mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
WIP: Try removing the hashmap
This commit is contained in:
parent
aa7823232b
commit
7b43debd3e
40
agb/Cargo.lock
generated
40
agb/Cargo.lock
generated
|
@ -24,8 +24,6 @@ dependencies = [
|
|||
"agb_sound_converter",
|
||||
"bare-metal",
|
||||
"bitflags",
|
||||
"hashbrown",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -67,17 +65,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -149,15 +136,6 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hound"
|
||||
version = "3.4.0"
|
||||
|
@ -235,12 +213,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.5"
|
||||
|
@ -307,12 +279,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.136"
|
||||
|
@ -359,12 +325,6 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
|
|
|
@ -21,13 +21,11 @@ freq18157 = ["agb_sound_converter/freq18157"]
|
|||
|
||||
[dependencies]
|
||||
bitflags = "1.3"
|
||||
hashbrown = "0.12.0"
|
||||
agb_image_converter = { version = "0.6.0", path = "../agb-image-converter" }
|
||||
agb_sound_converter = { version = "0.1.0", path = "../agb-sound-converter" }
|
||||
agb_macros = { version = "0.1.0", path = "../agb-macros" }
|
||||
agb_fixnum = { version = "0.1.0", path = "../agb-fixnum" }
|
||||
bare-metal = "1.0"
|
||||
rustc-hash = { version = "1.0", default-features = false }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
default-target = "thumbv6m-none-eabi"
|
||||
|
|
|
@ -10,12 +10,12 @@ const PALETTE_BACKGROUND: MemoryMapped1DArray<u16, 256> =
|
|||
unsafe { MemoryMapped1DArray::new(0x0500_0000) };
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
const unsafe fn debug_unreachable_unchecked() -> ! {
|
||||
unreachable!();
|
||||
unsafe fn debug_unreachable_unchecked(message: &'static str) -> ! {
|
||||
unreachable!(message);
|
||||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
const unsafe fn debug_unreachable_unchecked() -> ! {
|
||||
const unsafe fn debug_unreachable_unchecked(message: &'static str) -> ! {
|
||||
use core::hint::unreachable_unchecked;
|
||||
|
||||
unreachable_unchecked();
|
||||
|
@ -88,7 +88,7 @@ impl VRamState {
|
|||
if let VRamState::ReferenceCounted(count, _) = self {
|
||||
*count += 1;
|
||||
} else {
|
||||
unsafe { debug_unreachable_unchecked() };
|
||||
unsafe { debug_unreachable_unchecked("Cannot increase reference count of free item") };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ impl VRamState {
|
|||
*count -= 1;
|
||||
(*count, *tile_ref)
|
||||
} else {
|
||||
unsafe { debug_unreachable_unchecked() };
|
||||
unsafe { debug_unreachable_unchecked("Cannot decrease reference count of free item") };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ impl<'a> VRamManager<'a> {
|
|||
self.tilesets[ptr] = tileset;
|
||||
ptr
|
||||
}
|
||||
_ => unsafe { debug_unreachable_unchecked() },
|
||||
_ => unsafe { debug_unreachable_unchecked("Free pointer cannot point to data") },
|
||||
}
|
||||
} else {
|
||||
self.tilesets.push(tileset);
|
||||
|
@ -183,7 +183,7 @@ impl<'a> VRamManager<'a> {
|
|||
|
||||
self.free_pointer = Some(tile_set_ref.id as usize);
|
||||
}
|
||||
_ => unsafe { debug_unreachable_unchecked() },
|
||||
_ => panic!("Must remove valid tileset"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,9 @@ impl<'a> VRamManager<'a> {
|
|||
self.vram_free_pointer = Some(next_free as usize);
|
||||
}
|
||||
}
|
||||
VRamState::ReferenceCounted(_, _) => unsafe { debug_unreachable_unchecked() },
|
||||
VRamState::ReferenceCounted(_, _) => unsafe {
|
||||
debug_unreachable_unchecked("Free pointer must point to free item")
|
||||
},
|
||||
}
|
||||
|
||||
self.references[ptr] = VRamState::ReferenceCounted(1, tile_ref);
|
||||
|
@ -228,7 +230,7 @@ impl<'a> VRamManager<'a> {
|
|||
let tile_offset = (tile as usize) * data.format.tile_size() / 4;
|
||||
&data.tiles[tile_offset..(tile_offset + data.format.tile_size() / 4)]
|
||||
} else {
|
||||
unsafe { debug_unreachable_unchecked() };
|
||||
panic!("Tile set ref must point to existing tile set");
|
||||
};
|
||||
|
||||
let tile_size_in_half_words = TileFormat::FourBpp.tile_size() / 2;
|
||||
|
|
40
examples/the-hat-chooses-the-wizard/Cargo.lock
generated
40
examples/the-hat-chooses-the-wizard/Cargo.lock
generated
|
@ -24,8 +24,6 @@ dependencies = [
|
|||
"agb_sound_converter",
|
||||
"bare-metal",
|
||||
"bitflags",
|
||||
"hashbrown",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -67,17 +65,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -149,15 +136,6 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hound"
|
||||
version = "3.4.0"
|
||||
|
@ -241,12 +219,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.5"
|
||||
|
@ -313,12 +285,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
|
@ -391,12 +357,6 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
|
|
40
examples/the-purple-night/Cargo.lock
generated
40
examples/the-purple-night/Cargo.lock
generated
|
@ -24,8 +24,6 @@ dependencies = [
|
|||
"agb_sound_converter",
|
||||
"bare-metal",
|
||||
"bitflags",
|
||||
"hashbrown",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -67,17 +65,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -173,15 +160,6 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hound"
|
||||
version = "3.4.0"
|
||||
|
@ -271,12 +249,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.5"
|
||||
|
@ -349,12 +321,6 @@ version = "1.0.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.136"
|
||||
|
@ -428,12 +394,6 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
|
|
Loading…
Reference in a new issue