fail gracefully if BIOS/firmware are missing
This commit is contained in:
parent
d8ca8e8300
commit
c2fa561e40
|
@ -85,12 +85,36 @@ int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdsho
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
|
|
||||||
|
|
||||||
|
bool _fileexists(char* name)
|
||||||
|
{
|
||||||
|
FILE* f = fopen(name, "rb");
|
||||||
|
if (!f) return false;
|
||||||
|
fclose(f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxApp_melonDS::OnInit()
|
bool wxApp_melonDS::OnInit()
|
||||||
{
|
{
|
||||||
printf("melonDS " MELONDS_VERSION "\n" MELONDS_URL "\n");
|
printf("melonDS " MELONDS_VERSION "\n" MELONDS_URL "\n");
|
||||||
|
|
||||||
Config::Load();
|
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();
|
emuthread = new EmuThread();
|
||||||
if (emuthread->Run() != wxTHREAD_NO_ERROR)
|
if (emuthread->Run() != wxTHREAD_NO_ERROR)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue