Skip to content

Match Net::USERHandler::update()#306

Open
chrisking1981 wants to merge 1 commit into
snailspeed3:masterfrom
chrisking1981:pr/user-handler-update
Open

Match Net::USERHandler::update()#306
chrisking1981 wants to merge 1 commit into
snailspeed3:masterfrom
chrisking1981:pr/user-handler-update

Conversation

@chrisking1981

Copy link
Copy Markdown

Summary

Adds a 100% byte-matching implementation for Net::USERHandler::update() (declared in src/net/packets/USER.hpp but not yet defined).

The method checks NetManager::getInstance()->hasFoundMatch():

  • match found + state==0 → call internal init helper
  • no match + state!=0 → reset internal state (clear status fields + memset payload arrays)
  • always: if state!=0, run periodic update + check RFL async status

Internal helpers

Calls fn_1_152498 and fn_1_152B08 (forward-declared extern "C"). These don't yet have proper names — they continue to be provided via the asm fallback. Once those get matched + named in a follow-up, the extern "C" declarations can be replaced.

Test plan

  • objdiff-cli -x update__Q23Net11USERHandlerFv: 100% match (relaxed reloc — only the call targets to unmatched helpers differ in symbol naming, machine code is byte-identical)
  • Full build still produces matching ROM:
    • main.dol sha1 ac7d72448630ade7655fc8bc5fd7a6543cb53a49
    • StaticR.rel sha1 887bcc076781f5b005cc317a6e3cc8fd5f911300

🤖 Generated with Claude Code

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
Comment thread src/net/packets/USER.cpp
} else {
if (*(u8*)this != 0) {
*(u8*)this = 0;
*(u32*)((char*)this + 0x9e0) = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use class memebers instead of direct casts

Comment thread src/net/packets/USER.cpp
}
}
if (*(u8*)this != 0) {
fn_1_152B08(this);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be a member function of USERHandler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants