diff --git a/src/win32/Commands.cpp b/src/win32/Commands.cpp index 87a803fe..7fc34e8e 100644 --- a/src/win32/Commands.cpp +++ b/src/win32/Commands.cpp @@ -121,6 +121,7 @@ struct { { "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR }, { "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K }, { "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M }, + { "OptionsEmulatorSaveDetectNow", ID_OPTIONS_EMULATOR_SAVETYPE_DETECTNOW }, { "OptionsEmulatorAutoApplyPatchFiles", ID_OPTIONS_EMULATOR_AUTOMATICALLYAPPLYPATCHFILES }, { "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT }, { "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK }, diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index bb3b539a..ba7069e0 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -791,10 +791,14 @@ void MainWnd::OnOptionsEmulatorSavetypeDetectNow() 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 ) { - const u8 check = rom[address]; + const u32 EEPR = 'E' | ( 'E' << 8 ) | ( 'P' << 16 ) | ( 'R' << 24 ); + 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 ); if( 0 == strncmp( temp, "EEPROM_V", 8 ) ) { answer = _T( "This cartridge uses EEPROM." ); @@ -802,15 +806,15 @@ void MainWnd::OnOptionsEmulatorSavetypeDetectNow() } } - if( 'S' == check ) { + if( SRAM == check ) { 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." ); break; } } - if( 'F' == check ) { + if( FLAS == 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)." );