Use game disc title in log message

This commit is contained in:
Luke Street 2022-02-23 01:38:01 -05:00
parent 9966ca13fb
commit 848a8e4201
3 changed files with 38 additions and 32 deletions

View File

@ -23,6 +23,7 @@ struct MetaforceVersionInfo {
std::string version; std::string version;
ERegion region; ERegion region;
EGame game; EGame game;
std::string gameTitle;
}; };
class CStopwatch; class CStopwatch;
@ -47,6 +48,7 @@ public:
virtual bool IsUSA() const = 0; virtual bool IsUSA() const = 0;
virtual bool IsKorean() const = 0; virtual bool IsKorean() const = 0;
virtual bool IsTrilogy() const = 0; virtual bool IsTrilogy() const = 0;
virtual std::string GetGameTitle() const = 0;
virtual std::string_view GetVersionString() const = 0; virtual std::string_view GetVersionString() const = 0;
virtual void Quit() = 0; virtual void Quit() = 0;
virtual bool IsPaused() const = 0; virtual bool IsPaused() const = 0;

View File

@ -584,6 +584,7 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IA
m_cvarMgr = cvarMgr; m_cvarMgr = cvarMgr;
m_cvarCommons = std::make_unique<CVarCommons>(*m_cvarMgr); m_cvarCommons = std::make_unique<CVarCommons>(*m_cvarMgr);
{
const auto discInfo = CDvdFile::DiscInfo(); const auto discInfo = CDvdFile::DiscInfo();
if (discInfo.gameId[4] != '0' || discInfo.gameId[5] != '1') { if (discInfo.gameId[4] != '0' || discInfo.gameId[5] != '1') {
Log.report(logvisor::Fatal, FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6}); Log.report(logvisor::Fatal, FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6});
@ -616,6 +617,8 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IA
default: default:
Log.report(logvisor::Fatal, FMT_STRING("Unknown region {}"), discInfo.gameId[3]); Log.report(logvisor::Fatal, FMT_STRING("Unknown region {}"), discInfo.gameId[3]);
} }
m_version.gameTitle = std::move(discInfo.gameTitle);
}
if (m_version.game != EGame::MetroidPrime1 && m_version.game != EGame::MetroidPrimeTrilogy) { if (m_version.game != EGame::MetroidPrime1 && m_version.game != EGame::MetroidPrimeTrilogy) {
Log.report(logvisor::Fatal, FMT_STRING("Unsupported game {}"), magic_enum::enum_name(m_version.game)); Log.report(logvisor::Fatal, FMT_STRING("Unsupported game {}"), magic_enum::enum_name(m_version.game));
@ -642,8 +645,8 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IA
x70_tweaks.RegisterResourceTweaks(m_cvarMgr); x70_tweaks.RegisterResourceTweaks(m_cvarMgr);
AddWorldPaks(); AddWorldPaks();
MainLog.report(logvisor::Level::Info, FMT_STRING("Loading data from {} version {} from region {}"), MainLog.report(logvisor::Level::Info, FMT_STRING("Loading data from {} {} ({})"),
magic_enum::enum_name(GetGame()), GetVersionString(), magic_enum::enum_name(GetRegion())); GetGameTitle(), magic_enum::enum_name(GetRegion()), GetVersionString());
auto args = aurora::get_args(); auto args = aurora::get_args();
for (auto it = args.begin(); it != args.end(); ++it) { for (auto it = args.begin(); it != args.end(); ++it) {

View File

@ -293,6 +293,7 @@ public:
bool IsTrilogy() const override { return m_version.game == EGame::MetroidPrimeTrilogy; } bool IsTrilogy() const override { return m_version.game == EGame::MetroidPrimeTrilogy; }
ERegion GetRegion() const override { return m_version.region; } ERegion GetRegion() const override { return m_version.region; }
EGame GetGame() const override { return m_version.game; } EGame GetGame() const override { return m_version.game; }
std::string GetGameTitle() const override { return m_version.gameTitle; }
std::string_view GetVersionString() const override { return m_version.version; } std::string_view GetVersionString() const override { return m_version.version; }
void Quit() override { m_doQuit = true; } void Quit() override { m_doQuit = true; }
bool IsPaused() const override { return m_paused; } bool IsPaused() const override { return m_paused; }