NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
NWC24FileApi.h
1#ifndef RVL_SDK_NWC24_FILE_API_H
2#define RVL_SDK_NWC24_FILE_API_H
3#include <revolution/NAND.h>
4#include <revolution/NWC24/NWC24Types.h>
5#include <revolution/VF.h>
6#include <types.h>
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11typedef enum {
12 // Access
13 NWC24_OPEN_WRITE = (1 << 0),
14 NWC24_OPEN_READ = (1 << 1),
15 NWC24_OPEN_RW = (1 << 2),
16
17 // Domain
18 NWC24_OPEN_BUFF = (1 << 3),
19 NWC24_OPEN_VF = (1 << 8),
20
21 // NAND presets
22 NWC24_OPEN_NAND_W = NWC24_OPEN_WRITE,
23 NWC24_OPEN_NAND_R = NWC24_OPEN_READ,
24 NWC24_OPEN_NAND_RW = NWC24_OPEN_RW,
25
26 // VF presets
27 NWC24_OPEN_VF_W = NWC24_OPEN_WRITE | NWC24_OPEN_VF,
28 NWC24_OPEN_VF_R = NWC24_OPEN_READ | NWC24_OPEN_VF,
29 NWC24_OPEN_VF_RW = NWC24_OPEN_RW | NWC24_OPEN_VF,
30
31 // NAND (buffered) presets
32 NWC24_OPEN_NAND_WBUFF = NWC24_OPEN_NAND_W | NWC24_OPEN_BUFF,
33 NWC24_OPEN_NAND_RBUFF = NWC24_OPEN_NAND_R | NWC24_OPEN_BUFF,
34 NWC24_OPEN_NAND_RWBUFF = NWC24_OPEN_NAND_RW | NWC24_OPEN_BUFF,
35
36 // VF (buffered) presets
37 NWC24_OPEN_VF_WBUFF = NWC24_OPEN_VF_W | NWC24_OPEN_BUFF,
38 NWC24_OPEN_VF_RBUFF = NWC24_OPEN_VF_R | NWC24_OPEN_BUFF,
39 NWC24_OPEN_VF_RWBUFF = NWC24_OPEN_VF_RW | NWC24_OPEN_BUFF,
40} NWC24OpenMode;
41
42typedef enum {
43 NWC24_SEEK_BEG,
44 NWC24_SEEK_CUR,
45 NWC24_SEEK_END,
46} NWC24SeekMode;
47
48typedef struct NWC24File {
49 u32 id; // at 0x0
50 u32 mode; // at 0x4
51 u32 align; // at 0x8
52 NANDFileInfo nandf; // at 0xC
53 VFFile vff; // at 0x98
54} NWC24File;
55
56NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode);
57NWC24Err NWC24iFOpenNand(NWC24File* file, const char* path, u32 mode);
58NWC24Err NWC24iFOpenVF(NWC24File* file, const char* path, u32 mode);
59
60NWC24Err NWC24FClose(NWC24File* file);
61NWC24Err NWC24iFCloseNand(NWC24File* file) DECOMP_DONT_INLINE;
62NWC24Err NWC24iFCloseVF(NWC24File* file);
63
64NWC24Err NWC24FSeek(NWC24File* file, s32 offset, NWC24SeekMode whence);
65NWC24Err NWC24FRead(void* dst, s32 size, NWC24File* file);
66NWC24Err NWC24FWrite(const void* src, s32 size, NWC24File* file);
67NWC24Err NWC24FGetLength(NWC24File* file, u32* lengthOut);
68NWC24Err NWC24FDeleteVF(const char* path);
69NWC24Err NWC24MountVF(const char* drive, const char* filename);
70NWC24Err NWC24UnmountVF(const char* drive);
71NWC24Err NWC24CheckSizeVF(const char* drive, u32* sizeOut);
72
73#ifdef __cplusplus
74}
75#endif
76#endif