From 14ae1d23cf9cc67cf88074420b98ef6a0910b75f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 27 Aug 2015 07:13:08 -0400 Subject: [PATCH] Main: Move unofficial build check to its own function Removes the need to explicitly call exit. --- Source/Core/DolphinWX/Main.cpp | 34 ++++++++++++++++++---------------- Source/Core/DolphinWX/Main.h | 1 + 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Source/Core/DolphinWX/Main.cpp b/Source/Core/DolphinWX/Main.cpp index 07bc456083..a4d223ad95 100644 --- a/Source/Core/DolphinWX/Main.cpp +++ b/Source/Core/DolphinWX/Main.cpp @@ -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) diff --git a/Source/Core/DolphinWX/Main.h b/Source/Core/DolphinWX/Main.h index c0415528ee..005e8c6fc4 100644 --- a/Source/Core/DolphinWX/Main.h +++ b/Source/Core/DolphinWX/Main.h @@ -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;