mirror of
https://github.com/FranLMSP/snes.git
synced 2026-10-04 00:15:17 -04:00
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:
@@ -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]
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user