- add FLASH 8mbit save type support and fix import backup memory;
This commit is contained in:
parent
a11364e8d9
commit
5e0a1bb8d1
|
@ -64,18 +64,19 @@ static const u8 kUninitializedSaveDataValue = 0x00;
|
||||||
|
|
||||||
static const char* kDesmumeSaveCookie = "|-DESMUME SAVE-|";
|
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);
|
static const u32 saveSizes_count = ARRAY_SIZE(saveSizes);
|
||||||
|
|
||||||
//the lookup table from user save types to save parameters
|
//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_AUTODETECT,1},
|
||||||
{MC_TYPE_EEPROM1,MC_SIZE_4KBITS},
|
{MC_TYPE_EEPROM1,MC_SIZE_4KBITS},
|
||||||
{MC_TYPE_EEPROM2,MC_SIZE_64KBITS},
|
{MC_TYPE_EEPROM2,MC_SIZE_64KBITS},
|
||||||
{MC_TYPE_EEPROM2,MC_SIZE_512KBITS},
|
{MC_TYPE_EEPROM2,MC_SIZE_512KBITS},
|
||||||
{MC_TYPE_FRAM,MC_SIZE_256KBITS},
|
{MC_TYPE_FRAM,MC_SIZE_256KBITS},
|
||||||
{MC_TYPE_FLASH,MC_SIZE_2MBITS},
|
{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)
|
void backup_setManualBackupType(int type)
|
||||||
|
@ -917,13 +918,17 @@ void BackupDevice::raw_applyUserSettings(u32& size)
|
||||||
{
|
{
|
||||||
//respect the user's choice of backup memory type
|
//respect the user's choice of backup memory type
|
||||||
if(CommonSettings.manualBackupType == MC_TYPE_AUTODETECT)
|
if(CommonSettings.manualBackupType == MC_TYPE_AUTODETECT)
|
||||||
|
{
|
||||||
addr_size = addr_size_for_old_save_size(size);
|
addr_size = addr_size_for_old_save_size(size);
|
||||||
|
data.resize(size);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int savetype = save_types[CommonSettings.manualBackupType][0];
|
int savetype = save_types[CommonSettings.manualBackupType][0];
|
||||||
int savesize = save_types[CommonSettings.manualBackupType][1];
|
int savesize = save_types[CommonSettings.manualBackupType][1];
|
||||||
addr_size = addr_size_for_old_save_type(savetype);
|
addr_size = addr_size_for_old_save_type(savetype);
|
||||||
if((u32)savesize<size) size = savesize;
|
if((u32)savesize<size) size = savesize;
|
||||||
|
data.resize(savesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
state = RUNNING;
|
state = RUNNING;
|
||||||
|
@ -936,10 +941,9 @@ bool BackupDevice::load_raw(const char* filename)
|
||||||
fseek(inf, 0, SEEK_END);
|
fseek(inf, 0, SEEK_END);
|
||||||
u32 size = (u32)ftell(inf);
|
u32 size = (u32)ftell(inf);
|
||||||
fseek(inf, 0, SEEK_SET);
|
fseek(inf, 0, SEEK_SET);
|
||||||
|
|
||||||
raw_applyUserSettings(size);
|
raw_applyUserSettings(size);
|
||||||
|
|
||||||
data.resize(size);
|
|
||||||
fread(&data[0],1,size,inf);
|
fread(&data[0],1,size,inf);
|
||||||
fclose(inf);
|
fclose(inf);
|
||||||
|
|
||||||
|
|
|
@ -3706,8 +3706,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||||
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, lostFocusPause);
|
MainWindow->checkMenu(IDC_BACKGROUNDPAUSE, lostFocusPause);
|
||||||
|
|
||||||
//Save type
|
//Save type
|
||||||
const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7};
|
const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7,IDC_SAVETYPE8};
|
||||||
for(int i=0;i<7;i++)
|
for(int i=0;i<8;i++)
|
||||||
MainWindow->checkMenu(savelist[i], false);
|
MainWindow->checkMenu(savelist[i], false);
|
||||||
MainWindow->checkMenu(savelist[CommonSettings.manualBackupType], true);
|
MainWindow->checkMenu(savelist[CommonSettings.manualBackupType], true);
|
||||||
|
|
||||||
|
@ -4936,6 +4936,7 @@ DOKEYDOWN:
|
||||||
case IDC_SAVETYPE5: backup_setManualBackupType(4); return 0;
|
case IDC_SAVETYPE5: backup_setManualBackupType(4); return 0;
|
||||||
case IDC_SAVETYPE6: backup_setManualBackupType(5); return 0;
|
case IDC_SAVETYPE6: backup_setManualBackupType(5); return 0;
|
||||||
case IDC_SAVETYPE7: backup_setManualBackupType(6); return 0;
|
case IDC_SAVETYPE7: backup_setManualBackupType(6); return 0;
|
||||||
|
case IDC_SAVETYPE8: backup_setManualBackupType(7); return 0;
|
||||||
|
|
||||||
case IDM_RESET:
|
case IDM_RESET:
|
||||||
ResetGame();
|
ResetGame();
|
||||||
|
|
|
@ -700,6 +700,7 @@
|
||||||
#define ID_RAMSEARCH_CAPTIONTEXT 40064
|
#define ID_RAMSEARCH_CAPTIONTEXT 40064
|
||||||
#define IDM_VIEW3D 40065
|
#define IDM_VIEW3D 40065
|
||||||
#define IDM_LOCKDOWN 40066
|
#define IDM_LOCKDOWN 40066
|
||||||
|
#define IDC_SAVETYPE8 40067
|
||||||
#define IDC_LABEL_UP 50000
|
#define IDC_LABEL_UP 50000
|
||||||
#define IDC_LABEL_RIGHT 50001
|
#define IDC_LABEL_RIGHT 50001
|
||||||
#define IDC_LABEL_LEFT 50002
|
#define IDC_LABEL_LEFT 50002
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue