From 21112f99c387593098b022575e7a7ecc060218b7 Mon Sep 17 00:00:00 2001 From: MikeIsAStar <99037623+MikeIsAStar@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:20:00 -0400 Subject: [PATCH 1/2] [MKW] Do not overwrite the return value of the function 'gpiProcessConnect' --- payload/import/mkw/ui/page/openHostPage.hpp | 10 +++++----- payload/wwfcFeature.cpp | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/payload/import/mkw/ui/page/openHostPage.hpp b/payload/import/mkw/ui/page/openHostPage.hpp index ff613bc..ad6674c 100644 --- a/payload/import/mkw/ui/page/openHostPage.hpp +++ b/payload/import/mkw/ui/page/openHostPage.hpp @@ -121,7 +121,7 @@ class OpenHostPage : public Page L"the server.\n\n" L"Please try again later."; } else { - if (s_enableOpenHost) { + if (s_openHostEnabled) { formatParam.strings[0] = L"Open Host is now enabled!"; } else { formatParam.strings[0] = L"Open Host is now disabled!"; @@ -155,22 +155,22 @@ class OpenHostPage : public Page } s_sentOpenHostValue = true; - bool enableOpenHost = choice == 0; + bool openHostEnabled = choice == 0; char openHostValue[2]; - openHostValue[0] = '0' + enableOpenHost; + openHostValue[0] = '0' + openHostEnabled; openHostValue[1] = '\0'; GameSpy::gpiSendLocalInfo( gpConnection, "\\wwfc_openhost\\", openHostValue ); - s_enableOpenHost = enableOpenHost; + s_openHostEnabled = openHostEnabled; } static State s_state; static mkw::UI::MenuInputManager::Handler* s_onOption; static mkw::UI::YesNoPage::Handler* s_onYesOrNo; - static bool s_enableOpenHost; + static bool s_openHostEnabled; static bool s_sentOpenHostValue; }; diff --git a/payload/wwfcFeature.cpp b/payload/wwfcFeature.cpp index 5591a65..1994461 100644 --- a/payload/wwfcFeature.cpp +++ b/payload/wwfcFeature.cpp @@ -26,7 +26,7 @@ namespace mkw::UI OpenHostPage::State OpenHostPage::s_state = OpenHostPage::State::Previous; MenuInputManager::Handler* OpenHostPage::s_onOption = nullptr; YesNoPage::Handler* OpenHostPage::s_onYesOrNo = nullptr; -bool OpenHostPage::s_enableOpenHost = false; +bool OpenHostPage::s_openHostEnabled = false; bool OpenHostPage::s_sentOpenHostValue = false; const wchar_t* WifiMenuPage::s_messageOfTheDay = @@ -45,7 +45,7 @@ namespace wwfc::Feature extern "C" { __attribute__((__used__)) static GameSpy::GPResult -GetMessageOfTheDay(const char* message) +GetMessageOfTheDay(GameSpy::GPResult gpResult, const char* message) { using namespace mkw::UI; @@ -53,13 +53,13 @@ GetMessageOfTheDay(const char* message) if (strncmp( message, loginChallenge2Message, sizeof(loginChallenge2Message) - 1 )) { - return GameSpy::GPNoError; + return gpResult; } const char motdKey[] = "\\wwfc_motd\\"; char value[512]; if (!GameSpy::gpiValueForKey(message, motdKey, value, sizeof(value))) { - return GameSpy::GPNoError; + return gpResult; } wchar_t* messageOfTheDayBuffer = WifiMenuPage::MessageOfTheDayBuffer(); @@ -71,24 +71,24 @@ GetMessageOfTheDay(const char* message) ); if (messageOfTheDayLength == -1 || messageOfTheDayLength == messageOfTheDayBufferSize) { - return GameSpy::GPNoError; + return gpResult; } messageOfTheDayBuffer[messageOfTheDayLength / sizeof(wchar_t)] = L'\0'; WifiMenuPage::SetMessageOfTheDay(messageOfTheDayBuffer); - return GameSpy::GPNoError; + return gpResult; } } -// Get the "Message Of The Day" from the "Login Challenge" message +// Get the Message Of The Day from the "Login Challenge 2" message WWFC_DEFINE_PATCH = { Patch::BranchWithCTR( WWFC_PATCH_LEVEL_FEATURE, RMCXD_PORT(0x80101074, 0x80100FD4, 0x80100F94, 0x801010EC), // ASM_LAMBDA( // clang-format off - mr r3, r26; + mr r4, r26; bl _restgpr_26; lwz r0, 0x2D4(r1); @@ -101,7 +101,7 @@ WWFC_DEFINE_PATCH = { ), }; -// Display a "Message Of The Day" when a client connects to the server +// Display the Message Of The Day when a client connects to the server WWFC_DEFINE_PATCH = { Patch::BranchWithCTR( WWFC_PATCH_LEVEL_FEATURE, From 993bd43b3eb46fffdfc6e3858f57229fc3111f20 Mon Sep 17 00:00:00 2001 From: MikeIsAStar <99037623+MikeIsAStar@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:30:00 -0400 Subject: [PATCH 2/2] Include import statements where needed --- payload/import/egg/exception.hpp | 1 + payload/import/mkw/net/eventHandler.hpp | 1 + payload/import/mkw/net/userHandler.hpp | 1 + payload/import/mkw/ui/menuInputManager.hpp | 5 +++-- payload/import/mkw/ui/page/yesNoPage.hpp | 2 +- payload/wwfcMii.cpp | 1 + payload/wwfcSecurity.cpp | 2 ++ 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/payload/import/egg/exception.hpp b/payload/import/egg/exception.hpp index 932512b..7eeca10 100644 --- a/payload/import/egg/exception.hpp +++ b/payload/import/egg/exception.hpp @@ -8,6 +8,7 @@ namespace EGG class Exception { public: + Exception(); virtual ~Exception(); static void SetUserCallBack(void* arg) diff --git a/payload/import/mkw/net/eventHandler.hpp b/payload/import/mkw/net/eventHandler.hpp index 5469fa7..f2f7a2c 100644 --- a/payload/import/mkw/net/eventHandler.hpp +++ b/payload/import/mkw/net/eventHandler.hpp @@ -2,6 +2,7 @@ #include "import/mkw/item.hpp" #include +#include namespace mkw::Net { diff --git a/payload/import/mkw/net/userHandler.hpp b/payload/import/mkw/net/userHandler.hpp index cdbb73a..13dcacf 100644 --- a/payload/import/mkw/net/userHandler.hpp +++ b/payload/import/mkw/net/userHandler.hpp @@ -1,6 +1,7 @@ #pragma once #include "import/dwc.h" +#include #include namespace mkw::Net diff --git a/payload/import/mkw/ui/menuInputManager.hpp b/payload/import/mkw/ui/menuInputManager.hpp index 9b402a3..18f360a 100644 --- a/payload/import/mkw/ui/menuInputManager.hpp +++ b/payload/import/mkw/ui/menuInputManager.hpp @@ -34,7 +34,7 @@ class MenuInputManager class Handler final : public IHandler { public: - Handler(T* object, void (T::*function)(u32)) + Handler(T* object, void (T::*function)(u32 localPlayerId)) { m_object = object; m_function = function; @@ -47,9 +47,10 @@ class MenuInputManager private: T* m_object; - void (T::*m_function)(u32); + void (T::*m_function)(u32 localPlayerId); }; + MenuInputManager(); virtual ~MenuInputManager(); private: diff --git a/payload/import/mkw/ui/page/yesNoPage.hpp b/payload/import/mkw/ui/page/yesNoPage.hpp index fbf5ee0..cf95280 100644 --- a/payload/import/mkw/ui/page/yesNoPage.hpp +++ b/payload/import/mkw/ui/page/yesNoPage.hpp @@ -32,7 +32,7 @@ class YesNoPage : public Page class Handler final : public IHandler { public: - Handler(T* object, void (T::*function)(int, void*)) + Handler(T* object, void (T::*function)(int choice, void* pushButton)) { m_object = object; m_function = function; diff --git a/payload/wwfcMii.cpp b/payload/wwfcMii.cpp index 69c9a3b..51522b6 100644 --- a/payload/wwfcMii.cpp +++ b/payload/wwfcMii.cpp @@ -1,6 +1,7 @@ #include "import/mkw/net/userHandler.hpp" #include "wwfcGPReport.hpp" #include "wwfcPatch.hpp" +#include namespace wwfc::Mii { diff --git a/payload/wwfcSecurity.cpp b/payload/wwfcSecurity.cpp index dd0fbfa..1284548 100644 --- a/payload/wwfcSecurity.cpp +++ b/payload/wwfcSecurity.cpp @@ -5,7 +5,9 @@ #include "import/mkw/net/selectHandler.hpp" #include "import/mkw/net/userHandler.hpp" #include "import/mkw/registry.hpp" +#include "import/mkw/system/raceConfig.hpp" #include "import/mkw/system/system.hpp" +#include "wwfcLog.hpp" #include "wwfcPatch.hpp" namespace wwfc::Security