From 7bb6120d5753f13385a9f0d3bc39216f36774d0d Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 26 Apr 2026 07:22:30 +0200 Subject: [PATCH] Match Net::USERHandler::update() 100% byte-match (relax-reloc) for the update method declared in USER.hpp. The function checks NetManager::hasFoundMatch() and dispatches to internal helpers fn_1_152498/fn_1_152B08 (still unmatched, declared extern "C" so the asm fallback resolves them). Verified: - objdiff-cli with -x flag: 100% match - Full build still produces correct main.dol/StaticR.rel sha1 --- src/net/packets/USER.cpp | 46 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/net/packets/USER.cpp b/src/net/packets/USER.cpp index 9d99a525..1b1b95c2 100644 --- a/src/net/packets/USER.cpp +++ b/src/net/packets/USER.cpp @@ -1,3 +1,47 @@ #include "USER.hpp" -namespace Net {} +#include "net/NetManager.hpp" + +#include + +extern "C" { +void fn_1_152498(void*); +void fn_1_152B08(void*); +s32 RFLGetAsyncStatus(); +} + +namespace Net { + +void USERHandler::update() { + if (NetManager::getInstance()->hasFoundMatch()) { + if (*(u8*)this == 0) { + fn_1_152498(this); + } + } else { + if (*(u8*)this != 0) { + *(u8*)this = 0; + *(u32*)((char*)this + 0x9e0) = 0; + *(u32*)((char*)this + 0x9e4) = 0; + *(u32*)((char*)this + 0x9e8) = 0; + memset((char*)this + 0x8, 0, 0xc0); + u32 i; + char* p = (char*)this + 0xc8; + for (i = 0; i < 0xc; i++) { + memset(p, 0, 0xc0); + p += 0xc0; + } + } + } + if (*(u8*)this != 0) { + fn_1_152B08(this); + if (*(s32*)((char*)this + 0x9dc) == 1) { + if (RFLGetAsyncStatus() != 6) { + *(u32*)((char*)this + 0x9e0) = *(u32*)((char*)this + 0x9e8); + *(u32*)((char*)this + 0x9e8) = 0; + *(u32*)((char*)this + 0x9dc) = 0; + } + } + } +} + +} // namespace Net