C# Class SharpTune.RomMod.Mod

Defines and Applies a Mod (series of patches) to a ROM.
ファイルを表示 Open project: Merp/SharpTune Class Usage Examples

Public Properties

Property Type Description
ReleaseBuildWarning string
TestBuildWarning string
patchList List
unPatchList List

Public Methods

Method Description
Mod ( Stream s, string modPath ) : System

Constructor for embedded mods

Mod ( string modPath ) : System

Constructor for external mods

Mod ( string modPath, string build ) : System

Constructor for partial-patches

PrintPatches ( ) : void

Print patch descriptions to the console.

TryApplyMod ( Stream romStream ) : bool

Try to apply the patches to the ROM.

TryCheckApplyMod ( string romPath, string outPath, bool apply, bool commit ) : bool
TryDefinition ( AvailableDevices ad, string defPath ) : bool
TryGetMetaBlob ( uint startAddress, uint length, Blob &match, List blobs ) : bool

Try to find a blob in the patch that starts at the given address.

TryPrintBaselines ( string patchPath, Stream romStream ) : bool

Extract actual ROM data, for appending to a patch file.

TryReadMetaString ( Blob metadata, string &metaString, int &offset ) : bool

Read a single string from the metadata blob.

Consider returning false, printing error message. But, need to be certain to abort the whole process at that point...

TryReadPatches ( ) : bool

Create the patch start/end metadata from the patch file.

TryRemoveMod ( Stream romStream ) : bool

Try to remove patches from a ROM

TryReversePatches ( ) : bool

Reverses the "direction" of the patch by start address manipulation

TryValidatePatches ( Stream romStream ) : bool

Determine whether the data that the patch was designed to overwrite match what's actually in the ROM.

TryValidateUnPatches ( Stream romStream ) : bool

Determine whether the data that the patch was designed to overwrite match what's actually in the ROM.

Private Methods

Method Description
TryApplyPatch ( Patch patch, Stream romStream ) : bool

Given a patch, look up the content Blob and write it into the ROM.

TryCheckPrintBaseline ( Patch patch, Stream outStream ) : bool

Print the current contents of the ROM in the address range for the given patch. Contains a check against metadata when IsMetaChecked = true

TryConfirmPatchVersion ( Blob blob, int &offset ) : bool

Try to read the 'required version' metadata.

TryGetPatchBlob ( uint startAddress, uint length, Blob &match, List blobs ) : bool

Try to find a blob that starts at the given address.

TryReadBlobs ( BlobList &blist ) : bool

Try to read blobs from the patch file.

TryReadBuffer ( Stream romStream, uint startAddress, byte buffer ) : bool

Try to read an arbitrary byte range from the ROM.

TryReadCalibrationChange ( Blob blob, int &offset ) : bool

Try to read the initial and final calibration IDs

TryReadCalibrationId ( Blob blob, int &offset, string &calibrationId ) : bool

Try to read the calibration ID from the patch metadata.

TryReadCopyPatch ( Blob metadata, Patch &patch, int &offset, List blobs ) : bool

Read a single Offset Patch from the metadata blob. Offset patch reads from Srecord "copystart" Writes to rom at "start"

Consider returning false, printing error message. But, need to be certain to abort the whole process at that point...

TryReadMetaHeader8 ( Blob metadata, int &offset ) : bool
TryReadMetadata ( Blob blob, List blobs ) : bool

Try to read the patch file metadata (start and end addresses of each patch, etc).

TryReadPatch ( Blob metadata, Patch &patch, int &offset, List blobs ) : bool

Read a single Patch from the metadata blob.

Consider returning false, printing error message. But, need to be certain to abort the whole process at that point...

TryReadPatches ( Blob metadata, int &offset, List blobs ) : bool

Try to read the Patch metadata from the file.

TrySynthesize4BytePatch ( Blob metadata, Patch &patch, int &offset ) : bool

Construct a 4-byte patch from the metadata blob.

TrySynthesizeLast2Of4BytePatch ( Blob metadata, Patch &patch, int &offset ) : bool

Construct a Last 2 of 4-byte patch from the metadata blob.

TrySynthesizePullJsrHookPatch ( Blob metadata, Patch &patch, int &offset, List blobs ) : bool

Construct a Pull JSR HOOK patch from the metadata blob.

ValidateBytes ( Patch patch, Stream romStream ) : bool

Determine whether the bytes from a Patch's expected data match the contents of the ROM.

ValidateJSRHookBytes ( PullJSRHookPatch patch, Stream romStream ) : bool

Determine whether the bytes from a Patch's expected data match the contents of the ROM.

Method Details

Mod() public method

Constructor for embedded mods
public Mod ( Stream s, string modPath ) : System
s Stream
modPath string
return System

Mod() public method

Constructor for external mods
public Mod ( string modPath ) : System
modPath string
return System

Mod() public method

Constructor for partial-patches
public Mod ( string modPath, string build ) : System
modPath string
build string
return System

PrintPatches() public method

Print patch descriptions to the console.
public PrintPatches ( ) : void
return void

TryApplyMod() public method

Try to apply the patches to the ROM.
public TryApplyMod ( Stream romStream ) : bool
romStream Stream
return bool

TryCheckApplyMod() public method

public TryCheckApplyMod ( string romPath, string outPath, bool apply, bool commit ) : bool
romPath string
outPath string
apply bool
commit bool
return bool

TryDefinition() public method

public TryDefinition ( AvailableDevices ad, string defPath ) : bool
ad AvailableDevices
defPath string
return bool

TryGetMetaBlob() public method

Try to find a blob in the patch that starts at the given address.
public TryGetMetaBlob ( uint startAddress, uint length, Blob &match, List blobs ) : bool
startAddress uint
length uint
match Blob
blobs List
return bool

TryPrintBaselines() public method

Extract actual ROM data, for appending to a patch file.
public TryPrintBaselines ( string patchPath, Stream romStream ) : bool
patchPath string
romStream Stream
return bool

TryReadMetaString() public method

Read a single string from the metadata blob.
Consider returning false, printing error message. But, need to be certain to abort the whole process at that point...
public TryReadMetaString ( Blob metadata, string &metaString, int &offset ) : bool
metadata Blob
metaString string
offset int
return bool

TryReadPatches() public method

Create the patch start/end metadata from the patch file.
public TryReadPatches ( ) : bool
return bool

TryRemoveMod() public method

Try to remove patches from a ROM
public TryRemoveMod ( Stream romStream ) : bool
romStream Stream
return bool

TryReversePatches() public method

Reverses the "direction" of the patch by start address manipulation
public TryReversePatches ( ) : bool
return bool

TryValidatePatches() public method

Determine whether the data that the patch was designed to overwrite match what's actually in the ROM.
public TryValidatePatches ( Stream romStream ) : bool
romStream Stream
return bool

TryValidateUnPatches() public method

Determine whether the data that the patch was designed to overwrite match what's actually in the ROM.
public TryValidateUnPatches ( Stream romStream ) : bool
romStream Stream
return bool

Property Details

ReleaseBuildWarning public_oe property

public string ReleaseBuildWarning
return string

TestBuildWarning public_oe property

public string TestBuildWarning
return string

patchList public_oe property

public List patchList
return List

unPatchList public_oe property

public List unPatchList
return List