Fix large sprites
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 8s

This commit is contained in:
2026-04-08 22:47:41 -05:00
parent 00e28203fa
commit 233fae545a

View File

@@ -164,7 +164,7 @@ impl OAM {
OamState::ReadY => {
let l = self.oam_read_buffer as usize;
if self.count < 8 {
if l <= line && line < l + 8 {
if l <= line && line < l + if self.large_sprites { 16 } else { 8 } {
self.secondary[self.count as usize * 4] = self.oam_read_buffer;
self.state = OamState::ReadTile;
} else {
@@ -214,36 +214,55 @@ impl OAM {
} else if run % 8 == 3 {
self.sprite_output_units[run / 8].x_pos = self.secondary[(run / 8) * 4 + 3];
} else if run % 8 == 4 {
} else if run % 8 == 5 {
let off = line - self.sprite_output_units[run / 8].y_pos as usize;
let off = if self.sprite_output_units[run / 8].attrs.vflip() {
7 - off
} else {
off
};
let addr = if self.sprite_offset_0x1000 {
0x1000
} else {
0x0000
} + 16 * self.sprite_output_units[run / 8].tile as u16
+ off as u16;
self.sprite_output_units[run / 8].low = mem.read(addr).reg_map(|_, _| todo!());
// } else if run % 8 == 5 {
// let off = line - self.sprite_output_units[run / 8].y_pos as usize;
// let off = if self.sprite_output_units[run / 8].attrs.vflip() {
// 7 - off
// } else {
// off
// };
// let addr = if self.sprite_offset_0x1000 {
// 0x1000
// } else {
// 0x0000
// } + 16 * self.sprite_output_units[run / 8].tile as u16
// + off as u16;
// self.sprite_output_units[run / 8].low = mem.read(addr).reg_map(|_, _| todo!());
} else if run % 8 == 6 {
} else if run % 8 == 7 {
} else if run % 8 == 5 || run % 8 == 7 {
let off = line - self.sprite_output_units[run / 8].y_pos as usize;
let off = if self.sprite_output_units[run / 8].attrs.vflip() {
7 - off
let addr = if self.large_sprites {
let off = if self.sprite_output_units[run / 8].attrs.vflip() {
15 - off
} else {
off
};
(if self.sprite_output_units[run / 8].tile & 1 == 1 {
0x1000
} else {
0x0000
} + 16 * (self.sprite_output_units[run / 8].tile & !1) as u16
+ off as u16 + if off > 7 { 8 } else { 0 })
} else {
off
let off = if self.sprite_output_units[run / 8].attrs.vflip() {
7 - off
} else {
off
};
(if self.sprite_offset_0x1000 {
0x1000
} else {
0x0000
} + 16 * self.sprite_output_units[run / 8].tile as u16
+ off as u16)
};
let addr = if self.sprite_offset_0x1000 {
0x1000
if run % 8 == 5 {
self.sprite_output_units[run / 8].low =
mem.read(addr).reg_map(|_, _| todo!());
} else {
0x0000
} + 16 * self.sprite_output_units[run / 8].tile as u16
+ off as u16
+ 8;
self.sprite_output_units[run / 8].high = mem.read(addr).reg_map(|_, _| todo!());
self.sprite_output_units[run / 8].high =
mem.read(addr + 8).reg_map(|_, _| todo!());
}
}
}
}