summaryrefslogtreecommitdiffstats
path: root/src/fakerw
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2020-07-25 22:38:42 +0200
committerFilip Gawin <filip.gawin@zoho.com>2020-07-25 22:38:42 +0200
commit40c09d28f7491d158a8b8a81806d4b84cdf0e031 (patch)
treeb18e9c4b09eed4e0c92c010f6d03cedec136b45c /src/fakerw
parentSmall fixes for linux build (diff)
downloadre3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar.gz
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar.bz2
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar.lz
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar.xz
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.tar.zst
re3-40c09d28f7491d158a8b8a81806d4b84cdf0e031.zip
Diffstat (limited to 'src/fakerw')
-rw-r--r--src/fakerw/fake.cpp30
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"