From 35794dae21ff0a805ab1927269cfbe6d418e03f7 Mon Sep 17 00:00:00 2001 From: VitaSmith Date: Mon, 4 Jan 2021 00:03:56 +0000 Subject: [PATCH] Fix remaining case sensitivity issues Closes #1 --- .vs/cdecrypt.vcxproj | 8 ++++---- cdecrypt.c | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.vs/cdecrypt.vcxproj b/.vs/cdecrypt.vcxproj index e1e64db..673b686 100644 --- a/.vs/cdecrypt.vcxproj +++ b/.vs/cdecrypt.vcxproj @@ -131,7 +131,7 @@ _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;AES_ROM_TABLES;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true MultiThreadedDebug - 4200;4201 + 4200;4201;6384 NDEBUG @@ -154,7 +154,7 @@ _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;AES_ROM_TABLES;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true MultiThreadedDebug - 4200;4201 + 4200;4201;6384 NDEBUG @@ -178,7 +178,7 @@ _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;AES_ROM_TABLES;WIN32;_CONSOLE;%(PreprocessorDefinitions) true MultiThreaded - 4200;4201 + 4200;4201;6384 NDEBUG @@ -204,7 +204,7 @@ _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;AES_ROM_TABLES;WIN32;_CONSOLE;%(PreprocessorDefinitions) true MultiThreaded - 4200;4201 + 4200;4201;6384 NDEBUG diff --git a/cdecrypt.c b/cdecrypt.c index b959769..b82aa45 100644 --- a/cdecrypt.c +++ b/cdecrypt.c @@ -460,16 +460,22 @@ int main_utf8(int argc, char** argv) uint8_t iv[16]; memset(iv, 0, sizeof(iv)); - sprintf(str, "%s%c%08X.app", argv[1], PATH_SEP, getbe32(&tmd->Contents[0].ID)); + for (uint32_t k = 0; k < (array_size(pattern) / 2); k++) { + sprintf(str, pattern[k], argv[1], PATH_SEP, getbe32(&tmd->Contents[0].ID)); + if (is_file(str)) + break; + } uint32_t cnt_len = read_file(str, &cnt); if (cnt_len == 0) { - sprintf(str, "%s%c%08X", argv[1], PATH_SEP, getbe32(&tmd->Contents[0].ID)); + for (uint32_t k = (array_size(pattern) / 2); k < array_size(pattern); k++) { + sprintf(str, pattern[k], argv[1], PATH_SEP, getbe32(&tmd->Contents[0].ID)); + if (is_file(str)) + break; + } cnt_len = read_file(str, &cnt); - if (cnt_len == 0) { - fprintf(stderr, "ERROR: Failed to open content: %02X\n", getbe32(&tmd->Contents[0].ID)); + if (cnt_len == 0) goto out; - } } if (getbe64(&tmd->Contents[0].Size) != (uint64_t)cnt_len) {