Repository navigation
decomp: promote _printf, select_world_object_resource_tables and _sceFs_Rcv_Intr (3100 B) - #177
Merged
mateuszklysz merged 3 commits intoOct 14, 2026
Conversation
check-unit reports Object matches (promotable). The C body's format switch emits its jump table in .rodata, so pin it at retail's jtbl_001527B0 (0x1527B0, file 0x53730) in RODATA_OVERLAYS, right after printfloat's literals; without the pin the linker discards it. ./verify-baseline.sh: PASS: reconstructed boot ELF matches retail
The two hoisted %hi registers (resident_class_slot_by_id, moby_class_resources) came out in s0/s4 swapped. Global alloc ranks them by refs/live length and then by pseudo number, which PRE assigns in GCSE hash order of the symbol string. Reading class_slot before taking the table base equalises the live lengths, and naming the table D_001B3200 without the asm-label prefix puts its %hi first in the hash order, which gives retail's allocation. ./verify-baseline.sh: PASS: reconstructed boot ELF matches retail
The semaphore release loop compared ret against the slot (bne operands reversed) and, with the slots read through a volatile table, the reversed compare kept a separate sign-extension pseudo that took v0 from the semaphore. Reading the table plainly lets combine fold the extension, and releasing the slot through a volatile store keeps it ahead of the branch, out of the delay slot, as in retail. ./verify-baseline.sh: PASS: reconstructed boot ELF matches retail
Decompilation progress
3 newly matched functions (3,100 B)
Compared with main (34fd269). C_FUZZY uses main's last measurement. |
Report for SCUS_971.99 (34fd269 - 3c502e6)📈 Matched code: 87.79% (+0.09%, +3100 bytes) ✅ 3 new matches
|
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before
_printf,select_world_object_resource_tablesand_sceFs_Rcv_Intrwere assembly-backed units built from theirINCLUDE_ASMoracles. Their C bodies under#elsewere close but not exact.After
Three units promoted to exact C (3100 B):
sdk/debug/printf_impl(_printf, 1516 B): the C body already matched incheck-unit, but its formatswitchtable was discarded at link time. Pinned at retail'sjtbl_001527B0(0x1527B0, file 0x53730) inRODATA_OVERLAYS, right afterprintfloat's literals.textbin/world/data/select_world_object_resource_tables(684 B): the two hoisted%hiregisters came out in s0/s4 swapped. Global alloc ranks them by refs/live length, then by pseudo number, which PRE assigns in GCSE hash order of the symbol string. Readingclass_slotbefore taking the table base equalises the live lengths, and naming the tableD_001B3200without the asm-label prefix puts its%hifirst in the hash order.sdk/library/_sceFs_Rcv_Intr(900 B): the semaphore release loop compares the slot againstret(retailbneoperand order). The slot table is read plainly so combine folds the sign extension, and the slot is released through a volatile store, which keeps it ahead of the branch instead of in its delay slot.Verification
make elfends withPASS: reconstructed boot ELF matches retailmake overlaysends withPASS(overlay changes): n/a, no overlay changesmake checkpasses (92 tests OK)