cargo fmt

This commit is contained in:
Kevin Hamacher 2020-02-18 16:29:29 +01:00
parent 55373a6948
commit aa329237ba

View File

@ -374,7 +374,7 @@ impl Display {
} }
0xFF69 => { 0xFF69 => {
let idx = self.background_palette_index as usize; let idx = self.background_palette_index as usize;
if idx < 64 { if idx < 64 {
self.background_palette_cgb[idx / 8].0[idx % 8] = val; self.background_palette_cgb[idx / 8].0[idx % 8] = val;
} else { } else {
panic!("OOB palette w/ autoinc"); panic!("OOB palette w/ autoinc");
@ -389,7 +389,7 @@ impl Display {
} }
0xFF6B => { 0xFF6B => {
let idx = self.object_palette_index as usize; let idx = self.object_palette_index as usize;
if idx < 64 { if idx < 64 {
self.object_palette_cgb[idx / 8].0[idx % 8] = val; self.object_palette_cgb[idx / 8].0[idx % 8] = val;
} else { } else {
panic!("OOB obj palette w/ autoinc"); panic!("OOB obj palette w/ autoinc");
@ -459,7 +459,10 @@ impl Display {
background_map + ((tile_index_y as usize) * 32) + tile_index_x as usize; background_map + ((tile_index_y as usize) * 32) + tile_index_x as usize;
*/ */
// Background attributes are only in this memory range. // Background attributes are only in this memory range.
assert!(vram_offset >= 0x1800 && vram_offset < 0x2000, format!("offset: {:04X}", vram_offset)); assert!(
vram_offset >= 0x1800 && vram_offset < 0x2000,
format!("offset: {:04X}", vram_offset)
);
BgMapAttributes(self.vram1[vram_offset]) BgMapAttributes(self.vram1[vram_offset])
} }
@ -670,7 +673,12 @@ impl Display {
continue; continue;
} }
let c = self.object_palette_cgb[sprite.palette() as usize].get_color(c); let c = self.object_palette_cgb[sprite.palette() as usize].get_color(c);
self.set_pixel(x.wrapping_add(x_maybe_flipped), render_y, c, PixelOrigin::Sprite); self.set_pixel(
x.wrapping_add(x_maybe_flipped),
render_y,
c,
PixelOrigin::Sprite,
);
} }
} }
} }
@ -690,8 +698,12 @@ impl Display {
} }
pub fn dump_vram(&self) { pub fn dump_vram(&self) {
std::fs::File::create("vram0.dat").unwrap().write_all(&self.vram0); std::fs::File::create("vram0.dat")
std::fs::File::create("vram1.dat").unwrap().write_all(&self.vram1); .unwrap()
.write_all(&self.vram0);
std::fs::File::create("vram1.dat")
.unwrap()
.write_all(&self.vram1);
} }
#[inline] #[inline]