centralize hardcore check (#720)

This commit is contained in:
Logan McNaughton 2026-04-09 03:17:57 -06:00 committed by GitHub
parent a1da699580
commit d8ec09d475
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -49,9 +49,7 @@ pub fn run_game(device: &mut Device, rom_contents: Vec<u8>, game_settings: ui::g
if game_settings.disable_expansion_pak {
device.rdram.size = 0x400000;
}
if let Some(slot) = game_settings.load_savestate_slot
&& !retroachievements::get_hardcore()
{
if let Some(slot) = game_settings.load_savestate_slot {
device.ui.storage.save_state_slot = slot;
device.load_state = true;
}

View File

@ -100,6 +100,9 @@ pub fn create_savestate(device: &device::Device) {
}
pub fn load_savestate(device: &mut device::Device) {
if retroachievements::get_hardcore() {
return;
}
let savestate = std::fs::read(&device.ui.storage.paths.savestate_file_path);
if let Ok(savestate) = &savestate {
let device_bytes = ui::storage::decompress_file(savestate, "device");

View File

@ -159,7 +159,7 @@ pub fn check_callback(device: &mut device::Device) -> (bool, bool) {
if device.netplay.is_none() {
if callback.save_state {
device.save_state = true;
} else if callback.load_state && !retroachievements::get_hardcore() {
} else if callback.load_state {
device.load_state = true;
}
if callback.reset_game {