From 4cfb4442a4b57c42ce0492058d99db05beff31ba Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 26 Apr 2026 07:16:50 +0200 Subject: [PATCH] Match Net::ROOMHandler::reset() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found 100% match via decomp-permuter. The function zeros out 28 u32 fields, sets a 0xff byte at 0x68, then zeros 4 final u32s (0x74, 0x70, 0x7c, 0x78). The trailing 4 stores require an indirect-via-double-pointer trick (`u8** new_var = &self`) plus a dummy null check to force mwcc to emit the matching instruction sequence — without it the compiler picks a different scheduling that fails to byte-match. Verified: reset__Q23Net11ROOMHandlerFv 100% match (objdiff) ROM-level: build/RMCP01/StaticR/StaticR.rel sha1 unchanged --- src/net/packets/ROOM.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/net/packets/ROOM.cpp b/src/net/packets/ROOM.cpp index 4155d693..4a884196 100644 --- a/src/net/packets/ROOM.cpp +++ b/src/net/packets/ROOM.cpp @@ -1,3 +1,41 @@ #include "ROOM.hpp" -namespace Net {} +namespace Net { + +void ROOMHandler::reset() { + u8* self = (u8*)this; + u8** new_var; + *self = 0; + *(u32*)(self + 0x08) = 0; + *(u32*)(self + 0x38) = 0; + *(u32*)(self + 0x0c) = 0; + *(u32*)(self + 0x3c) = 0; + *(u32*)(self + 0x10) = 0; + *(u32*)(self + 0x40) = 0; + *(u32*)(self + 0x14) = 0; + *(u32*)(self + 0x44) = 0; + *(u32*)(self + 0x18) = 0; + *(u32*)(self + 0x48) = 0; + *(u32*)(self + 0x1c) = 0; + *(u32*)(self + 0x4c) = 0; + *(u32*)(self + 0x20) = 0; + *(u32*)(self + 0x50) = 0; + *(u32*)(self + 0x24) = 0; + *(u32*)(self + 0x54) = 0; + *(u32*)(self + 0x28) = 0; + *(u32*)(self + 0x58) = 0; + *(u32*)(self + 0x2c) = 0; + *(u32*)(self + 0x5c) = 0; + *(u32*)(self + 0x30) = 0; + *(u32*)(self + 0x60) = 0; + *(u32*)(self + 0x34) = 0; + *(u32*)(self + 0x64) = 0; + self[0x68] = 0xff; + *(u32*)((*(new_var = &self)) + 0x74) = 0; + *(u32*)((*new_var) + 0x70) = 0; + *(u32*)((*new_var) + 0x7c) = 0; + if (!(*new_var)) {} + *(u32*)((*new_var) + 0x78) = 0; +} + +} // namespace Net