2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// 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/
|
|
|
|
|
|
|
|
|
2009-06-28 12:50:51 +00:00
|
|
|
/*
|
2009-06-20 11:05:52 +00:00
|
|
|
1.1 Windows
|
|
|
|
|
2009-05-13 22:23:54 +00:00
|
|
|
CFrame is the main parent window. Inside CFrame there is m_Panel which is the
|
|
|
|
parent for the rendering window (when we render to the main window). In Windows
|
|
|
|
the rendering window is created by giving CreateWindow() m_Panel->GetHandle()
|
|
|
|
as parent window and creating a new child window to m_Panel. The new child
|
|
|
|
window handle that is returned by CreateWindow() can be accessed from
|
|
|
|
Core::GetWindowHandle().
|
2009-06-28 12:50:51 +00:00
|
|
|
*/
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
#include "Setup.h" // Common
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2009-05-13 21:50:24 +00:00
|
|
|
#include "NetWindow.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "Common.h" // Common
|
|
|
|
#include "FileUtil.h"
|
|
|
|
#include "FileSearch.h"
|
|
|
|
#include "Timer.h"
|
2011-01-31 01:28:32 +00:00
|
|
|
#include "VideoBackendBase.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
|
2011-01-31 07:38:36 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
#endif
|
|
|
|
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "Globals.h" // Local
|
2009-02-23 06:15:48 +00:00
|
|
|
#include "Frame.h"
|
|
|
|
#include "ConfigMain.h"
|
|
|
|
#include "MemcardManager.h"
|
|
|
|
#include "CheatsWindow.h"
|
|
|
|
#include "AboutDolphin.h"
|
|
|
|
#include "GameListCtrl.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "BootManager.h"
|
2009-08-31 23:09:50 +00:00
|
|
|
#include "LogWindow.h"
|
2011-02-21 15:01:00 +00:00
|
|
|
#include "LogConfigWindow.h"
|
2011-03-27 02:55:08 +00:00
|
|
|
#include "FifoPlayerDlg.h"
|
2009-06-16 19:10:37 +00:00
|
|
|
#include "WxUtils.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
#include "ConfigManager.h" // Core
|
|
|
|
#include "Core.h"
|
2011-06-24 06:50:50 +00:00
|
|
|
#include "Movie.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "HW/CPU.h"
|
|
|
|
#include "PowerPC/PowerPC.h"
|
|
|
|
#include "HW/DVDInterface.h"
|
|
|
|
#include "HW/ProcessorInterface.h"
|
2010-06-13 09:14:40 +00:00
|
|
|
#include "HW/GCPad.h"
|
2010-10-12 19:42:29 +00:00
|
|
|
#include "HW/Wiimote.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
|
2011-05-09 05:47:29 +00:00
|
|
|
//#include "IPC_HLE/WII_IPC_HLE_Device_FileIO.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
#include "State.h"
|
|
|
|
#include "VolumeHandler.h"
|
|
|
|
#include "NANDContentLoader.h"
|
|
|
|
#include "WXInputBase.h"
|
2010-10-12 19:42:29 +00:00
|
|
|
#include "WiimoteConfigDiag.h"
|
|
|
|
#include "InputConfigDiag.h"
|
2011-02-12 06:46:33 +00:00
|
|
|
#include "HotkeyDlg.h"
|
2011-06-24 06:50:50 +00:00
|
|
|
#include "TASInputDlg.h"
|
2010-06-03 18:05:08 +00:00
|
|
|
|
|
|
|
#include <wx/datetime.h> // wxWidgets
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Resources
|
|
|
|
extern "C" {
|
|
|
|
#include "../resources/Dolphin.c" // Dolphin icon
|
|
|
|
#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_plugin_dsp.c"
|
|
|
|
#include "../resources/toolbar_plugin_gfx.c"
|
|
|
|
#include "../resources/toolbar_plugin_options.c"
|
|
|
|
#include "../resources/toolbar_plugin_pad.c"
|
2010-01-20 10:11:53 +00:00
|
|
|
#include "../resources/toolbar_plugin_wiimote.c"
|
2009-02-23 06:15:48 +00:00
|
|
|
#include "../resources/toolbar_refresh.c"
|
|
|
|
#include "../resources/toolbar_stop.c"
|
|
|
|
#include "../resources/Boomy.h" // Theme packages
|
|
|
|
#include "../resources/Vista.h"
|
|
|
|
#include "../resources/X-Plastik.h"
|
|
|
|
#include "../resources/KDE.h"
|
|
|
|
};
|
|
|
|
|
|
|
|
// Create menu items
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::CreateMenu()
|
|
|
|
{
|
2009-09-03 05:24:30 +00:00
|
|
|
if (GetMenuBar()) GetMenuBar()->Destroy();
|
2009-04-16 02:32:21 +00:00
|
|
|
|
2010-07-24 02:36:22 +00:00
|
|
|
wxMenuBar *m_MenuBar = new wxMenuBar();
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// file menu
|
|
|
|
wxMenu* fileMenu = new wxMenu;
|
2011-02-12 06:46:33 +00:00
|
|
|
fileMenu->Append(wxID_OPEN, GetMenuLabel(HK_OPEN));
|
|
|
|
fileMenu->Append(IDM_CHANGEDISC, GetMenuLabel(HK_CHANGE_DISC));
|
2009-02-24 07:30:10 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
wxMenu *externalDrive = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
fileMenu->Append(IDM_DRIVES, _("&Boot from DVD Drive..."), externalDrive);
|
2009-02-24 15:04:12 +00:00
|
|
|
|
|
|
|
drives = cdio_get_devices();
|
2010-02-16 08:46:21 +00:00
|
|
|
// Windows Limitation of 24 character drives
|
2010-02-24 03:38:36 +00:00
|
|
|
for (unsigned int i = 0; i < drives.size() && i < 24; i++) {
|
2010-02-16 08:46:21 +00:00
|
|
|
externalDrive->Append(IDM_DRIVE1 + i, wxString::FromAscii(drives[i].c_str()));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-02-24 15:04:12 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
fileMenu->AppendSeparator();
|
2011-02-12 06:46:33 +00:00
|
|
|
fileMenu->Append(wxID_REFRESH, GetMenuLabel(HK_REFRESH_LIST));
|
2009-02-23 06:15:48 +00:00
|
|
|
fileMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
fileMenu->Append(IDM_BROWSE, _("&Browse for ISOs..."));
|
2009-02-23 06:15:48 +00:00
|
|
|
fileMenu->AppendSeparator();
|
2011-01-06 13:57:46 +00:00
|
|
|
fileMenu->Append(wxID_EXIT, _("E&xit") + wxString(wxT("\tAlt+F4")));
|
2011-01-05 04:35:46 +00:00
|
|
|
m_MenuBar->Append(fileMenu, _("&File"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Emulation menu
|
|
|
|
wxMenu* emulationMenu = new wxMenu;
|
2010-04-12 01:33:10 +00:00
|
|
|
emulationMenu->Append(IDM_PLAY, GetMenuLabel(HK_PLAY_PAUSE));
|
|
|
|
emulationMenu->Append(IDM_STOP, GetMenuLabel(HK_STOP));
|
2011-02-12 06:46:33 +00:00
|
|
|
emulationMenu->Append(IDM_RESET, GetMenuLabel(HK_RESET));
|
2009-08-21 19:55:03 +00:00
|
|
|
emulationMenu->AppendSeparator();
|
2011-05-24 19:12:18 +00:00
|
|
|
emulationMenu->Append(IDM_TOGGLE_FULLSCREEN, GetMenuLabel(HK_FULLSCREEN));
|
2010-04-12 01:33:10 +00:00
|
|
|
emulationMenu->AppendSeparator();
|
2011-02-12 06:46:33 +00:00
|
|
|
emulationMenu->Append(IDM_RECORD, GetMenuLabel(HK_START_RECORDING));
|
|
|
|
emulationMenu->Append(IDM_PLAYRECORD, GetMenuLabel(HK_PLAY_RECORDING));
|
|
|
|
emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING));
|
|
|
|
emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK);
|
2011-06-24 06:50:50 +00:00
|
|
|
emulationMenu->Append(IDM_TASINPUT, _("TAS Input"));
|
2011-02-12 02:14:20 +00:00
|
|
|
emulationMenu->Check(IDM_RECORDREADONLY, true);
|
2009-08-21 19:55:03 +00:00
|
|
|
emulationMenu->AppendSeparator();
|
|
|
|
|
2011-12-12 05:08:26 +00:00
|
|
|
emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString);
|
2009-08-22 02:05:02 +00:00
|
|
|
|
2009-08-08 01:39:56 +00:00
|
|
|
wxMenu *skippingMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping"));
|
2009-08-08 01:39:56 +00:00
|
|
|
for(int i = 0; i < 10; i++)
|
2011-01-05 04:35:46 +00:00
|
|
|
skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(wxT("%i"), i), wxEmptyString, wxITEM_RADIO);
|
2009-08-08 01:39:56 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
emulationMenu->AppendSeparator();
|
2010-08-08 00:13:05 +00:00
|
|
|
emulationMenu->Append(IDM_SCREENSHOT, GetMenuLabel(HK_SCREENSHOT));
|
2010-07-30 13:14:53 +00:00
|
|
|
|
2009-06-29 09:24:39 +00:00
|
|
|
emulationMenu->AppendSeparator();
|
2009-02-23 06:15:48 +00:00
|
|
|
wxMenu *saveMenu = new wxMenu;
|
|
|
|
wxMenu *loadMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
emulationMenu->Append(IDM_LOADSTATE, _("&Load State"), loadMenu);
|
|
|
|
emulationMenu->Append(IDM_SAVESTATE, _("Sa&ve State"), saveMenu);
|
2009-06-28 01:11:35 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
saveMenu->Append(IDM_SAVESTATEFILE, _("Save State..."));
|
2011-01-06 13:57:46 +00:00
|
|
|
loadMenu->Append(IDM_UNDOSAVESTATE, _("Last Overwritten State") + wxString(wxT("\tShift+F12")));
|
2009-06-28 01:11:35 +00:00
|
|
|
saveMenu->AppendSeparator();
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
loadMenu->Append(IDM_LOADSTATEFILE, _("Load State..."));
|
2010-08-08 06:00:22 +00:00
|
|
|
|
|
|
|
// Reserve F11 for the "step into" function in the debugger
|
|
|
|
if (g_pCodeWindow)
|
2011-01-05 04:35:46 +00:00
|
|
|
loadMenu->Append(IDM_LOADLASTSTATE, _("Last Saved State"));
|
2010-08-08 06:00:22 +00:00
|
|
|
else
|
2011-01-06 13:57:46 +00:00
|
|
|
loadMenu->Append(IDM_LOADLASTSTATE, _("Last Saved State") + wxString(wxT("\tF11")));
|
2010-08-08 06:00:22 +00:00
|
|
|
|
2011-01-06 13:57:46 +00:00
|
|
|
loadMenu->Append(IDM_UNDOLOADSTATE, _("Undo Load State") + wxString(wxT("\tF12")));
|
2009-06-28 01:11:35 +00:00
|
|
|
loadMenu->AppendSeparator();
|
|
|
|
|
2009-06-28 19:47:02 +00:00
|
|
|
for (int i = 1; i <= 8; i++) {
|
2011-02-12 06:46:33 +00:00
|
|
|
loadMenu->Append(IDM_LOADSLOT1 + i - 1, GetMenuLabel(HK_LOAD_STATE_SLOT_1 + i - 1));
|
|
|
|
saveMenu->Append(IDM_SAVESLOT1 + i - 1, GetMenuLabel(HK_SAVE_STATE_SLOT_1 + i - 1));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2011-01-05 04:35:46 +00:00
|
|
|
m_MenuBar->Append(emulationMenu, _("&Emulation"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Options menu
|
|
|
|
wxMenu* pOptionsMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
pOptionsMenu->Append(wxID_PREFERENCES, _("Co&nfigure..."));
|
2009-02-23 06:15:48 +00:00
|
|
|
pOptionsMenu->AppendSeparator();
|
2011-02-14 02:18:03 +00:00
|
|
|
pOptionsMenu->Append(IDM_CONFIG_GFX_BACKEND, _("&Graphics Settings"));
|
|
|
|
pOptionsMenu->Append(IDM_CONFIG_DSP_EMULATOR, _("&DSP Settings"));
|
2011-02-18 12:34:24 +00:00
|
|
|
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _("Gamecube &Pad Settings"));
|
2011-01-05 04:35:46 +00:00
|
|
|
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _("&Wiimote Settings"));
|
2011-02-12 06:46:33 +00:00
|
|
|
pOptionsMenu->Append(IDM_CONFIG_HOTKEYS, _("&Hotkey Settings"));
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow)
|
2009-09-03 06:54:46 +00:00
|
|
|
{
|
|
|
|
pOptionsMenu->AppendSeparator();
|
2011-05-24 19:12:18 +00:00
|
|
|
g_pCodeWindow->CreateMenuOptions(pOptionsMenu);
|
2009-09-03 06:54:46 +00:00
|
|
|
}
|
2011-01-05 04:35:46 +00:00
|
|
|
m_MenuBar->Append(pOptionsMenu, _("&Options"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2009-03-02 21:58:56 +00:00
|
|
|
// Tools menu
|
|
|
|
wxMenu* toolsMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
toolsMenu->Append(IDM_MEMCARD, _("&Memcard Manager (GC)"));
|
|
|
|
toolsMenu->Append(IDM_IMPORTSAVE, _("Wii Save Import"));
|
|
|
|
toolsMenu->Append(IDM_CHEATS, _("&Cheats Manager"));
|
2009-05-13 21:50:24 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
toolsMenu->Append(IDM_NETPLAY, _("Start &NetPlay"));
|
2009-04-28 02:30:50 +00:00
|
|
|
|
2011-05-08 02:56:09 +00:00
|
|
|
toolsMenu->Append(IDM_MENU_INSTALLWAD, _("Install WAD"));
|
2011-06-02 23:36:50 +00:00
|
|
|
UpdateWiiMenuChoice(toolsMenu->Append(IDM_LOAD_WII_MENU, wxT("Dummy string to keep wxw happy")));
|
2011-03-05 05:07:44 +00:00
|
|
|
|
2011-03-27 02:55:08 +00:00
|
|
|
toolsMenu->Append(IDM_FIFOPLAYER, _("Fifo Player"));
|
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
toolsMenu->AppendSeparator();
|
2010-04-25 20:10:16 +00:00
|
|
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE1, GetMenuLabel(HK_WIIMOTE1_CONNECT));
|
|
|
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE2, GetMenuLabel(HK_WIIMOTE2_CONNECT));
|
|
|
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE3, GetMenuLabel(HK_WIIMOTE3_CONNECT));
|
|
|
|
toolsMenu->AppendCheckItem(IDM_CONNECT_WIIMOTE4, GetMenuLabel(HK_WIIMOTE4_CONNECT));
|
2009-02-27 23:44:15 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
m_MenuBar->Append(toolsMenu, _("&Tools"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2009-04-28 02:30:50 +00:00
|
|
|
wxMenu* viewMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _("Show &Toolbar"));
|
2009-04-28 02:30:50 +00:00
|
|
|
viewMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar);
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _("Show &Statusbar"));
|
2009-04-28 02:30:50 +00:00
|
|
|
viewMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
|
2009-09-03 06:54:46 +00:00
|
|
|
viewMenu->AppendSeparator();
|
2011-02-02 18:21:20 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_LOGWINDOW, _("Show &Log"));
|
2011-02-21 15:01:00 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_LOGCONFIGWINDOW, _("Show Log &Configuration"));
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_CONSOLEWINDOW, _("Show &Console"));
|
2009-04-28 02:30:50 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
|
2011-02-02 18:21:20 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
viewMenu->Enable(IDM_CONSOLEWINDOW, false);
|
|
|
|
#endif
|
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow)
|
2009-09-03 06:54:46 +00:00
|
|
|
{
|
2010-07-26 03:46:14 +00:00
|
|
|
viewMenu->Check(IDM_LOGWINDOW, g_pCodeWindow->bShowOnStart[0]);
|
|
|
|
viewMenu->Check(IDM_CONSOLEWINDOW, g_pCodeWindow->bShowOnStart[1]);
|
|
|
|
|
|
|
|
const wxString MenuText[] = {
|
2011-01-06 13:57:46 +00:00
|
|
|
wxTRANSLATE("&Registers"),
|
|
|
|
wxTRANSLATE("&Breakpoints"),
|
|
|
|
wxTRANSLATE("&Memory"),
|
|
|
|
wxTRANSLATE("&JIT"),
|
|
|
|
wxTRANSLATE("&Sound"),
|
|
|
|
wxTRANSLATE("&Video")
|
2010-07-26 03:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
for (int i = IDM_REGISTERWINDOW; i <= IDM_VIDEOWINDOW; i++)
|
|
|
|
{
|
2011-01-06 13:57:46 +00:00
|
|
|
viewMenu->AppendCheckItem(i, wxGetTranslation(MenuText[i - IDM_REGISTERWINDOW]));
|
2010-07-26 03:46:14 +00:00
|
|
|
viewMenu->Check(i, g_pCodeWindow->bShowOnStart[i - IDM_LOGWINDOW]);
|
|
|
|
}
|
|
|
|
|
2009-09-03 06:54:46 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
}
|
2010-07-26 03:46:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
viewMenu->Check(IDM_LOGWINDOW, SConfig::GetInstance().m_InterfaceLogWindow);
|
2011-02-21 15:01:00 +00:00
|
|
|
viewMenu->Check(IDM_LOGCONFIGWINDOW, SConfig::GetInstance().m_InterfaceLogConfigWindow);
|
2010-07-26 03:46:14 +00:00
|
|
|
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
|
|
|
|
}
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2009-09-15 21:35:32 +00:00
|
|
|
wxMenu *platformMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendSubMenu(platformMenu, _("Show Platforms"));
|
|
|
|
platformMenu->AppendCheckItem(IDM_LISTWII, _("Show Wii"));
|
2009-09-15 21:35:32 +00:00
|
|
|
platformMenu->Check(IDM_LISTWII, SConfig::GetInstance().m_ListWii);
|
2011-01-05 04:35:46 +00:00
|
|
|
platformMenu->AppendCheckItem(IDM_LISTGC, _("Show GameCube"));
|
2009-09-15 21:35:32 +00:00
|
|
|
platformMenu->Check(IDM_LISTGC, SConfig::GetInstance().m_ListGC);
|
2011-01-05 04:35:46 +00:00
|
|
|
platformMenu->AppendCheckItem(IDM_LISTWAD, _("Show Wad"));
|
2009-09-15 21:35:32 +00:00
|
|
|
platformMenu->Check(IDM_LISTWAD, SConfig::GetInstance().m_ListWad);
|
|
|
|
|
|
|
|
wxMenu *regionMenu = new wxMenu;
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendSubMenu(regionMenu, _("Show Regions"));
|
|
|
|
regionMenu->AppendCheckItem(IDM_LISTJAP, _("Show JAP"));
|
2009-09-15 21:35:32 +00:00
|
|
|
regionMenu->Check(IDM_LISTJAP, SConfig::GetInstance().m_ListJap);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTPAL, _("Show PAL"));
|
2009-09-15 21:35:32 +00:00
|
|
|
regionMenu->Check(IDM_LISTPAL, SConfig::GetInstance().m_ListPal);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTUSA, _("Show USA"));
|
2009-09-15 21:35:32 +00:00
|
|
|
regionMenu->Check(IDM_LISTUSA, SConfig::GetInstance().m_ListUsa);
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTFRANCE, _("Show France"));
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->Check(IDM_LISTFRANCE, SConfig::GetInstance().m_ListFrance);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTITALY, _("Show Italy"));
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->Check(IDM_LISTITALY, SConfig::GetInstance().m_ListItaly);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTKOREA, _("Show Korea"));
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->Check(IDM_LISTKOREA, SConfig::GetInstance().m_ListKorea);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LISTTAIWAN, _("Show Taiwan"));
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->Check(IDM_LISTTAIWAN, SConfig::GetInstance().m_ListTaiwan);
|
2011-01-05 04:35:46 +00:00
|
|
|
regionMenu->AppendCheckItem(IDM_LIST_UNK, _("Show unknown"));
|
2010-01-11 05:07:56 +00:00
|
|
|
regionMenu->Check(IDM_LIST_UNK, SConfig::GetInstance().m_ListUnknown);
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->AppendCheckItem(IDM_LISTDRIVES, _("Show Drives"));
|
2009-04-28 02:30:50 +00:00
|
|
|
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
|
2011-01-05 04:35:46 +00:00
|
|
|
viewMenu->Append(IDM_PURGECACHE, _("Purge Cache"));
|
2011-05-24 19:12:18 +00:00
|
|
|
m_MenuBar->Append(viewMenu, _("&View"));
|
2009-04-28 02:30:50 +00:00
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
if (g_pCodeWindow) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
|
2009-09-03 06:54:46 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Help menu
|
|
|
|
wxMenu* helpMenu = new wxMenu;
|
2010-06-01 21:03:02 +00:00
|
|
|
// Re-enable when there's something useful to display */
|
2011-01-05 04:35:46 +00:00
|
|
|
// helpMenu->Append(wxID_HELP, _("&Help"));
|
|
|
|
helpMenu->Append(IDM_HELPWEBSITE, _("Dolphin &Web Site"));
|
|
|
|
helpMenu->Append(IDM_HELPGOOGLECODE, _("Dolphin at &Google Code"));
|
2009-02-23 06:15:48 +00:00
|
|
|
helpMenu->AppendSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
helpMenu->Append(wxID_ABOUT, _("&About..."));
|
|
|
|
m_MenuBar->Append(helpMenu, _("&Help"));
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Associate the menu bar with the frame
|
2009-09-03 05:24:30 +00:00
|
|
|
SetMenuBar(m_MenuBar);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-04-14 03:26:18 +00:00
|
|
|
wxString CFrame::GetMenuLabel(int Id)
|
2010-04-12 01:33:10 +00:00
|
|
|
{
|
2011-01-30 14:20:20 +00:00
|
|
|
int hotkey = SConfig::GetInstance().\
|
|
|
|
m_LocalCoreStartupParameter.iHotkey[Id];
|
|
|
|
int hotkeymodifier = SConfig::GetInstance().\
|
|
|
|
m_LocalCoreStartupParameter.iHotkeyModifier[Id];
|
|
|
|
wxString Hotkey, Label, Modifier;
|
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
switch (Id)
|
|
|
|
{
|
2011-02-12 06:46:33 +00:00
|
|
|
case HK_OPEN:
|
|
|
|
Label = _("&Open...");
|
|
|
|
break;
|
|
|
|
case HK_CHANGE_DISC:
|
|
|
|
Label = _("Change &Disc...");
|
|
|
|
break;
|
|
|
|
case HK_REFRESH_LIST:
|
|
|
|
Label = _("&Refresh List");
|
2010-04-12 01:33:10 +00:00
|
|
|
break;
|
2011-02-12 06:46:33 +00:00
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
case HK_PLAY_PAUSE:
|
2010-04-25 20:10:16 +00:00
|
|
|
if (Core::GetState() == Core::CORE_RUN)
|
2011-01-06 13:57:46 +00:00
|
|
|
Label = _("&Pause");
|
2010-04-12 01:33:10 +00:00
|
|
|
else
|
2011-01-06 13:57:46 +00:00
|
|
|
Label = _("&Play");
|
2010-04-12 01:33:10 +00:00
|
|
|
break;
|
|
|
|
case HK_STOP:
|
2011-01-06 13:57:46 +00:00
|
|
|
Label = _("&Stop");
|
2010-04-26 23:25:36 +00:00
|
|
|
break;
|
2011-02-12 06:46:33 +00:00
|
|
|
case HK_RESET:
|
|
|
|
Label = _("&Reset");
|
|
|
|
break;
|
|
|
|
case HK_FRAME_ADVANCE:
|
|
|
|
Label = _("&Frame Advance");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_START_RECORDING:
|
|
|
|
Label = _("Start Re&cording");
|
|
|
|
break;
|
|
|
|
case HK_PLAY_RECORDING:
|
|
|
|
Label = _("P&lay Recording...");
|
|
|
|
break;
|
|
|
|
case HK_EXPORT_RECORDING:
|
|
|
|
Label = _("Export Recording...");
|
|
|
|
break;
|
|
|
|
case HK_READ_ONLY_MODE:
|
|
|
|
Label = _("&Read-only mode");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_FULLSCREEN:
|
|
|
|
Label = _("&Fullscreen");
|
|
|
|
break;
|
2010-08-08 00:13:05 +00:00
|
|
|
case HK_SCREENSHOT:
|
2011-01-06 13:57:46 +00:00
|
|
|
Label = _("Take Screenshot");
|
2010-08-08 00:13:05 +00:00
|
|
|
break;
|
2011-02-12 06:46:33 +00:00
|
|
|
|
2010-04-25 20:10:16 +00:00
|
|
|
case HK_WIIMOTE1_CONNECT:
|
|
|
|
case HK_WIIMOTE2_CONNECT:
|
|
|
|
case HK_WIIMOTE3_CONNECT:
|
|
|
|
case HK_WIIMOTE4_CONNECT:
|
2011-01-06 13:57:46 +00:00
|
|
|
Label = wxString::Format(_("Connect Wiimote %i"),
|
2010-08-01 04:09:59 +00:00
|
|
|
Id - HK_WIIMOTE1_CONNECT + 1);
|
2010-04-26 23:25:36 +00:00
|
|
|
break;
|
2011-02-12 06:46:33 +00:00
|
|
|
|
|
|
|
case HK_LOAD_STATE_SLOT_1:
|
|
|
|
case HK_LOAD_STATE_SLOT_2:
|
|
|
|
case HK_LOAD_STATE_SLOT_3:
|
|
|
|
case HK_LOAD_STATE_SLOT_4:
|
|
|
|
case HK_LOAD_STATE_SLOT_5:
|
|
|
|
case HK_LOAD_STATE_SLOT_6:
|
|
|
|
case HK_LOAD_STATE_SLOT_7:
|
|
|
|
case HK_LOAD_STATE_SLOT_8:
|
|
|
|
Label = wxString::Format(_("Slot %i"),
|
|
|
|
Id - HK_LOAD_STATE_SLOT_1 + 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_SAVE_STATE_SLOT_1:
|
|
|
|
case HK_SAVE_STATE_SLOT_2:
|
|
|
|
case HK_SAVE_STATE_SLOT_3:
|
|
|
|
case HK_SAVE_STATE_SLOT_4:
|
|
|
|
case HK_SAVE_STATE_SLOT_5:
|
|
|
|
case HK_SAVE_STATE_SLOT_6:
|
|
|
|
case HK_SAVE_STATE_SLOT_7:
|
|
|
|
case HK_SAVE_STATE_SLOT_8:
|
|
|
|
Label = wxString::Format(_("Slot %i"),
|
|
|
|
Id - HK_SAVE_STATE_SLOT_1 + 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
Label = wxString::Format(_("Undefined %i"), Id);
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
2011-01-30 14:20:20 +00:00
|
|
|
// wxWidgets only accepts Ctrl/Alt/Shift as menu accelerator
|
|
|
|
// modifiers. On OS X, "Ctrl+" is mapped to the Command key.
|
|
|
|
#ifdef __APPLE__
|
|
|
|
if (hotkeymodifier & wxMOD_CMD)
|
|
|
|
hotkeymodifier |= wxMOD_CONTROL;
|
|
|
|
#endif
|
|
|
|
hotkeymodifier &= wxMOD_CONTROL | wxMOD_ALT | wxMOD_SHIFT;
|
|
|
|
|
|
|
|
Modifier = InputCommon::WXKeymodToString(hotkeymodifier);
|
|
|
|
Hotkey = InputCommon::WXKeyToString(hotkey);
|
2011-01-06 13:57:46 +00:00
|
|
|
if (Modifier.Len() + Hotkey.Len() > 0)
|
|
|
|
Label += '\t';
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2011-01-30 14:20:20 +00:00
|
|
|
return Label + Modifier + Hotkey;
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
2009-09-02 21:00:45 +00:00
|
|
|
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Create toolbar items
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-08-27 07:33:07 +00:00
|
|
|
void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
|
|
|
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
|
2010-06-05 01:38:22 +00:00
|
|
|
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
|
2009-09-08 08:47:33 +00:00
|
|
|
ToolBar->SetToolBitmapSize(wxSize(w, h));
|
|
|
|
|
2009-09-02 15:38:04 +00:00
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
ToolBar->AddTool(wxID_OPEN, _("Open"), m_Bitmaps[Toolbar_FileOpen], _("Open file..."));
|
|
|
|
ToolBar->AddTool(wxID_REFRESH, _("Refresh"), m_Bitmaps[Toolbar_Refresh], _("Refresh game list"));
|
|
|
|
ToolBar->AddTool(IDM_BROWSE, _("Browse"), m_Bitmaps[Toolbar_Browse], _("Browse for an ISO directory..."));
|
2009-08-27 07:33:07 +00:00
|
|
|
ToolBar->AddSeparator();
|
2011-01-05 04:35:46 +00:00
|
|
|
ToolBar->AddTool(IDM_PLAY, _("Play"), m_Bitmaps[Toolbar_Play], _("Play"));
|
|
|
|
ToolBar->AddTool(IDM_STOP, _("Stop"), m_Bitmaps[Toolbar_Stop], _("Stop"));
|
|
|
|
ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _("FullScr"), m_Bitmaps[Toolbar_FullScreen], _("Toggle Fullscreen"));
|
|
|
|
ToolBar->AddTool(IDM_SCREENSHOT, _("ScrShot"), m_Bitmaps[Toolbar_FullScreen], _("Take Screenshot"));
|
2009-08-27 07:33:07 +00:00
|
|
|
ToolBar->AddSeparator();
|
2011-02-02 16:34:12 +00:00
|
|
|
ToolBar->AddTool(wxID_PREFERENCES, _("Config"), m_Bitmaps[Toolbar_ConfigMain], _("Configure..."));
|
2011-02-14 02:18:03 +00:00
|
|
|
ToolBar->AddTool(IDM_CONFIG_GFX_BACKEND, _("Graphics"), m_Bitmaps[Toolbar_ConfigGFX], _("Graphics settings"));
|
|
|
|
ToolBar->AddTool(IDM_CONFIG_DSP_EMULATOR, _("DSP"), m_Bitmaps[Toolbar_ConfigDSP], _("DSP settings"));
|
2011-02-02 16:34:12 +00:00
|
|
|
ToolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _("GCPad"), m_Bitmaps[Toolbar_ConfigPAD], _("Gamecube Pad settings"));
|
2011-01-05 04:35:46 +00:00
|
|
|
ToolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _("Wiimote settings"));
|
2009-09-15 21:35:32 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect
|
|
|
|
// the changes
|
2009-08-27 07:33:07 +00:00
|
|
|
ToolBar->Realize();
|
|
|
|
}
|
2009-12-28 19:34:19 +00:00
|
|
|
|
2009-08-27 07:33:07 +00:00
|
|
|
void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
|
|
|
|
{
|
|
|
|
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
|
2010-08-01 04:09:59 +00:00
|
|
|
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
|
2009-08-27 07:33:07 +00:00
|
|
|
ToolBar->SetToolBitmapSize(wxSize(w, h));
|
|
|
|
|
2011-01-05 04:35:46 +00:00
|
|
|
ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, _("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Save current perspective"));
|
|
|
|
ToolBar->AddTool(IDM_EDIT_PERSPECTIVES, _("Edit"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Edit current perspective"));
|
2009-08-30 19:44:42 +00:00
|
|
|
|
|
|
|
ToolBar->SetToolDropDown(IDM_SAVE_PERSPECTIVE, true);
|
2011-05-24 19:12:18 +00:00
|
|
|
ToolBar->SetToolDropDown(IDM_EDIT_PERSPECTIVES, true);
|
2009-08-27 07:33:07 +00:00
|
|
|
|
|
|
|
ToolBar->Realize();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Delete and recreate the toolbar
|
|
|
|
void CFrame::RecreateToolbar()
|
|
|
|
{
|
2009-09-15 21:35:32 +00:00
|
|
|
if (m_ToolBar)
|
|
|
|
{
|
|
|
|
m_Mgr->DetachPane(m_ToolBar);
|
|
|
|
m_ToolBar->Destroy();
|
|
|
|
}
|
|
|
|
|
2010-07-24 02:36:22 +00:00
|
|
|
long TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
|
2009-09-01 19:47:04 +00:00
|
|
|
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
|
2009-12-28 19:34:19 +00:00
|
|
|
|
2009-08-25 07:49:23 +00:00
|
|
|
PopulateToolbar(m_ToolBar);
|
2009-09-01 12:44:02 +00:00
|
|
|
|
2009-08-25 07:49:23 +00:00
|
|
|
m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo().
|
2009-08-25 06:34:58 +00:00
|
|
|
Name(wxT("TBMain")).Caption(wxT("TBMain")).
|
2009-08-25 01:50:27 +00:00
|
|
|
ToolbarPane().Top().
|
2009-08-25 07:49:23 +00:00
|
|
|
LeftDockable(false).RightDockable(false).Floatable(false));
|
2009-08-25 01:50:27 +00:00
|
|
|
|
2009-09-15 21:35:32 +00:00
|
|
|
if (g_pCodeWindow && !m_ToolBarDebug)
|
2009-08-25 01:50:27 +00:00
|
|
|
{
|
2009-09-01 19:47:04 +00:00
|
|
|
m_ToolBarDebug = new wxAuiToolBar(this, ID_TOOLBAR_DEBUG, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
|
2009-08-27 07:33:07 +00:00
|
|
|
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
|
2009-09-01 12:44:02 +00:00
|
|
|
|
2009-08-27 07:33:07 +00:00
|
|
|
m_Mgr->AddPane(m_ToolBarDebug, wxAuiPaneInfo().
|
2009-08-25 06:34:58 +00:00
|
|
|
Name(wxT("TBDebug")).Caption(wxT("TBDebug")).
|
2009-08-25 01:50:27 +00:00
|
|
|
ToolbarPane().Top().
|
2009-08-25 07:49:23 +00:00
|
|
|
LeftDockable(false).RightDockable(false).Floatable(false));
|
2009-08-27 07:33:07 +00:00
|
|
|
|
2009-09-01 19:47:04 +00:00
|
|
|
m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
|
2009-08-27 07:33:07 +00:00
|
|
|
PopulateToolbarAui(m_ToolBarAui);
|
|
|
|
m_Mgr->AddPane(m_ToolBarAui, wxAuiPaneInfo().
|
|
|
|
Name(wxT("TBAui")).Caption(wxT("TBAui")).
|
|
|
|
ToolbarPane().Top().
|
|
|
|
LeftDockable(false).RightDockable(false).Floatable(false));
|
2009-08-25 01:50:27 +00:00
|
|
|
}
|
2009-09-15 21:35:32 +00:00
|
|
|
|
|
|
|
UpdateGUI();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-06-18 08:22:02 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::InitBitmaps()
|
|
|
|
{
|
|
|
|
// Get selected theme
|
|
|
|
int Theme = SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme;
|
|
|
|
|
2009-06-18 08:22:02 +00:00
|
|
|
// Save memory by only having one set of bitmaps loaded at any time. I mean, they are still
|
2009-12-28 19:34:19 +00:00
|
|
|
// in the exe, which is in memory, but at least we wont make another copy of all of them.
|
2009-02-23 06:15:48 +00:00
|
|
|
switch (Theme)
|
|
|
|
{
|
|
|
|
case BOOMY:
|
|
|
|
{
|
|
|
|
// These are stored as 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_Stop] = wxGetBitmapFromMemory(toolbar_stop_png);
|
|
|
|
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png);
|
2011-02-02 16:34:12 +00:00
|
|
|
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(toolbar_plugin_options_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(toolbar_plugin_gfx_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(toolbar_plugin_dsp_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(toolbar_plugin_pad_png);
|
2010-01-20 10:11:53 +00:00
|
|
|
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(toolbar_plugin_wiimote_png);
|
2009-02-27 06:24:54 +00:00
|
|
|
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(toolbar_fullscreen_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(toolbar_fullscreen_png);
|
|
|
|
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(toolbar_help_png);
|
|
|
|
|
|
|
|
// Scale the 48x48 bitmaps to 24x24
|
2010-06-03 18:49:35 +00:00
|
|
|
for (size_t n = Toolbar_FileOpen; n < EToolbar_Max; n++)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
|
|
|
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VISTA:
|
|
|
|
{
|
|
|
|
// These are stored as 24x24 and need no scaling
|
|
|
|
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open1_png);
|
|
|
|
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh1_png);
|
|
|
|
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse1_png);
|
|
|
|
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play1_png);
|
|
|
|
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop1_png);
|
|
|
|
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause1_png);
|
2011-02-02 16:34:12 +00:00
|
|
|
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options1_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx1_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP1_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad1_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote1_png);
|
2009-02-27 06:24:54 +00:00
|
|
|
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen1_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen1_png);
|
|
|
|
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help1_png);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case XPLASTIK:
|
|
|
|
{
|
|
|
|
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open2_png);
|
|
|
|
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh2_png);
|
|
|
|
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse2_png);
|
|
|
|
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play2_png);
|
|
|
|
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop2_png);
|
|
|
|
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause2_png);
|
2011-02-02 16:34:12 +00:00
|
|
|
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options2_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx2_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP2_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad2_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote2_png);
|
2009-02-27 06:24:54 +00:00
|
|
|
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen2_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen2_png);
|
|
|
|
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help2_png);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KDE:
|
|
|
|
{
|
|
|
|
m_Bitmaps[Toolbar_FileOpen] = wxGetBitmapFromMemory(Toolbar_Open3_png);
|
|
|
|
m_Bitmaps[Toolbar_Refresh] = wxGetBitmapFromMemory(Toolbar_Refresh3_png);
|
|
|
|
m_Bitmaps[Toolbar_Browse] = wxGetBitmapFromMemory(Toolbar_Browse3_png);
|
|
|
|
m_Bitmaps[Toolbar_Play] = wxGetBitmapFromMemory(Toolbar_Play3_png);
|
|
|
|
m_Bitmaps[Toolbar_Stop] = wxGetBitmapFromMemory(Toolbar_Stop3_png);
|
|
|
|
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(Toolbar_Pause3_png);
|
2011-02-02 16:34:12 +00:00
|
|
|
m_Bitmaps[Toolbar_ConfigMain] = wxGetBitmapFromMemory(Toolbar_Options3_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigGFX] = wxGetBitmapFromMemory(Toolbar_Gfx3_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigDSP] = wxGetBitmapFromMemory(Toolbar_DSP3_png);
|
|
|
|
m_Bitmaps[Toolbar_ConfigPAD] = wxGetBitmapFromMemory(Toolbar_Pad3_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_Wiimote] = wxGetBitmapFromMemory(Toolbar_Wiimote3_png);
|
2009-02-27 06:24:54 +00:00
|
|
|
m_Bitmaps[Toolbar_Screenshot] = wxGetBitmapFromMemory(Toolbar_Fullscreen3_png);
|
2009-02-23 06:15:48 +00:00
|
|
|
m_Bitmaps[Toolbar_FullScreen] = wxGetBitmapFromMemory(Toolbar_Fullscreen3_png);
|
|
|
|
m_Bitmaps[Toolbar_Help] = wxGetBitmapFromMemory(Toolbar_Help3_png);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-01-13 02:05:58 +00:00
|
|
|
default: PanicAlertT("Theme selection went wrong");
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update in case the bitmap has been updated
|
2009-09-15 21:35:32 +00:00
|
|
|
if (m_ToolBar != NULL) RecreateToolbar();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-08-25 07:49:23 +00:00
|
|
|
// Menu items
|
|
|
|
|
2010-01-18 12:10:51 +00:00
|
|
|
// Start the game or change the disc.
|
|
|
|
// Boot priority:
|
2010-01-18 18:21:27 +00:00
|
|
|
// 1. Show the game list and boot the selected game.
|
|
|
|
// 2. Default ISO
|
2010-01-18 12:10:51 +00:00
|
|
|
// 3. Boot last selected game
|
2010-01-22 21:41:25 +00:00
|
|
|
void CFrame::BootGame(const std::string& filename)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
std::string bootfile = filename;
|
2010-01-18 12:10:51 +00:00
|
|
|
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
2009-12-28 19:34:19 +00:00
|
|
|
return;
|
|
|
|
|
2010-01-22 21:41:25 +00:00
|
|
|
// Start filename if non empty.
|
2009-09-15 05:38:49 +00:00
|
|
|
// Start the selected ISO, or try one of the saved paths.
|
|
|
|
// If all that fails, ask to add a dir and don't boot
|
2010-04-17 03:17:36 +00:00
|
|
|
if (bootfile.empty())
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
if (m_GameListCtrl->GetSelectedISO() != NULL)
|
2009-09-15 05:38:49 +00:00
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
if (m_GameListCtrl->GetSelectedISO()->IsValid())
|
|
|
|
bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName();
|
2009-09-15 05:38:49 +00:00
|
|
|
}
|
2010-04-17 03:17:36 +00:00
|
|
|
else if (!StartUp.m_strDefaultGCM.empty()
|
|
|
|
&& wxFileExists(wxString(StartUp.m_strDefaultGCM.c_str(), wxConvUTF8)))
|
|
|
|
bootfile = StartUp.m_strDefaultGCM;
|
2009-09-15 05:38:49 +00:00
|
|
|
else
|
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
if (!SConfig::GetInstance().m_LastFilename.empty()
|
|
|
|
&& wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
|
|
|
bootfile = SConfig::GetInstance().m_LastFilename;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_GameListCtrl->BrowseForDirectory();
|
|
|
|
return;
|
|
|
|
}
|
2010-01-30 15:05:16 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-04-17 03:17:36 +00:00
|
|
|
if (!bootfile.empty())
|
|
|
|
StartGame(bootfile);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-18 08:22:02 +00:00
|
|
|
// Open file to boot
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
DoOpen(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::DoOpen(bool Boot)
|
|
|
|
{
|
2010-06-05 01:38:22 +00:00
|
|
|
std::string currentDir = File::GetCurrentDir();
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Select the file to load"),
|
2009-02-23 06:15:48 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-02-22 02:02:56 +00:00
|
|
|
_("All GC/Wii files (elf, dol, gcm, iso, ciso, gcz, wad)") +
|
2011-06-02 07:04:26 +00:00
|
|
|
wxString::Format(wxT("|*.elf;*.dol;*.gcm;*.iso;*.ciso;*.gcz;*.wad;*.dff;*.tmd|%s"),
|
2011-02-22 02:02:56 +00:00
|
|
|
wxGetTranslation(wxALL_FILES)),
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST,
|
2009-02-23 06:15:48 +00:00
|
|
|
this);
|
2009-06-18 08:22:02 +00:00
|
|
|
|
2010-06-05 01:38:22 +00:00
|
|
|
std::string currentDir2 = File::GetCurrentDir();
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2010-06-05 01:38:22 +00:00
|
|
|
if (currentDir != currentDir2)
|
|
|
|
{
|
2011-01-13 02:05:58 +00:00
|
|
|
PanicAlertT("Current dir changed from %s to %s after wxFileSelector!",
|
2010-09-16 02:12:00 +00:00
|
|
|
currentDir.c_str(), currentDir2.c_str());
|
2011-03-01 03:06:14 +00:00
|
|
|
File::SetCurrentDir(currentDir);
|
2010-06-05 01:38:22 +00:00
|
|
|
}
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2010-09-16 02:12:00 +00:00
|
|
|
if (path.IsEmpty())
|
|
|
|
return;
|
2009-02-24 07:18:08 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Should we boot a new game or just change the disc?
|
2009-06-18 08:22:02 +00:00
|
|
|
if (Boot)
|
2010-04-17 03:17:36 +00:00
|
|
|
BootGame(std::string(path.mb_str()));
|
2009-02-23 06:15:48 +00:00
|
|
|
else
|
|
|
|
{
|
2010-07-30 03:51:49 +00:00
|
|
|
char newDiscpath[2048];
|
2010-01-24 03:17:42 +00:00
|
|
|
strncpy(newDiscpath, path.mb_str(), strlen(path.mb_str())+1);
|
|
|
|
DVDInterface::ChangeDisc(newDiscpath);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-12 02:14:20 +00:00
|
|
|
void CFrame::OnRecordReadOnly(wxCommandEvent& event)
|
|
|
|
{
|
2011-06-24 06:50:50 +00:00
|
|
|
Movie::SetReadOnly(event.IsChecked());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnTASInput(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
g_TASInputDlg->Show(true);
|
2011-02-12 02:14:20 +00:00
|
|
|
}
|
|
|
|
|
2009-08-22 02:05:02 +00:00
|
|
|
void CFrame::OnFrameStep(wxCommandEvent& event)
|
|
|
|
{
|
2011-12-12 05:08:26 +00:00
|
|
|
bool wasPaused = (Core::GetState() == Core::CORE_PAUSE);
|
|
|
|
|
|
|
|
Movie::DoFrameStep();
|
|
|
|
|
|
|
|
bool isPaused = (Core::GetState() == Core::CORE_PAUSE);
|
|
|
|
if(isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when pausing next frame
|
|
|
|
UpdateGUI();
|
2009-08-22 02:05:02 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
DoOpen(false);
|
|
|
|
}
|
|
|
|
|
2009-08-21 09:26:34 +00:00
|
|
|
void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2010-09-06 21:41:01 +00:00
|
|
|
int controllers = 0;
|
2011-07-11 20:15:05 +00:00
|
|
|
|
|
|
|
if (Movie::IsReadOnly())
|
|
|
|
{
|
2011-12-12 05:08:26 +00:00
|
|
|
//PanicAlertT("Cannot record movies in read-only mode.");
|
|
|
|
//return;
|
|
|
|
// the user just chose to record a movie, so that should take precedence
|
|
|
|
Movie::SetReadOnly(false);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false);
|
2011-07-11 20:15:05 +00:00
|
|
|
}
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2011-02-11 19:09:46 +00:00
|
|
|
for (int i = 0; i < 4; i++) {
|
2011-10-23 14:01:17 +00:00
|
|
|
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
|
2011-02-11 19:09:46 +00:00
|
|
|
controllers |= (1 << i);
|
|
|
|
|
|
|
|
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
|
|
|
|
controllers |= (1 << (i + 4));
|
|
|
|
}
|
2010-09-06 21:41:01 +00:00
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
if(Movie::BeginRecordingInput(controllers))
|
2010-01-22 21:41:25 +00:00
|
|
|
BootGame(std::string(""));
|
2009-08-21 19:55:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Select The Recording File"),
|
2009-08-21 19:55:03 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-01-06 13:57:46 +00:00
|
|
|
_("Dolphin TAS Movies (*.dtm)") +
|
|
|
|
wxString::Format(wxT("|*.dtm|%s"), wxGetTranslation(wxALL_FILES)),
|
2009-08-21 19:55:03 +00:00
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
|
|
|
|
|
|
|
if(path.IsEmpty())
|
|
|
|
return;
|
|
|
|
|
2011-12-18 10:23:59 +00:00
|
|
|
if (!Movie::IsReadOnly())
|
|
|
|
{
|
|
|
|
// let's make the read-only flag consistent at the start of a movie.
|
|
|
|
Movie::SetReadOnly(true);
|
|
|
|
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(true);
|
|
|
|
}
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
if(Movie::PlayInput(path.mb_str()))
|
2010-01-22 21:41:25 +00:00
|
|
|
BootGame(std::string(""));
|
2009-08-21 09:26:34 +00:00
|
|
|
}
|
|
|
|
|
2010-08-30 07:05:47 +00:00
|
|
|
void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
DoRecordingSave();
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2009-12-28 19:34:19 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
2010-01-18 12:10:51 +00:00
|
|
|
// Core is initialized and emulator is running
|
2009-12-28 19:34:19 +00:00
|
|
|
if (UseDebugger)
|
|
|
|
{
|
|
|
|
if (CCPU::IsStepping())
|
|
|
|
CCPU::EnableStepping(false);
|
|
|
|
else
|
|
|
|
CCPU::EnableStepping(true); // Break
|
|
|
|
|
|
|
|
wxThread::Sleep(20);
|
|
|
|
g_pCodeWindow->JumpToAddress(PC);
|
|
|
|
g_pCodeWindow->Update();
|
2010-03-15 23:25:11 +00:00
|
|
|
// Update toolbar with Play/Pause status
|
|
|
|
UpdateGUI();
|
2009-12-28 19:34:19 +00:00
|
|
|
}
|
|
|
|
else
|
2010-03-15 23:25:11 +00:00
|
|
|
DoPause();
|
2009-12-28 19:34:19 +00:00
|
|
|
}
|
2010-01-18 12:10:51 +00:00
|
|
|
else
|
|
|
|
// Core is uninitialized, start the game
|
2010-04-17 03:17:36 +00:00
|
|
|
BootGame(std::string(""));
|
2010-01-18 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
DoStop();
|
2010-12-17 22:13:58 +00:00
|
|
|
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
|
|
|
event.Skip();
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
|
|
|
{
|
2010-04-22 04:28:34 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED &&
|
2010-10-17 12:42:04 +00:00
|
|
|
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized() && !m_RenderFrame->IsIconized())
|
2010-04-12 01:33:10 +00:00
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos = m_RenderFrame->GetPosition().x;
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos = m_RenderFrame->GetPosition().y;
|
|
|
|
}
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
|
|
|
{
|
2010-04-22 04:28:34 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
2010-04-12 01:33:10 +00:00
|
|
|
{
|
2010-04-22 04:28:34 +00:00
|
|
|
int width, height;
|
|
|
|
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
2010-10-17 12:42:04 +00:00
|
|
|
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized() && !m_RenderFrame->IsIconized())
|
2010-04-22 04:28:34 +00:00
|
|
|
{
|
2011-01-16 12:18:34 +00:00
|
|
|
m_RenderFrame->GetClientSize(&width, &height);
|
2010-04-22 04:28:34 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
|
|
|
|
}
|
2010-04-12 01:33:10 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2010-04-22 04:28:34 +00:00
|
|
|
int x, y;
|
2011-01-25 03:30:12 +00:00
|
|
|
m_RenderParent->GetClientSize(&width, &height);
|
2010-04-22 04:28:34 +00:00
|
|
|
m_RenderParent->GetPosition(&x, &y);
|
2010-07-16 14:14:57 +00:00
|
|
|
X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()),
|
2010-08-01 04:09:59 +00:00
|
|
|
"RESIZE", x, y, width, height);
|
2010-04-12 01:33:10 +00:00
|
|
|
#endif
|
2010-07-27 02:39:12 +00:00
|
|
|
m_LogWindow->Refresh();
|
|
|
|
m_LogWindow->Update();
|
2010-04-22 04:28:34 +00:00
|
|
|
}
|
2010-04-17 03:17:36 +00:00
|
|
|
event.Skip();
|
2010-04-12 01:33:10 +00:00
|
|
|
}
|
|
|
|
|
2010-10-17 12:42:04 +00:00
|
|
|
void CFrame::ToggleDisplayMode(bool bFullscreen)
|
2010-04-22 04:28:34 +00:00
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (bFullscreen)
|
|
|
|
{
|
|
|
|
DEVMODE dmScreenSettings;
|
|
|
|
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
|
|
|
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
|
|
|
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
|
2010-08-01 04:09:59 +00:00
|
|
|
"%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
|
2010-04-22 04:28:34 +00:00
|
|
|
dmScreenSettings.dmBitsPerPel = 32;
|
|
|
|
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
|
|
|
|
|
|
|
|
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
|
|
|
|
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Change to default resolution
|
|
|
|
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
|
|
|
|
}
|
|
|
|
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
|
|
|
m_XRRConfig->ToggleDisplayMode(bFullscreen);
|
2011-01-31 07:38:36 +00:00
|
|
|
#elif defined __APPLE__
|
2011-01-31 14:34:46 +00:00
|
|
|
if (!bFullscreen) {
|
|
|
|
CGRestorePermanentDisplayConfiguration();
|
|
|
|
CGDisplayRelease(CGMainDisplayID());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-31 07:38:36 +00:00
|
|
|
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
|
|
|
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
|
|
|
{
|
|
|
|
CFDictionaryRef mode;
|
|
|
|
CFNumberRef ref;
|
|
|
|
int x, y, w, h, d;
|
|
|
|
|
|
|
|
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.\
|
|
|
|
strFullscreenResolution.c_str(), "%dx%d", &x, &y);
|
|
|
|
|
|
|
|
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
|
|
|
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
|
|
|
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
|
|
|
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
|
|
|
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
|
|
|
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
|
|
|
kCGDisplayBitsPerPixel);
|
|
|
|
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
|
|
|
|
2011-01-31 14:34:46 +00:00
|
|
|
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched))
|
|
|
|
continue;
|
2011-01-31 07:38:36 +00:00
|
|
|
if (w != x || h != y || d != 32)
|
|
|
|
continue;;
|
|
|
|
|
2011-01-31 14:34:46 +00:00
|
|
|
CGDisplayCapture(CGMainDisplayID());
|
|
|
|
CGDisplaySwitchToMode(CGMainDisplayID(), mode);
|
2011-01-31 07:38:36 +00:00
|
|
|
}
|
2011-01-31 14:34:46 +00:00
|
|
|
|
2010-04-22 04:28:34 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-01-18 12:10:51 +00:00
|
|
|
// Prepare the GUI to start the game.
|
2010-01-22 21:41:25 +00:00
|
|
|
void CFrame::StartGame(const std::string& filename)
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
m_bGameLoading = true;
|
2010-01-18 12:10:51 +00:00
|
|
|
|
|
|
|
if (m_ToolBar)
|
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, false);
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
|
|
|
|
2011-01-20 21:37:00 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
2011-01-20 21:37:00 +00:00
|
|
|
// Game has been started, hide the game list
|
2010-01-18 12:10:51 +00:00
|
|
|
m_GameListCtrl->Disable();
|
|
|
|
m_GameListCtrl->Hide();
|
2009-12-28 19:34:19 +00:00
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
m_RenderParent = m_Panel;
|
|
|
|
m_RenderFrame = this;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxPoint position(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos);
|
2011-01-11 04:09:11 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
// On OS X, the render window's title bar is not visible,
|
|
|
|
// and the window therefore not easily moved, when the
|
|
|
|
// position is 0,0. Weed out the 0's from existing configs.
|
|
|
|
if (position == wxPoint(0, 0))
|
|
|
|
position = wxDefaultPosition;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_RenderFrame = new CRenderFrame((wxFrame*)this, wxID_ANY, _("Dolphin"), position);
|
2010-04-12 01:33:10 +00:00
|
|
|
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
|
2010-08-03 18:57:59 +00:00
|
|
|
m_RenderFrame->SetClientSize(size.GetWidth(), size.GetHeight());
|
2010-04-12 01:33:10 +00:00
|
|
|
m_RenderFrame->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW,
|
|
|
|
wxCloseEventHandler(CFrame::OnRenderParentClose),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
m_RenderFrame->Connect(wxID_ANY, wxEVT_ACTIVATE,
|
|
|
|
wxActivateEventHandler(CFrame::OnActive),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
m_RenderFrame->Connect(wxID_ANY, wxEVT_MOVE,
|
|
|
|
wxMoveEventHandler(CFrame::OnRenderParentMove),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
m_RenderParent = new CPanel(m_RenderFrame, wxID_ANY);
|
|
|
|
m_RenderFrame->Show();
|
|
|
|
}
|
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
wxBeginBusyCursor();
|
|
|
|
|
2011-03-25 18:12:40 +00:00
|
|
|
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
|
|
|
|
2010-04-17 03:17:36 +00:00
|
|
|
if (!BootManager::BootCore(filename))
|
|
|
|
{
|
2011-03-25 18:12:40 +00:00
|
|
|
DoFullscreen(false);
|
2010-04-17 03:17:36 +00:00
|
|
|
// Destroy the renderer frame when not rendering to main
|
|
|
|
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
|
|
|
m_RenderFrame->Destroy();
|
|
|
|
m_RenderParent = NULL;
|
|
|
|
m_bGameLoading = false;
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-17 13:14:55 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2011-08-25 19:44:13 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
|
2010-11-25 02:26:46 +00:00
|
|
|
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
|
|
|
|
X11Utils::XWindowFromHandle(GetHandle()), true);
|
|
|
|
#endif
|
|
|
|
|
2010-04-22 04:28:34 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
::SetFocus((HWND)m_RenderParent->GetHandle());
|
|
|
|
#else
|
|
|
|
m_RenderParent->SetFocus();
|
|
|
|
#endif
|
2011-06-02 23:36:50 +00:00
|
|
|
|
2010-04-17 03:17:36 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyDown),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyUp),
|
|
|
|
(wxObject*)0, this);
|
2010-12-21 23:58:25 +00:00
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_RIGHT_DOWN, // Mouse
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_MIDDLE_DOWN,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_MIDDLE_UP,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
2010-07-27 02:39:12 +00:00
|
|
|
m_RenderParent->Connect(wxID_ANY, wxEVT_SIZE,
|
2010-04-17 03:17:36 +00:00
|
|
|
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
}
|
2011-03-15 23:09:12 +00:00
|
|
|
|
|
|
|
wxEndBusyCursor();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnBootDrive(wxCommandEvent& event)
|
|
|
|
{
|
2010-04-17 03:17:36 +00:00
|
|
|
BootGame(drives[event.GetId()-IDM_DRIVE1]);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Refresh the file list and browse for a favorites directory
|
|
|
|
void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2009-09-06 13:36:05 +00:00
|
|
|
if (m_GameListCtrl) m_GameListCtrl->Update();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2009-09-06 13:36:05 +00:00
|
|
|
if (m_GameListCtrl) m_GameListCtrl->BrowseForDirectory();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-02-27 03:56:34 +00:00
|
|
|
|
2009-06-20 11:05:52 +00:00
|
|
|
// Create screenshot
|
2009-02-27 03:56:34 +00:00
|
|
|
void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-03-15 23:09:12 +00:00
|
|
|
Core::SaveScreenShot();
|
2009-02-27 03:56:34 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2010-02-09 00:34:27 +00:00
|
|
|
// Pause the emulation
|
|
|
|
void CFrame::DoPause()
|
|
|
|
{
|
2010-03-08 23:29:16 +00:00
|
|
|
if (Core::GetState() == Core::CORE_RUN)
|
2010-03-15 23:25:11 +00:00
|
|
|
{
|
2010-03-08 23:29:16 +00:00
|
|
|
Core::SetState(Core::CORE_PAUSE);
|
2010-04-12 01:33:10 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
|
|
|
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
2010-03-15 23:25:11 +00:00
|
|
|
}
|
2010-03-08 23:29:16 +00:00
|
|
|
else
|
2010-03-15 23:25:11 +00:00
|
|
|
{
|
2010-03-08 23:29:16 +00:00
|
|
|
Core::SetState(Core::CORE_RUN);
|
2010-04-12 01:33:10 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
|
|
|
|
RendererHasFocus())
|
|
|
|
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
2010-03-15 23:25:11 +00:00
|
|
|
}
|
2010-02-09 00:34:27 +00:00
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
// Stop the emulation
|
|
|
|
void CFrame::DoStop()
|
|
|
|
{
|
2011-06-19 01:22:34 +00:00
|
|
|
m_bGameLoading = false;
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED ||
|
|
|
|
m_RenderParent != NULL)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2011-03-06 04:31:43 +00:00
|
|
|
#if defined __WXGTK__
|
|
|
|
wxMutexGuiLeave();
|
2011-03-15 12:50:58 +00:00
|
|
|
std::lock_guard<std::recursive_mutex> lk(keystate_lock);
|
2011-03-06 04:31:43 +00:00
|
|
|
wxMutexGuiEnter();
|
|
|
|
#endif
|
2010-01-19 06:37:09 +00:00
|
|
|
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
|
|
|
|
{
|
2010-07-30 03:51:49 +00:00
|
|
|
wxMessageDialog *m_StopDlg = new wxMessageDialog(
|
2010-01-19 06:37:09 +00:00
|
|
|
this,
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Do you want to stop the current emulation?"),
|
|
|
|
_("Please confirm..."),
|
2010-01-19 20:18:41 +00:00
|
|
|
wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION,
|
2010-01-19 06:37:09 +00:00
|
|
|
wxDefaultPosition);
|
|
|
|
|
2010-01-20 07:47:41 +00:00
|
|
|
int Ret = m_StopDlg->ShowModal();
|
|
|
|
m_StopDlg->Destroy();
|
2010-07-30 03:51:49 +00:00
|
|
|
if (Ret != wxID_YES)
|
2009-04-28 23:47:18 +00:00
|
|
|
return;
|
2010-01-19 06:37:09 +00:00
|
|
|
}
|
2009-08-21 09:26:34 +00:00
|
|
|
|
|
|
|
// TODO: Show the author/description dialog here
|
2011-06-24 06:50:50 +00:00
|
|
|
if(Movie::IsRecordingInput())
|
2010-08-30 07:05:47 +00:00
|
|
|
DoRecordingSave();
|
2011-06-24 06:50:50 +00:00
|
|
|
if(Movie::IsPlayingInput() || Movie::IsRecordingInput())
|
|
|
|
Movie::EndPlayInput(false);
|
2010-07-22 02:05:28 +00:00
|
|
|
|
2011-03-15 23:09:12 +00:00
|
|
|
wxBeginBusyCursor();
|
2010-11-03 07:37:13 +00:00
|
|
|
BootManager::Stop();
|
2011-03-15 23:09:12 +00:00
|
|
|
wxEndBusyCursor();
|
2010-01-01 03:55:39 +00:00
|
|
|
|
2011-06-17 13:14:55 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2011-08-25 19:44:13 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
|
2010-11-25 02:26:46 +00:00
|
|
|
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
|
|
|
|
X11Utils::XWindowFromHandle(GetHandle()), false);
|
|
|
|
#endif
|
2011-08-21 21:30:19 +00:00
|
|
|
m_RenderFrame->SetTitle(wxString::FromAscii(scm_rev_str));
|
2010-11-25 02:26:46 +00:00
|
|
|
|
2010-04-12 01:33:10 +00:00
|
|
|
// Destroy the renderer frame when not rendering to main
|
2010-07-27 02:39:12 +00:00
|
|
|
m_RenderParent->Disconnect(wxID_ANY, wxEVT_SIZE,
|
2010-04-17 03:17:36 +00:00
|
|
|
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyDown),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_KEY_UP,
|
|
|
|
wxKeyEventHandler(CFrame::OnKeyUp),
|
|
|
|
(wxObject*)0, this);
|
2010-12-21 23:58:25 +00:00
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_RIGHT_DOWN, // Mouse
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_RIGHT_UP,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_MIDDLE_DOWN,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_MIDDLE_UP,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
|
|
|
wxTheApp->Disconnect(wxID_ANY, wxEVT_MOTION,
|
|
|
|
wxMouseEventHandler(CFrame::OnMouse),
|
|
|
|
(wxObject*)0, this);
|
2010-04-12 01:33:10 +00:00
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
|
|
|
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
2011-01-31 01:28:32 +00:00
|
|
|
DoFullscreen(false);
|
2010-04-12 01:33:10 +00:00
|
|
|
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
|
|
|
m_RenderFrame->Destroy();
|
2010-04-12 20:41:38 +00:00
|
|
|
m_RenderParent = NULL;
|
2010-04-12 01:33:10 +00:00
|
|
|
|
2010-01-01 03:55:39 +00:00
|
|
|
// Clean framerate indications from the status bar.
|
2010-07-30 03:51:49 +00:00
|
|
|
GetStatusBar()->SetStatusText(wxT(" "), 0);
|
2010-07-08 17:25:20 +00:00
|
|
|
|
2010-07-19 02:09:34 +00:00
|
|
|
// Clear wiimote connection status from the status bar.
|
2010-07-30 03:51:49 +00:00
|
|
|
GetStatusBar()->SetStatusText(wxT(" "), 1);
|
2011-01-20 21:37:00 +00:00
|
|
|
|
|
|
|
// If batch mode was specified on the command-line, exit now.
|
|
|
|
if (m_bBatchMode)
|
|
|
|
Close(true);
|
|
|
|
|
2011-01-25 03:30:12 +00:00
|
|
|
// If using auto size with render to main, reset the application size.
|
|
|
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize)
|
|
|
|
SetSize(SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth,
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight);
|
|
|
|
|
2011-01-20 21:37:00 +00:00
|
|
|
m_GameListCtrl->Enable();
|
|
|
|
m_GameListCtrl->Show();
|
2011-06-19 01:22:34 +00:00
|
|
|
UpdateGUI();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-30 07:05:47 +00:00
|
|
|
void CFrame::DoRecordingSave()
|
|
|
|
{
|
|
|
|
bool paused = (Core::GetState() == Core::CORE_PAUSE);
|
|
|
|
|
|
|
|
if (!paused)
|
|
|
|
DoPause();
|
|
|
|
|
|
|
|
wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Select The Recording File"),
|
2010-08-30 07:05:47 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-01-06 13:57:46 +00:00
|
|
|
_("Dolphin TAS Movies (*.dtm)") +
|
|
|
|
wxString::Format(wxT("|*.dtm|%s"), wxGetTranslation(wxALL_FILES)),
|
2011-05-03 00:06:44 +00:00
|
|
|
wxFD_SAVE | wxFD_PREVIEW | wxFD_OVERWRITE_PROMPT,
|
2010-08-30 07:05:47 +00:00
|
|
|
this);
|
|
|
|
|
|
|
|
if(path.IsEmpty())
|
|
|
|
return;
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
Movie::SaveRecording(path.mb_str());
|
2010-08-30 07:05:47 +00:00
|
|
|
|
|
|
|
if (!paused)
|
|
|
|
DoPause();
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2009-04-28 23:47:18 +00:00
|
|
|
DoStop();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-06-20 11:05:52 +00:00
|
|
|
|
2009-10-06 15:49:20 +00:00
|
|
|
void CFrame::OnReset(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
ProcessorInterface::ResetButton_Tap();
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CConfigMain ConfigMain(this);
|
|
|
|
if (ConfigMain.ShowModal() == wxID_OK)
|
|
|
|
m_GameListCtrl->Update();
|
|
|
|
}
|
|
|
|
|
2011-02-02 16:34:12 +00:00
|
|
|
void CFrame::OnConfigGFX(wxCommandEvent& WXUNUSED (event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2011-01-31 01:28:32 +00:00
|
|
|
if (g_video_backend)
|
|
|
|
g_video_backend->ShowConfig(this);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 16:34:12 +00:00
|
|
|
void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2011-01-29 04:16:05 +00:00
|
|
|
CConfigMain ConfigMain(this);
|
|
|
|
ConfigMain.SetSelectedTab(CConfigMain::ID_AUDIOPAGE);
|
|
|
|
if (ConfigMain.ShowModal() == wxID_OK)
|
|
|
|
m_GameListCtrl->Update();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 16:34:12 +00:00
|
|
|
void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-10-12 19:42:29 +00:00
|
|
|
InputPlugin *const pad_plugin = Pad::GetPlugin();
|
2010-06-13 09:14:40 +00:00
|
|
|
bool was_init = false;
|
2010-10-12 19:42:29 +00:00
|
|
|
if (g_controller_interface.IsInit()) // check if game is running
|
2010-06-13 09:14:40 +00:00
|
|
|
was_init = true;
|
|
|
|
else
|
|
|
|
{
|
2010-06-13 14:49:49 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
2010-07-16 03:43:11 +00:00
|
|
|
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
2010-10-12 19:42:29 +00:00
|
|
|
Pad::Initialize((void *)win);
|
2010-06-13 14:49:49 +00:00
|
|
|
#else
|
2010-10-12 19:42:29 +00:00
|
|
|
Pad::Initialize(GetHandle());
|
2010-06-13 14:49:49 +00:00
|
|
|
#endif
|
2010-06-13 09:14:40 +00:00
|
|
|
}
|
2011-02-02 16:34:12 +00:00
|
|
|
InputConfigDialog m_ConfigFrame(this, *pad_plugin, _trans("Dolphin GCPad Configuration"));
|
|
|
|
m_ConfigFrame.ShowModal();
|
|
|
|
m_ConfigFrame.Destroy();
|
2010-06-16 02:57:50 +00:00
|
|
|
if (!was_init) // if game isn't running
|
2010-06-13 09:14:40 +00:00
|
|
|
{
|
2010-10-12 19:42:29 +00:00
|
|
|
Pad::Shutdown();
|
2010-06-13 09:14:40 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-06-13 09:14:40 +00:00
|
|
|
|
2011-02-02 16:34:12 +00:00
|
|
|
void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-10-12 19:42:29 +00:00
|
|
|
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
|
|
|
|
bool was_init = false;
|
|
|
|
if (g_controller_interface.IsInit()) // check if game is running
|
|
|
|
was_init = true;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
|
|
|
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
|
|
|
Wiimote::Initialize((void *)win);
|
|
|
|
#else
|
|
|
|
Wiimote::Initialize(GetHandle());
|
|
|
|
#endif
|
|
|
|
}
|
2011-02-02 16:34:12 +00:00
|
|
|
WiimoteConfigDiag m_ConfigFrame(this, *wiimote_plugin);
|
|
|
|
m_ConfigFrame.ShowModal();
|
|
|
|
m_ConfigFrame.Destroy();
|
2010-10-12 19:42:29 +00:00
|
|
|
if (!was_init) // if game isn't running
|
|
|
|
{
|
|
|
|
Wiimote::Shutdown();
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-12 06:46:33 +00:00
|
|
|
void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this);
|
|
|
|
m_HotkeyDialog->ShowModal();
|
|
|
|
m_HotkeyDialog->Destroy();
|
|
|
|
// Update the GUI in case menu accelerators were changed
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnHelp(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
2010-06-01 21:03:02 +00:00
|
|
|
case wxID_ABOUT:
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2009-11-01 01:24:30 +00:00
|
|
|
AboutDolphin frame(this);
|
|
|
|
frame.ShowModal();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2010-02-25 06:38:09 +00:00
|
|
|
break;
|
2009-02-23 06:15:48 +00:00
|
|
|
case IDM_HELPWEBSITE:
|
2010-12-11 01:09:28 +00:00
|
|
|
WxUtils::Launch("http://www.dolphin-emulator.com/");
|
2009-02-23 06:15:48 +00:00
|
|
|
break;
|
|
|
|
case IDM_HELPGOOGLECODE:
|
2009-02-24 19:31:32 +00:00
|
|
|
WxUtils::Launch("http://code.google.com/p/dolphin-emu/");
|
2009-02-23 06:15:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-08-27 07:33:07 +00:00
|
|
|
|
2009-09-01 19:47:04 +00:00
|
|
|
void CFrame::ClearStatusBar()
|
2009-08-27 07:33:07 +00:00
|
|
|
{
|
2009-09-01 19:47:04 +00:00
|
|
|
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxT(""),0);
|
2009-08-27 07:33:07 +00:00
|
|
|
}
|
2009-09-08 21:16:05 +00:00
|
|
|
|
|
|
|
void CFrame::StatusBarMessage(const char * Text, ...)
|
2009-09-03 07:59:24 +00:00
|
|
|
{
|
|
|
|
const int MAX_BYTES = 1024*10;
|
|
|
|
char Str[MAX_BYTES];
|
|
|
|
va_list ArgPtr;
|
|
|
|
int Cnt;
|
|
|
|
va_start(ArgPtr, Text);
|
|
|
|
Cnt = vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
|
|
|
|
va_end(ArgPtr);
|
|
|
|
|
|
|
|
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxString::FromAscii(Str),0);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2009-09-02 21:00:45 +00:00
|
|
|
|
2009-08-29 06:08:14 +00:00
|
|
|
// Miscellaneous menus
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-05-13 21:50:24 +00:00
|
|
|
// NetPlay stuff
|
|
|
|
void CFrame::OnNetPlay(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-02-27 02:27:43 +00:00
|
|
|
if (!g_NetPlaySetupDiag)
|
|
|
|
{
|
|
|
|
if (NetPlayDiag::GetInstance() != NULL)
|
|
|
|
NetPlayDiag::GetInstance()->Raise();
|
|
|
|
else
|
|
|
|
g_NetPlaySetupDiag = new NetPlaySetupDiag(this, m_GameListCtrl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_NetPlaySetupDiag->Raise();
|
2009-05-13 21:50:24 +00:00
|
|
|
}
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
CMemcardManager MemcardManager(this);
|
|
|
|
MemcardManager.ShowModal();
|
2010-01-05 07:34:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnImportSave(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-01-05 04:35:46 +00:00
|
|
|
wxString path = wxFileSelector(_("Select the save file"),
|
2010-01-05 07:34:03 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Wii save files (*.bin)|*.bin"),
|
2010-01-05 07:34:03 +00:00
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
|
|
|
|
|
|
|
if (!path.IsEmpty())
|
|
|
|
{
|
2010-09-06 04:36:58 +00:00
|
|
|
CWiiSaveCrypted* saveFile = new CWiiSaveCrypted(path.mb_str());
|
2010-01-14 07:19:10 +00:00
|
|
|
delete saveFile;
|
2010-01-05 07:34:03 +00:00
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-02-27 02:27:43 +00:00
|
|
|
if (!g_CheatsWindow)
|
|
|
|
g_CheatsWindow = new wxCheatsWindow(this);
|
|
|
|
else
|
|
|
|
g_CheatsWindow->Raise();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-03-20 19:12:04 +00:00
|
|
|
|
2011-05-08 02:56:09 +00:00
|
|
|
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
2011-05-09 05:47:29 +00:00
|
|
|
BootGame(Common::GetTitleContentPath(TITLEID_SYSMENU));
|
2011-05-08 02:56:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnInstallWAD(wxCommandEvent& event)
|
2009-02-27 23:44:15 +00:00
|
|
|
{
|
2011-05-08 02:56:09 +00:00
|
|
|
std::string fileName;
|
|
|
|
|
|
|
|
switch(event.GetId())
|
2010-05-13 04:50:18 +00:00
|
|
|
{
|
2011-05-08 02:56:09 +00:00
|
|
|
case IDM_LIST_INSTALLWAD:
|
|
|
|
{
|
|
|
|
const GameListItem *iso = m_GameListCtrl->GetSelectedISO();
|
|
|
|
if (!iso)
|
|
|
|
return;
|
|
|
|
fileName = iso->GetFileName();
|
|
|
|
break;
|
2010-05-13 04:50:18 +00:00
|
|
|
}
|
2011-05-08 02:56:09 +00:00
|
|
|
case IDM_MENU_INSTALLWAD:
|
2010-05-13 04:50:18 +00:00
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
2011-03-05 05:07:44 +00:00
|
|
|
_("Select a Wii WAD file to install"),
|
2010-05-13 04:50:18 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-03-05 05:07:44 +00:00
|
|
|
_T("Wii WAD file (*.wad)|*.wad"),
|
2010-05-13 04:50:18 +00:00
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
2011-05-08 02:56:09 +00:00
|
|
|
fileName = path.mb_str();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2010-05-13 04:50:18 +00:00
|
|
|
|
2011-05-08 02:56:09 +00:00
|
|
|
wxProgressDialog dialog(_("Installing WAD..."),
|
2011-03-05 05:07:44 +00:00
|
|
|
_("Working..."),
|
|
|
|
1000, // range
|
|
|
|
this, // parent
|
|
|
|
wxPD_APP_MODAL |
|
2011-05-08 02:56:09 +00:00
|
|
|
wxPD_ELAPSED_TIME |
|
|
|
|
wxPD_ESTIMATED_TIME |
|
|
|
|
wxPD_REMAINING_TIME |
|
2011-03-05 05:07:44 +00:00
|
|
|
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
|
|
|
);
|
2011-05-08 02:56:09 +00:00
|
|
|
|
|
|
|
dialog.CenterOnParent();
|
|
|
|
|
2011-05-09 05:47:29 +00:00
|
|
|
u64 titleID = DiscIO::CNANDContentManager::Access().Install_WiiWAD(fileName);
|
2011-05-08 02:56:09 +00:00
|
|
|
if (titleID == TITLEID_SYSMENU)
|
|
|
|
{
|
2011-05-24 19:12:18 +00:00
|
|
|
UpdateWiiMenuChoice();
|
|
|
|
}
|
|
|
|
}
|
2011-03-05 05:10:28 +00:00
|
|
|
|
2011-05-24 19:12:18 +00:00
|
|
|
|
|
|
|
void CFrame::UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem)
|
|
|
|
{
|
|
|
|
if (!WiiMenuItem)
|
|
|
|
{
|
|
|
|
WiiMenuItem = GetMenuBar()->FindItem(IDM_LOAD_WII_MENU);
|
|
|
|
}
|
|
|
|
|
|
|
|
const DiscIO::INANDContentLoader & SysMenu_Loader = DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU, true);
|
|
|
|
if (SysMenu_Loader.IsValid())
|
|
|
|
{
|
|
|
|
int sysmenuVersion = SysMenu_Loader.GetTitleVersion();
|
|
|
|
char sysmenuRegion = SysMenu_Loader.GetCountryChar();
|
|
|
|
WiiMenuItem->Enable();
|
|
|
|
WiiMenuItem->SetItemLabel(wxString::Format(_("Load Wii System Menu %d%c"), sysmenuVersion, sysmenuRegion));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WiiMenuItem->Enable(false);
|
|
|
|
WiiMenuItem->SetItemLabel(_("Load Wii System Menu"));
|
2010-05-13 04:50:18 +00:00
|
|
|
}
|
2009-02-27 23:44:15 +00:00
|
|
|
}
|
|
|
|
|
2011-03-27 02:55:08 +00:00
|
|
|
void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
if (m_FifoPlayerDlg)
|
|
|
|
{
|
|
|
|
m_FifoPlayerDlg->Show();
|
|
|
|
m_FifoPlayerDlg->SetFocus();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_FifoPlayerDlg = new FifoPlayerDlg(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-07 15:18:00 +00:00
|
|
|
void CFrame::ConnectWiimote(int wm_idx, bool connect)
|
2009-12-27 19:31:02 +00:00
|
|
|
{
|
2011-03-15 23:09:12 +00:00
|
|
|
if (Core::IsRunning() && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
2009-12-30 09:00:43 +00:00
|
|
|
{
|
2011-01-07 15:18:00 +00:00
|
|
|
GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->Activate(connect);
|
2011-01-20 03:02:51 +00:00
|
|
|
wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1,
|
|
|
|
connect ? wxT("Connected") : wxT("Disconnected")));
|
2010-01-04 03:11:31 +00:00
|
|
|
Core::DisplayMessage(msg.ToAscii(), 3000);
|
2009-12-30 09:00:43 +00:00
|
|
|
}
|
2009-12-27 19:31:02 +00:00
|
|
|
}
|
|
|
|
|
2011-01-07 15:18:00 +00:00
|
|
|
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, event.IsChecked());
|
|
|
|
}
|
|
|
|
|
2009-06-18 08:22:02 +00:00
|
|
|
// Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover
|
|
|
|
// the entire screen (when we render to the main window).
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2010-04-12 01:33:10 +00:00
|
|
|
DoFullscreen(!RendererIsFullscreen());
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2009-10-23 15:26:35 +00:00
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = !SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
|
2009-02-23 06:15:48 +00:00
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
2009-03-20 19:12:04 +00:00
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnToggleSkipIdle(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = !SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
|
|
|
}
|
|
|
|
|
2009-06-28 01:11:35 +00:00
|
|
|
void CFrame::OnLoadStateFromFile(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Select the state to load"),
|
2009-06-28 01:11:35 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-01-06 13:57:46 +00:00
|
|
|
_("All Save States (sav, s##)") +
|
|
|
|
wxString::Format(wxT("|*.sav;*.s??|%s"), wxGetTranslation(wxALL_FILES)),
|
2009-06-28 01:11:35 +00:00
|
|
|
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
|
|
|
|
this);
|
|
|
|
|
2011-03-17 10:17:45 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
State::LoadAs((const char*)path.mb_str());
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
wxString path = wxFileSelector(
|
2011-01-05 04:35:46 +00:00
|
|
|
_("Select the state to save"),
|
2009-06-28 01:11:35 +00:00
|
|
|
wxEmptyString, wxEmptyString, wxEmptyString,
|
2011-01-06 13:57:46 +00:00
|
|
|
_("All Save States (sav, s##)") +
|
|
|
|
wxString::Format(wxT("|*.sav;*.s??|%s"), wxGetTranslation(wxALL_FILES)),
|
2009-06-28 01:11:35 +00:00
|
|
|
wxFD_SAVE,
|
|
|
|
this);
|
|
|
|
|
2011-03-17 10:17:45 +00:00
|
|
|
if (!path.IsEmpty())
|
|
|
|
State::SaveAs((const char*)path.mb_str());
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
State::LoadLastSaved();
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 21:11:51 +00:00
|
|
|
void CFrame::OnUndoLoadState(wxCommandEvent& WXUNUSED (event))
|
2009-06-28 01:11:35 +00:00
|
|
|
{
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
State::UndoLoadState();
|
2009-06-28 01:11:35 +00:00
|
|
|
}
|
|
|
|
|
2009-06-28 21:11:51 +00:00
|
|
|
void CFrame::OnUndoSaveState(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
State::UndoSaveState();
|
2009-06-28 21:11:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-02-23 06:15:48 +00:00
|
|
|
void CFrame::OnLoadState(wxCommandEvent& event)
|
|
|
|
{
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_LOADSLOT1 + 1;
|
|
|
|
State::Load(slot);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrame::OnSaveState(wxCommandEvent& event)
|
|
|
|
{
|
2011-06-18 04:04:48 +00:00
|
|
|
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
int slot = id - IDM_SAVESLOT1 + 1;
|
|
|
|
State::Save(slot);
|
|
|
|
}
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-08-08 01:39:56 +00:00
|
|
|
void CFrame::OnFrameSkip(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int amount = event.GetId() - IDM_FRAMESKIP0;
|
|
|
|
|
2011-06-24 06:50:50 +00:00
|
|
|
Movie::SetFrameSkipping((unsigned int)amount);
|
2009-08-08 01:39:56 +00:00
|
|
|
}
|
|
|
|
|
2009-08-25 07:49:23 +00:00
|
|
|
|
2009-09-02 21:00:45 +00:00
|
|
|
|
|
|
|
|
2009-08-27 10:10:07 +00:00
|
|
|
// GUI
|
2009-09-08 16:07:13 +00:00
|
|
|
// ---------------------
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Update the enabled/disabled status
|
|
|
|
void CFrame::UpdateGUI()
|
|
|
|
{
|
|
|
|
// Save status
|
2011-03-15 23:09:12 +00:00
|
|
|
bool Initialized = Core::IsRunning();
|
2009-09-07 12:40:43 +00:00
|
|
|
bool Running = Core::GetState() == Core::CORE_RUN;
|
|
|
|
bool Paused = Core::GetState() == Core::CORE_PAUSE;
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Make sure that we have a toolbar
|
2009-09-15 21:35:32 +00:00
|
|
|
if (m_ToolBar)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
|
|
|
// Enable/disable the Config and Stop buttons
|
2009-09-07 12:40:43 +00:00
|
|
|
m_ToolBar->EnableTool(wxID_OPEN, !Initialized);
|
|
|
|
m_ToolBar->EnableTool(wxID_REFRESH, !Initialized); // Don't allow refresh when we don't show the list
|
|
|
|
m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
|
2010-04-12 01:33:10 +00:00
|
|
|
m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused);
|
2009-09-07 12:40:43 +00:00
|
|
|
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// File
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized);
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_DRIVES)->Enable(!Initialized);
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized);
|
|
|
|
GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!Initialized);
|
2009-02-23 06:15:48 +00:00
|
|
|
|
|
|
|
// Emulation
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_STOP)->Enable(Running || Paused);
|
2009-10-22 19:13:22 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused);
|
2011-06-24 06:50:50 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput());
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
|
2011-12-18 10:23:59 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_RECORDEXPORT)->Enable(Movie::IsPlayingInput() || Movie::IsRecordingInput());
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
|
|
|
|
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
|
2010-04-12 01:33:10 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);
|
|
|
|
|
|
|
|
// Update Menu Accelerators
|
2011-02-14 01:18:01 +00:00
|
|
|
for (unsigned int i = 0; i < NUM_HOTKEYS; i++)
|
|
|
|
GetMenuBar()->FindItem(GetCmdForHotkey(i))->SetItemLabel(GetMenuLabel(i));
|
2010-04-12 01:33:10 +00:00
|
|
|
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized);
|
|
|
|
GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized);
|
2009-02-23 06:15:48 +00:00
|
|
|
// Misc
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized);
|
2010-09-06 04:36:58 +00:00
|
|
|
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU).IsValid())
|
2009-09-07 12:40:43 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
|
2009-02-23 06:15:48 +00:00
|
|
|
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->
|
|
|
|
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->
|
|
|
|
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->
|
|
|
|
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
|
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->
|
|
|
|
Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
|
2010-02-06 05:22:53 +00:00
|
|
|
if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
|
2009-12-27 19:31:02 +00:00
|
|
|
{
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
|
2010-09-05 20:18:13 +00:00
|
|
|
AccessWiiMote(0x0100)->IsConnected());
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->
|
2010-09-05 20:18:13 +00:00
|
|
|
AccessWiiMote(0x0101)->IsConnected());
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->
|
2010-09-05 20:18:13 +00:00
|
|
|
AccessWiiMote(0x0102)->IsConnected());
|
2010-07-30 03:51:49 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->
|
2010-09-05 20:18:13 +00:00
|
|
|
AccessWiiMote(0x0103)->IsConnected());
|
2009-12-27 19:31:02 +00:00
|
|
|
}
|
|
|
|
|
2009-09-07 12:40:43 +00:00
|
|
|
if (Running)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2009-09-15 21:35:32 +00:00
|
|
|
if (m_ToolBar)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2009-08-25 10:58:13 +00:00
|
|
|
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Pause]);
|
|
|
|
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Pause"));
|
|
|
|
m_ToolBar->SetToolLabel(IDM_PLAY, _("Pause"));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-15 21:35:32 +00:00
|
|
|
if (m_ToolBar)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2009-08-25 10:58:13 +00:00
|
|
|
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]);
|
|
|
|
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Play"));
|
2011-01-06 13:57:46 +00:00
|
|
|
m_ToolBar->SetToolLabel(IDM_PLAY, _("Play"));
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-18 10:23:59 +00:00
|
|
|
|
2011-12-20 00:38:07 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Enable(Running || Paused);
|
2010-01-18 12:10:51 +00:00
|
|
|
|
2011-06-19 01:22:34 +00:00
|
|
|
if (!Initialized && !m_bGameLoading)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-01-22 21:41:25 +00:00
|
|
|
if (m_GameListCtrl->IsEnabled())
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
|
|
|
// Prepare to load Default ISO, enable play button
|
2010-02-06 05:22:53 +00:00
|
|
|
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty())
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
|
|
|
if (m_ToolBar)
|
2011-05-24 19:12:18 +00:00
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, true);
|
2010-01-18 12:10:51 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(true);
|
|
|
|
}
|
2010-01-19 13:43:51 +00:00
|
|
|
// Prepare to load last selected file, enable play button
|
|
|
|
else if (!SConfig::GetInstance().m_LastFilename.empty()
|
2011-06-19 01:22:34 +00:00
|
|
|
&& wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
2010-01-19 13:43:51 +00:00
|
|
|
{
|
|
|
|
if (m_ToolBar)
|
2011-05-24 19:12:18 +00:00
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, true);
|
2010-01-19 13:43:51 +00:00
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(true);
|
|
|
|
}
|
2010-01-18 12:10:51 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// No game has been selected yet, disable play button
|
|
|
|
if (m_ToolBar)
|
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, false);
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-19 01:22:34 +00:00
|
|
|
// Game has not started, show game list
|
|
|
|
if (!m_GameListCtrl->IsShown())
|
2010-01-18 12:10:51 +00:00
|
|
|
{
|
2011-06-19 01:22:34 +00:00
|
|
|
m_GameListCtrl->Enable();
|
|
|
|
m_GameListCtrl->Show();
|
|
|
|
}
|
|
|
|
// Game has been selected but not started, enable play button
|
|
|
|
if (m_GameListCtrl->GetSelectedISO() != NULL && m_GameListCtrl->IsEnabled())
|
|
|
|
{
|
|
|
|
if (m_ToolBar)
|
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, true);
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(true);
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
}
|
2011-06-19 01:22:34 +00:00
|
|
|
else if (Initialized)
|
2009-02-23 06:15:48 +00:00
|
|
|
{
|
2010-06-05 01:38:22 +00:00
|
|
|
// Game has been loaded, enable the pause button
|
2010-01-18 12:10:51 +00:00
|
|
|
if (m_ToolBar)
|
|
|
|
m_ToolBar->EnableTool(IDM_PLAY, true);
|
|
|
|
GetMenuBar()->FindItem(IDM_PLAY)->Enable(true);
|
2010-01-20 09:24:06 +00:00
|
|
|
|
|
|
|
// Reset game loading flag
|
2010-04-17 03:17:36 +00:00
|
|
|
m_bGameLoading = false;
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
2009-08-27 00:54:44 +00:00
|
|
|
|
2009-09-25 16:29:00 +00:00
|
|
|
if (m_ToolBar) m_ToolBar->Refresh();
|
2009-09-15 21:35:32 +00:00
|
|
|
|
2009-08-27 00:54:44 +00:00
|
|
|
// Commit changes to manager
|
|
|
|
m_Mgr->Update();
|
2009-02-23 06:15:48 +00:00
|
|
|
}
|
|
|
|
|
2010-06-01 21:03:02 +00:00
|
|
|
void CFrame::UpdateGameList()
|
|
|
|
{
|
|
|
|
m_GameListCtrl->Update();
|
|
|
|
}
|
|
|
|
|
2009-04-28 02:30:50 +00:00
|
|
|
void CFrame::GameListChanged(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
switch (event.GetId())
|
|
|
|
{
|
|
|
|
case IDM_LISTWII:
|
|
|
|
SConfig::GetInstance().m_ListWii = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTGC:
|
|
|
|
SConfig::GetInstance().m_ListGC = event.IsChecked();
|
|
|
|
break;
|
2009-06-07 02:27:36 +00:00
|
|
|
case IDM_LISTWAD:
|
|
|
|
SConfig::GetInstance().m_ListWad = event.IsChecked();
|
|
|
|
break;
|
2009-04-28 02:30:50 +00:00
|
|
|
case IDM_LISTJAP:
|
|
|
|
SConfig::GetInstance().m_ListJap = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTPAL:
|
|
|
|
SConfig::GetInstance().m_ListPal = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTUSA:
|
|
|
|
SConfig::GetInstance().m_ListUsa = event.IsChecked();
|
|
|
|
break;
|
2010-01-11 05:07:56 +00:00
|
|
|
case IDM_LISTFRANCE:
|
|
|
|
SConfig::GetInstance().m_ListFrance = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTITALY:
|
|
|
|
SConfig::GetInstance().m_ListItaly = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTKOREA:
|
|
|
|
SConfig::GetInstance().m_ListKorea = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LISTTAIWAN:
|
|
|
|
SConfig::GetInstance().m_ListTaiwan = event.IsChecked();
|
|
|
|
break;
|
|
|
|
case IDM_LIST_UNK:
|
|
|
|
SConfig::GetInstance().m_ListUnknown = event.IsChecked();
|
|
|
|
break;
|
2009-04-28 02:30:50 +00:00
|
|
|
case IDM_LISTDRIVES:
|
|
|
|
SConfig::GetInstance().m_ListDrives = event.IsChecked();
|
|
|
|
break;
|
2009-06-06 07:36:22 +00:00
|
|
|
case IDM_PURGECACHE:
|
|
|
|
CFileSearch::XStringVector Directories;
|
2011-02-28 20:40:15 +00:00
|
|
|
Directories.push_back(File::GetUserPath(D_CACHE_IDX).c_str());
|
2009-06-06 07:36:22 +00:00
|
|
|
CFileSearch::XStringVector Extensions;
|
|
|
|
Extensions.push_back("*.cache");
|
|
|
|
|
|
|
|
CFileSearch FileSearch(Extensions, Directories);
|
|
|
|
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
|
|
|
|
|
|
|
for (u32 i = 0; i < rFilenames.size(); i++)
|
|
|
|
{
|
2011-03-01 03:06:14 +00:00
|
|
|
File::Delete(rFilenames[i]);
|
2009-06-06 07:36:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-04-28 02:30:50 +00:00
|
|
|
}
|
|
|
|
|
2009-09-06 13:36:05 +00:00
|
|
|
if (m_GameListCtrl) m_GameListCtrl->Update();
|
2009-04-28 02:30:50 +00:00
|
|
|
}
|
2009-09-01 19:47:04 +00:00
|
|
|
|
|
|
|
// Enable and disable the toolbar
|
|
|
|
void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked();
|
|
|
|
DoToggleToolbar(event.IsChecked());
|
|
|
|
}
|
2009-09-02 07:59:06 +00:00
|
|
|
void CFrame::DoToggleToolbar(bool _show)
|
2009-09-01 19:47:04 +00:00
|
|
|
{
|
2009-09-02 07:59:06 +00:00
|
|
|
if (_show)
|
2009-09-01 19:47:04 +00:00
|
|
|
{
|
|
|
|
m_Mgr->GetPane(wxT("TBMain")).Show();
|
2010-07-27 22:12:19 +00:00
|
|
|
if (g_pCodeWindow)
|
2010-08-01 04:09:59 +00:00
|
|
|
{
|
|
|
|
m_Mgr->GetPane(wxT("TBDebug")).Show();
|
|
|
|
m_Mgr->GetPane(wxT("TBAui")).Show();
|
|
|
|
}
|
2009-09-01 19:47:04 +00:00
|
|
|
m_Mgr->Update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_Mgr->GetPane(wxT("TBMain")).Hide();
|
2010-07-27 22:12:19 +00:00
|
|
|
if (g_pCodeWindow)
|
2010-08-01 04:09:59 +00:00
|
|
|
{
|
|
|
|
m_Mgr->GetPane(wxT("TBDebug")).Hide();
|
|
|
|
m_Mgr->GetPane(wxT("TBAui")).Hide();
|
|
|
|
}
|
2009-09-01 19:47:04 +00:00
|
|
|
m_Mgr->Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Enable and disable the status bar
|
|
|
|
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked();
|
|
|
|
if (SConfig::GetInstance().m_InterfaceStatusbar == true)
|
2010-07-30 03:51:49 +00:00
|
|
|
GetStatusBar()->Show();
|
2009-09-01 19:47:04 +00:00
|
|
|
else
|
2010-07-30 03:51:49 +00:00
|
|
|
GetStatusBar()->Hide();
|
2009-09-01 19:47:04 +00:00
|
|
|
|
|
|
|
this->SendSizeEvent();
|
|
|
|
}
|