From cefa3dbcf59c1ddc13bf94c0bb093ea5732f68a5 Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 4 Aug 2009 15:36:46 +0000 Subject: [PATCH] add a hack for fixing game sessions that were carelessly initialized with the wrong save size. it may or may not work in any given case, depending on how the game works --- src/mc.cpp | 12 ++++++++++++ src/mc.h | 3 +++ src/windows/main.cpp | 1 + src/windows/resource.h | 1 + src/windows/resources.rc | Bin 674360 -> 675460 bytes 5 files changed, 17 insertions(+) diff --git a/src/mc.cpp b/src/mc.cpp index f3b55c0b3..ecb14051d 100644 --- a/src/mc.cpp +++ b/src/mc.cpp @@ -78,6 +78,12 @@ static const int save_types[7][2] = { {MC_TYPE_FLASH,MC_SIZE_4MBITS} }; +//forces the current +void backup_forceManualBackupType() +{ + MMU_new.backupDevice.forceManualBackupType(); +} + void backup_setManualBackupType(int type) { CommonSettings.manualBackupType = type; @@ -818,3 +824,9 @@ bool BackupDevice::load_movie(std::istream* is) { return true; } + +void BackupDevice::forceManualBackupType() +{ + addr_size = addr_size_for_old_save_size(save_types[CommonSettings.manualBackupType][1]); + state = RUNNING; +} diff --git a/src/mc.h b/src/mc.h index 8cdc4f580..45c5a7cf4 100644 --- a/src/mc.h +++ b/src/mc.h @@ -75,6 +75,8 @@ public: void reset(); void close_rom(); + + void forceManualBackupType(); bool save_state(std::ostream* os); bool load_state(std::istream* is); @@ -142,6 +144,7 @@ void fw_reset_com(memory_chip_t *mc); /* reset communication with mc */ u8 fw_transfer(memory_chip_t *mc, u8 data); void backup_setManualBackupType(int type); +void backup_forceManualBackupType(); #endif /*__FW_H__*/ diff --git a/src/windows/main.cpp b/src/windows/main.cpp index a2071e287..bd2edb79d 100644 --- a/src/windows/main.cpp +++ b/src/windows/main.cpp @@ -3451,6 +3451,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDC_SAVETYPE5: backup_setManualBackupType(4); return 0; case IDC_SAVETYPE6: backup_setManualBackupType(5); return 0; case IDC_SAVETYPE7: backup_setManualBackupType(6); return 0; + case IDC_SAVETYPE_FORCE: backup_forceManualBackupType(); return 0; case IDM_RESET: ResetGame(); diff --git a/src/windows/resource.h b/src/windows/resource.h index 6a8fbdae5..8345c447e 100644 --- a/src/windows/resource.h +++ b/src/windows/resource.h @@ -77,6 +77,7 @@ #define IDC_SAVETYPE4 185 #define IDC_SAVETYPE5 186 #define IDC_SAVETYPE6 187 +#define IDC_SAVETYPE_FORCE 188 #define IDC_FRAMESKIPAUTO 190 #define IDC_FRAMESKIP0 191 #define IDC_FRAMESKIP1 192 diff --git a/src/windows/resources.rc b/src/windows/resources.rc index 30896884ae346c53c6339e8dbe9da7388a09a33d..8a45d4214070c6d34349725da53a50eca7673a6a 100644 GIT binary patch delta 369 zcmdlnMYCnD=7vQ!(;c3$NKN1HkHtyejlrKGh{2h`l|g~Qks%mJIx~a<9B17h~=8@MiLH5YBA7JI&et?y$!UX_Y@m_`i delta 89 zcmZpftGQ!}=7vQ!(+@DS>NPL0ZC_x^2*ga=7uYiU-3E(JUSP|%y+Vpb>l2vUzJQk% hh}nRceft7lju*ec!qXS