- fix bugs in import save;

This commit is contained in:
mtabachenko 2013-05-27 18:37:40 +00:00
parent eb3831d4fe
commit 0567969202
3 changed files with 16 additions and 7 deletions

View File

@ -591,7 +591,7 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi
buf[4] = 0;
if (advsc.checkDB(buf, gameInfo.crc))
{
u8 sv = advsc.getSaveType() + 1; // skip autodetect description in save_types[] struct
u8 sv = advsc.getSaveType();
printf("Found in game database by %s:\n",advsc.getIdMethod());
printf("\t* ROM save type: ");
if (sv == 0xFF)
@ -601,7 +601,7 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi
printf("None");
else
{
printf("%s", save_types[sv].descr);
printf("%s", save_types[sv + 1].descr);
if (CommonSettings.autodetectBackupMethod == 1)
backup_setManualBackupType(sv + 1);
}

View File

@ -1038,7 +1038,8 @@ void BackupDevice::loadfile()
info.type = advsc.getSaveType();
if (info.type != 0xFF && info.type != 0xFE)
{
u32 adv_size = save_types[info.type+1].size;
info.type++;
u32 adv_size = save_types[info.type].size;
if (info.size > adv_size)
info.size = adv_size;
else
@ -1065,6 +1066,7 @@ void BackupDevice::loadfile()
info.type = searchFileSaveType(info.size);
if (info.type == 0xFF) info.type = 0;
}
u32 ss = info.size * 8 / 1024;
if (ss >= 1024)
{

View File

@ -40,7 +40,7 @@ BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
{
memset(&buf, 0, sizeof(buf));
u8 sv = advsc.getSaveType() + 1;
u8 sv = advsc.getSaveType();
if (sv == 0xFF)
{
strcpy(buf, "Unknown");
@ -53,13 +53,20 @@ BOOL CALLBACK ImportSizeSelect_Proc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
EnableWindow(GetDlgItem(hDlg, IDC_IMP_AUTO_ADVANSCENE), false);
}
else
strcpy(buf, save_types[sv].descr);
strcpy(buf, save_types[sv + 1].descr);
SetWindowText(GetDlgItem(hDlg, IDC_IMP_INFO_ADVANSCENE), buf);
}
else
EnableWindow(GetDlgItem(hDlg, IDC_IMP_AUTO_ADVANSCENE), false);
SetWindowText(GetDlgItem(hDlg, IDC_IMP_INFO_CURRENT), save_types[MMU_new.backupDevice.info.type+1].descr);
{
u8 type = MMU_new.backupDevice.searchFileSaveType(MMU_new.backupDevice.info.size);
if (type == 0xFF)
SetWindowText(GetDlgItem(hDlg, IDC_IMP_INFO_CURRENT), "NA");
else
SetWindowText(GetDlgItem(hDlg, IDC_IMP_INFO_CURRENT), save_types[type + 1].descr);
}
SendDlgItemMessage(hDlg, IDC_IMP_AUTO_CURRENT, BM_SETCHECK, true, 0);
for (u8 i = 1; i <= MAX_SAVE_TYPES; i++)