Skip to content

Commit

Permalink
Add attempt to fix suspend bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mkwcat committed Jan 22, 2024
1 parent f6640e2 commit 158fb1b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions payload/wwfcNatneg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,28 @@ s32 GT2CreateSocket(
);
}

#if RMC
// Attempt to fix the "suspend bug," where DWC stalls suspending the match due
// to ongoing NATNEG between clients. This patch will ignore NATNEG and suspend
// anyway if not the host.
// Credit: MrBean35000vr
WWFC_DEFINE_PATCH = {Patch::CallWithCTR(
WWFC_PATCH_LEVEL_BUGFIX | WWFC_PATCH_LEVEL_PARITY, //
RMCXD_PORT(0x800E77F4, 0x800E7754, 0x800E7714, 0x800E7854), //
ASM_LAMBDA(
// clang-format off
lbz r0, 0x16(r31); // stpMatchCnt->hostState
cmpwi r0, 0; // Not in a match
beqlr; // r0 = 0 will already fall through to 0x800E7814

cmpwi r0, 1; // Client in room
beqlr; // r0 = 1 will already fall through to 0x800E781C

lwz r0, 0x71C(r31); // stpMatchCnt->state
blr;
// clang-format on
)
)};
#endif // RMC

} // namespace wwfc::Natneg

0 comments on commit 158fb1b

Please sign in to comment.