Skip to content
Snippets Groups Projects
Verified Commit 2463f23e authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

Merge branch 'master' into joamag/color

parents 11f7f1b1 5102df98
No related branches found
No related tags found
1 merge request!16Support for Game Boy Color (CGB) 😎🖍️
Pipeline #1630 passed
......@@ -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.). |
......
......@@ -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(
......
......@@ -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),
}
}
......
......@@ -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> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment