diff --git a/README.md b/README.md index 2fc10a883909cae6cc4fbcc7090084484843e65b..47035548efcf9dd957c6d1d63d3cb9120a0eacdc 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,9 @@ You can use some GET parameters to control the initial behaviour of the emulator | Parameter | Type | Description | | ------------ | ------- | ---------------------------------------------------------------------------------------------- | | `rom_url` | String | The URL from which the initial ROM is going to be loaded, should support CORS. | -| `url` | String | The same as `url`. | +| `url` | String | The same as `rom_url`. | | `fullscreen` | Boolean | If the emulator should start in fullscreen mode. | +| `fs` | Boolean | The same as `fullscreen`. | | `debug` | Boolean | If the "debugger" should start visible. | | `keyboard` | Boolean | If the on screen keyboard should start visible. | | `palette` | String | The name of the palette to be set at startup( eg: `christmas`, `hogwards`, `mariobros`, etc.). | diff --git a/frontends/web/index.ts b/frontends/web/index.ts index 2badc5de949d9d2a25127ee144915a47cb8a8ae7..25ac5e1c5f81d7360ddb675b293f344fb367ae14 100644 --- a/frontends/web/index.ts +++ b/frontends/web/index.ts @@ -17,7 +17,7 @@ const BACKGROUNDS = [ const params = new URLSearchParams(window.location.search); const romUrl = params.get("rom_url") ?? params.get("url") ?? undefined; const fullscreen = ["1", "true", "True"].includes( - params.get("fullscreen") ?? "" + params.get("fullscreen") ?? params.get("fs") ?? "" ); const debug = ["1", "true", "True"].includes(params.get("debug") ?? ""); const keyboard = ["1", "true", "True"].includes( diff --git a/src/ppu.rs b/src/ppu.rs index f9c056e0ceffb61920c76dfad83331e5b8d73bc3..ec68a8b36510cc45845daf2e6bc243cff35da322 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -940,10 +940,10 @@ impl Ppu { /// This method should be called whenever the palette indexes /// are changed. fn compute_palette(palette: &mut Palette, palette_colors: &Palette, value: u8) { - for index in 0..PALETTE_SIZE { + for (index, palette_item) in palette.iter_mut().enumerate() { let color_index: usize = (value as usize >> (index * 2)) & 3; match color_index { - 0..=3 => palette[index] = palette_colors[color_index], + 0..=3 => *palette_item = palette_colors[color_index], color_index => panic!("Invalid palette color index {:04x}", color_index), } } diff --git a/src/rom.rs b/src/rom.rs index 1c3e313a431fe255818fa5d8bebecf7ffaf2819a..cc8c5b53365987a44e00601a77f7c0ead750c64c 100644 --- a/src/rom.rs +++ b/src/rom.rs @@ -412,20 +412,20 @@ impl Cartridge { } pub fn has_battery(&self) -> bool { - match self.rom_type() { - RomType::Mbc1RamBattery => true, - RomType::Mbc2Battery => true, - RomType::RomRamBattery => true, - RomType::Mmm01RamBattery => true, - RomType::Mbc3TimerBattery => true, - RomType::Mbc3TimerRamBattery => true, - RomType::Mbc3RamBattery => true, - RomType::Mbc5RamBattery => true, - RomType::Mbc5RumbleRamBattery => true, - RomType::Mbc7SensorRumbleRamBattery => true, - RomType::HuC1RamBattery => true, - _ => false, - } + return matches!( + self.rom_type(), + RomType::Mbc1RamBattery + | RomType::Mbc2Battery + | RomType::RomRamBattery + | RomType::Mmm01RamBattery + | RomType::Mbc3TimerBattery + | RomType::Mbc3TimerRamBattery + | RomType::Mbc3RamBattery + | RomType::Mbc5RamBattery + | RomType::Mbc5RumbleRamBattery + | RomType::Mbc7SensorRumbleRamBattery + | RomType::HuC1RamBattery + ); } pub fn ram_data_eager(&self) -> Vec<u8> {