N64FlashcartMenu
Loading...
Searching...
No Matches
cpakfs_utils.h
Go to the documentation of this file.
1
2#ifndef CPAKFS_UTILS__H__
3#define CPAKFS_UTILS__H__
4
11#include <stdbool.h>
12#include <libdragon.h>
13#include <stddef.h>
14
19#define FS_BLOCK_DIVIDER (8 * 32)
20
25#define MAX_NUM_NOTES 16
26
34typedef struct {
35 char gamecode[5];
36 char pubcode[5];
37 char filename[17];
38 char ext[5];
40
44extern const char * const CPAK_MOUNT_ARRAY[4];
45
52int get_block_size_from_fs_path(const char *filename_cpak);
53
57void unmount_all_cpakfs(void);
58
65int mount_cpakfs(int controller);
66
73bool has_cpak(int controller);
74
81int get_file_size_from_fs_path(const char *filename_cpak);
82
91int extract_title_from_absolute_path(const char *path, char *outbuf, size_t outbuf_size);
92
100int parse_cpakfs_fullname(const char *fullname, cpakfs_path_strings_t *out);
101
108int file_exists_full(const char *full_mounted_path);
109
116int inc_index_note(int current_index);
117
124int dec_index_note(int current_index);
125
138int pick_unique_fullname_with_mount(const char *mount_prefix,
139 const char *desired_name,
140 char *out_fullpath, size_t outsz,
141 int (*exists_fullpath)(const char *fullpath));
142
143#endif // CPAKFS_UTILS__H__
int extract_title_from_absolute_path(const char *path, char *outbuf, size_t outbuf_size)
Extract the title from an absolute file path.
Definition cpakfs_utils.c:118
const char *const CPAK_MOUNT_ARRAY[4]
Array of Controller Pak mount point strings (e.g., "cpak1:/").
Definition cpakfs_utils.c:18
int pick_unique_fullname_with_mount(const char *mount_prefix, const char *desired_name, char *out_fullpath, size_t outsz, int(*exists_fullpath)(const char *fullpath))
Pick a unique full filename with mount prefix, avoiding collisions.
Definition cpakfs_utils.c:335
int parse_cpakfs_fullname(const char *fullname, cpakfs_path_strings_t *out)
Parse a Controller Pak full filename into its components.
Definition cpakfs_utils.c:156
int mount_cpakfs(int controller)
Mount the Controller Pak file system for a given controller.
Definition cpakfs_utils.c:100
int inc_index_note(int current_index)
Increment a note index, wrapping around MAX_NUM_NOTES.
Definition cpakfs_utils.c:80
int file_exists_full(const char *full_mounted_path)
Check if a file exists at the given full mounted path.
Definition cpakfs_utils.c:396
bool has_cpak(int controller)
Check if a Controller Pak is present in the given controller.
Definition cpakfs_utils.c:28
int get_file_size_from_fs_path(const char *filename_cpak)
Get the file size from a Controller Pak file system path.
Definition cpakfs_utils.c:49
int get_block_size_from_fs_path(const char *filename_cpak)
Get the block size from a Controller Pak file system path.
Definition cpakfs_utils.c:39
void unmount_all_cpakfs(void)
Unmount all Controller Pak file systems.
Definition cpakfs_utils.c:63
int dec_index_note(int current_index)
Decrement a note index, wrapping around MAX_NUM_NOTES.
Definition cpakfs_utils.c:90
Structure holding parsed components of a Controller Pak file path.
Definition cpakfs_utils.h:34