diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-06-04 18:36:59 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-06-04 18:36:59 +0200 |
commit | c2fa561e403c755291ce9d70d3fdb6644de2d34c (patch) | |
tree | 16498bada29a00f69080cde1371654dec1ef0715 /src/wx | |
parent | d8ca8e83000b516815dddd55159dcd521e55fb0c (diff) |
fail gracefully if BIOS/firmware are missing
Diffstat (limited to 'src/wx')
-rw-r--r-- | src/wx/main.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/wx/main.cpp b/src/wx/main.cpp index a79861f..6897757 100644 --- a/src/wx/main.cpp +++ b/src/wx/main.cpp @@ -85,11 +85,35 @@ int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdsho #endif // __WXMSW__ +bool _fileexists(char* name) +{ + FILE* f = fopen(name, "rb"); + if (!f) return false; + fclose(f); + return true; +} + + bool wxApp_melonDS::OnInit() { printf("melonDS " MELONDS_VERSION "\n" MELONDS_URL "\n"); Config::Load(); + + if (!_fileexists("bios7.bin") || !_fileexists("bios9.bin") || !_fileexists("firmware.bin")) + { + wxMessageBox( + "One or more of the following required files don't exist or couldn't be accessed:\n\n" + "bios7.bin -- ARM7 BIOS\n" + "bios9.bin -- ARM9 BIOS\n" + "firmware.bin -- firmware image\n\n" + "Place the following files in the directory you run melonDS from.\n" + "Make sure that the files can be accessed.", + "melonDS", + wxICON_ERROR); + + return false; + } emuthread = new EmuThread(); if (emuthread->Run() != wxTHREAD_NO_ERROR) |