N64FlashcartMenu
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
rom_database.h File Reference

N64 ROM Database. More...

Go to the source code of this file.

Data Structures

struct  rom_config_flags_t
 ROM Config Flags Structure. More...
 
struct  rom_header_t
 ROM Header Structure. More...
 

Enumerations

enum  db_savetype_t {
  DB_SAVE_TYPE_NONE = 0x00 , DB_SAVE_TYPE_EEPROM_4K = 0x01 , DB_SAVE_TYPE_EEPROM_16K = 0x02 , DB_SAVE_TYPE_SRAM = 0x03 ,
  DB_SAVE_TYPE_SRAM_BANKED = 0x04 , DB_SAVE_TYPE_SRAM_128K = 0x05 , DB_SAVE_TYPE_FLASHRAM = 0x06 , DB_SAVE_TYPE_CPAK = 0x10 ,
  DB_SAVE_TYPE_DD = 0x20 , DB_SAVE_TYPE_DD_CONVERSION = 0x30 , DB_SAVE_TYPE_INVALID = 0xFF
}
 ROM database save type enumeration. More...
 
enum  rom_memorytype_t {
  DB_MEMORY_EXPANSION_NONE = 0x00 , DB_MEMORY_EXPANSION_REQUIRED = 0x01 , DB_MEMORY_EXPANSION_RECOMMENDED = 0x02 , DB_MEMORY_EXPANSION_SUGGESTED = 0x03 ,
  DB_MEMORY_EXPANSION_FAULTY = 0x04
}
 ROM system memory requirements enumeration. More...
 
enum  homebrew_savetype_t {
  HB_SAVE_TYPE_NONE = 0x00 , HB_SAVE_TYPE_EEPROM_4K = 0x01 , HB_SAVE_TYPE_EEPROM_16K = 0x02 , HB_SAVE_TYPE_SRAM = 0x03 ,
  HB_SAVE_TYPE_SRAM_BANKED = 0x04 , HB_SAVE_TYPE_FLASHRAM = 0x05 , HB_SAVE_TYPE_SRAM_128K = 0x06
}
 ROM homebrew save type enumeration. More...
 
enum  rom_endian_type_t {
  ROM_BIG_ENDIAN = 0x80371240 , ROM_LITTLE_ENDIAN = 0x40123780 , ROM_MID_BIG_ENDIAN = 0x37804012 , ROM_MID_LITTLE_ENDIAN = 0x12408037 ,
  IPL_BIG_ENDIAN = 0x80270740
}
 ROM file endian enumeration. More...
 
enum  rom_media_type_t {
  N64_CART = 'N' , N64_DISK = 'D' , N64_CART_EXPANDABLE = 'C' , N64_DISK_EXPANDABLE = 'E' ,
  N64_ALECK64 = 'Z'
}
 ROM media type enumeration. More...
 
enum  rom_destination_market_t {
  MARKET_ALL = 'A' , MARKET_BRAZIL = 'B' , MARKET_CHINA = 'C' , MARKET_GERMANY = 'D' ,
  MARKET_USA = 'E' , MARKET_FRANCE = 'F' , MARKET_GATEWAY64_NTSC = 'G' , MARKET_NETHERLANDS = 'H' ,
  MARKET_ITALY = 'I' , MARKET_JAPAN = 'J' , MARKET_KOREA = 'K' , MARKET_GATEWAY64_PAL = 'L' ,
  MARKET_CANADA = 'N' , MARKET_PAL_GENERIC = 'P' , MARKET_SPAIN = 'S' , MARKET_AUSTRAILA = 'U' ,
  MARKET_SCANDINAVAIA = 'W' , MARKET_PAL_X = 'X' , MARKET_PAL_Y = 'Y' , MARKET_PAL_Z = 'Z'
}
 ROM market type enumeration. More...
 

Functions

rom_header_t file_read_rom_header (char *path)
 Reads the N64 ROM header from a file. More...
 
