Recompiler: a delay slot past the function end is replaced by a NOP
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with function_emitter.cpp:143-147 and trace how delay slots are decoded when a branch or jump ends a function range. Check how the ELF section provides the word at inst.address + 4, and compare that behavior with makeSyntheticDelaySlot. Done means the real delay instruction is preserved, or a warning identifies when a non-NOP word would be replaced.
Written by the indexing model from the issue text.
Description
When a branch or jump is the last instruction of a function's range, function_emitter.cpp:143-147 emits a synthetic NOP for its delay slot (makeSyntheticDelaySlot) instead of decoding the real word at inst.address + 4 from the ELF. Nothing is logged.
So any function start that lands on a delay slot silently drops that delay instruction from the owner. The fallback heuristics are fixed in the linked PR, but the same thing can still happen with starts from JAL targets, the entry point, symbols, DWARF or Ghidra maps.
Seen in FIFA Street 2 (SLUS-21369): a heuristic start at 0x202020 cut sub_00201FD8 right after jal 0x431c88. The delay-slot lw $a0, 0($v0) that loads the call argument was replaced by the NOP, the lookup returned null, and the main thread died on a virtual call at 0x202048.
Suggested fix: decode the real word from the section when the delay slot sits outside the range, or at least warn when that word is not a NOP.
Related PR: fix/delay-slot-function-starts
- Dominant language
- C++
- Stars
- 3.3k
- Forks
- 149
- Avg merge
- 8h 46m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ran-j/PS2Recomp
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ran-j/PS2Recomp#393 · 1 comment ·
Maintainers usually reply within 5 days
-
EE sceCdStatus stub always reports READ (6), hanging games that wait for PAUSEPossibly taken @ahmedgamalalzatary claimed this 13 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 5 days
-
VU0 macro VSQI / VSQD: address and source registers swapped in generated codePossibly taken @yanm1103 claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 5 days
-
Runtime: SampleTexture casts unbounded or NaN texture coordinates to int, which is undefined behaviourMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ran-j/PS2Recomp#273 · 2 comments ·
Maintainers usually reply within 5 days
-
Build: /Qspectre- is MSVC-only and breaks every Release target under clang-clPossibly taken @ahmedgamalalzatary claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 5 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA-RTX/NRI#312 ·
Maintainers usually reply within 1 day
-
permute_q_b_proj / permute_wv_proj accept scale factors from another devicePossibly taken @0z5a claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepseek-ai/FlashMLA#247 ·
Maintainers usually reply within 1 day
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutPossibly taken @Spockkk0225 claimed this today. Openci
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
alibaba/neug#1195 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days