From d8a27626b1e9e4ab4de440347c330efe6c927056 Mon Sep 17 00:00:00 2001 From: Marcello Cordeiro <23259818+marcellocordeiro@users.noreply.github.com> Date: Sun, 21 Jan 2024 03:12:07 -0300 Subject: [PATCH] [eframe] Rename crate --- .gitignore | 14 ++---- Cargo.toml | 2 +- core/gb-core/src/audio.rs | 46 +++++++++++++++++++ platform/{eframe-rust => eframe}/Cargo.toml | 0 platform/{eframe-rust => eframe}/src/app.rs | 0 .../{eframe-rust => eframe}/src/cartridge.rs | 0 platform/{eframe-rust => eframe}/src/gui.rs | 0 .../src/gui/components/color_rect.rs | 0 .../src/gui/components/mod.rs | 0 .../src/gui/control.rs | 0 .../src/gui/palettes.rs | 0 .../src/gui/screen_area.rs | 0 .../{eframe-rust => eframe}/src/gui/state.rs | 0 .../{eframe-rust => eframe}/src/gui/tiles.rs | 0 .../src/key_mappings.rs | 0 platform/{eframe-rust => eframe}/src/main.rs | 0 .../{eframe-rust => eframe}/src/utils/mod.rs | 0 .../src/utils/scaling.rs | 0 18 files changed, 50 insertions(+), 12 deletions(-) rename platform/{eframe-rust => eframe}/Cargo.toml (100%) rename platform/{eframe-rust => eframe}/src/app.rs (100%) rename platform/{eframe-rust => eframe}/src/cartridge.rs (100%) rename platform/{eframe-rust => eframe}/src/gui.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/components/color_rect.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/components/mod.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/control.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/palettes.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/screen_area.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/state.rs (100%) rename platform/{eframe-rust => eframe}/src/gui/tiles.rs (100%) rename platform/{eframe-rust => eframe}/src/key_mappings.rs (100%) rename platform/{eframe-rust => eframe}/src/main.rs (100%) rename platform/{eframe-rust => eframe}/src/utils/mod.rs (100%) rename platform/{eframe-rust => eframe}/src/utils/scaling.rs (100%) diff --git a/.gitignore b/.gitignore index 32e9a5c..ed159b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ /build /target -# Created by https://www.toptal.com/developers/gitignore/api/swiftpackagemanager,xcode,macos -# Edit at https://www.toptal.com/developers/gitignore?templates=swiftpackagemanager,xcode,macos +# Created by https://www.toptal.com/developers/gitignore/api/macos,xcode +# Edit at https://www.toptal.com/developers/gitignore?templates=macos,xcode ### macOS ### # General @@ -37,14 +37,6 @@ Temporary Items # iCloud generated files *.icloud -### SwiftPackageManager ### -Packages -.build/ -xcuserdata -DerivedData/ -*.xcodeproj - - ### Xcode ### ## User settings xcuserdata/ @@ -62,7 +54,7 @@ xcuserdata/ /*.gcno **/xcshareddata/WorkspaceSettings.xcsettings -# End of https://www.toptal.com/developers/gitignore/api/swiftpackagemanager,xcode,macos +# End of https://www.toptal.com/developers/gitignore/api/macos,xcode # Logs logs diff --git a/Cargo.toml b/Cargo.toml index c3cfaea..b399916 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = [ "core/gb-core-c", "core/gb-core-wasm", "core/gb-opcode-info", - "platform/eframe-rust", + "platform/eframe", "platform/libretro", "platform/sdl2-rust", ] diff --git a/core/gb-core/src/audio.rs b/core/gb-core/src/audio.rs index 5af987a..57cc356 100644 --- a/core/gb-core/src/audio.rs +++ b/core/gb-core/src/audio.rs @@ -18,21 +18,66 @@ impl Audio { pub fn read(&self, address: u16) -> u8 { match address { // TODO: stubs for the DMG. + + // Channel 1 + + // FF10 — NR10: Channel 1 sweep 0xFF10 => 0x80, + + // FF11 — NR11: Channel 1 length timer & duty cycle 0xFF11 => 0xBF, + + // FF12 — NR12: Channel 1 volume & envelope 0xFF12 => 0xF3, + + // FF13 — NR13: Channel 1 period low [write-only] + 0xFF13 => panic!("NR13 is write-only"), + + // FF14 — NR14: Channel 1 period high & control 0xFF14 => 0xBF, + + // Channel 2 + + // FF16 — NR21: Channel 2 length timer & duty cycle 0xFF16 => 0x3F, + + // FF12 — NR22: Channel 2 volume & envelope 0xFF17 => 0x00, + + // FF18 — NR23: Channel 2 period low [write-only] + 0xFF18 => panic!("NR23 is write-only"), + + // FF19 — NR24: Channel 2 period high & control 0xFF19 => 0xBF, + + // Channel 3 + + // FF1A — NR30: Channel 3 DAC enable 0xFF1A => 0x7F, + + // FF1B — NR31: Channel 3 length timer [write-only] + 0xFF1B => panic!("NR31 is write-only"), + + // FF1C — NR32: Channel 3 output level 0xFF1C => 0x9F, + + // FF1D — NR33: Channel 3 period low [write-only] + 0xFF1D => panic!("NR33 is write-only"), + + // FF1E — NR34: Channel 3 period high & control 0xFF1E => 0xBF, + 0xFF21 => 0x00, 0xFF22 => 0x00, 0xFF23 => 0xBF, + + // FF24 — NR50: Master volume & VIN panning 0xFF24 => 0x77, + + // FF25 — NR51: Sound panning 0xFF25 => 0xF3, + + // FF26 — NR52: Audio master control 0xFF26 => 0xF1, 0xFF76 => { @@ -51,6 +96,7 @@ impl Audio { 0x00 } + // _ => panic!("Invalid address"), _ => 0xFF, } } diff --git a/platform/eframe-rust/Cargo.toml b/platform/eframe/Cargo.toml similarity index 100% rename from platform/eframe-rust/Cargo.toml rename to platform/eframe/Cargo.toml diff --git a/platform/eframe-rust/src/app.rs b/platform/eframe/src/app.rs similarity index 100% rename from platform/eframe-rust/src/app.rs rename to platform/eframe/src/app.rs diff --git a/platform/eframe-rust/src/cartridge.rs b/platform/eframe/src/cartridge.rs similarity index 100% rename from platform/eframe-rust/src/cartridge.rs rename to platform/eframe/src/cartridge.rs diff --git a/platform/eframe-rust/src/gui.rs b/platform/eframe/src/gui.rs similarity index 100% rename from platform/eframe-rust/src/gui.rs rename to platform/eframe/src/gui.rs diff --git a/platform/eframe-rust/src/gui/components/color_rect.rs b/platform/eframe/src/gui/components/color_rect.rs similarity index 100% rename from platform/eframe-rust/src/gui/components/color_rect.rs rename to platform/eframe/src/gui/components/color_rect.rs diff --git a/platform/eframe-rust/src/gui/components/mod.rs b/platform/eframe/src/gui/components/mod.rs similarity index 100% rename from platform/eframe-rust/src/gui/components/mod.rs rename to platform/eframe/src/gui/components/mod.rs diff --git a/platform/eframe-rust/src/gui/control.rs b/platform/eframe/src/gui/control.rs similarity index 100% rename from platform/eframe-rust/src/gui/control.rs rename to platform/eframe/src/gui/control.rs diff --git a/platform/eframe-rust/src/gui/palettes.rs b/platform/eframe/src/gui/palettes.rs similarity index 100% rename from platform/eframe-rust/src/gui/palettes.rs rename to platform/eframe/src/gui/palettes.rs diff --git a/platform/eframe-rust/src/gui/screen_area.rs b/platform/eframe/src/gui/screen_area.rs similarity index 100% rename from platform/eframe-rust/src/gui/screen_area.rs rename to platform/eframe/src/gui/screen_area.rs diff --git a/platform/eframe-rust/src/gui/state.rs b/platform/eframe/src/gui/state.rs similarity index 100% rename from platform/eframe-rust/src/gui/state.rs rename to platform/eframe/src/gui/state.rs diff --git a/platform/eframe-rust/src/gui/tiles.rs b/platform/eframe/src/gui/tiles.rs similarity index 100% rename from platform/eframe-rust/src/gui/tiles.rs rename to platform/eframe/src/gui/tiles.rs diff --git a/platform/eframe-rust/src/key_mappings.rs b/platform/eframe/src/key_mappings.rs similarity index 100% rename from platform/eframe-rust/src/key_mappings.rs rename to platform/eframe/src/key_mappings.rs diff --git a/platform/eframe-rust/src/main.rs b/platform/eframe/src/main.rs similarity index 100% rename from platform/eframe-rust/src/main.rs rename to platform/eframe/src/main.rs diff --git a/platform/eframe-rust/src/utils/mod.rs b/platform/eframe/src/utils/mod.rs similarity index 100% rename from platform/eframe-rust/src/utils/mod.rs rename to platform/eframe/src/utils/mod.rs diff --git a/platform/eframe-rust/src/utils/scaling.rs b/platform/eframe/src/utils/scaling.rs similarity index 100% rename from platform/eframe-rust/src/utils/scaling.rs rename to platform/eframe/src/utils/scaling.rs