aboutsummaryrefslogtreecommitdiff
path: root/src/melon_fopen.cpp
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-03-27 04:23:03 +0100
committerArisotura <thetotalworm@gmail.com>2019-03-27 04:23:03 +0100
commit6d7e80b67768d1c14792f5da5ff59b739e2109e6 (patch)
tree34eaabaf36eb9f37861aa7c1a9f962508b283c37 /src/melon_fopen.cpp
parent5d127f9e555faf227a7736f74ae579df6adee41a (diff)
move melon_fopen() to Platform.cpp
melon_fopen_local() will need fixoring
Diffstat (limited to 'src/melon_fopen.cpp')
-rw-r--r--src/melon_fopen.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/melon_fopen.cpp b/src/melon_fopen.cpp
index 7f3e3e7..5e0d03f 100644
--- a/src/melon_fopen.cpp
+++ b/src/melon_fopen.cpp
@@ -32,6 +32,7 @@ extern "C" const GUID DECLSPEC_SELECTANY FOLDERID_RoamingAppData = {0x3eb685db,
#include <glib.h>
#endif
+#include "Platform.h"
extern char* EmuDirectory;
@@ -39,26 +40,6 @@ extern char* EmuDirectory;
-FILE* melon_fopen(const char* path, const char* mode)
-{
- int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
- if (len < 1) return NULL;
- WCHAR* fatass = new WCHAR[len];
- int res = MultiByteToWideChar(CP_UTF8, 0, path, -1, fatass, len);
- if (res != len) { delete[] fatass; return NULL; } // checkme?
-
- // this will be more than enough
- WCHAR fatmode[4];
- fatmode[0] = mode[0];
- fatmode[1] = mode[1];
- fatmode[2] = mode[2];
- fatmode[3] = 0;
-
- FILE* ret = _wfopen(fatass, fatmode);
- delete[] fatass;
- return ret;
-}
-
FILE* melon_fopen_local(const char* fileName, const char* permissions)
{
// Locations are application directory, and AppData/melonDS on windows
@@ -82,7 +63,7 @@ FILE* melon_fopen_local(const char* fileName, const char* permissions)
strncpy(&tmp[dirlen+1], fileName, filelen);
tmp[dirlen+1+filelen] = '\0';
- f = melon_fopen(tmp, permissions);
+ f = Platform::OpenFile(tmp, permissions);
delete[] tmp;
if (f) return f;
}
@@ -132,8 +113,6 @@ FILE* melon_fopen_local(const char* fileName, const char* permissions)
-FILE* melon_fopen(const char* filename, const char* perm) { return fopen(filename, perm); }
-
FILE* melon_fopen_local(const char* fileName, const char* permissions)
{
// Locations are application directory, and XDG_CONFIG_HOME/melonds