Backup media detection tool: improve speed & ignore if running non-GBA
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@896 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
15da28c26a
commit
f88eb1a750
|
@ -786,21 +786,32 @@ void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI)
|
||||||
|
|
||||||
void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
||||||
{
|
{
|
||||||
|
if( theApp.cartridgeType != IMAGE_GBA ) return;
|
||||||
const int address_max = theApp.romSize - 10;
|
const int address_max = theApp.romSize - 10;
|
||||||
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 ) {
|
for( int address = 0; address < address_max; address += 4 ) {
|
||||||
memcpy( temp, &rom[address], 10 );
|
const u8 check = rom[address];
|
||||||
|
|
||||||
|
if( 'E' == check ) {
|
||||||
|
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." );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 'S' == check ) {
|
||||||
|
memcpy( temp, &rom[address], 10 );
|
||||||
if( 0 == strncmp( temp, "SRAM_V", 6 ) ) {
|
if( 0 == strncmp( temp, "SRAM_V", 6 ) ) {
|
||||||
answer = _T( "This cartridge uses SRAM." );
|
answer = _T( "This cartridge uses SRAM." );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( 'F' == check ) {
|
||||||
|
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)." );
|
||||||
break;
|
break;
|
||||||
|
@ -810,6 +821,7 @@ void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MessageBox( answer );
|
MessageBox( answer );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue