add cheats enabled var

This commit is contained in:
Logan McNaughton 2025-07-05 09:25:31 +02:00
parent 6c6d0f32a7
commit 5857da0404
3 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@ pub struct DecodedCheat {
pub struct Cheats {
pub cheats: Vec<Vec<DecodedCheat>>,
pub boot: bool,
pub enabled: bool,
}
pub fn init(
@ -69,6 +70,7 @@ pub fn init(
}
if !device.cheats.cheats.is_empty() {
device.cheats.enabled = true;
ui::audio::play_cheat_event(&device.ui);
}
}

View File

@ -506,6 +506,7 @@ impl Device {
cheats: cheats::Cheats {
cheats: vec![],
boot: true,
enabled: false,
},
}
}

View File

@ -134,7 +134,9 @@ pub fn write_regs(device: &mut device::Device, address: u64, value: u32, mask: u
}
pub fn vertical_interrupt_event(device: &mut device::Device) {
cheats::execute_cheats(device, device.cheats.cheats.clone());
if device.cheats.enabled {
cheats::execute_cheats(device, device.cheats.cheats.clone());
}
let mut speed_limiter_toggled = ui::video::check_callback(device);
if device.netplay.is_some() {