SMS: Fixed region detection showing the region based on the previously loaded game's filename when loading a new game

This commit is contained in:
Sour 2024-11-05 18:18:33 +09:00
parent 0fbb19d52c
commit a72b8bff6e
2 changed files with 4 additions and 1 deletions

View file

@ -37,6 +37,8 @@ LoadRomResult SmsConsole::LoadRom(VirtualFile& romFile)
romData.erase(romData.begin(), romData.begin() + 0x200);
}
_filename = romFile.GetFileName();
string ext = romFile.GetFileExtension();
bool isGameGear = ext == ".gg";
if(isGameGear) {
@ -169,7 +171,7 @@ void SmsConsole::UpdateRegion(bool forceUpdate)
}
if(region == ConsoleRegion::Auto) {
string filename = StringUtilities::ToLower(_emu->GetRomInfo().RomFile.GetFileName());
string filename = StringUtilities::ToLower(_filename);
if(filename.find("(europe)") != string::npos || filename.find("(e)") != string::npos) {
region = ConsoleRegion::Pal;
} else {

View file

@ -30,6 +30,7 @@ private:
RomFormat _romFormat = RomFormat::Sms;
SmsModel _model = SmsModel::Sms;
ConsoleRegion _region = ConsoleRegion::Ntsc;
string _filename;
void UpdateRegion(bool forceUpdate);