[WIP] Ultrawide#314
Open
enzuru wants to merge 5 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey everyone, I worked with Claude this week to add 32:9 ultrawide support to this project. There are a couple of things remaining:
Description
This adds 32:9 support.
Will this Pull Request break anything?
It shouldn't!
Suggested Testing Steps
Test on an ultrawide monitor.
Claude's description of its own changes
Here's a summary of all changes since the
fbbb3f9(Add BPS support) base:32:9 Ultra-Widescreen Support
These changes add support for 32:9 ultra-widescreen (796px viewport, 270px extra per side) to the zelda3 ALTTP reimplementation.
Build / Config
-std=gnu17because GCC 15 defaults to C23 which breaks old-style empty function parameter lists.32:9, fullscreen, autosave enabled..agent-shell/directory.Bug Fixes
extended_aspect_ratiochanged fromuint8touint16. The value 270 (for 32:9) overfloweduint8max 255, silently wrapping to 14.32:9as a recognized aspect ratio string.kPpuExtraLeftRightincreased from 96 to 320 to size PPU pixel buffers large enough for 32:9.extraLeftCur,extraRightCur,extraLeftRightwidened fromuint8_ttouint16_t(values > 255 needed).Extended Tilemap (core feature)
The SNES tilemap is 64 tiles wide (512px) with a ring buffer. To exceed this limit:
snes/ppu.h — Added
extTilemap[0x1000](4 pages, 0x400 words each) andextTilemapEnabledflag to thePpustruct. These hold tile data for columns beyond the 64-column VRAM tilemap.snes/ppu.c — PpuDrawBackground_4bpp (old renderer):
tps[]expanded from 2 to 4 page pointers. Pages 0-1 point to VRAM (ring buffer data), pages 2-3 point toextTilemapwhen enabled.NEXT_TP()macro cycles through all 4 pages: 0→1→2→3→0.(x >> 8) & 1— always starts in VRAM, never in extTilemap.#undef NEXT_TPbefore the 2bpp renderer to avoid redefinition warning.snes/ppu.c — ppu_getPixelForBgLayer (new renderer):
extTilemap; otherwise uses the original VRAM path.snes/ppu.c — PpuSetExtraSideSpace:
tilemap_extraclamp entirely whenextTilemapEnabledis true, allowing the full 270px per side.src/overworld.c — Overworld_FillExtTilemap() (new function):
BG1HOFS_copy2/BG2HOFS_copy2) for map data lookup indung_bg1/dung_bg2.src/overworld.h — Declares
Overworld_FillExtTilemap(struct Ppu *ppu).src/zelda_rtl.c — ZeldaDrawPpuFrame:
extTilemapEnabled = trueBEFOREConfigurePpuSideSpace()so the clamp bypass takes effect.Overworld_FillExtTilemap()afterConfigurePpuSideSpace().Key bugs found and fixed during development
uint8overflow for aspect ratio value 270dung_bg2(which uses local area coords)& 3instead of& 1— broke rendering when hScroll >= 256BG2HOFS_copy2for map data lookup