NesContainers
Public Types | Public Member Functions | Static Public Member Functions | Properties
com.clusterrr.Famicom.Containers.UnifFile Class Reference

UNIF file container for NES/Famicom games More...

Inherits IEnumerable< KeyValuePair< string, byte[]>>.

Public Types

enum class  Controller {
  None = 0 , StandardController = 1 , Zapper = 2 , ROB = 4 ,
  ArkanoidController = 8 , PowerPad = 16 , FourScore = 32
}
 Default game controller(s) More...
 

Public Member Functions

bool ContainsField (string fieldName)
 Returns true if field exists in the UNIF More...
 
void RemoveField (string fieldName)
 Remove field from the UNIF More...
 
IEnumerator< KeyValuePair< string, byte[]> > GetEnumerator ()
 Returns enumerator that iterates throught fields More...
 
 UnifFile ()
 Constructor to create empty UnifFile object More...
 
 UnifFile (byte[] data)
 Create UnifFile object from raw .unf file contents More...
 
 UnifFile (string fileName)
 Create UnifFile object from specified file More...
 
byte[] ToBytes ()
 Returns .unf file contents More...
 
void Save (string filename)
 Save as .unf file More...
 
void CalculateAndStoreCRCs ()
 Calculate CRC32 for PRG and CHR fields and store it into PCKx and CCKx fields More...
 
byte[] CalculateMD5 ()
 Calculate MD5 checksum of ROM (all PRG fields + all CHR fields) More...
 
uint CalculateCRC32 ()
 Calculate CRC32 checksum of ROM (all PRG fields + all CHR fields) More...
 

Static Public Member Functions

static UnifFile FromBytes (byte[] data)
 Create UnifFile object from raw .unf file contents More...
 
static UnifFile FromFile (string filename)
 Create UnifFile object from specified file More...
 

Properties

uint Version = 5 [get, set]
 UNIF version More...
 
byte[] this[string key] [get, set]
 Get/set UNIF field More...
 
string?? Mapper [get, set]
 Mapper name (null if none) More...
 
string? DumperName [get, set]
 The dumper name (null if none) More...
 
string? DumpingSoftware [get, set]
 The name of the dumping software or mechanism (null if none) More...
 
DateTime? DumpDate [get, set]
 Date of the dump (null if none) More...
 
string?? GameName [get, set]
 Name of the game (null if none) More...
 
TimingRegion [get, set]
 For non-homebrew NES/Famicom games, this field's value is always a function of the region in which a game was released (null if none) More...
 
ControllerControllers [get, set]
 Controllers usable by this game, bitmask (null if none) More...
 
bool?? Battery [get, set]
 Battery-backed (or other non-volatile memory) memory is present (null if none) More...
 
MirroringTypeMirroring [get, set]
 Mirroring type (null if none) More...
 
byte?[] PRG0 [get, set]
 PRG0 field (null if none) More...
 
byte?[] PRG1 [get, set]
 PRG1 field (null if none) More...
 
byte?[] PRG2 [get, set]
 PRG2 field (null if none) More...
 
byte?[] PRG3 [get, set]
 PRG3 field (null if none) More...
 
byte?[] CHR0 [get, set]
 CHR0 field (null if none) More...
 
byte?[] CHR1 [get, set]
 CHR1 field (null if none) More...
 
byte?[] CHR2 [get, set]
 CHR2 field (null if none) More...
 
byte?[] CHR3 [get, set]
 CHR3 field (null if none) More...
 

Detailed Description

UNIF file container for NES/Famicom games

Member Enumeration Documentation

◆ Controller

Default game controller(s)

Enumerator
None 

None

StandardController 

Standatd Controller

Zapper 

Zapper

ROB 

R.O.B.

ArkanoidController 

Arkanoid Controller

PowerPad 

Power Pad

FourScore 

Four Score

Constructor & Destructor Documentation

◆ UnifFile() [1/3]

com.clusterrr.Famicom.Containers.UnifFile.UnifFile ( )
inline

Constructor to create empty UnifFile object

◆ UnifFile() [2/3]

com.clusterrr.Famicom.Containers.UnifFile.UnifFile ( byte[]  data)
inline

Create UnifFile object from raw .unf file contents

Parameters
dataRaw UNIF data

◆ UnifFile() [3/3]

com.clusterrr.Famicom.Containers.UnifFile.UnifFile ( string  fileName)
inline

Create UnifFile object from specified file

Parameters
fileNamePath to the .unf file

Member Function Documentation

◆ ContainsField()

bool com.clusterrr.Famicom.Containers.UnifFile.ContainsField ( string  fieldName)

Returns true if field exists in the UNIF

Parameters
fieldNameField code
Returns
True if field exists in the UNIF
Here is the caller graph for this function:

◆ RemoveField()

