Skip to content

Widescreen: experimento 288px + fixes de crackle/overflow (Half A) - #2

Merged
HayatoG merged 4 commits into
switch-portfrom
widescreen
May 29, 2026
Merged

Widescreen: experimento 288px + fixes de crackle/overflow (Half A)#2
HayatoG merged 4 commits into
switch-portfrom
widescreen

Conversation

@HayatoG

@HayatoG HayatoG commented May 29, 2026

Copy link
Copy Markdown
Owner

Continuação do PR #1. Traz os 4 commits mais novos da branch widescreen que ainda não estão no switch-port.

Commits

  • 9d44bf34 widescreen: EXPERIMENT — render 288px wide (iteration 1)
  • a71d1ab1 widescreen: fix xBRZ buffer overflow at width>240 (corrupção da tela inteira)
  • 87e0c0b5 widescreen: 1 render worker pra parar o crackle de áudio
  • 18f4900d widescreen: render serial do PPU + buffer de áudio de 2048 samples (fix do crackle em clock padrão)

Arquivos tocados (6)

  • platforms/switch/Makefile (-DMODE1_GBA_WIDTH=288)
  • platforms/switch/switch_render_pool.c
  • platforms/switch/TODO.md
  • port/port_audio.c
  • port/port_ppu.cpp
  • port/patches/switch-parallel-render.patch

Conflitos

Nenhum — testado localmente com git merge-tree, faz merge limpo no switch-port.

⚠️ Estado: widescreen "Half A" (experimental)

Tela mais larga (~16:9), porém a faixa de ~32px na direita ainda bugada (a engine preenche só um fundo de 256px/32 tiles). O "Half B" — ensinar a engine a preencher 512px (64 tiles) — é o próximo passo. Áudio roda em modo serial pra não estourar em clock padrão.

Build correspondente publicado na release switch-v0.2.3 (pre-release).

HayatoG and others added 4 commits May 27, 2026 19:37
Set -DMODE1_GBA_WIDTH=288 (~16:9 at 160px tall) and render BG across the full
width (MODE1_GBA_BG_CLIP_X = MODE1_GBA_WIDTH). OAM stays clipped at 240 to avoid
leaking engine-parked off-screen sprites.

Expected on HW: the view is visibly wider, BUT the right ~32px strip GLITCHES —
the engine still fills only a 256px (32-tile) BG tilemap, so columns past ~256
wrap to the left edge. This is the visible proof of what Half B must fix: teach
the engine to fill a 512px (64-tile) BG buffer (scroll.c / screenTileMap.c bake
the 32-tile assumption into hard-coded constants — a pervasive change). Full
clean rebuild required (DEFINES change isn't tracked by make).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ption + audio crackle)

The xBRZ/hi-res path used fixed dimensions (kHiResW=960, kHiResH=640,
sUpscale2xBuf=480x320 = all 240*N) while the upscaler is parameterized by
srcW/srcH. At width=288 the 4x pass wrote 1152px into the 960px buffers,
overflowing the heap → shredded frame (incl. the overlay) + crackling audio.
Derive kHiResW/kHiResH and sUpscale2xBuf from MODE1_GBA_WIDTH/HEIGHT so they
scale with the widescreen frame. Nearest/linear modes were already width-aware
and rendered the 288px frame correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e SDL callback)

The persistent render pool spawned 2 workers (cores 1+2); with the main thread
that put all 3 Application cores on rendering, starving the SDL audio callback
thread at the heavier 288px render width → crackling even on static screens.
Drop to 1 worker (core 1) so core 2 stays free for audio. Costs ~no fps since
the PPU render isn't the bottleneck (game logic is). xBRZ corruption already
fixed; this is the remaining widescreen-build regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-clock crackle

Audio crackled/slowed at the 288px render width on a stock Switch — CPU/memory
starvation (an overclock nearly removes it). The render worker threads competed
with the SDL audio thread for cores 1/2. Since threading the PPU render did NOT
improve fps (game logic is the bottleneck), drop to serial render
(POOL_MAX_WORKERS=0) so cores 1-2 are entirely free for the audio thread, and
double the audio device buffer (1024 -> 2048 samples) to ride out hiccups.

TODO.md: record the analog-stick-moves-Link request and the stock-clock audio
finding/mitigations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HayatoG
HayatoG merged commit 04d1235 into switch-port May 29, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant