diff --git a/enemize/src/rom.rs b/enemize/src/rom.rs index fe22d41..b4e8700 100644 --- a/enemize/src/rom.rs +++ b/enemize/src/rom.rs @@ -1,6 +1,6 @@ use std::collections::BTreeMap; use std::iter; -use std::ops::Range; +use std::ops::{Index, IndexMut, Range}; use anyhow::bail; @@ -245,11 +245,6 @@ impl RomData { self.set_patch_bytes(flag_idx..(flag_idx + 1)); } - pub fn patch_bytes(&mut self, address: usize, patch_data: Vec) { - self.rom_data - .splice(address..(address + patch_data.len()), patch_data); - } - pub fn patch_data(&mut self, patch: &Patch) { self.set_rom_bytes( &patch.patch_data, @@ -296,3 +291,17 @@ impl RomData { } } } + +impl Index for RomData { + type Output = u8; + + fn index(&self, index: usize) -> &u8 { + &self.rom_data[index] + } +} + +impl IndexMut for RomData { + fn index_mut(&mut self, index: usize) -> &mut u8 { + &mut self.rom_data[index] + } +}