2008-09-07 20:26:38 +00:00
|
|
|
// Copyright (C) 2003-2008 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "Frame.h"
|
|
|
|
#include "FileUtil.h"
|
|
|
|
|
|
|
|
#include "GameListCtrl.h"
|
|
|
|
#include "BootManager.h"
|
|
|
|
|
|
|
|
#include "Common.h"
|
|
|
|
#include "Config.h"
|
|
|
|
#include "Core.h"
|
|
|
|
#include "State.h"
|
2008-09-23 05:43:52 +00:00
|
|
|
#include "ConfigMain.h"
|
2008-09-07 20:26:38 +00:00
|
|
|
#include "PluginManager.h"
|
|
|
|
#include "MemcardManager.h"
|
2008-10-31 05:40:52 +00:00
|
|
|
#include "AboutDolphin.h"
|
2008-09-07 20:26:38 +00:00
|
|
|
|
|
|
|
#include <wx/mstream.h>
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// resources
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "../resources/Dolphin.c"
|
|
|
|
#include "../resources/toolbar_browse.c"
|
|
|
|
#include "../resources/toolbar_file_open.c"
|
|
|
|
#include "../resources/toolbar_fullscreen.c"
|
|
|
|
#include "../resources/toolbar_help.c"
|
|
|
|
#include "../resources/toolbar_pause.c"
|
|
|
|
#include "../resources/toolbar_play.c"
|
|
|
|
#include "../resources/toolbar_play_dis.c"
|
|
|
|
#include "../resources/toolbar_plugin_dsp.c"
|
|
|
|
#include "../resources/toolbar_plugin_gfx.c"
|
|
|
|
#include "../resources/toolbar_plugin_options.c"
|
|
|
|
#include "../resources/toolbar_plugin_options_dis.c"
|
|
|
|
#include "../resources/toolbar_plugin_pad.c"
|
|
|
|
#include "../resources/toolbar_refresh.c"
|
|
|
|
#include "../resources/toolbar_stop.c"
|
|
|
|
#include "../resources/toolbar_stop_dis.c"
|
|
|
|
};
|
|
|
|
|
|
|
|
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
|
|
|
|
inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
|
|
|
|
{
|
|
|
|
wxMemoryInputStream is(data, length);
|
|
|
|
return(wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static const long TOOLBAR_STYLE = wxTB_FLAT | wxTB_DOCKABLE | wxTB_TEXT;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event tables
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
|
|
|
|
// help button.
|
|
|
|
|
|
|
|
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CFrame, wxFrame)
|
2008-11-05 22:58:26 +00:00
|
|
|
EVT_CLOSE(CFrame::OnClose)
|
2008-09-07 20:26:38 +00:00
|
|
|
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
|
|
|
|
EVT_MENU(wxID_EXIT, CFrame::OnQuit)
|
|
|
|
EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp)
|
|
|
|
EVT_MENU(IDM_HELPGOOGLECODE, CFrame::OnHelp)
|
|
|
|
EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp)
|
|
|
|
EVT_MENU(wxID_REFRESH, CFrame::OnRefresh)
|
|
|
|
EVT_MENU(IDM_PLAY, CFrame::OnPlay)
|
|
|
|
EVT_MENU(IDM_STOP, CFrame::OnStop)
|
2008-09-23 05:43:52 +00:00
|
|
|
EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain)
|
2008-09-07 20:26:38 +00:00
|
|
|
EVT_MENU(IDM_CONFIG_GFX_PLUGIN, CFrame::OnPluginGFX)
|
|
|
|
EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
|
|
|
|
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
|
2008-11-16 20:09:13 +00:00
|
|
|
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote)
|
2008-09-07 20:26:38 +00:00
|
|
|
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
|
|
|
|
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
|
|
|
EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
|
|
|
|
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
|
2008-09-16 20:02:59 +00:00
|
|
|
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
|
2008-09-07 20:26:38 +00:00
|
|
|
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
|
2008-09-11 21:24:49 +00:00
|
|
|
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
|
2008-09-07 20:26:38 +00:00
|
|
|
EVT_MENU(IDM_LOADSLOT1, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT2, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT3, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT4, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT5, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT6, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT7, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT8, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT9, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_LOADSLOT10, CFrame::OnLoadState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT1, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT2, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT3, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT4, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT5, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT6, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT7, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT8, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT9, CFrame::OnSaveState)
|
|
|
|
EVT_MENU(IDM_SAVESLOT10, CFrame::OnSaveState)
|
|
|
|
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// implementation
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
CFrame::CFrame(wxFrame* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style)
|
|
|
|
: wxFrame(parent, id, title, pos, size, style)
|
|
|
|
, m_Panel(NULL)
|
|
|
|
, m_pStatusBar(NULL)
|
|
|
|
, m_pMenuBar(NULL)
|
|
|
|
, m_pBootProcessDialog(NULL)
|
|
|
|
{
|
|
|
|
InitBitmaps();
|
|
|
|
|
|
|
|
// Give it an icon
|
|
|
|
wxIcon IconTemp;
|
|
|
|
IconTemp.CopyFromBitmap(wxGetBitmapFromMemory(dolphin_png));
|
|
|
|
SetIcon(IconTemp);
|
|
|
|
|
|
|
|
// Give it a status line
|
2008-10-30 12:57:35 +00:00
|
|
|
m_pStatusBar = CreateStatusBar(2);
|
|
|
|
int StylesField[] = {wxSB_FLAT, wxSB_FLAT};
|
|
|
|
m_pStatusBar->SetStatusStyles(2, StylesField);
|
2008-09-07 20:26:38 +00:00
|
|
|
CreateMenu();
|
|
|
|
|
2008-10-14 02:56:03 +00:00
|
|
|
// This panel is the parent for rendering and it holds the gamelistctrl
|
|
|
|
m_Panel = new wxPanel(this);
|
2008-09-07 20:26:38 +00:00
|
|
|
|
2008-10-14 02:56:03 +00:00
|
|
|
m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
|
2008-09-07 20:26:38 +00:00
|
|
|
|
2008-10-14 02:56:03 +00:00
|
|
|
sizerPanel = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
sizerPanel->Add(m_GameListCtrl, 2, wxEXPAND);
|
|
|
|
m_Panel->SetSizer(sizerPanel);
|
2008-09-07 20:26:38 +00:00
|
|
|
|
|
|
|
// Create the toolbar
|
|
|
|
RecreateToolbar();
|
2008-10-14 02:56:03 +00:00
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
Show();
|
|
|
|
|
|
|
|
CPluginManager::GetInstance().ScanForPlugins(this);
|
|
|
|
|
2008-11-03 17:18:35 +00:00
|
|
|
//if we are ever going back to optional iso caching:
|
|
|
|
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
|
|
|
|
m_GameListCtrl->Update();
|
2008-10-14 04:32:49 +00:00
|
|
|
//sizerPanel->SetSizeHints(m_Panel);
|
2008-10-14 02:56:03 +00:00
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyDown),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
|
2008-09-28 16:08:48 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
|
|
|
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (nMsg)
|
|
|
|
{
|
|
|
|
case WM_SYSCOMMAND:
|
|
|
|
switch (wParam)
|
|
|
|
{
|
|
|
|
case SC_SCREENSAVE:
|
|
|
|
case SC_MONITORPOWER:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2008-09-07 20:26:38 +00:00
|
|
|
|
|
|
|
void CFrame::CreateMenu()
|
|
|
|
{
|
|
|
|
delete m_pMenuBar;
|
|
|
|
m_pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
|
|
|
|
|
|
|
|
// file menu
|
|
|
|
wxMenu* fileMenu = new wxMenu;
|
|
|
|
fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));
|
|
|
|
fileMenu->Append(wxID_REFRESH, _T("&Refresh"));
|
|
|
|
fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs..."));
|
|
|
|
|
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
fileMenu->Append(wxID_EXIT, _T("E&xit"), _T("Alt+F4"));
|
|
|
|
m_pMenuBar->Append(fileMenu, _T("&File"));
|
|
|
|
|
|
|
|
// emulation menu
|
|
|
|
wxMenu* emulationMenu = new wxMenu;
|
|
|
|
m_pMenuItemPlay = emulationMenu->Append(IDM_PLAY, _T("&Play"));
|
|
|
|
m_pMenuItemStop = emulationMenu->Append(IDM_STOP, _T("&Stop"));
|
|
|
|
emulationMenu->AppendSeparator();
|
|
|
|
wxMenu *saveMenu = new wxMenu;
|
|
|
|
wxMenu *loadMenu = new wxMenu;
|
|
|
|
m_pMenuItemLoad = emulationMenu->AppendSubMenu(saveMenu, _T("&Load State"));
|
|
|
|
m_pMenuItemSave = emulationMenu->AppendSubMenu(loadMenu, _T("Sa&ve State"));
|
|
|
|
for (int i = 1; i < 10; i++) {
|
2008-09-11 21:24:49 +00:00
|
|
|
saveMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
|
|
|
|
loadMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
m_pMenuBar->Append(emulationMenu, _T("&Emulation"));
|
|
|
|
|
|
|
|
// options menu
|
|
|
|
wxMenu* pOptionsMenu = new wxMenu;
|
2008-09-23 05:43:52 +00:00
|
|
|
m_pPluginOptions = pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure..."));
|
2008-09-07 20:26:38 +00:00
|
|
|
pOptionsMenu->AppendSeparator();
|
|
|
|
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&GFX settings"));
|
|
|
|
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings"));
|
|
|
|
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&PAD settings"));
|
|
|
|
pOptionsMenu->AppendSeparator();
|
2008-09-23 05:43:52 +00:00
|
|
|
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
|
2008-09-07 20:26:38 +00:00
|
|
|
m_pMenuBar->Append(pOptionsMenu, _T("&Options"));
|
|
|
|
|
|
|
|
// misc menu
|
|
|
|
wxMenu* miscMenu = new wxMenu;
|
2008-09-11 21:24:49 +00:00
|
|
|
miscMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("View &toolbar"));
|
2008-09-07 20:26:38 +00:00
|
|
|
miscMenu->Check(IDM_TOGGLE_TOOLBAR, true);
|
2008-09-11 21:24:49 +00:00
|
|
|
miscMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("View &statusbar"));
|
|
|
|
miscMenu->Check(IDM_TOGGLE_STATUSBAR, true);
|
|
|
|
miscMenu->AppendSeparator();
|
|
|
|
miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager"));
|
2008-09-07 20:26:38 +00:00
|
|
|
m_pMenuBar->Append(miscMenu, _T("&Misc"));
|
|
|
|
|
|
|
|
// help menu
|
|
|
|
wxMenu* helpMenu = new wxMenu;
|
|
|
|
/*helpMenu->Append(wxID_HELP, _T("&Help"));
|
|
|
|
re-enable when there's something useful to display*/
|
2008-09-11 21:24:49 +00:00
|
|
|
helpMenu->Append(IDM_HELPWEBSITE, _T("Dolphin &web site"));
|
|
|
|
helpMenu->Append(IDM_HELPGOOGLECODE, _T("Dolphin at &Google Code"));
|
2008-09-07 20:26:38 +00:00
|
|
|
helpMenu->AppendSeparator();
|
|
|
|
helpMenu->Append(IDM_HELPABOUT, _T("&About..."));
|
|
|
|
m_pMenuBar->Append(helpMenu, _T("&Help"));
|
|
|
|
|
|
|
|
// Associate the menu bar with the frame
|
|
|
|
SetMenuBar(m_pMenuBar);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::PopulateToolbar(wxToolBar* toolBar)
|
|
|
|
{
|
|
|
|
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
|
|
|
|
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
|
|
|
|
|
|
|
|
toolBar->SetToolBitmapSize(wxSize(w, h));
|
|
|
|
toolBar->AddTool(wxID_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file..."));
|
|
|
|
toolBar->AddTool(wxID_REFRESH, _T("Refresh"), m_Bitmaps[Toolbar_Refresh], _T("Refresh"));
|
|
|
|
toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory..."));
|
|
|
|
toolBar->AddSeparator();
|
2008-09-09 23:34:13 +00:00
|
|
|
m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play"));
|
2008-09-07 20:26:38 +00:00
|
|
|
toolBar->SetToolDisabledBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play_Dis]);
|
|
|
|
toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
|
|
|
|
toolBar->SetToolDisabledBitmap(IDM_STOP, m_Bitmaps[Toolbar_Stop_Dis]);
|
|
|
|
toolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
|
|
|
|
toolBar->AddSeparator();
|
2008-09-23 05:43:52 +00:00
|
|
|
toolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
|
|
|
|
toolBar->SetToolDisabledBitmap(IDM_CONFIG_MAIN, m_Bitmaps[Toolbar_PluginOptions_Dis]);
|
2008-09-07 20:26:38 +00:00
|
|
|
toolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("GFX"), m_Bitmaps[Toolbar_PluginGFX], _T("GFX settings"));
|
|
|
|
toolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
|
|
|
|
toolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("PAD"), m_Bitmaps[Toolbar_PluginPAD], _T("PAD settings"));
|
2008-11-16 20:09:13 +00:00
|
|
|
toolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _T("Wiimote"), m_Bitmaps[Toolbar_PluginPAD], _T("Wiimote settings"));
|
2008-09-07 20:26:38 +00:00
|
|
|
toolBar->AddSeparator();
|
|
|
|
toolBar->AddTool(IDM_HELPABOUT, _T("About"), m_Bitmaps[Toolbar_Help], _T("About Dolphin"));
|
|
|
|
|
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect
|
|
|
|
// the changes
|
|
|
|
toolBar->Realize();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::RecreateToolbar()
|
|
|
|
{
|
|
|
|
// delete and recreate the toolbar
|
|
|
|
wxToolBarBase* toolBar = GetToolBar();
|
|
|
|
long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;
|
|
|
|
|
|
|
|
delete toolBar;
|
|
|
|
SetToolBar(NULL);
|
|
|
|
|
|
|
|
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP);
|
|
|
|
wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR);
|
|
|
|
|
|
|
|
PopulateToolbar(theToolBar);
|
|
|
|
SetToolBar(theToolBar);
|
2008-09-12 20:08:38 +00:00
|
|
|
UpdateGUI();
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::InitBitmaps()
|
|
|
|
{
|
|
|
|
// load orignal size 48x48
|
|
|
|
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(toolbar_file_open_png);
|
|
|
|
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(toolbar_refresh_png);
|
|
|
|
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(toolbar_browse_png);
|
|
|
|
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(toolbar_play_png);
|
|
|
|
m_Bitmaps[Toolbar_Play_Dis] = wxGetBitmapFromMemory(toolbar_play_dis_png);
|
|
|
|
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(toolbar_stop_png);
|
|
|
|
m_Bitmaps[Toolbar_Stop_Dis] = wxGetBitmapFromMemory(toolbar_stop_dis_png);
|
|
|
|
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png);
|
|
|
|
m_Bitmaps[Toolbar_PluginOptions] = wxGetBitmapFromMemory(toolbar_plugin_options_png);
|
|
|
|
m_Bitmaps[Toolbar_PluginOptions_Dis] = wxGetBitmapFromMemory(toolbar_plugin_options_dis_png);
|
|
|
|
m_Bitmaps[Toolbar_PluginGFX] = wxGetBitmapFromMemory(toolbar_plugin_gfx_png);
|
|
|
|
m_Bitmaps[Toolbar_PluginDSP] = wxGetBitmapFromMemory(toolbar_plugin_dsp_png);
|
|
|
|
m_Bitmaps[Toolbar_PluginPAD] = wxGetBitmapFromMemory(toolbar_plugin_pad_png);
|
|
|
|
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(toolbar_fullscreen_png);
|
|
|
|
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(toolbar_help_png);
|
|
|
|
|
|
|
|
// scale to 24x24 for toolbar
|
|
|
|
for (size_t n = Toolbar_FileOpen; n < WXSIZEOF(m_Bitmaps); n++)
|
|
|
|
{
|
|
|
|
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
return;
|
|
|
|
wxString path = wxFileSelector(
|
|
|
|
_T("Select the file to load"),
|
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
|
|
|
wxString::Format
|
|
|
|
(
|
2008-10-15 21:29:44 +00:00
|
|
|
_T("All GC/Wii files (elf, dol, gcm, iso)|*.elf;*.dol;*.gcm;*.iso;*.gcz|All files (%s)|%s"),
|
2008-09-07 20:26:38 +00:00
|
|
|
wxFileSelectorDefaultWildcardStr,
|
|
|
|
wxFileSelectorDefaultWildcardStr
|
|
|
|
),
|
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
|
|
|
if (!path)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
BootManager::BootCore(std::string(path.ToAscii()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2008-11-05 22:58:26 +00:00
|
|
|
Close(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnClose(wxCloseEvent& event)
|
|
|
|
{
|
|
|
|
// Don't forget the skip of the window won't be destroyed
|
|
|
|
event.Skip();
|
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
Core::Stop();
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnHelp(wxCommandEvent& event)
|
|
|
|
{
|
2008-10-31 05:40:52 +00:00
|
|
|
switch (event.GetId())
|
|
|
|
{
|
2008-09-07 20:26:38 +00:00
|
|
|
case IDM_HELPABOUT:
|
|
|
|
{
|
2008-11-04 09:56:25 +00:00
|
|
|
AboutDolphin frame(this);
|
|
|
|
frame.ShowModal();
|
2008-09-07 20:26:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case IDM_HELPWEBSITE:
|
|
|
|
File::Launch("http://www.dolphin-emu.com/");
|
|
|
|
break;
|
|
|
|
case IDM_HELPGOOGLECODE:
|
|
|
|
File::Launch("http://code.google.com/p/dolphin-emu/");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
if (Core::GetState() == Core::CORE_RUN)
|
|
|
|
{
|
|
|
|
Core::SetState(Core::CORE_PAUSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Core::SetState(Core::CORE_RUN);
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
2008-10-14 02:56:03 +00:00
|
|
|
else if (m_GameListCtrl->GetSelectedISO() != 0)
|
2008-09-11 21:24:49 +00:00
|
|
|
{
|
2008-10-14 02:56:03 +00:00
|
|
|
BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
|
2008-09-11 21:24:49 +00:00
|
|
|
}
|
2008-10-14 02:56:03 +00:00
|
|
|
else if (!SConfig::GetInstance().m_LastFilename.empty() &&
|
|
|
|
wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
2008-09-11 21:24:49 +00:00
|
|
|
{
|
2008-10-14 02:56:03 +00:00
|
|
|
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
|
2008-09-11 21:24:49 +00:00
|
|
|
}
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2008-11-08 06:31:18 +00:00
|
|
|
// Ask for confirmation in case the user accidently clicked Stop
|
2008-11-09 20:55:04 +00:00
|
|
|
int answer = wxMessageBox(wxT("Are you sure you want to stop the current emulation?"),
|
|
|
|
wxT("Confirm"), wxYES_NO);
|
2008-11-08 06:31:18 +00:00
|
|
|
|
|
|
|
if (answer == wxYES && Core::GetState() != Core::CORE_UNINITIALIZED)
|
2008-09-07 20:26:38 +00:00
|
|
|
{
|
|
|
|
Core::Stop();
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
if (m_GameListCtrl)
|
|
|
|
{
|
2008-11-03 17:18:35 +00:00
|
|
|
m_GameListCtrl->Update();
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-23 05:43:52 +00:00
|
|
|
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
2008-09-07 20:26:38 +00:00
|
|
|
{
|
2008-09-23 05:43:52 +00:00
|
|
|
CConfigMain ConfigMain(this);
|
|
|
|
ConfigMain.ShowModal();
|
2008-10-14 02:56:03 +00:00
|
|
|
if (ConfigMain.bRefreshList)
|
2008-11-03 17:18:35 +00:00
|
|
|
m_GameListCtrl->Update();
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CPluginManager::GetInstance().OpenConfig(
|
|
|
|
GetHandle(),
|
2008-09-22 19:48:12 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str()
|
2008-09-07 20:26:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CPluginManager::GetInstance().OpenConfig(
|
|
|
|
GetHandle(),
|
2008-09-22 19:48:12 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
|
2008-09-07 20:26:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CPluginManager::GetInstance().OpenConfig(
|
|
|
|
GetHandle(),
|
2008-09-22 19:48:12 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str()
|
2008-09-07 20:26:38 +00:00
|
|
|
);
|
|
|
|
}
|
2008-11-16 20:09:13 +00:00
|
|
|
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
|
2008-09-13 13:44:06 +00:00
|
|
|
{
|
|
|
|
CPluginManager::GetInstance().OpenConfig(
|
|
|
|
GetHandle(),
|
2008-09-22 19:48:12 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str()
|
2008-09-13 13:44:06 +00:00
|
|
|
);
|
|
|
|
}
|
2008-09-07 20:26:38 +00:00
|
|
|
|
|
|
|
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
m_GameListCtrl->BrowseForDirectory();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CMemcardManager MemcardManager(this);
|
|
|
|
MemcardManager.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnHostMessage(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_UPDATEGUI:
|
|
|
|
UpdateGUI();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDM_BOOTING_STARTED:
|
|
|
|
if (m_pBootProcessDialog == NULL)
|
|
|
|
{
|
|
|
|
/* m_pBootProcessDialog = new wxProgressDialog
|
|
|
|
(_T("Booting the core"),
|
|
|
|
_T("Booting..."),
|
|
|
|
1, // range
|
|
|
|
this,
|
|
|
|
wxPD_APP_MODAL |
|
|
|
|
// wxPD_AUTO_HIDE | -- try this as well
|
|
|
|
wxPD_ELAPSED_TIME |
|
|
|
|
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
|
|
|
);*/
|
|
|
|
|
|
|
|
m_pBootProcessDialog = new wxBusyInfo(wxString::FromAscii("Booting..."), this);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDM_BOOTING_ENDED:
|
|
|
|
if (m_pBootProcessDialog != NULL)
|
|
|
|
{
|
|
|
|
// m_pBootProcessDialog->Destroy();
|
|
|
|
delete m_pBootProcessDialog;
|
|
|
|
m_pBootProcessDialog = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDM_UPDATESTATUSBAR:
|
|
|
|
if (m_pStatusBar != NULL)
|
|
|
|
{
|
2008-10-30 12:57:35 +00:00
|
|
|
m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
ShowFullScreen(true);
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore = !SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2008-09-16 20:02:59 +00:00
|
|
|
void CFrame::OnToggleSkipIdle(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = !SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2008-09-07 20:26:38 +00:00
|
|
|
|
|
|
|
void CFrame::OnLoadState(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_LOADSLOT1 + 1;
|
|
|
|
State_Load(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveState(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_SAVESLOT1 + 1;
|
|
|
|
State_Save(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
wxToolBarBase* toolBar = GetToolBar();
|
|
|
|
|
|
|
|
if (event.IsChecked())
|
|
|
|
{
|
|
|
|
CFrame::RecreateToolbar();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete toolBar;
|
|
|
|
SetToolBar(NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-11 21:24:49 +00:00
|
|
|
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
if (event.IsChecked())
|
|
|
|
{
|
|
|
|
m_pStatusBar = CreateStatusBar();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delete m_pStatusBar;
|
|
|
|
m_pStatusBar = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
void CFrame::OnKeyDown(wxKeyEvent& event)
|
|
|
|
{
|
2008-11-22 16:46:12 +00:00
|
|
|
// Toggle fullscreen from Alt + Enter or Esc
|
2008-09-07 20:26:38 +00:00
|
|
|
if (((event.GetKeyCode() == WXK_RETURN) && (event.GetModifiers() == wxMOD_ALT)) ||
|
|
|
|
(event.GetKeyCode() == WXK_ESCAPE))
|
|
|
|
{
|
|
|
|
ShowFullScreen(!IsFullScreen());
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
2008-11-22 16:46:12 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
else if(event.GetKeyCode() == 'E') // Send this to the video plugin WndProc
|
|
|
|
{
|
|
|
|
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
|
2008-11-24 08:13:31 +00:00
|
|
|
event.Skip();
|
2008-11-22 16:46:12 +00:00
|
|
|
}
|
|
|
|
#endif
|
2008-09-07 20:26:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::UpdateGUI()
|
|
|
|
{
|
|
|
|
// buttons
|
|
|
|
{
|
|
|
|
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
2008-09-23 05:43:52 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_CONFIG_MAIN, true);
|
2008-09-07 20:26:38 +00:00
|
|
|
m_pPluginOptions->Enable(true);
|
|
|
|
|
|
|
|
GetToolBar()->EnableTool(IDM_STOP, false);
|
|
|
|
|
2008-09-12 20:08:38 +00:00
|
|
|
m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
|
2008-09-09 23:34:13 +00:00
|
|
|
m_pToolPlay->SetShortHelp(_T("Play"));
|
|
|
|
m_pToolPlay->SetLabel(_T("Play"));
|
|
|
|
|
2008-09-11 21:24:49 +00:00
|
|
|
m_pMenuItemPlay->SetText(_T("&Play"));
|
2008-09-09 23:34:13 +00:00
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
m_pMenuItemStop->Enable(false);
|
|
|
|
m_pMenuItemLoad->Enable(false);
|
|
|
|
m_pMenuItemSave->Enable(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-23 05:43:52 +00:00
|
|
|
GetToolBar()->EnableTool(IDM_CONFIG_MAIN, false);
|
2008-09-07 20:26:38 +00:00
|
|
|
m_pPluginOptions->Enable(false);
|
|
|
|
|
|
|
|
GetToolBar()->EnableTool(IDM_STOP, true);
|
|
|
|
|
|
|
|
m_pMenuItemStop->Enable(true);
|
|
|
|
m_pMenuItemLoad->Enable(true);
|
|
|
|
m_pMenuItemSave->Enable(true);
|
|
|
|
|
|
|
|
if (Core::GetState() == Core::CORE_RUN)
|
|
|
|
{
|
2008-09-09 23:34:13 +00:00
|
|
|
m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
|
|
|
|
m_pToolPlay->SetShortHelp(_T("Pause"));
|
|
|
|
m_pToolPlay->SetLabel(_T("Pause"));
|
2008-09-07 20:26:38 +00:00
|
|
|
|
2008-09-11 21:24:49 +00:00
|
|
|
m_pMenuItemPlay->SetText(_T("&Pause"));
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-09-09 23:34:13 +00:00
|
|
|
m_pToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
|
|
|
|
m_pToolPlay->SetShortHelp(_T("Play"));
|
|
|
|
m_pToolPlay->SetLabel(_T("Play"));
|
2008-09-07 20:26:38 +00:00
|
|
|
|
2008-09-11 21:24:49 +00:00
|
|
|
m_pMenuItemPlay->SetText(_T("&Play"));
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
2008-09-09 23:34:13 +00:00
|
|
|
GetToolBar()->Realize();
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
2008-09-09 23:34:13 +00:00
|
|
|
|
2008-09-07 20:26:38 +00:00
|
|
|
// gamelistctrl
|
|
|
|
{
|
|
|
|
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
if (m_GameListCtrl && !m_GameListCtrl->IsShown())
|
2008-10-31 05:40:52 +00:00
|
|
|
{
|
|
|
|
m_GameListCtrl->Enable();
|
|
|
|
m_GameListCtrl->Show();
|
2008-10-30 17:10:34 +00:00
|
|
|
sizerPanel->FitInside(m_Panel);
|
2008-09-07 20:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_GameListCtrl && m_GameListCtrl->IsShown())
|
|
|
|
{
|
|
|
|
m_GameListCtrl->Disable();
|
|
|
|
m_GameListCtrl->Hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|