From 2efbe60ac0a36b7ea6c0b171f2a55a3265f179ae Mon Sep 17 00:00:00 2001 From: LittleCoaks Date: Sat, 29 Jul 2023 21:00:17 -0400 Subject: [PATCH] Game Name specification in Core allows Core to know which game we're playing --- Source/Core/Core/Core.cpp | 15 +++++++++++++++ Source/Core/Core/Core.h | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index b0656456aa10..6f6613a096ea 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -171,6 +171,11 @@ static Common::EventHook s_frame_presented = AfterPresentEvent::Register( "Core Frame Presented"); DefaultGeckoCodes CodeWriter; +static GameName mGameBeingPlayed = GameName::UnknownGame; +const std::map mGameMap = { + {"GYQE01", GameName::MarioBaseball}, + {"GFTE01", GameName::ToadstoolTour} +}; bool GetIsThrottlerTempDisabled() { @@ -220,6 +225,9 @@ void FrameUpdateOnCPUThread() // anything that needs to read or write to memory should be getting run from here void RunRioFunctions(const Core::CPUThreadGuard& guard) { + if (mGameBeingPlayed != GameName::MarioBaseball) + return; + if (s_stat_tracker) { s_stat_tracker->Run(guard); } @@ -749,6 +757,13 @@ bool Init(std::unique_ptr boot, const WindowSystemInfo& wsi) s_is_booting.Set(); s_emu_thread = std::thread(EmuThread, std::move(boot), prepared_wsi); + // initialize current game variable + std::string game_id = SConfig::GetInstance().GetGameID(); + if (Core::mGameMap.find(game_id) == mGameMap.end()) + mGameBeingPlayed = GameName::UnknownGame; + else + mGameBeingPlayed = mGameMap.at(game_id); + std::optional> client_codes = GetActiveTagSet(NetPlay::IsNetPlayRunning()).has_value() ? GetActiveTagSet(NetPlay::IsNetPlayRunning()).value().client_codes_vector() : diff --git a/Source/Core/Core/Core.h b/Source/Core/Core/Core.h index 7714fb6c0d98..867f15895815 100644 --- a/Source/Core/Core/Core.h +++ b/Source/Core/Core/Core.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" @@ -49,6 +50,12 @@ enum class State Starting, }; +enum class GameName : u8 { + UnknownGame = 0, + MarioBaseball = 1, + ToadstoolTour = 2, +}; + // Console type values based on: // - YAGCD 4.2.1.1.2 // - OSInit (GameCube ELF from Finding Nemo)