From 5e0a1bb8d14fd42add7f046ada0d4ef5aa7ba431 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Mon, 21 Dec 2009 19:41:52 +0000 Subject: [PATCH] - add FLASH 8mbit save type support and fix import backup memory; --- desmume/src/mc.cpp | 14 +++++++++----- desmume/src/windows/main.cpp | 5 +++-- desmume/src/windows/resource.h | 1 + desmume/src/windows/resources.rc | Bin 888274 -> 888944 bytes 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index 0c6406c7f..40a7c9ee9 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -64,18 +64,19 @@ static const u8 kUninitializedSaveDataValue = 0x00; static const char* kDesmumeSaveCookie = "|-DESMUME SAVE-|"; -static const u32 saveSizes[] = {512,8*1024,32*1024,64*1024,256*1024,512*1024,0xFFFFFFFF}; +static const u32 saveSizes[] = {512,8*1024,32*1024,64*1024,256*1024,512*1024,1024*1024,0xFFFFFFFF}; static const u32 saveSizes_count = ARRAY_SIZE(saveSizes); //the lookup table from user save types to save parameters -static const int save_types[7][2] = { +static const int save_types[8][2] = { {MC_TYPE_AUTODETECT,1}, {MC_TYPE_EEPROM1,MC_SIZE_4KBITS}, {MC_TYPE_EEPROM2,MC_SIZE_64KBITS}, {MC_TYPE_EEPROM2,MC_SIZE_512KBITS}, {MC_TYPE_FRAM,MC_SIZE_256KBITS}, {MC_TYPE_FLASH,MC_SIZE_2MBITS}, - {MC_TYPE_FLASH,MC_SIZE_4MBITS} + {MC_TYPE_FLASH,MC_SIZE_4MBITS}, + {MC_TYPE_FLASH,MC_SIZE_8MBITS} }; void backup_setManualBackupType(int type) @@ -917,13 +918,17 @@ void BackupDevice::raw_applyUserSettings(u32& size) { //respect the user's choice of backup memory type if(CommonSettings.manualBackupType == MC_TYPE_AUTODETECT) + { addr_size = addr_size_for_old_save_size(size); + data.resize(size); + } else { int savetype = save_types[CommonSettings.manualBackupType][0]; int savesize = save_types[CommonSettings.manualBackupType][1]; addr_size = addr_size_for_old_save_type(savetype); if((u32)savesizecheckMenu(IDC_BACKGROUNDPAUSE, lostFocusPause); //Save type - const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7}; - for(int i=0;i<7;i++) + const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7,IDC_SAVETYPE8}; + for(int i=0;i<8;i++) MainWindow->checkMenu(savelist[i], false); MainWindow->checkMenu(savelist[CommonSettings.manualBackupType], true); @@ -4936,6 +4936,7 @@ DOKEYDOWN: 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_SAVETYPE8: backup_setManualBackupType(7); return 0; case IDM_RESET: ResetGame(); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 7e94c0267..5f9ef3579 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -700,6 +700,7 @@ #define ID_RAMSEARCH_CAPTIONTEXT 40064 #define IDM_VIEW3D 40065 #define IDM_LOCKDOWN 40066 +#define IDC_SAVETYPE8 40067 #define IDC_LABEL_UP 50000 #define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_LEFT 50002 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 8d763cd0ef9a5a3c6d4d3fec439d8e0b16866765..ba3cf44325a18fd2e3614b6aeb36e2a81a2dbcaf 100644 GIT binary patch delta 214 zcmcaK+w8*vvxXMNEljUUrui|+Om8S*;$gIy{&6yw`}9q^tYXs(oO$)yB}$oqn0dQI zDT~8eJnGt%Slio_*tWMRv76yj_v$=*`>XRD+h3jMOgVzvylK<91loJ1Z~-y*_MRy` UMLTe-oxZ`JS8BVPFK>?n0C@XN3;+NC delta 140 zcmeyc!0gg&vxXMNEljUUre8?n(wRO%nU$@5Q7ID;GjCs1%3`w?EZz7hn65X