mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Io: Apply VFAT hack only to dirs <= 8 chars long.
Fixes Mega Drops 2, which relies on the lowercase name at about 10 characters.
This commit is contained in:
parent
0d2acb6d73
commit
08b6275bc7
1 changed files with 9 additions and 1 deletions
|
@ -795,10 +795,17 @@ static std::string SimulateVFATBug(std::string filename) {
|
|||
// These are the characters allowed in DOS filenames.
|
||||
static const char *FAT_UPPER_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&'(){}-_`~";
|
||||
static const char *FAT_LOWER_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&'(){}-_`~";
|
||||
static const char *LOWER_CHARS = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
// To avoid logging/comparing, skip all this if it has no lowercase chars to begin with.
|
||||
size_t lowerchar = filename.find_first_of(LOWER_CHARS);
|
||||
if (lowerchar == filename.npos) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
bool apply_hack = false;
|
||||
size_t dot_pos = filename.find('.');
|
||||
if (dot_pos == filename.npos) {
|
||||
if (dot_pos == filename.npos && filename.length() <= 8) {
|
||||
size_t badchar = filename.find_first_not_of(FAT_LOWER_CHARS);
|
||||
if (badchar == filename.npos) {
|
||||
// It's all lowercase. Convert to upper.
|
||||
|
@ -825,6 +832,7 @@ static std::string SimulateVFATBug(std::string filename) {
|
|||
}
|
||||
|
||||
if (apply_hack) {
|
||||
VERBOSE_LOG(FILESYS, "Applying VFAT hack to filename: %s", filename.c_str());
|
||||
// In this situation, NT would write UPPERCASE, and just set a flag to say "actually lowercase".
|
||||
// That VFAT flag isn't read by the PSP firmware, so let's pretend to "not read it."
|
||||
std::transform(filename.begin(), filename.end(), filename.begin(), toupper);
|
||||
|
|
Loading…
Add table
Reference in a new issue