VDP2::ClearVRAM never frees background-layer palettes (saturnringlib/srl_vdp2.hpp:1912,1924,1935,1946)

Open Beginner friendly
#148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

The bug is in VDP2::ClearVRAM in saturnringlib/srl_vdp2.hpp, around lines 1912, 1924, 1935 and 1946, where each background layer's palette is freed. Read SetBankUsedState and the NBG0–NBG3 TilePalette definitions to see how the mode is chosen. Done when each layer frees its palette using its own TilePalette.GetMode() and no bank is left marked as used after ClearVRAM.

Written by the indexing model from the issue text.

Description

bug required hardware test
  • What this is: ClearVRAM is meant to release the VRAM and the palettes used by the four background layers (NBG0–NBG3).
    • Problem: It frees each layer's palette using RBG0's color mode. When RBG0 has no palette, its mode is RGB555, and SetBankUsedState does nothing for that mode, so the bank stays marked as used.
    • Fix: Use each layer's own palette: NBG0::TilePalette.GetMode(), and the same for NBG1–NBG3.
Dominant language
C++
Stars
90
Forks
5
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ReyeMe/SaturnRingLib

All issues in ReyeMe/SaturnRingLib

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.