Repository navigation
Combined/widescreen and runtime fixes + KONG letter tracking - #17
matthew-somers wants to merge 41 commits into
Conversation
…elliotttate#4) CODE_B7E8E0 subtracts camera + right ($2C, native $0100) from each static banana/star group left X, adds the group width, and adds back the full $010F span before skipping both drawing ($B7:E981) and collection ($B7:EB69) on BMI. Wrapping 0x10f with Dkc3VideoExpandCullLeft instead of Dkc3VideoExpandCullSpan caused extra to cancel out and shifted the left cutoff inward by +2*bias near a left wall (up to camera + 71 in 16:9 and camera + 175 in 21:9), skipping entry 0 in Doorstop Dash Bonus 1 (world X $0148..$0150) so only 59 of 60 stars could be drawn or collected. Wrap 0x10f in block 0xB7E909 with Dkc3VideoExpandCullSpan so Span(0x10f) - Right(0x100) == Left(0x0f) for every aspect ratio, presentation bias, and DKC3_CULL_WIDEN=0.
Prevents black screen, off-rails crash, and SRAM corruption when compiled helpers discard their return frame via PLA before an unresolved tail jump (e.g. $B6:B234 in Pot Hole Panic and $B6:9D3F in Tyrant Twin Tussle).
Honor WBGLOG/WOBJLOG (OR/AND/XOR/XNOR) and wsPresentationXBias in PpuWindows_CalcWithExtra via fail-closed runtime patch hunks, and keep windowed 32-column BG3 layers physical-wide near level walls. Fixes Poisonous Pipeline's wrapped and inverted BG3 water-surface patterns across 4:3, 16:9, and 21:9.
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Pause emulation, audio, and fullscreen OpenGL swaps on Windows focus loss and minimization, replace end-of-frame Sleep(0)/PumpEvents busy-spinning with high-resolution waitable timer pacing, and route Win32 menu commands via a dedicated SDL user event instead of enabling SDL_SYSWMEVENT globally.
There was a problem hiding this comment.
All reported issues were addressed across 10 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 7 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Barrel Shield Bust-Up (World 2 Level 1) parks off-screen hollow tree-trunk windows at [0, 0] or [255, 255]. In widescreen, PpuWidescreenAdjustPinnedWindowEdges expanded those 1px sentinels across the entire side margin, and presentation X bias shifted them further into the viewport, blacking out the forest background on the side. Treat [0, 0] and [255, 255] as empty when widescreen margins are active (exact no-op in 4:3).
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Anchor the composite-ext-obj-fallback-sub PPU hunk on the math_enabled_cur line so its replacement is unique and the runtime patch round-trip test passes. Add a palette allocator fixture, hook placement assertions, and a fail-closed test for a moved $BB:95E6 anchor to the widescreen override tests. Add the opt-in DKC3_EXT_PAL_TRACE diagnostic, and record the cause, changes, and verification in BRINGUP.md and README.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Run the overflow-palette save recovery only in a short window after a state load or an aspect change, and clear tracked slots whenever the frame is not widescreen, so a stale $1D4B or tracked slot cannot be applied to an unrelated palette-0 sprite. - Assert the parked-window suppression and bias guards, and the full owner-depth save/restore and deadline-unwind blocks, in the runtime patch tests. - Correct the intro-skip fade predicates and the nested-unwind conditions in BRINGUP; record the parked-sentinel scope decision and the accepted 4:3 divergence for the Sneek save. - README: qualify the palette-overflow claims to what was measured and move the intro-skip note out of the macOS release section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In bonus rooms the camera travels only 24 pixels, less than two margins at every wide aspect. The glide centered such a room, so its target bias followed the camera pixel for pixel; the host's one-pixel-per-frame bias limit turned that into a lag and a drift back after the player stopped, and the HUD slid sideways with the bias. Glide now keeps a zero bias there and clamps each margin to the authored extent (the bars geometry). Wider rooms and the other edge policies are unchanged. Verified headless on the first-level bonus save: bias 0 at 16:10/16:9/21:9, native columns identical to 4:3, frames and hashes identical to bars. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The second bonus room of the first level travels 128 pixels: wider than two margins, so the narrow-room lock did not apply, but far shorter than the 2 * extra * 8 pixels the glide needs to release a full margin at each wall. The pins then made the target bias follow the camera about two pixels for every three, and the one-pixel-per-frame limit left the view drifting well after the player stopped. In such rooms the glide's wall shift is now range / 16 (none below two margins), released at the usual one pixel per eight of travel, with no pins and margins clamped to the room. Longer rooms and other edge policies are unchanged. Verified headless on the bonus save at 16:10, 16:9, and 21:9: bias steps by at most one and stops with the camera, the native columns match 4:3, and the first bonus room is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The overworld runs main-loop vector $B4:B179, not the level vector, so every wide aspect showed it between black margins. Its 64x32 BG1 and BG3 maps hold the whole 512-pixel map (world $100..$300) and no tilemap word changes while the camera travels, so the margins can be drawn straight from VRAM. A per-frame tilemap hash must hold before widening; a change while displayed latches black margins until the scene is left. Margins clamp to the map at the rendered scroll (the camera word leads it by up to two pixels while the boat moves). The view stays camera-locked: the presentation bias shifts sprites but nothing shifts the raw backgrounds, which misplaced the boat by the bias in a first version. 4:3 hashes are unchanged; the native center matches 4:3 at every wide aspect. The overworld's own sprite window still ends about 45 px past each native edge (open, recorded in BRINGUP). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The glide and margin clamp took the level-wide camera clamp ($04BC) as the east wall, so a room the camera cannot leave sideways widened into other rooms' map columns. In the reported mill save the one-screen elevator shaft showed a misaligned, cut-off strip in the right margin while the bias slid toward a west wall 144 pixels away. Read the cartridge's camera region table ($995A..$9E5A, current region $0478) and use the current region's span, continued through its linked left and right neighbours, as the walls. The clamp's row-overlap and player gates are left out so the bounds change only with the region and never slide the glide back and forth at a seam. 4:3 output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the hovercraft opens the north of the Northern Kremisphere map, the game streams tilemap rows ahead of a climbing camera, and the whole-map static proof latched black margins. The code in c9b28d6 replaces that proof with a per-row comparison that admits row streaming (at most two changed rows on screen per layer per frame, all rows when HDMA rewrites the layer's vertical scroll). Record the measurements, the tilemap oracle, and the headless-only garbling seen north of the start screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Re-snap the presented bias when the widescreen edge policy changes, so switching from the menu no longer slides the background and HUD. - Check all four bytes of each pixel in the right-margin clear test. - Overworld header comment: separate the measured two-pixel camera lead from the eight-pixel tolerance, and state the shown-row write contract. - Guide and README: state the one-pixel limit as a per-frame bound and narrow bonus-room, overworld west-bound, hovercraft, and linked-region claims to what BRINGUP records. - BRINGUP: record these and why the overworld row gate stays diff-based. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The cartridge never saves KONG letters, so the host records each level whose four letters ($05D7 bits 0-3) were collected, per file slot ($04C8), in its own sidecar, saves/kong_letters.dat. save.srm is only read and stays byte-identical to what the game writes. The world map draws "KONG" beside a recorded level's name, and the Northern Kremisphere beside a world whose five levels are all recorded, using the world node tables at $B4:CFB9. File-select copy and erase are followed through the cartridge's own slot check ($80:9141). A Settings > Gameplay checkbox, on by default and saved in launcher.cfg, shows or hides the badges; recording continues either way. Headless runs opt in with DKC3_KONG_TRACKER. Evidence and the unverified parts are recorded in docs/BRINGUP.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 15 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Replace the sidecar atomically (MoveFileExA on Windows) instead of deleting it before the rename, so a failed replace keeps the flags. - Track level uniqueness locally in Dkc3KongWorldLevels so a short or absent output buffer is never read past. - When a copied slot matches several identical slots, keep only the levels all candidates share instead of the first match's flags. - Restore Defaults re-enables the KONG badges. - Report an over-long sidecar path separately; make the headless host's fail-closed stop explicit and drop the contradictory "ignoring" wording. - Test version and size rejection independently, ambiguous copies, and short output buffers. - BRINGUP: record these and state the earlier entry's test counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Copying one slot onto both others in one sync made each destination intersect the source's flags with the other destination's old flags, dropping letters. Candidates whose image changed this sync are now used only when no unchanged slot holds the image, and never if they were blank before the sync, so a slot saved and copied at once keeps its own flags. Tests cover both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopting the battery save cleared the flags of every slot without a valid SRAM file, which loses the letters of a file played only through quick saves. Quick saves also carry the cartridge SRAM, so loading an older one could read as an erase, or two identical slots as a copy. Adopting SRAM now never clears flags. Copy and erase are followed only while the file select runs ($80:9586), and a quick load or rewind makes the next sync adopt the restored SRAM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
$B3:C0F4 writes Ripsaw Rage's BG3 trunk windows as world spans minus the camera, with each edge clamped to the 256-pixel screen. A trunk just past the native right edge was written as [255,255], which the parked-window rule treats as empty, so the far forest showed through the trunk's hollow in the right margin. The overrides script now records the routine's unclamped spans right after its $2129 write (failing closed if that block moves), and the patched PPU uses them in wide aspects while the window registers still hold what the routine wrote. Native 4:3 frames and all guest memory hashes are unchanged; DKC3_CULL_WIDEN=0 turns the override off. Also records the bark blocks under a hollow's platform as faithful: BG2's 256-pixel wrap shows through authored transparent BG1 cells that the native camera range never lines up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 12 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Set the KONG tracker's SRAM baseline inside the state-load hook, where the runtime has already restored SRAM, instead of leaving the next frame to adopt it unseen; a copy or erase in the first file-select frame after a quick load is now followed. Correct the trunk-window recorder's comment, note in README that a corrupt kong_letters.dat starts empty, and record in BRINGUP why the reported ppu.c declaration-order issue does not occur. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of DKC2Recomp d59c6127. The presented bias stepped one pixel a frame toward the glide's target, so where the pins make the target track the camera (every wall under shift, and glide frames where a camera region or west hold moves the bounds) the view ran past the wall and drifted back while the camera moved 2-4 pixels a frame. Dkc3VideoStepPresentationBias keeps the one-pixel step and also allows a step as large as this frame's camera motion, only against it, so the pins hold the view still and no step moves the view faster than the camera plus one pixel. The cartridge camera and WRAM are unchanged. Windows Release CTest 31/31 with the new unit cases. No replay measurement: the local quick save boots to the Rare logo in headless, and the live app is unverified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The presentation walls follow the current camera region ($0478). When it changed, a wall could move a whole margin in one frame. In the reported save, entering a one-screen shaft while the camera was still 43 px short of its wall clamped the west wall to the camera, so the left margin went from 43 columns to black although the native window still showed those columns. Leaving the shaft for a room linked far west then opened it from black to full in one frame. As the Kongs crossed between the corridor and the shaft, the margin popped in and out. A camera outside its region's span now gets the wall reflected about it (Dkc3VideoRegionScrollBounds), so the margin equals the travel left and closes as the camera arrives. A margin may open no faster than the view's own motion plus 2 px a frame (Dkc3VideoLimitMarginGrowth); narrowing is never limited, and restores, level starts, and DKC3_CULL_WIDEN=0 are unaffected. The prefill trace now prints the region, walls, and margins. Final frame, WRAM, VRAM, CGRAM, and OAM hashes match the previous build at 4:3, 16:9, and 21:9 with widening on and off. Also removes stray carriage returns inside test_dkc3_video.c string literals that broke MSVC builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The structural wall rule continued a tree trunk into the authored gap between two trunks in a waterfall level, so rock and grass popped into the right margin whenever the camera rested on an 8-pixel boundary. The rule now applies only to margin tiles outside the reach of the frame's camera scroll bounds (region walls or a west hold); inside it the decoded map stands. The prefill trace also prints the row stride. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 20 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
A quick save does not carry the palette-overflow hook's associations, so the load recovery attached the most recent overflow ($1D4B) to the only palette-0 dynamic sprite. In the reported save that painted a silver bear coin orange at wide aspects. Dkc3VideoInitScriptPaletteForType walks the bank-$FF init scripts for a sprite type and returns the palette only when every script requests the same one exactly once. The load recovery uses that palette first and falls back to $1D4B only for types the scripts do not settle. The 4:3 path and guest memory are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some sprites stay alive but undrawn: the renderer at $B7:8908 skips a slot whose render word (+$26) has bits 15 and 14 set, as the hidden bear coin (type $0284) does. The override script wraps that read in all twelve inlined copies of block $B7:8904 with Dkc3RevealHiddenSpriteFlags, which clears bit 15 of a hidden word so the sprite takes the normal draw. Kong slots and the ridden buddy's slot stay hidden. The helper never writes guest memory and returns the word unchanged when the option is off. The option is off by default, saved as ShowHiddenObjects, gated behind Enable Assist Tools / Cheats, and DKC3_SHOW_HIDDEN_OBJECTS=1 enables it headless. With it off, the quick save's frame, WRAM, VRAM, CGRAM, and OAM hashes match the previous build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…saves - Level $23 KAOS arena and the K. Roolenstein phase fill 16:10, 16:9 and 21:9 from the static 512-pixel room plane, with KAOS's body and the floor effects clipped by the cartridge's own windows. - Show hidden objects applies only during level gameplay and to sprites that hold tiles or a palette (fixes the world-map crash), and keeps the defeated K. Rool hidden. - DKC3_USER_DIR gives the Windows smoke tests their own config, quick state and SRAM directories, so CTest leaves Release/saves untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The credits run on the level main loop and set the frozen bit in $05AF ($80C0) between scenes, which the crate spawner took for a player pause. Bit 15 stays set while no player is in control and is clear in a real pause ($40C0), so the selector, Left/Right and B now require it clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 22 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Pause banner frames reset ImGui's framebuffer scale to 1, since their display size is already in framebuffer pixels. - The pause banner is set before the screenshot is armed, and arming uses the same Metal condition as presentation. - DKC3_USER_DIR fails closed when the executable directory cannot be resolved instead of reading launcher assets under the user directory. - The hidden-sprite reveal requires every $B7:8904 marker to be wrapped and the primary renderer CODE_B78857 to be among them; the fixture now includes that unit. - Prefill trace arguments match their printf conversions. - Doc and comment wording: the margin growth limit and the $FC palette command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Combined today's work.
Summary by cubic
Fixes widescreen rendering, the balanced interpreter, and Windows desktop edge cases raised during combined testing, and tracks KONG letter progress per save slot.
New Features
saves/kong_letters.dat) so the battery save stays byte-identical; the sidecar is replaced atomically, adopting SRAM never clears flags, and quick loads re-adopt the restored letters.DKC3_KONG_TRACKER.DKC3_SHOW_HIDDEN_OBJECTS=1enables it headless.Bug Fixes
WBGLOG/WOBJLOGcombine logic, shift un-pinned edges bywsPresentationXBias, and keep windowed 32-column BG3 layers physically wide — fixing Poisonous Pipeline's wrapped water-surface patterns. Edge-parked 1-pixel windows are treated as empty so off-screen hollow tree trunks no longer black out the forest background, while Ripsaw Rage's legitimate[255,255]trunk spans draw from the routine's unclamped world spans.DKC3_SPAWN_LEAD) to placement activation and sprite culls, and wrapped the static banana/star grid walk span so "Collect the Stars!" bonus levels no longer skip left-wall stars.DKC3_EXT_PAL_TRACEdiagnostic. Quick loads recover a sprite's palette from its bank-$FF init scripts when those scripts agree on one.DKC3_SKIP_INTRO_START).Testing adds a 247-case ROM-free PPU window oracle test against the legacy scalar PPU, plus unit tests for spawn/cull helpers, palette-overflow routing, runtime patch hunks, background-pause policy, intro skip, crate spawning, hidden-sprite reveals, trunk-spawn overrides, and the KONG tracker, including sidecar rejection, ambiguous copies, and quick-save adoption.
DKC3_USER_DIRisolates Windows smoke-test saves from the installed config.Written for commit aa05037. Summary will update on new commits.