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,28 +786,40 @@ void MainWnd::OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI)
|
|||
|
||||
void MainWnd::OnOptionsEmulatorSavetypeDetectNow()
|
||||
{
|
||||
if( theApp.cartridgeType != IMAGE_GBA ) return;
|
||||
const int address_max = theApp.romSize - 10;
|
||||
char temp[11]; temp[10] = '\0';
|
||||
CString answer( _T( "This cartridge has probably no backup media." ) );
|
||||
|
||||
for( int address = 0; address < address_max; address += 4 ) {
|
||||
memcpy( temp, &rom[address], 10 );
|
||||
const u8 check = rom[address];
|
||||
|
||||
if( 0 == strncmp( temp, "EEPROM_V", 8 ) ) {
|
||||
answer = _T( "This cartridge uses EEPROM." );
|
||||
break;
|
||||
if( 'E' == check ) {
|
||||
memcpy( temp, &rom[address], 10 );
|
||||
if( 0 == strncmp( temp, "EEPROM_V", 8 ) ) {
|
||||
answer = _T( "This cartridge uses EEPROM." );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( 0 == strncmp( temp, "SRAM_V", 6 ) ) {
|
||||
answer = _T( "This cartridge uses SRAM." );
|
||||
break;
|
||||
|
||||
if( 'S' == check ) {
|
||||
memcpy( temp, &rom[address], 10 );
|
||||
if( 0 == strncmp( temp, "SRAM_V", 6 ) ) {
|
||||
answer = _T( "This cartridge uses SRAM." );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ( 0 == strncmp( temp, "FLASH_V", 7 ) ) || ( 0 == strncmp( temp, "FLASH512_V", 10 ) ) ) {
|
||||
answer = _T( "This cartridge uses FLASH (64 KiB)." );
|
||||
break;
|
||||
}
|
||||
if( 0 == strncmp( temp, "FLASH1M_V", 9 ) ) {
|
||||
answer = _T( "This cartridge uses FLASH (128 KiB)." );
|
||||
break;
|
||||
|
||||
if( 'F' == check ) {
|
||||
memcpy( temp, &rom[address], 10 );
|
||||
if( ( 0 == strncmp( temp, "FLASH_V", 7 ) ) || ( 0 == strncmp( temp, "FLASH512_V", 10 ) ) ) {
|
||||
answer = _T( "This cartridge uses FLASH (64 KiB)." );
|
||||
break;
|
||||
}
|
||||
if( 0 == strncmp( temp, "FLASH1M_V", 9 ) ) {
|
||||
answer = _T( "This cartridge uses FLASH (128 KiB)." );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue