From 97bbe2ea66260adf446e84c69d228d1a19ac7caf Mon Sep 17 00:00:00 2001 From: superp00t Date: Sat, 12 Apr 2025 04:34:05 -0400 Subject: [PATCH] feat(util): convert names of asset files to lowercase before attempting to read --- src/util/SFile.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/util/SFile.cpp b/src/util/SFile.cpp index fdac653..fab5907 100644 --- a/src/util/SFile.cpp +++ b/src/util/SFile.cpp @@ -145,6 +145,13 @@ int32_t SFile::OpenEx(SArchive* archive, const char* filename, uint32_t flags, S } SStrCopy(path, filename, STORM_MAX_PATH); + for (int32_t i = 0; i < STORM_MAX_PATH; i++) { + if (!path[i]) { + break; + } + + path[i] = static_cast(tolower(path[i])); + } SFILE_TYPE filetype = SFILE_PLAIN; void* filehandle; @@ -216,7 +223,9 @@ int32_t SFile::Read(SFile* file, void* buffer, size_t bytestoread, size_t* bytes auto stream = reinterpret_cast(file->m_handle); auto count = static_cast(bytestoread); Blizzard::File::Read(stream, buffer, &count); - *bytesread = static_cast(count); + if (bytesread) { + *bytesread = static_cast(count); + } return 1; } case SFILE_PAQ: {