N64FlashcartMenu
Loading...
Searching...
No Matches
flashcart.h
Go to the documentation of this file.
1
7#ifndef FLASHCART_H__
8#define FLASHCART_H__
9
10
11#include <stdbool.h>
12#include <stdint.h>
13
14
16typedef enum {
17 FLASHCART_OK,
18 FLASHCART_ERR_OUTDATED,
19 FLASHCART_ERR_SD_CARD,
20 FLASHCART_ERR_ARGS,
21 FLASHCART_ERR_LOAD,
22 FLASHCART_ERR_INT,
23 FLASHCART_ERR_FUNCTION_NOT_SUPPORTED,
25
27typedef enum {
28 FLASHCART_FEATURE_64DD,
29 FLASHCART_FEATURE_RTC,
30 FLASHCART_FEATURE_USB,
32
34typedef enum {
35 FLASHCART_SAVE_TYPE_NONE,
36 FLASHCART_SAVE_TYPE_EEPROM_4K,
37 FLASHCART_SAVE_TYPE_EEPROM_16K,
38 FLASHCART_SAVE_TYPE_SRAM,
39 FLASHCART_SAVE_TYPE_SRAM_BANKED,
40 FLASHCART_SAVE_TYPE_SRAM_128K,
41 FLASHCART_SAVE_TYPE_FLASHRAM,
42 FLASHCART_SAVE_TYPE_FLASHRAM_PKST2,
43 __FLASHCART_SAVE_TYPE_END
45
47typedef struct {
48 bool development_drive;
49 uint8_t disk_type;
50 bool bad_system_area_lbas[24];
51 uint8_t defect_tracks[16][12];
53
54typedef void flashcart_progress_callback_t (float progress);
55
57typedef struct {
59 flashcart_err_t (*init) (void);
61 flashcart_err_t (*deinit) (void);
63 bool (*has_feature) (flashcart_features_t feature);
65 flashcart_err_t (*load_rom) (char *rom_path, flashcart_progress_callback_t *progress);
67 flashcart_err_t (*load_file) (char *file_path, uint32_t rom_offset, uint32_t file_offset);
69 flashcart_err_t (*load_save) (char *save_path);
71 flashcart_err_t (*load_64dd_ipl) (char *ipl_path, flashcart_progress_callback_t *progress);
73 flashcart_err_t (*load_64dd_disk) (char *disk_path, flashcart_disk_parameters_t *disk_parameters);
75 flashcart_err_t (*set_save_type) (flashcart_save_type_t save_type);
77 flashcart_err_t (*set_save_writeback) (char *save_path);
79
80
81char *flashcart_convert_error_message (flashcart_err_t err);
82flashcart_err_t flashcart_init (const char **storage_prefix);
83flashcart_err_t flashcart_deinit (void);
84bool flashcart_has_feature (flashcart_features_t feature);
85flashcart_err_t flashcart_load_rom (char *rom_path, bool byte_swap, flashcart_progress_callback_t *progress);
86flashcart_err_t flashcart_load_file (char *file_path, uint32_t rom_offset, uint32_t file_offset);
87flashcart_err_t flashcart_load_save (char *save_path, flashcart_save_type_t save_type);
88flashcart_err_t flashcart_load_64dd_ipl (char *ipl_path, flashcart_progress_callback_t *progress);
89flashcart_err_t flashcart_load_64dd_disk (char *disk_path, flashcart_disk_parameters_t *disk_parameters);
90
91
92#endif
flashcart_err_t
Flashcart error enumeration.
Definition: flashcart.h:16
flashcart_save_type_t
Flashcart save type enumeration.
Definition: flashcart.h:34
flashcart_features_t
List of optional supported flashcart features.
Definition: flashcart.h:27
Flashcart Disk Parameter Structure.
Definition: flashcart.h:47
Flashcart Structure.
Definition: flashcart.h:57