Flesh out bgmap viewer
This commit is contained in:
+5
-2
@@ -70,9 +70,12 @@ pub struct MemoryRef<'a> {
|
||||
}
|
||||
|
||||
impl MemoryRef<'_> {
|
||||
pub fn read(&self, index: usize) -> u8 {
|
||||
self.inner[index]
|
||||
pub fn read<T: bytemuck::AnyBitPattern>(&self, index: usize) -> T {
|
||||
let from = index * size_of::<T>();
|
||||
let to = from + size_of::<T>();
|
||||
*bytemuck::from_bytes(&self.inner[from..to])
|
||||
}
|
||||
|
||||
pub fn range<T: bytemuck::AnyBitPattern>(&self, start: usize, count: usize) -> &[T] {
|
||||
let from = start * size_of::<T>();
|
||||
let to = from + (count * size_of::<T>());
|
||||
|
||||
Reference in New Issue
Block a user