diff --git a/README.md b/README.md index 96e7741..ab56ce7 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ I am using LLVM's clang and libcxx as the primary toolchain. ## Static libraries -| Name | Version | Required? | -|:------:|:----------|:---------:| -| catch2 | >= 3.4 | for tests | +| Name | Version | Required? | Purpose | +|:------:|:--------|:---------:|:---------:| +| catch2 | >= 3.4 | no | for tests | This goes without saying but using a different toolchain to compile these libraries before linking probably won't work. diff --git a/include/bus.hh b/include/bus.hh index 55e7413..06ebdba 100644 --- a/include/bus.hh +++ b/include/bus.hh @@ -1,6 +1,7 @@ #pragma once #include "memory.hh" +#include "io/io.hh" #include namespace matar { @@ -18,6 +19,7 @@ class Bus { void write_word(uint32_t address, uint32_t word); private: + IoDevices io; std::shared_ptr memory; }; } diff --git a/include/io.hh b/include/io.hh deleted file mode 100644 index dd41ae4..0000000 --- a/include/io.hh +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include - -// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays) - -namespace matar { -class IoRegisters { - public: - uint8_t read(uint32_t) const; - void write(uint32_t, uint8_t); - - private: - struct { - bool post_boot_flag = false; - bool interrupt_master_enabler = false; - } system; -}; -} - -// NOLINTEND(cppcoreguidelines-avoid-c-arrays) diff --git a/include/io/io.hh b/include/io/io.hh new file mode 100644 index 0000000..e22c7a1 --- /dev/null +++ b/include/io/io.hh @@ -0,0 +1,32 @@ +#pragma once +#include "lcd.hh" +#include "sound.hh" +#include + +namespace matar { +class IoDevices { + public: + uint8_t read_byte(uint32_t) const; + void write_byte(uint32_t, uint8_t); + + uint32_t read_word(uint32_t) const; + void write_word(uint32_t, uint32_t); + + uint16_t read_halfword(uint32_t) const; + void write_halfword(uint32_t, uint16_t); + + private: + struct { + using u16 = uint16_t; + bool post_boot_flag; + bool interrupt_master_enabler; + u16 interrupt_enable; + u16 interrupt_request_flags; + u16 waitstate_control; + bool low_power_mode; + } system = {}; + + struct lcd lcd = {}; + struct sound sound = {}; +}; +} diff --git a/include/io/lcd.hh b/include/io/lcd.hh new file mode 100644 index 0000000..fa9bd21 --- /dev/null +++ b/include/io/lcd.hh @@ -0,0 +1,84 @@ +#include + +// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays) + +/* + 4000000h 2 R/W DISPCNT LCD Control + 4000002h 2 R/W - Undocumented - Green Swap + 4000004h 2 R/W DISPSTAT General LCD Status (STAT,LYC) + 4000006h 2 R VCOUNT Vertical Counter (LY) + 4000008h 2 R/W BG0CNT BG0 Control + 400000Ah 2 R/W BG1CNT BG1 Control + 400000Ch 2 R/W BG2CNT BG2 Control + 400000Eh 2 R/W BG3CNT BG3 Control + 4000010h 2 W BG0HOFS BG0 X-Offset + 4000012h 2 W BG0VOFS BG0 Y-Offset + 4000014h 2 W BG1HOFS BG1 X-Offset + 4000016h 2 W BG1VOFS BG1 Y-Offset + 4000018h 2 W BG2HOFS BG2 X-Offset + 400001Ah 2 W BG2VOFS BG2 Y-Offset + 400001Ch 2 W BG3HOFS BG3 X-Offset + 400001Eh 2 W BG3VOFS BG3 Y-Offset + 4000020h 2 W BG2PA BG2 Rotation/Scaling Parameter A (dx) + 4000022h 2 W BG2PB BG2 Rotation/Scaling Parameter B (dmx) + 4000024h 2 W BG2PC BG2 Rotation/Scaling Parameter C (dy) + 4000026h 2 W BG2PD BG2 Rotation/Scaling Parameter D (dmy) + 4000028h 4 W BG2X BG2 Reference Point X-Coordinate + 400002Ch 4 W BG2Y BG2 Reference Point Y-Coordinate + 4000030h 2 W BG3PA BG3 Rotation/Scaling Parameter A (dx) + 4000032h 2 W BG3PB BG3 Rotation/Scaling Parameter B (dmx) + 4000034h 2 W BG3PC BG3 Rotation/Scaling Parameter C (dy) + 4000036h 2 W BG3PD BG3 Rotation/Scaling Parameter D (dmy) + 4000038h 4 W BG3X BG3 Reference Point X-Coordinate + 400003Ch 4 W BG3Y BG3 Reference Point Y-Coordinate + 4000040h 2 W WIN0H Window 0 Horizontal Dimensions + 4000042h 2 W WIN1H Window 1 Horizontal Dimensions + 4000044h 2 W WIN0V Window 0 Vertical Dimensions + 4000046h 2 W WIN1V Window 1 Vertical Dimensions + 4000048h 2 R/W WININ Inside of Window 0 and 1 + 400004Ah 2 R/W WINOUT Inside of OBJ Window & Outside of Windows + 400004Ch 2 W MOSAIC Mosaic Size + 400004Eh - - Not used + 4000050h 2 R/W BLDCNT Color Special Effects Selection + 4000052h 2 R/W BLDALPHA Alpha Blending Coefficients + 4000054h 2 W BLDY Brightness (Fade-In/Out) Coefficient + 4000056h - - Not used +*/ + +struct lcd { + using u16 = uint16_t; + + u16 lcd_control; + u16 general_lcd_status; + u16 vertical_counter; + u16 bg0_control; + u16 bg1_control; + u16 bg2_control; + u16 bg3_control; + u16 bg0_x_offset; + u16 bg0_y_offset; + u16 bg1_x_offset; + u16 bg1_y_offset; + u16 bg2_x_offset; + u16 bg2_y_offset; + u16 bg3_x_offset; + u16 bg3_y_offset; + u16 bg2_rot_scaling_parameters[4]; + u16 bg2_reference_x[2]; + u16 bg2_reference_y[2]; + u16 bg3_rot_scaling_parameters[4]; + u16 bg3_reference_x[2]; + u16 bg3_reference_y[2]; + u16 win0_horizontal_dimensions; + u16 win1_horizontal_dimensions; + u16 win0_vertical_dimensions; + u16 win1_vertical_dimensions; + u16 inside_win_0_1; + u16 outside_win; + u16 mosaic_size; + u16 color_special_effects_selection; + u16 alpha_blending_coefficients; + u16 brightness_coefficient; +}; + +// NOLINTEND(cppcoreguidelines-avoid-c-arrays) diff --git a/include/io/meson.build b/include/io/meson.build new file mode 100644 index 0000000..4cb1864 --- /dev/null +++ b/include/io/meson.build @@ -0,0 +1,3 @@ +headers += files( + 'io.hh' +) \ No newline at end of file diff --git a/include/io/sound.hh b/include/io/sound.hh new file mode 100644 index 0000000..b983789 --- /dev/null +++ b/include/io/sound.hh @@ -0,0 +1,66 @@ +#include + +// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays) + +/* + 4000060h 2 R/W SOUND1CNT_L Channel 1 Sweep register (NR10) + 4000062h 2 R/W SOUND1CNT_H Channel 1 Duty/Length/Envelope (NR11, NR12) + 4000064h 2 R/W SOUND1CNT_X Channel 1 Frequency/Control (NR13, NR14) + 4000066h - - Not used + 4000068h 2 R/W SOUND2CNT_L Channel 2 Duty/Length/Envelope (NR21, NR22) + 400006Ah - - Not used + 400006Ch 2 R/W SOUND2CNT_H Channel 2 Frequency/Control (NR23, NR24) + 400006Eh - - Not used + 4000070h 2 R/W SOUND3CNT_L Channel 3 Stop/Wave RAM select (NR30) + 4000072h 2 R/W SOUND3CNT_H Channel 3 Length/Volume (NR31, NR32) + 4000074h 2 R/W SOUND3CNT_X Channel 3 Frequency/Control (NR33, NR34) + 4000076h - - Not used + 4000078h 2 R/W SOUND4CNT_L Channel 4 Length/Envelope (NR41, NR42) + 400007Ah - - Not used + 400007Ch 2 R/W SOUND4CNT_H Channel 4 Frequency/Control (NR43, NR44) + 400007Eh - - Not used + 4000080h 2 R/W SOUNDCNT_L Control Stereo/Volume/Enable (NR50, NR51) + 4000082h 2 R/W SOUNDCNT_H Control Mixing/DMA Control + 4000084h 2 R/W SOUNDCNT_X Control Sound on/off (NR52) + 4000086h - - Not used + 4000088h 2 BIOS SOUNDBIAS Sound PWM Control + 400008Ah .. - - Not used + 4000090h 2x10h R/W WAVE_RAM Channel 3 Wave Pattern RAM (2 banks!!) + 40000A0h 4 W FIFO_A Channel A FIFO, Data 0-3 + 40000A4h 4 W FIFO_B Channel B FIFO, Data 0-3 +*/ + +struct sound{ + using u16 = uint16_t; + + // channel 1 + u16 ch1_sweep; + u16 ch1_duty_length_env; + u16 ch1_freq_control; + + // channel 2 + u16 ch2_duty_length_env; + u16 ch2_freq_control; + + // channel 3 + u16 ch3_stop_wave_ram_select; + u16 ch3_length_volume; + u16 ch3_freq_control; + u16 ch3_wave_pattern[8]; + + // channel 4 + u16 ch4_length_env; + u16 ch4_freq_control; + + // control + u16 ctrl_stereo_volume; + u16 ctrl_mixing; + u16 ctrl_sound_on_off; + u16 pwm_control; + + // fifo + u16 fifo_a[2]; + u16 fifo_b[2]; +}; + +// NOLINTEND(cppcoreguidelines-avoid-c-arrays) diff --git a/include/memory.hh b/include/memory.hh index bd2b250..eedf0a9 100644 --- a/include/memory.hh +++ b/include/memory.hh @@ -1,7 +1,6 @@ #pragma once #include "header.hh" -#include "io.hh" #include #include #include @@ -51,8 +50,6 @@ class Memory { MEMORY_REGION(ROM_2, 0x0C000000) #undef MEMORY_REGION - - IoRegisters io; std::unordered_map invalid_mem; std::vector rom; Header header; diff --git a/include/meson.build b/include/meson.build index 5862056..cc26387 100644 --- a/include/meson.build +++ b/include/meson.build @@ -8,5 +8,6 @@ inc = include_directories('.') subdir('cpu') subdir('util') +subdir('io') install_headers(headers, subdir: meson.project_name(), preserve_path: true) \ No newline at end of file diff --git a/nix/Cargo.lock b/nix/Cargo.lock new file mode 100644 index 0000000..51ae60e --- /dev/null +++ b/nix/Cargo.lock @@ -0,0 +1,1248 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +dependencies = [ + "serde", +] + +[[package]] +name = "ash" +version = "0.37.3+1.3.251" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" +dependencies = [ + "libloading 0.7.4", +] + +[[package]] +name = "autocfg" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +dependencies = [ + "serde", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "cc" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading 0.8.3", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "d3d12" +version = "0.19.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=87576b72b37c6b78b41104eb25fc31893af94092#87576b72b37c6b78b41104eb25fc31893af94092" +dependencies = [ + "bitflags 2.5.0", + "libloading 0.8.3", + "winapi", +] + +[[package]] +name = "either" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "glow" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-alloc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" +dependencies = [ + "bitflags 2.5.0", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "gpu-descriptor" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" +dependencies = [ + "bitflags 2.5.0", + "gpu-descriptor-types", + "hashbrown", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading 0.8.3", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "metal" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +dependencies = [ + "bitflags 2.5.0", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "naga" +version = "0.19.2" +source = "git+https://github.com/gfx-rs/wgpu?rev=87576b72b37c6b78b41104eb25fc31893af94092#87576b72b37c6b78b41104eb25fc31893af94092" +dependencies = [ + "bit-set", + "bitflags 2.5.0", + "codespan-reporting", + "hexf-parse", + "indexmap", + "log", + "num-traits", + "petgraph", + "pp-rs", + "rustc-hash", + "serde", + "spirv", + "termcolor", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "pp-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "prettyplease" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58" + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "range-alloc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" + +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "ron" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" +dependencies = [ + "base64", + "bitflags 2.5.0", + "serde", + "serde_derive", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.198" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.198" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slotmap" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "spirv" +version = "0.3.0+sdk-1.3.268.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "syn" +version = "2.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu-core" +version = "0.19.4" +source = "git+https://github.com/gfx-rs/wgpu?rev=87576b72b37c6b78b41104eb25fc31893af94092#87576b72b37c6b78b41104eb25fc31893af94092" +dependencies = [ + "arrayvec", + "bit-vec", + "bitflags 2.5.0", + "cfg_aliases", + "codespan-reporting", + "indexmap", + "log", + "naga", + "once_cell", + "parking_lot", + "profiling", + "raw-window-handle", + "ron", + "rustc-hash", + "serde", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-hal" +version = "0.19.4" +source = "git+https://github.com/gfx-rs/wgpu?rev=87576b72b37c6b78b41104eb25fc31893af94092#87576b72b37c6b78b41104eb25fc31893af94092" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.5.0", + "block", + "cfg_aliases", + "core-graphics-types", + "d3d12", + "glow", + "glutin_wgl_sys", + "gpu-alloc", + "gpu-descriptor", + "js-sys", + "khronos-egl", + "libc", + "libloading 0.8.3", + "log", + "metal", + "naga", + "ndk-sys", + "objc", + "once_cell", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types", + "winapi", +] + +[[package]] +name = "wgpu-native" +version = "0.0.0" +dependencies = [ + "bindgen", + "cfg_aliases", + "log", + "naga", + "parking_lot", + "paste", + "raw-window-handle", + "serde", + "smallvec", + "thiserror", + "wgpu-core", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "0.19.2" +source = "git+https://github.com/gfx-rs/wgpu?rev=87576b72b37c6b78b41104eb25fc31893af94092#87576b72b37c6b78b41104eb25fc31893af94092" +dependencies = [ + "bitflags 2.5.0", + "js-sys", + "serde", + "web-sys", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "xml-rs" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/src/bus.cc b/src/bus.cc index ca60675..c55e21c 100644 --- a/src/bus.cc +++ b/src/bus.cc @@ -3,16 +3,28 @@ #include namespace matar { + +static constexpr uint32_t IO_START = 0x4000000; +static constexpr uint32_t IO_END = 0x40003FE; + Bus::Bus(const Memory& memory) : memory(std::make_shared(memory)) {} uint8_t Bus::read_byte(uint32_t address) { + if (address >= IO_START && address <= IO_END) + return io.read_byte(address); + return memory->read(address); } void Bus::write_byte(uint32_t address, uint8_t byte) { + if (address >= IO_START && address <= IO_END) { + io.write_byte(address, byte); + return; + } + memory->write(address, byte); } @@ -21,6 +33,9 @@ Bus::read_halfword(uint32_t address) { if (address & 0b01) glogger.warn("Reading a non aligned halfword address"); + if (address >= IO_START && address <= IO_END) + return io.read_halfword(address); + return read_byte(address) | read_byte(address + 1) << 8; } @@ -29,6 +44,11 @@ Bus::write_halfword(uint32_t address, uint16_t halfword) { if (address & 0b01) glogger.warn("Writing to a non aligned halfword address"); + if (address >= IO_START && address <= IO_END) { + io.write_halfword(address, halfword); + return; + } + write_byte(address, halfword & 0xFF); write_byte(address + 1, halfword >> 8 & 0xFF); } @@ -38,6 +58,9 @@ Bus::read_word(uint32_t address) { if (address & 0b11) glogger.warn("Reading a non aligned word address"); + if (address >= IO_START && address <= IO_END) + return io.read_word(address); + return read_byte(address) | read_byte(address + 1) << 8 | read_byte(address + 2) << 16 | read_byte(address + 3) << 24; } @@ -47,6 +70,11 @@ Bus::write_word(uint32_t address, uint32_t word) { if (address & 0b11) glogger.warn("Writing to a non aligned word address"); + if (address >= IO_START && address <= IO_END) { + io.write_word(address, word); + return; + } + write_byte(address, word & 0xFF); write_byte(address + 1, word >> 8 & 0xFF); write_byte(address + 2, word >> 16 & 0xFF); diff --git a/src/io.cc b/src/io.cc deleted file mode 100644 index ae46e79..0000000 --- a/src/io.cc +++ /dev/null @@ -1,40 +0,0 @@ -#include "io.hh" -#include "util/log.hh" - -namespace matar { -#define ADDR static constexpr uint32_t - -ADDR POSTFLG = 0x4000300; -ADDR IME = 0x4000208; - -#undef ADDR - -uint8_t -IoRegisters::read(uint32_t address) const { - switch (address) { - case POSTFLG: - return system.post_boot_flag; - case IME: - return system.interrupt_master_enabler; - default: - glogger.warn("Unused IO address read at 0x{:08X}", address); - } - - return 0xFF; -} - -void -IoRegisters::write(uint32_t address, uint8_t byte) { - switch (address) { - case POSTFLG: - system.post_boot_flag = byte & 1; - break; - case IME: - system.interrupt_master_enabler = byte & 1; - break; - default: - glogger.warn("Unused IO address written at 0x{:08X}", address); - } - return; -} -} diff --git a/src/io/io.cc b/src/io/io.cc new file mode 100644 index 0000000..9d1794d --- /dev/null +++ b/src/io/io.cc @@ -0,0 +1,279 @@ +#include "io/io.hh" +#include "util/bits.hh" +#include "util/log.hh" + +namespace matar { +#define ADDR static constexpr uint32_t + +// lcd +ADDR DISPCNT = 0x4000000; +ADDR DISPSTAT = 0x4000004; +ADDR VCOUNT = 0x4000006; +ADDR BG0CNT = 0x4000008; +ADDR BG1CNT = 0x400000A; +ADDR BG2CNT = 0x400000C; +ADDR BG3CNT = 0x400000E; +ADDR BG0HOFS = 0x4000010; +ADDR BG0VOFS = 0x4000012; +ADDR BG1HOFS = 0x4000014; +ADDR BG1VOFS = 0x4000016; +ADDR BG2HOFS = 0x4000018; +ADDR BG2VOFS = 0x400001A; +ADDR BG3HOFS = 0x400001C; +ADDR BG3VOFS = 0x400001E; +ADDR BG2PA = 0x4000020; +ADDR BG2PB = 0x4000022; +ADDR BG2PC = 0x4000024; +ADDR BG2PD = 0x4000026; +ADDR BG2X_L = 0x4000028; +ADDR BG2X_H = 0x400002A; +ADDR BG2Y_L = 0x400002C; +ADDR BG2Y_H = 0x400002E; +ADDR BG3PA = 0x4000030; +ADDR BG3PB = 0x4000032; +ADDR BG3PC = 0x4000034; +ADDR BG3PD = 0x4000036; +ADDR BG3X_L = 0x4000038; +ADDR BG3X_H = 0x400003A; +ADDR BG3Y_L = 0x400003C; +ADDR BG3Y_H = 0x400003E; +ADDR WIN0H = 0x4000040; +ADDR WIN1H = 0x4000042; +ADDR WIN0V = 0x4000044; +ADDR WIN1V = 0x4000046; +ADDR WININ = 0x4000048; +ADDR WINOUT = 0x400004A; +ADDR MOSAIC = 0x400004C; +ADDR BLDCNT = 0x4000050; +ADDR BLDALPHA = 0x4000052; +ADDR BLDY = 0x4000054; + +// sound +ADDR SOUND1CNT_L = 0x4000060; +ADDR SOUND1CNT_H = 0x4000062; +ADDR SOUND1CNT_X = 0x4000064; +ADDR SOUND2CNT_L = 0x4000068; +ADDR SOUND2CNT_H = 0x400006C; +ADDR SOUND3CNT_L = 0x4000070; +ADDR SOUND3CNT_H = 0x4000072; +ADDR SOUND3CNT_X = 0x4000074; +ADDR SOUND4CNT_L = 0x4000078; +ADDR SOUND4CNT_H = 0x400007C; +ADDR SOUNDCNT_L = 0x4000080; +ADDR SOUNDCNT_H = 0x4000082; +ADDR SOUNDCNT_X = 0x4000084; +ADDR SOUNDBIAS = 0x4000088; +ADDR WAVE_RAM0_L = 0x4000090; +ADDR WAVE_RAM0_H = 0x4000092; +ADDR WAVE_RAM1_L = 0x4000094; +ADDR WAVE_RAM1_H = 0x4000096; +ADDR WAVE_RAM2_L = 0x4000098; +ADDR WAVE_RAM2_H = 0x400009A; +ADDR WAVE_RAM3_L = 0x400009C; +ADDR WAVE_RAM3_H = 0x400009E; +ADDR FIFO_A_L = 0x40000A0; +ADDR FIFO_A_H = 0x40000A2; +ADDR FIFO_B_L = 0x40000A4; +ADDR FIFO_B_H = 0x40000A6; + +// system +ADDR POSTFLG = 0x4000300; +ADDR IME = 0x4000208; +ADDR IE = 0x4000200; +ADDR IF = 0x4000202; +ADDR WAITCNT = 0x4000204; +ADDR HALTCNT = 0x4000301; + +#undef ADDR + +uint8_t +IoDevices::read_byte(uint32_t address) const { + uint16_t halfword = read_halfword(address & ~1); + + if (address & 1) + halfword >>= 8; + + return halfword & 0xFF; +} + +void +IoDevices::write_byte(uint32_t address, uint8_t byte) { + uint16_t halfword = read_halfword(address & ~1); + + if (address & 1) + write_halfword(address & ~1, + (static_cast(byte) << 8) | (halfword & 0xFF)); + else + write_halfword(address & ~1, + (static_cast(byte) | (halfword & 0xFF00))); +} + +uint32_t +IoDevices::read_word(uint32_t address) const { + return read_halfword(address) | read_halfword(address + 2) << 16; +} + +void +IoDevices::write_word(uint32_t address, uint32_t word) { + write_halfword(address, word & 0xFFFF); + write_halfword(address + 2, (word >> 16) & 0xFFFF); +} + +uint16_t +IoDevices::read_halfword(uint32_t address) const { + switch (address) { + +#define READ(name, var) \ + case name: \ + return var; + + // lcd + READ(DISPCNT, lcd.lcd_control) + READ(DISPSTAT, lcd.general_lcd_status) + READ(VCOUNT, lcd.vertical_counter) + READ(WININ, lcd.inside_win_0_1) + READ(WINOUT, lcd.outside_win) + READ(BLDCNT, lcd.color_special_effects_selection) + READ(BLDALPHA, lcd.alpha_blending_coefficients) + + // sound + READ(SOUND1CNT_L, sound.ch1_sweep) + READ(SOUND1CNT_H, sound.ch1_duty_length_env) + READ(SOUND1CNT_X, sound.ch1_freq_control) + READ(SOUND2CNT_L, sound.ch2_duty_length_env) + READ(SOUND2CNT_H, sound.ch2_freq_control) + READ(SOUND3CNT_L, sound.ch3_stop_wave_ram_select) + READ(SOUND3CNT_H, sound.ch3_length_volume) + READ(SOUND3CNT_X, sound.ch3_freq_control) + READ(WAVE_RAM0_L, sound.ch3_wave_pattern[0]); + READ(WAVE_RAM0_H, sound.ch3_wave_pattern[1]); + READ(WAVE_RAM1_L, sound.ch3_wave_pattern[2]); + READ(WAVE_RAM1_H, sound.ch3_wave_pattern[3]); + READ(WAVE_RAM2_L, sound.ch3_wave_pattern[4]); + READ(WAVE_RAM2_H, sound.ch3_wave_pattern[5]); + READ(WAVE_RAM3_L, sound.ch3_wave_pattern[6]); + READ(WAVE_RAM3_H, sound.ch3_wave_pattern[7]); + READ(SOUND4CNT_L, sound.ch4_length_env); + READ(SOUND4CNT_H, sound.ch4_freq_control); + READ(SOUNDCNT_L, sound.ctrl_stereo_volume); + READ(SOUNDCNT_H, sound.ctrl_mixing); + READ(SOUNDCNT_X, sound.ctrl_sound_on_off); + READ(SOUNDBIAS, sound.pwm_control); + + // system + READ(POSTFLG, system.post_boot_flag) + READ(IME, system.interrupt_master_enabler) + READ(IE, system.interrupt_enable); + READ(IF, system.interrupt_request_flags); + READ(WAITCNT, system.waitstate_control); + +#undef READ + + default: + glogger.warn("Unused IO address read at 0x{:08X}", address); + } + + return 0xFF; +} + +void +IoDevices::write_halfword(uint32_t address, uint16_t halfword) { + switch (address) { + +#define WRITE(name, var) \ + case name: \ + var = halfword; \ + break; + +#define WRITE_2(name, var, val) \ + case name: \ + var = val; \ + break; + + // lcd + WRITE(DISPCNT, lcd.lcd_control) + WRITE(DISPSTAT, lcd.general_lcd_status) + WRITE(BG0CNT, lcd.bg0_control) + WRITE(BG1CNT, lcd.bg1_control) + WRITE(BG2CNT, lcd.bg2_control) + WRITE(BG3CNT, lcd.bg3_control) + WRITE(BG0HOFS, lcd.bg0_x_offset) + WRITE(BG0VOFS, lcd.bg0_y_offset) + WRITE(BG1HOFS, lcd.bg1_x_offset) + WRITE(BG1VOFS, lcd.bg1_y_offset) + WRITE(BG2HOFS, lcd.bg2_x_offset) + WRITE(BG2VOFS, lcd.bg2_y_offset) + WRITE(BG3HOFS, lcd.bg3_x_offset) + WRITE(BG3VOFS, lcd.bg3_y_offset) + WRITE(BG2PA, lcd.bg2_rot_scaling_parameters[0]) + WRITE(BG2PB, lcd.bg2_rot_scaling_parameters[1]) + WRITE(BG2PC, lcd.bg2_rot_scaling_parameters[2]) + WRITE(BG2PD, lcd.bg2_rot_scaling_parameters[3]) + WRITE(BG2X_L, lcd.bg2_reference_x[0]) + WRITE(BG2X_H, lcd.bg2_reference_x[1]) + WRITE(BG2Y_L, lcd.bg2_reference_y[0]) + WRITE(BG2Y_H, lcd.bg2_reference_y[1]) + WRITE(BG3PA, lcd.bg3_rot_scaling_parameters[0]) + WRITE(BG3PB, lcd.bg3_rot_scaling_parameters[1]) + WRITE(BG3PC, lcd.bg3_rot_scaling_parameters[2]) + WRITE(BG3PD, lcd.bg3_rot_scaling_parameters[3]) + WRITE(BG3X_L, lcd.bg3_reference_x[0]) + WRITE(BG3X_H, lcd.bg3_reference_x[1]) + WRITE(BG3Y_L, lcd.bg3_reference_y[0]) + WRITE(BG3Y_H, lcd.bg3_reference_y[1]) + WRITE(WIN0H, lcd.win0_horizontal_dimensions) + WRITE(WIN1H, lcd.win1_horizontal_dimensions) + WRITE(WIN0V, lcd.win0_vertical_dimensions) + WRITE(WIN1V, lcd.win1_vertical_dimensions) + WRITE(WININ, lcd.inside_win_0_1) + WRITE(WINOUT, lcd.outside_win) + WRITE(MOSAIC, lcd.mosaic_size) + WRITE(BLDCNT, lcd.color_special_effects_selection) + WRITE(BLDALPHA, lcd.alpha_blending_coefficients) + WRITE(BLDY, lcd.brightness_coefficient) + + // sound + WRITE(SOUND1CNT_L, sound.ch1_sweep) + WRITE(SOUND1CNT_H, sound.ch1_duty_length_env) + WRITE(SOUND1CNT_X, sound.ch1_freq_control) + WRITE(SOUND2CNT_L, sound.ch2_duty_length_env) + WRITE(SOUND2CNT_H, sound.ch2_freq_control) + WRITE(SOUND3CNT_L, sound.ch3_stop_wave_ram_select) + WRITE(SOUND3CNT_H, sound.ch3_length_volume) + WRITE(SOUND3CNT_X, sound.ch3_freq_control) + WRITE(WAVE_RAM0_L, sound.ch3_wave_pattern[0]); + WRITE(WAVE_RAM0_H, sound.ch3_wave_pattern[1]); + WRITE(WAVE_RAM1_L, sound.ch3_wave_pattern[2]); + WRITE(WAVE_RAM1_H, sound.ch3_wave_pattern[3]); + WRITE(WAVE_RAM2_L, sound.ch3_wave_pattern[4]); + WRITE(WAVE_RAM2_H, sound.ch3_wave_pattern[5]); + WRITE(WAVE_RAM3_L, sound.ch3_wave_pattern[6]); + WRITE(WAVE_RAM3_H, sound.ch3_wave_pattern[7]); + WRITE(SOUND4CNT_L, sound.ch4_length_env); + WRITE(SOUND4CNT_H, sound.ch4_freq_control); + WRITE(SOUNDCNT_L, sound.ctrl_stereo_volume); + WRITE(SOUNDCNT_H, sound.ctrl_mixing); + WRITE(SOUNDCNT_X, sound.ctrl_sound_on_off); + WRITE(SOUNDBIAS, sound.pwm_control); + WRITE(FIFO_A_L, sound.fifo_a[0]); + WRITE(FIFO_A_H, sound.fifo_a[1]); + WRITE(FIFO_B_L, sound.fifo_b[0]); + WRITE(FIFO_B_H, sound.fifo_b[1]); + + // system + WRITE_2(POSTFLG, system.post_boot_flag, halfword & 1) + WRITE_2(IME, system.interrupt_master_enabler, halfword & 1) + WRITE(IE, system.interrupt_enable); + WRITE(IF, system.interrupt_request_flags); + WRITE(WAITCNT, system.waitstate_control); + WRITE_2(HALTCNT, system.low_power_mode, get_bit(halfword, 7)); + +#undef WRITE +#undef WRITE_2 + + default: + glogger.warn("Unused IO address written at 0x{:08X}", address); + } + return; +} +} diff --git a/src/io/meson.build b/src/io/meson.build new file mode 100644 index 0000000..7b86144 --- /dev/null +++ b/src/io/meson.build @@ -0,0 +1,3 @@ +lib_sources += files( + 'io.cc', +) \ No newline at end of file diff --git a/src/memory.cc b/src/memory.cc index 0d57ca6..668c180 100644 --- a/src/memory.cc +++ b/src/memory.cc @@ -41,10 +41,6 @@ Memory::read(uint32_t address) const { MATCHES(BIOS, bios) MATCHES(BOARD_WRAM, board_wram) MATCHES(CHIP_WRAM, chip_wram) - - if (address >= 0x04000000 && address <= 0x040003FE) - return io.read(address); - MATCHES(PALETTE_RAM, palette_ram) MATCHES(VRAM, vram) MATCHES(OAM_OBJ_ATTR, oam_obj_attr) @@ -68,12 +64,6 @@ Memory::write(uint32_t address, uint8_t byte) { MATCHES(BOARD_WRAM, board_wram) MATCHES(CHIP_WRAM, chip_wram) - - if (address >= 0x04000000 && address <= 0x040003FE) { - io.write(address, byte); - return; - } - MATCHES(PALETTE_RAM, palette_ram) MATCHES(VRAM, vram) MATCHES(OAM_OBJ_ATTR, oam_obj_attr) diff --git a/src/meson.build b/src/meson.build index 8dfdd6f..e6fc911 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,11 +1,11 @@ lib_sources = files( 'memory.cc', 'bus.cc', - 'io.cc' ) subdir('util') subdir('cpu') +subdir('io') lib_cpp_args = [] diff --git a/src/util/log.hh b/src/util/log.hh index 1666cfe..98ebb17 100644 --- a/src/util/log.hh +++ b/src/util/log.hh @@ -19,7 +19,7 @@ class Logger { using LogLevel = matar::LogLevel; public: - Logger(LogLevel level = LogLevel::Debug, FILE* stream = stderr) + Logger(LogLevel level = LogLevel::Debug, FILE* stream = stdout) : level(0) , stream(stream) { set_level(level);