VU0 macro VSQI / VSQD: address and source registers swapped in generated code
I maintainer di solito rispondono entro 5 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia da ps2xRecomp/src/lib/vu_translation_helpers.cpp, in translateVU_VSQI e translateVU_VSQD, e confronta la loro estrazione degli operandi con le traduzioni di caricamento VLQI/VLQD funzionanti. L'esempio è 0x119548: vsqi.xyzw $vf4, ($vi15++), dove l'indirizzo viene da it e la sorgente da fs. È completato quando questo esempio memorizza vf4 in vi15 e fa avanzare vi15, e vf16–vf31 non indicizzano più al di fuori dei limiti di vi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
VU0 macro VSQI / VSQD: address and source registers swapped in generated code
Game: ICO (PAL, SCES_507.60)
Found on: c5a9d02, still present on eb8688b (latest main as of 2026-10-15).
The bug
In ps2xRecomp/src/lib/vu_translation_helpers.cpp, translateVU_VSQI and translateVU_VSQD use the operand layout of the loads (VLQI / VLQD). For the stores, the fields are reversed: the address register is it (bits 20–16, inst.rt) and the source register is fs (bits 15–11, inst.rd).
Example from ICO, 0x119548: vsqi.xyzw $vf4, ($vi15++)
Current output:
{ uint32_t addr = ((uint32_t)(ctx->vi[4] & 0x3FF)) << 4; ... ctx->vu0_vf[15] ... ctx->vi[4] = (ctx->vi[4] + 1) & 0x3FF; }With the two fields swapped (in both functions):
{ uint32_t addr = ((uint32_t)(ctx->vi[15] & 0x3FF)) << 4; ... ctx->vu0_vf[4] ... ctx->vi[15] = (ctx->vi[15] + 1) & 0x3FF; }So vf15 is stored at vi4 instead of storing vf4 at vi15, and vi15 never advances. The matching vlqd pop, which is correctly translated, then reads back the wrong data.
When the source is vf16–vf31, the generated code also indexes ctx->vi[16..31], out of bounds of vi[16]. ICO does this at 0x119018.
Effect in ICO
ICO uses vsqi to push its current matrix and VU0 registers. With this bug, camera matrices in cutscenes and on the title screen become corrupted, and geometry collapses or disappears, and the scenery is missing (only a flat background is drawn).
With the fix, using the same ELF, TOML and function list, only the two generated files containing the affected VSQI code change. The camera matrices are correct in our test run, and the previously collapsed scenes render again.
The same moments before and after the fix are shown below:
| Before | After | |
|---|---|---|
| Intro cutscene | ||
| Title screen ~10 s | ||
| Title screen ~60 s |
Other issues visible in the screenshots, including missing title text and the overall cream / fog tint, are not addressed by this report and are still being investigated separately. This report concerns only the VSQI / VSQD translation bug.
- Lingua principale
- C++
- Stelle
- 3.3k
- Fork
- 149
- Merge medio
- 5g 10h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ran-j/PS2Recomp
-
Runtime: SampleTexture casts unbounded or NaN texture coordinates to int, which is undefined behaviourForse già presa @luisbraganca l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ran-j/PS2Recomp#273 · 2 commenti ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
Runtime: writes to D_ENABLEW (0x1000F590) are never visible at D_ENABLER (0x1000F520), hanging any game that suspends the DMACForse già presa @luisbraganca l’ha presa 5 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ran-j/PS2Recomp#257 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
recompAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 4/100
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di ran-j/PS2Recomp
Issue simili
-
os:Linux
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
acceptable_buffer_backends: unknown backend names are silently ignoredForse già presa @mini-1235 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ros2/rmw_fastrtps#945 ·
I maintainer di solito rispondono entro 1 giorno
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
README: CI link/badge checkAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
SCIInstitute/SCIRun#2842 ·
I maintainer di solito rispondono entro 3 giorni