@@ -154,7 +154,6 @@ int32_t loadSettings(const char *fileName, gc::card::card_file *fileInfo, uint8_
154
154
155
155
delete[] (MiscData);
156
156
return CARD_ERROR_READY;
157
-
158
157
}
159
158
160
159
int32_t writeSettings (const char *description, const char *fileName,
@@ -176,12 +175,24 @@ int32_t writeSettings(const char *description, const char *fileName,
176
175
177
176
// Open the settings file if it exists
178
177
ReturnCode = gc::card::CARDOpen (CARD_SLOTA, fileName, fileInfo);
179
- if (ReturnCode != CARD_ERROR_READY )
178
+ switch (ReturnCode)
180
179
{
181
- // Settings file does not exist, so create it
182
- // createSettingsFile keeps the file open, but closes and unmounts if it fails to create the file
183
- ReturnCode = createSettingsFile (fileName, description, fileInfo);
184
- if (ReturnCode != CARD_ERROR_READY)
180
+ case CARD_ERROR_READY:
181
+ {
182
+ break ;
183
+ }
184
+ case CARD_ERROR_NOFILE:
185
+ {
186
+ // Settings file does not exist, so create it
187
+ // createSettingsFile keeps the file open, but closes and unmounts if it fails to create the file
188
+ ReturnCode = createSettingsFile (fileName, description, fileInfo);
189
+ if (ReturnCode != CARD_ERROR_READY)
190
+ {
191
+ return ReturnCode;
192
+ }
193
+ break ;
194
+ }
195
+ default :
185
196
{
186
197
return ReturnCode;
187
198
}
@@ -199,7 +210,7 @@ int32_t writeSettings(const char *description, const char *fileName,
199
210
char *MiscData = new char [MiscDataSize];
200
211
clearMemory (MiscData, MiscDataSize);
201
212
202
- // Copy the name and description to display into the memory
213
+ // Copy the name, description, and file size into the memory
203
214
ttyd::string::strcpy (MiscData, " Paper Mario" );
204
215
ttyd::string::strcpy (&MiscData[0x20 ], description);
205
216
0 commit comments