LakeSnes: picture brightness is a global shared by every machine and not saved in savestates #47

Open
opened 2026-11-03 07:49:59 +00:00 by Gatchan · 0 comments
Owner

LakeSnes keeps the current brightness of the picture in a file-level global, bright_now in third_party/lakesnes/snes/ppu.c (set by every INIDISP write, read by the pixel output). Two consequences, found while writing the video service (#33):

  1. Every machine in the process shares it: the clone used by shadow validation, the three cores of rom.ports, the ROM oracle next to the port. Whichever core wrote INIDISP last decides the brightness of the pixels the others produce. Not seen to break a test so far (shadow writes on the clone happen in vblank and the original writes the same value just after), but picture comparisons between cores in one process are not trustworthy while a fade runs.
  2. It is not part of the savestate: after ff6_debug_state_load the picture keeps the brightness of the machine that ran last until the game writes INIDISP again.

Proposed fix (local LakeSnes patch, listed in its README, bump HW_EMULATOR_REVISION): compute the factor from ppu->brightness at pixel output (or keep it in Ppu). Movies may need regeneration if picture hashes change after a load.

LakeSnes keeps the current brightness of the picture in a file-level global, `bright_now` in `third_party/lakesnes/snes/ppu.c` (set by every `INIDISP` write, read by the pixel output). Two consequences, found while writing the video service (#33): 1. Every machine in the process shares it: the clone used by shadow validation, the three cores of `rom.ports`, the ROM oracle next to the port. Whichever core wrote `INIDISP` last decides the brightness of the pixels the others produce. Not seen to break a test so far (shadow writes on the clone happen in vblank and the original writes the same value just after), but picture comparisons between cores in one process are not trustworthy while a fade runs. 2. It is not part of the savestate: after `ff6_debug_state_load` the picture keeps the brightness of the machine that ran last until the game writes `INIDISP` again. Proposed fix (local LakeSnes patch, listed in its README, bump `HW_EMULATOR_REVISION`): compute the factor from `ppu->brightness` at pixel output (or keep it in `Ppu`). Movies may need regeneration if picture hashes change after a load.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Gatchan/FF6Portage#47
No description provided.