diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-05-12 23:19:21 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-05-12 23:27:15 +0200 |
commit | 33dfaf7da11675fdad2909e39b6d15e49fc6cc68 (patch) | |
tree | ff2b3fe079b51b521cb26ceb2da0a5717b0601ff /src/fakerw | |
parent | Merge remote-tracking branch 'upstream/miami' into miami (diff) | |
parent | fix shotgun (diff) | |
download | re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar.gz re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar.bz2 re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar.lz re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar.xz re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.tar.zst re3-33dfaf7da11675fdad2909e39b6d15e49fc6cc68.zip |
Diffstat (limited to 'src/fakerw')
-rw-r--r-- | src/fakerw/fake.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index f1531490..50d12b2f 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -7,6 +7,9 @@ #include <rpskin.h> #include <assert.h> #include <string.h> +#ifndef _WIN32 +#include "crossplatform.h" +#endif using namespace rw; @@ -371,8 +374,24 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v StreamFile fakefile; file = rwNewT(StreamFile, 1, 0); memcpy(file, &fakefile, sizeof(StreamFile)); +#ifndef _WIN32 + // Be case-insensitive and fix backslashes (from https://github.com/OneSadCookie/fcaseopen/) + FILE* first = fopen((char*)pData, "r"); + char *r; + if (!first) { + r = (char*)alloca(strlen((char*)pData) + 2); + // Use default path(and pass error handling to librw) if we can't find any match + if (!casepath((char*)pData, r)) + r = (char*)pData; + } else + fclose(first); + + if(file->open((char*)r, mode)) + return file; +#else if(file->open((char*)pData, mode)) return file; +#endif rwFree(file); return nil; } |