Update of /cvsroot/arcem/arcem/arch
In directory vz-cvs-4.sog:/tmp/cvs-serv13637/arch
Modified Files:
ArcemConfig.c ArcemConfig.h ControlPane.h Version.h armarc.c
fdc1772.c filecommon.c hdc63463.c i2c.c paldisplaydev.c
stddisplaydev.c
Log Message:
* Add ControlPane_Error() function to allow errors to be reported in a
platform-specific way.
* Replace numerous fprintf(stderr,"Foo"); exit(1); calls with calls to
ControlPane_Error()
RISC OS specific changes:
* Add support for running in 32bpp modes (e.g. for Raspberry Pi)
* Allow tweak menu keys to be configured
* Fix stdout redirection preventing tweak menu from being visible!
Index: paldisplaydev.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/paldisplaydev.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- paldisplaydev.c 12 May 2012 17:34:51 -0000 1.3
+++ paldisplaydev.c 21 Oct 2012 16:59:32 -0000 1.4
@@ -1041,8 +1041,7 @@
EventQ_Remove(state,idx);
else
{
- fprintf(stderr,"Couldn't find PDD_Name(EventFunc)!\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Couldn't find PDD_Name(EventFunc)!\n");
}
free(state->Display);
state->Display = NULL;
Index: hdc63463.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/hdc63463.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- hdc63463.c 12 May 2012 17:34:51 -0000 1.15
+++ hdc63463.c 21 Oct 2012 16:59:32 -0000 1.16
@@ -28,6 +28,7 @@
#include "dbugsys.h"
#include "hdc63463.h"
#include "ArcemConfig.h"
+#include "ControlPane.h"
struct HDCReadDataStr {
uint8_t US,PHA,LCAH,LCAL,LHA,LSA,SCNTH,SCNTL;
@@ -444,9 +445,8 @@
dbug("SetFilePtr: drive=%d head=%u cyl=%u sec=%u\n", drive, head, cyl,
sect);
if (drive < 0 || drive > DIM(hArcemConfig.aST506DiskShapes)) {
- fprintf(stderr, "SetFilePtr: drive %d out of range 0..%d\n",
+ ControlPane_Error(1,"SetFilePtr: drive %d out of range 0..%d\n",
drive, (int) DIM(hArcemConfig.aST506DiskShapes));
- exit(1);
}
disc = hArcemConfig.aST506DiskShapes + drive;
@@ -1300,8 +1300,7 @@
char *fillbuffer; /* A buffer which holds a block of data to write */
if (fillbuffer=malloc(8192),fillbuffer==NULL) {
- fprintf(stderr,"HDC:WriteFormat_DoNextBufferFull: Couldn't allocate memory
for fillbuffer\n");
- exit(1);
+ ControlPane_Error(1,"HDC:WriteFormat_DoNextBufferFull: Couldn't allocate
memory for fillbuffer\n");
}
memset(fillbuffer,0x4e,8192);
Index: fdc1772.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/fdc1772.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- fdc1772.c 12 May 2012 17:34:51 -0000 1.33
+++ fdc1772.c 21 Oct 2012 16:59:32 -0000 1.34
@@ -1048,9 +1048,8 @@
static void efseek(FILE *fp, int32_t offset, int whence)
{
if (fseek(fp, offset, whence)) {
- fprintf(stderr, "efseek(%p, %ld, %d) failed.\n", fp, (long int) offset,
+ ControlPane_Error(1,"efseek(%p, %ld, %d) failed.\n", fp, (long int) offset,
whence);
- exit(1);
}
return;
Index: ArcemConfig.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/ArcemConfig.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ArcemConfig.c 12 May 2012 17:34:51 -0000 1.9
+++ ArcemConfig.c 21 Oct 2012 16:59:32 -0000 1.10
@@ -18,6 +18,7 @@
#include "ArcemConfig.h"
#include "Version.h"
+#include "ControlPane.h"
#ifdef AMIGA
#include <workbench/startup.h>
@@ -49,8 +50,7 @@
hArcemConfig.sRomImageName = arcemconfig_StringDuplicate("ROM");
// If we've run out of memory this early, something is very wrong
if(NULL == hArcemConfig.sRomImageName) {
- fprintf(stderr, "Failed to allocate memory for initial configuration.
Please free up more memory.\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Failed to allocate memory for initial
configuration. Please free up more memory.\n");
}
#if defined(EXTNROM_SUPPORT)
@@ -58,8 +58,7 @@
hArcemConfig.sEXTNDirectory = arcemconfig_StringDuplicate("extnrom");
// If we've run out of memory this early, something is very wrong
if(NULL == hArcemConfig.sEXTNDirectory) {
- fprintf(stderr, "Failed to allocate memory for initial configuration.
Please free up more memory.\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Failed to allocate memory for initial
configuration. Please free up more memory.\n");
}
#endif /* EXTNROM_SUPPORT */
@@ -72,8 +71,7 @@
#endif
// If we've run out of memory this early, something is very wrong
if(NULL == hArcemConfig.sHostFSDirectory) {
- fprintf(stderr, "Failed to allocate memory for initial configuration.
Please free up more memory.\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Failed to allocate memory for initial
configuration. Please free up more memory.\n");
}
#endif /* HOSTFS_SUPPORT */
@@ -92,6 +90,8 @@
hArcemConfig.iMinResY = 0;
hArcemConfig.iLCDResX = 0;
hArcemConfig.iLCDResY = 0;
+ hArcemConfig.iTweakMenuKey1 = 104; /* Left windows key */
+ hArcemConfig.iTweakMenuKey2 = 105; /* Right windows key */
#endif
}
@@ -127,7 +127,7 @@
" --processor <value> - Set the emulated CPU\n"
" Where value is one of 'ARM2', 'ARM250', 'ARM3'\n"
#if defined(SYSTEM_riscos_single)
- " --display <mode> - Select display driver, 'pal' or '16bpp'\n"
+ " --display <mode> - Select display driver, 'pal' or 'std'\n"
" --rbswap - Swap red & blue in 16bpp mode (e.g. for Iyonix with GeForce
FX)\n"
" --noaspect - Disable aspect ratio correction\n"
" --noupscale - Disable upscaling\n"
@@ -135,6 +135,7 @@
" --minres <x> <y> - Specify dimensions of smallest screen mode to use\n"
" --lcdres <x> <y> - Specify native resolution of your monitor (to avoid
using\n"
" modes that won't scale well on an LCD)\n"
+ " --menukeys <a> <b> - Specify which key numbers open the tweak menu\n"
#endif /* SYSTEM_riscos_single */
;
@@ -182,9 +183,7 @@
iArgument += 2;
} else {
// No argument following the --rom option
- fprintf(stderr, "No argument following the --rom option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --rom
option\n");
}
}
#if defined(EXTNROM_SUPPORT)
@@ -203,9 +202,7 @@
iArgument += 2;
} else {
// No argument following the --extnromdir option
- fprintf(stderr, "No argument following the --extnromdir option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --extnromdir
option\n");
}
}
#endif /* EXTNROM_SUPPORT */
@@ -225,9 +222,7 @@
iArgument += 2;
} else {
// No argument following the --hostfsdir option
- fprintf(stderr, "No argument following the --hostfsdir option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --hostfsdir
option\n");
}
}
#endif /* HOSTFS_SUPPORT */
@@ -274,16 +269,12 @@
iArgument += 2;
}
else {
- fprintf(stderr, "Unrecognised value to the --memory option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Unrecognised value to the --memory
option\n");
}
} else {
// No argument following the --memory option
- fprintf(stderr, "No argument following the --memory option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --memory
option\n");
}
}
else if(0 == strcmp("--processor", argv[iArgument])) {
@@ -304,15 +295,11 @@
iArgument += 2;
}
else {
- fprintf(stderr, "Unrecognised value to the --processor option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Unrecognised value to the
--processor option\n");
}
} else {
// No argument following the --processor option
- fprintf(stderr, "No argument following the --processor option\n");
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --processor
option\n");
}
}
#if defined(SYSTEM_riscos_single)
@@ -322,17 +309,15 @@
hArcemConfig.eDisplayDriver = DisplayDriver_Palettised;
iArgument += 2;
}
- else if(0 == strcmp("16bpp", argv[iArgument + 1])) {
+ else if(0 == strcmp("std", argv[iArgument + 1])) {
hArcemConfig.eDisplayDriver = DisplayDriver_Standard;
iArgument += 2;
}
else {
- fprintf(stderr, "Unrecognised value to the --display option\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Unrecognised value to the --display
option\n");
}
} else {
- fprintf(stderr, "No argument following the --display option\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"No argument following the --display
option\n");
}
} else if(0 == strcmp("--rbswap",argv[iArgument])) {
hArcemConfig.bRedBlueSwap = true;
@@ -352,8 +337,7 @@
hArcemConfig.iMinResY = atoi(argv[iArgument+2]);
iArgument += 3;
} else {
- fprintf(stderr, "Not enough arguments following the --minres
option\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Not enough arguments following the
--minres option\n");
}
} else if(0 == strcmp("--lcdres",argv[iArgument])) {
if(iArgument+2 < argc) {
@@ -361,15 +345,20 @@
hArcemConfig.iLCDResY = atoi(argv[iArgument+2]);
iArgument += 3;
} else {
- fprintf(stderr, "Not enough arguments following the --lcdres
option\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Not enough arguments following the
--lcdres option\n");
+ }
+ } else if(0 == strcmp("--menukeys",argv[iArgument])) {
+ if(iArgument+2 < argc) {
+ hArcemConfig.iTweakMenuKey1 = atoi(argv[iArgument+1]);
+ hArcemConfig.iTweakMenuKey2 = atoi(argv[iArgument+2]);
+ iArgument += 3;
+ } else {
+ ControlPane_Error(EXIT_FAILURE,"Not enough arguments following the
--menukeys option\n");
}
}
#endif /* SYSTEM_riscos_single */
else {
- fprintf(stderr, "Unrecognised option '%s', try --help\n",
argv[iArgument]);
-
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Unrecognised option '%s', try --help\n",
argv[iArgument]);
}
}
}
Index: filecommon.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/filecommon.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- filecommon.c 21 Jul 2012 01:01:11 -0000 1.4
+++ filecommon.c 21 Oct 2012 16:59:32 -0000 1.5
@@ -16,6 +16,7 @@
#include "armarc.h"
#include "filecalls.h"
#include "displaydev.h"
+#include "ControlPane.h"
#define USE_FILEBUFFER
@@ -37,9 +38,8 @@
if (buffer_size_needed > buffer_size) {
buffer = realloc(buffer, buffer_size_needed);
if (!buffer) {
- fprintf(stderr, "filecommon could not increase buffer size to %u
bytes\n",
+ ControlPane_Error(EXIT_FAILURE,"filecommon could not increase buffer
size to %u bytes\n",
(ARMword) buffer_size_needed);
- exit(EXIT_FAILURE);
}
buffer_size = buffer_size_needed;
}
Index: Version.h
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/Version.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Version.h 11 Dec 2005 23:56:32 -0000 1.7
+++ Version.h 21 Oct 2012 16:59:32 -0000 1.8
@@ -1 +1 @@
-static const char Version[] = "Version 1.10 (11/12/2005) + CVS";
+static const char Version[] = "Version 1.50 alpha (21/10/2012) + CVS";
Index: i2c.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/i2c.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- i2c.c 21 Jul 2012 01:01:11 -0000 1.15
+++ i2c.c 21 Oct 2012 16:59:32 -0000 1.16
@@ -14,6 +14,7 @@
#include "i2c.h"
#include "dbugsys.h"
+#include "ControlPane.h"
/*
static const char *I2CStateNameTrans[] = {"Idle",
@@ -162,27 +163,22 @@
int loop,dest;
unsigned char val;
FILE *OutFile;
+ const char *filename;
#ifdef __riscos__
- OutFile = fopen("<ArcEm$Dir>.hexcmos", "w");
- if (OutFile == NULL) {
- fprintf(stderr,"SaveCMOS: Could not open CMOS file for writing\n");
- return;
- }
+ filename = "<ArcEm$Dir>.hexcmos";
#else
+ filename = "hexcmos";
+#endif
+
#ifdef MACOSX
- {
- chdir(arcemDir);
- OutFile = fopen("hexcmos","w");
- }
-#else
- OutFile = fopen("hexcmos","w");
+ chdir(arcemDir);
#endif
+
+ OutFile = fopen(filename,"w");
if (OutFile == NULL) {
- fprintf(stderr,"SaveCMOS: Could not open (hexcmos.updated) CMOS settings
file\n");
- exit(1);
+ ControlPane_Error(1,"SaveCMOS: Could not open CMOS settings file (%s)\n",
filename);
};
-#endif
for (loop = 0; loop < 240; loop++) {
dest = loop + 64;
@@ -446,9 +442,8 @@
for (byte = 0; byte < 240; byte++) {
if (fp) {
if (fscanf(fp, "%x\n", &val) != 1) {
- fprintf(stderr, "arcem: failed to read value %d of %s\n",
+ ControlPane_Error(1,"arcem: failed to read CMOS value %d of
%s\n",
byte, path);
- exit(1);
}
} else {
val = CMOSDefaults[byte];
Index: ControlPane.h
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/ControlPane.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ControlPane.h 21 Dec 2004 22:08:09 -0000 1.5
+++ ControlPane.h 21 Oct 2012 16:59:32 -0000 1.6
@@ -13,4 +13,7 @@
void ControlPane_Event(ARMul_State *state, XEvent *e);
#endif
+/* Report an error and exit */
+void ControlPane_Error(int code,const char *fmt,...);
+
#endif
Index: armarc.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/armarc.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- armarc.c 21 Jul 2012 01:01:11 -0000 1.40
+++ armarc.c 21 Oct 2012 16:59:32 -0000 1.41
@@ -31,12 +31,12 @@
#include "sound.h"
#include "displaydev.h"
#include "filecalls.h"
+#include "ControlPane.h"
#ifdef MACOSX
#include <unistd.h>
extern char arcemDir[256];
-void arcem_exit(char* msg);
#endif
/* Page size flags */
@@ -198,7 +198,7 @@
#if defined(EXTNROM_SUPPORT)
uint32_t extnrom_entry_count;
#endif
- uint32_t initmemsize;
+ uint32_t initmemsize = 0;
MEMC.DRAMPageSize = MEMC_PAGESIZE_3_32K;
switch(hArcemConfig.eMemSize) {
@@ -244,8 +244,7 @@
break;
default:
- fprintf(stderr, "Unsupported memory size");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Unsupported memory size");
}
dbug("Reading config file....\n");
@@ -271,15 +270,10 @@
{
chdir(arcemDir);
}
+#endif
if (ROMFile = fopen(hArcemConfig.sRomImageName, "rb"), ROMFile == NULL) {
- arcem_exit("Couldn't open ROM file");
- }
-#else
- if (ROMFile = fopen(hArcemConfig.sRomImageName, "rb"), ROMFile == NULL) {
- fprintf(stderr, "Couldn't open ROM file\n");
- exit(2);
+ ControlPane_Error(2,"Couldn't open ROM file");
}
-#endif
/* Find the rom file size */
fseek(ROMFile, 0l, SEEK_END);
@@ -288,8 +282,7 @@
MEMC.ROMHighMask = MEMC.ROMHighSize-1;
if(MEMC.ROMHighSize & MEMC.ROMHighMask) {
- fprintf(stderr,"ROM High isn't power of 2 in size\n");
- exit(3);
+ ControlPane_Error(3,"ROM High isn't power of 2 in size\n");
}
fseek(ROMFile, 0l, SEEK_SET);
@@ -308,8 +301,7 @@
MEMC.ROMRAMChunk = calloc(RAMChunkSize+MEMC.ROMHighSize+extnrom_size+256,1);
MEMC.EmuFuncChunk =
calloc(RAMChunkSize+MEMC.ROMHighSize+extnrom_size+256,sizeof(FastMapUInt)/4);
if((MEMC.ROMRAMChunk == NULL) || (MEMC.EmuFuncChunk == NULL)) {
- fprintf(stderr,"Couldn't allocate ROMRAMChunk/EmuFuncChunk\n");
- exit(3);
+ ControlPane_Error(3,"Couldn't allocate ROMRAMChunk/EmuFuncChunk\n");
}
#ifdef FASTMAP_64
/* On 64bit systems, ROMRAMChunk needs shifting to account for the shift
that occurs in FastMap_Phy2Func */
@@ -334,8 +326,7 @@
MEMC.ROMLowMask = MEMC.ROMLowSize-1;
if(MEMC.ROMLowSize & MEMC.ROMLowMask) {
- fprintf(stderr,"ROM Low isn't power of 2 in size\n");
- exit(3);
+ ControlPane_Error(3,"ROM Low isn't power of 2 in size\n");
}
/* calloc() now used to ensure that Extension ROM space is zero'ed */
@@ -355,14 +346,12 @@
if (DisplayDev_Init(state)) {
/* There was an error of some sort - it will already have been reported */
- fprintf(stderr, "Could not initialise display - exiting\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Could not initialise display - exiting\n");
}
if (Sound_Init(state)) {
/* There was an error of some sort - it will already have been reported */
- fprintf(stderr, "Could not initialise sound output - exiting\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Could not initialise sound output -
exiting\n");
}
for (i = 0; i < 512 * 1024 / UPDATEBLOCKSIZE; i++) {
Index: stddisplaydev.c
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/stddisplaydev.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- stddisplaydev.c 30 Jul 2012 21:26:24 -0000 1.5
+++ stddisplaydev.c 21 Oct 2012 16:59:32 -0000 1.6
@@ -1647,7 +1647,7 @@
}
}
-static const SDD_Name(RowFunc) RowFuncs[2][4] = {
+static const SDD_Name(RowFunc) SDD_Name(RowFuncs)[2][4] = {
{ /* 1X horizontal scaling */
SDD_Name(RowFunc1bpp1X),
SDD_Name(RowFunc2bpp1X),
@@ -1719,7 +1719,7 @@
}
drow = SDD_Name(Host_BeginRow)(state,hoststart++,HD.XOffset);
- rf = &RowFuncs[HD.XScale-1][(DC.VIDC_CR&0xc)>>2];
+ rf = &SDD_Name(RowFuncs)[HD.XScale-1][(DC.VIDC_CR&0xc)>>2];
if(hoststart == hostend)
{
if((*rf)(state,row,drow,rowflags | ROWFUNC_UPDATEFLAGS))
@@ -1751,7 +1751,7 @@
}
}
-static const SDD_Name(RowFuncNoFlags) RowFuncsNoFlags[2][4] = {
+static const SDD_Name(RowFuncNoFlags) SDD_Name(RowFuncsNoFlags)[2][4] = {
{ /* 1X horizontal scaling */
SDD_Name(RowFunc1bpp1XNoFlags),
SDD_Name(RowFunc2bpp1XNoFlags),
@@ -1810,7 +1810,7 @@
/* Display area */
- rf = &RowFuncsNoFlags[HD.XScale-1][(DC.VIDC_CR&0xc)>>2];
+ rf = &SDD_Name(RowFuncsNoFlags)[HD.XScale-1][(DC.VIDC_CR&0xc)>>2];
/* Remember current Vptr */
Vptr = DC.Vptr;
do
@@ -2451,8 +2451,7 @@
EventQ_Remove(state,idx);
else
{
- fprintf(stderr,"Couldn't find SDD event func!\n");
- exit(EXIT_FAILURE);
+ ControlPane_Error(EXIT_FAILURE,"Couldn't find SDD event func!\n");
}
free(state->Display);
state->Display = NULL;
Index: ArcemConfig.h
===================================================================
RCS file: /cvsroot/arcem/arcem/arch/ArcemConfig.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ArcemConfig.h 12 May 2012 17:34:51 -0000 1.6
+++ ArcemConfig.h 21 Oct 2012 16:59:32 -0000 1.7
@@ -87,6 +87,7 @@
bool bNoLowColour; /* Disable 1/2/4bpp modes */
int iMinResX,iMinResY;
int iLCDResX,iLCDResY;
+ int iTweakMenuKey1,iTweakMenuKey2;
#endif
} ArcemConfig;
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
--
arcem-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/arcem-cvs