wut  v1.7.0
Wii U Toolchain
storage.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
11 #ifdef __cplusplus
12 
13 #include <cstring>
14 
15 namespace nn {
16 namespace spm {
17 
18 enum StorageType : uint32_t
19 {
22 };
23 
24 using StorageIndex = uint64_t;
25 
26 struct VolumeId
27 {
28  VolumeId() = default;
29 
30  VolumeId(char const* id){
31  strncpy(this->id, id, sizeof(this->id));
32  }
33 
40  int32_t
41  Compare(VolumeId const& other) const
42  asm("Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId");
43 
44  char id[16];
45 };
46 WUT_CHECK_SIZE(VolumeId, 0x10);
47 
49 {
51  WUT_UNKNOWN_BYTES(0x04);
53 };
54 WUT_CHECK_OFFSET(StorageListItem, 0x00, index);
55 WUT_CHECK_OFFSET(StorageListItem, 0x0c, type);
56 WUT_CHECK_SIZE(StorageListItem, 0x10);
57 
59 {
61  char path[0x280];
65  char format_string[8];
66  WUT_UNKNOWN_BYTES(4);
69 };
70 WUT_CHECK_OFFSET(StorageInfo, 0x000, path);
71 WUT_CHECK_OFFSET(StorageInfo, 0x280, connection_type_string);
72 WUT_CHECK_OFFSET(StorageInfo, 0x288, format_string);
73 WUT_CHECK_OFFSET(StorageInfo, 0x294, type);
74 WUT_CHECK_OFFSET(StorageInfo, 0x298, volumeId);
75 WUT_CHECK_SIZE(StorageInfo, 0x2a8);
76 
77 void
79  asm("Initialize__Q2_2nn3spmFv");
80 
81 void
83  asm("Finalize__Q2_2nn3spmFv");
84 
85 void
86 SetAutoFatal(bool enabled)
87  asm("SetAutoFatal__Q2_2nn3spmFb");
88 
95 int32_t
97  asm("SetExtendedStorage__Q2_2nn3spmFQ3_2nn3spm12StorageIndex");
98 
102 void
104  asm("SetDefaultExtendedStorageVolumeId__Q2_2nn3spmFRCQ3_2nn3spm8VolumeId");
105 
109 void
111  asm("GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv");
112 
113 bool
115  asm("GetPreviousExtendedStorageVolumeId__Q2_2nn3spmFPbPQ3_2nn3spm8VolumeId");
116 
117 bool
118 FindStorageByVolumeId(StorageIndex* outIndex, VolumeId const& volumeId)
119  asm("FindStorageByVolumeId__Q2_2nn3spmFPQ3_2nn3spm12StorageIndexRCQ3_2nn3spm8VolumeId");
120 
121 int32_t
123  asm("GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex");
124 
125 int32_t
126 GetStorageList(StorageListItem* items, uint32_t maxNumItems)
127  asm("GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi");
128 
129 int32_t
131  asm("GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex");
132 
139 int32_t
140 ReadRawStorageHead512(StorageIndex* index, char* outBuffer)
141  asm("ReadRawStorageHead512__Q2_2nn3spmFQ3_2nn3spm12StorageIndexPc");
142 
151 int32_t
152 IsStorageMaybePcFormatted(bool* isPcFormatted, StorageIndex* index)
153  asm("IsStorageMaybePcFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex");
154 
163 int32_t
164 IsStorageMaybeWfsFormatted(bool* isWfsFormatted, StorageIndex* index)
165  asm("IsStorageMaybeWfsFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex");
166 
167 };
168 };
169 
170 #endif
171 
char connection_type_string[8]
The connection type (e.g. "usb")
Definition: storage.h:63
void SetDefaultExtendedStorageVolumeId(VolumeId const &id) asm("SetDefaultExtendedStorageVolumeId__Q2_2nn3spmFRCQ3_2nn3spm8VolumeId")
Sets the id of the default extended storage drive.
void SetAutoFatal(bool enabled) asm("SetAutoFatal__Q2_2nn3spmFb")
VolumeId volumeId
Definition: storage.h:68
uint64_t StorageIndex
Definition: storage.h:24
bool FindStorageByVolumeId(StorageIndex *outIndex, VolumeId const &volumeId) asm("FindStorageByVolumeId__Q2_2nn3spmFPQ3_2nn3spm12StorageIndexRCQ3_2nn3spm8VolumeId")
int32_t ReadRawStorageHead512(StorageIndex *index, char *outBuffer) asm("ReadRawStorageHead512__Q2_2nn3spmFQ3_2nn3spm12StorageIndexPc")
Reads the first 512 bytes of the storage head into the buffer.
void GetDefaultExtendedStorageVolumeId(VolumeId *id) asm("GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv")
Gets the id of the default extended storage drive.
int32_t GetExtendedStorageIndex(StorageIndex *outIndex) asm("GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex")
void Finalize() asm("Finalize__Q2_2nn3spmFv")
int32_t SetExtendedStorage(StorageIndex *index) asm("SetExtendedStorage__Q2_2nn3spmFQ3_2nn3spm12StorageIndex")
Sets the storage drive which should be used for extended storage.
StorageIndex index
Definition: storage.h:50
StorageType type
Definition: storage.h:51
int32_t GetStorageList(StorageListItem *items, uint32_t maxNumItems) asm("GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi")
char format_string[8]
The drive format (e.g. "raw" / "wfs")
Definition: storage.h:65
int32_t GetStorageInfo(StorageInfo *outInfo, StorageIndex *index) asm("GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex")
char path[0x280]
The mount path (e.g. "/vol/storage_usb01")
Definition: storage.h:61
bool GetPreviousExtendedStorageVolumeId(bool *, VolumeId *outVolumeId) asm("GetPreviousExtendedStorageVolumeId__Q2_2nn3spmFPbPQ3_2nn3spm8VolumeId")
StorageType
Definition: storage.h:19
@ STORAGE_TYPE_RAW
Definition: storage.h:20
@ STORAGE_TYPE_WFS
Definition: storage.h:21
int32_t IsStorageMaybePcFormatted(bool *isPcFormatted, StorageIndex *index) asm("IsStorageMaybePcFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex")
void Initialize() asm("Initialize__Q2_2nn3spmFv")
int32_t IsStorageMaybeWfsFormatted(bool *isWfsFormatted, StorageIndex *index) asm("IsStorageMaybeWfsFormatted__Q2_2nn3spmFPbQ3_2nn3spm12StorageIndex")
Definition: ac_cpp.h:15
int32_t Compare(VolumeId const &other) const asm("Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId")
Compares this VolumeId with another one.
VolumeId(char const *id)
Definition: storage.h:30
VolumeId()=default