From 18fc5a589f40eb46ccbfad74a6ec003407f04332 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 13 Nov 2022 11:58:12 +0000
Subject: [PATCH] refactor: some structure refactor

---
 examples/web/index.ts | 2 +-
 src/gb.rs             | 4 ++--
 src/mmu.rs            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/web/index.ts b/examples/web/index.ts
index ebc456c9..72242663 100644
--- a/examples/web/index.ts
+++ b/examples/web/index.ts
@@ -286,7 +286,7 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
                 break;
         }
 
-        // @todo replace this with somethign more flexible
+        // @TODO replace this with something more flexible
         this.gameBoy.set_palette_colors_ws([
             "b6a571",
             "8b7e56",
diff --git a/src/gb.rs b/src/gb.rs
index 73af0a25..e248248d 100644
--- a/src/gb.rs
+++ b/src/gb.rs
@@ -258,14 +258,14 @@ impl GameBoy {
     pub fn set_palette_colors_ws(&mut self, value: Vec<JsValue>) {
         let palette: Palette = value
             .into_iter()
-            .map(|v| self.convert_value(&v))
+            .map(|v| Self::js_to_pixel(&v))
             .collect::<Vec<Pixel>>()
             .try_into()
             .unwrap();
         self.ppu().set_palette_colors(&palette);
     }
 
-    fn convert_value(&self, value: &JsValue) -> [u8; 3] {
+    fn js_to_pixel(value: &JsValue) -> [u8; 3] {
         value
             .as_string()
             .unwrap()
diff --git a/src/mmu.rs b/src/mmu.rs
index 4ffaef9b..abe5aa46 100644
--- a/src/mmu.rs
+++ b/src/mmu.rs
@@ -235,7 +235,7 @@ impl Mmu {
                             0x50 => match addr & 0x00ff {
                                 // 0xFF50 - Boot active flag
                                 0x50 => self.boot_active = false,
-    
+
                                 // 0xFF51-0xFF52 - VRAM DMA source (CGB only)
                                 0x51..=0x52 => (),
 
-- 
GitLab