2013-04-17 21:43:35 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2009-01-02 18:38:44 -07:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
#ifndef __FRAME_H_
|
|
|
|
#define __FRAME_H_
|
|
|
|
|
2009-01-04 14:53:41 -07:00
|
|
|
#include <wx/wx.h> // wxWidgets
|
2008-12-07 21:46:09 -07:00
|
|
|
#include <wx/busyinfo.h>
|
2009-01-04 14:53:41 -07:00
|
|
|
#include <wx/mstream.h>
|
2009-03-20 12:25:36 -06:00
|
|
|
#include <wx/listctrl.h>
|
2009-08-26 03:19:15 -06:00
|
|
|
#include <wx/artprov.h>
|
2009-08-24 19:50:27 -06:00
|
|
|
#include <wx/aui/aui.h>
|
2011-04-20 09:25:21 -06:00
|
|
|
#include <wx/tooltip.h>
|
2010-02-16 01:46:21 -07:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2009-05-13 16:23:54 -06:00
|
|
|
|
2013-03-31 10:08:29 -06:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#endif
|
|
|
|
|
2009-02-24 08:04:12 -07:00
|
|
|
#include "CDUtils.h"
|
2011-02-12 23:06:32 -07:00
|
|
|
#include "Debugger/CodeWindow.h"
|
2009-08-31 17:09:50 -06:00
|
|
|
#include "LogWindow.h"
|
2011-02-21 08:01:00 -07:00
|
|
|
#include "LogConfigWindow.h"
|
2011-06-24 00:50:50 -06:00
|
|
|
#include "TASInputDlg.h"
|
|
|
|
#include "Movie.h"
|
2010-04-11 19:33:10 -06:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2010-04-21 22:28:34 -06:00
|
|
|
#include "X11Utils.h"
|
2010-04-11 19:33:10 -06:00
|
|
|
#endif
|
2009-05-13 16:23:54 -06:00
|
|
|
|
2009-01-04 14:53:41 -07:00
|
|
|
// A shortcut to access the bitmaps
|
|
|
|
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
|
2011-02-05 09:06:05 -07:00
|
|
|
static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
|
2009-01-04 14:53:41 -07:00
|
|
|
{
|
|
|
|
wxMemoryInputStream is(data, length);
|
|
|
|
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Class declarations
|
2008-12-07 21:46:09 -07:00
|
|
|
class CGameListCtrl;
|
2011-02-13 15:36:12 -07:00
|
|
|
class GameListItem;
|
2009-08-31 17:09:50 -06:00
|
|
|
class CLogWindow;
|
2011-03-26 20:55:08 -06:00
|
|
|
class FifoPlayerDlg;
|
2011-02-26 19:27:43 -07:00
|
|
|
class NetPlaySetupDiag;
|
|
|
|
class wxCheatsWindow;
|
2009-06-18 02:22:02 -06:00
|
|
|
|
2011-02-02 09:34:12 -07:00
|
|
|
// The CPanel class to receive MSWWindowProc messages from the video backend.
|
2010-04-11 19:33:10 -06:00
|
|
|
class CPanel : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CPanel(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id = wxID_ANY
|
|
|
|
);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Receive WndProc messages
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2010-04-14 21:25:35 -06:00
|
|
|
class CRenderFrame : public wxFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CRenderFrame(wxFrame* parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& title = wxT("Dolphin"),
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
|
|
|
|
|
|
|
|
private:
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Receive WndProc messages
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
class CFrame : public CRenderFrame
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
2011-03-15 17:09:12 -06:00
|
|
|
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();
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2013-04-07 23:16:50 -06:00
|
|
|
// These have to be public
|
2011-03-15 17:09:12 -06:00
|
|
|
CCodeWindow* g_pCodeWindow;
|
|
|
|
NetPlaySetupDiag* g_NetPlaySetupDiag;
|
|
|
|
wxCheatsWindow* g_CheatsWindow;
|
2012-11-11 15:38:01 -07:00
|
|
|
TASInputDlg* g_TASInputDlg[4];
|
2013-07-23 18:43:51 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void InitBitmaps();
|
|
|
|
void DoPause();
|
|
|
|
void DoStop();
|
|
|
|
void DoRecordingSave();
|
|
|
|
void UpdateGUI();
|
|
|
|
void UpdateGameList();
|
|
|
|
void ToggleLogWindow(bool bShow);
|
|
|
|
void ToggleLogConfigWindow(bool bShow);
|
2013-04-07 23:16:50 -06:00
|
|
|
void ToggleConsole(bool bShow);
|
2011-03-15 17:09:12 -06:00
|
|
|
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);
|
2011-05-24 13:12:18 -06:00
|
|
|
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=NULL);
|
2011-03-15 17:09:12 -06:00
|
|
|
static void ConnectWiimote(int wm_idx, bool connect);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
const CGameListCtrl *GetGameListCtrl() const;
|
2010-11-10 17:55:06 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
#ifdef __WXGTK__
|
|
|
|
Common::Event panic_event;
|
|
|
|
bool bPanicResult;
|
2011-03-15 19:12:27 -06:00
|
|
|
std::recursive_mutex keystate_lock;
|
2011-03-15 17:09:12 -06:00
|
|
|
#endif
|
2008-12-08 22:37:15 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
|
|
|
X11Utils::XRRConfiguration *m_XRRConfig;
|
|
|
|
#endif
|
2009-08-25 01:05:53 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
// AUI
|
|
|
|
wxAuiManager *m_Mgr;
|
|
|
|
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
|
|
|
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CGameListCtrl* m_GameListCtrl;
|
|
|
|
wxPanel* m_Panel;
|
|
|
|
CRenderFrame* m_RenderFrame;
|
|
|
|
wxPanel* m_RenderParent;
|
|
|
|
CLogWindow* m_LogWindow;
|
|
|
|
LogConfigWindow* m_LogConfigWindow;
|
2011-03-26 20:55:08 -06:00
|
|
|
FifoPlayerDlg* m_FifoPlayerDlg;
|
2011-03-15 17:09:12 -06:00
|
|
|
bool UseDebugger;
|
|
|
|
bool m_bBatchMode;
|
|
|
|
bool m_bEdit;
|
|
|
|
bool m_bTabSplit;
|
|
|
|
bool m_bNoDocking;
|
|
|
|
bool m_bGameLoading;
|
|
|
|
|
|
|
|
std::vector<std::string> drives;
|
|
|
|
|
|
|
|
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,
|
2013-04-07 23:16:50 -06:00
|
|
|
Toolbar_Wiimote,
|
2011-03-15 17:09:12 -06:00
|
|
|
Toolbar_Help,
|
|
|
|
EToolbar_Max
|
|
|
|
};
|
|
|
|
|
|
|
|
wxBitmap m_Bitmaps[EToolbar_Max];
|
|
|
|
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
|
|
|
|
|
|
|
void PopulateToolbar(wxAuiToolBar* toolBar);
|
|
|
|
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
|
|
|
void RecreateToolbar();
|
|
|
|
void CreateMenu();
|
|
|
|
|
|
|
|
// 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();
|
2011-03-22 20:06:40 -06:00
|
|
|
void ShowResizePane();
|
2011-03-15 17:09:12 -06:00
|
|
|
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);
|
2010-07-29 21:51:49 -06:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
#ifdef _WIN32
|
2011-03-15 17:09:12 -06:00
|
|
|
// Override window proc for tricks like screensaver disabling
|
|
|
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
2008-12-07 21:46:09 -07:00
|
|
|
#endif
|
2011-03-15 17:09:12 -06:00
|
|
|
// 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 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);
|
2011-06-24 00:50:50 -06:00
|
|
|
void OnTASInput(wxCommandEvent& event);
|
2012-11-10 19:57:31 -07:00
|
|
|
void OnTogglePauseMovie(wxCommandEvent& event);
|
2012-11-11 15:57:06 -07:00
|
|
|
void OnShowLag(wxCommandEvent& event);
|
2011-03-15 17:09:12 -06:00
|
|
|
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);
|
2012-11-08 00:40:49 -07:00
|
|
|
void OnSaveFirstState(wxCommandEvent& event);
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnUndoLoadState(wxCommandEvent& event);
|
|
|
|
void OnUndoSaveState(wxCommandEvent& event);
|
2013-04-07 23:16:50 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnFrameSkip(wxCommandEvent& event);
|
|
|
|
void OnFrameStep(wxCommandEvent& event);
|
2013-04-07 23:16:50 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
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 OnKeyDown(wxKeyEvent& event); // Keyboard
|
|
|
|
void OnKeyUp(wxKeyEvent& event);
|
|
|
|
|
|
|
|
void OnMouse(wxMouseEvent& event); // Mouse
|
2013-04-07 23:16:50 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnHostMessage(wxCommandEvent& event);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnMemcard(wxCommandEvent& event); // Misc
|
|
|
|
void OnImportSave(wxCommandEvent& event);
|
2013-08-18 15:59:05 -06:00
|
|
|
void OnExportAllSaves(wxCommandEvent& event);
|
2009-04-15 14:19:25 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnNetPlay(wxCommandEvent& event);
|
2009-05-13 15:50:24 -06:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnShow_CheatsWindow(wxCommandEvent& event);
|
|
|
|
void OnLoadWiiMenu(wxCommandEvent& event);
|
2011-05-07 20:56:09 -06:00
|
|
|
void OnInstallWAD(wxCommandEvent& event);
|
2011-03-26 20:55:08 -06:00
|
|
|
void OnFifoPlayer(wxCommandEvent& event);
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnConnectWiimote(wxCommandEvent& event);
|
|
|
|
void GameListChanged(wxCommandEvent& event);
|
2008-12-23 01:47:37 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
|
|
|
void OnRenderParentResize(wxSizeEvent& event);
|
|
|
|
bool RendererIsFullscreen();
|
|
|
|
void StartGame(const std::string& filename);
|
2009-01-07 02:06:42 -07:00
|
|
|
|
2011-03-15 17:09:12 -06:00
|
|
|
// Event table
|
|
|
|
DECLARE_EVENT_TABLE();
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
2011-02-13 18:18:01 -07:00
|
|
|
int GetCmdForHotkey(unsigned int key);
|
2009-08-30 02:22:05 -06:00
|
|
|
|
2011-12-18 02:15:59 -07:00
|
|
|
void OnAfterLoadCallback();
|
|
|
|
|
2011-06-24 00:50:50 -06:00
|
|
|
// For TASInputDlg
|
|
|
|
void TASManipFunction(SPADStatus *PadStatus, int controllerID);
|
2012-11-11 14:35:08 -07:00
|
|
|
bool TASInputHasFocus();
|
2011-06-24 00:50:50 -06:00
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
#endif // __FRAME_H_
|
2009-12-28 12:34:19 -07:00
|
|
|
|