A Game About Digging A Hole: fix crash after the intro #2304
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2304
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2304"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Oskie5802 on GitHub · 2026-11-16 19:58 UTC · original
Oskie5802:digging-hole-patcher-crash→main· +180 −22 · 1 files · 4 commits · openGame:
A Game About Digging A Hole (PPSA30552, 01.100.000), issue #2249
Problem:
With --redzone, the game still crashed about 1.5-2 minutes in, after the intro, at eboot 0x323e347 inside the function at 0x323dfc0. That function is reached only through a pointer (lambda / virtual call), so it is neither listed in .eh_frame nor called directly. The red-zone patcher never found it and never protected its stores below RSP.
Depends on #2099
This PR is built on top of #2099 by @joaocaparroz (red-zone protection for functions missing from .eh_frame) and includes its two commits unchanged. Only the last commit is new. If #2099 is merged first, I will rebase so this PR is just that one commit.
Change:
loader: Clang pads between functions with int3 up to the 16-byte function alignment, so the aligned address after the padding that ends a decoded function starts another function. The patcher now follows that padding to find the next function. When the decoded code does not reach the end of the function (an unresolved jump table), it steps over the remaining instructions up to the padding first.
Result: with --redzone, the patcher finds 257,989 functions in the eboot instead of 249,803, including the one that crashed.
Testing
Played from boot through the intro into gameplay without the crash (RX 6600, Windows 11). On this card the game also needs the AMD fixes from #2302 to render at all, so I tested both together.
CI test list on Windows: 32/32 pass.
Not tested on NVIDIA, Intel or Linux.
AI use
The investigation and the code were done with Claude Fable 5.2. I reviewed the changes and
tested them on my own hardware as described, this description are writted by human - Me :) and corrected by AI
@coderabbitai[bot] on GitHub · 2026-11-16 20:06 UTC · original · edited 2026-11-16 20:21 UTC
Walkthrough
The patcher records direct-call targets and expands known function starts through decoded callees and aligned functions after
int3padding. Jump-table reads can use tables within the loaded module image outside the executable segment. Red-zone analysis detects frame-pointer-relative accesses and marks affected functions for conservative tracking. When memory protection is enabled, the patch entry point runs callee discovery and checks for these accesses before liveness analysis.Suggested reviewers:
nmzik,ew-sudoChange: Bug fix
Merge Risk:
Low · up to
2f08dThe change fixes the post-intro crash by discovering more functions and detecting frame-pointer red-zone accesses. The new detection still misses some function shapes, so a few functions may remain unprotected. This is unlikely to cause regressions, but it is worth tightening before or soon after merge.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "A Game About Digging A Hole: fix crash after the intro" names the game and the crash fix. The changeset modifies function discovery in guestInstructionPatcher.cpp so the red-zone patcher finds functions reached only through pointers, which addresses the crash described in the title. The title is specific and matches the primary change, though it does not name the technical mechanism (int3 padding follow-up and function discovery).
Full details: Description check
Explanation
The description explains the problem (a crash about 1.5 to 2 minutes into the game with --redzone, in a function reached only through a pointer), the change (following int3 padding to find the next aligned function start and stepping over instructions before unresolved jump tables), the test results, and the dependency on PR
#2099. These points match the raw summary of the changes in guestInstructionPatcher.cpp.Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
@coderabbitai[bot] on GitHub · 2026-11-16 20:06 UTC · original · edited 2026-11-16 20:22 UTC
On
src/loader/guestInstructionPatcher.cppline 550 (outdated):Skip direct calls to the next instruction when recording callees.
A
callto the next instruction returns to the code that follows it. A followingpopreads the return address, and execution stays in the same function. The target is not a separate function entry, but line 549-550 records it as a callee.AddDecodedCalleesthen inserts it intostarts, and the caller ends at thepop. Liveness analysis cannot see thepopas a successor. A red-zone store before thecallcan therefore be left unprotected, while the load after thepopis still protected.The guard should exclude only the call target that equals the following instruction. Calls to other targets keep their current handling. Update the comment above the guard to match.
Suggested fix
✅ Addressed in commit
2f08d52@coderabbitai[bot] on GitHub · 2026-11-16 20:06 UTC · original · reviewed
Actionable comments posted: 1
f227d761-4c03-4319-beab-9f65fcc1a880Reviewing files that changed from the base of the PR and between
d45b0865d8andfb351dae58.src/loader/guestInstructionPatcher.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
@Oskie5802 on GitHub · 2026-11-16 20:14 UTC · original
On
src/loader/guestInstructionPatcher.cppline 550 (outdated):This line comes from #2099, but the guard is cheap and safe, so I added it in
2f08d520. A call to the next instruction is no longer recorded as a function entry.@coderabbitai[bot] on GitHub · 2026-11-16 20:21 UTC · original · reviewed
91c49a61-f76a-457f-ac9a-2def84c2ade0Reviewing files that changed from the base of the PR and between
fb351dae58and2f08d5200e.src/loader/guestInstructionPatcher.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.