diff options
Diffstat (limited to '')
-rw-r--r-- | src/fakerw/fake.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 457a6b51..6524e87c 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -858,19 +858,37 @@ RpHAnimHierarchy *RpSkinAtomicGetHAnimHierarchy( const RpAtomic *atomic ) { retu RwImage * RtBMPImageWrite(RwImage *image, const RwChar *imageName) { - char *r = (char *)alloca(strlen((char *)imageName) + 2); - // Use default path(and pass error handling to librw) if we can't find any match - if(!casepath((char *)imageName, r)) r = (char *)imageName; +#ifndef _WIN32 + char *r = nil; + FILE *valid = fopen((char *)imageName, "r"); + if(!valid) { + char *r = (char *)alloca(strlen((char *)imageName) + 2); + // Use default path(and pass error handling to librw) if we can't find any match + if(!casepath((char *)imageName, r)) r = (char *)imageName; + } else + fclose(valid); rw::writeBMP(image, r); +#else + rw::writeBMP(image, imageName); +#endif return image; } RwImage * RtBMPImageRead(const RwChar *imageName) { - char *r = (char *)alloca(strlen((char *)imageName) + 2); - // Use default path(and pass error handling to librw) if we can't find any match - if(!casepath((char *)imageName, r)) r = (char *)imageName; +#ifndef _WIN32 + char *r = nil; + FILE *valid = fopen((char *)imageName, "r"); + if(!valid) { + r = (char *)alloca(strlen((char *)imageName) + 2); + // Use default path(and pass error handling to librw) if we can't find any match + if(!casepath((char *)imageName, r)) r = (char *)imageName; + } else + fclose(valid); return rw::readBMP(r); +#else + return rw::readBMP(imageName); +#endif } #include "rtquat.h" |