A bit of cleanup to Core Init/Stop, Frame, and Main. Cleanup XAudio2 to attempt to fix the crash on stop(didn't help :p). For some reason CFrame::DoStop is called twice.(might be the issue)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7353 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-03-15 23:09:12 +00:00
parent e77059d30c
commit 41c98f982e
31 changed files with 618 additions and 763 deletions

View File

@ -151,35 +151,31 @@ CPanel::CPanel(
case WIIMOTE_DISCONNECT:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
if (main_frame->bNoWiimoteMsg)
main_frame->bNoWiimoteMsg = false;
const int wiimote_idx = lParam;
const int wiimote_num = wiimote_idx + 1;
//Auto reconnect if option is turned on.
//TODO: Make this only auto reconnect wiimotes that have the option activated.
SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings.
if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx])
{
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num);
}
else
{
int wiimote_idx = lParam;
int wiimote_num = wiimote_idx + 1;
//Auto reconnect if option is turned on.
//TODO: Make this only auto reconnect wiimotes that have the option activated.
SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings.
if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx])
{
// The Wiimote has been disconnected, we offer reconnect here.
wxMessageDialog *dlg = new wxMessageDialog(
this,
wxString::Format(_("Wiimote %i has been disconnected by system.\nMaybe this game doesn't support multi-wiimote,\nor maybe it is due to idle time out or other reason.\nDo you want to reconnect immediately?"), wiimote_num),
_("Reconnect Wiimote Confirm"),
wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION,
wxDefaultPosition);
if (dlg->ShowModal() == wxID_YES)
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num);
}
else
{
// The Wiimote has been disconnected, we offer reconnect here.
wxMessageDialog *dlg = new wxMessageDialog(
this,
wxString::Format(_("Wiimote %i has been disconnected by system.\nMaybe this game doesn't support multi-wiimote,\nor maybe it is due to idle time out or other reason.\nDo you want to reconnect immediately?"), wiimote_num),
_("Reconnect Wiimote Confirm"),
wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION,
wxDefaultPosition);
if (dlg->ShowModal() == wxID_YES)
GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true);
dlg->Destroy();
}
dlg->Destroy();
}
}
}
@ -341,7 +337,6 @@ CFrame::CFrame(wxFrame* parent,
long style)
: CRenderFrame(parent, id, title, pos, size, style)
, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
, bRenderToMain(false), bNoWiimoteMsg(false)
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, m_GameListCtrl(NULL), m_Panel(NULL)
, m_RenderFrame(NULL), m_RenderParent(NULL)
@ -602,22 +597,10 @@ void CFrame::OnResize(wxSizeEvent& event)
#ifdef _WIN32
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
switch (nMsg)
{
case WM_SYSCOMMAND:
switch (wParam & 0xFFF0)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
break;
default:
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
break;
default:
if (WM_SYSCOMMAND == nMsg && (SC_SCREENSAVE == wParam || SC_MONITORPOWER == wParam))
return 0;
else
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
return 0;
}
#endif
@ -887,7 +870,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
DoStop();
// Screenshot hotkey
else if (IsHotkey(event, HK_SCREENSHOT))
Core::ScreenShot();
Core::SaveScreenShot();
// Wiimote connect and disconnect hotkeys
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
WiimoteId = 0;

View File

