Made the Flash save type detection stricter. Made the SRAM detection override the EEPROM detection. Fixes the save type detection for Rockman EXE 4.5 - Real Operation (Japan), Breath of Fire - Ryuu no Senshi (Japan) and maintains the correct detection of the save type for Saibara Rieko no Dendou Mahjong (Japan).

Changed the wx save type detection to use the core version.
This commit is contained in:
skidau 2015-05-18 03:35:37 +00:00
parent ac3abd7bb3
commit 4fdbbefe9b
2 changed files with 15 additions and 47 deletions

View File

@ -714,7 +714,7 @@ void utilGBAFindSave(const int size)
}
} else if (d == 0x4D415253) {
if(memcmp(p, "SRAM_", 5) == 0) {
if(detectedSaveType == 0 || detectedSaveType == 4)
if(detectedSaveType == 0 || detectedSaveType == 1 || detectedSaveType == 4)
detectedSaveType = 2;
}
} else if (d == 0x53414C46) {
@ -723,6 +723,11 @@ void utilGBAFindSave(const int size)
detectedSaveType = 3;
flashSize = 0x20000;
}
} else if (memcmp(p, "FLASH512_", 9) == 0) {
if (detectedSaveType == 0) {
detectedSaveType = 3;
flashSize = 0x10000;
}
} else if(memcmp(p, "FLASH", 5) == 0) {
if(detectedSaveType == 0) {
detectedSaveType = 4;

View File

@ -1575,56 +1575,19 @@ public:
}
void Detect(wxCommandEvent &ev)
{
// note: win32 version just pops up a dialog stating what it found
// which is appropriate becauase it was in a menu
// this code sets the controls instead, since there right there
u32 sz = wxGetApp().frame->GetPanel()->game_size();
#define ch4(a, b, c, d) \
wxUINT32_SWAP_ON_BE(a + (b << 8) + (c << 16) + (d << 24))
utilGBAFindSave(sz);
type->SetSelection(saveType);
for (u32 addr = 0; addr < sz - 10; addr += 4)
if (saveType == 3)
{
switch (*(u32*)&rom[addr])
{
case ch4('E', 'E', 'P', 'R'):
if (memcmp(&rom[addr + 4], "OM_V", 4))
break;
// apparently no sensor autodetection
type->SetSelection(1);
size->Disable();
return;
case ch4('S', 'R', 'A', 'M'):
if (memcmp(&rom[addr + 4], "_V", 2))
break;
type->SetSelection(2);
size->Disable();
return;
case ch4('F', 'L', 'A', 'S'):
if (!memcmp(&rom[addr + 4], "H_V", 3))
{
type->SetSelection(3);
size->SetSelection(0);
size->Enable();
return;
}
else if (!memcmp(&rom[addr + 4], "H1M_V", 5))
{
type->SetSelection(3);
size->SetSelection(1);
size->Enable();
return;
}
break;
}
size->SetSelection(flashSize == 0x20000 ? 1 : 0);
size->Enable();
}
else
{
size->Disable();
}
type->SetSelection(5);
size->Disable();
}
} BatConfigHandler;