Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

VU0 macro VSQI / VSQD: address and source registers swapped in generated code

Aperta Adatta ai principianti
#309 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

@yanm1103 ci sta già lavorando.

Dal 15/10/2026.

  • #310 di @yanm1103 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
compilers

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 Image Image
Title screen ~10 s Image Image
Title screen ~60 s Image Image

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ran-j/PS2Recomp

Tutte le issue di ran-j/PS2Recomp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.