General improvements (#10)

* Makefile

* Restart emulation as soon as a ROM is loaded

* upgrade eframe and wgpu

* adjust the tv output image size according to the current snes resolution

* fix bug when loading different roms
This commit is contained in:
2024-11-06 22:45:43 -05:00
committed by GitHub
parent 966b24697c
commit 06355d8a34
11 changed files with 59 additions and 12 deletions
+6
View File
@@ -35,6 +35,12 @@ impl Bus {
}
}
pub fn hard_reset(&mut self) {
self.wram = [0; 0x10000];
self.internal_registers = InternalRegisters::new();
self.dma = DMA::new();
}
fn read_wram(&self, address: u32) -> u8 {
self.wram[(address & 0xFFFF) as usize]
}
+7 -1
View File
@@ -34,9 +34,15 @@ impl Emulator {
}
}
pub fn reset(&mut self) {
pub fn reset_vector(&mut self) {
self.cpu.reset_vector(&mut self.bus);
}
pub fn hard_reset(&mut self) {
self.cpu = CPU::new();
self.bus.hard_reset();
self.reset_vector();
}
}
impl Default for Emulator {
+1
View File
@@ -94,6 +94,7 @@ impl PPU {
// ----
// possible optimizations:
// - Fetch all of the necessary data before starting to render the scanline
// - Pre-render each background in a framebuffer and only update the framebuffer if either the tileset or charset changes
let tileset_vram_base_address = self.registers.get_bg_tile_base_address(background) as usize;
let charset_vram_base_address = self.registers.get_bg_char_base_address(background) as usize;
let (bg_size_width, _) = self.registers.get_bg_size(background).to_usize();
+1
View File
@@ -20,6 +20,7 @@ impl LoROM {
impl ROM for LoROM {
fn load(&mut self, filename: &str) -> std::io::Result<bool> {
self.data = vec![];
load_rom(filename, &mut self.data)
}