diff --git a/src/cheats.rs b/src/cheats.rs index 0fe876d..d661e90 100644 --- a/src/cheats.rs +++ b/src/cheats.rs @@ -12,6 +12,7 @@ pub struct DecodedCheat { pub struct Cheats { pub cheats: Vec>, 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); } } diff --git a/src/device.rs b/src/device.rs index 19c4d2e..371e171 100644 --- a/src/device.rs +++ b/src/device.rs @@ -506,6 +506,7 @@ impl Device { cheats: cheats::Cheats { cheats: vec![], boot: true, + enabled: false, }, } } diff --git a/src/device/vi.rs b/src/device/vi.rs index a0fad2f..d0f8599 100644 --- a/src/device/vi.rs +++ b/src/device/vi.rs @@ -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() {