Main: Move unofficial build check to its own function

Removes the need to explicitly call exit.
This commit is contained in:
Lioncash 2015-08-27 07:13:08 -04:00
parent aafae49d24
commit 14ae1d23cf
2 changed files with 19 additions and 16 deletions

View File

@ -96,7 +96,7 @@ bool DolphinApp::Initialize(int& c, wxChar **v)
bool DolphinApp::OnInit()
{
if (!wxApp::OnInit())
if (!wxApp::OnInit() || DolphinEmulatorDotComTextFileExists())
return false;
Bind(wxEVT_QUERY_END_SESSION, &DolphinApp::OnEndSession, this);
@ -131,20 +131,6 @@ bool DolphinApp::OnInit()
int w = SConfig::GetInstance().iWidth;
int h = SConfig::GetInstance().iHeight;
if (File::Exists("www.dolphin-emulator.com.txt"))
{
File::Delete("www.dolphin-emulator.com.txt");
wxMessageDialog dlg(nullptr, _(
"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please "
"download Dolphin from the official website instead: https://dolphin-emu.org/"),
_("Unofficial version detected"), wxOK | wxICON_WARNING);
dlg.ShowModal();
wxLaunchDefaultBrowser("https://dolphin-emu.org/?ref=badver");
exit(0);
}
// The following is not needed with X11, where window managers
// do not allow windows to be created off the desktop.
#ifdef _WIN32
@ -256,7 +242,6 @@ bool DolphinApp::OnCmdLineParsed(wxCmdLineParser& parser)
return true;
}
#ifdef __APPLE__
void DolphinApp::MacOpenFile(const wxString& fileName)
{
@ -266,6 +251,23 @@ void DolphinApp::MacOpenFile(const wxString& fileName)
}
#endif
bool DolphinApp::DolphinEmulatorDotComTextFileExists()
{
if (!File::Exists("www.dolphin-emulator.com.txt"))
return false;
File::Delete("www.dolphin-emulator.com.txt");
wxMessageDialog dlg(nullptr, _(
"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please "
"download Dolphin from the official website instead: https://dolphin-emu.org/"),
_("Unofficial version detected"), wxOK | wxICON_WARNING);
dlg.ShowModal();
wxLaunchDefaultBrowser("https://dolphin-emu.org/?ref=badver");
return true;
}
void DolphinApp::AfterInit()
{
if (!m_batch_mode)

View File

@ -32,6 +32,7 @@ private:
void OnEndSession(wxCloseEvent& event);
void InitLanguageSupport();
void AfterInit();
static bool DolphinEmulatorDotComTextFileExists();
bool m_batch_mode = false;
bool m_load_file = false;