fix(video): ignore enable bits for backgrounds a mode lacks
DISPCNT enable bits for BG3 in Mode 1, BG0/BG1 in Mode 2, and every background but BG2 in Modes 3-5 failed the whole frame with UnsupportedLayers, and the window turned that into a stopped session. Hardware has no such backgrounds and ignores the bits, so the renderer now masks them. The error variant is removed. Prohibited OBJ mode 3 and shape 3 stay diagnostics: their hardware output is not established here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HhfHfHEuzv2AUTd6erW1gU
This commit is contained in:
parent
258fbff2fa
commit
0ef2719c6b
5 changed files with 31 additions and 36 deletions
|
|
@ -149,7 +149,7 @@ fn forced_blank_is_white_and_disabled_bg2_uses_palette_backdrop() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn unsupported_modes_and_layers_report_errors_without_changing_output() {
|
||||
fn unsupported_modes_report_errors_and_absent_layer_bits_are_ignored() {
|
||||
let mut memory = mode3();
|
||||
let mut frame = Framebuffer::default();
|
||||
frame.clear(0x001f);
|
||||
|
|
@ -160,14 +160,17 @@ fn unsupported_modes_and_layers_report_errors_without_changing_output() {
|
|||
Err(VideoError::UnsupportedMode(mode as u8))
|
||||
);
|
||||
}
|
||||
for layer in [0x100, 0x200, 0x800] {
|
||||
memory.write16(DISPCNT, 0x403 | layer).unwrap();
|
||||
assert_eq!(
|
||||
memory.render_frame(&mut frame),
|
||||
Err(VideoError::UnsupportedLayers(0x403 | layer))
|
||||
);
|
||||
}
|
||||
assert!(frame.pixels().iter().all(|&pixel| pixel == 0xff0000));
|
||||
// Mode 3 has only BG2. Stale BG0, BG1, and BG3 enables do not change the image.
|
||||
memory.write16(VRAM_START, 0x03e0).unwrap();
|
||||
memory.write16(DISPCNT, 0x403).unwrap();
|
||||
let mut expected = Framebuffer::default();
|
||||
memory.render_frame(&mut expected).unwrap();
|
||||
for layer in [0x100, 0x200, 0x800, 0xb00] {
|
||||
memory.write16(DISPCNT, 0x403 | layer).unwrap();
|
||||
memory.render_frame(&mut frame).unwrap();
|
||||
assert_eq!(frame.pixels(), expected.pixels());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue