PSFLoader: Detect region from exe

This commit is contained in:
Connor McLaughlin
2021-01-24 13:55:19 +10:00
parent 10135e08a2
commit 253b115b11
4 changed files with 30 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include "psf_loader.h"
#include "bios.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/log.h"
@ -159,6 +160,16 @@ bool File::Load(const char* path)
}
}
// Region detection.
m_region = BIOS::GetPSExeDiscRegion(*reinterpret_cast<const BIOS::PSEXEHeader*>(m_program_data.data()));
// _refresh tag takes precedence.
const int refresh_tag = GetTagInt("_region", 0);
if (refresh_tag == 60)
m_region = DiscRegion::NTSC_U;
else if (refresh_tag == 50)
m_region = DiscRegion::PAL;
return true;
}