From 316eb532aa750785df460e6d44dec2444f5b213f Mon Sep 17 00:00:00 2001 From: LittleCoaks Date: Sat, 29 Jul 2023 20:21:45 -0400 Subject: [PATCH 1/3] fix auto update bug --- .../Core/DolphinQt/Settings/GeneralPane.cpp | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index 85fedc688762..06a5b20ea300 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -283,25 +283,25 @@ void GeneralPane::LoadConfig() SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX); } -static QString UpdateTrackFromIndex(int index) -{ - QString value; - - switch (index) - { - case AUTO_UPDATE_DISABLE_INDEX: - value = QString::fromStdString(AUTO_UPDATE_DISABLE_STRING); - break; - case AUTO_UPDATE_BETA_INDEX: - value = QString::fromStdString(AUTO_UPDATE_BETA_STRING); - break; - case AUTO_UPDATE_DEV_INDEX: - value = QString::fromStdString(AUTO_UPDATE_DEV_STRING); - break; - } - - return value; -} +//static QString UpdateTrackFromIndex(int index) +//{ +// QString value; +// +// switch (index) +// { +// case AUTO_UPDATE_DISABLE_INDEX: +// value = QString::fromStdString(AUTO_UPDATE_DISABLE_STRING); +// break; +// case AUTO_UPDATE_BETA_INDEX: +// value = QString::fromStdString(AUTO_UPDATE_BETA_STRING); +// break; +// case AUTO_UPDATE_DEV_INDEX: +// value = QString::fromStdString(AUTO_UPDATE_DEV_STRING); +// break; +// } +// +// return value; +//} static DiscIO::Region UpdateFallbackRegionFromIndex(int index) { @@ -333,11 +333,11 @@ void GeneralPane::OnSaveConfig() Config::ConfigChangeCallbackGuard config_guard; auto& settings = SConfig::GetInstance(); - if (AutoUpdateChecker::SystemSupportsAutoUpdates()) - { - Settings::Instance().SetAutoUpdateTrack( - UpdateTrackFromIndex(m_combobox_update_track->currentIndex())); - } + //if (AutoUpdateChecker::SystemSupportsAutoUpdates()) + //{ + // Settings::Instance().SetAutoUpdateTrack( + // UpdateTrackFromIndex(m_combobox_update_track->currentIndex())); + //} #ifdef USE_DISCORD_PRESENCE Discord::SetDiscordPresenceEnabled(m_checkbox_discord_presence->isChecked()); From 2efbe60ac0a36b7ea6c0b171f2a55a3265f179ae Mon Sep 17 00:00:00 2001 From: LittleCoaks Date: Sat, 29 Jul 2023 21:00:17 -0400 Subject: [PATCH 2/3] 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) From bdca6a6bfc71d19ab9d52af33bd286774b09d8d6 Mon Sep 17 00:00:00 2001 From: LittleCoaks Date: Sat, 29 Jul 2023 22:30:42 -0400 Subject: [PATCH 3/3] Update Gecko Codes tab for MGTT --- Source/Core/Core/GeckoCodeConfig.cpp | 11 ++++++++--- Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp | 12 +++++++++--- Source/Core/DolphinQt/Config/PropertiesDialog.cpp | 13 ++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index 2fbae89df028..a321b5c54907 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -23,9 +23,14 @@ std::vector DownloadCodes(std::string gametdb_id, bool* succeeded, bo const std::string protocol = use_https ? "https://" : "http://"; // codes.rc24.xyz is a mirror of the now defunct geckocodes.org. - std::string endpoint = (gametdb_id == "GYQE01") ? - "https://pastebin.com/raw/cPBAFkKf" : - "https://codes.rc24.xyz/txt.php?txt=" + gametdb_id; + std::string endpoint; + if (gametdb_id == "GYQE01") + endpoint = "https://pastebin.com/raw/cPBAFkKf"; + else if (gametdb_id == "GFTE01") + endpoint = "https://pastebin.com/raw/N1aupMyU"; + else + endpoint = "https://codes.rc24.xyz/txt.php?txt=" + gametdb_id; + Common::HttpRequest http; // The server always redirects once to the same location. diff --git a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp index ad75794846b5..efe9d667edb7 100644 --- a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp @@ -87,9 +87,15 @@ void GeckoCodeWidget::CreateWidgets() m_remove_code = new NonDefaultQPushButton(tr("&Remove Code")); m_download_codes = new NonDefaultQPushButton(tr("Download Codes")); - m_download_codes->setToolTip(tr(m_game_id == "GYQE01" ? - "Download Mario Superstar Baseball Codes" : - "Download Codes from WiiRD Database")); + std::string download_codes_tooltip; + if (m_game_id == "GYQE01") { + download_codes_tooltip = "Download Mario Superstar Baseball Codes"; + } else if (m_game_id == "GFTE01") { + download_codes_tooltip = "Download Mario Golf Toadstool Tour Codes"; + } else { + "Download Codes from WiiRD Database"; + } + m_download_codes->setToolTip(QString::fromStdString(download_codes_tooltip)); m_code_list->setEnabled(!m_game_id.empty()); m_name_label->setEnabled(!m_game_id.empty()); diff --git a/Source/Core/DolphinQt/Config/PropertiesDialog.cpp b/Source/Core/DolphinQt/Config/PropertiesDialog.cpp index b79e9b6f22db..5feae7f7526a 100644 --- a/Source/Core/DolphinQt/Config/PropertiesDialog.cpp +++ b/Source/Core/DolphinQt/Config/PropertiesDialog.cpp @@ -102,20 +102,23 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga GeckoDialog::GeckoDialog(QWidget* parent) : QDialog(parent) { - setWindowTitle(QStringLiteral("%1 - %2") - .arg(QString::fromStdString("Gecko Codes"), QString::fromStdString("(Game ID: GYQE01)"))); + setWindowTitle(QStringLiteral("%1") + .arg(QString::fromStdString("Gecko Codes"))); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QVBoxLayout* layout = new QVBoxLayout(); QTabWidget* tab_widget = new QTabWidget(this); - GeckoCodeWidget* gecko = new GeckoCodeWidget("GYQE01", "GYQE01", 0); + GeckoCodeWidget* mssb_gecko = new GeckoCodeWidget("GYQE01", "GYQE01", 0); + GeckoCodeWidget* mgtt_gecko = new GeckoCodeWidget("GFTE01", "GFTE01", 0); - connect(gecko, &GeckoCodeWidget::OpenGeneralSettings, this, &GeckoDialog::OpenGeneralSettings); + connect(mssb_gecko, &GeckoCodeWidget::OpenGeneralSettings, this, &GeckoDialog::OpenGeneralSettings); + connect(mgtt_gecko, &GeckoCodeWidget::OpenGeneralSettings, this, &GeckoDialog::OpenGeneralSettings); const int padding_width = 120; const int padding_height = 200; - tab_widget->addTab(GetWrappedWidget(gecko, this, padding_width, padding_height),tr("Mario Superstar Baseball")); + tab_widget->addTab(GetWrappedWidget(mssb_gecko, this, padding_width, padding_height),tr("Mario Superstar Baseball")); + tab_widget->addTab(GetWrappedWidget(mgtt_gecko, this, padding_width, padding_height),tr("Mario Golf Toadstool Tour")); layout->addWidget(tab_widget);