Speed & detection improvement for save type detection tool.
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@897 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
f88eb1a750
commit
bd6f0136f2
|
@ -121,6 +121,7 @@ struct {
|
||||||
{ "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR },
|
{ "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR },
|
||||||
{ "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K },
|
{ "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K },
|
||||||
{ "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M },
|
{ "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M },
|
||||||
|
{ "OptionsEmulatorSaveDetectNow", ID_OPTIONS_EMULATOR_SAVETYPE_DETECTNOW },
|
||||||
{ "OptionsEmulatorAutoApplyPatchFiles", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES },
|
{ "OptionsEmulatorAutoApplyPatchFiles", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES },
|
||||||
{ "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT },
|
{ "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT },
|
||||||
{ "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK },
|
{ "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK },
|
||||||
|
|
|
@ -791,10 +791,14 @@ void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
||||||
char temp[11]; temp[10] = '\0';
|
char temp[11]; temp[10] = '\0';
|
||||||
CString answer( _T( "This cartridge has probably no backup media." ) );
|
CString answer( _T( "This cartridge has probably no backup media." ) );
|
||||||
|
|
||||||
for( int address = 0; address < address_max; address += 4 ) {
|
const u32 EEPR = 'E' | ( 'E' << 8 ) | ( 'P' << 16 ) | ( 'R' << 24 );
|
||||||
const u8 check = rom[address];
|
const u32 SRAM = 'S' | ( 'R' << 8 ) | ( 'A' << 16 ) | ( 'M' << 24 );
|
||||||
|
const u32 FLAS = 'F' | ( 'L' << 8 ) | ( 'A' << 16 ) | ( 'S' << 24 );
|
||||||
|
|
||||||
if( 'E' == check ) {
|
for( int address = 0; address < address_max; address += 4 ) {
|
||||||
|
const u32 check = *((u32*)&rom[address]);
|
||||||
|
|
||||||
|
if( EEPR == check ) {
|
||||||
memcpy( temp, &rom[address], 10 );
|
memcpy( temp, &rom[address], 10 );
|
||||||
if( 0 == strncmp( temp, "EEPROM_V", 8 ) ) {
|
if( 0 == strncmp( temp, "EEPROM_V", 8 ) ) {
|
||||||
answer = _T( "This cartridge uses EEPROM." );
|
answer = _T( "This cartridge uses EEPROM." );
|
||||||
|
@ -802,15 +806,15 @@ void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 'S' == check ) {
|
if( SRAM == check ) {
|
||||||
memcpy( temp, &rom[address], 10 );
|
memcpy( temp, &rom[address], 10 );
|
||||||
if( 0 == strncmp( temp, "SRAM_V", 6 ) ) {
|
if( ( 0 == strncmp( temp, "SRAM_V", 6 ) ) || ( 0 == strncmp( temp, "SRAM_F_V", 8 ) ) ) {
|
||||||
answer = _T( "This cartridge uses SRAM." );
|
answer = _T( "This cartridge uses SRAM." );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 'F' == check ) {
|
if( FLAS == check ) {
|
||||||
memcpy( temp, &rom[address], 10 );
|
memcpy( temp, &rom[address], 10 );
|
||||||
if( ( 0 == strncmp( temp, "FLASH_V", 7 ) ) || ( 0 == strncmp( temp, "FLASH512_V", 10 ) ) ) {
|
if( ( 0 == strncmp( temp, "FLASH_V", 7 ) ) || ( 0 == strncmp( temp, "FLASH512_V", 10 ) ) ) {
|
||||||
answer = _T( "This cartridge uses FLASH (64 KiB)." );
|
answer = _T( "This cartridge uses FLASH (64 KiB)." );
|
||||||
|
|
Loading…
Reference in New Issue