uint8_t rom_db_match_save_type (rom_header_t rom_header)
 
uint8_t rom_db_match_expansion_pak (rom_header_t rom_header)
 

Detailed Description

N64 ROM Database.

Note
Only works with N64 ROM's by checking the first 1024 bytes of the file.

Data Structure Documentation

◆ rom_config_flags_t

struct rom_config_flags_t

ROM Config Flags Structure.

Note
This information is derived from the ROM header.
See also
https://n64brew.dev/wiki/Peripheral_Interface#Domains i.e. 0x00 = PI BSD Domain 1 Release register 0x01 = PI BSD Domain 1 Page Size register 0x02 = PI BSD Domain 1 Pulse Width register 0x03 = PI BSD Domain 1 Latch register
Data Fields
uint8_t domain1_release
uint8_t domain1_page_size
uint8_t domain1_latency
uint8_t domain1_pulse_width

◆ rom_metadata_t

struct rom_metadata_t

ROM Metadata Structure.

Note
This information is derived from the ROM header. i.e. 0x3B = Media Type 0x3C and 0x3D = Unique Identifier 0x3E = Destination Market
Data Fields
uint8_t media_type
uint16_t unique_identifier
uint8_t destination_market
uint8_t version

◆ rom_header_t

struct rom_header_t

ROM Header Structure.

Note
This information is derived from the ROM header.
See also
https://n64brew.dev/wiki/ROM_Header
Data Fields
uint32_t config_flags The ROM configuration flags.
Note
we currently use this to work out the endian
See also
rom_endian_type_t.
uint32_t clock_rate The ROM file clock rate.
uint32_t boot_address The ROM file boot address.
uint32_t sdk_version The ROM file SDK version.
uint64_t checksum The ROM file checksum.
uint64_t unknown_reserved_1 The ROM file unknown reserved region at 0x18. for 8 bytes.
char title[21] The ROM file title.
char unknown_reserved_2[7] The ROM file unknown reserved region at 0x34. for 7 bytes.
rom_metadata_t metadata The ROM file metadata.
See also
rom_metadata_t.
char ipl_boot_code[0x0FC0] The ROM file release version.

Enumeration Type Documentation

◆ db_savetype_t

ROM database save type enumeration.

Note
These values are independent of flashcart / OS but by default align to SC64.
Enumerator
DB_SAVE_TYPE_NONE 

The ROM has no save type.

DB_SAVE_TYPE_EEPROM_4K 

The ROM uses EEPROM 4K saves.

DB_SAVE_TYPE_EEPROM_16K 

The ROM uses EEPROM 16K saves.

DB_SAVE_TYPE_SRAM 

The ROM uses SRAM saves.

DB_SAVE_TYPE_SRAM_BANKED 

The ROM uses SRAM Banked saves.

DB_SAVE_TYPE_SRAM_128K 

The ROM uses SRAM 128K saves.

Note
This is not supported by all flashcarts.
DB_SAVE_TYPE_FLASHRAM 

The ROM uses FLASHRAM saves.

DB_SAVE_TYPE_CPAK 

The ROM uses CPAK saves.

Note
This must be handled by user code.
DB_SAVE_TYPE_DD 

The ROM uses Disk Drive saves.

Note
This is not supported by all flashcarts.
DB_SAVE_TYPE_DD_CONVERSION 

The ROM uses Disk Drive conversion saves.

Note
This must be handled by user code.
DB_SAVE_TYPE_INVALID 

The ROM uses a save type that was not recognised.

◆ rom_memorytype_t

ROM system memory requirements enumeration.

Enumerator
DB_MEMORY_EXPANSION_NONE 

The ROM is happy with 4MB of memory.

DB_MEMORY_EXPANSION_REQUIRED 

The ROM requires 8MB of memory.

DB_MEMORY_EXPANSION_RECOMMENDED 

The ROM recommends 8MB of memory.

DB_MEMORY_EXPANSION_SUGGESTED 

