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_JAPANESE_MULTI = 'A' , MARKET_BRAZILIAN = 'B' , MARKET_CHINESE = 'C' , MARKET_GERMAN = 'D' ,
  MARKET_NORTH_AMERICA = 'E' , MARKET_FRENCH = 'F' , MARKET_GATEWAY64_NTSC = 'G' , MARKET_DUTCH = 'H' ,
  MARKET_ITALIAN = 'I' , MARKET_JAPANESE = 'J' , MARKET_KOREAN = 'K' , MARKET_GATEWAY64_PAL = 'L' ,
  MARKET_CANADIAN = 'N' , MARKET_EUROPEAN_BASIC = 'P' , MARKET_SPANISH = 'S' , MARKET_AUSTRALIAN = 'U' ,
  MARKET_SCANDINAVIAN = 'W' , MARKET_OTHER_X = 'X' , MARKET_OTHER_Y = 'Y' , MARKET_OTHER_Z = 'Z'
}
 ROM market region & language 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 region & language type enumeration.

Enumerator
MARKET_JAPANESE_MULTI 

The ROM is designed for Japanese and "English" languages.

MARKET_BRAZILIAN 

The ROM is designed for Brazil (Portuguese) language.

MARKET_CHINESE 

The ROM is designed for Chinese language.

MARKET_GERMAN 

The ROM is designed for German language.

MARKET_NORTH_AMERICA 

The ROM is designed for North American "English" language.

MARKET_FRENCH 

The ROM is designed for French language.

MARKET_GATEWAY64_NTSC 

The ROM is designed for a NTSC Gateway 64.

MARKET_DUTCH 

The ROM is designed for Dutch language.

MARKET_ITALIAN 

The ROM is designed for Italian language.

MARKET_JAPANESE 

The ROM is designed for Japanese language.

MARKET_KOREAN 

The ROM is designed for Korean language.

MARKET_GATEWAY64_PAL 

The ROM is designed for a PAL Gateway 64.

MARKET_CANADIAN 

The ROM is designed for Canada region (English and French) language.

MARKET_EUROPEAN_BASIC 

The ROM is designed for European market and languages (must at minimum include English).

MARKET_SPANISH 

The ROM is designed for Spanish language.

MARKET_AUSTRALIAN 

The ROM is designed for Australia (English) language.

MARKET_SCANDINAVIAN 

The ROM is designed for Scandinavian (Swedish, Norwegian, Finnish, etc.) languages.

MARKET_OTHER_X 

The ROM is designed for an undefined region and TBD language(s).

MARKET_OTHER_Y 

The ROM is designed for a European region and language(s).

MARKET_OTHER_Z 

The ROM is designed for an undefined region and TBD language(s).

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