libdragon
Loading...
Searching...
No Matches
mempak.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_MEMPAK_H
7#define __LIBDRAGON_MEMPAK_H
8
33#define MEMPAK_BLOCK_SIZE 256
34
38typedef struct entry_structure
39{
41 uint32_t vendor;
43 uint16_t game_id;
45 uint16_t inode;
47 uint8_t region;
50 uint8_t blocks;
52 uint8_t valid;
54 uint8_t entry_id;
67 char name[19];
69
70#ifdef __cplusplus
71extern "C" {
72#endif
73
91int read_mempak_sector( int controller, int sector, uint8_t *sector_data );
92
110int write_mempak_sector( int controller, int sector, uint8_t *sector_data );
111
125int validate_mempak( int controller );
126
138int get_mempak_free_space( int controller );
139
157int get_mempak_entry( int controller, int entry, entry_structure_t *entry_data );
158
171int format_mempak( int controller );
172
195int read_mempak_entry_data( int controller, entry_structure_t *entry, uint8_t *data );
196
219int write_mempak_entry_data( int controller, entry_structure_t *entry, uint8_t *data );
220
236int delete_mempak_entry( int controller, entry_structure_t *entry );
237
238#ifdef __cplusplus
239}
240#endif
241
/* controllerpak */
243
244#endif
uint16_t game_id
Game ID.
Definition mempak.h:43
uint32_t vendor
Vendor ID.
Definition mempak.h:41
uint16_t inode
Inode pointer.
Definition mempak.h:45
uint8_t region
Intended region.
Definition mempak.h:47
uint8_t blocks
Number of blocks used by this entry.
Definition mempak.h:50
uint8_t valid
Validity of this entry.
Definition mempak.h:52
uint8_t entry_id
ID of this entry.
Definition mempak.h:54
int format_mempak(int controller)
Format a Controller Pak.
Definition mempak.c:745
int read_mempak_sector(int controller, int sector, uint8_t *sector_data)
Read a sector from a Controller Pak.
Definition mempak.c:27
int write_mempak_entry_data(int controller, entry_structure_t *entry, uint8_t *data)
Write associated data to a Controller Pak entry.
Definition mempak.c:882
int get_mempak_free_space(int controller)
Return the number of free blocks on a Controller Pak.
Definition mempak.c:723
int read_mempak_entry_data(int controller, entry_structure_t *entry, uint8_t *data)
Read the data associated with an entry on a Controller Pak.
Definition mempak.c:819
int delete_mempak_entry(int controller, entry_structure_t *entry)
Delete a Controller Pak entry and associated data.
Definition mempak.c:1022
int get_mempak_entry(int controller, int entry, entry_structure_t *entry_data)
Read an entry on a Controller Pak.
Definition mempak.c:669
int write_mempak_sector(int controller, int sector, uint8_t *sector_data)
Write a sector to a Controller Pak.
Definition mempak.c:45
int validate_mempak(int controller)
Return whether a Controller Pak is valid.
Definition mempak.c:653
Structure representing a save entry on a Controller Pak.
Definition mempak.h:39