is_system_pal (#1007)

This commit is contained in:
Logan McNaughton 2026-06-05 19:21:29 +02:00 committed by GitHub
parent 9140138843
commit 077c1f439c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -137,7 +137,7 @@ pub fn init(device: &mut device::Device, rom_file: &[u8]) {
device.cart.sc64.cfg[device::cart::sc64::SC64_BOOTLOADER_SWITCH as usize] = 1;
device.cart.rom = rom_file.to_vec();
device.cart.pal = is_system_pal(device.cart.rom[0x3E]);
device.cart.pal = is_system_pal(&device.cart.rom);
set_cic(device);
device.ui.game_hash = calculate_hash(&device.cart.rom);
@ -148,10 +148,10 @@ pub fn init(device: &mut device::Device, rom_file: &[u8]) {
}
}
pub fn is_system_pal(country: u8) -> bool {
pub fn is_system_pal(rom_contents: &[u8]) -> bool {
let pal_codes: [u8; 8] = *b"DFIPSUXY";
for i in pal_codes {
if country == i {
if rom_contents[0x3E] == i {
return true;
}
}

View File

@ -179,7 +179,7 @@ pub async fn run(args: Args, arg_count: usize) -> std::io::Result<()> {
player_number,
number_of_players,
input_delay,
device::cart::rom::is_system_pal(rom_contents[0x3E]),
device::cart::rom::is_system_pal(&rom_contents),
);
if device.netplay.is_none() {
return Err(Error::other("Failed to connect to netplay server"));

View File

@ -67,7 +67,7 @@ fn select_rom(weak: slint::Weak<AppWindow>, rom_dir: slint::SharedString) {
if let Some(rom_contents) = device::get_rom_contents(&file) {
let hash = device::cart::rom::calculate_hash(&rom_contents);
let mut game_name = ui::storage::get_game_name(&rom_contents);
let pal = device::cart::rom::is_system_pal(rom_contents[0x3E]);
let pal = device::cart::rom::is_system_pal(&rom_contents);
let game_crc = ui::storage::get_game_crc(&rom_contents);
let cheats = ui::config::Cheats::new();
let mut parsed_cheats = String::new();