-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MKW] Remove the 100cc engine class from Worldwide Versus Races
Closes issue #12.
- Loading branch information
MikeIsAStar
authored and
MikeIsAStar
committed
Dec 29, 2023
1 parent
3c0a834
commit 3d3b33e
Showing
5 changed files
with
173 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <wwfcCommon.h> | ||
|
||
namespace mkw::Util | ||
{ | ||
|
||
#if RMC | ||
|
||
class Random | ||
{ | ||
public: | ||
Random* dt(Random* random, s32 type) | ||
{ | ||
LONGCALL Random* dt(Random * random, s32 type) | ||
AT(RMCXD_PORT(0x80555538, 0x8054F518, 0x80554EB8, 0x80543590)); | ||
|
||
return dt(random, type); | ||
} | ||
|
||
private: | ||
u8 _00[0x18 - 0x00]; | ||
}; | ||
|
||
static_assert(sizeof(Random) == 0x18); | ||
|
||
#endif | ||
|
||
} // namespace mkw::Util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "import/mkwNet.hpp" | ||
#include "import/mkwUtil.hpp" | ||
|
||
namespace wwfc::Feature | ||
{ | ||
|
||
#if RMC | ||
|
||
static void DecideEngineClass(mkw::Net::SELECTHandler* selectHandler) | ||
{ | ||
using namespace mkw::Net; | ||
|
||
SELECTHandler::SELECTPacket* sendPacket = selectHandler->sendPacket(); | ||
|
||
if (__builtin_ppc_mftb() & 1) { | ||
sendPacket->engineClass = | ||
SELECTHandler::SELECTPacket::EngineClass::e150cc; | ||
} else { | ||
sendPacket->engineClass = | ||
SELECTHandler::SELECTPacket::EngineClass::eMirrorMode; | ||
} | ||
} | ||
|
||
// Remove the 100cc engine class from Worldwide Versus Races | ||
WWFC_DEFINE_PATCH = { | ||
Patch::CallWithCTR( // | ||
WWFC_PATCH_LEVEL_FEATURE, // | ||
RMCXD_PORT(0x806613F8, 0x806594BC, 0x80660A64, 0x8064F710), // | ||
[](mkw::Util::Random* random) -> void { | ||
random->dt(random, -1); | ||
|
||
using namespace mkw::Net; | ||
|
||
RKNetController::MatchType matchType = | ||
RKNetController::Instance()->matchType(); | ||
SELECTHandler* selectHandler = SELECTHandler::Instance(); | ||
|
||
if (matchType == RKNetController::MatchType::WorldwideVersusRace) { | ||
DecideEngineClass(selectHandler); | ||
} else { | ||
selectHandler->decideEngineClass(); | ||
} | ||
} | ||
), | ||
}; | ||
|
||
#endif | ||
|
||
} // namespace wwfc::Feature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters