Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

OpenPayload

OpenPayload is an open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

General Information

The Wiimmfi payload is a set of patches Wiimmfi provides to fix various game bugs and protect Mario Kart Wii players from malicious attacks. It is implemented as a binary blob that relies on security through obscurity, meaning it can easily interfere with more complex mods.

The reasons behind OpenPayload are the following:

  • An open implementation allows for potential improvements and additional vetting on the patches;
  • Not applying the patches at runtime means the game can connect to the server faster than it normally would;
  • Features can be integrated by mods or left out entirely.

Compilation

OpenPayload's code relies on the CodeWarrior compiler and the Kamek linker for hook insertion, therefore it can be easily imported into existing Kamek projects (or ported to other Wii code loaders).

Compilation instructions or compiled outputs will not be provided, as OpenPayload is meant to give more wiggle room to complex distributions rather than disrupt Wiimmfi's functionality.

Testing Status

OpenPayload is largely untested at the moment. Connecting to the server and creating/joining/starting a friend room are confirmed to be working, but there may be bugs still lingering. Please report any issue.

Implementation Details

OpenPayload is opinionated, meaning that some features are not reimplemented and some others are implemented differently, in order to follow proper programming practices and provide cleaner, less bloated code.

Major features that were not ported include:

  • Auto Reconnect: While the feature allows the game to remain functional during server maintenance, such a scenario usually doesn't last long enough to justify the effort required to port the code. There are also concerns about potential introduced instabilities due to the extensive modifications that were made;
  • Cheat Reporting: Since these are basically self-reports that generally do not lead to a ban (the reports themselves are not accessible to moderators), these hooks have been skipped. Once in-game reporting is properly implemented on both client and server side, porting will be considered;
  • Custom Error Messages: Due to this feature being prone to breakage, it has been chosen to rely on an offline set of fixed error messages instead. OpenPayload also displays the error code when the "disc error" occurs;
  • Frameskip: The amount of code and its unreadability proved too much to handle. A skill issue, one could argue;
  • IOS Operation Protection: This measure is extremely easy to bypass, offers no additional protection and only serves to make IOS access more annoying for mods.

Mod Support

Some generic functions meant to showcase potential interoperation between mods and OpenPayload have been defined in ModSupport.hpp.

The message patches applied by the WSZST-based patcher have been converted to the JSON5 format used by wuj5 and cleaned up, adding some missing translations and removing various translation errors and broken escape sequences. They can be found in assets.

OpenPayload currently does not support modifying the login region. To do so, use this Gecko code or apply an equivalent patch for the patching framework you're using.

Existing Hooks

The table below lists all the hooks used by the original Wiimmfi payload as of v96, their purpose, the reimplementation status and any changes that were made to the original code.

The legend is as follows:

  • ✅: The code for this hook has been ported
  • ☑️: The code for this hook has been ported, but the hook has been moved to a different address
  • ⚠️: The code for this hook is currently being ported
  • ⏭: The code for this hook will not be ported
  • ❌: The code for this hook has not been ported yet
Hook Address(es)CategoryPurposeStatusCodeNotes/Changes
0x800095C4
0x800095E4
0x800095F4
FrameskipMain Frameskip FunctionN/AFrameskip will not be implemented
0x800CE220Security FixesFriend Status Data Buffer Overflow Fixdwc_friend.cppN/A
0x800CE7A4NATify FixesUpdate NATifydwc_friend.cpp
Natify.cpp
Changed disgusting runtime hook to a fixed hook
0x800CECB0
0x800DEA18
Auto ReconnectFix Friend Status IssuesN/AAuto Reconnect will not be implemented
0x800CECBC
0x8065A0EC
Auto ReconnectDWC Stub ImplementationN/AAuto Reconnect will not be implemented
0x800D01E4Auto ReconnectFix Error 61070N/AAuto Reconnect will not be implemented
0x800D0598
0x800D059C
0x800D05A0
Bug FixesError 60000 Fix☑️
(Branch from 0x800D05A8 to 0x800D0610)
dwc_login.cppEnsured the data type flag is properly cleared before setting it
0x800D086CNATify FixesStart NATifydwc_login.cpp
natneg.cpp
Natify.cpp
  • Changed disgusting runtime hook to a fixed hook
  • Removed pointless call to DetermineNatType
  • Don't copy NATify data if the negotiation failed
0x800D0DD4
0x800D0DE8
NATNEG FixesOverride Connected Callback☑️
(Moved to 0x800D0FE8)
dwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D13F4Auto ReconnectAllow P2P While OfflineN/AAuto Reconnect will not be implemented
0x800D1DDC
0x800D1F04
0x800D1FDC
0x800D2058
Auto ReconnectDon't Close P2P Connections When DisconnectingN/AAuto Reconnect will not be implemented
0x800D26DC
0x800D3050
0x800D3078
0x800D31A0
0x800D31BC
0x800D3624
0x800D3C38
0x800D3EA0
0x800E5680
0x80657648
0x8065764C
0x80658714
0x8065A970
Auto ReconnectN/AN/AAuto Reconnect will not be implemented
0x800D2884Port BindingUse UPNP Port for NATNEGdwc_main.cppN/A
0x800D28CCNATNEG FixesOverride Connect Attempt Callbackdwc_main.cpp
Natneg.cpp
What does this patch effectively do?
0x800D31C4
0x80658F7C
NATNEG FixesReattempt NATNEG Multiple Times☑️
(Moved respectively to 0x800D3188 and 0x80657990)
dwc_main.cpp
RKNetController.cpp
Natneg.cpp
N/A
0x800D3F1C
0x800E09A8
NATNEG Fixes / TelemetrySend Connection Matrix to Host and Serverdwc_main.cpp
dwc_match.cpp
ConnectionMatrix.cpp
N/A
0x800D8354NATNEG FixesImproved Next NATNEG Target Choosing Algorithm☑️
(Branch from 0x800D80D0 to 0x800D8360 and replaced instruction at 0x800D8360)
dwc_match.cpp
Natneg.cpp
Removed various pointless checks and checks related to Auto Reconnect
0x800D94F0
0x800E5980
0x800E5B14
NATNEG FixesParse Custom Match Commandsdwc_match.cpp
Natneg.cpp
  • Storing RESV command data is not implemented due to the data being unused
  • Support for CTGP's custom commands will not be implemented
0x800D9754NATNEG FixesParse SYN Packets in Additional Statesdwc_match.cppN/A
0x800DA7D0
0x800DA7D4
0x800DA7D8
NATNEG FixesSend Failed Connection Matrix to Hostdwc_match.cpp
MatchCommand.cpp
N/A
0x800DBE30Auto ReconnectHandle P2P Status Messages While OfflineN/AAuto Reconnect will not be implemented
0x800DC21CTelemetryReport Host Disconnections☑️
(Changed to three hooks at 0x800DDF40, 0x800DE1E4 and 0x800E6A14)
dwc_match.cpp
Reporting.cpp
N/A
0x800DC49CAuto ReconnectStop People From Joining During ReconnectN/AAuto Reconnect will not be implemented
0x800DCA18NATNEG FixesStore Reservations in QueueN/APatch not applied by the payload
0x800DCEC8
0x800DCF98
0x800E57FC
NATNEG FixesSend Failed Connection Matrix to HostN/APatch not applied by the payload
0x800E1A58NATNEG FixesReduce SYN-ACK Timeout Timedwc_match.cppN/A
0x800E1CA8NATNEG FixesSend Extra Packets on SYN-ACK Timeoutdwc_match.cpp
Natneg.cpp
N/A
0x800E58B8
0x800E58BC
0x800E58C8
0x800E58CC
0x800E58D0
0x800E58D8
0x800E58EC
Security FixesMatch Command Buffer Overflow Fix (GT2)☑️
(Merged into one call at 0x800E5924)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E5A2C
0x800E5A3C
0x800E5A40
0x800E5A50
0x800E5A54
0x800E5A64
0x800E5A74
0x800E5A80
Security FixesMatch Command Buffer Overflow Fix (QR2)☑️
(Merged into one call at 0x800E5AAC)
dwc_match.cppPorted from WiiLink24's WFC Patcher and condensed
0x800E6778NATNEG FixesPrevent Host Disconnection From Repeated NATNEG Failuresdwc_match.cpp
Natneg.cpp
N/A
0x800E7800NATNEG FixesSuspend Bug Fix☑️
(Moved to 0x800E77F4)
dwc_match.cppPorted from WiiLink24's WFC Patcher
0x800ED4A0
0x800ED558
Auto ReconnectStub Some ErrorsN/AAuto Reconnect will not be implemented
0x800ED784
0x800ED78C
Payload DownloadPayload Download RequestN/APorting unnecessary since the payload is not downloaded
0x800EDEE8AuthenticationMain Authentication Function⚠️dwc_auth_interface.cpp
Auth.cpp
Accurate Data Sent:
  • Console Certificate
  • Patcher Type
  • Console Type
  • Game Region
  • Device ID
  • Dolphin Version (if applicable)
  • Requested UPNP Port (if set)
Faked Data Sent:
  • Payload Version (Wiimmfi will otherwise reject access)
