N64FlashcartMenu
Loading...
Searching...
No Matches
rom_info.h
Go to the documentation of this file.
1
8#ifndef ROM_INFO_H__
9#define ROM_INFO_H__
10
11
12#include <stdbool.h>
13#include <stdint.h>
14
15#include "path.h"
16
17
19typedef enum {
20 ROM_OK,
21 ROM_ERR_LOAD_IO,
22 ROM_ERR_SAVE_IO,
23 ROM_ERR_NO_FILE,
24} rom_err_t;
25
27typedef enum {
35
37typedef enum {
39 N64_CART = 'N',
41 N64_DISK = 'D',
47 N64_ALECK64 = 'Z'
49
51typedef enum {
53 MARKET_JAPANESE_MULTI = 'A', // 1080 Snowboarding JPN is the only ROM that uses this? possibily a mistake, or the fact it also includes American English!.
79 MARKET_EUROPEAN_BASIC = 'P', // Sometimes used for Australian region ROMs as well.
87 MARKET_OTHER_X = 'X', // many EU ROM's, Top Gear Rally (Asia) and HSV Racing (AUS) ROM uses this.
89 MARKET_OTHER_Y = 'Y', // many EU ROM's uses this.
91 MARKET_OTHER_Z = 'Z' // no known ROM's use this.
93
95typedef enum {
96 ROM_CIC_TYPE_UNKNOWN = 0, // No known CIC type detected
97 ROM_CIC_TYPE_5101 = 5101, // Aleck64 CIC-5101
98 ROM_CIC_TYPE_5167 = 5167, // 64DD ROM conversion CIC-5167
99 ROM_CIC_TYPE_6101 = 6101, // NTSC CIC-6101
100 ROM_CIC_TYPE_7102 = 7102, // PAL CIC-7102
101 ROM_CIC_TYPE_x102 = 6102, // NTSC CIC-6102 / PAL CIC-7101
102 ROM_CIC_TYPE_x103 = 6103, // NTSC CIC-6103 / PAL CIC-7103
103 ROM_CIC_TYPE_x105 = 6105, // NTSC CIC-6105 / PAL CIC-7105
104 ROM_CIC_TYPE_x106 = 6106, // NTSC CIC-6106 / PAL CIC-7106
105 ROM_CIC_TYPE_8301 = 8301, // NDDJ0 64DD IPL
106 ROM_CIC_TYPE_8302 = 8302, // NDDJ1 64DD IPL
107 ROM_CIC_TYPE_8303 = 8303, // NDDJ2 64DD IPL
108 ROM_CIC_TYPE_8401 = 8401, // NDXJ0 64DD IPL
109 ROM_CIC_TYPE_8501 = 8501, // NDDE0 64DD IPL
110 ROM_CIC_TYPE_AUTOMATIC = -1, // Guess CIC from IPL3
112
114typedef enum {
117 SAVE_TYPE_EEPROM_4KBIT = 1,
118 SAVE_TYPE_EEPROM_16KBIT = 2,
119 SAVE_TYPE_SRAM_256KBIT = 3,
120 SAVE_TYPE_SRAM_BANKED = 4,
121 SAVE_TYPE_SRAM_1MBIT = 5,
122 SAVE_TYPE_FLASHRAM_1MBIT = 6,
123 SAVE_TYPE_FLASHRAM_PKST2 = 7,
124 SAVE_TYPE_AUTOMATIC = -1,
126
127typedef enum {
128 ROM_TV_TYPE_PAL = 0,
129 ROM_TV_TYPE_NTSC = 1,
130 ROM_TV_TYPE_MPAL = 2,
131 ROM_TV_TYPE_UNKNOWN = 3,
132 ROM_TV_TYPE_AUTOMATIC = -1,
133} rom_tv_type_t;
134
136typedef enum {
139
142
145
148
152
154typedef struct {
157
160
162 uint32_t boot_address;
163
164 struct {
166 uint8_t version;
168 char revision;
169 } libultra;
170
172 uint64_t check_code;
173
175 char title[20];
176
177 union {
179 char game_code[4];
180 struct {
182 rom_category_type_t category_code : 8;
184 char unique_code[2];
186 rom_destination_type_t destination_code : 8;
187 };
188 };
189
191 uint8_t version;
192
195
198
200 rom_tv_type_t tv_type;
201
203 struct {
204 bool cic;
205 rom_cic_type_t cic_type;
206
207 bool save;
208 rom_save_type_t save_type;
209
210 bool tv;
211 rom_tv_type_t tv_type;
212 } override;
213
215 struct {
216 bool controller_pak;
217 bool rumble_pak;
218 bool transfer_pak;
219 bool voice_recognition_unit;
220 bool real_time_clock;
221 bool disk_conversion;
222 bool combo_rom_disk_game;
223 rom_expansion_pak_t expansion_pak;
224 } features;
225} rom_info_t;
226
227
228rom_cic_type_t rom_info_get_cic_type (rom_info_t *rom_info);
229bool rom_info_get_cic_seed (rom_info_t *rom_info, uint8_t *seed);
230rom_err_t rom_info_override_cic_type (path_t *path, rom_info_t *rom_info, rom_cic_type_t cic_type);
231
232rom_save_type_t rom_info_get_save_type (rom_info_t *rom_info);
233rom_err_t rom_info_override_save_type (path_t *path, rom_info_t *rom_info, rom_save_type_t save_type);
234
235rom_tv_type_t rom_info_get_tv_type (rom_info_t *rom_info);
236rom_err_t rom_info_override_tv_type (path_t *path, rom_info_t *rom_info, rom_tv_type_t tv_type);
237
238rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info);
239
240
241#endif
Menu Path.
Path Structure.
Definition: path.h:16
rom_category_type_t
ROM media type enumeration.
Definition: rom_info.h:37
@ N64_DISK_EXPANDABLE
Is a Disk Drive program that could use an extra Cartridge program to expand its capabilities.
Definition: rom_info.h:45
@ N64_CART
Is a stand alone Cartridge program.
Definition: rom_info.h:39
@ N64_CART_EXPANDABLE
Is a Cartridge program that could use an extra Disk Drive program to expand its capabilities.
Definition: rom_info.h:43
@ N64_DISK
Is a stand alone Disk Drive program.
Definition: rom_info.h:41
@ N64_ALECK64
Is an Aleck64 program.
Definition: rom_info.h:47
rom_endianness_t endianness
The file endian.
Definition: rom_info.h:156
rom_save_type_t
ROM save type enumeration.
Definition: rom_info.h:114
@ SAVE_TYPE_NONE
There is no expected save type.
Definition: rom_info.h:116
rom_cic_type_t
ROM CIC type enumeration.
Definition: rom_info.h:95
rom_expansion_pak_t
ROM memory requirements enumeration.
Definition: rom_info.h:136
@ EXPANSION_PAK_SUGGESTED
The ROM suggests 8MB of memory.
Definition: rom_info.h:147
@ EXPANSION_PAK_NONE
The ROM is happy with 4MB of memory.
Definition: rom_info.h:138
@ EXPANSION_PAK_RECOMMENDED
The ROM recommends 8MB of memory.
Definition: rom_info.h:144
@ EXPANSION_PAK_REQUIRED
The ROM requires 8MB of memory.
Definition: rom_info.h:141
@ EXPANSION_PAK_FAULTY
The ROM is faulty when using 8MB of memory.
Definition: rom_info.h:150
rom_cic_type_t cic_type
The CIC type required by the ROM.
Definition: rom_info.h:194
rom_destination_type_t
ROM market region & language type enumeration.
Definition: rom_info.h:51
@ MARKET_SPANISH
The ROM is designed for Spanish language.
Definition: rom_info.h:81
@ MARKET_OTHER_Z
The ROM is designed for an undefined region and TBD language(s).
Definition: rom_info.h:91
@ MARKET_EUROPEAN_BASIC
The ROM is designed for European market and languages (must at minimum include English).
Definition: rom_info.h:79
@ MARKET_ITALIAN
The ROM is designed for Italian language.
Definition: rom_info.h:69
@ MARKET_GERMAN
The ROM is designed for German language.
Definition: rom_info.h:59
@ MARKET_KOREAN
The ROM is designed for Korean language.
Definition: rom_info.h:73
@ MARKET_JAPANESE
The ROM is designed for Japanese language.
Definition: rom_info.h:71
@ MARKET_NORTH_AMERICA
The ROM is designed for North American "English" language.
Definition: rom_info.h:61
@ MARKET_JAPANESE_MULTI
The ROM is designed for Japanese and "English" languages.
Definition: rom_info.h:53
@ MARKET_OTHER_Y
The ROM is designed for a European region and language(s).
Definition: rom_info.h:89
@ MARKET_OTHER_X
The ROM is designed for an undefined region and TBD language(s).
Definition: rom_info.h:87
@ MARKET_BRAZILIAN
The ROM is designed for Brazil (Portuguese) language.
Definition: rom_info.h:55
@ MARKET_GATEWAY64_PAL
The ROM is designed for a PAL Gateway 64.
Definition: rom_info.h:75
@ MARKET_GATEWAY64_NTSC
The ROM is designed for a NTSC Gateway 64.
Definition: rom_info.h:65
@ MARKET_DUTCH
The ROM is designed for Dutch language.
Definition: rom_info.h:67
@ MARKET_CANADIAN
The ROM is designed for Canada region (English and French) language.
Definition: rom_info.h:77
@ MARKET_CHINESE
The ROM is designed for Chinese language.
Definition: rom_info.h:57
@ MARKET_AUSTRALIAN
The ROM is designed for Australia (English) language.
Definition: rom_info.h:83
@ MARKET_SCANDINAVIAN
The ROM is designed for Scandinavian (Swedish, Norwegian, Finnish, etc.) languages.
Definition: rom_info.h:85
@ MARKET_FRENCH
The ROM is designed for French language.
Definition: rom_info.h:63
rom_endianness_t
ROM endian enumeration.
Definition: rom_info.h:27
@ ENDIANNESS_BYTE_SWAP
Is Byte Swapped Endian.
Definition: rom_info.h:33
@ ENDIANNESS_LITTLE
Is Little Endian.
Definition: rom_info.h:31
@ ENDIANNESS_BIG
Is Big Endian.
Definition: rom_info.h:29
float clock_rate
The clock rate defined in the ROM's header.
Definition: rom_info.h:159
rom_save_type_t save_type
The save type required by the ROM.
Definition: rom_info.h:197
uint8_t version
The ROM version defined in the ROM's header.
Definition: rom_info.h:191
rom_err_t
ROM error enumeration.
Definition: rom_info.h:19
rom_tv_type_t tv_type
The TV type required by the ROM.
Definition: rom_info.h:200
uint64_t check_code
The check code defined in the ROM's header.
Definition: rom_info.h:172
uint32_t boot_address
The boot address defined in the ROM's header.
Definition: rom_info.h:162
ROM Information Structure.
Definition: rom_info.h:154