This project is read-only.

The Read and Find classes are used - as their names imply - to read or find information from the ROM.
Both classes are initialized with a "filename" parameter.


- Responsible for ALL data read from a ROM.

Function Effect
byte ReadByte(int Offset) Reads a single byte from the ROM
byte[] ReadBytes(int Offset, int Length) Reads an array of bytes from the ROM
string ReadString(int Offset, int Length) Reads a string from the ROM
byte[] ReadLz77Bytes(int Offset, out int DataLength) Decompresses stored Lz77 compressed data from the ROM and returns the compressed data's length


- Handles searching for and replacing data
  • free space is space in the ROM entirely composed of the 0xFF byte.
  • A safe offset is one that is a multiple of four. ie: hex values ending in 0, 4, 8 or C
  • Find will return -1 for any instance where a true value/match is NOT found
Function Effect
int FindFreeSpace(int StartOffset, int Size, bool Safe = true) Finds the first instance of free space in the ROM from any given offset. Safe only returns safe offsets
int FindBytes(byte[] Bytes, byte[] SearchBytes, int Offset = 0) Finds the first instance of SearchBytes in Bytes beginning at Offset
int FindSafeBytes(byte[] Bytes, byte[] SearchBytes, int Offset = 0) Same as FindBytes() but only returns safe offsets
void SearchAndReplace(byte[] Search, byte[] Replace) Replaces every instance of Search with Replace in the ROM
void SearchAndReplace(byte[] Search, byte[] Replace, out List<int> Pointers) Replaces every instance of Search with Replace in the ROM and returns a list of pointers to the changed data(s)
List<int> Search(byte[] Search) Returns a list of pointers to all instances of Search in the ROM

* Important Note: Changing the public FilePath object of any initialized Read or Find object will NOT reset the internal reader. These classes must be re-created to change the FilePath

Last edited Jun 7, 2012 at 8:43 PM by lastlinkx, version 6


No comments yet.