- Removed BOOL and replaced it with native C++ type, bool.

- Removed TRUE and FALSE, changed to 'true' and 'false' keywords.
This commit is contained in:
Bart Trzynadlowski 2011-09-08 06:34:18 +00:00
parent abd86a5624
commit 11d1d61bc2
55 changed files with 1895 additions and 1893 deletions

View file

@ -170,7 +170,7 @@ void CBlockFile::NewBlock(const char *name, const char *comment)
WriteBlockHeader(name, comment); WriteBlockHeader(name, comment);
} }
BOOL CBlockFile::FindBlock(const char *name) bool CBlockFile::FindBlock(const char *name)
{ {
long int curPos = 0; long int curPos = 0;
unsigned blockLen, nameLen, commentLen; unsigned blockLen, nameLen, commentLen;
@ -208,7 +208,7 @@ BOOL CBlockFile::FindBlock(const char *name)
return FAIL; return FAIL;
} }
BOOL CBlockFile::Create(const char *file, const char *headerName, const char *comment) bool CBlockFile::Create(const char *file, const char *headerName, const char *comment)
{ {
fp = fopen(file, "wb"); fp = fopen(file, "wb");
if (NULL == fp) if (NULL == fp)
@ -218,7 +218,7 @@ BOOL CBlockFile::Create(const char *file, const char *headerName, const char *co
return OKAY; return OKAY;
} }
BOOL CBlockFile::Load(const char *file) bool CBlockFile::Load(const char *file)
{ {
fp = fopen(file, "rb"); fp = fopen(file, "rb");
if (NULL == fp) if (NULL == fp)

View file

@ -70,7 +70,7 @@ public:
* Returns: * Returns:
* OKAY if found, FAIL if unable to locate. * OKAY if found, FAIL if unable to locate.
*/ */
BOOL FindBlock(const char *name); bool FindBlock(const char *name);
/* /*
* Write(data, numBytes): * Write(data, numBytes):
@ -112,7 +112,7 @@ public:
* Returns: * Returns:
* OKAY if successfully opened, otherwise FAIL. * OKAY if successfully opened, otherwise FAIL.
*/ */
BOOL Create(const char *file, const char *headerName, const char *comment); bool Create(const char *file, const char *headerName, const char *comment);
/* /*
* Load(file): * Load(file):
@ -128,7 +128,7 @@ public:
* subsequent operations will be silently ignored (reads will return * subsequent operations will be silently ignored (reads will return
* 0's). Write commands will be ignored. * 0's). Write commands will be ignored.
*/ */
BOOL Load(const char *file); bool Load(const char *file);
/* /*
* Close(void): * Close(void):

View file

@ -248,7 +248,7 @@ void M68KSetContext(M68KCtx *Src)
// One-time initialization // One-time initialization
BOOL M68KInit(void) bool M68KInit(void)
{ {
m68k_init(); m68k_init();
m68k_set_cpu_type(M68K_CPU_TYPE_68000); m68k_set_cpu_type(M68K_CPU_TYPE_68000);

View file

@ -211,7 +211,7 @@ extern void M68KAttachBus(CBus *BusPtr);
* Returns: * Returns:
* Always returns OKAY. * Always returns OKAY.
*/ */
extern BOOL M68KInit(void); extern bool M68KInit(void);
/* /*
* M68KGetContext(M68KCtx *Dest): * M68KGetContext(M68KCtx *Dest):

View file

@ -526,7 +526,7 @@ static void SPR(char *dest, unsigned spr_field)
* Predecodes the SIMM field for us. If do_unsigned, it is printed as an * Predecodes the SIMM field for us. If do_unsigned, it is printed as an
* unsigned 32-bit integer. * unsigned 32-bit integer.
*/ */
static void DecodeSigned16(char *outbuf, UINT32 op, BOOL do_unsigned) static void DecodeSigned16(char *outbuf, UINT32 op, bool do_unsigned)
{ {
INT16 s; INT16 s;
@ -573,7 +573,7 @@ static UINT32 Mask(unsigned mb, unsigned me)
* Perform checks on the instruction as required by the flags. Returns 1 if * Perform checks on the instruction as required by the flags. Returns 1 if
* the instruction failed. * the instruction failed.
*/ */
static BOOL Check(UINT32 op, unsigned flags) static bool Check(UINT32 op, unsigned flags)
{ {
unsigned nb, rt, ra; unsigned nb, rt, ra;
@ -634,7 +634,7 @@ static BOOL Check(UINT32 op, unsigned flags)
* Handles all simplified instruction forms. Returns 1 if one was decoded, * Handles all simplified instruction forms. Returns 1 if one was decoded,
* otherwise 0 to indicate disassembly should carry on as normal. * otherwise 0 to indicate disassembly should carry on as normal.
*/ */
static BOOL Simplified(UINT32 op, UINT32 vpc, char *signed16, char *mnem, char *oprs) static bool Simplified(UINT32 op, UINT32 vpc, char *signed16, char *mnem, char *oprs)
{ {
UINT32 value, disp; UINT32 value, disp;
@ -806,8 +806,8 @@ static BOOL Simplified(UINT32 op, UINT32 vpc, char *signed16, char *mnem, char *
* Zero if successful, non-zero if the instruction was unrecognized or * Zero if successful, non-zero if the instruction was unrecognized or
* had an invalid form (see note above in function description.) * had an invalid form (see note above in function description.)
*/ */
BOOL DisassemblePowerPC(UINT32 op, UINT32 vpc, char *mnem, char *oprs, bool DisassemblePowerPC(UINT32 op, UINT32 vpc, char *mnem, char *oprs,
BOOL simplify) bool simplify)
{ {
char signed16[12]; char signed16[12];
UINT32 disp; UINT32 disp;
@ -1135,7 +1135,7 @@ int main(int argc, char **argv)
UINT8 *buffer; UINT8 *buffer;
unsigned i, fsize, start = 0, len, org, file = 0; unsigned i, fsize, start = 0, len, org, file = 0;
UINT32 op; UINT32 op;
BOOL len_specified = 0, org_specified = 0, little = 0, simple = 1; bool len_specified = 0, org_specified = 0, little = 0, simple = 1;
char *c; char *c;

View file

@ -52,7 +52,7 @@
* OKAY if successful, FAIL if the instruction was unrecognized or had an * OKAY if successful, FAIL if the instruction was unrecognized or had an
* invalid form (see note above in function description.) * invalid form (see note above in function description.)
*/ */
extern BOOL DisassemblePowerPC(UINT32 op, UINT32 vpc, char *mnem, char *oprs, extern bool DisassemblePowerPC(UINT32 op, UINT32 vpc, char *mnem, char *oprs,
BOOL simplify); bool simplify);
#endif // INCLUDED_PPCDISASM_H #endif // INCLUDED_PPCDISASM_H

View file

@ -175,7 +175,7 @@ typedef struct {
typedef struct { typedef struct {
BOOL fatalError; // if true, halt PowerPC until hard reset bool fatalError; // if true, halt PowerPC until hard reset
UINT32 r[32]; UINT32 r[32];
UINT32 pc; UINT32 pc;
@ -306,7 +306,7 @@ static void ppc_change_pc(UINT32 newpc)
DebugLog("Invalid PC %08X, previous PC %08X\n", newpc, ppc.pc); DebugLog("Invalid PC %08X, previous PC %08X\n", newpc, ppc.pc);
ErrorLog("PowerPC is out of bounds. Halting emulation until reset."); ErrorLog("PowerPC is out of bounds. Halting emulation until reset.");
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
INLINE UINT8 READ8(UINT32 address) INLINE UINT8 READ8(UINT32 address)
@ -551,7 +551,7 @@ INLINE void ppc_set_spr(int spr, UINT32 value)
ErrorLog("PowerPC wrote to an invalid register. Halting emulation until reset."); ErrorLog("PowerPC wrote to an invalid register. Halting emulation until reset.");
DebugLog("ppc: set_spr: unknown spr %d (%03X) !\n", spr, spr); DebugLog("ppc: set_spr: unknown spr %d (%03X) !\n", spr, spr);
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
INLINE UINT32 ppc_get_spr(int spr) INLINE UINT32 ppc_get_spr(int spr)
@ -613,7 +613,7 @@ INLINE UINT32 ppc_get_spr(int spr)
ErrorLog("PowerPC read from an invalid register. Halting emulation until reset."); ErrorLog("PowerPC read from an invalid register. Halting emulation until reset.");
DebugLog("ppc: get_spr: unknown spr %d (%03X) !\n", spr, spr); DebugLog("ppc: get_spr: unknown spr %d (%03X) !\n", spr, spr);
ppc.fatalError = TRUE; ppc.fatalError = true;
return 0; return 0;
} }
@ -623,7 +623,7 @@ INLINE void ppc_set_msr(UINT32 value)
{ {
ErrorLog("PowerPC entered an unemulated mode. Halting emulation until reset."); ErrorLog("PowerPC entered an unemulated mode. Halting emulation until reset.");
DebugLog("ppc: set_msr: little_endian mode not supported !\n"); DebugLog("ppc: set_msr: little_endian mode not supported !\n");
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
MSR = value; MSR = value;

View file

@ -201,7 +201,7 @@ void ppc603_exception(int exception)
default: default:
ErrorLog("PowerPC triggered an unknown exception. Emulation halted until reset."); ErrorLog("PowerPC triggered an unknown exception. Emulation halted until reset.");
DebugLog("PowerPC triggered an unknown exception (%d).\n", exception); DebugLog("PowerPC triggered an unknown exception (%d).\n", exception);
ppc.fatalError = TRUE; ppc.fatalError = true;
break; break;
} }
} }
@ -237,7 +237,7 @@ static void ppc603_check_interrupts(void)
void ppc_reset(void) void ppc_reset(void)
{ {
ppc.fatalError = FALSE; // reset the fatal error flag ppc.fatalError = false; // reset the fatal error flag
ppc.pc = ppc.npc = 0xfff00100; ppc.pc = ppc.npc = 0xfff00100;
@ -272,7 +272,7 @@ int ppc_execute(int cycles)
char string1[200]; char string1[200];
char string2[200]; char string2[200];
opcode = BSWAP32(*ppc.op); opcode = BSWAP32(*ppc.op);
DisassemblePowerPC(opcode, ppc.npc, string1, string2, TRUE); DisassemblePowerPC(opcode, ppc.npc, string1, string2, true);
printf("%08X: %s %s\n", ppc.npc, string1, string2); printf("%08X: %s %s\n", ppc.npc, string1, string2);
}*/ }*/
// printf("trigger cycle %d (%08X)\n", ppc_dec_trigger_cycle, ppc_dec_trigger_cycle); // printf("trigger cycle %d (%08X)\n", ppc_dec_trigger_cycle, ppc_dec_trigger_cycle);
@ -333,7 +333,7 @@ int ppc_execute(int cycles)
char string1[200]; char string1[200];
char string2[200]; char string2[200];
opcode = BSWAP32(*ppc.op); opcode = BSWAP32(*ppc.op);
DisassemblePowerPC(opcode, ppc.npc, string1, string2, TRUE); DisassemblePowerPC(opcode, ppc.npc, string1, string2, true);
printf("%08X: %s %s\n", ppc.npc, string1, string2); printf("%08X: %s %s\n", ppc.npc, string1, string2);
} }
*/ */

View file

@ -38,7 +38,7 @@ static void ppc_unimplemented(UINT32 op)
{ {
ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset."); ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset.");
DebugLog("PowerPC encountered an unimplemented opcode %08X at %08X\n", op, ppc.pc); DebugLog("PowerPC encountered an unimplemented opcode %08X at %08X\n", op, ppc.pc);
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
static void ppc_addx(UINT32 op) static void ppc_addx(UINT32 op)
@ -769,7 +769,7 @@ static void ppc_lswx(UINT32 op)
{ {
ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset."); ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset.");
DebugLog("ppc: lswx unimplemented at %08X\n", ppc.pc); DebugLog("ppc: lswx unimplemented at %08X\n", ppc.pc);
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
static void ppc_lwarx(UINT32 op) static void ppc_lwarx(UINT32 op)
@ -1285,7 +1285,7 @@ static void ppc_stswx(UINT32 op)
{ {
ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset."); ErrorLog("PowerPC hit an unimplemented instruction. Halting emulation until reset.");
DebugLog("ppc: stswx unimplemented\n"); DebugLog("ppc: stswx unimplemented\n");
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
static void ppc_stw(UINT32 op) static void ppc_stw(UINT32 op)
@ -1553,7 +1553,7 @@ static void ppc_invalid(UINT32 op)
{ {
ErrorLog("PowerPC hit an invalid instruction. Halting emulation until reset."); ErrorLog("PowerPC hit an invalid instruction. Halting emulation until reset.");
DebugLog("ppc: Invalid opcode %08X PC : %X, %08X\n", op, ppc.pc, ppc.npc); DebugLog("ppc: Invalid opcode %08X PC : %X, %08X\n", op, ppc.pc, ppc.npc);
ppc.fatalError = TRUE; ppc.fatalError = true;
} }
@ -1964,7 +1964,7 @@ static void ppc_mftb(UINT32 op)
default: default:
ErrorLog("PowerPC read from an invalid register. Halting emulation until reset."); ErrorLog("PowerPC read from an invalid register. Halting emulation until reset.");
DebugLog("ppc: Invalid timebase register %d at %08X\n", x, ppc.pc); DebugLog("ppc: Invalid timebase register %d at %08X\n", x, ppc.pc);
ppc.fatalError = TRUE; ppc.fatalError = true;
break; break;
} }
} }

View file

@ -3621,7 +3621,7 @@ int CZ80::Run(int numCycles)
pc = 0x0066; pc = 0x0066;
iff = (iff&~2) | ((iff&1)<<1); iff = (iff&~2) | ((iff&1)<<1);
iff &= ~1; iff &= ~1;
nmiTrigger = FALSE; // clear NMI nmiTrigger = false; // clear NMI
// TODO: if in HALTed state, un-halt // TODO: if in HALTed state, un-halt
} }
else if (intLine) // INT asserted else if (intLine) // INT asserted
@ -3679,7 +3679,7 @@ int CZ80::Run(int numCycles)
} }
} }
else // if no callback, do nothing, clear INT line else // if no callback, do nothing, clear INT line
intLine = FALSE; intLine = false;
break; break;
case 1: case 1:
/* /*
@ -3693,7 +3693,7 @@ int CZ80::Run(int numCycles)
if (NULL != INTCallback) if (NULL != INTCallback)
INTCallback(this); INTCallback(this);
else // no callback, clear INT line automatically else // no callback, clear INT line automatically
intLine = FALSE; intLine = false;
break; break;
case 2: case 2:
/* /*
@ -3712,10 +3712,10 @@ int CZ80::Run(int numCycles)
iff = 0; iff = 0;
} }
else // if no callback, do nothing, clear INT line else // if no callback, do nothing, clear INT line
intLine = FALSE; intLine = false;
break; break;
default: // should never happen (nothing will be done) default: // should never happen (nothing will be done)
intLine = FALSE; intLine = false;
break; break;
} }
} }
@ -3734,10 +3734,10 @@ HALTExit:
void CZ80::TriggerNMI(void) void CZ80::TriggerNMI(void)
{ {
nmiTrigger = TRUE; nmiTrigger = true;
} }
void CZ80::SetINT(BOOL state) void CZ80::SetINT(bool state)
{ {
intLine = state; intLine = state;
} }
@ -3768,8 +3768,8 @@ void CZ80::Reset(void)
af_sel = 0; af_sel = 0;
regs_sel = 0; regs_sel = 0;
intLine = FALSE; intLine = false;
nmiTrigger = FALSE; nmiTrigger = false;
} }
void CZ80::SaveState(CBlockFile *StateFile, const char *name) void CZ80::SaveState(CBlockFile *StateFile, const char *name)

View file

@ -103,11 +103,11 @@ public:
* callbacks to clear interrupts. * callbacks to clear interrupts.
* *
* Parameters: * Parameters:
* state If TRUE, this is equivalent to /INT being asserted on the * state If true, this is equivalent to /INT being asserted on the
* Z80 (INT line low, which triggers an interrupt). If FALSE, * Z80 (INT line low, which triggers an interrupt). If false,
* this deasserts /INT (INT line high, no interrupt pending). * this deasserts /INT (INT line high, no interrupt pending).
*/ */
void SetINT(BOOL state); void SetINT(bool state);
/* /*
* GetPC(void): * GetPC(void):
@ -161,7 +161,7 @@ public:
* *
* An interrupt callback, which is called each time an interrupt occurs, * An interrupt callback, which is called each time an interrupt occurs,
* should also be supplied. The interrupt callback should explicitly clear * should also be supplied. The interrupt callback should explicitly clear
* the INT status (using SetINT(FALSE)) and then return the appropriate * the INT status (using SetINT(false)) and then return the appropriate
* vector depending on the interrupt mode that is used by the system. * vector depending on the interrupt mode that is used by the system.
* *
* For mode 0, only Z80_INT_RST_* values are acceptable. For mode 1, the * For mode 0, only Z80_INT_RST_* values are acceptable. For mode 1, the
@ -214,8 +214,8 @@ private:
CBus *Bus; CBus *Bus;
// Interrupts // Interrupts
BOOL nmiTrigger; bool nmiTrigger;
BOOL intLine; bool intLine;
int (*INTCallback)(CZ80 *Z80); int (*INTCallback)(CZ80 *Z80);
}; };

View file

@ -301,7 +301,7 @@ namespace Debugger
char valStr[40]; char valStr[40];
UINT32 opcode = m_bus->Read32(addr); UINT32 opcode = m_bus->Read32(addr);
operands[0] = '\0'; operands[0] = '\0';
if (!::DisassemblePowerPC(opcode, addr, mnemonic, opStr, TRUE)) if (!::DisassemblePowerPC(opcode, addr, mnemonic, opStr, true))
{ {
char *o = opStr; char *o = opStr;
char *s = strstr(o, "0x"); char *s = strstr(o, "0x");

View file

@ -113,7 +113,7 @@ namespace Debugger
DetachFromCPU(); DetachFromCPU();
} }
BOOL __cdecl DebugHandler(TURBO68K_INT32 pc, TURBO68K_INT32 opcode) bool __cdecl DebugHandler(TURBO68K_INT32 pc, TURBO68K_INT32 opcode)
{ {
// Return true to let Turbo68K know if PC was changed by user // Return true to let Turbo68K know if PC was changed by user
return debug->CheckExecution((UINT32)pc, (UINT32)opcode); return debug->CheckExecution((UINT32)pc, (UINT32)opcode);

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@ struct GameInfo
unsigned year; // year released (in decimal) unsigned year; // year released (in decimal)
int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1 int step; // Model 3 hardware stepping: 0x10 = 1.0, 0x15 = 1.5, 0x20 = 2.0, 0x21 = 2.1
unsigned cromSize; // size of fixed CROM (up to 8 MB) unsigned cromSize; // size of fixed CROM (up to 8 MB)
BOOL mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB bool mirrorLow64MB; // mirror low 64 MB of banked CROM space to upper 64 MB
unsigned vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored) unsigned vromSize; // size of video ROMs (32 or 64 MB; if 32 MB, will have to be mirrored)
unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored) unsigned sampleSize; // size of sample ROMS (8 or 16 MB; if 8 MB, will have to be mirrored)
unsigned inputFlags; // game input types unsigned inputFlags; // game input types

View file

@ -40,7 +40,7 @@
// Overflow in the local vertex buffer, which holds one model // Overflow in the local vertex buffer, which holds one model
BOOL CRender3D::ErrorLocalVertexOverflow(void) bool CRender3D::ErrorLocalVertexOverflow(void)
{ {
if ((errorMsgFlags&ERROR_LOCAL_VERTEX_OVERFLOW)) if ((errorMsgFlags&ERROR_LOCAL_VERTEX_OVERFLOW))
return FAIL; return FAIL;
@ -49,7 +49,7 @@ BOOL CRender3D::ErrorLocalVertexOverflow(void)
} }
// Model could not be cached, even after dumping display list and re-caching // Model could not be cached, even after dumping display list and re-caching
BOOL CRender3D::ErrorUnableToCacheModel(UINT32 modelAddr) bool CRender3D::ErrorUnableToCacheModel(UINT32 modelAddr)
{ {
if ((errorMsgFlags&ERROR_UNABLE_TO_CACHE_MODEL)) if ((errorMsgFlags&ERROR_UNABLE_TO_CACHE_MODEL))
return FAIL; return FAIL;

View file

@ -145,7 +145,7 @@ void CRender3D::DrawDisplayList(ModelCache *Cache, POLY_STATE state)
} }
// Appends an instance of a model or viewport to the display list, copying over the required state information // Appends an instance of a model or viewport to the display list, copying over the required state information
BOOL CRender3D::AppendDisplayList(ModelCache *Cache, BOOL isViewport, const struct VBORef *Model) bool CRender3D::AppendDisplayList(ModelCache *Cache, bool isViewport, const struct VBORef *Model)
{ {
int lm, i; int lm, i;
@ -363,11 +363,11 @@ void CRender3D::InsertVertex(ModelCache *Cache, const Vertex *V, const Poly *P,
Cache->vboCurOffset += VBO_VERTEX_SIZE*sizeof(GLfloat); Cache->vboCurOffset += VBO_VERTEX_SIZE*sizeof(GLfloat);
} }
BOOL CRender3D::InsertPolygon(ModelCache *Cache, const Poly *P) bool CRender3D::InsertPolygon(ModelCache *Cache, const Poly *P)
{ {
GLfloat n[3], v1[3], v2[3], normZFlip; GLfloat n[3], v1[3], v2[3], normZFlip;
int i; int i;
BOOL doubleSided; bool doubleSided;
// Bounds testing: up to 12 triangles will be inserted (worst case: double sided quad is 6 triangles) // Bounds testing: up to 12 triangles will be inserted (worst case: double sided quad is 6 triangles)
if ((Cache->curVertIdx[P->state]+6*2) >= Cache->maxVertIdx) if ((Cache->curVertIdx[P->state]+6*2) >= Cache->maxVertIdx)
@ -376,7 +376,7 @@ BOOL CRender3D::InsertPolygon(ModelCache *Cache, const Poly *P)
return FAIL; // this just indicates we may need to re-cache return FAIL; // this just indicates we may need to re-cache
// Is the polygon double sided? // Is the polygon double sided?
doubleSided = (P->header[1]&0x10) ? TRUE : FALSE; doubleSided = (P->header[1]&0x10) ? true : false;
/* /*
* Determine polygon winding by taking cross product of vectors formed from * Determine polygon winding by taking cross product of vectors formed from
@ -468,7 +468,7 @@ BOOL CRender3D::InsertPolygon(ModelCache *Cache, const Poly *P)
} }
// Begins caching a new model by resetting to the start of the local vertex buffer // Begins caching a new model by resetting to the start of the local vertex buffer
BOOL CRender3D::BeginModel(ModelCache *Cache) bool CRender3D::BeginModel(ModelCache *Cache)
{ {
int m; int m;
@ -546,7 +546,7 @@ struct VBORef *CRender3D::CacheModel(ModelCache *Cache, int lutIdx, UINT16 texOf
{ {
Vertex Prev[4]; // previous vertices Vertex Prev[4]; // previous vertices
int numPolys = 0; int numPolys = 0;
BOOL done = FALSE; bool done = false;
// Sega Rally 2 bad models // Sega Rally 2 bad models
//if (lutIdx == 0x27a1 || lutIdx == 0x21e0) //if (lutIdx == 0x27a1 || lutIdx == 0x21e0)
@ -731,13 +731,13 @@ void CRender3D::ClearModelCache(ModelCache *Cache)
ClearDisplayList(Cache); ClearDisplayList(Cache);
} }
BOOL CRender3D::CreateModelCache(ModelCache *Cache, unsigned vboMaxVerts, bool CRender3D::CreateModelCache(ModelCache *Cache, unsigned vboMaxVerts,
unsigned localMaxVerts, unsigned maxNumModels, unsigned numLUTEntries, unsigned localMaxVerts, unsigned maxNumModels, unsigned numLUTEntries,
unsigned displayListSize, BOOL isDynamic) unsigned displayListSize, bool isDynamic)
{ {
unsigned i; unsigned i;
int vboBytes, localBytes; int vboBytes, localBytes;
BOOL success; bool success;
Cache->dynamic = isDynamic; Cache->dynamic = isDynamic;
@ -757,13 +757,13 @@ BOOL CRender3D::CreateModelCache(ModelCache *Cache, unsigned vboMaxVerts,
localBytes = localMaxVerts*VBO_VERTEX_SIZE*sizeof(GLfloat); localBytes = localMaxVerts*VBO_VERTEX_SIZE*sizeof(GLfloat);
// Try allocating until size is // Try allocating until size is
success = FALSE; success = false;
while (vboBytes >= localBytes) while (vboBytes >= localBytes)
{ {
glBufferData(GL_ARRAY_BUFFER, vboBytes, 0, isDynamic?GL_STREAM_DRAW:GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, vboBytes, 0, isDynamic?GL_STREAM_DRAW:GL_STATIC_DRAW);
if (glGetError() == GL_NO_ERROR) if (glGetError() == GL_NO_ERROR)
{ {
success = TRUE; success = true;
break; break;
} }

View file

@ -265,7 +265,7 @@ void CRender2D::DrawCompleteLayer(int layerNum, const UINT16 *nameTableBase)
int hFullScrollPri, hFullScrollAlt; // full-screen horizontal scroll values (from registers) int hFullScrollPri, hFullScrollAlt; // full-screen horizontal scroll values (from registers)
int vOffset; // vertical pixel offset within tile int vOffset; // vertical pixel offset within tile
int tx, i, j; int tx, i, j;
BOOL lineScrollPri, lineScrollAlt; // line scrolling enable/disable bool lineScrollPri, lineScrollAlt; // line scrolling enable/disable
UINT16 mask; UINT16 mask;
// Determine layer color depths (1 if 4-bit, 0 if 8-bit) // Determine layer color depths (1 if 4-bit, 0 if 8-bit)
@ -491,7 +491,7 @@ void CRender2D::DrawCompleteLayer(int layerNum, const UINT16 *nameTableBase)
int hOffset, vOffset; // pixel offsets int hOffset, vOffset; // pixel offsets
int ntOffset; // offset in name table int ntOffset; // offset in name table
int tx; int tx;
BOOL lineScrollPri, lineScrollAlt; // line scrolling enable/disable bool lineScrollPri, lineScrollAlt; // line scrolling enable/disable
UINT16 mask; UINT16 mask;
// Determine layer color depths (1 if 4-bit, 0 if 8-bit) // Determine layer color depths (1 if 4-bit, 0 if 8-bit)
@ -614,7 +614,7 @@ void CRender2D::UpdateLayer(int layerNum)
{ {
glBindTexture(GL_TEXTURE_2D, texID[layerNum]); glBindTexture(GL_TEXTURE_2D, texID[layerNum]);
allDirty = TRUE; allDirty = true;
if (allDirty) if (allDirty)
{ {
// If everything is dirty, update the whole thing at once // If everything is dirty, update the whole thing at once
@ -710,7 +710,7 @@ void CRender2D::BeginFrame(void)
{ {
UpdateLayer(i); UpdateLayer(i);
} }
allDirty = FALSE; allDirty = false;
// Draw bottom layer // Draw bottom layer
Setup2D(); Setup2D();
@ -762,7 +762,7 @@ void CRender2D::WriteVRAM(unsigned addr, UINT32 data)
return; return;
// For now, mark everything as dirty // For now, mark everything as dirty
allDirty = TRUE; allDirty = true;
// Palette // Palette
if (addr >= 0x100000) if (addr >= 0x100000)
@ -810,7 +810,7 @@ void CRender2D::AttachVRAM(const UINT8 *vramPtr)
#define MEMORY_POOL_SIZE (512*512*4+0x20000) #define MEMORY_POOL_SIZE (512*512*4+0x20000)
BOOL CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes) bool CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes)
{ {
float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000;
@ -843,7 +843,7 @@ BOOL CRender2D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
// Clear textures and dirty rectangles (all memory) // Clear textures and dirty rectangles (all memory)
memset(memoryPool, 0, MEMORY_POOL_SIZE); memset(memoryPool, 0, MEMORY_POOL_SIZE);
memset(dirty, 0, sizeof(dirty)); memset(dirty, 0, sizeof(dirty));
allDirty = TRUE; allDirty = true;
// Create textures // Create textures
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

View file

@ -120,7 +120,7 @@ public:
* OKAY is successful, otherwise FAILED if a non-recoverable error * OKAY is successful, otherwise FAILED if a non-recoverable error
* occurred. Prints own error messages. * occurred. Prints own error messages.
*/ */
BOOL Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes); bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes);
/* /*
* CRender2D(void): * CRender2D(void):
@ -167,7 +167,7 @@ private:
// Dirty rectangles (non-zero indicates region is dirty) // Dirty rectangles (non-zero indicates region is dirty)
UINT8 dirty[2][64/DIRTY_RECT_HEIGHT][48/DIRTY_RECT_WIDTH]; UINT8 dirty[2][64/DIRTY_RECT_HEIGHT][48/DIRTY_RECT_WIDTH];
BOOL allDirty; // global dirty flag (forces everything to be updated) bool allDirty; // global dirty flag (forces everything to be updated)
// Buffers // Buffers
UINT8 *memoryPool; // all memory is allocated here UINT8 *memoryPool; // all memory is allocated here

View file

@ -547,7 +547,7 @@ void CRender3D::InitMatrixStack(UINT32 matrixBaseAddr)
* operations within the stack machine). We must be careful to ensure that no * operations within the stack machine). We must be careful to ensure that no
* games ever write data to this high nibble. * games ever write data to this high nibble.
*/ */
void CRender3D::Push(UINT32 ptr, BOOL pushMatrix) void CRender3D::Push(UINT32 ptr, bool pushMatrix)
{ {
#ifdef DEBUG #ifdef DEBUG
if ((ptr&0xF0000000)) // high nibble already being used for something! if ((ptr&0xF0000000)) // high nibble already being used for something!
@ -572,7 +572,7 @@ void CRender3D::Push(UINT32 ptr, BOOL pushMatrix)
} }
else else
{ {
stackOverflow = TRUE; // signal that a stack overflow occurred stackOverflow = true; // signal that a stack overflow occurred
#ifdef DEBUG #ifdef DEBUG
printf("stack overflow\n"); printf("stack overflow\n");
#endif #endif
@ -601,7 +601,7 @@ UINT32 CRender3D::Pop(void)
void CRender3D::ClearStack(void) void CRender3D::ClearStack(void)
{ {
stackTop = 0; stackTop = 0;
stackOverflow = FALSE; stackOverflow = false;
} }
@ -622,7 +622,7 @@ void CRender3D::ClearStack(void)
* The current texture offset state, texOffset, is also used. Models are cached * The current texture offset state, texOffset, is also used. Models are cached
* for each unique texOffset. * for each unique texOffset.
*/ */
BOOL CRender3D::DrawModel(UINT32 modelAddr) bool CRender3D::DrawModel(UINT32 modelAddr)
{ {
ModelCache *Cache; ModelCache *Cache;
const UINT32 *model; const UINT32 *model;
@ -666,7 +666,7 @@ BOOL CRender3D::DrawModel(UINT32 modelAddr)
} }
// Add to display list // Add to display list
return AppendDisplayList(Cache, FALSE, ModelRef); return AppendDisplayList(Cache, false, ModelRef);
} }
// Descends into a 10-word culling node // Descends into a 10-word culling node
@ -865,7 +865,7 @@ void CRender3D::StackMachine(UINT32 nodeAddr)
unsigned listStackDepth = 0; unsigned listStackDepth = 0;
// Push this address on to the stack to begin the process // Push this address on to the stack to begin the process
Push(nodeAddr,FALSE); Push(nodeAddr,false);
// Process the stack (keep popping until all finished) // Process the stack (keep popping until all finished)
while (stackTop > 0) while (stackTop > 0)
@ -943,7 +943,7 @@ void CRender3D::StackMachine(UINT32 nodeAddr)
if (!(list[i]&0x01000000)) // Fighting Vipers (this bit seems to indicate "do not process" if (!(list[i]&0x01000000)) // Fighting Vipers (this bit seems to indicate "do not process"
{ {
if ((nodeAddr != 0) && (nodeAddr != 0x800800)) if ((nodeAddr != 0) && (nodeAddr != 0x800800))
Push(nodeAddr,FALSE); // don't need to save matrix (each culling node saves/restores matrix) Push(nodeAddr,false); // don't need to save matrix (each culling node saves/restores matrix)
} }
if ((list[i]&0x02000000)) // list terminator if ((list[i]&0x02000000)) // list terminator
@ -980,7 +980,7 @@ void CRender3D::StackMachine(UINT32 nodeAddr)
z = *(float *) &node[0x06-offset]; z = *(float *) &node[0x06-offset];
// Push second link on stack (this also saves current matrix and will ensure it is restored) // Push second link on stack (this also saves current matrix and will ensure it is restored)
Push(node2Ptr,TRUE); Push(node2Ptr,true);
// Apply matrix and translation, then process first link // Apply matrix and translation, then process first link
if ((node[0x00]&0x10)) // apply translation vector if ((node[0x00]&0x10)) // apply translation vector
@ -994,7 +994,7 @@ void CRender3D::StackMachine(UINT32 nodeAddr)
if (NULL != lodTable) if (NULL != lodTable)
{ {
if ((node[0x03-offset]&0x20000000)) if ((node[0x03-offset]&0x20000000))
Push(lodTable[0]&0x00FFFFFF,FALSE); // process as culling node Push(lodTable[0]&0x00FFFFFF,false); // process as culling node
else else
{ {
if (DrawModel(lodTable[0]&0x00FFFFFF)) if (DrawModel(lodTable[0]&0x00FFFFFF))
@ -1003,7 +1003,7 @@ void CRender3D::StackMachine(UINT32 nodeAddr)
} }
} }
else else
Push(node1Ptr,FALSE); Push(node1Ptr,false);
break; break;
@ -1166,8 +1166,8 @@ void CRender3D::RenderViewport(UINT32 addr, int pri)
} }
// Render // Render
AppendDisplayList(&VROMCache, TRUE, 0); // add a viewport display list node AppendDisplayList(&VROMCache, true, 0); // add a viewport display list node
AppendDisplayList(&PolyCache, TRUE, 0); AppendDisplayList(&PolyCache, true, 0);
stackDepth = 0; stackDepth = 0;
listDepth = 0; listDepth = 0;
@ -1283,7 +1283,7 @@ void CRender3D::SetStep(int stepID)
DebugLog("Render3D set to Step %d.%d\n", (step>>4)&0xF, step&0xF); DebugLog("Render3D set to Step %d.%d\n", (step>>4)&0xF, step&0xF);
} }
BOOL CRender3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes) bool CRender3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes)
{ {
// Allocate memory for texture buffer // Allocate memory for texture buffer
textureBuffer = new(std::nothrow) GLfloat[512*512*4]; textureBuffer = new(std::nothrow) GLfloat[512*512*4];
@ -1311,9 +1311,9 @@ BOOL CRender3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
return ErrorLog("OpenGL was unable to provide a 2048x2048-texel texture map."); return ErrorLog("OpenGL was unable to provide a 2048x2048-texel texture map.");
// Create model caches and VBOs // Create model caches and VBOs
if (CreateModelCache(&VROMCache, NUM_STATIC_VERTS, NUM_LOCAL_VERTS, NUM_STATIC_MODELS, 0x4000000/4, NUM_DISPLAY_LIST_ITEMS, FALSE)) if (CreateModelCache(&VROMCache, NUM_STATIC_VERTS, NUM_LOCAL_VERTS, NUM_STATIC_MODELS, 0x4000000/4, NUM_DISPLAY_LIST_ITEMS, false))
return FAIL; return FAIL;
if (CreateModelCache(&PolyCache, NUM_DYNAMIC_VERTS, NUM_LOCAL_VERTS, NUM_DYNAMIC_MODELS, 0x400000/4, NUM_DISPLAY_LIST_ITEMS, TRUE)) if (CreateModelCache(&PolyCache, NUM_DYNAMIC_VERTS, NUM_LOCAL_VERTS, NUM_DYNAMIC_MODELS, 0x400000/4, NUM_DISPLAY_LIST_ITEMS, true))
return FAIL; return FAIL;
// Initialize lighting parameters (updated as viewports are traversed) // Initialize lighting parameters (updated as viewports are traversed)

View file

@ -79,7 +79,7 @@ struct VBORef
// Display list items: model instances and viewport settings // Display list items: model instances and viewport settings
struct DisplayList struct DisplayList
{ {
BOOL isViewport; // if true, this is a viewport node bool isViewport; // if true, this is a viewport node
union union
{ {
@ -125,7 +125,7 @@ struct DisplayList
struct ModelCache struct ModelCache
{ {
// Cache type // Cache type
BOOL dynamic; bool dynamic;
// Vertex buffer object // Vertex buffer object
unsigned vboMaxOffset; // size of VBO (in bytes) unsigned vboMaxOffset; // size of VBO (in bytes)
@ -282,7 +282,7 @@ public:
* occurred. Any allocated memory will not be freed until the * occurred. Any allocated memory will not be freed until the
* destructor is called. Prints own error messages. * destructor is called. Prints own error messages.
*/ */
BOOL Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes); bool Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned yRes);
/* /*
* CRender3D(void): * CRender3D(void):
@ -304,16 +304,16 @@ private:
// Model caching and display list management // Model caching and display list management
void DrawDisplayList(ModelCache *Cache, POLY_STATE state); void DrawDisplayList(ModelCache *Cache, POLY_STATE state);
BOOL AppendDisplayList(ModelCache *Cache, BOOL isViewport, const struct VBORef *Model); bool AppendDisplayList(ModelCache *Cache, bool isViewport, const struct VBORef *Model);
void ClearDisplayList(ModelCache *Cache); void ClearDisplayList(ModelCache *Cache);
BOOL InsertPolygon(ModelCache *cache, const Poly *p); bool InsertPolygon(ModelCache *cache, const Poly *p);
void InsertVertex(ModelCache *cache, const Vertex *v, const Poly *p, float normFlip); void InsertVertex(ModelCache *cache, const Vertex *v, const Poly *p, float normFlip);
BOOL BeginModel(ModelCache *cache); bool BeginModel(ModelCache *cache);
struct VBORef *EndModel(ModelCache *cache, int lutIdx, UINT16 texOffset); struct VBORef *EndModel(ModelCache *cache, int lutIdx, UINT16 texOffset);
struct VBORef *CacheModel(ModelCache *cache, int lutIdx, UINT16 texOffset, const UINT32 *data); struct VBORef *CacheModel(ModelCache *cache, int lutIdx, UINT16 texOffset, const UINT32 *data);
struct VBORef *LookUpModel(ModelCache *cache, int lutIdx, UINT16 texOffset); struct VBORef *LookUpModel(ModelCache *cache, int lutIdx, UINT16 texOffset);
void ClearModelCache(ModelCache *cache); void ClearModelCache(ModelCache *cache);
BOOL CreateModelCache(ModelCache *cache, unsigned vboMaxVerts, unsigned localMaxVerts, unsigned maxNumModels, unsigned numLUTEntries, unsigned displayListSize, BOOL isDynamic); bool CreateModelCache(ModelCache *cache, unsigned vboMaxVerts, unsigned localMaxVerts, unsigned maxNumModels, unsigned numLUTEntries, unsigned displayListSize, bool isDynamic);
void DestroyModelCache(ModelCache *cache); void DestroyModelCache(ModelCache *cache);
// Texture management // Texture management
@ -322,12 +322,12 @@ private:
// Stack management // Stack management
void MultMatrix(UINT32 matrixOffset); void MultMatrix(UINT32 matrixOffset);
void InitMatrixStack(UINT32 matrixBaseAddr); void InitMatrixStack(UINT32 matrixBaseAddr);
void Push(UINT32 ptr, BOOL pushMatrix); void Push(UINT32 ptr, bool pushMatrix);
UINT32 Pop(void); UINT32 Pop(void);
void ClearStack(void); void ClearStack(void);
// Scene database traversal // Scene database traversal
BOOL DrawModel(UINT32 modelAddr); bool DrawModel(UINT32 modelAddr);
void DescendCullingNode(UINT32 addr); void DescendCullingNode(UINT32 addr);
void DescendPointerList(UINT32 addr); void DescendPointerList(UINT32 addr);
void DescendNodePtr(UINT32 nodeAddr); void DescendNodePtr(UINT32 nodeAddr);
@ -335,8 +335,8 @@ private:
void RenderViewport(UINT32 addr, int pri); void RenderViewport(UINT32 addr, int pri);
// In-frame error reporting // In-frame error reporting
BOOL ErrorLocalVertexOverflow(void); bool ErrorLocalVertexOverflow(void);
BOOL ErrorUnableToCacheModel(UINT32 modelAddr); bool ErrorUnableToCacheModel(UINT32 modelAddr);
void ClearErrors(void); void ClearErrors(void);
/* /*
@ -365,7 +365,7 @@ private:
UINT32 *stack; UINT32 *stack;
int stackSize; // number of elements stack can contain int stackSize; // number of elements stack can contain
int stackTop; // current top of stack (free spot, last element is stackTop-1) int stackTop; // current top of stack (free spot, last element is stackTop-1)
BOOL stackOverflow; // records stack overflows (cleared by ClearStack()) bool stackOverflow; // records stack overflows (cleared by ClearStack())
// Current viewport parameters (updated as viewports are traversed) // Current viewport parameters (updated as viewports are traversed)
GLfloat lightingParams[6]; GLfloat lightingParams[6];

View file

@ -82,13 +82,13 @@ static char *LoadShaderSource(const char *file)
return buf; return buf;
} }
BOOL LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint *fragmentShaderPtr, const char *vsFile, const char *fsFile, const char *vsString, const char *fsString) bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint *fragmentShaderPtr, const char *vsFile, const char *fsFile, const char *vsString, const char *fsString)
{ {
char msg[2048+128], infoLog[2048]; char msg[2048+128], infoLog[2048];
const char *vsSource, *fsSource; // source code const char *vsSource, *fsSource; // source code
GLuint shaderProgram, vertexShader, fragmentShader; GLuint shaderProgram, vertexShader, fragmentShader;
GLint result, len; GLint result, len;
BOOL ret = OKAY; bool ret = OKAY;
// Load shaders from files if specified // Load shaders from files if specified
if (vsFile != NULL) if (vsFile != NULL)

View file

@ -51,7 +51,7 @@
* Returns: * Returns:
* OKAY is successfully loaded, otherwise FAIL. Prints own error messages. * OKAY is successfully loaded, otherwise FAIL. Prints own error messages.
*/ */
extern BOOL LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, extern bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr,
GLuint *fragmentShaderPtr, const char *vsFile, GLuint *fragmentShaderPtr, const char *vsFile,
const char *fsFile, const char *vsString, const char *fsFile, const char *vsString,
const char *fsString); const char *fsString);

View file

@ -67,9 +67,9 @@ using namespace std;
Basic Functions Basic Functions
******************************************************************************/ ******************************************************************************/
BOOL CINIFile::Write(const char *comment) bool CINIFile::Write(const char *comment)
{ {
BOOL writeSuccess; bool writeSuccess;
// In order to truncate, we must close and reopen as truncated // In order to truncate, we must close and reopen as truncated
File.close(); File.close();
@ -129,7 +129,7 @@ BOOL CINIFile::Write(const char *comment)
return writeSuccess; return writeSuccess;
} }
BOOL CINIFile::Open(const char *fileNameStr) bool CINIFile::Open(const char *fileNameStr)
{ {
FileName = fileNameStr; FileName = fileNameStr;
@ -142,7 +142,7 @@ BOOL CINIFile::Open(const char *fileNameStr)
return OKAY; return OKAY;
} }
BOOL CINIFile::OpenAndCreate(const char *fileNameStr) bool CINIFile::OpenAndCreate(const char *fileNameStr)
{ {
FileName = fileNameStr; FileName = fileNameStr;
@ -173,7 +173,7 @@ void CINIFile::Close(void)
******************************************************************************/ ******************************************************************************/
// Finds index of first matching section in the section list. Returns FAIL if not found. // Finds index of first matching section in the section list. Returns FAIL if not found.
BOOL CINIFile::LookUpSection(unsigned *idx, string SectionName) bool CINIFile::LookUpSection(unsigned *idx, string SectionName)
{ {
for (unsigned i = 0; i < Sections.size(); i++) for (unsigned i = 0; i < Sections.size(); i++)
{ {
@ -232,7 +232,7 @@ void CINIFile::Set(string SectionName, string SettingName, int value)
// Update the setting! // Update the setting!
UpdateIntValue: UpdateIntValue:
Sections[sectionIdx].Settings[settingIdx].isNumber = TRUE; Sections[sectionIdx].Settings[settingIdx].isNumber = true;
Sections[sectionIdx].Settings[settingIdx].value = value; Sections[sectionIdx].Settings[settingIdx].value = value;
Sections[sectionIdx].Settings[settingIdx].String = ""; Sections[sectionIdx].Settings[settingIdx].String = "";
} }
@ -281,13 +281,13 @@ void CINIFile::Set(string SectionName, string SettingName, string String)
// Update the setting! // Update the setting!
UpdateString: UpdateString:
Sections[sectionIdx].Settings[settingIdx].isNumber = FALSE; Sections[sectionIdx].Settings[settingIdx].isNumber = false;
Sections[sectionIdx].Settings[settingIdx].String = String; Sections[sectionIdx].Settings[settingIdx].String = String;
Sections[sectionIdx].Settings[settingIdx].value = 0; Sections[sectionIdx].Settings[settingIdx].value = 0;
} }
// Obtains a numerical setting, if it exists, otherwise does nothing. // Obtains a numerical setting, if it exists, otherwise does nothing.
BOOL CINIFile::Get(string SectionName, string SettingName, int& value) bool CINIFile::Get(string SectionName, string SettingName, int& value)
{ {
for (unsigned i = 0; i < Sections.size(); i++) for (unsigned i = 0; i < Sections.size(); i++)
{ {
@ -309,7 +309,7 @@ BOOL CINIFile::Get(string SectionName, string SettingName, int& value)
return FAIL; return FAIL;
} }
BOOL CINIFile::Get(string SectionName, string SettingName, unsigned& value) bool CINIFile::Get(string SectionName, string SettingName, unsigned& value)
{ {
int intVal; int intVal;
if (Get(SectionName, SettingName, intVal) == FAIL || intVal < 0) if (Get(SectionName, SettingName, intVal) == FAIL || intVal < 0)
@ -321,7 +321,7 @@ BOOL CINIFile::Get(string SectionName, string SettingName, unsigned& value)
} }
// Obtains a string setting, if it exists, otherwise does nothing. // Obtains a string setting, if it exists, otherwise does nothing.
BOOL CINIFile::Get(string SectionName, string SettingName, string& String) bool CINIFile::Get(string SectionName, string SettingName, string& String)
{ {
for (unsigned i = 0; i < Sections.size(); i++) for (unsigned i = 0; i < Sections.size(); i++)
{ {
@ -371,11 +371,11 @@ CINIFile::CToken::CToken(void)
} }
// Returns true for white space, comment symbol, or null terminator. // Returns true for white space, comment symbol, or null terminator.
static BOOL IsBlank(char c) static bool IsBlank(char c)
{ {
if (isspace(c) || (c==';') || (c=='\0')) if (isspace(c) || (c==';') || (c=='\0'))
return TRUE; return true;
return FALSE; return false;
} }
// Fetches a string. Tolerates all characters between quotes. // Fetches a string. Tolerates all characters between quotes.
@ -414,7 +414,7 @@ CINIFile::CToken CINIFile::GetNumber(void)
{ {
CToken T; CToken T;
unsigned long long number = 0; unsigned long long number = 0;
BOOL isNeg = FALSE; bool isNeg = false;
int overflow = 0; int overflow = 0;
T.type = TOKEN_NUMBER; T.type = TOKEN_NUMBER;
@ -422,7 +422,7 @@ CINIFile::CToken CINIFile::GetNumber(void)
// See if begins with minus sign // See if begins with minus sign
if (linePtr[0]=='-') if (linePtr[0]=='-')
{ {
isNeg = TRUE; isNeg = true;
linePtr++; linePtr++;
} }
@ -598,11 +598,11 @@ void CINIFile::InitParseTree(void)
Sections.push_back(FirstSection); Sections.push_back(FirstSection);
} }
BOOL CINIFile::Parse(void) bool CINIFile::Parse(void)
{ {
CToken T, U, V, W; CToken T, U, V, W;
string currentSection; // current section we're processing string currentSection; // current section we're processing
BOOL parseStatus = OKAY; bool parseStatus = OKAY;
lineNum = 0; lineNum = 0;

View file

@ -66,9 +66,9 @@ public:
* checked. If the setting is not found, the output parameter will not * checked. If the setting is not found, the output parameter will not
* be modified. * be modified.
*/ */
BOOL Get(string SectionName, string SettingName, int& value); bool Get(string SectionName, string SettingName, int& value);
BOOL Get(string SectionName, string SettingName, unsigned& value); bool Get(string SectionName, string SettingName, unsigned& value);
BOOL Get(string SectionName, string SettingName, string& String); bool Get(string SectionName, string SettingName, string& String);
/* /*
* Set(SectionName, SettingName, value): * Set(SectionName, SettingName, value):
@ -111,7 +111,7 @@ public:
* procedure, it is possible that nothing will be output and the * procedure, it is possible that nothing will be output and the
* previous contents will be lost. * previous contents will be lost.
*/ */
BOOL Write(const char *comment); bool Write(const char *comment);
/* /*
* Parse(void): * Parse(void):
@ -125,7 +125,7 @@ public:
* Returns: * Returns:
* OKAY if successful, FAIL if there was a file or parse error. * OKAY if successful, FAIL if there was a file or parse error.
*/ */
BOOL Parse(void); bool Parse(void);
/* /*
* SetDefaultSectionName(SectionName): * SetDefaultSectionName(SectionName):
@ -160,7 +160,7 @@ public:
* Returns: * Returns:
* OKAY if successful, FAIL if unable to open for reading and writing. * OKAY if successful, FAIL if unable to open for reading and writing.
*/ */
BOOL Open(const char *fileNameStr); bool Open(const char *fileNameStr);
/* /*
* OpenAndCreate(fileNameStr): * OpenAndCreate(fileNameStr):
@ -174,7 +174,7 @@ public:
* Returns: * Returns:
* OKAY if successful, FAIL if unable to open file. * OKAY if successful, FAIL if unable to open file.
*/ */
BOOL OpenAndCreate(const char *fileNameStr); bool OpenAndCreate(const char *fileNameStr);
/* /*
* Close(void): * Close(void):
@ -197,7 +197,7 @@ private:
}; };
// Parse tree // Parse tree
BOOL LookUpSection(unsigned *idx, string SectionName); bool LookUpSection(unsigned *idx, string SectionName);
void InitParseTree(void); void InitParseTree(void);
// Tokenizer // Tokenizer
@ -222,14 +222,14 @@ private:
struct Setting // it is up to caller to determine whether to use value or string struct Setting // it is up to caller to determine whether to use value or string
{ {
string Name; // setting name string Name; // setting name
BOOL isNumber; // internal flag: true if the setting is a number, false if it is a string bool isNumber; // internal flag: true if the setting is a number, false if it is a string
int value; // value of number int value; // value of number
string String; // string string String; // string
Setting(void) Setting(void)
{ {
value = 0; // initialize value to 0 value = 0; // initialize value to 0
isNumber = TRUE; // indicate the setting is initially a number isNumber = true; // indicate the setting is initially a number
} }
}; };
struct Section struct Section

View file

@ -104,9 +104,9 @@ static inline UINT32 Fetch(struct NCR53C810Context *Ctx)
} }
//TO-DO: check if this ever occurs in single-step mode (if so, we would need to stack interrupts) //TO-DO: check if this ever occurs in single-step mode (if so, we would need to stack interrupts)
static BOOL SCRIPTS_Int_IntFly(struct NCR53C810Context *Ctx) static bool SCRIPTS_Int_IntFly(struct NCR53C810Context *Ctx)
{ {
Ctx->halt = TRUE; // halt SCRIPTS execution Ctx->halt = true; // halt SCRIPTS execution
Ctx->regISTAT |= 1; // DMA interrupt pending Ctx->regISTAT |= 1; // DMA interrupt pending
Ctx->regDSTAT |= 4; // SCRIPTS interrupt instruction received Ctx->regDSTAT |= 4; // SCRIPTS interrupt instruction received
Ctx->IRQ->Assert(Ctx->scsiIRQ); Ctx->IRQ->Assert(Ctx->scsiIRQ);
@ -116,7 +116,7 @@ static BOOL SCRIPTS_Int_IntFly(struct NCR53C810Context *Ctx)
return OKAY; return OKAY;
} }
static BOOL SCRIPTS_MoveMemory(struct NCR53C810Context *Ctx) static bool SCRIPTS_MoveMemory(struct NCR53C810Context *Ctx)
{ {
UINT32 src, dest; UINT32 src, dest;
unsigned numBytes, i; unsigned numBytes, i;
@ -154,13 +154,13 @@ static BOOL SCRIPTS_MoveMemory(struct NCR53C810Context *Ctx)
} }
// Invalid instruction handler // Invalid instruction handler
static BOOL SCRIPTS_Invalid(struct NCR53C810Context *Ctx) static bool SCRIPTS_Invalid(struct NCR53C810Context *Ctx)
{ {
DebugLog("53C810 encountered an unrecognized instruction (%02X%06X, DSP=%08X)\n!", Ctx->regDCMD, Ctx->regDBC, Ctx->regDSP); DebugLog("53C810 encountered an unrecognized instruction (%02X%06X, DSP=%08X)\n!", Ctx->regDCMD, Ctx->regDBC, Ctx->regDSP);
return FAIL; return FAIL;
} }
void C53C810::Run(BOOL singleStep) void C53C810::Run(bool singleStep)
{ {
UINT32 op; UINT32 op;
int i; int i;
@ -201,7 +201,7 @@ void C53C810::Run(BOOL singleStep)
} }
// Insert instructions into the LUT under control of the mask // Insert instructions into the LUT under control of the mask
void C53C810::Insert(UINT8 mask, UINT8 op, BOOL (*Handler)(struct NCR53C810Context *)) void C53C810::Insert(UINT8 mask, UINT8 op, bool (*Handler)(struct NCR53C810Context *))
{ {
UINT32 i; UINT32 i;
@ -291,13 +291,13 @@ void C53C810::WriteRegister(unsigned reg, UINT8 data)
case 0x2F: // DSP 31-24 case 0x2F: // DSP 31-24
Ctx.regDSP &= 0x00FFFFFF; Ctx.regDSP &= 0x00FFFFFF;
Ctx.regDSP |= (data<<24); Ctx.regDSP |= (data<<24);
Ctx.halt = FALSE; // writing this register un-halts 53C810 operation (pg.6-31 of LSI manual) Ctx.halt = false; // writing this register un-halts 53C810 operation (pg.6-31 of LSI manual)
if (!(Ctx.regDMODE&1)) // if MAN=0, start SCRIPTS automatically if (!(Ctx.regDMODE&1)) // if MAN=0, start SCRIPTS automatically
// To-Do: is this correct? Should single step really be tested first? // To-Do: is this correct? Should single step really be tested first?
//if (!(Ctx.regDCNTL&0x10) && !(Ctx.regDMODE&1)) // if MAN=0 and not single stepping, start SCRIPTS automatically //if (!(Ctx.regDCNTL&0x10) && !(Ctx.regDMODE&1)) // if MAN=0 and not single stepping, start SCRIPTS automatically
{ {
DebugLog("53C810: Automatically starting (PC=%08X, LR=%08X, single step=%d)\n", ppc_get_pc(), ppc_get_lr(), !!(Ctx.regDCNTL&0x10)); DebugLog("53C810: Automatically starting (PC=%08X, LR=%08X, single step=%d)\n", ppc_get_pc(), ppc_get_lr(), !!(Ctx.regDCNTL&0x10));
Run(FALSE); // automatic Run(false); // automatic
} }
break; break;
case 0x30: // DSPS 7-0 case 0x30: // DSPS 7-0
@ -324,12 +324,12 @@ void C53C810::WriteRegister(unsigned reg, UINT8 data)
if ((Ctx.regDCNTL&0x14) == 0x14) // single step if ((Ctx.regDCNTL&0x14) == 0x14) // single step
{ {
DebugLog("53C810: single step: %08X, (halt=%d)\n", Ctx.regDSP, Ctx.halt); DebugLog("53C810: single step: %08X, (halt=%d)\n", Ctx.regDSP, Ctx.halt);
Run(TRUE); Run(true);
} }
else if ((Ctx.regDCNTL&0x04)) // start DMA bit else if ((Ctx.regDCNTL&0x04)) // start DMA bit
{ {
DebugLog("53C810: Manually starting\n"); DebugLog("53C810: Manually starting\n");
Run(FALSE); Run(false);
} }
break; break;
default: default:
@ -472,7 +472,7 @@ void C53C810::Reset(void)
Ctx.regDMODE = 0; Ctx.regDMODE = 0;
Ctx.regDSTAT = 0x80; // DMA FIFO empty Ctx.regDSTAT = 0x80; // DMA FIFO empty
Ctx.regISTAT = 0; Ctx.regISTAT = 0;
Ctx.halt = FALSE; Ctx.halt = false;
DebugLog("53C810 reset\n"); DebugLog("53C810 reset\n");
} }

View file

@ -51,7 +51,7 @@ struct NCR53C810Context
UINT8 regISTAT; // ISTAT: Interrupt Status UINT8 regISTAT; // ISTAT: Interrupt Status
// Operational status // Operational status
BOOL halt; // set TRUE if halted by interrupt instruction bool halt; // set true if halted by interrupt instruction
// Big endian bus object for DMA memory access and instruction fetching // Big endian bus object for DMA memory access and instruction fetching
CBus *Bus; CBus *Bus;
@ -185,10 +185,10 @@ public:
private: private:
// Private members // Private members
void Run(int numOps); void Run(bool singleStep);
void BuildOpTable(void); void BuildOpTable(void);
void Insert(UINT8 mask, UINT8 op, BOOL (*Handler)(struct NCR53C810Context *)); void Insert(UINT8 mask, UINT8 op, bool (*Handler)(struct NCR53C810Context *));
BOOL (*OpTable[256])(struct NCR53C810Context *); bool (*OpTable[256])(struct NCR53C810Context *);
// Context (register file) // Context (register file)
struct NCR53C810Context Ctx; struct NCR53C810Context Ctx;

View file

@ -162,7 +162,7 @@ int main(int argc, char **argv)
UINT8 *buffer; UINT8 *buffer;
unsigned i, num, offset, fsize, start = 0, len, org, file = 0; unsigned i, num, offset, fsize, start = 0, len, org, file = 0;
UINT32 op[3]; UINT32 op[3];
BOOL len_specified = 0, org_specified = 0; bool len_specified = 0, org_specified = 0;
char *c; char *c;

View file

@ -118,7 +118,7 @@ void C93C46::Write(unsigned pinCS, unsigned pinCLK, unsigned pinDI)
if (CS == 0) if (CS == 0)
{ {
bitBufferIn = 0; // this must be cleared each time (only leading 0's can exist prior to commands) bitBufferIn = 0; // this must be cleared each time (only leading 0's can exist prior to commands)
receiving = TRUE; // ready to accept commands receiving = true; // ready to accept commands
busyCycles = 5; // some applications require the chip to take time while writing busyCycles = 5; // some applications require the chip to take time while writing
return; return;
} }
@ -126,7 +126,7 @@ void C93C46::Write(unsigned pinCS, unsigned pinCLK, unsigned pinDI)
// Rising clock edge // Rising clock edge
if (!prevCLK && CLK) if (!prevCLK && CLK)
{ {
if (receiving == TRUE) // is the chip receiving commands? if (receiving == true) // is the chip receiving commands?
{ {
// Shift in a new bit // Shift in a new bit
bitBufferIn <<= 1; bitBufferIn <<= 1;
@ -139,17 +139,17 @@ void C93C46::Write(unsigned pinCS, unsigned pinCLK, unsigned pinDI)
bitBufferOut = ReverseBits16(regs[addr]); // reverse so that D15 is shifted out first bitBufferOut = ReverseBits16(regs[addr]); // reverse so that D15 is shifted out first
//bitBufferOut <<= 1; // a leading 0 precedes the first word read (causes problems) //bitBufferOut <<= 1; // a leading 0 precedes the first word read (causes problems)
bitsOut = 0; // how many bits read out bitsOut = 0; // how many bits read out
receiving = FALSE; // transmitting data now receiving = false; // transmitting data now
DebugLog("93C46: READ %X\n", addr); DebugLog("93C46: READ %X\n", addr);
} }
else if (bitBufferIn == 0x13) // WEN (write enable) else if (bitBufferIn == 0x13) // WEN (write enable)
{ {
locked = FALSE; locked = false;
DebugLog("93C46: WEN\n"); DebugLog("93C46: WEN\n");
} }
else if (bitBufferIn == 0x10) // WDS (write disable) else if (bitBufferIn == 0x10) // WDS (write disable)
{ {
locked = TRUE; locked = true;
DebugLog("93C46: WDS\n"); DebugLog("93C46: WDS\n");
} }
else if ((bitBufferIn&0xFFC00000) == 0x01400000) // WRITE else if ((bitBufferIn&0xFFC00000) == 0x01400000) // WRITE
@ -232,8 +232,8 @@ void C93C46::Clear(void)
void C93C46::Reset(void) void C93C46::Reset(void)
{ {
receiving = TRUE; receiving = true;
locked = TRUE; locked = true;
bitBufferIn = 0; bitBufferIn = 0;
bitBufferOut = 0; bitBufferOut = 0;
addr = 0; addr = 0;

View file

@ -117,10 +117,10 @@ private:
UINT32 bitBufferOut; // bits to be shifted out UINT32 bitBufferOut; // bits to be shifted out
UINT32 bitBufferIn; // stores bits as they are shifted in UINT32 bitBufferIn; // stores bits as they are shifted in
int bitsOut; // how many bits have been shifted out int bitsOut; // how many bits have been shifted out
BOOL receiving; // if true, accepting data, if false, sending data out (read commands) bool receiving; // if true, accepting data, if false, sending data out (read commands)
unsigned addr; // latched address unsigned addr; // latched address
int busyCycles; // when > 0, counts down delay cycles and indicates busy int busyCycles; // when > 0, counts down delay cycles and indicates busy
BOOL locked; // whether the EEPROM is in a locked state bool locked; // whether the EEPROM is in a locked state
}; };

View file

@ -377,7 +377,7 @@ UINT8 CDSB1::IORead8(UINT32 addr)
else else
status |= 2; status |= 2;
Z80.SetINT(FALSE); // clear IRQ Z80.SetINT(false); // clear IRQ
//printf("Z80: INT cleared, read from FIFO\n"); //printf("Z80: INT cleared, read from FIFO\n");
return d; return d;
@ -436,7 +436,7 @@ void CDSB1::RunFrame(INT16 *audioL, INT16 *audioR)
// While FIFO not empty, fire interrupts, run for up to one frame // While FIFO not empty, fire interrupts, run for up to one frame
for (cycles = (4000000/60)/4; (cycles > 0) && (fifoIdxR != fifoIdxW); ) for (cycles = (4000000/60)/4; (cycles > 0) && (fifoIdxR != fifoIdxW); )
{ {
Z80.SetINT(TRUE); // fire an IRQ to indicate pending command Z80.SetINT(true); // fire an IRQ to indicate pending command
//printf("Z80 INT fired\n"); //printf("Z80 INT fired\n");
cycles -= Z80.Run(500); cycles -= Z80.Run(500);
} }
@ -561,7 +561,7 @@ void CDSB1::LoadState(CBlockFile *StateFile)
#define DSB1_OFFSET_MPEG_RIGHT 0x8644 // 1604 bytes right MPEG buffer #define DSB1_OFFSET_MPEG_RIGHT 0x8644 // 1604 bytes right MPEG buffer
#define DSB1_MEMORY_POOL_SIZE (0x8000 + 0x644 + 0x644) #define DSB1_MEMORY_POOL_SIZE (0x8000 + 0x644 + 0x644)
BOOL CDSB1::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr) bool CDSB1::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
{ {
float memSizeMB = (float)DSB1_MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)DSB1_MEMORY_POOL_SIZE/(float)0x100000;
@ -1122,7 +1122,7 @@ void CDSB2::LoadState(CBlockFile *StateFile)
#define DSB2_OFFSET_MPEG_RIGHT 0x20644 // 1604 bytes right MPEG buffer #define DSB2_OFFSET_MPEG_RIGHT 0x20644 // 1604 bytes right MPEG buffer
#define DSB2_MEMORY_POOL_SIZE (0x20000 + 0x644 + 0x644) #define DSB2_MEMORY_POOL_SIZE (0x20000 + 0x644 + 0x644)
BOOL CDSB2::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr) bool CDSB2::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
{ {
float memSizeMB = (float)DSB2_MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)DSB2_MEMORY_POOL_SIZE/(float)0x100000;

View file

@ -50,7 +50,7 @@
class CDSBConfig class CDSBConfig
{ {
public: public:
bool emulateDSB; // DSB emulation (enabled if TRUE) bool emulateDSB; // DSB emulation (enabled if true)
// Sound (SCSP) volume (0-200, 100 being full amplitude) // Sound (SCSP) volume (0-200, 100 being full amplitude)
inline void SetSoundVolume(unsigned vol) inline void SetSoundVolume(unsigned vol)
@ -207,7 +207,7 @@ public:
* Returns: * Returns:
* OKAY if successful, otherwise FAIL. * OKAY if successful, otherwise FAIL.
*/ */
virtual BOOL Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr) = 0; virtual bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr) = 0;
}; };
@ -239,7 +239,7 @@ public:
void Reset(void); void Reset(void);
void SaveState(CBlockFile *StateFile); void SaveState(CBlockFile *StateFile);
void LoadState(CBlockFile *StateFile); void LoadState(CBlockFile *StateFile);
BOOL Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr); bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr);
// Constructor and destructor // Constructor and destructor
CDSB1(void); CDSB1(void);
@ -311,7 +311,7 @@ public:
void Reset(void); void Reset(void);
void SaveState(CBlockFile *StateFile); void SaveState(CBlockFile *StateFile);
void LoadState(CBlockFile *StateFile); void LoadState(CBlockFile *StateFile);
BOOL Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr); bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr);
// Constructor and destructor // Constructor and destructor
CDSB2(void); CDSB2(void);

View file

@ -117,7 +117,7 @@ void CDriveBoard::LoadState(CBlockFile *SaveState)
SendStopAll(); SendStopAll();
} }
BOOL CDriveBoard::Init(const UINT8 *romPtr) bool CDriveBoard::Init(const UINT8 *romPtr)
{ {
// Assign ROM (note that the ROM data has not yet been loaded) // Assign ROM (note that the ROM data has not yet been loaded)
m_rom = romPtr; m_rom = romPtr;

View file

@ -50,7 +50,7 @@ public:
void LoadState(CBlockFile *SaveState); void LoadState(CBlockFile *SaveState);
BOOL Init(const UINT8 *romPtr); bool Init(const UINT8 *romPtr);
void AttachInputs(CInputs *InputsPtr, unsigned gameInputFlags); void AttachInputs(CInputs *InputsPtr, unsigned gameInputFlags);

View file

@ -2476,7 +2476,7 @@ static void Reverse32(UINT8 *buf, unsigned size)
} }
// Dumps a memory region to a file for debugging purposes // Dumps a memory region to a file for debugging purposes
static void Dump(const char *file, UINT8 *buf, unsigned size, BOOL reverse32, BOOL reverse16) static void Dump(const char *file, UINT8 *buf, unsigned size, bool reverse32, bool reverse16)
{ {
FILE *fp; FILE *fp;
@ -2518,7 +2518,7 @@ const struct GameInfo * CModel3::GetGameInfo(void)
} }
// Stepping-dependent parameters (MPC10x type, etc.) are initialized here // Stepping-dependent parameters (MPC10x type, etc.) are initialized here
BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile) bool CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
{ {
struct ROMMap Map[] = struct ROMMap Map[] =
{ {
@ -2538,7 +2538,7 @@ BOOL CModel3::LoadROMSet(const struct GameInfo *GameList, const char *zipFile)
*(UINT64 *) driveROM = MAGIC_NUMBER; *(UINT64 *) driveROM = MAGIC_NUMBER;
// Load game // Load game
Game = LoadROMSetFromZIPFile(Map, GameList, zipFile, TRUE); Game = LoadROMSetFromZIPFile(Map, GameList, zipFile, true);
if (NULL == Game) if (NULL == Game)
return ErrorLog("Failed to load ROM set."); return ErrorLog("Failed to load ROM set.");
@ -2669,7 +2669,7 @@ void CModel3::AttachInputs(CInputs *InputsPtr)
} }
// Model 3 initialization. Some initialization is deferred until ROMs are loaded in LoadROMSet() // Model 3 initialization. Some initialization is deferred until ROMs are loaded in LoadROMSet()
BOOL CModel3::Init(void) bool CModel3::Init(void)
{ {
float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000;
@ -2754,12 +2754,12 @@ CModel3::~CModel3(void)
{ {
// Debug: dump some files // Debug: dump some files
#if 0 #if 0
Dump("ram", ram, 0x800000, TRUE, FALSE); Dump("ram", ram, 0x800000, true, false);
//Dump("vrom", vrom, 0x4000000, TRUE, FALSE); //Dump("vrom", vrom, 0x4000000, true, false);
//Dump("crom", crom, 0x800000, TRUE, FALSE); //Dump("crom", crom, 0x800000, true, false);
//Dump("bankedCrom", &crom[0x800000], 0x7000000, TRUE, FALSE); //Dump("bankedCrom", &crom[0x800000], 0x7000000, true, false);
//Dump("soundROM", soundROM, 0x80000, FALSE, TRUE); //Dump("soundROM", soundROM, 0x80000, false, true);
//Dump("sampleROM", sampleROM, 0x800000, FALSE, TRUE); //Dump("sampleROM", sampleROM, 0x800000, false, true);
#endif #endif
// Stop all threads // Stop all threads

View file

@ -36,7 +36,7 @@
class CModel3Config class CModel3Config
{ {
public: public:
bool multiThreaded; // Multi-threading (enabled if TRUE) bool multiThreaded; // Multi-threading (enabled if true)
// PowerPC clock frequency in MHz (minimum: 1 MHz) // PowerPC clock frequency in MHz (minimum: 1 MHz)
inline void SetPowerPCFrequency(unsigned f) inline void SetPowerPCFrequency(unsigned f)
@ -240,7 +240,7 @@ public:
* Returns: * Returns:
* OKAY if successful, FAIL otherwise. Prints errors. * OKAY if successful, FAIL otherwise. Prints errors.
*/ */
BOOL LoadROMSet(const struct GameInfo *GameList, const char *zipFile); bool LoadROMSet(const struct GameInfo *GameList, const char *zipFile);
/* /*
* AttachRenderers(Render2DPtr, Render3DPtr): * AttachRenderers(Render2DPtr, Render3DPtr):
@ -273,7 +273,7 @@ public:
* OKAY is successful, otherwise FAILED if a non-recoverable error * OKAY is successful, otherwise FAILED if a non-recoverable error
* occurred. Prints own error messages. * occurred. Prints own error messages.
*/ */
BOOL Init(void); bool Init(void);
/* /*
* CModel3(void): * CModel3(void):
@ -352,14 +352,14 @@ private:
PPC_FETCH_REGION PPCFetchRegions[3]; PPC_FETCH_REGION PPCFetchRegions[3];
// Multiple threading // Multiple threading
bool startedThreads; // True if threads have been created and started bool startedThreads; // True if threads have been created and started
CThread *sndBrdThread; // Sound board thread CThread *sndBrdThread; // Sound board thread
CThread *drvBrdThread; // Drive board thread CThread *drvBrdThread; // Drive board thread
bool sndBrdThreadDone; // Flag to indicate sound board thread has finished processing for current frame bool sndBrdThreadDone; // Flag to indicate sound board thread has finished processing for current frame
bool drvBrdThreadDone; // Flag to indicate drive board thread has finished processing for current frame bool drvBrdThreadDone; // Flag to indicate drive board thread has finished processing for current frame
// Thread synchronization objects // Thread synchronization objects
CSemaphore *sndBrdThreadSync; CSemaphore *sndBrdThreadSync;
CSemaphore *drvBrdThreadSync; CSemaphore *drvBrdThreadSync;
CMutex *notifyLock; CMutex *notifyLock;
CCondVar *notifySync; CCondVar *notifySync;

View file

@ -121,7 +121,7 @@ void CReal3D::RenderFrame(void)
{ {
//if (commandPortWritten) //if (commandPortWritten)
Render3D->RenderFrame(); Render3D->RenderFrame();
commandPortWritten = FALSE; commandPortWritten = false;
} }
void CReal3D::BeginFrame(void) void CReal3D::BeginFrame(void)
@ -668,7 +668,7 @@ void CReal3D::Flush(void)
unsigned i, size; unsigned i, size;
UINT32 header; UINT32 header;
commandPortWritten = TRUE; commandPortWritten = true;
DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc()); DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc());
@ -806,7 +806,7 @@ void CReal3D::Reset(void)
{ {
error = false; error = false;
commandPortWritten = FALSE; commandPortWritten = false;
fifoIdx = 0; fifoIdx = 0;
status = 0; status = 0;
@ -857,7 +857,7 @@ void CReal3D::SetStep(int stepID)
DebugLog("Real3D set to Step %d.%d\n", (step>>4)&0xF, step&0xF); DebugLog("Real3D set to Step %d.%d\n", (step>>4)&0xF, step&0xF);
} }
BOOL CReal3D::Init(const UINT8 *vromPtr, CBus *BusObjectPtr, CIRQ *IRQObjectPtr, unsigned dmaIRQBit) bool CReal3D::Init(const UINT8 *vromPtr, CBus *BusObjectPtr, CIRQ *IRQObjectPtr, unsigned dmaIRQBit)
{ {
float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000;

View file

@ -323,7 +323,7 @@ public:
* OKAY if successful otherwise FAIL (not enough memory). Prints own * OKAY if successful otherwise FAIL (not enough memory). Prints own
* errors. * errors.
*/ */
BOOL Init(const UINT8 *vromPtr, CBus *BusObjectPtr, CIRQ *IRQObjectPtr, unsigned dmaIRQBit); bool Init(const UINT8 *vromPtr, CBus *BusObjectPtr, CIRQ *IRQObjectPtr, unsigned dmaIRQBit);
/* /*
* CReal3D(void): * CReal3D(void):
@ -382,7 +382,7 @@ private:
UINT8 dmaConfig; UINT8 dmaConfig;
// Command port // Command port
BOOL commandPortWritten; bool commandPortWritten;
// Status and command registers // Status and command registers
UINT32 status; UINT32 status;

View file

@ -468,7 +468,7 @@ void CSoundBoard::AttachDSB(CDSB *DSBPtr)
#define OFFSET_AUDIO_RIGHT 0x2005BE // 1470 bytes right audio channel #define OFFSET_AUDIO_RIGHT 0x2005BE // 1470 bytes right audio channel
#define MEMORY_POOL_SIZE (0x100000 + 0x100000 + 0x5BE + 0x5BE) #define MEMORY_POOL_SIZE (0x100000 + 0x100000 + 0x5BE + 0x5BE)
BOOL CSoundBoard::Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr) bool CSoundBoard::Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr)
{ {
float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000;

View file

@ -40,7 +40,7 @@
class CSoundBoardConfig class CSoundBoardConfig
{ {
public: public:
bool emulateSCSP; // SCSP emulation (enabled if TRUE) bool emulateSCSP; // SCSP emulation (enabled if true)
// Defaults // Defaults
CSoundBoardConfig(void) CSoundBoardConfig(void)
@ -160,7 +160,7 @@ public:
* OKAY if successful, FAIL if unable to allocate memory. Prints own * OKAY if successful, FAIL if unable to allocate memory. Prints own
* error messages. * error messages.
*/ */
BOOL Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr); bool Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr);
/* /*
* CSoundBoard(void): * CSoundBoard(void):

View file

@ -156,7 +156,7 @@ void CTileGen::AttachRenderer(CRender2D *Render2DPtr)
#define MEMORY_POOL_SIZE 0x120000 #define MEMORY_POOL_SIZE 0x120000
BOOL CTileGen::Init(CIRQ *IRQObjectPtr) bool CTileGen::Init(CIRQ *IRQObjectPtr)
{ {
float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000; float memSizeMB = (float)MEMORY_POOL_SIZE/(float)0x100000;

View file

@ -151,7 +151,7 @@ public:
* OKAY is successful, otherwise FAILED if a non-recoverable error * OKAY is successful, otherwise FAILED if a non-recoverable error
* occurred. Prints own error messages. * occurred. Prints own error messages.
*/ */
BOOL Init(CIRQ *IRQObjectPtr); bool Init(CIRQ *IRQObjectPtr);
/* /*
* CTileGen(void): * CTileGen(void):

View file

@ -12,7 +12,7 @@
* *
* Initializes the audio system. * Initializes the audio system.
*/ */
extern BOOL OpenAudio(); extern bool OpenAudio();
/* /*
* OutputAudio(unsigned numSamples, *INT16 leftBuffer, *INT16 rightBuffer) * OutputAudio(unsigned numSamples, *INT16 leftBuffer, *INT16 rightBuffer)

View file

@ -249,7 +249,7 @@ extern void DebugLog(const char *fmt, ...);
* Returns: * Returns:
* Must always return FAIL. * Must always return FAIL.
*/ */
extern BOOL ErrorLog(const char *fmt, ...); extern bool ErrorLog(const char *fmt, ...);
/* /*
* InfoLog(fmt, ...); * InfoLog(fmt, ...);

View file

@ -173,7 +173,7 @@ static void LogAudioInfo(SDL_AudioSpec *fmt)
InfoLog(""); InfoLog("");
} }
BOOL OpenAudio() bool OpenAudio()
{ {
// Initialize SDL audio sub-system // Initialize SDL audio sub-system
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0)

View file

@ -106,7 +106,7 @@ void InfoLog(const char *fmt, ...)
va_end(vl); va_end(vl);
} }
BOOL ErrorLog(const char *fmt, ...) bool ErrorLog(const char *fmt, ...)
{ {
if (s_Logger == NULL) if (s_Logger == NULL)
return FAIL; return FAIL;
@ -139,8 +139,8 @@ unsigned xRes, yRes; // renderer output resolution (can be smaller than GL vi
* because the actual drawing area may need to be adjusted to preserve the * because the actual drawing area may need to be adjusted to preserve the
* Model 3 aspect ratio. The new resolution will be passed back as well. * Model 3 aspect ratio. The new resolution will be passed back as well.
*/ */
static BOOL CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned *xResPtr, unsigned *yResPtr, static bool CreateGLScreen(const char *caption, unsigned *xOffsetPtr, unsigned *yOffsetPtr, unsigned *xResPtr, unsigned *yResPtr,
BOOL keepAspectRatio, BOOL fullScreen) bool keepAspectRatio, bool fullScreen)
{ {
const SDL_VideoInfo *VideoInfo; const SDL_VideoInfo *VideoInfo;
GLenum err; GLenum err;
@ -238,7 +238,7 @@ static void PrintGLInfo(bool createScreen, bool infoLog, bool printExtensions)
if (createScreen) if (createScreen)
{ {
if (OKAY != CreateGLScreen("Supermodel - Querying OpenGL Information...",&xOffset,&yOffset,&xRes,&yRes,FALSE,FALSE)) if (OKAY != CreateGLScreen("Supermodel - Querying OpenGL Information...",&xOffset,&yOffset,&xRes,&yRes,false,false))
{ {
ErrorLog("Unable to query OpenGL.\n"); ErrorLog("Unable to query OpenGL.\n");
return; return;
@ -334,7 +334,7 @@ static bool ConfigureInputs(CInputs *Inputs, bool configure)
{ {
// Open an SDL window // Open an SDL window
unsigned xOffset, yOffset, xRes=496, yRes=384; unsigned xOffset, yOffset, xRes=496, yRes=384;
if (OKAY != CreateGLScreen("Supermodel - Configuring Inputs...",&xOffset,&yOffset,&xRes,&yRes,FALSE,FALSE)) if (OKAY != CreateGLScreen("Supermodel - Configuring Inputs...",&xOffset,&yOffset,&xRes,&yRes,false,false))
return (bool) ErrorLog("Unable to start SDL to configure inputs.\n"); return (bool) ErrorLog("Unable to start SDL to configure inputs.\n");
// Configure the inputs // Configure the inputs
@ -674,8 +674,8 @@ int Supermodel(const char *zipFile, CInputs *Inputs, CINIFile *CmdLine)
unsigned fpsFramesElapsed, framesElapsed; unsigned fpsFramesElapsed, framesElapsed;
unsigned showCrosshairs = 0; // bit 1: player 1 crosshair, bit 0: player 2 unsigned showCrosshairs = 0; // bit 1: player 1 crosshair, bit 0: player 2
bool gameHasLightguns = false; bool gameHasLightguns = false;
BOOL quit = 0; bool quit = 0;
BOOL paused = 0; bool paused = 0;
// Initialize and load ROMs // Initialize and load ROMs
if (OKAY != Model3->Init()) if (OKAY != Model3->Init())
@ -694,7 +694,7 @@ int Supermodel(const char *zipFile, CInputs *Inputs, CINIFile *CmdLine)
xRes = g_Config.xRes; xRes = g_Config.xRes;
yRes = g_Config.yRes; yRes = g_Config.yRes;
sprintf(titleStr, "Supermodel - %s", Model3->GetGameInfo()->title); sprintf(titleStr, "Supermodel - %s", Model3->GetGameInfo()->title);
if (OKAY != CreateGLScreen(titleStr,&xOffset,&yOffset,&xRes,&yRes,TRUE,g_Config.fullScreen)) if (OKAY != CreateGLScreen(titleStr,&xOffset,&yOffset,&xRes,&yRes,true,g_Config.fullScreen))
return 1; return 1;
// Info log GL information and user options // Info log GL information and user options
@ -1036,7 +1036,7 @@ static int DisassembleCROM(const char *zipFile, UINT32 addr, unsigned n)
Map[1].ptr = &crom[0x800000]; Map[1].ptr = &crom[0x800000];
// Load ROM set // Load ROM set
Game = LoadROMSetFromZIPFile(Map, g_Model3GameList, zipFile, FALSE); Game = LoadROMSetFromZIPFile(Map, g_Model3GameList, zipFile, false);
if (NULL == Game) if (NULL == Game)
return ErrorLog("Failed to load ROM set."); return ErrorLog("Failed to load ROM set.");

View file

@ -44,7 +44,7 @@ class COSDConfig
{ {
public: public:
unsigned xRes, yRes; // X and Y resolution, in pixels unsigned xRes, yRes; // X and Y resolution, in pixels
bool fullScreen; // Full screen mode (if TRUE) bool fullScreen; // Full screen mode (if true)
bool throttle; // 60 Hz frame limiting bool throttle; // 60 Hz frame limiting
bool showFPS; // Show frame rate bool showFPS; // Show frame rate
bool flipStereo; // Flip stereo channels bool flipStereo; // Flip stereo channels

View file

@ -33,13 +33,10 @@
#define INCLUDED_TYPES_H #define INCLUDED_TYPES_H
// Booleans (must be 0 or 1 only) // Booleans (must be 0 or 1 only)
#define TRUE 1 #define OKAY 0
#define FALSE 0 #define FAIL 1
#define OKAY FALSE
#define FAIL TRUE
// Types // Types
typedef int BOOL;
typedef unsigned long long UINT64; typedef unsigned long long UINT64;
typedef signed long long INT64; typedef signed long long INT64;
typedef unsigned int UINT32; typedef unsigned int UINT32;

View file

@ -522,8 +522,8 @@ void CDirectInputSystem::OpenKeyboardsAndMice()
strcpy(keyDetails.name, "Unknown Keyboard"); strcpy(keyDetails.name, "Unknown Keyboard");
m_keyDetails.push_back(keyDetails); m_keyDetails.push_back(keyDetails);
BOOL *pKeyState = new BOOL[255]; bool *pKeyState = new bool[255];
memset(pKeyState, 0, sizeof(BOOL) * 255); memset(pKeyState, 0, sizeof(bool) * 255);
m_rawKeyStates.push_back(pKeyState); m_rawKeyStates.push_back(pKeyState);
} }
else if (device.dwType == RIM_TYPEMOUSE) else if (device.dwType == RIM_TYPEMOUSE)
@ -751,7 +751,7 @@ void CDirectInputSystem::CloseKeyboardsAndMice()
} }
// Delete storage for keyboards // Delete storage for keyboards
for (vector<BOOL*>::iterator it = m_rawKeyStates.begin(); it != m_rawKeyStates.end(); it++) for (vector<bool*>::iterator it = m_rawKeyStates.begin(); it != m_rawKeyStates.end(); it++)
delete[] *it; delete[] *it;
m_keyDetails.clear(); m_keyDetails.clear();
m_rawKeyboards.clear(); m_rawKeyboards.clear();
@ -828,7 +828,7 @@ void CDirectInputSystem::ProcessRawInput(HRAWINPUT hInput)
if (pData->header.dwType == RIM_TYPEKEYBOARD) if (pData->header.dwType == RIM_TYPEKEYBOARD)
{ {
// Keyboard event, so identify which keyboard produced event // Keyboard event, so identify which keyboard produced event
BOOL *pKeyState = NULL; bool *pKeyState = NULL;
size_t kbdNum; size_t kbdNum;
for (kbdNum = 0; kbdNum < m_rawKeyboards.size(); kbdNum++) for (kbdNum = 0; kbdNum < m_rawKeyboards.size(); kbdNum++)
{ {
@ -843,9 +843,9 @@ void CDirectInputSystem::ProcessRawInput(HRAWINPUT hInput)
if (pKeyState != NULL) if (pKeyState != NULL)
{ {
// Get scancode of key and whether key was pressed or released // Get scancode of key and whether key was pressed or released
BOOL isRight = pData->data.keyboard.Flags & RI_KEY_E0; int isRight = (pData->data.keyboard.Flags & RI_KEY_E0);
UINT8 scanCode = (pData->data.keyboard.MakeCode & 0x7f) | (isRight ? 0x80 : 0x00); UINT8 scanCode = (pData->data.keyboard.MakeCode & 0x7f) | (isRight ? 0x80 : 0x00);
BOOL pressed = !(pData->data.keyboard.Flags & RI_KEY_BREAK); bool pressed = !(pData->data.keyboard.Flags & RI_KEY_BREAK);
// Store current state for key // Store current state for key
if (scanCode != 0xAA) if (scanCode != 0xAA)
@ -1113,7 +1113,7 @@ void CDirectInputSystem::OpenJoysticks()
// If joystick has force feedback capabilities then disable auto-center // If joystick has force feedback capabilities then disable auto-center
if (joyDetails.hasFFeedback) if (joyDetails.hasFFeedback)
{ {
dipdw.dwData = FALSE; dipdw.dwData = false;
if (FAILED(hr = joystick->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph))) if (FAILED(hr = joystick->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph)))
{ {
@ -1188,10 +1188,10 @@ void CDirectInputSystem::PollJoysticks()
pJoyState->lRy = (LONG)-gamepad.sThumbRY; pJoyState->lRy = (LONG)-gamepad.sThumbRY;
pJoyState->lRz = (LONG)CInputSource::Scale(gamepad.bRightTrigger, 0, 255, 0, 32767); pJoyState->lRz = (LONG)CInputSource::Scale(gamepad.bRightTrigger, 0, 255, 0, 32767);
WORD buttons = gamepad.wButtons; WORD buttons = gamepad.wButtons;
BOOL dUp = buttons & XINPUT_GAMEPAD_DPAD_UP; int dUp = (buttons & XINPUT_GAMEPAD_DPAD_UP);
BOOL dDown = buttons & XINPUT_GAMEPAD_DPAD_DOWN; int dDown = (buttons & XINPUT_GAMEPAD_DPAD_DOWN);
BOOL dLeft = buttons & XINPUT_GAMEPAD_DPAD_LEFT; int dLeft = (buttons & XINPUT_GAMEPAD_DPAD_LEFT);
BOOL dRight = buttons & XINPUT_GAMEPAD_DPAD_RIGHT; int dRight = (buttons & XINPUT_GAMEPAD_DPAD_RIGHT);
if (dUp) if (dUp)
{ {
if (dLeft) pJoyState->rgdwPOV[0] = 31500; if (dLeft) pJoyState->rgdwPOV[0] = 31500;
@ -1494,7 +1494,7 @@ bool CDirectInputSystem::IsKeyPressed(int kbdNum, int keyIndex)
if (m_useRawInput) if (m_useRawInput)
{ {
// For RawInput, check if key is currently pressed for given keyboard number // For RawInput, check if key is currently pressed for given keyboard number
BOOL *keyState = m_rawKeyStates[kbdNum]; bool *keyState = m_rawKeyStates[kbdNum];
return !!keyState[diKey]; return !!keyState[diKey];
} }
@ -1877,9 +1877,9 @@ bool CDirectInputSystem::Poll()
void CDirectInputSystem::SetMouseVisibility(bool visible) void CDirectInputSystem::SetMouseVisibility(bool visible)
{ {
if (m_useRawInput) if (m_useRawInput)
ShowCursor(!m_grabMouse && visible ? TRUE : FALSE); ShowCursor(!m_grabMouse && visible ? true : false);
else else
ShowCursor(visible ? TRUE : FALSE); ShowCursor(visible ? true : false);
} }
void CDirectInputSystem::GrabMouse() void CDirectInputSystem::GrabMouse()

View file

@ -59,7 +59,7 @@ struct DIEnumDevsContext
// RawInput API // RawInput API
typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDeviceListPtr)(OUT PRAWINPUTDEVICELIST pRawInputDeviceList, IN OUT PUINT puiNumDevices, IN UINT cbSize); typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDeviceListPtr)(OUT PRAWINPUTDEVICELIST pRawInputDeviceList, IN OUT PUINT puiNumDevices, IN UINT cbSize);
typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDeviceInfoPtr)(IN HANDLE hDevice, IN UINT uiCommand, OUT LPVOID pData, IN OUT PUINT pcbSize); typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDeviceInfoPtr)(IN HANDLE hDevice, IN UINT uiCommand, OUT LPVOID pData, IN OUT PUINT pcbSize);
typedef /*WINUSERAPI*/ BOOL (WINAPI *RegisterRawInputDevicesPtr)(IN PCRAWINPUTDEVICE pRawInputDevices, IN UINT uiNumDevices, IN UINT cbSize); typedef /*WINUSERAPI*/ bool (WINAPI *RegisterRawInputDevicesPtr)(IN PCRAWINPUTDEVICE pRawInputDevices, IN UINT uiNumDevices, IN UINT cbSize);
typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDataPtr)(IN HRAWINPUT hRawInput, IN UINT uiCommand, OUT LPVOID pData, IN OUT PUINT pcbSize, IN UINT cbSizeHeader); typedef /*WINUSERAPI*/ INT (WINAPI *GetRawInputDataPtr)(IN HRAWINPUT hRawInput, IN UINT uiCommand, OUT LPVOID pData, IN OUT PUINT pcbSize, IN UINT cbSizeHeader);
// XInput API // XInput API
@ -111,7 +111,7 @@ private:
// RawInput keyboard and mice handles and states // RawInput keyboard and mice handles and states
vector<HANDLE> m_rawKeyboards; vector<HANDLE> m_rawKeyboards;
vector<BOOL*> m_rawKeyStates; vector<bool*> m_rawKeyStates;
vector<HANDLE> m_rawMice; vector<HANDLE> m_rawMice;
RawMseState m_combRawMseState; RawMseState m_combRawMseState;
vector<RawMseState> m_rawMseStates; vector<RawMseState> m_rawMseStates;

View file

@ -60,7 +60,7 @@ void CopyRegion(UINT8 *dest, unsigned destOffset, unsigned destSize, UINT8 *src,
} }
// Search for a ROM within a single game based on its CRC // Search for a ROM within a single game based on its CRC
static BOOL FindROMByCRCInGame(const struct GameInfo **gamePtr, int *romIdxPtr, const struct GameInfo *Game, UINT32 crc) static bool FindROMByCRCInGame(const struct GameInfo **gamePtr, int *romIdxPtr, const struct GameInfo *Game, UINT32 crc)
{ {
unsigned j; unsigned j;
@ -78,7 +78,7 @@ static BOOL FindROMByCRCInGame(const struct GameInfo **gamePtr, int *romIdxPtr,
} }
// Search for a ROM in the complete game list based on CRC32 and return its GameInfo and ROMInfo entries // Search for a ROM in the complete game list based on CRC32 and return its GameInfo and ROMInfo entries
static BOOL FindROMByCRC(const struct GameInfo **gamePtr, int *romIdxPtr, const struct GameInfo *GameList, const struct GameInfo *TryGame, UINT32 crc) static bool FindROMByCRC(const struct GameInfo **gamePtr, int *romIdxPtr, const struct GameInfo *GameList, const struct GameInfo *TryGame, UINT32 crc)
{ {
unsigned i; unsigned i;
@ -97,8 +97,8 @@ static BOOL FindROMByCRC(const struct GameInfo **gamePtr, int *romIdxPtr, const
return FAIL; return FAIL;
} }
// Returns TRUE if this ROM appears only a single time in the entire game list (ie., it is not shared between games) // Returns true if this ROM appears only a single time in the entire game list (ie., it is not shared between games)
static BOOL ROMIsUnique(const struct GameInfo *GameList, UINT32 crc) static bool ROMIsUnique(const struct GameInfo *GameList, UINT32 crc)
{ {
int timesFound = 0; int timesFound = 0;
@ -111,7 +111,7 @@ static BOOL ROMIsUnique(const struct GameInfo *GameList, UINT32 crc)
} }
} }
return (timesFound == 1) ? TRUE : FALSE; return (timesFound == 1) ? true : false;
} }
static void ByteSwap(UINT8 *buf, unsigned size) static void ByteSwap(UINT8 *buf, unsigned size)
@ -128,7 +128,7 @@ static void ByteSwap(UINT8 *buf, unsigned size)
} }
// Load a single ROM file // Load a single ROM file
static BOOL LoadROM(UINT8 *buf, unsigned bufSize, const struct ROMMap *Map, const struct ROMInfo *ROM, unzFile zf, const char *zipFile, BOOL loadAll) static bool LoadROM(UINT8 *buf, unsigned bufSize, const struct ROMMap *Map, const struct ROMInfo *ROM, unzFile zf, const char *zipFile, bool loadAll)
{ {
char file[2048+1]; char file[2048+1];
int err, bytes; int err, bytes;
@ -202,7 +202,7 @@ static BOOL LoadROM(UINT8 *buf, unsigned bufSize, const struct ROMMap *Map, cons
* Pointer to GameInfo struct for loaded game if successful, NULL * Pointer to GameInfo struct for loaded game if successful, NULL
* otherwise. Prints errors. * otherwise. Prints errors.
*/ */
const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile, BOOL loadAll) const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile, bool loadAll)
{ {
unzFile zf; unzFile zf;
unz_file_info fileInfo; unz_file_info fileInfo;
@ -212,7 +212,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
unsigned romsFound[sizeof(Game->ROM)/sizeof(struct ROMInfo)], numROMs; unsigned romsFound[sizeof(Game->ROM)/sizeof(struct ROMInfo)], numROMs;
int err; int err;
unsigned i, maxSize; unsigned i, maxSize;
BOOL multipleGameError = FALSE; bool multipleGameError = false;
UINT8 *buf; UINT8 *buf;
// Try to open file // Try to open file
@ -254,10 +254,10 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
if (CurGame != Game) // another game? if (CurGame != Game) // another game?
{ {
DebugLog("%s also contains: %s (%s)\n", zipFile, CurGame->id, CurGame->title); DebugLog("%s also contains: %s (%s)\n", zipFile, CurGame->id, CurGame->title);
if (multipleGameError == FALSE) // only warn about this once if (multipleGameError == false) // only warn about this once
{ {
ErrorLog("Multiple games were found in %s; loading '%s'.", zipFile, Game->title); ErrorLog("Multiple games were found in %s; loading '%s'.", zipFile, Game->title);
multipleGameError = TRUE; multipleGameError = true;
} }
} }
} }
@ -295,7 +295,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
for (i = 0; i < numROMs; i++) for (i = 0; i < numROMs; i++)
{ {
if ((0 == romsFound[i]) && !Game->ROM[i].optional) // if not found and also not optional if ((0 == romsFound[i]) && !Game->ROM[i].optional) // if not found and also not optional
err |= ErrorLog("%s (CRC=%08X) is missing from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile); err |= (int) ErrorLog("%s (CRC=%08X) is missing from %s.", Game->ROM[i].fileName, Game->ROM[i].crc, zipFile);
} }
if (err != OKAY) if (err != OKAY)
{ {
@ -345,6 +345,7 @@ const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const st
// Ensure all ROMs were loaded // Ensure all ROMs were loaded
if (loadAll) if (loadAll)
{ {
// See if any ROMs (that are not optional) could not be found
err = OKAY; err = OKAY;
for (i = 0; i < numROMs; i++) for (i = 0; i < numROMs; i++)
{ {

View file

@ -53,7 +53,7 @@ struct ROMInfo
unsigned groupSize; // number of consecutive bytes to fetch each time (groupSize%2 must = 0, must be consistent for region) unsigned groupSize; // number of consecutive bytes to fetch each time (groupSize%2 must = 0, must be consistent for region)
unsigned offset; // starting offset within ROM region unsigned offset; // starting offset within ROM region
unsigned stride; // number of bytes to skip before loading next group of bytes from file (must be >= groupSize) unsigned stride; // number of bytes to skip before loading next group of bytes from file (must be >= groupSize)
BOOL byteSwap; // swap every pair of bytes if true bool byteSwap; // swap every pair of bytes if true
}; };
/* /*
@ -113,7 +113,7 @@ extern void CopyRegion(UINT8 *dest, unsigned destOffset, unsigned destSize, UINT
* otherwise. Prints errors. * otherwise. Prints errors.
*/ */
extern const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile, extern const struct GameInfo * LoadROMSetFromZIPFile(const struct ROMMap *Map, const struct GameInfo *GameList, const char *zipFile,
BOOL loadAll); bool loadAll);
#endif // INCLUDED_ROMLOAD_H #endif // INCLUDED_ROMLOAD_H

View file

@ -43,9 +43,9 @@
* MPEG_IsPlaying(void): * MPEG_IsPlaying(void):
* *
* Returns: * Returns:
* TRUE if an MPEG stream is currently playing, otherwise FALSE. * TRUE if an MPEG stream is currently playing, otherwise false.
*/ */
extern BOOL MPEG_IsPlaying(void); extern bool MPEG_IsPlaying(void);
/* /*
* MPEG_GetProgress(void): * MPEG_GetProgress(void):
@ -121,7 +121,7 @@ extern void MPEG_StopPlaying(void);
* Returns: * Returns:
* OKAY if successful, FAIL if internal buffer could not be allocated. * OKAY if successful, FAIL if internal buffer could not be allocated.
*/ */
extern BOOL MPEG_Init(void); extern bool MPEG_Init(void);
/* /*
* MPEG_Shutdown(void): * MPEG_Shutdown(void):

View file

@ -373,12 +373,12 @@ void MPEG_StopPlaying(void)
} }
} }
BOOL MPEG_IsPlaying(void) bool MPEG_IsPlaying(void)
{ {
return playing ? TRUE : FALSE; return playing ? TRUE : false;
} }
BOOL MPEG_Init(void) bool MPEG_Init(void)
{ {
if (!decoder_init) if (!decoder_init)
{ {

View file

@ -68,7 +68,6 @@
/* /*
* Fundamental Data Types: * Fundamental Data Types:
* *
* BOOL Boolean (w/ TRUE = FAIL = 1, OKAY = FALSE = 0).
* UINT64 Unsigned 64-bit integer. * UINT64 Unsigned 64-bit integer.
* INT64 Signed 64-bit integer. * INT64 Signed 64-bit integer.
* UINT32 Unsigned 32-bit integer. * UINT32 Unsigned 32-bit integer.
@ -80,6 +79,11 @@
* FLOAT32 Single-precision, 32-bit floating point number. * FLOAT32 Single-precision, 32-bit floating point number.
* FLOAT64 Double-precision, 64-bit floating point number. * FLOAT64 Double-precision, 64-bit floating point number.
* *
* Boolean Values:
*
* OKAY 0
* FAIL 1
*
* Types.h is used within C++ and C modules, so it must NOT include any C++- * Types.h is used within C++ and C modules, so it must NOT include any C++-
* specific stuff. Some modules may choose to include it directly rather than * specific stuff. Some modules may choose to include it directly rather than
* use Supermodel.h, so it must exist. * use Supermodel.h, so it must exist.