- add FLASH 8mbit save type support and fix import backup memory;

This commit is contained in:
mtabachenko 2009-12-21 19:41:52 +00:00
parent a11364e8d9
commit 5e0a1bb8d1
4 changed files with 13 additions and 7 deletions

View File

@ -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)savesize<size) size = savesize;
data.resize(savesize);
}
state = RUNNING;
@ -939,7 +944,6 @@ bool BackupDevice::load_raw(const char* filename)
raw_applyUserSettings(size);
data.resize(size);
fread(&data[0],1,size,inf);
fclose(inf);

View File

@ -3706,8 +3706,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
MainWindow->checkMenu(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();

View File

@ -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

Binary file not shown.