Skip to content

Commit

Permalink
Replace any non alphanumerical character with '_' for output filenames (
Browse files Browse the repository at this point in the history
#246)

Fixes dumping carts with headers that have random garbage data in their gameTitle that are not actually ascii characters, thus making the dump fail because the output file cannot be opened
  • Loading branch information
edo9300 authored Nov 21, 2024
1 parent 87d623c commit e94a930
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions arm9/source/dumpOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "screenshot.h"
#include "version.h"

#include <cctype>
#include <dirent.h>
#include <nds.h>
#include <nds/arm9/dldi.h>
Expand Down Expand Up @@ -825,18 +826,8 @@ void ndsCardDump(void) {
sprintf(gameTitle, "NO-TITLE");
} else {
for(uint i = 0; i < sizeof(gameTitle); i++) {
switch(gameTitle[i]) {
case '>':
case '<':
case ':':
case '"':
case '/':
case '\x5C':
case '|':
case '?':
case '*':
gameTitle[i] = '_';
}
if(!isalnum(gameTitle[i]))
gameTitle[i] = '_';
}
}
if (gameCode[0] == 0 || gameCode[0] == 0x23 || gameCode[0] == 0xFF) {
Expand Down

0 comments on commit e94a930

Please sign in to comment.