Data Not Sent:
  • Game IOS (Leseratte said it's not read by the server)
  • UPNP Settings (cannot be set without dedicated patchers)
  • Disc Version (unused)
  • Patcher Version (WSZST only)
  • Reconnect Data (Auto Reconnect not implemented)
0x800EE098AuthenticationReport Product Code on Dolphindwc_auth_interface.cpp
Auth.cpp
N/A
0x800EE364
0x800EE36C
Custom Error MessagesStore Custom Error MessageN/AReplaced with offline error messages
0x800EE74CChallenge CheckingSave Received Challengedwc_auth_interface.cpp
Challenge.cpp
N/A
0x800EE9F8AuthenticationParse Custom Response☑️
(Moved to 0x800EEA08)
dwc_auth_interface.cpp
Auth.cpp
  • Discard oversized messages and properly NULL-terminate them after decoding
  • Replace disgusting runtime hook replacements with fixed hooks
0x800FCEDCPlayer KickingParse Kick Requests⚠️
(Moved to 0x800FCEE8 and replaced instruction at 0x800FCEC8)
gpi.cpp
Kick.cpp
  • Kicking other players has been restricted to hosts to prevent the Phantom Racer Glitch
  • Custom kick message support not implemented yet
0x801007D8AuthenticationReport Certificate and Signed TokengpiConnect.cpp
Auth.cpp
N/A
0x8010E094Port BindingRetry on Different Port on Binding Failuregt2Socket.cppAvoid pointless use of static variables
0x80111534Challenge CheckingSend Saved Challengeqr2.cpp
Challenge.cpp
Hook rewritten to avoid overwriting existing parameters or overflowing the buffer
0x8011AB28
0x8011AB30
NATify FixesSend NATify Result☑️
(Added extra write to 0x8011AB2C)
natneg.cpp
Natify.cpp
Replaced unsafe store
0x8011B478NATNEG FixesReduce CONNECT_PING Retry Timenatneg.cppN/A
0x8011B4B0NATNEG FixesIgnore Retry Time on NATNEG Successnatneg.cppN/A
0x801937E0
0x801938F8
"Security" FixesIOS Operation "Protection"N/APorting skipped for the aforementioned reasons
0x801D4F10
0x801D4F2C
Payload DownloadPayload Download CA ReplacementN/APorting unnecessary since the payload is not downloaded
0x8023B0E0Player KickingReset Kick Flag☑️
(Moved to 0x80554728)
N/AN/A
0x80279D58
0x80279DA4
0x80279DE4
0x8027A428
0x8027A4A8
0x8027AD68
0x8027B4D8
0x8027BEF0
0x8027D091
0x8027DCAB
0x8027DCC7
0x8027DCE3
0x8027DE33
0x8027DEB7
0x8027E0A0
0x8089A6B8
0x8089ABD0
0x8089AC25
0x8089AC85
0x8089AD12
Domain ReplacementsN/ADomains.cppN/A
0x8027A688Auto ReconnectHandle LoginN/AAuto Reconnect will not be implemented
0x80514D58
0x80514D7C
Bug FixesInvalid Item Point Antifreeze☑️
(Overrides function at 0x80514D3C)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80518AFC
0x80518B20
Bug FixesInvalid Cannon Point Antifreeze☑️
(Overrides function at 0x80518AE0)
CourseMap.cppEntire function reimplemented to provide extra flexibility
0x80519560TelemetryReport Track SHA1 Hash☑️
(Overrides function at 0x80519508)
DvdArchive.cpp
Reporting.cpp
  • The track hash will not be calculated if the game is in offline mode
  • Replaced various ugly checks to detect a track file with a simple path string check
  • Hint: mods can cache and reuse the calculated hashes for other purposes or simply to reduce loading times
0x8051B69CFrameskipN/AN/AFrameskip will not be reimplemented
0x80533660TelemetryReport Race Finish and Battle Results☑️
(Moved to 0x8053369C)
RaceManager.cpp
Reporting.cpp
  • The race finish will not be reported if the race is offline
  • The battle results are not reported because the payload fails to copy them over before sending the report
0x805348CCTelemetryReport Race Finish Time☑️
(Moved to 0x8053490C)
RaceManager.cpp
Reporting.cpp
The finish time will not be reported if the race is offline or the player is not local
0x8053511cBug FixesUltra Shortcut Fix☑️
(Moved to 0x805350DC)
RaceManager.cppRewritten in C++ to allow mods more control over the fix's application
0x80535C78Accurate TimingUpdate Race Frame Counter☑️
(Added a extra hook at 0x80535C7C)
TimerManager.cpp
Delay.cpp
N/A
0x8053F3F4Player KickingCancel Race Support☑️
(Branch from 0x8053F39C to 0x8053F444)
RaceModeOnlineVs.cppRewritten in C++ to allow mods to easily end the race on command
0x8054DF88FrameskipDisable Model Drawing while LaggingN/APointless patch as the hooked function is never called by the game
0x805543A4TelemetryReport Course Subfile SHA1 HashesRaceScene.cpp
Reporting.cpp
The hashes are not computed if the race is offline
0x80562AD0FrameskipDisable Model Drawing while LaggingN/AFrameskip will not be implemented
0x805845D8Bug FixesInvalid Item Point AntifreezeKartMove.cppN/A
0x80589ACCBug FixesHalfpipe FixKartNetReceiver.cpp
  • Removed pointless null pointer check
  • Used a couple padding bytes in the KartNetReceiver class instead of a static array
0x80591B70Telemetry and "Anticheat"Report Common.szs Subfile SHA1 Hashes and "Detect" Gecko CodesKartParam.cpp
Reporting.cpp
  • The hashes will not be calculated if the game is offline
  • The Gecko code checks are not ported due to ease of bypass, potential false reports caused by mods and lack of use for bans
0x805CDDC8Custom MessagesApply Message ReplacementsN/AFeatures implemented separately due to high chances of clashing with existing patches:
  • Custom Error Messages: replaced with offline error messages
  • Custom Kick Messages: not yet ported since it is currently unused, but it will be implemented separately
  • Console Assignment Message: logic moved to 0x808BFF8C
0x805CE55CFrameskipMess with Text Rendering CodeN/AFrameskip should not mess with BMG escape sequences
0x805D2EF8
0x805D2F00
Bug FixesInvalid Friend Code AntifreezeFriendList.cppN/A
0x805D8CF4
0x805D9044
0x806437CC
0x80643CB8
0x80643CCC
0x80644404
0x8064AAAC
Auto ReconnectVoting Screen Text UpdateN/AAuto Reconnect will not be implemented
0x805DCE34TelemetryReport Room StartFriendRoomMessageSelectPage.cpp
Reporting.cpp
Removed pointless snprintf call
0x80600D10Data Sharing ConsentRevoke Custom Data Sharing Consent FlagOptionMessagePage.cppN/A
0x8064ECB4
0x8064F074
0x8064F60C
0x8064F610
0x8064F618
0x8064F61C
0x8064F620
0x8064F644
Auto ReconnectHandle Exiting Race while OfflineN/AAuto Reconnect will not be implemented
0x80654400Bug FixesIgnore Reported Lag FramesRKNetPacketCreator.cppN/A
0x806579B0VariousMain Wiimmfi Network LoopN/AImplemented:
  • Report match state changes to the server
  • Report suspend changes to the server
  • Execute scheduled kicks
  • Report AID/PID matrix to the server
  • Report host AID to the server
  • Calculate frame lag
  • Report frame count to the server
  • Stop NATNEG after 11 seconds have passed since the last match state change (unsure)
  • Report VS and BT region to the server
  • Report SELECT packet information to the server
  • Report first four PIDs to the server (???)
Will not be implemented:
  • Auto Reconnect update (feature won't be implemented)
  • Item cheat self-reporting (pointless measure)
  • Countdown item usage self-reporting (pointless measure)
0x80657A6CAuto ReconnectFix Main ThreadN/AAuto Reconnect will not be implemented
0x80658610Security FixesRCE Fix⚠️RKNetController.cpp
Security.cpp
Ported from WiiLink24, providing the following enhancements:
  • Full support for custom packet sizes
  • Packet data is also validated and not just the size (not yet implemented)
  • Only the host is able to disconnect the offending player to avoid the Phantom Racer Glitch
0x806591F4
0x80659248
TelemetryObtain VS/BT RegionsN/ARemoved disgusting runtime hooks and replaced them with a sane solution
0x8065DF44Security FixesITEM Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x8065FF5CBug FixesReset Room Stall TimerRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80660330Bug FixesRoom Stall PreventionRKNetSelectHandler.cpp
RoomStall.cpp
N/A
0x80760A88Bug FixesThwomp AntifreezeObjDossun.cppN/A
0x8079BF88Security FixesEVENT Packet Data Validation⚠️N/AIntegrated into RCE Fix (not implemented yet)
0x807A1914Bug FixesStationary Item Collision Momentum FixItemObj.cppN/A
0x807BC940"Anticheat"Store Item for Cheat DetectionN/ANot ported due to the measure basically amounting to self-reporting, which is too fragile and easily bypassed
0x808BFF8CAuthenticationDisplay Console Assignment MessageWifiMenuPage.cppReplaced disgusting runtime hook with fixed hook
0x808D4100FrameskipDisplay Debug DataN/AThis should not be in the regular payload
0x808D410CFrameskipN/AN/AHook does literally nothing

New Hooks

The table below lists all the new hooks introduced by OpenPayload and their purpose:

Hook Address(es)CategoryPurposeCodeNotes/Changes
0x8011BC38NATNEG FixesSkip Unnecessary Delaynatneg.cppPorted from WiiLink24 WFC
0x80554728VariousReset Values Before Race StartN/AN/A
0x808BFB74Custom Error MessagesDisplay Custom Error MessageWifiDisconnectPage.cppVirtual function override

About

An open-source reimplementation of the Wiimmfi payload for Mario Kart Wii.

Resources

Stars

28 stars

Watchers

2 watching

Forks

Contributors

Languages