Skip to content

Commit

Permalink
Silent invalid reads logs (made them trace)
Browse files Browse the repository at this point in the history
  • Loading branch information
alloncm committed Dec 28, 2024
1 parent 69f08f8 commit 71f5ebb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions core/src/machine/mbc_initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub fn initialize_mbc(program:&[u8], save_data:Option<&[u8]>)->&'static mut dyn
let program_clone:&mut [u8] = static_alloc_array(program.len());
program_clone.clone_from_slice(program);
let save_data_clone:Option<&'static mut[u8]> = if let Some(sd) = save_data{
log::info!("Found save data!");
let static_alloc_array = static_alloc_array(sd.len());
static_alloc_array.clone_from_slice(&sd);
Some(static_alloc_array)
Expand Down
12 changes: 6 additions & 6 deletions core/src/mmu/gb_mmu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a, D:AudioDevice, G:GfxDevice, J:JoypadProvider> Memory for GbMmu<'a, D, G
return self.io_bus.ppu.vram.read_current_bank(address-0x8000);
}
else{
log::warn!("bad vram read");
log::trace!("bad vram read");
return BAD_READ_VALUE;
}
},
Expand All @@ -50,7 +50,7 @@ impl<'a, D:AudioDevice, G:GfxDevice, J:JoypadProvider> Memory for GbMmu<'a, D, G
return self.io_bus.ppu.oam[(address-0xFE00) as usize];
}
else{
log::warn!("bad oam read");
log::trace!("bad oam read");
return BAD_READ_VALUE;
}
}
Expand Down Expand Up @@ -80,15 +80,15 @@ impl<'a, D:AudioDevice, G:GfxDevice, J:JoypadProvider> Memory for GbMmu<'a, D, G
self.io_bus.ppu.vram.write_current_bank(address-0x8000, value);
}
else{
log::warn!("bad vram write: address - {:#X}, value - {:#X}, bank - {}", address, value, self.io_bus.ppu.vram.get_bank_reg());
log::trace!("bad vram write: address - {:#X}, value - {:#X}, bank - {}", address, value, self.io_bus.ppu.vram.get_bank_reg());
}
},
0xFE00..=0xFE9F=>{
if self.is_oam_ready_for_io(){
self.io_bus.ppu.oam[(address-0xFE00) as usize] = value;
}
else{
log::warn!("bad oam write")
log::trace!("bad oam write")
}
},
_=>self.write_unprotected(address, value)
Expand Down Expand Up @@ -249,12 +249,12 @@ impl<'a, D:AudioDevice, G:GfxDevice, J:JoypadProvider> GbMmu<'a, D, G, J>{
}

fn bad_dma_read(address:u16)->u8{
log::warn!("bad memory read during dma. {:#X}", address);
log::trace!("bad memory read during dma. {:#X}", address);
return BAD_READ_VALUE;
}

fn bad_dma_write(address:u16){
log::warn!("bad memory write during dma. {:#X}", address)
log::trace!("bad memory write during dma. {:#X}", address)
}

fn write_color_ram(&mut self, address:u16, color: Color){
Expand Down
2 changes: 1 addition & 1 deletion core/src/ppu/gb_ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ impl<GFX:GfxDevice> GbPpu<GFX>{
color_ram[(*pallete_index_register & 0b11_1111) as usize] = value;
}
else{
log::warn!("bad color ram write: index - {:#X}, value: - {:#X}", pallete_index_register, value);
log::trace!("bad color ram write: index - {:#X}, value: - {:#X}", pallete_index_register, value);
}

// if bit 7 is set inderement the dest adderess after write
Expand Down

0 comments on commit 71f5ebb

Please sign in to comment.