diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-03-27 13:34:26 +0100 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-03-27 13:34:26 +0100 |
commit | f08b87b41f0ffaabd7928d68c41d704e824b5de3 (patch) | |
tree | 8a0548247fbd0a63d4a810d4c1c81bd8444681b3 /src/libui_sdl/main.cpp | |
parent | 6d7e80b67768d1c14792f5da5ff59b739e2109e6 (diff) |
* 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
Diffstat (limited to 'src/libui_sdl/main.cpp')
-rw-r--r-- | src/libui_sdl/main.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 4fc6679..566b346 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -25,7 +25,6 @@ #include "libui/ui.h" #include "../types.h" -#include "../melon_fopen.h" #include "../version.h" #include "PlatformConfig.h" @@ -138,23 +137,6 @@ void GetSavestateName(int slot, char* filename, int len); -bool FileExists(const char* name) -{ - FILE* f = Platform::OpenFile(name, "rb"); - if (!f) return false; - fclose(f); - return true; -} - -bool LocalFileExists(const char* name) -{ - FILE* f = melon_fopen_local(name, "rb"); - if (!f) return false; - fclose(f); - return true; -} - - void MicLoadWav(char* name) { SDL_AudioSpec format; @@ -1077,8 +1059,8 @@ void Run() { char ssfile[1024]; GetSavestateName(i+1, ssfile, 1024); - if (FileExists(ssfile)) uiMenuItemEnable(MenuItem_LoadStateSlot[i]); - else uiMenuItemDisable(MenuItem_LoadStateSlot[i]); + if (Platform::FileExists(ssfile)) uiMenuItemEnable(MenuItem_LoadStateSlot[i]); + else uiMenuItemDisable(MenuItem_LoadStateSlot[i]); } for (int i = 0; i < 9; i++) uiMenuItemEnable(MenuItem_SaveStateSlot[i]); @@ -1210,7 +1192,7 @@ void LoadState(int slot) uiFreeText(file); } - if (!FileExists(filename)) + if (!Platform::FileExists(filename)) { EmuRunning = prevstatus; return; @@ -1752,7 +1734,9 @@ int main(int argc, char** argv) if (Config::AudioVolume < 0) Config::AudioVolume = 0; else if (Config::AudioVolume > 256) Config::AudioVolume = 256; - if (!LocalFileExists("bios7.bin") || !LocalFileExists("bios9.bin") || !LocalFileExists("firmware.bin")) + if (!Platform::LocalFileExists("bios7.bin") || + !Platform::LocalFileExists("bios9.bin") || + !Platform::LocalFileExists("firmware.bin")) { uiMsgBoxError( NULL, @@ -1770,7 +1754,7 @@ int main(int argc, char** argv) } { - FILE* f = melon_fopen_local("romlist.bin", "rb"); + FILE* f = Platform::OpenLocalFile("romlist.bin", "rb"); if (f) { u32 data; |