void com.clusterrr.Famicom.Containers.UnifFile.RemoveField ( string  fieldName)

Remove field from the UNIF

Parameters
fieldName

◆ GetEnumerator()

IEnumerator<KeyValuePair<string, byte[]> > com.clusterrr.Famicom.Containers.UnifFile.GetEnumerator ( )

Returns enumerator that iterates throught fields

Returns
IEnumerable object

◆ FromBytes()

static UnifFile com.clusterrr.Famicom.Containers.UnifFile.FromBytes ( byte[]  data)
static

Create UnifFile object from raw .unf file contents

Parameters
data
Returns
UnifFile object

◆ FromFile()

static UnifFile com.clusterrr.Famicom.Containers.UnifFile.FromFile ( string  filename)
static

Create UnifFile object from specified file

Parameters
filenamePath to the .unf file
Returns
UnifFile object

◆ ToBytes()

byte [] com.clusterrr.Famicom.Containers.UnifFile.ToBytes ( )
inline

Returns .unf file contents

Returns
Here is the call graph for this function:

◆ Save()

void com.clusterrr.Famicom.Containers.UnifFile.Save ( string  filename)

Save as .unf file

Parameters
filenameTarget filename

◆ CalculateAndStoreCRCs()

void com.clusterrr.Famicom.Containers.UnifFile.CalculateAndStoreCRCs ( )
inline

Calculate CRC32 for PRG and CHR fields and store it into PCKx and CCKx fields

◆ CalculateMD5()

byte [] com.clusterrr.Famicom.Containers.UnifFile.CalculateMD5 ( )
inline

Calculate MD5 checksum of ROM (all PRG fields + all CHR fields)

Returns
MD5 checksum for all PRG and CHR data

◆ CalculateCRC32()

uint com.clusterrr.Famicom.Containers.UnifFile.CalculateCRC32 ( )
inline

Calculate CRC32 checksum of ROM (all PRG fields + all CHR fields)

Returns
CRC32 checksum for all PRG and CHR data

Property Documentation

◆ Version

uint com.clusterrr.Famicom.Containers.UnifFile.Version = 5
getset

UNIF version

◆ this[string key]

byte [] com.clusterrr.Famicom.Containers.UnifFile.this[string key]
getset

Get/set UNIF field

Parameters
keyUNIF data block key
Returns

◆ Mapper

string?? com.clusterrr.Famicom.Containers.UnifFile.Mapper
getset

Mapper name (null if none)

◆ DumperName

string? com.clusterrr.Famicom.Containers.UnifFile.DumperName
getset

The dumper name (null if none)

◆ DumpingSoftware

string? com.clusterrr.Famicom.Containers.UnifFile.DumpingSoftware
getset

The name of the dumping software or mechanism (null if none)

◆ DumpDate

DateTime? com.clusterrr.Famicom.Containers.UnifFile.DumpDate
getset

Date of the dump (null if none)

◆ GameName

string?? com.clusterrr.Famicom.Containers.UnifFile.GameName
getset

Name of the game (null if none)

◆ Region

Timing? com.clusterrr.Famicom.Containers.UnifFile.Region
getset

For non-homebrew NES/Famicom games, this field's value is always a function of the region in which a game was released (null if none)

◆ Controllers

Controller? com.clusterrr.Famicom.Containers.UnifFile.Controllers
getset

Controllers usable by this game, bitmask (null if none)

◆ Battery

bool?? com.clusterrr.Famicom.Containers.UnifFile.Battery
getset

Battery-backed (or other non-volatile memory) memory is present (null if none)

◆ Mirroring

MirroringType? com.clusterrr.Famicom.Containers.UnifFile.Mirroring
getset

Mirroring type (null if none)

◆ PRG0

byte? [] com.clusterrr.Famicom.Containers.UnifFile.PRG0
getset

PRG0 field (null if none)

◆ PRG1

byte? [] com.clusterrr.Famicom.Containers.UnifFile.PRG1
getset

PRG1 field (null if none)

◆ PRG2

byte? [] com.clusterrr.Famicom.Containers.UnifFile.PRG2
getset

PRG2 field (null if none)

◆ PRG3

byte? [] com.clusterrr.Famicom.Containers.UnifFile.PRG3
getset

PRG3 field (null if none)

◆ CHR0

byte? [] com.clusterrr.Famicom.Containers.UnifFile.CHR0
getset

CHR0 field (null if none)

◆ CHR1

byte? [] com.clusterrr.Famicom.Containers.UnifFile.CHR1
getset

CHR1 field (null if none)

◆ CHR2

byte? [] com.clusterrr.Famicom.Containers.UnifFile.CHR2
getset

CHR2 field (null if none)

◆ CHR3

byte? [] com.clusterrr.Famicom.Containers.UnifFile.CHR3
getset

CHR3 field (null if none)