From 54ceaedf8412303ebe39b9c310601a889660b251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Wed, 6 Jul 2022 09:11:19 +0100 Subject: [PATCH] feat: new upload operation --- examples/sdl/src/main.rs | 4 +++- examples/web/index.html | 2 +- examples/web/index.ts | 2 +- src/gb.rs | 6 +++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/sdl/src/main.rs b/examples/sdl/src/main.rs index ff54cf48..965230e0 100644 --- a/examples/sdl/src/main.rs +++ b/examples/sdl/src/main.rs @@ -81,7 +81,7 @@ fn main() { // creates a new Game Boy instance and loads both the boot ROM // and the initial game ROM to "start the engine" let mut game_boy = GameBoy::new(); - game_boy.load_boot_dmg_bootix(); + game_boy.load_boot_static(); game_boy.load_rom_file("../../res/roms.prop/tetris.gb"); //game_boy.load_rom_file("../../res/roms.prop/alleyway.gb"); @@ -107,6 +107,8 @@ fn main() { // on the number of visual ticks since beginning counter = counter.wrapping_add(1); + // obtains an event from the SDL sub-system to be + // processed under the current emulation context while let Some(event) = graphics.event_pump.poll_event() { match event { Event::Quit { .. } => break 'main, diff --git a/examples/web/index.html b/examples/web/index.html index faa20ad4..a60d7232 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -112,7 +112,7 @@ <img src="res/marker.svg" alt="marker" /><span>Theme</span> </span> <span id="button-upload" class="tiny-button border padded file"> - <img src="res/upload.svg" alt="upload" /><span>Upload ROM</span> + <img src="res/upload.svg" alt="upload" /><span>Load ROM</span> <input type="file" id="button-upload-file" name="button-upload-file" accept=".ch8"> </span> </div> diff --git a/examples/web/index.ts b/examples/web/index.ts index 13442109..68cd9aaa 100644 --- a/examples/web/index.ts +++ b/examples/web/index.ts @@ -288,7 +288,7 @@ const start = async ({ // resets the Game Boy engine to restore it into // a valid state ready to be used //state.gameBoy.reset_hard(); @todo - state.gameBoy.load_boot_dmg(); + state.gameBoy.load_boot_static(); state.gameBoy.load_rom(romData); // updates the name of the currently selected engine diff --git a/src/gb.rs b/src/gb.rs index d81ea62b..e7037be1 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -82,7 +82,7 @@ impl GameBoy { } pub fn load_boot_default(&mut self) { - self.load_boot_dmg_f(); + self.load_boot_dmg_bootix_f(); } pub fn load_boot_dmg(&mut self) { @@ -101,6 +101,10 @@ impl GameBoy { self.load_boot(&MGB_BOOTIX); } + pub fn load_boot_static(&mut self) { + self.load_boot_dmg_bootix(); + } + pub fn frame_buffer_eager(&mut self) -> Vec<u8> { self.frame_buffer().to_vec() } -- GitLab