Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Properties

Romulus.Nes.Rom Class Reference

Represents a headered ROM. Contains the ROM image and provides utility methods for dealing with the ROM. More...

List of all members.

Public Member Functions

 Rom (Stream s, int size)
 Creates a Rom object from a stream, with a specicified size.
 Rom (Stream s)
 Creates a Rom object from a stream.
 Rom (string filePath)
 Loads a ROM from a file.
void BeforeSave ()
 Call this method to before saving the ROM. This method commits changes (as if CommitChanges were called), and derived classes may do additional work before saving.
virtual void CommitChanges ()
 Instructs the Rom object to commit any edits to the ROM image. Call this method when an up-to-date ROM image is necessary.
pCpu GetPtr (pHRom offset)
 Gets a pointer from the ROM image.
void SetPtr (pCpu value, pHRom offset)
 Writes a pointer to the ROM image.
pCpu GetTablePtr (pHRom TableOffset, int index)
 Gets a pointer from a pointer table. (Consider using the PointerTable class for frequent access to a pointer table.).
void SetTablePtr (pCpu value, pHRom tableOffset, int index)
 Writes a pointer to a pointer table.
SinglePalette GetSinglePalette (pHRom offset)
 Returns a SinglePalette that references palette data in the ROM image.
CompositePalette GetCompositePalette (pHRom offset)
 Returns a CompositePalette that references palette data in the ROM image.
MD5Hash GetMD5 ()
 Gets an MD5 hash of the ROM data.

Static Public Member Functions

static implicit operator byte[] (Rom rom)
 Defines an implicit conversion from Rom to byte[]. This is a convenience for calling functions tha expect a ROM image as a byte array.

Public Attributes

byte[] data
 Gets the raw byte buffer of the ROM image.

Protected Member Functions

virtual void OnBeforeSave ()
 Override to perform any necessary tasks or serialize any non-rom-image-backed data objects before the ROM is saved.

Properties

virtual int MinimumRomSize [get]
 Returns the minimum size this type of ROM should be. (Override to specify in a derived class.).
MD5Hash UnmodifiedHash [get, set]
 Gets the MD5 hash of the ROM in its unmodified state.
bool IsModified [get]
 Returns true if the ROM has been modified. In derived classes it may be necessary to call CommitChanges first so that any modified ROM data is written to the ROM image in memory.
byte this [int offset] [get, set]
 Gets a byte from the ROM image at the specified offset.

Detailed Description

Represents a headered ROM. Contains the ROM image and provides utility methods for dealing with the ROM.


Constructor & Destructor Documentation

Romulus.Nes.Rom.Rom ( Stream  s,
int  size 
)

Creates a Rom object from a stream, with a specicified size.

Parameters:
s The stream to load from.
size The size of the ROM image to load from the stream.
Romulus.Nes.Rom.Rom ( Stream  s  ) 

Creates a Rom object from a stream.

Parameters:
s The stream to load from. The stream must support the Length and Position properties.
Romulus.Nes.Rom.Rom ( string  filePath  ) 

Loads a ROM from a file.

Parameters:
filePath The path of the file to load.

Member Function Documentation

void Romulus.Nes.Rom.BeforeSave (  ) 

Call this method to before saving the ROM. This method commits changes (as if CommitChanges were called), and derived classes may do additional work before saving.

virtual void Romulus.Nes.Rom.CommitChanges (  )  [virtual]

Instructs the Rom object to commit any edits to the ROM image. Call this method when an up-to-date ROM image is necessary.

CompositePalette Romulus.Nes.Rom.GetCompositePalette ( pHRom  offset  ) 

Returns a CompositePalette that references palette data in the ROM image.

Parameters:
offset The offset of the palette.
Returns:
A CompositePalette object that references ROM data.
MD5Hash Romulus.Nes.Rom.GetMD5 (  ) 

Gets an MD5 hash of the ROM data.

Returns:
pCpu Romulus.Nes.Rom.GetPtr ( pHRom  offset  ) 

Gets a pointer from the ROM image.

Parameters:
offset The offset of the pointer.
Returns:
A pointer.
SinglePalette Romulus.Nes.Rom.GetSinglePalette ( pHRom  offset  ) 

Returns a SinglePalette that references palette data in the ROM image.

Parameters:
offset The offset of the palette.
Returns:
A SinglePalette object that references ROM data.
pCpu Romulus.Nes.Rom.GetTablePtr ( pHRom  TableOffset,
int  index 
)

Gets a pointer from a pointer table. (Consider using the PointerTable class for frequent access to a pointer table.).

Parameters:
TableOffset The offset of the pointer.
index The index of the pointer.
Returns:
A pointer from the pointer table.
virtual void Romulus.Nes.Rom.OnBeforeSave (  )  [protected, virtual]

Override to perform any necessary tasks or serialize any non-rom-image-backed data objects before the ROM is saved.

static implicit Romulus.Nes.Rom.operator byte[] ( Rom  rom  )  [static]

Defines an implicit conversion from Rom to byte[]. This is a convenience for calling functions tha expect a ROM image as a byte array.

Parameters:
rom The rom to get byte data for.
Returns:
A byte array containing the ROM image.
void Romulus.Nes.Rom.SetPtr ( pCpu  value,
pHRom  offset 
)

Writes a pointer to the ROM image.

Parameters:
value The pointer to write.
offset The location to write the pointer.
void Romulus.Nes.Rom.SetTablePtr ( pCpu  value,
pHRom  tableOffset,
int  index 
)

Writes a pointer to a pointer table.

Parameters:
value The pointer to write.
tableOffset The location of the pointer table.
index The index of the pointer.

Member Data Documentation

Gets the raw byte buffer of the ROM image.


Property Documentation

bool Romulus.Nes.Rom.IsModified [get]

Returns true if the ROM has been modified. In derived classes it may be necessary to call CommitChanges first so that any modified ROM data is written to the ROM image in memory.

virtual int Romulus.Nes.Rom.MinimumRomSize [get]

Returns the minimum size this type of ROM should be. (Override to specify in a derived class.).

byte Romulus::Nes.Rom::this [get, set]

Gets a byte from the ROM image at the specified offset.

Parameters:
offset The offset of the data to get.
Returns:
The data at the specified offset.
MD5Hash Romulus.Nes.Rom.UnmodifiedHash [get, set]

Gets the MD5 hash of the ROM in its unmodified state.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events