Skip to content
Snippets Groups Projects
Verified Commit 557bd2b4 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: support for SDL fast mode

parent 61d9461d
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* XRGB8888 support for Libretro frontend, for better color fidelity and faster render
* Support for save state - [#7](https://gitlab.stage.hive.pt/joamag/boytacean/-/issues/7)
* LibRetro save state support - [#7](https://gitlab.stage.hive.pt/joamag/boytacean/-/issues/7)
* Support for fast mode in SDL frontend
### Changed
......
......@@ -88,6 +88,7 @@ pub struct Emulator {
visual_frequency: f32,
next_tick_time: f32,
next_tick_time_i: u32,
fast: bool,
features: Vec<&'static str>,
palettes: [PaletteInfo; 7],
palette_index: usize,
......@@ -109,6 +110,7 @@ impl Emulator {
visual_frequency: GameBoy::VISUAL_FREQ,
next_tick_time: 0.0,
next_tick_time_i: 0,
fast: false,
features: options
.features
.unwrap_or_else(|| vec!["video", "audio", "no-vsync"]),
......@@ -427,6 +429,34 @@ impl Emulator {
keycode: Some(Keycode::P),
..
} => self.toggle_palette(),
Event::KeyDown {
keycode: Some(Keycode::E),
keymod,
..
} => {
if !self.fast && (keymod & (Mod::LCTRLMOD | Mod::RCTRLMOD)) != Mod::NOMOD {
self.fast = true;
self.logic_frequency *= 8;
}
}
Event::KeyUp {
keycode: Some(Keycode::E),
..
} => {
if self.fast {
self.fast = false;
self.logic_frequency /= 8;
}
}
Event::KeyUp {
keycode: Some(Keycode::LCtrl) | Some(Keycode::RCtrl),
..
} => {
if self.fast {
self.fast = false;
self.logic_frequency /= 8;
}
}
Event::KeyDown {
keycode: Some(Keycode::F),
keymod,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment