mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 04:55:56 +00:00
Merge task/optref: an invalid optional reference no longer crashes the game in main+0x1bd0138 / 0x1622bec, it is treated as absent (#1005)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
d8a1d14104
3 files changed
+20
No files matched your search
@@ -49,6 +49,7 @@ GPU semantics behind the graphics rows: [maxwell.md](../maxwell.md). The method
|
||||
| a host core at 100% while the game waits | game spin loops without system calls | profile: which guest function spins |
|
||||
| crash on world load | sizes the game reads from the driver (command memory used) differ from the console's | the sizes the game asks for against the console's |
|
||||
| crash with one save only | the save itself; some crash on a real Switch | the same save on another build and, if possible, on hardware |
|
||||
| random crash after minutes to hours, access violation reading `0xffffffffffffffff` in a game function | an invalid value (-1, `0xffff0000ffffffff`) in an optional reference the game checks only for null; set `optref` in `recomp/patches-v143.txt` guards main+0x1bd0138 | the crash dump's faulting host instruction, the register it loads through and the field that register came from |
|
||||
|
||||
## Device lost, hangs, black window
|
||||
|
||||
|
||||
@@ -1126,3 +1126,10 @@ site grass main fe58ec 52802002 @page:x2 b9408842 # mov w2, #0x100 -> ldr
|
||||
site grass main fe5950 52801002 @page:x2 b9408c42 # mov w2, #0x80 -> ldr w2, [page+140]
|
||||
site grass main 1a30a8c 52a84f48 @page:x8 b9408108 # mov w8, #62.5 -> ldr w8, [page+128]
|
||||
site grass main 1a30a98 52a83f48 @page:x8 b9409108 # mov w8, #31.25 -> ldr w8, [page+144]
|
||||
|
||||
|
||||
# Optional reference with an invalid value (#1005). The same guard as set optref in patches-v143.txt (main+0x1bd01c0),
|
||||
# here for 1.2.1's main+0x1622bec: ldr x8, [x19, #0x6b0]; cbz x8; ldr x21, [x8]. A negative value counts as absent.
|
||||
# x8 and x9 are dead at the branch target 0x1622c1c, which loads x8 again.
|
||||
set optref TOTK_OPTREF_GUARD 1
|
||||
site optref main 1622bec b4000188 937ffd09 8a290108 b4000188 # cbz x8 -> asr x9, x8, #63; bic x8, x8, x9; cbz x8
|
||||
@@ -1116,3 +1116,15 @@ site grass main a38e94 52802002 @page:x2 b9408842 # mov w2, #0x100 -> ldr
|
||||
site grass main a38ef4 52801002 @page:x2 b9408c42 # mov w2, #0x80 -> ldr w2, [page+140]
|
||||
site grass main 2063454 52a84f48 @page:x8 b9408108 # mov w8, #62.5 -> ldr w8, [page+128]
|
||||
site grass main 2063460 52a83f48 @page:x8 b9409108 # mov w8, #31.25 -> ldr w8, [page+144]
|
||||
|
||||
|
||||
# Optional reference with an invalid value (#1005). main+0x1bd0138 reads an optional reference at object +0x6b0 (null or
|
||||
# a holder whose first word is the target, bit 0 a tag) and checks it only for null: ldr x8, [x19, #0x6b0]; cbz x8;
|
||||
# ldr x21, [x8]. Players' crash reports show the field holding 0xffffffffffffffff after minutes to hours of play, and
|
||||
# the load of the holder faults. MacNativeGames (games/totk/runtime/loader.c, crash) met the same field holding
|
||||
# 0xffff0000ffffffff during a save load and treats the reference as absent there. Every valid holder is a heap address
|
||||
# below 2^63, so the cbz becomes a test for null or negative: x9 = x8 >> 63 (arithmetic, all ones when negative),
|
||||
# x8 &= ~x9, cbz x8. Both x8 and x9 are dead at the branch target 0x1bd01f0, which loads x8 again and writes x9 before
|
||||
# any read; on the fall-through path x8 is unchanged.
|
||||
set optref TOTK_OPTREF_GUARD 1
|
||||
site optref main 1bd01c0 b4000188 937ffd09 8a290108 b4000188 # cbz x8 -> asr x9, x8, #63; bic x8, x8, x9; cbz x8
|
||||
Reference in new issue
Block a user