Skip to content

Commit

Permalink
Merge branch '1.9.7_dev' into mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
MORImementos authored Jul 30, 2023
2 parents 9316410 + bdca6a6 commit a9e3b7a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
9 changes: 9 additions & 0 deletions Source/Core/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ static GameName mGameBeingPlayed = GameName::UnknownGame;
const std::map<std::string, GameName> mGameMap = {{"GYQE01", GameName::MarioBaseball},
{"GFTE01", GameName::ToadstoolTour}};


bool GetIsThrottlerTempDisabled()
{
return s_is_throttler_temp_disabled;
Expand Down Expand Up @@ -242,6 +243,7 @@ void RunRioFunctions(const Core::CPUThreadGuard& guard)
{
SConfig& config = SConfig::GetInstance();


// Access the game ID
const std::string& gameID = config.GetGameID();
CheckCurrentGame(gameID);
Expand Down Expand Up @@ -819,6 +821,13 @@ bool Init(std::unique_ptr<BootParameters> 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<std::vector<ClientCode>> client_codes =
GetActiveTagSet(NetPlay::IsNetPlayRunning()).has_value() ?
GetActiveTagSet(NetPlay::IsNetPlayRunning()).value().client_codes_vector() :
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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)
Expand Down
11 changes: 8 additions & 3 deletions Source/Core/Core/GeckoCodeConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ std::vector<GeckoCode> 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.
Expand Down
12 changes: 9 additions & 3 deletions Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 8 additions & 5 deletions Source/Core/DolphinQt/Config/PropertiesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a9e3b7a

Please sign in to comment.