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

refactor: some structure refactor

parent 7df36d9f
No related branches found
No related tags found
No related merge requests found
Pipeline #1533 passed
...@@ -286,7 +286,7 @@ class GameboyEmulator extends EmulatorBase implements Emulator { ...@@ -286,7 +286,7 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
break; break;
} }
// @todo replace this with somethign more flexible // @TODO replace this with something more flexible
this.gameBoy.set_palette_colors_ws([ this.gameBoy.set_palette_colors_ws([
"b6a571", "b6a571",
"8b7e56", "8b7e56",
......
...@@ -258,14 +258,14 @@ impl GameBoy { ...@@ -258,14 +258,14 @@ impl GameBoy {
pub fn set_palette_colors_ws(&mut self, value: Vec<JsValue>) { pub fn set_palette_colors_ws(&mut self, value: Vec<JsValue>) {
let palette: Palette = value let palette: Palette = value
.into_iter() .into_iter()
.map(|v| self.convert_value(&v)) .map(|v| Self::js_to_pixel(&v))
.collect::<Vec<Pixel>>() .collect::<Vec<Pixel>>()
.try_into() .try_into()
.unwrap(); .unwrap();
self.ppu().set_palette_colors(&palette); self.ppu().set_palette_colors(&palette);
} }
fn convert_value(&self, value: &JsValue) -> [u8; 3] { fn js_to_pixel(value: &JsValue) -> [u8; 3] {
value value
.as_string() .as_string()
.unwrap() .unwrap()
......
...@@ -235,7 +235,7 @@ impl Mmu { ...@@ -235,7 +235,7 @@ impl Mmu {
0x50 => match addr & 0x00ff { 0x50 => match addr & 0x00ff {
// 0xFF50 - Boot active flag // 0xFF50 - Boot active flag
0x50 => self.boot_active = false, 0x50 => self.boot_active = false,
// 0xFF51-0xFF52 - VRAM DMA source (CGB only) // 0xFF51-0xFF52 - VRAM DMA source (CGB only)
0x51..=0x52 => (), 0x51..=0x52 => (),
......
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