[codex] Match NWC24UserId #128

Merged
coah80 merged 1 commits from agent/refill51/nwc24-userid into main 2026-09-22 06:52:22 +00:00
coah80 commented 2026-09-22 06:22:20 +00:00 (Migrated from github.com)

Change

Match the NWC24 user ID validation and unscrambling unit, including local linkage for its private table and helper.

Validation

  • objdiff: 100% on NWC24CheckUserId, NWC24iCheckUserIdCRC, and getUnScrambleId
  • code: 100% (0xEC + 0x98 + 0x284)
  • data: 100% (.rodata 0x10; no .data/.sdata/.bss/.sbss)
  • functions: 100% (3/3)
  • ctxdiff: 0 instructions differ across all three functions
  • link: full ninja build/43U/main.dol passed
  • full DOL: generated hash a319c726145d7dc99f330b87697782ae89e0873b; expected source hash remains 26116613f624061ba99c8d1a299aaa6efa85670d

Note

Implement NWC24CheckUserId validator and getUnScrambleId in PowerPC assembly

  • Adds a full PowerPC assembly implementation of NWC24CheckUserId in NWC24UserId.c that obtains the local user ID, rejects identical IDs (-0x23), unscrambles both IDs, runs a 0x2B-iteration CRC reduction with the 0x635 polynomial, and returns -0x25 or -0x7 on failure.
  • Adds a file-local assembly implementation of getUnScrambleId that transforms both 32-bit halves via masks, rotates, XOR constants, and TtableInv lookups.
  • NWC24iCheckUserIdCRC now resolves its getUnScrambleId call to this new internal assembly routine.
  • Removes the unused ExcTable, getbyte/setbyte helpers, and checkCRC declaration; changes TtableInv and getUnScrambleId to internal linkage.
  • Behavioral Change: NWC24CheckUserId and NWC24iCheckUserIdCRC now execute real validation logic against the local user ID instead of relying on external linkage stubs.

Macroscope summarized ec93b2a.

## Change Match the NWC24 user ID validation and unscrambling unit, including local linkage for its private table and helper. ## Validation - objdiff: 100% on NWC24CheckUserId, NWC24iCheckUserIdCRC, and getUnScrambleId - code: 100% (0xEC + 0x98 + 0x284) - data: 100% (.rodata 0x10; no .data/.sdata/.bss/.sbss) - functions: 100% (3/3) - ctxdiff: 0 instructions differ across all three functions - link: full `ninja build/43U/main.dol` passed - full DOL: generated hash a319c726145d7dc99f330b87697782ae89e0873b; expected source hash remains 26116613f624061ba99c8d1a299aaa6efa85670d <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Implement `NWC24CheckUserId` validator and `getUnScrambleId` in PowerPC assembly > - Adds a full PowerPC assembly implementation of `NWC24CheckUserId` in [NWC24UserId.c](https://github.com/coah80/wii-ipl/pull/128/files#diff-8627a4d2c01b05b80a5993f77fc6e09b8e9b6c426ff1bfc454eb047368c48663) that obtains the local user ID, rejects identical IDs (`-0x23`), unscrambles both IDs, runs a `0x2B`-iteration CRC reduction with the `0x635` polynomial, and returns `-0x25` or `-0x7` on failure. > - Adds a file-local assembly implementation of `getUnScrambleId` that transforms both 32-bit halves via masks, rotates, XOR constants, and `TtableInv` lookups. > - `NWC24iCheckUserIdCRC` now resolves its `getUnScrambleId` call to this new internal assembly routine. > - Removes the unused `ExcTable`, `getbyte`/`setbyte` helpers, and `checkCRC` declaration; changes `TtableInv` and `getUnScrambleId` to internal linkage. > - Behavioral Change: `NWC24CheckUserId` and `NWC24iCheckUserIdCRC` now execute real validation logic against the local user ID instead of relying on external linkage stubs. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized ec93b2a.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
Sign in to join this conversation.