The ROM suggests 8MB of memory.

DB_MEMORY_EXPANSION_FAULTY 

The ROM is faulty when using 8MB of memory.

◆ homebrew_savetype_t

ROM homebrew save type enumeration.

Note
These align to the Krikzz ED64 save types and are generally accepted by all emulators.
Enumerator
HB_SAVE_TYPE_NONE 

The ROM has no save type.

HB_SAVE_TYPE_EEPROM_4K 

The ROM uses EEPROM 4K saves.

HB_SAVE_TYPE_EEPROM_16K 

The ROM uses EEPROM 16K saves.

HB_SAVE_TYPE_SRAM 

The ROM uses SRAM saves.

HB_SAVE_TYPE_SRAM_BANKED 

The ROM uses SRAM Banked saves.

HB_SAVE_TYPE_FLASHRAM 

The ROM uses FLASHRAM saves.

HB_SAVE_TYPE_SRAM_128K 

The ROM uses SRAM 128K saves.

Note
This is not supported by all flashcarts.

◆ rom_endian_type_t

ROM file endian enumeration.

Note
this is a hack used for checking ROM's against expected Big Endian when reading from the file system.
Enumerator
ROM_BIG_ENDIAN 

Big Endian ROM.

ROM_LITTLE_ENDIAN 

Little Endian ROM.

ROM_MID_BIG_ENDIAN 

Mid Big Endian ROM.

ROM_MID_LITTLE_ENDIAN 

Mid Little Endian ROM.

IPL_BIG_ENDIAN 

Big Endian IPL ROM.

◆ rom_media_type_t

ROM media type enumeration.

Enumerator
N64_CART 

Is a stand alone Cartridge program.

N64_DISK 

Is a stand alone Disk Drive program.

N64_CART_EXPANDABLE 

Is a Cartridge program that could use an extra Disk Drive program to expand its capabilities.

N64_DISK_EXPANDABLE 

Is a Disk Drive program that could use an extra Cartridge program to expand its capabilities.

N64_ALECK64 

Is an Aleck64 program.

◆ rom_destination_market_t

ROM market type enumeration.

Enumerator
MARKET_ALL 

The ROM is designed for all regions.

MARKET_BRAZIL 

The ROM is designed for Brazil (probably PAL-M).

MARKET_CHINA 

The ROM is designed for China (probably PAL-D).

MARKET_GERMANY 

The ROM is designed for Germany (probably PAL).

MARKET_USA 

The ROM is designed for USA. (probably NTSC-M)

MARKET_FRANCE 

The ROM is designed for France (probably PAL).

MARKET_GATEWAY64_NTSC 

The ROM is designed for a NTSC Gateway 64.

MARKET_NETHERLANDS 

The ROM is designed for Netherlands (probably PAL).

MARKET_ITALY 

The ROM is designed for Italy (probably PAL).

MARKET_JAPAN 

The ROM is designed for Japan. (probably NTSC-J)

MARKET_KOREA 

The ROM is designed for Korea.

MARKET_GATEWAY64_PAL 

The ROM is designed for a PAL Gateway 64.

MARKET_CANADA 

The ROM is designed for Canada.

MARKET_PAL_GENERIC 

The ROM is designed for all PAL regions.

MARKET_SPAIN 

The ROM is designed for Spain (probably PAL).

MARKET_AUSTRAILA 

The ROM is designed for Australia (probably PAL).

MARKET_SCANDINAVAIA 

The ROM is designed for Scandinavia.

MARKET_PAL_X 

The ROM is designed for a PAL market (just unsure which and why).

MARKET_PAL_Y 

The ROM is designed for a PAL market (just unsure which and why).

MARKET_PAL_Z 

The ROM is designed for a PAL market (just unsure which and why).

Function Documentation

◆ file_read_rom_header()

rom_header_t file_read_rom_header ( char *  path)

Reads the N64 ROM header from a file.

See also
https://n64brew.dev/wiki/ROM_Header