From: Spacy <sp...@us...> - 2006-05-27 14:47:38
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gb In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6380/src/gb Modified Files: GB.cpp GB.h gbCheats.cpp Log Message: vs2005 compatibility, minor changes/fixes Index: GB.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/GB.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GB.cpp 13 May 2006 16:32:15 -0000 1.25 --- GB.cpp 27 May 2006 14:47:33 -0000 1.26 *************** *** 2092,2104 **** } ! void gbReset() { - - gbCgbMode = 0; gbSgbMode = 0; - oldRegister_WY = 146; - gbInterruptLaunched = 0; - if(gbRom[0x143] & 0x80) { if((gbEmulatorType == 0) || --- 2092,2099 ---- } ! void gbGetHardwareType() { gbCgbMode = 0; gbSgbMode = 0; if(gbRom[0x143] & 0x80) { if((gbEmulatorType == 0) || *************** *** 2106,2129 **** gbEmulatorType == 4) { gbCgbMode = 1; - if (gbVram == NULL) - gbVram = (u8 *)malloc(0x4000); - if (gbWram == NULL) - gbWram = (u8 *)malloc(0x8000); - memset(gbVram,0,0x4000); - memset(gbPalette,0, 2*128); } } ! else ! { ! if(gbVram != NULL) { ! free(gbVram); ! gbVram = NULL; ! } ! if(gbWram != NULL) { ! free(gbWram); ! gbWram = NULL; ! } ! } ! if((gbCgbMode == 0 ) && (gbRom[0x146] == 0x03)) { if(gbEmulatorType == 0 || --- 2101,2107 ---- gbEmulatorType == 4) { gbCgbMode = 1; } } ! if((gbCgbMode == 0 ) && (gbRom[0x146] == 0x03)) { if(gbEmulatorType == 0 || *************** *** 2144,2147 **** --- 2122,2153 ---- if (gbHardware & 8) // If GBA is selected, choose the GBA default settings. gbGBCColorType = 2; // (0 = GBC, 1 = GBA, 2 = GBASP) + } + + void gbReset() + { + gbGetHardwareType(); + + oldRegister_WY = 146; + gbInterruptLaunched = 0; + + if(gbCgbMode == 1) { + if (gbVram == NULL) + gbVram = (u8 *)malloc(0x4000); + if (gbWram == NULL) + gbWram = (u8 *)malloc(0x8000); + memset(gbVram,0,0x4000); + memset(gbPalette,0, 2*128); + } + else + { + if(gbVram != NULL) { + free(gbVram); + gbVram = NULL; + } + if(gbWram != NULL) { + free(gbWram); + gbWram = NULL; + } + } gbLYChangeHappened = false; Index: GB.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/GB.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GB.h 30 Apr 2006 14:41:06 -0000 1.7 --- GB.h 27 May 2006 14:47:33 -0000 1.8 *************** *** 43,46 **** --- 43,47 ---- extern void gbSoundReset(); extern void gbSoundSetQuality(int); + extern void gbGetHardwareType(); extern void gbReset(); extern void gbCleanUp(); Index: gbCheats.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gb/gbCheats.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gbCheats.cpp 4 Jan 2006 13:38:47 -0000 1.9 --- gbCheats.cpp 27 May 2006 14:47:33 -0000 1.10 *************** *** 164,168 **** bool gbVerifyGsCode(const char *code) { ! int len = strlen(code); if(len == 0) --- 164,168 ---- bool gbVerifyGsCode(const char *code) { ! size_t len = strlen(code); if(len == 0) *************** *** 229,233 **** bool gbVerifyGgCode(const char *code) { ! int len = strlen(code); if(len != 11 && --- 229,233 ---- bool gbVerifyGgCode(const char *code) { ! size_t len = strlen(code); if(len != 11 && *************** *** 314,318 **** int i = gbCheatNumber; ! int len = strlen(code); strcpy(gbCheatList[i].cheatCode, code); --- 314,318 ---- int i = gbCheatNumber; ! size_t len = strlen(code); strcpy(gbCheatList[i].cheatCode, code); |