@ -88,265 +88,265 @@ class CRenderFrame : public wxFrame
class CFrame : public CRenderFrame
{
public:
CFrame(wxFrame* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
bool _UseDebugger = false,
bool _BatchMode = false,
bool ShowLogWindow = false,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
public:
CFrame(wxFrame* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Dolphin"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
bool _UseDebugger = false,
bool _BatchMode = false,
bool ShowLogWindow = false,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~CFrame();
virtual ~CFrame();
void* GetRenderHandle()
{
#ifdef _WIN32
return (void *)m_RenderParent->GetHandle();
#elif defined(HAVE_X11) && HAVE_X11
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
#else
return m_RenderParent;
#endif
}
void* GetRenderHandle()
{
#ifdef _WIN32
return (void *)m_RenderParent->GetHandle();
#elif defined(HAVE_X11) && HAVE_X11
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
#else
return m_RenderParent;
#endif
}
// These have to be public
CCodeWindow* g_pCodeWindow;
NetPlaySetupDiag* g_NetPlaySetupDiag;
wxCheatsWindow* g_CheatsWindow;
void InitBitmaps();
void DoPause();
void DoStop();
void DoRecordingSave();
bool bRenderToMain;
bool bNoWiimoteMsg;
void UpdateGUI();
void UpdateGameList();
void ToggleLogWindow(bool bShow);
void ToggleLogConfigWindow(bool bShow);
void ToggleConsole(bool bShow);
void PostEvent(wxCommandEvent& event);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
void GetRenderWindowSize(int& x, int& y, int& width, int& height);
void OnRenderWindowSizeRequest(int width, int height);
void BootGame(const std::string& filename);
void OnRenderParentClose(wxCloseEvent& event);
void OnRenderParentMove(wxMoveEvent& event);
bool RendererHasFocus();
void DoFullscreen(bool bF);
void ToggleDisplayMode (bool bFullscreen);
static void ConnectWiimote(int wm_idx, bool connect);
// These have to be public
CCodeWindow* g_pCodeWindow;
NetPlaySetupDiag* g_NetPlaySetupDiag;
wxCheatsWindow* g_CheatsWindow;
const CGameListCtrl *GetGameListCtrl() const;
void InitBitmaps();
void DoPause();
void DoStop();
void DoRecordingSave();
void UpdateGUI();
void UpdateGameList();
void ToggleLogWindow(bool bShow);
void ToggleLogConfigWindow(bool bShow);
void ToggleConsole(bool bShow);
void PostEvent(wxCommandEvent& event);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
void GetRenderWindowSize(int& x, int& y, int& width, int& height);
void OnRenderWindowSizeRequest(int width, int height);
void BootGame(const std::string& filename);
void OnRenderParentClose(wxCloseEvent& event);
void OnRenderParentMove(wxMoveEvent& event);
bool RendererHasFocus();
void DoFullscreen(bool bF);
void ToggleDisplayMode (bool bFullscreen);
static void ConnectWiimote(int wm_idx, bool connect);
#ifdef __WXGTK__
Common::Event panic_event;
bool bPanicResult;
std::recursive_mutex keystate_lock;
#endif
const CGameListCtrl *GetGameListCtrl() const;
#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *m_XRRConfig;
#endif
#ifdef __WXGTK__
Common::Event panic_event;
bool bPanicResult;
std::mutex keystate_lock;
#endif
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *m_XRRConfig;
#endif
// Perspectives (Should find a way to make all of this private)
void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true);
struct SPerspectives
{
std::string Name;
wxString Perspective;
std::vector<int> Width, Height;
};
std::vector<SPerspectives> Perspectives;
u32 ActivePerspective;
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
private:
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
CRenderFrame* m_RenderFrame;
wxPanel* m_RenderParent;
CLogWindow* m_LogWindow;
LogConfigWindow* m_LogConfigWindow;
bool UseDebugger;
bool m_bBatchMode;
bool m_bEdit;
bool m_bTabSplit;
bool m_bNoDocking;
bool m_bGameLoading;
// Perspectives (Should find a way to make all of this private)
void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true);
struct SPerspectives
{
std::string Name;
wxString Perspective;
std::vector<int> Width, Height;
};
std::vector<SPerspectives> Perspectives;
u32 ActivePerspective;
std::vector<std::string> drives;
private:
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
CRenderFrame* m_RenderFrame;
wxPanel* m_RenderParent;
CLogWindow* m_LogWindow;
LogConfigWindow* m_LogConfigWindow;
bool UseDebugger;
bool m_bBatchMode;
bool m_bEdit;
bool m_bTabSplit;
bool m_bNoDocking;
bool m_bGameLoading;
enum EToolbar
{
Toolbar_FileOpen,
Toolbar_Refresh,
Toolbar_Browse,
Toolbar_Play,
Toolbar_Stop,
Toolbar_Pause,
Toolbar_Screenshot,
Toolbar_FullScreen,
Toolbar_ConfigMain,
Toolbar_ConfigGFX,
Toolbar_ConfigDSP,
Toolbar_ConfigPAD,
Toolbar_Wiimote,
Toolbar_Help,
EToolbar_Max
};
std::vector<std::string> drives;
enum EBitmapsThemes
{
BOOMY,
VISTA,
XPLASTIK,
KDE,
THEMES_MAX
};
enum EToolbar
{
Toolbar_FileOpen,
Toolbar_Refresh,
Toolbar_Browse,
Toolbar_Play,
Toolbar_Stop,
Toolbar_Pause,
Toolbar_Screenshot,
Toolbar_FullScreen,
Toolbar_ConfigMain,
Toolbar_ConfigGFX,
Toolbar_ConfigDSP,
Toolbar_ConfigPAD,
Toolbar_Wiimote,
Toolbar_Help,
EToolbar_Max
};
wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max];
enum EBitmapsThemes
{
BOOMY,
VISTA,
XPLASTIK,
KDE,
THEMES_MAX
};
void PopulateToolbar(wxAuiToolBar* toolBar);
void PopulateToolbarAui(wxAuiToolBar* toolBar);
void RecreateToolbar();
void CreateMenu();
wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max];
// Utility
wxString GetMenuLabel(int Id);
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32 NBId);
int GetNotebookCount();
wxAuiNotebook *CreateEmptyNotebook();
void PopulateToolbar(wxAuiToolBar* toolBar);
void PopulateToolbarAui(wxAuiToolBar* toolBar);
void RecreateToolbar();
void CreateMenu();
// Perspectives
void AddRemoveBlankPage();
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
void OnFloatWindow(wxCommandEvent& event);
void ToggleFloatWindow(int Id);
void OnTab(wxAuiNotebookEvent& event);
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void CloseAllNotebooks();
void TogglePane();
void SetPaneSize();
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);
void ToggleNotebookStyle(bool On, long Style);
void ResizeConsole();
// Float window
void DoUnfloatPage(int Id);
void OnFloatingPageClosed(wxCloseEvent& event);
void OnFloatingPageSize(wxSizeEvent& event);
void DoFloatNotebookPage(wxWindowID Id);
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
const wxString& title = wxT(""),
wxWindow * = NULL);
wxString AuiFullscreen, AuiCurrent;
void AddPane();
void UpdateCurrentPerspective();
void SaveIniPerspectives();
void LoadIniPerspectives();
void OnPaneClose(wxAuiManagerEvent& evt);
void ReloadPanes();
void DoLoadPerspective();
void OnDropDownToolbarSelect(wxCommandEvent& event);
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
void OnSelectPerspective(wxCommandEvent& event);
// Utility
wxString GetMenuLabel(int Id);
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32 NBId);
int GetNotebookCount();
wxAuiNotebook *CreateEmptyNotebook();
// Perspectives
void AddRemoveBlankPage();
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
void OnFloatWindow(wxCommandEvent& event);
void ToggleFloatWindow(int Id);
void OnTab(wxAuiNotebookEvent& event);
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void CloseAllNotebooks();
void TogglePane();
void SetPaneSize();
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);
void ToggleNotebookStyle(bool On, long Style);
void ResizeConsole();
// Float window
void DoUnfloatPage(int Id);
void OnFloatingPageClosed(wxCloseEvent& event);
void OnFloatingPageSize(wxSizeEvent& event);
void DoFloatNotebookPage(wxWindowID Id);
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
const wxString& title = wxT(""),
wxWindow * = NULL);
wxString AuiFullscreen, AuiCurrent;
void AddPane();
void UpdateCurrentPerspective();
void SaveIniPerspectives();
void LoadIniPerspectives();
void OnPaneClose(wxAuiManagerEvent& evt);
void ReloadPanes();
void DoLoadPerspective();
void OnDropDownToolbarSelect(wxCommandEvent& event);
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
void OnSelectPerspective(wxCommandEvent& event);
#ifdef _WIN32
// Override window proc for tricks like screensaver disabling
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
// Override window proc for tricks like screensaver disabling
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
#endif
// Event functions
void OnQuit(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnToolBar(wxCommandEvent& event);
void OnAuiToolBar(wxAuiToolBarEvent& event);
// Event functions
void OnQuit(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnToolBar(wxCommandEvent& event);
void OnAuiToolBar(wxAuiToolBarEvent& event);
void OnOpen(wxCommandEvent& event); // File menu
void DoOpen(bool Boot);
void OnRefresh(wxCommandEvent& event);
void OnBrowse(wxCommandEvent& event);
void OnBootDrive(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event); // File menu
void DoOpen(bool Boot);
void OnRefresh(wxCommandEvent& event);
void OnBrowse(wxCommandEvent& event);
void OnBootDrive(wxCommandEvent& event);
void OnPlay(wxCommandEvent& event); // Emulation
void OnStop(wxCommandEvent& event);
void OnReset(wxCommandEvent& event);
void OnRecord(wxCommandEvent& event);
void OnPlayRecording(wxCommandEvent& event);
void OnRecordExport(wxCommandEvent& event);
void OnRecordReadOnly(wxCommandEvent& event);
void OnChangeDisc(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnActive(wxActivateEvent& event);
void OnClose(wxCloseEvent &event);
void OnLoadState(wxCommandEvent& event);
void OnSaveState(wxCommandEvent& event);
void OnLoadStateFromFile(wxCommandEvent& event);
void OnSaveStateToFile(wxCommandEvent& event);
void OnLoadLastState(wxCommandEvent& event);
void OnUndoLoadState(wxCommandEvent& event);
void OnUndoSaveState(wxCommandEvent& event);
void OnPlay(wxCommandEvent& event); // Emulation
void OnStop(wxCommandEvent& event);
void OnReset(wxCommandEvent& event);
void OnRecord(wxCommandEvent& event);
void OnPlayRecording(wxCommandEvent& event);
void OnRecordExport(wxCommandEvent& event);
void OnRecordReadOnly(wxCommandEvent& event);
void OnChangeDisc(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnActive(wxActivateEvent& event);
void OnClose(wxCloseEvent &event);
void OnLoadState(wxCommandEvent& event);
void OnSaveState(wxCommandEvent& event);
void OnLoadStateFromFile(wxCommandEvent& event);
void OnSaveStateToFile(wxCommandEvent& event);
void OnLoadLastState(wxCommandEvent& event);
void OnUndoLoadState(wxCommandEvent& event);
void OnUndoSaveState(wxCommandEvent& event);
void OnFrameSkip(wxCommandEvent& event);
void OnFrameStep(wxCommandEvent& event);
void OnFrameSkip(wxCommandEvent& event);
void OnFrameStep(wxCommandEvent& event);
void OnConfigMain(wxCommandEvent& event); // Options
void OnConfigGFX(wxCommandEvent& event);
void OnConfigDSP(wxCommandEvent& event);
void OnConfigPAD(wxCommandEvent& event);
void OnConfigWiimote(wxCommandEvent& event);
void OnConfigHotkey(wxCommandEvent& event);
void OnConfigMain(wxCommandEvent& event); // Options
void OnConfigGFX(wxCommandEvent& event);
void OnConfigDSP(wxCommandEvent& event);
void OnConfigPAD(wxCommandEvent& event);
void OnConfigWiimote(wxCommandEvent& event);
void OnConfigHotkey(wxCommandEvent& event);
void OnToggleFullscreen(wxCommandEvent& event);
void OnToggleDualCore(wxCommandEvent& event);
void OnToggleSkipIdle(wxCommandEvent& event);
void OnToggleThrottle(wxCommandEvent& event);
void OnManagerResize(wxAuiManagerEvent& event);
void OnMove(wxMoveEvent& event);
void OnResize(wxSizeEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void DoToggleToolbar(bool);
void OnToggleStatusbar(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnToggleFullscreen(wxCommandEvent& event);
void OnToggleDualCore(wxCommandEvent& event);
void OnToggleSkipIdle(wxCommandEvent& event);
void OnToggleThrottle(wxCommandEvent& event);
void OnManagerResize(wxAuiManagerEvent& event);
void OnMove(wxMoveEvent& event);
void OnResize(wxSizeEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void DoToggleToolbar(bool);
void OnToggleStatusbar(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event); // Keyboard
void OnKeyUp(wxKeyEvent& event);
void OnKeyDown(wxKeyEvent& event); // Keyboard
void OnKeyUp(wxKeyEvent& event);
void OnMouse(wxMouseEvent& event); // Mouse
void OnMouse(wxMouseEvent& event); // Mouse
void OnHostMessage(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event);
void OnMemcard(wxCommandEvent& event); // Misc
void OnImportSave(wxCommandEvent& event);
void OnMemcard(wxCommandEvent& event); // Misc
void OnImportSave(wxCommandEvent& event);
void OnNetPlay(wxCommandEvent& event);
void OnNetPlay(wxCommandEvent& event);
void OnShow_CheatsWindow(wxCommandEvent& event);
void OnLoadWiiMenu(wxCommandEvent& event);
void OnConnectWiimote(wxCommandEvent& event);
void GameListChanged(wxCommandEvent& event);
void OnShow_CheatsWindow(wxCommandEvent& event);
void OnLoadWiiMenu(wxCommandEvent& event);
void OnConnectWiimote(wxCommandEvent& event);
void GameListChanged(wxCommandEvent& event);
void OnGameListCtrl_ItemActivated(wxListEvent& event);
void OnRenderParentResize(wxSizeEvent& event);
bool RendererIsFullscreen();
void StartGame(const std::string& filename);
void OnGameListCtrl_ItemActivated(wxListEvent& event);
void OnRenderParentResize(wxSizeEvent& event);
bool RendererIsFullscreen();
void StartGame(const std::string& filename);
// Event table
DECLARE_EVENT_TABLE();
// Event table
DECLARE_EVENT_TABLE();
};
int GetCmdForHotkey(unsigned int key);

View File

@ -922,6 +922,8 @@ void CFrame::StartGame(const std::string& filename)
m_RenderFrame->Show();
}
wxBeginBusyCursor();
if (!BootManager::BootCore(filename))
{
// Destroy the renderer frame when not rendering to main
@ -971,6 +973,8 @@ void CFrame::StartGame(const std::string& filename)
wxSizeEventHandler(CFrame::OnRenderParentResize),
(wxObject*)0, this);
}
wxEndBusyCursor();
}
void CFrame::OnBootDrive(wxCommandEvent& event)
@ -978,7 +982,6 @@ void CFrame::OnBootDrive(wxCommandEvent& event)
BootGame(drives[event.GetId()-IDM_DRIVE1]);
}
// Refresh the file list and browse for a favorites directory
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
{
@ -994,7 +997,7 @@ void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
// Create screenshot
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
{
Core::ScreenShot();
Core::SaveScreenShot();
}
// Pause the emulation
@ -1048,7 +1051,9 @@ void CFrame::DoStop()
if(Frame::IsPlayingInput() || Frame::IsRecordingInput())
Frame::EndPlayInput(false);
wxBeginBusyCursor();
BootManager::Stop();
wxEndBusyCursor();
#if defined(HAVE_XDG_SCREENSAVER) && HAVE_XDG_SCREENSAVER
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
@ -1353,7 +1358,7 @@ void CFrame::OnLoadWiiMenu(wxCommandEvent& event)
void CFrame::ConnectWiimote(int wm_idx, bool connect)
{
if (Core::isRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
if (Core::IsRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
@ -1461,7 +1466,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
void CFrame::UpdateGUI()
{
// Save status
bool Initialized = Core::isRunning();
bool Initialized = Core::IsRunning();
bool Running = Core::GetState() == Core::CORE_RUN;
bool Paused = Core::GetState() == Core::CORE_PAUSE;

View File

@ -51,10 +51,6 @@
IMPLEMENT_APP(DolphinApp)
BEGIN_EVENT_TABLE(DolphinApp, wxApp)
EVT_TIMER(wxID_ANY, DolphinApp::AfterInit)
END_EVENT_TABLE()
#include <wx/stdpaths.h>
bool wxMsgAlert(const char*, const char*, bool, int);
std::string wxStringTranslator(const char *);
@ -325,12 +321,6 @@ bool DolphinApp::OnInit()
SetTopWindow(main_frame);
main_frame->SetMinSize(wxSize(400, 300));
// Postpone final actions until event handler is running.
// Updating the game list makes use of wxProgressDialog which may
// only be run after OnInit() when the event handler is running.
m_afterinit = new wxTimer(this, wxID_ANY);
m_afterinit->Start(1, wxTIMER_ONE_SHOT);
return true;
}
@ -339,15 +329,12 @@ void DolphinApp::MacOpenFile(const wxString &fileName)
FileToLoad = fileName;
LoadFile = true;
if (m_afterinit == NULL)
if (IsMainLoopRunning())
main_frame->BootGame(std::string(FileToLoad.mb_str()));
}
void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
int DolphinApp::MainLoop()
{
delete m_afterinit;
m_afterinit = NULL;
if (!BatchMode)
main_frame->UpdateGameList();
@ -375,6 +362,8 @@ void DolphinApp::AfterInit(wxTimerEvent& WXUNUSED(event))
}
}
}
return wxApp::MainLoop();
}
void DolphinApp::InitLanguageSupport()
@ -582,7 +571,7 @@ void Host_UpdateBreakPointView()
bool Host_GetKeyState(int keycode)
{
#ifdef _WIN32
return GetAsyncKeyState(keycode);
return (0 != GetAsyncKeyState(keycode));
#elif defined __WXGTK__
std::unique_lock<std::recursive_mutex> lk(main_frame->keystate_lock, std::try_to_lock);
if (!lk.owns_lock())
@ -627,14 +616,6 @@ void Host_SetStartupDebuggingParameters()
StartUp.bEnableDebugging = main_frame->g_pCodeWindow ? true : false; // RUNNING_DEBUG
}
void Host_SetWaitCursor(bool enable)
{
if (enable)
wxBeginBusyCursor();
else
wxEndBusyCursor();
}
void Host_UpdateStatusBar(const char* _pText, int Field)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);

View File

@ -35,15 +35,12 @@ private:
void InitLanguageSupport();
void MacOpenFile(const wxString &fileName);
DECLARE_EVENT_TABLE()
wxTimer *m_afterinit;
bool BatchMode;
bool LoadFile;
wxString FileToLoad;
wxLocale *m_locale;
void AfterInit(wxTimerEvent& WXUNUSED(event));
int MainLoop();
};
DECLARE_APP(DolphinApp);

View File

@ -146,7 +146,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// If a game from the game list is running, show the game specific config; show the default config otherwise
cur_profile = 0;
if (Core::isRunning())
if (Core::IsRunning())
{
// Search which ISO has been started
for (long index = GameListCtrl->GetNextItem(-1); index != -1; index = GameListCtrl->GetNextItem(index))
@ -196,7 +196,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
profile_cb->Select(cur_profile);
_connect_macro_(profile_cb, VideoConfigDiag::Event_OnProfileChange, wxEVT_COMMAND_CHOICE_SELECTED, this);
profile_cb->Enable(!Core::isRunning());
profile_cb->Enable(!Core::IsRunning());
// adapter // for D3D only
if (vconfig.backend_info.Adapters.size())
@ -545,7 +545,7 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
// If emulation hasn't started, yet, always update g_Config.
// Otherwise only update it if we're editing the currently running game's profile
if (!Core::isRunning())
if (!Core::IsRunning())
{
g_Config = vconfig;
}