* move melon_fopen_local() to Platform.cpp

* make it require that the file already exist (hopefully fixing config saving bug)
* finally axe melon_fopen.cpp
This commit is contained in:
Arisotura
2019-03-27 13:34:26 +01:00
parent 6d7e80b677
commit f08b87b41f
11 changed files with 207 additions and 235 deletions

View File

@ -26,7 +26,36 @@ namespace Platform
void StopEmu();
FILE* OpenFile(const char* path, const char* mode);
// fopen() wrappers
// * OpenFile():
// simple fopen() wrapper that supports UTF8.
// can be optionally restricted to only opening a file that already exists.
// * OpenLocalFile():
// opens files local to the emulator (melonDS.ini, BIOS, firmware, ...)
// checks, by order of priority:
// * current working directory
// * emulator directory (essentially where the melonDS executable is) if supported
// * any platform-specific application data directories
// requires that the file already exist.
FILE* OpenFile(const char* path, const char* mode, bool mustexist=false);
FILE* OpenLocalFile(const char* path, const char* mode);
inline bool FileExists(const char* name)
{
FILE* f = OpenFile(name, "rb");
if (!f) return false;
fclose(f);
return true;
}
inline bool LocalFileExists(const char* name)
{
FILE* f = OpenLocalFile(name, "rb");
if (!f) return false;
fclose(f);
return true;
}
void* Thread_Create(void (*func)());
void Thread_Free(void* thread);