From: <for...@us...> - 2004-02-05 11:41:34
|
Update of /cvsroot/vba/VisualBoyAdvance/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18627 Modified Files: EEprom.cpp Flash.cpp GBA.cpp SDL.cpp Sram.cpp System.h Log Message: Update battery file more often, a while after the game stops writing to it (RFE #882246) Index: EEprom.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/EEprom.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EEprom.cpp 17 Jun 2003 15:34:20 -0000 1.4 --- EEprom.cpp 5 Feb 2004 11:38:30 -0000 1.5 *************** *** 180,183 **** --- 180,184 ---- eepromData[(eepromAddress << 3) + i] = eepromBuffer[i]; } + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; } else if(eepromBits == 0x41) { eepromMode = EEPROM_IDLE; Index: Flash.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Flash.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Flash.cpp 12 Jun 2003 10:45:09 -0000 1.5 --- Flash.cpp 5 Feb 2004 11:38:30 -0000 1.6 *************** *** 208,215 **** --- 208,217 ---- 0, 0x1000); + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashReadState = FLASH_ERASE_COMPLETE; } else if(byte == 0x10) { // CHIP ERASE memset(flashSaveMemory, 0, flashSize); + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashReadState = FLASH_ERASE_COMPLETE; } else { *************** *** 231,234 **** --- 233,237 ---- case FLASH_PROGRAM: flashSaveMemory[(flashBank<<16)+address] = byte; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashState = FLASH_READ_ARRAY; flashReadState = FLASH_READ_ARRAY; Index: GBA.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/GBA.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** GBA.cpp 28 Jan 2004 17:59:29 -0000 1.50 --- GBA.cpp 5 Feb 2004 11:38:30 -0000 1.51 *************** *** 809,812 **** --- 809,814 ---- if(eepromInUse) gbaSaveType = 3; + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; return true; *************** *** 1089,1092 **** --- 1091,1096 ---- long size = ftell(file); fseek(file, 0, SEEK_SET); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + if(size == 512 || size == 0x2000) { if(fread(eepromData, 1, size, file) != (size_t)size) { *************** *** 1250,1253 **** --- 1254,1259 ---- elfCleanUp(); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + emulating = 0; } *************** *** 1260,1263 **** --- 1266,1271 ---- CPUCleanUp(); } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; rom = (u8 *)malloc(0x2000000); *************** *** 3273,3276 **** --- 3281,3286 ---- break; } + + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; lastTime = systemGetClock(); Index: SDL.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/SDL.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** SDL.cpp 31 Jan 2004 01:14:36 -0000 1.51 --- SDL.cpp 5 Feb 2004 11:38:30 -0000 1.52 *************** *** 148,151 **** --- 148,152 ---- int systemVerbose = 0; int systemFrameSkip = 0; + int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; int srcPitch = 0; *************** *** 2176,2179 **** --- 2177,2182 ---- } + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + if(optind < argc) { char *szFile = argv[optind]; *************** *** 2873,2876 **** --- 2876,2887 ---- } } + + if(systemSaveUpdateCounter) { + if(--systemSaveUpdateCounter <= SYSTEM_SAVE_NOT_UPDATED) { + sdlWriteBattery(); + systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; + } + } + wasPaused = false; autoFrameSkipLastTime = time; Index: Sram.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/Sram.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sram.cpp 20 Oct 2002 13:03:12 -0000 1.1 --- Sram.cpp 5 Feb 2004 11:38:30 -0000 1.2 *************** *** 29,31 **** --- 29,32 ---- { flashSaveMemory[address & 0xFFFF] = byte; + systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; } Index: System.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/System.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** System.h 28 Jan 2004 17:59:31 -0000 1.11 --- System.h 5 Feb 2004 11:38:30 -0000 1.12 *************** *** 117,120 **** --- 117,124 ---- extern int systemVerbose; extern int systemFrameSkip; + extern int systemSaveUpdateCounter; + + #define SYSTEM_SAVE_UPDATED 30 + #define SYSTEM_SAVE_NOT_UPDATED 0 #endif //VBA_SYSTEM_H |