mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Big restructuring of how the video plugin works. In linux and windows you shouldn't see a change in the functionality; however, there are changes in how render to main or not, and fullscreen modes, and such are handled. Input is largely restructured for the video plugin. It is now handled by the host. Keys for pausing and changing fullscreen are configurable. More will probably be later. This is probably classified as highly experimental.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5336 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -90,6 +90,22 @@ void SConfig::SaveSettings()
|
||||
ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
|
||||
ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
|
||||
|
||||
// Hotkeys
|
||||
ini.Set("Hotkeys", "ToggleFullscreen", m_LocalCoreStartupParameter.iHotkey[HK_FULLSCREEN]);
|
||||
ini.Set("Hotkeys", "PlayPause", m_LocalCoreStartupParameter.iHotkey[HK_PLAY_PAUSE]);
|
||||
ini.Set("Hotkeys", "Stop", m_LocalCoreStartupParameter.iHotkey[HK_STOP]);
|
||||
ini.Set("Hotkeys", "ToggleFullscreenModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_FULLSCREEN]);
|
||||
ini.Set("Hotkeys", "PlayPauseModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_PLAY_PAUSE]);
|
||||
ini.Set("Hotkeys", "StopModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_STOP]);
|
||||
|
||||
// Display
|
||||
ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
|
||||
ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
|
||||
ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
|
||||
ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos);
|
||||
ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth);
|
||||
ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
|
||||
|
||||
// Game List Control
|
||||
ini.Set("GameList", "ListDrives", m_ListDrives);
|
||||
ini.Set("GameList", "ListWad", m_ListWad);
|
||||
@ -198,6 +214,23 @@ void SConfig::LoadSettings()
|
||||
ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false);
|
||||
ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false);
|
||||
|
||||
// Hotkeys
|
||||
ini.Get("Hotkeys", "ToggleFullscreen", &m_LocalCoreStartupParameter.iHotkey[HK_FULLSCREEN], 13); // WXK_RETURN
|
||||
ini.Get("Hotkeys", "PlayPause", &m_LocalCoreStartupParameter.iHotkey[HK_PLAY_PAUSE], 349); // WXK_F10
|
||||
ini.Get("Hotkeys", "Stop", &m_LocalCoreStartupParameter.iHotkey[HK_STOP], 27); // WXK_ESCAPE
|
||||
ini.Get("Hotkeys", "ToggleFullscreenModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_FULLSCREEN], 0x0001); // wxMOD_ALT
|
||||
ini.Get("Hotkeys", "PlayPauseModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_PLAY_PAUSE], 0x0000); // wxMOD_NONE
|
||||
ini.Get("Hotkeys", "StopModifier", &m_LocalCoreStartupParameter.iHotkeyModifier[HK_STOP], 0x0000); // wxMOD_NONE
|
||||
|
||||
// Display
|
||||
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
|
||||
ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
|
||||
std::string temp;
|
||||
ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, 0);
|
||||
ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, 0);
|
||||
ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);
|
||||
ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
|
||||
|
||||
// Game List Control
|
||||
ini.Get("GameList", "ListDrives", &m_ListDrives, false);
|
||||
ini.Get("GameList", "ListWad", &m_ListWad, true);
|
||||
|
@ -71,7 +71,7 @@ volatile u32 DrawnFrame = 0;
|
||||
u32 DrawnVideo = 0;
|
||||
|
||||
// Function forwarding
|
||||
//void Callback_VideoRequestWindowSize(int _iWidth, int _iHeight, BOOL _bFullscreen);
|
||||
void Callback_VideoRequestWindowSize(int& x, int& y, int& width, int& height);
|
||||
void Callback_VideoLog(const TCHAR* _szMessage, int _bDoBreak);
|
||||
void Callback_VideoCopiedToXFB(bool video_update);
|
||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v);
|
||||
@ -80,9 +80,10 @@ void Callback_DSPInterrupt();
|
||||
void Callback_PADLog(const TCHAR* _szMessage);
|
||||
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v);
|
||||
void Callback_WiimoteInput(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
bool Callback_RendererHasFocus(void);
|
||||
|
||||
// For keyboard shortcuts.
|
||||
void Callback_KeyPress(int key, bool shift, bool control);
|
||||
void Callback_CoreMessage(int Id);
|
||||
TPeekMessages Callback_PeekMessages = NULL;
|
||||
TUpdateFPSDisplay g_pUpdateFPSDisplay = NULL;
|
||||
|
||||
@ -322,17 +323,14 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
VideoInitialize.pScheduleEvent_Threadsafe = CoreTiming::ScheduleEvent_Threadsafe;
|
||||
// This is first the m_Panel handle, then it is updated to have the new window handle
|
||||
VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow;
|
||||
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2
|
||||
VideoInitialize.pPanel = _CoreParameter.hMainWindow;
|
||||
#endif
|
||||
VideoInitialize.pLog = Callback_VideoLog;
|
||||
VideoInitialize.pSysMessage = Host_SysMessage;
|
||||
VideoInitialize.pRequestWindowSize = NULL; //Callback_VideoRequestWindowSize;
|
||||
VideoInitialize.pRequestWindowSize = Callback_VideoRequestWindowSize;
|
||||
VideoInitialize.pCopiedToXFB = Callback_VideoCopiedToXFB;
|
||||
VideoInitialize.pPeekMessages = NULL;
|
||||
VideoInitialize.pUpdateFPSDisplay = NULL;
|
||||
VideoInitialize.pMemoryBase = Memory::base;
|
||||
VideoInitialize.pKeyPress = Callback_KeyPress;
|
||||
VideoInitialize.pCoreMessage = Callback_CoreMessage;
|
||||
VideoInitialize.bWii = _CoreParameter.bWii;
|
||||
VideoInitialize.bOnThread = _CoreParameter.bCPUThread;
|
||||
VideoInitialize.Fifo_CPUBase = &ProcessorInterface::Fifo_CPUBase;
|
||||
@ -381,11 +379,9 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
PADInitialize.hWnd = g_pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
PADInitialize.pXWindow = g_pXWindow;
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2
|
||||
PADInitialize.pPanel = VideoInitialize.pPanel;
|
||||
#endif
|
||||
#endif
|
||||
PADInitialize.pLog = Callback_PADLog;
|
||||
PADInitialize.pRendererHasFocus = Callback_RendererHasFocus;
|
||||
// This is may be needed to avoid a SDL problem
|
||||
//Plugins.FreeWiimote();
|
||||
Plugins.GetPad(0)->Initialize(&PADInitialize);
|
||||
@ -396,14 +392,12 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
SWiimoteInitialize WiimoteInitialize;
|
||||
WiimoteInitialize.hWnd = g_pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2
|
||||
WiimoteInitialize.pPanel = VideoInitialize.pPanel;
|
||||
#endif
|
||||
WiimoteInitialize.pXWindow = g_pXWindow;
|
||||
#endif
|
||||
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
|
||||
WiimoteInitialize.pLog = Callback_WiimoteLog;
|
||||
WiimoteInitialize.pWiimoteInput = Callback_WiimoteInput;
|
||||
WiimoteInitialize.pRendererHasFocus = Callback_RendererHasFocus;
|
||||
// Wait for Wiiuse to find the number of connected Wiimotes
|
||||
Plugins.GetWiimote(0)->Initialize((void *)&WiimoteInitialize);
|
||||
}
|
||||
@ -711,6 +705,12 @@ void Callback_VideoCopiedToXFB(bool video_update)
|
||||
Frame::FrameUpdate();
|
||||
}
|
||||
|
||||
// Ask the host for the desired window size
|
||||
void Callback_VideoRequestWindowSize(int& x, int& y, int& width, int& height)
|
||||
{
|
||||
Host_RequestWindowSize(x, y, width, height);
|
||||
}
|
||||
|
||||
// Callback_DSPLog
|
||||
// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
|
||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
|
||||
@ -748,46 +748,10 @@ const char *Callback_ISOName()
|
||||
}
|
||||
|
||||
// Called from ANY thread!
|
||||
// The hotkey function
|
||||
void Callback_KeyPress(int key, bool shift, bool control)
|
||||
// Pass the message on to the host
|
||||
void Callback_CoreMessage(int Id)
|
||||
{
|
||||
// F1 - F8: Save states
|
||||
if (key >= 0x70 && key < 0x78) {
|
||||
// F-key
|
||||
int slot_number = key - 0x70 + 1;
|
||||
if (shift)
|
||||
State_Save(slot_number);
|
||||
else
|
||||
State_Load(slot_number);
|
||||
}
|
||||
|
||||
// 0x78 == VK_F9
|
||||
if (key == 0x78)
|
||||
ScreenShot();
|
||||
|
||||
// 0x7a == VK_F11
|
||||
if (key == 0x7a)
|
||||
State_LoadLastSaved();
|
||||
|
||||
// 0x7b == VK_F12
|
||||
if (key == 0x7b)
|
||||
{
|
||||
if(shift)
|
||||
State_UndoSaveState();
|
||||
else
|
||||
State_UndoLoadState();
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
if (key == 0)
|
||||
Host_Message(WM_USER_CREATE);
|
||||
// 0x1b == VK_ESCAPE
|
||||
if (key == 0x1b)
|
||||
Host_Message(WM_USER_STOP);
|
||||
if (key == 0x1c)
|
||||
Host_Message(WM_USER_PAUSE);
|
||||
if (key == 0x1d)
|
||||
Host_Message(TOGGLE_FULLSCREEN);
|
||||
#endif
|
||||
Host_Message(Id);
|
||||
}
|
||||
|
||||
// Callback_WiimoteLog
|
||||
@ -797,4 +761,10 @@ void Callback_WiimoteLog(const TCHAR* _szMessage, int _v)
|
||||
GENERIC_LOG(LogTypes::WIIMOTE, (LogTypes::LOG_LEVELS)_v, _szMessage);
|
||||
}
|
||||
|
||||
// Check to see if the renderer window has focus
|
||||
bool Callback_RendererHasFocus(void)
|
||||
{
|
||||
return Host_RendererHasFocus();
|
||||
}
|
||||
|
||||
} // Core
|
||||
|
@ -50,6 +50,9 @@ SCoreStartupParameter::SCoreStartupParameter()
|
||||
bWii(false),
|
||||
bConfirmStop(false), bHideCursor(false),
|
||||
bAutoHideCursor(false), bUsePanicHandlers(true),
|
||||
bFullscreen(false), bRenderToMain(false),
|
||||
iRenderWindowXPos(0), iRenderWindowYPos(0),
|
||||
iRenderWindowWidth(640), iRenderWindowHeight(480),
|
||||
iTheme(0),
|
||||
iPosX(100), iPosY(100), iWidth(800), iHeight(600)
|
||||
{
|
||||
|
@ -24,6 +24,13 @@
|
||||
#define MAXPADS 1
|
||||
#define MAXWIIMOTES 1
|
||||
|
||||
enum Hotkey {
|
||||
HK_FULLSCREEN,
|
||||
HK_PLAY_PAUSE,
|
||||
HK_STOP,
|
||||
NUM_HOTKEYS,
|
||||
};
|
||||
|
||||
struct SCoreStartupParameter
|
||||
{
|
||||
void * hInstance; // HINSTANCE but we don't want to include <windows.h>
|
||||
@ -77,6 +84,16 @@ struct SCoreStartupParameter
|
||||
|
||||
// Interface settings
|
||||
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;
|
||||
|
||||
// Hotkeys
|
||||
int iHotkey[NUM_HOTKEYS];
|
||||
int iHotkeyModifier[NUM_HOTKEYS];
|
||||
|
||||
// Display settings
|
||||
bool bFullscreen, bRenderToMain;
|
||||
int iRenderWindowXPos, iRenderWindowYPos;
|
||||
int iRenderWindowWidth, iRenderWindowHeight;
|
||||
|
||||
int iTheme;
|
||||
int iPosX, iPosY, iWidth, iHeight;
|
||||
|
||||
|
@ -45,6 +45,8 @@ void Host_NotifyMapLoaded();
|
||||
void Host_UpdateBreakPointView();
|
||||
void Host_ShowJitResults(unsigned int address);
|
||||
void Host_SetDebugMode(bool enable);
|
||||
void Host_RequestWindowSize(int& x, int& y, int& width, int& height);
|
||||
bool Host_RendererHasFocus();
|
||||
|
||||
void Host_SetWaitCursor(bool enable);
|
||||
|
||||
|
@ -601,7 +601,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete()
|
||||
SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
|
||||
pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL;
|
||||
pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
|
||||
pInquiryComplete->Status = 0x00;
|
||||
pInquiryComplete->EventStatus = 0x00;
|
||||
|
||||
AddEventToQueue(Event);
|
||||
|
||||
@ -666,7 +666,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdad
|
||||
|
||||
pConnectionComplete->EventType = HCI_EVENT_CON_COMPL;
|
||||
pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2;
|
||||
pConnectionComplete->Status = 0x00;
|
||||
pConnectionComplete->EventStatus = 0x00;
|
||||
pConnectionComplete->Connection_Handle = pWiiMote->GetConnectionHandle();
|
||||
pConnectionComplete->bdaddr = _bd;
|
||||
pConnectionComplete->LinkType = HCI_LINK_ACL;
|
||||
@ -745,7 +745,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHan
|
||||
SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer;
|
||||
pDisconnect->EventType = HCI_EVENT_DISCON_COMPL;
|
||||
pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
|
||||
pDisconnect->Status = 0;
|
||||
pDisconnect->EventStatus = 0;
|
||||
pDisconnect->Connection_Handle = _connectionHandle;
|
||||
pDisconnect->Reason = _Reason;
|
||||
|
||||
@ -770,7 +770,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _
|
||||
SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer;
|
||||
pEventAuthenticationCompleted->EventType = HCI_EVENT_AUTH_COMPL;
|
||||
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
|
||||
pEventAuthenticationCompleted->Status = 0;
|
||||
pEventAuthenticationCompleted->EventStatus = 0;
|
||||
pEventAuthenticationCompleted->Connection_Handle = _connectionHandle;
|
||||
|
||||
// Log
|
||||
@ -794,7 +794,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t&
|
||||
|
||||
pRemoteNameReq->EventType = HCI_EVENT_REMOTE_NAME_REQ_COMPL;
|
||||
pRemoteNameReq->PayloadLength = sizeof(SHCIEventRemoteNameReq) - 2;
|
||||
pRemoteNameReq->Status = 0x00;
|
||||
pRemoteNameReq->EventStatus = 0x00;
|
||||
pRemoteNameReq->bdaddr = _bd;
|
||||
strcpy((char*)pRemoteNameReq->RemoteName, pWiiMote->GetName());
|
||||
|
||||
@ -821,7 +821,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne
|
||||
|
||||
pReadRemoteFeatures->EventType = HCI_EVENT_READ_REMOTE_FEATURES_COMPL;
|
||||
pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
|
||||
pReadRemoteFeatures->Status = 0x00;
|
||||
pReadRemoteFeatures->EventStatus = 0x00;
|
||||
pReadRemoteFeatures->ConnectionHandle = _connectionHandle;
|
||||
pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0];
|
||||
pReadRemoteFeatures->features[1] = pWiiMote->GetFeatures()[1];
|
||||
@ -856,7 +856,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connec
|
||||
SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
|
||||
pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL;
|
||||
pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
|
||||
pReadRemoteVerInfo->Status = 0x00;
|
||||
pReadRemoteVerInfo->EventStatus = 0x00;
|
||||
pReadRemoteVerInfo->ConnectionHandle = _connectionHandle;
|
||||
pReadRemoteVerInfo->lmp_version = pWiiMote->GetLMPVersion();
|
||||
pReadRemoteVerInfo->manufacturer = pWiiMote->GetManufactorID();
|
||||
@ -914,7 +914,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode)
|
||||
SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.m_buffer;
|
||||
pHCIEvent->EventType = HCI_EVENT_COMMAND_STATUS;
|
||||
pHCIEvent->PayloadLength = sizeof(SHCIEventStatus) - 2;
|
||||
pHCIEvent->Status = 0x0;
|
||||
pHCIEvent->EventStatus = 0x0;
|
||||
pHCIEvent->PacketIndicator = 0x01;
|
||||
pHCIEvent->Opcode = _Opcode;
|
||||
|
||||
@ -947,7 +947,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool
|
||||
|
||||
pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE;
|
||||
pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
|
||||
pRoleChange->Status = 0x00;
|
||||
pRoleChange->EventStatus = 0x00;
|
||||
pRoleChange->bdaddr = _bd;
|
||||
pRoleChange->NewRole = _master ? 0x00 : 0x01;
|
||||
|
||||
@ -1002,7 +1002,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHan
|
||||
SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
|
||||
pModeChange->EventType = HCI_EVENT_MODE_CHANGE;
|
||||
pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
|
||||
pModeChange->Status = 0;
|
||||
pModeChange->EventStatus = 0;
|
||||
pModeChange->Connection_Handle = _connectionHandle;
|
||||
pModeChange->CurrentMode = _mode;
|
||||
pModeChange->Value = _value;
|
||||
@ -1074,7 +1074,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _
|
||||
SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer;
|
||||
pReadClockOffsetComplete->EventType = HCI_EVENT_READ_CLOCK_OFFSET_COMPL;
|
||||
pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
|
||||
pReadClockOffsetComplete->Status = 0x00;
|
||||
pReadClockOffsetComplete->EventStatus = 0x00;
|
||||
pReadClockOffsetComplete->ConnectionHandle = _connectionHandle;
|
||||
pReadClockOffsetComplete->ClockOffset = 0x3818;
|
||||
|
||||
@ -1099,7 +1099,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConPacketTypeChange(u16 _conn
|
||||
SHCIEventConPacketTypeChange* pChangeConPacketType = (SHCIEventConPacketTypeChange*)Event.m_buffer;
|
||||
pChangeConPacketType->EventType = HCI_EVENT_CON_PKT_TYPE_CHANGED;
|
||||
pChangeConPacketType->PayloadLength = sizeof(SHCIEventConPacketTypeChange) - 2;
|
||||
pChangeConPacketType->Status = 0x00;
|
||||
pChangeConPacketType->EventStatus = 0x00;
|
||||
pChangeConPacketType->ConnectionHandle = _connectionHandle;
|
||||
pChangeConPacketType->PacketType = _packetType;
|
||||
|
||||
|
@ -2407,7 +2407,7 @@ struct SHCIEventStatus
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u8 PacketIndicator;
|
||||
u16 Opcode;
|
||||
};
|
||||
@ -2423,14 +2423,14 @@ struct SHCIEventInquiryComplete
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
};
|
||||
|
||||
struct SHCIEventReadClockOffsetComplete
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 ConnectionHandle;
|
||||
u16 ClockOffset;
|
||||
};
|
||||
@ -2439,7 +2439,7 @@ struct SHCIEventConPacketTypeChange
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 ConnectionHandle;
|
||||
u16 PacketType;
|
||||
};
|
||||
@ -2448,7 +2448,7 @@ struct SHCIEventReadRemoteVerInfo
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 ConnectionHandle;
|
||||
u8 lmp_version;
|
||||
u16 manufacturer;
|
||||
@ -2459,7 +2459,7 @@ struct SHCIEventReadRemoteFeatures
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 ConnectionHandle;
|
||||
u8 features[HCI_FEATURES_SIZE];
|
||||
};
|
||||
@ -2468,7 +2468,7 @@ struct SHCIEventRemoteNameReq
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
bdaddr_t bdaddr;
|
||||
u8 RemoteName[248];
|
||||
};
|
||||
@ -2486,7 +2486,7 @@ struct SHCIEventConnectionComplete
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 Connection_Handle;
|
||||
bdaddr_t bdaddr;
|
||||
u8 LinkType;
|
||||
@ -2497,7 +2497,7 @@ struct SHCIEventRoleChange
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
bdaddr_t bdaddr;
|
||||
u8 NewRole;
|
||||
};
|
||||
@ -2515,7 +2515,7 @@ struct SHCIEventAuthenticationCompleted
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 Connection_Handle;
|
||||
};
|
||||
|
||||
@ -2524,7 +2524,7 @@ struct SHCIEventModeChange
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 Connection_Handle;
|
||||
u8 CurrentMode;
|
||||
u16 Value;
|
||||
@ -2535,7 +2535,7 @@ struct SHCIEventDisconnectCompleted
|
||||
{
|
||||
u8 EventType;
|
||||
u8 PayloadLength;
|
||||
u8 Status;
|
||||
u8 EventStatus;
|
||||
u16 Connection_Handle;
|
||||
u8 Reason;
|
||||
};
|
||||
|
@ -871,6 +871,14 @@
|
||||
RelativePath=".\src\Globals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HotkeyDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\HotkeyDlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\ISOProperties.cpp"
|
||||
>
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "ConfigManager.h"
|
||||
#include "SysConf.h"
|
||||
#include "Frame.h"
|
||||
#include "HotkeyDlg.h"
|
||||
|
||||
extern CFrame* main_frame;
|
||||
|
||||
@ -51,12 +52,12 @@ EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick)
|
||||
|
||||
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged)
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
#endif
|
||||
EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::CoreSettingsChanged)
|
||||
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
|
||||
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
|
||||
EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::CoreSettingsChanged)
|
||||
|
||||
EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_RADIOJIT, CConfigMain::CoreSettingsChanged)
|
||||
@ -142,6 +143,7 @@ void CConfigMain::UpdateGUI()
|
||||
LockThreads->Disable();
|
||||
SkipIdle->Disable();
|
||||
EnableCheats->Disable();
|
||||
RenderToMain->Disable();
|
||||
|
||||
GCSystemLang->Disable();
|
||||
|
||||
@ -223,14 +225,15 @@ void CConfigMain::InitializeGUIValues()
|
||||
// General - Interface
|
||||
ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
|
||||
UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers);
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
AutoHideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor);
|
||||
HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
|
||||
#endif
|
||||
Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme);
|
||||
// need redesign
|
||||
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
|
||||
|
||||
// General - Display
|
||||
Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
|
||||
RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain);
|
||||
|
||||
// Gamecube - IPL
|
||||
GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
|
||||
@ -280,19 +283,23 @@ void CConfigMain::InitializeGUITooltips()
|
||||
UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.")
|
||||
wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin")
|
||||
wxT(" suddenly crashes without any explanation at all."));
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
AutoHideCursor->SetToolTip(wxT("This will auto hide the cursor in fullscreen mode."));
|
||||
HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window.")
|
||||
wxT("\nIt can be convenient in a Wii game that already has a cursor."));
|
||||
#endif
|
||||
InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in")
|
||||
wxT("\nthe game list of PAL GC games."));
|
||||
|
||||
// Themes: Copyright notice
|
||||
Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]"));
|
||||
Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com"));
|
||||
Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments"));
|
||||
Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org"));
|
||||
|
||||
// General - Display
|
||||
Fullscreen->SetToolTip(
|
||||
wxT("Start the rendering window in fullscreen mode.")
|
||||
wxT(" Press Alt+Enter to switch between Fullscreen and Windowed mode."));
|
||||
HideCursor->SetToolTip(wxT("Hide the cursor when it is over the rendering window")
|
||||
wxT("\n and the rendering window has focus."));
|
||||
RenderToMain->SetToolTip(wxT("Render to main window."));
|
||||
|
||||
// Wii
|
||||
WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games."));
|
||||
}
|
||||
@ -318,6 +325,7 @@ void CConfigMain::CreateGUIControls()
|
||||
sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings"));
|
||||
sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings"));
|
||||
sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings"));
|
||||
sbDisplay = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Emulator Display Settings"));
|
||||
// Core Settings - Basic
|
||||
CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, wxT("Enable Dual Core (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
@ -340,21 +348,23 @@ void CConfigMain::CreateGUIControls()
|
||||
ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
UsePanicHandlers = new wxCheckBox(GeneralPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
// Hide Cursor
|
||||
wxStaticText *HideCursorText = new wxStaticText(GeneralPage, ID_INTERFACE_HIDECURSOR_TEXT, wxT("Hide Cursor:"), wxDefaultPosition, wxDefaultSize);
|
||||
AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto"));
|
||||
HideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_HIDECURSOR, wxT("Always"));
|
||||
#endif
|
||||
// Interface Language
|
||||
// At the moment this only changes the language displayed in m_gamelistctrl
|
||||
// If someone wants to control the whole GUI's language, it should be set here too
|
||||
wxStaticText *InterfaceLangText = new wxStaticText(GeneralPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize);
|
||||
InterfaceLang = new wxChoice(GeneralPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator);
|
||||
|
||||
// Hotkey configuration
|
||||
HotkeyConfig = new wxButton(GeneralPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator);
|
||||
|
||||
// Themes - this should really be a wxChoice...
|
||||
Theme = new wxRadioBox(GeneralPage, ID_INTERFACE_THEME, wxT("Theme"),wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS);
|
||||
|
||||
// General display settings
|
||||
Fullscreen = new wxCheckBox(GeneralPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
HideCursor = new wxCheckBox(GeneralPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor"));
|
||||
RenderToMain = new wxCheckBox(GeneralPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Populate the settings
|
||||
sCore = new wxBoxSizer(wxHORIZONTAL);
|
||||
sbBasic->Add(CPUThread, 0, wxALL, 5);
|
||||
@ -378,23 +388,23 @@ void CConfigMain::CreateGUIControls()
|
||||
|
||||
sbInterface->Add(ConfirmStop, 0, wxALL, 5);
|
||||
sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
wxBoxSizer *sHideCursor = new wxBoxSizer(wxHORIZONTAL);
|
||||
sHideCursor->Add(HideCursorText);
|
||||
sHideCursor->Add(AutoHideCursor, 0, wxLEFT, 5);
|
||||
sHideCursor->Add(HideCursor, 0, wxLEFT, 5);
|
||||
sbInterface->Add(sHideCursor, 0, wxALL, 5);
|
||||
#endif
|
||||
sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
|
||||
wxBoxSizer *sInterfaceLanguage = new wxBoxSizer(wxHORIZONTAL);
|
||||
sInterfaceLanguage->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sInterfaceLanguage->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
|
||||
sbInterface->Add(sInterfaceLanguage, 0, wxEXPAND | wxALL, 5);
|
||||
wxBoxSizer *sInterface = new wxBoxSizer(wxHORIZONTAL);
|
||||
sInterface->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
sInterface->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5);
|
||||
sInterface->AddStretchSpacer();
|
||||
sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
|
||||
sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
sbDisplay->Add(Fullscreen, 0, wxEXPAND | wxALL, 5);
|
||||
sbDisplay->Add(HideCursor, 0, wxALL, 5);
|
||||
sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
// Populate the entire page
|
||||
sGeneralPage = new wxBoxSizer(wxVERTICAL);
|
||||
sGeneralPage->Add(sCore, 0, wxEXPAND | wxALL, 5);
|
||||
sGeneralPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5);
|
||||
sGeneralPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
GeneralPage->SetSizer(sGeneralPage);
|
||||
sGeneralPage->Layout();
|
||||
@ -699,18 +709,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
|
||||
SetEnableAlert(UsePanicHandlers->IsChecked());
|
||||
break;
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
case ID_INTERFACE_AUTOHIDECURSOR:
|
||||
if (AutoHideCursor->IsChecked()) HideCursor->SetValue(!AutoHideCursor->IsChecked()); // Update the other one
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor = AutoHideCursor->IsChecked();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
|
||||
break;
|
||||
case ID_INTERFACE_HIDECURSOR:
|
||||
if (HideCursor->IsChecked()) AutoHideCursor->SetValue(!HideCursor->IsChecked()); // Update the other one
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor = AutoHideCursor->IsChecked();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
|
||||
break;
|
||||
#endif
|
||||
case ID_INTERFACE_THEME:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
|
||||
main_frame->InitBitmaps();
|
||||
@ -719,6 +717,15 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
||||
SConfig::GetInstance().m_InterfaceLanguage = (INTERFACE_LANGUAGE)InterfaceLang->GetSelection();
|
||||
bRefreshList = true;
|
||||
break;
|
||||
case ID_HOTKEY_CONFIG:
|
||||
{
|
||||
HotkeyConfigDialog *m_HotkeyDialog = new HotkeyConfigDialog(this);
|
||||
m_HotkeyDialog->ShowModal();
|
||||
m_HotkeyDialog->Destroy();
|
||||
// Update the GUI in case menu accelerators were changed
|
||||
main_frame->UpdateGUI();
|
||||
}
|
||||
break;
|
||||
case ID_FRAMELIMIT:
|
||||
SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection();
|
||||
break;
|
||||
@ -752,6 +759,15 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
||||
case ID_ENABLECHEATS:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
|
||||
break;
|
||||
case ID_DISPLAY_FULLSCREEN: // Display
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked();
|
||||
break;
|
||||
case ID_DISPLAY_HIDECURSOR:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked();
|
||||
break;
|
||||
case ID_DISPLAY_RENDERTOMAIN:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,16 @@ private:
|
||||
|
||||
wxBoxSizer* sGeneralPage; // General Settings
|
||||
wxCheckBox* ConfirmStop, *UsePanicHandlers;
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
wxCheckBox* HideCursor, *AutoHideCursor;
|
||||
#endif
|
||||
wxCheckBox* HideCursor;
|
||||
wxChoice* InterfaceLang;
|
||||
wxChoice* Framelimit;
|
||||
wxRadioBox* Theme;
|
||||
wxCheckBox* Fullscreen;
|
||||
wxCheckBox* RenderToMain;
|
||||
wxButton* HotkeyConfig;
|
||||
|
||||
wxBoxSizer* sCore;
|
||||
wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface;
|
||||
wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface, *sbDisplay;
|
||||
wxCheckBox* AlwaysHLE_BS2;
|
||||
wxRadioButton* m_RadioInt;
|
||||
wxRadioButton* m_RadioJIT;
|
||||
@ -171,9 +172,10 @@ private:
|
||||
|
||||
ID_INTERFACE_CONFIRMSTOP, // Interface settings
|
||||
ID_INTERFACE_USEPANICHANDLERS,
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR,
|
||||
#endif
|
||||
ID_DISPLAY_FULLSCREEN,
|
||||
ID_DISPLAY_HIDECURSOR,
|
||||
ID_DISPLAY_RENDERTOMAIN,
|
||||
ID_HOTKEY_CONFIG,
|
||||
ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG,
|
||||
ID_INTERFACE_THEME,
|
||||
ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT,
|
||||
|
@ -111,22 +111,6 @@ HWND MSWGetParent_(HWND Parent)
|
||||
|
||||
extern CFrame* main_frame;
|
||||
|
||||
class CPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
CPanel(
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY
|
||||
);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Receive WndProc messages
|
||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(CPanel, wxPanel)
|
||||
END_EVENT_TABLE()
|
||||
@ -158,12 +142,15 @@ CPanel::CPanel(
|
||||
break;
|
||||
|
||||
case WM_USER_CREATE:
|
||||
// We don't have a local setting for bRenderToMain but we can detect it this way instead
|
||||
//PanicAlert("main call %i %i %i %i", lParam, (HWND)Core::GetWindowHandle(), MSWGetParent_((HWND)Core::GetWindowHandle()), (HWND)this->GetHWND());
|
||||
if (lParam == NULL)
|
||||
main_frame->bRenderToMain = false;
|
||||
main_frame->DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
break;
|
||||
|
||||
case WM_USER_SETCURSOR:
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
|
||||
main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN)
|
||||
MSWSetCursor(!SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
|
||||
else
|
||||
main_frame->bRenderToMain = true;
|
||||
MSWSetCursor(true);
|
||||
break;
|
||||
|
||||
case WIIMOTE_DISCONNECT:
|
||||
@ -341,9 +328,6 @@ CFrame::CFrame(wxFrame* parent,
|
||||
, UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
|
||||
, m_bControlsCreated(false), m_StopDlg(NULL)
|
||||
#if wxUSE_TIMER
|
||||
#ifdef _WIN32
|
||||
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
|
||||
#endif
|
||||
, m_timer(this)
|
||||
#endif
|
||||
|
||||
@ -473,10 +457,6 @@ CFrame::CFrame(wxFrame* parent,
|
||||
// -------------------------
|
||||
// Connect event handlers
|
||||
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_SIZE, // Keyboard
|
||||
wxSizeEventHandler(CFrame::OnResizeAll),
|
||||
(wxObject*)0, this);
|
||||
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(CFrame::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
@ -491,11 +471,6 @@ CFrame::CFrame(wxFrame* parent,
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DCLICK,
|
||||
wxMouseEventHandler(CFrame::OnDoubleClick),
|
||||
(wxObject*)0, this);
|
||||
#ifdef _WIN32
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
|
||||
wxMouseEventHandler(CFrame::OnMotion),
|
||||
(wxObject*)0, this);
|
||||
#endif
|
||||
// ----------
|
||||
|
||||
// Update controls
|
||||
@ -530,13 +505,23 @@ CFrame::~CFrame()
|
||||
delete m_Mgr;
|
||||
}
|
||||
|
||||
bool CFrame::RendererIsFullscreen()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
return m_RenderFrame->IsFullScreen();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void CFrame::X11_SendClientEvent(const char *message)
|
||||
void CFrame::X11_SendClientEvent(const char *message,
|
||||
int data1, int data2, int data3, int data4)
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
@ -546,6 +531,10 @@ void CFrame::X11_SendClientEvent(const char *message)
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
|
||||
event.xclient.data.l[1] = data1;
|
||||
event.xclient.data.l[2] = data2;
|
||||
event.xclient.data.l[3] = data3;
|
||||
event.xclient.data.l[4] = data4;
|
||||
|
||||
// Send the event
|
||||
if (!XSendEvent(dpy, win, False, False, &event))
|
||||
@ -560,7 +549,7 @@ void X11_SendKeyEvent(int key)
|
||||
|
||||
// Init X event structure for key press event
|
||||
event.xkey.type = KeyPress;
|
||||
// WARNING: This works for '3' to '7'. If in the future other keys are needed
|
||||
// WARNING: This works for ASCII keys. If in the future other keys are needed
|
||||
// convert with InputCommon::wxCharCodeWXToX from X11InputBase.cpp.
|
||||
event.xkey.keycode = XKeysymToKeycode(dpy, key);
|
||||
|
||||
@ -574,15 +563,25 @@ void X11_SendKeyEvent(int key)
|
||||
// Events
|
||||
void CFrame::OnActive(wxActivateEvent& event)
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
if (event.GetActive())
|
||||
X11_SendClientEvent("FOCUSIN");
|
||||
else
|
||||
X11_SendClientEvent("FOCUSOUT");
|
||||
}
|
||||
if (event.GetActive() && event.GetEventObject() == m_RenderFrame)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
::SetFocus((HWND)m_RenderParent->GetHandle());
|
||||
#else
|
||||
m_RenderParent->SetFocus();
|
||||
#endif
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
|
||||
Core::GetState() == Core::CORE_RUN)
|
||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
||||
}
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@ -601,7 +600,7 @@ void CFrame::OnClose(wxCloseEvent& event)
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
Core::Stop();
|
||||
DoStop();
|
||||
UpdateGUI();
|
||||
}
|
||||
}
|
||||
@ -635,26 +634,23 @@ void CFrame::OnMove(wxMoveEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX = GetPosition().x;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY = GetPosition().y;
|
||||
if (!IsMaximized() &&
|
||||
!(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen()))
|
||||
{
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX = GetPosition().x;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY = GetPosition().y;
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnResize(wxSizeEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight();
|
||||
}
|
||||
void CFrame::OnResizeAll(wxSizeEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
X11_SendClientEvent("RESIZE");
|
||||
#endif
|
||||
//wxWindow * Win = (wxWindow*)event.GetEventObject();
|
||||
//NOTICE_LOG(CONSOLE, "OnResizeAll: %i", (HWND)Win->GetHWND());
|
||||
if (!IsMaximized() &&
|
||||
!(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen()))
|
||||
{
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth();
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
// Host messages
|
||||
@ -681,17 +677,14 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxUSE_TIMER
|
||||
void CFrame::OnTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Update();
|
||||
#else
|
||||
// Process events in linux. Primarily to update the statusbar text.
|
||||
// This should be unnecessary if we ever get WXGL and render to main working
|
||||
// Process events. Primarily to update the statusbar text.
|
||||
if (wxGetApp().Pending())
|
||||
wxGetApp().ProcessPendingEvents();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
@ -707,19 +700,16 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
|
||||
}
|
||||
break;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
|
||||
case WM_USER_CREATE:
|
||||
bRenderToMain = true;
|
||||
break;
|
||||
case TOGGLE_FULLSCREEN:
|
||||
DoFullscreen(!IsFullScreen());
|
||||
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||
break;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
case WM_USER_STOP:
|
||||
DoStop();
|
||||
break;
|
||||
case WM_USER_PAUSE:
|
||||
DoPause();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -755,6 +745,24 @@ void CFrame::OnCustomHostMessage(int Id)
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnSizeRequest(int& x, int& y, int& width, int& height)
|
||||
{
|
||||
m_RenderParent->GetSize(&width, &height);
|
||||
m_RenderParent->GetPosition(&x, &y);
|
||||
}
|
||||
|
||||
bool CFrame::RendererHasFocus()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Why doesn't the "else" method below work in windows when called from
|
||||
// Host_RendererHasFocus()?
|
||||
bRendererHasFocus = (m_RenderParent == wxWindow::FindFocus());
|
||||
return bRendererHasFocus;
|
||||
#else
|
||||
return m_RenderParent == wxWindow::FindFocus();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
||||
{
|
||||
// Show all platforms and regions if...
|
||||
@ -803,38 +811,68 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
|
||||
StartGame(std::string(""));
|
||||
}
|
||||
|
||||
bool IsHotkey(wxKeyEvent &event, int Id)
|
||||
{
|
||||
return (event.GetKeyCode() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkey[Id] &&
|
||||
event.GetModifiers() == SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkeyModifier[Id]);
|
||||
}
|
||||
|
||||
void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
// Toggle fullscreen
|
||||
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
|
||||
{
|
||||
DoFullscreen(!IsFullScreen());
|
||||
if (IsHotkey(event, HK_FULLSCREEN))
|
||||
DoFullscreen(!RendererIsFullscreen());
|
||||
// Pause and Unpause
|
||||
else if (IsHotkey(event, HK_PLAY_PAUSE))
|
||||
DoPause();
|
||||
// Stop
|
||||
else if (IsHotkey(event, HK_STOP))
|
||||
DoStop();
|
||||
|
||||
// We do that to avoid the event to be double processed (which would cause the window to be stuck in fullscreen)
|
||||
event.StopPropagation();
|
||||
}
|
||||
else if(event.GetKeyCode() == WXK_ESCAPE)
|
||||
{
|
||||
main_frame->DoPause();
|
||||
}
|
||||
// event.Skip() allows the event to propagate to the gamelist for example
|
||||
else if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == this))
|
||||
event.Skip();
|
||||
|
||||
if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7') // Send this to the video plugin
|
||||
// Send the OSD hotkeys to the video plugin
|
||||
if (event.GetKeyCode() >= '3' && event.GetKeyCode() <= '7' && event.GetModifiers() == wxMOD_NONE)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
X11_SendKeyEvent(event.GetKeyCode());
|
||||
#endif
|
||||
}
|
||||
#ifdef _WIN32
|
||||
// Send the freelook hotkeys to the video plugin
|
||||
if ((event.GetKeyCode() == '0', '9', 'W', 'S', 'A', 'D', 'R')
|
||||
&& event.GetModifiers() == wxMOD_SHIFT)
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
#endif
|
||||
// state save and state load hotkeys
|
||||
if (event.GetKeyCode() >= WXK_F1 && event.GetKeyCode() <= WXK_F8)
|
||||
{
|
||||
int slot_number = event.GetKeyCode() - WXK_F1 + 1;
|
||||
if (event.GetModifiers() == wxMOD_NONE)
|
||||
State_Load(slot_number);
|
||||
else if (event.GetModifiers() == wxMOD_SHIFT)
|
||||
State_Save(slot_number);
|
||||
}
|
||||
if (event.GetKeyCode() == WXK_F11 && event.GetModifiers() == wxMOD_NONE)
|
||||
State_LoadLastSaved();
|
||||
if (event.GetKeyCode() == WXK_F12)
|
||||
{
|
||||
if (event.GetModifiers() == wxMOD_NONE)
|
||||
State_UndoSaveState();
|
||||
else if (event.GetModifiers() == wxMOD_SHIFT)
|
||||
State_UndoLoadState();
|
||||
}
|
||||
// screenshot hotkeys
|
||||
if (event.GetKeyCode() == WXK_F9 && event.GetModifiers() == wxMOD_NONE)
|
||||
Core::ScreenShot();
|
||||
|
||||
// Send the keyboard status to the Input plugin
|
||||
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down
|
||||
}
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void CFrame::OnKeyUp(wxKeyEvent& event)
|
||||
@ -857,84 +895,12 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) return;
|
||||
|
||||
// Only detect double clicks in the rendering window, and only use this when a game is running
|
||||
if (! (Core::GetState() == Core::CORE_RUN && bRenderToMain && event.GetEventObject() == m_Panel)) return;
|
||||
if (! (Core::GetState() == Core::CORE_RUN && event.GetEventObject() == m_RenderParent)) return;
|
||||
|
||||
DoFullscreen(!IsFullScreen());
|
||||
DoFullscreen(!RendererIsFullscreen());
|
||||
}
|
||||
|
||||
|
||||
// Check for mouse motion. Here we process the bHideCursor setting.
|
||||
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
void CFrame::OnMotion(wxMouseEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
// The following is only interesting when a game is running
|
||||
if(Core::GetState() == Core::CORE_UNINITIALIZED) return;
|
||||
|
||||
/* For some reason WM_MOUSEMOVE events are sent from the plugin even when there is no movement
|
||||
so we have to check that the cursor position has actually changed */
|
||||
if(bRenderToMain) //
|
||||
{
|
||||
bool PositionIdentical = false;
|
||||
if (event.GetX() == LastMouseX && event.GetY() == LastMouseY) PositionIdentical = true;
|
||||
LastMouseX = event.GetX(); LastMouseY = event.GetY();
|
||||
if(PositionIdentical) return;
|
||||
}
|
||||
|
||||
// Now we know that we have an actual mouse movement event
|
||||
|
||||
// Update motion for the auto hide option and return
|
||||
if(IsFullScreen() && SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor)
|
||||
{
|
||||
m_iLastMotionTime = Common::Timer::GetDoubleTime();
|
||||
MSWSetCursor(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && event.GetId() == IDM_MPANEL)
|
||||
{
|
||||
if(bRenderToMain) MSWSetCursor(false);
|
||||
|
||||
/* We only need to use this if we are rendering to a separate window. It does work
|
||||
for rendering to the main window to, but in that case our MSWSetCursor() works to
|
||||
so we can use that instead. If we one day determine that the separate window
|
||||
rendering is superfluous we could do without this */
|
||||
else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 0);
|
||||
}
|
||||
|
||||
// For some reason we need this to, otherwise the cursor can get stuck with the resizing arrows
|
||||
else
|
||||
{
|
||||
if(bRenderToMain) MSWSetCursor(true);
|
||||
else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for mouse status a couple of times per second for the auto hide option
|
||||
#if wxUSE_TIMER && defined _WIN32
|
||||
void CFrame::Update()
|
||||
{
|
||||
// Check if auto hide is on, or if we are already hiding the cursor all the time
|
||||
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor
|
||||
|| SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) return;
|
||||
|
||||
if(IsFullScreen())
|
||||
{
|
||||
int HideDelay = 1; // Wait 1 second to hide the cursor, just like Windows Media Player
|
||||
double TmpSeconds = Common::Timer::GetDoubleTime(); // Get timestamp
|
||||
double CompareTime = TmpSeconds - HideDelay; // Compare it
|
||||
|
||||
if(m_iLastMotionTime < CompareTime) // Update cursor
|
||||
MSWSetCursor(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// --------
|
||||
// Functions
|
||||
|
||||
@ -986,10 +952,14 @@ void CFrame::DoFullscreen(bool bF)
|
||||
// the main window to become unresponsive, so we have to avoid that.
|
||||
if ((Core::GetState() == Core::CORE_RUN) || (Core::GetState() == Core::CORE_PAUSE))
|
||||
{
|
||||
if (bRenderToMain)
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
X11_SendClientEvent("TOGGLE_DISPLAYMODE", bF);
|
||||
#elif defined(_WIN32)
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_DISPLAYMODE, bF);
|
||||
#endif
|
||||
m_RenderFrame->ShowFullScreen(bF);
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
{
|
||||
ShowFullScreen(bF);
|
||||
|
||||
if (bF)
|
||||
{
|
||||
// Save the current mode before going to fullscreen
|
||||
@ -1001,25 +971,9 @@ void CFrame::DoFullscreen(bool bF)
|
||||
// Restore saved perspective
|
||||
m_Mgr->LoadPerspective(AuiCurrent, true);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Show the cursor again, in case it was hidden
|
||||
if (IsFullScreen())
|
||||
{
|
||||
MSWSetCursor(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else // Post the message to the separate rendering window which will then handle it.
|
||||
{
|
||||
BringWindowToTop((HWND)Core::GetWindowHandle());
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_FULLSCREEN, 0);
|
||||
}
|
||||
#elif defined HAVE_X11 && HAVE_X11
|
||||
else // Send the event to the separate rendering window which will then handle it.
|
||||
X11_SendClientEvent("TOGGLE_FULLSCREEN");
|
||||
#endif
|
||||
else
|
||||
m_RenderFrame->Raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,10 @@
|
||||
#include "CDUtils.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "LogWindow.h"
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
|
||||
// A shortcut to access the bitmaps
|
||||
#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name, sizeof(name))
|
||||
@ -48,6 +52,24 @@ inline wxBitmap _wxGetBitmapFromMemory(const unsigned char* data, int length)
|
||||
class CGameListCtrl;
|
||||
class CLogWindow;
|
||||
|
||||
// The CPanel class to receive MSWWindowProc messages from the video plugin.
|
||||
class CPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
CPanel(
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY
|
||||
);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Receive WndProc messages
|
||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif
|
||||
};
|
||||
|
||||
class CFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
@ -63,11 +85,11 @@ class CFrame : public wxFrame
|
||||
void* GetRenderHandle()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return(m_Panel->GetHandle());
|
||||
return (void *)m_RenderParent->GetHandle();
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
return m_Panel;
|
||||
return (void *)GDK_WINDOW_XID(GTK_WIDGET(m_RenderParent->GetHandle())->window);
|
||||
#else
|
||||
return this;
|
||||
return m_RenderParent;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -81,6 +103,9 @@ class CFrame : public wxFrame
|
||||
void DoPause();
|
||||
void DoStop();
|
||||
bool bRenderToMain;
|
||||
#ifdef _WIN32
|
||||
bool bRendererHasFocus;
|
||||
#endif
|
||||
bool bNoWiimoteMsg;
|
||||
void UpdateGUI();
|
||||
void ToggleLogWindow(bool, int i = -1);
|
||||
@ -91,7 +116,12 @@ class CFrame : public wxFrame
|
||||
void StatusBarMessage(const char * Text, ...);
|
||||
void ClearStatusBar();
|
||||
void OnCustomHostMessage(int Id);
|
||||
void OnSizeRequest(int& x, int& y, int& width, int& height);
|
||||
void StartGame(const std::string& filename);
|
||||
void OnRenderParentClose(wxCloseEvent& event);
|
||||
void OnRenderParentMove(wxMoveEvent& event);
|
||||
bool RendererHasFocus();
|
||||
void DoFullscreen(bool _F);
|
||||
|
||||
// AUI
|
||||
wxAuiManager *m_Mgr;
|
||||
@ -118,6 +148,7 @@ class CFrame : public wxFrame
|
||||
int PixelsToPercentage(int,int);
|
||||
void ListChildren();
|
||||
void ListTopWindows();
|
||||
const wxChar * GetMenuLabel(int Id);
|
||||
|
||||
// Perspectives
|
||||
void AddRemoveBlankPage();
|
||||
@ -178,6 +209,8 @@ class CFrame : public wxFrame
|
||||
wxBoxSizer* sizerFrame;
|
||||
CGameListCtrl* m_GameListCtrl;
|
||||
wxPanel* m_Panel;
|
||||
wxFrame* m_RenderFrame;
|
||||
wxPanel* m_RenderParent;
|
||||
wxToolBarToolBase* m_ToolPlay;
|
||||
CLogWindow* m_LogWindow;
|
||||
bool UseDebugger;
|
||||
@ -277,7 +310,6 @@ class CFrame : public wxFrame
|
||||
void OnManagerResize(wxAuiManagerEvent& event);
|
||||
void OnMove(wxMoveEvent& event);
|
||||
void OnResize(wxSizeEvent& event);
|
||||
void OnResizeAll(wxSizeEvent& event);
|
||||
void OnToggleToolbar(wxCommandEvent& event);
|
||||
void DoToggleToolbar(bool);
|
||||
void OnToggleStatusbar(wxCommandEvent& event);
|
||||
@ -286,7 +318,6 @@ class CFrame : public wxFrame
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnDoubleClick(wxMouseEvent& event);
|
||||
void OnMotion(wxMouseEvent& event);
|
||||
|
||||
void OnHostMessage(wxCommandEvent& event);
|
||||
|
||||
@ -302,9 +333,11 @@ class CFrame : public wxFrame
|
||||
void GameListChanged(wxCommandEvent& event);
|
||||
|
||||
void OnGameListCtrl_ItemActivated(wxListEvent& event);
|
||||
void DoFullscreen(bool _F);
|
||||
void OnRenderParentResize(wxSizeEvent& event);
|
||||
bool RendererIsFullscreen();
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void X11_SendClientEvent(const char *message);
|
||||
void X11_SendClientEvent(const char *message,
|
||||
int data1 = 0, int data2 = 0, int data3 = 0, int data4 = 0);
|
||||
#endif
|
||||
|
||||
// MenuBar
|
||||
@ -318,15 +351,8 @@ class CFrame : public wxFrame
|
||||
|
||||
void BootGame(const std::string& filename);
|
||||
|
||||
// Double click and mouse move options
|
||||
#if wxUSE_TIMER
|
||||
#ifdef _WIN32
|
||||
double m_fLastClickTime, m_iLastMotionTime;
|
||||
int LastMouseX, LastMouseY;
|
||||
|
||||
void Update();
|
||||
#endif
|
||||
// Used in linux to process command events
|
||||
// Used to process command events
|
||||
void OnTimer(wxTimerEvent& WXUNUSED(event));
|
||||
wxTimer m_timer;
|
||||
#endif
|
||||
|
@ -60,6 +60,7 @@ Core::GetWindowHandle().
|
||||
#include "State.h"
|
||||
#include "VolumeHandler.h"
|
||||
#include "NANDContentLoader.h"
|
||||
#include "WXInputBase.h"
|
||||
|
||||
#include <wx/datetime.h> // wxWidgets
|
||||
|
||||
@ -122,10 +123,12 @@ void CFrame::CreateMenu()
|
||||
|
||||
// Emulation menu
|
||||
wxMenu* emulationMenu = new wxMenu;
|
||||
emulationMenu->Append(IDM_PLAY, _T("&Play\tF10"));
|
||||
emulationMenu->Append(IDM_STOP, _T("&Stop"));
|
||||
emulationMenu->Append(IDM_PLAY, GetMenuLabel(HK_PLAY_PAUSE));
|
||||
emulationMenu->Append(IDM_STOP, GetMenuLabel(HK_STOP));
|
||||
emulationMenu->Append(IDM_RESET, _T("&Reset"));
|
||||
emulationMenu->AppendSeparator();
|
||||
emulationMenu->Append(IDM_TOGGLE_FULLSCREEN, GetMenuLabel(HK_FULLSCREEN));
|
||||
emulationMenu->AppendSeparator();
|
||||
emulationMenu->Append(IDM_RECORD, _T("Start Re&cording..."));
|
||||
emulationMenu->Append(IDM_PLAYRECORD, _T("P&lay Recording..."));
|
||||
emulationMenu->AppendSeparator();
|
||||
@ -169,8 +172,6 @@ void CFrame::CreateMenu()
|
||||
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&Gamecube Pad Settings"));
|
||||
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote Settings"));
|
||||
pOptionsMenu->AppendSeparator();
|
||||
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
pOptionsMenu->AppendSeparator();
|
||||
@ -269,7 +270,31 @@ void CFrame::CreateMenu()
|
||||
SetMenuBar(m_MenuBar);
|
||||
}
|
||||
|
||||
const wxChar * CFrame::GetMenuLabel(int Id)
|
||||
{
|
||||
wxString Label;
|
||||
switch (Id)
|
||||
{
|
||||
case HK_FULLSCREEN:
|
||||
Label = _T("&Fullscreen\t");
|
||||
break;
|
||||
case HK_PLAY_PAUSE:
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
Label = _T("&Play\t");
|
||||
else
|
||||
Label = _T("&Play\t");
|
||||
break;
|
||||
case HK_STOP:
|
||||
Label = _T("&Stop\t");
|
||||
}
|
||||
|
||||
wxString Modifier = InputCommon::WXKeymodToString
|
||||
(SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkeyModifier[Id]);
|
||||
wxString Hotkey = InputCommon::WXKeyToString
|
||||
(SConfig::GetInstance().m_LocalCoreStartupParameter.iHotkey[Id]);
|
||||
|
||||
return Label + Modifier + (Modifier.Len() ? _T("+") : _T("")) + Hotkey;
|
||||
}
|
||||
|
||||
|
||||
// Create toolbar items
|
||||
@ -500,6 +525,8 @@ void CFrame::BootGame(const std::string& filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
m_GameListCtrl->BrowseForDirectory();
|
||||
game_loading = false;
|
||||
m_GameListCtrl->Enable();
|
||||
@ -509,6 +536,8 @@ void CFrame::BootGame(const std::string& filename)
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
game_loading = false;
|
||||
m_GameListCtrl->Enable();
|
||||
m_GameListCtrl->Show();
|
||||
@ -641,6 +670,43 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
||||
StartGame(std::string(""));
|
||||
}
|
||||
|
||||
void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
||||
{
|
||||
if ((Core::GetState() == Core::CORE_RUN) || (Core::GetState() == Core::CORE_PAUSE))
|
||||
DoStop();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
||||
{
|
||||
if (!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
|
||||
{
|
||||
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)
|
||||
{
|
||||
event.Skip();
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
int x, y, width, height;
|
||||
m_RenderParent->GetSize(&width, &height);
|
||||
m_RenderParent->GetPosition(&x, &y);
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
||||
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
|
||||
{
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
X11_SendClientEvent("RESIZE", x, y, width, height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare the GUI to start the game.
|
||||
void CFrame::StartGame(const std::string& filename)
|
||||
{
|
||||
@ -657,6 +723,42 @@ void CFrame::StartGame(const std::string& filename)
|
||||
m_GameListCtrl->Hide();
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
{
|
||||
m_RenderParent = m_Panel;
|
||||
m_RenderFrame = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPoint position(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos);
|
||||
wxSize size(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
|
||||
m_RenderFrame = new wxFrame((wxWindow *)NULL, wxID_ANY, _("Dolphin"), position, size);
|
||||
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_RenderFrame->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(CFrame::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
m_RenderParent = new CPanel(m_RenderFrame, wxID_ANY);
|
||||
m_RenderFrame->Show();
|
||||
}
|
||||
m_RenderFrame->Connect(wxID_ANY, wxEVT_SIZE,
|
||||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||
(wxObject*)0, this);
|
||||
#ifdef _WIN32
|
||||
::SetFocus((HWND)m_RenderParent->GetHandle());
|
||||
#else
|
||||
m_RenderParent->SetFocus();
|
||||
#endif
|
||||
|
||||
BootGame(filename);
|
||||
}
|
||||
|
||||
@ -689,17 +791,16 @@ void CFrame::DoPause()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
X11_SendClientEvent("PAUSE");
|
||||
#endif
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
X11_SendClientEvent("RESUME");
|
||||
#endif
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
|
||||
RendererHasFocus())
|
||||
m_RenderParent->SetCursor(wxCURSOR_BLANK);
|
||||
}
|
||||
UpdateGUI();
|
||||
}
|
||||
@ -739,6 +840,12 @@ void CFrame::DoStop()
|
||||
Core::Stop();
|
||||
UpdateGUI();
|
||||
|
||||
// Destroy the renderer frame when not rendering to main
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
|
||||
// Clean framerate indications from the status bar.
|
||||
m_pStatusBar->SetStatusText(wxT(" "), 0);
|
||||
}
|
||||
@ -902,7 +1009,7 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
||||
// the entire screen (when we render to the main window).
|
||||
void CFrame::OnToggleFullscreen(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
DoFullscreen(!IsFullScreen());
|
||||
DoFullscreen(!RendererIsFullscreen());
|
||||
}
|
||||
|
||||
void CFrame::OnToggleDualCore(wxCommandEvent& WXUNUSED (event))
|
||||
@ -1014,6 +1121,7 @@ void CFrame::UpdateGUI()
|
||||
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);
|
||||
m_ToolBar->EnableTool(IDM_TOGGLE_FULLSCREEN, Running || Paused);
|
||||
m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
|
||||
}
|
||||
|
||||
@ -1030,7 +1138,13 @@ void CFrame::UpdateGUI()
|
||||
GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
|
||||
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
|
||||
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
|
||||
|
||||
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);
|
||||
|
||||
// Update Menu Accelerators
|
||||
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->SetItemLabel(GetMenuLabel(HK_FULLSCREEN));
|
||||
GetMenuBar()->FindItem(IDM_PLAY)->SetItemLabel(GetMenuLabel(HK_PLAY_PAUSE));
|
||||
GetMenuBar()->FindItem(IDM_STOP)->SetItemLabel(GetMenuLabel(HK_STOP));
|
||||
|
||||
m_pSubMenuLoad->Enable(Initialized);
|
||||
m_pSubMenuSave->Enable(Initialized);
|
||||
|
||||
@ -1059,7 +1173,6 @@ void CFrame::UpdateGUI()
|
||||
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Pause"));
|
||||
m_ToolBar->SetToolLabel(IDM_PLAY, _("Pause"));
|
||||
}
|
||||
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Pause\tF10"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1069,7 +1182,6 @@ void CFrame::UpdateGUI()
|
||||
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Play"));
|
||||
m_ToolBar->SetToolLabel(IDM_PLAY, wxT(" Play "));
|
||||
}
|
||||
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play\tF10"));
|
||||
}
|
||||
|
||||
if (!Initialized)
|
||||
|
@ -79,6 +79,7 @@ enum
|
||||
IDM_PLAY,
|
||||
IDM_STOP,
|
||||
IDM_RESET,
|
||||
IDM_TOGGLE_FULLSCREEN,
|
||||
IDM_RECORD,
|
||||
IDM_PLAYRECORD,
|
||||
IDM_FRAMESTEP,
|
||||
@ -123,7 +124,6 @@ enum
|
||||
IDM_CONFIG_DSP_PLUGIN,
|
||||
IDM_CONFIG_PAD_PLUGIN,
|
||||
IDM_CONFIG_WIIMOTE_PLUGIN,
|
||||
IDM_TOGGLE_FULLSCREEN,
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Debugger Menu Entries
|
||||
|
@ -540,13 +540,13 @@ CFrame* DolphinApp::GetCFrame()
|
||||
|
||||
void Host_Message(int Id)
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
|
||||
switch(Id)
|
||||
{
|
||||
case WM_USER_CREATE:
|
||||
case TOGGLE_FULLSCREEN:
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
case WM_USER_STOP:
|
||||
case WM_USER_PAUSE:
|
||||
#endif
|
||||
case WM_USER_CREATE:
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, Id);
|
||||
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||
@ -555,9 +555,6 @@ void Host_Message(int Id)
|
||||
default:
|
||||
main_frame->OnCustomHostMessage(Id);
|
||||
}
|
||||
#else
|
||||
main_frame->OnCustomHostMessage(Id);
|
||||
#endif
|
||||
}
|
||||
|
||||
// OK, this thread boundary is DANGEROUS on linux
|
||||
@ -631,18 +628,17 @@ void Host_UpdateMemoryView()
|
||||
void Host_SetDebugMode(bool)
|
||||
{}
|
||||
|
||||
void Host_RequestWindowSize(int& x, int& y, int& width, int& height)
|
||||
{
|
||||
main_frame->OnSizeRequest(x, y, width, height);
|
||||
}
|
||||
|
||||
void Host_SetWaitCursor(bool enable)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (enable)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_WAIT));
|
||||
}
|
||||
wxBeginBusyCursor();
|
||||
else
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
}
|
||||
#endif
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
|
||||
void Host_UpdateStatusBar(const char* _pText, int Field)
|
||||
@ -656,9 +652,6 @@ void Host_UpdateStatusBar(const char* _pText, int Field)
|
||||
// TODO : this has been said to cause hang (??) how is that even possible ? :d
|
||||
event.StopPropagation();
|
||||
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||
// Process the event before continue
|
||||
if (wxGetApp().Pending())
|
||||
wxGetApp().ProcessPendingEvents();
|
||||
}
|
||||
|
||||
void Host_SetWiiMoteConnectionState(int _State)
|
||||
@ -681,3 +674,12 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||
|
||||
main_frame->GetEventHandler()->AddPendingEvent(event);
|
||||
}
|
||||
|
||||
bool Host_RendererHasFocus()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return main_frame->bRendererHasFocus;
|
||||
#else
|
||||
return main_frame->RendererHasFocus();
|
||||
#endif
|
||||
}
|
||||
|
@ -34,6 +34,14 @@
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "X11InputBase.h"
|
||||
#include "State.h"
|
||||
// EWMH state actions, see
|
||||
// http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
|
||||
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
|
||||
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
||||
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_COCOA) && HAVE_COCOA
|
||||
@ -54,12 +62,18 @@
|
||||
#include "LogManager.h"
|
||||
#include "BootManager.h"
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
bool running = true;
|
||||
bool rendererHasFocus = true;
|
||||
#endif
|
||||
|
||||
void Host_NotifyMapLoaded(){}
|
||||
|
||||
void Host_ShowJitResults(unsigned int address){}
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
void X11_SendClientEvent(const char *message)
|
||||
void X11_SendClientEvent(const char *message,
|
||||
int data1 = 0, int data2 = 0, int data3 = 0, int data4 = 0)
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
@ -69,11 +83,38 @@ void X11_SendClientEvent(const char *message)
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
|
||||
event.xclient.data.l[1] = data1;
|
||||
event.xclient.data.l[2] = data2;
|
||||
event.xclient.data.l[3] = data3;
|
||||
event.xclient.data.l[4] = data4;
|
||||
|
||||
// Send the event
|
||||
if (!XSendEvent(dpy, win, False, False, &event))
|
||||
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
|
||||
}
|
||||
|
||||
void X11_EWMH_Fullscreen(int action)
|
||||
{
|
||||
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|
||||
|| action == _NET_WM_STATE_TOGGLE);
|
||||
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
|
||||
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
|
||||
XEvent event;
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||
event.xclient.window = win;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = action;
|
||||
event.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
|
||||
// Send the event
|
||||
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask, &event))
|
||||
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
Common::Event updateMainFrameEvent;
|
||||
@ -83,19 +124,7 @@ void Host_Message(int Id)
|
||||
switch (Id)
|
||||
{
|
||||
case WM_USER_STOP:
|
||||
updateMainFrameEvent.Set();
|
||||
break;
|
||||
case WM_USER_PAUSE:
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
{
|
||||
X11_SendClientEvent("PAUSE");
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
X11_SendClientEvent("RESUME");
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
}
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -120,6 +149,18 @@ void Host_UpdateMemoryView(){}
|
||||
|
||||
void Host_SetDebugMode(bool){}
|
||||
|
||||
void Host_RequestWindowSize(int& x, int& y, int& width, int& height)
|
||||
{
|
||||
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;
|
||||
y = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos;
|
||||
width = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth;
|
||||
height = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight;
|
||||
}
|
||||
|
||||
bool Host_RendererHasFocus()
|
||||
{
|
||||
return rendererHasFocus;
|
||||
}
|
||||
|
||||
void Host_SetWaitCursor(bool enable){}
|
||||
|
||||
@ -279,9 +320,111 @@ int main(int argc, char* argv[])
|
||||
if (BootManager::BootCore(bootFile)) //no use running the loop when booting fails
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;
|
||||
printf("gopt here\n");
|
||||
while (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
updateMainFrameEvent.Wait();
|
||||
updateMainFrameEvent.Wait();
|
||||
Display *dpy = XOpenDisplay(0);
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
|
||||
Cursor blankCursor = NULL;
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
{
|
||||
// make a blank cursor
|
||||
Pixmap Blank;
|
||||
XColor DummyColor;
|
||||
char ZeroData[1] = {0};
|
||||
Blank = XCreateBitmapFromData (dpy, win, ZeroData, 1, 1);
|
||||
blankCursor = XCreatePixmapCursor(dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
|
||||
XFreePixmap (dpy, Blank);
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
}
|
||||
if (fullscreen)
|
||||
{
|
||||
X11_SendClientEvent("TOGGLE_DISPLAYMODE", fullscreen);
|
||||
X11_EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
||||
}
|
||||
while (running)
|
||||
{
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
for (int num_events = XPending(dpy); num_events > 0; num_events--)
|
||||
{
|
||||
XNextEvent(dpy, &event);
|
||||
switch(event.type)
|
||||
{
|
||||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if (key == XK_Escape)
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
{
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
XUndefineCursor(dpy, win);
|
||||
Core::SetState(Core::CORE_PAUSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
}
|
||||
}
|
||||
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
|
||||
{
|
||||
fullscreen = !fullscreen;
|
||||
X11_SendClientEvent("TOGGLE_DISPLAYMODE", fullscreen);
|
||||
X11_EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
||||
}
|
||||
else if (key >= XK_F1 && key <= XK_F8)
|
||||
{
|
||||
int slot_number = key - XK_F1 + 1;
|
||||
if (event.xkey.state & ShiftMask)
|
||||
State_Save(slot_number);
|
||||
else
|
||||
State_Load(slot_number);
|
||||
}
|
||||
else if (key == XK_F9)
|
||||
Core::ScreenShot();
|
||||
else if (key == XK_F11)
|
||||
State_LoadLastSaved();
|
||||
else if (key == XK_F12)
|
||||
{
|
||||
if (event.xkey.state & ShiftMask)
|
||||
State_UndoLoadState();
|
||||
else
|
||||
State_UndoSaveState();
|
||||
}
|
||||
break;
|
||||
case FocusIn:
|
||||
rendererHasFocus = true;
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
|
||||
Core::GetState() != Core::CORE_PAUSE)
|
||||
XDefineCursor(dpy, win, blankCursor);
|
||||
break;
|
||||
case FocusOut:
|
||||
rendererHasFocus = false;
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
XUndefineCursor(dpy, win);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!fullscreen)
|
||||
{
|
||||
Window winDummy;
|
||||
unsigned int borderDummy, depthDummy;
|
||||
XGetGeometry(dpy, win, &winDummy,
|
||||
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
|
||||
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos,
|
||||
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
|
||||
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
|
||||
&borderDummy, &depthDummy);
|
||||
}
|
||||
usleep(100000);
|
||||
}
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
XFreeCursor(dpy, blankCursor);
|
||||
XCloseDisplay(dpy);
|
||||
Core::Stop();
|
||||
#else
|
||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
|
@ -27,6 +27,7 @@ if wxenv['HAVE_WX']:
|
||||
'LogWindow.cpp',
|
||||
'GameListCtrl.cpp',
|
||||
'Globals.cpp',
|
||||
'HotkeyDlg.cpp',
|
||||
'ISOFile.cpp',
|
||||
'ISOProperties.cpp',
|
||||
'MemcardManager.cpp',
|
||||
|
@ -448,6 +448,14 @@
|
||||
RelativePath=".\Src\SDL_Util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\WXInputBase.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\WXInputBase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\XInput_Util.cpp"
|
||||
>
|
||||
|
@ -14,6 +14,11 @@ if env['HAVE_X11']:
|
||||
"X11InputBase.cpp",
|
||||
]
|
||||
|
||||
if env['HAVE_WX']:
|
||||
files += [
|
||||
"WXInputBase.cpp",
|
||||
]
|
||||
|
||||
env_inputcommon = env.Clone()
|
||||
env_inputcommon.Append(CXXFLAGS = [ '-fPIC' ])
|
||||
env_inputcommon.StaticLibrary(env['local_libs'] + "inputcommon", files)
|
||||
|
@ -112,10 +112,16 @@ KeySym wxCharCodeWXToX(int id)
|
||||
|
||||
return keySym;
|
||||
}
|
||||
#else
|
||||
KeySym wxCharCodeWXToX(int id)
|
||||
int wxKeyModWXToX(int modstate)
|
||||
{
|
||||
return NULL;
|
||||
int xstate = 0;
|
||||
if (modstate & wxMOD_ALT)
|
||||
xstate |= 8;
|
||||
if (modstate & wxMOD_SHIFT)
|
||||
xstate |= 1;
|
||||
if (modstate & wxMOD_CONTROL)
|
||||
xstate |= 4;
|
||||
return xstate;
|
||||
}
|
||||
#endif
|
||||
void XKeyToString(unsigned int keycode, char *keyStr) {
|
||||
|
@ -26,7 +26,10 @@
|
||||
#endif
|
||||
namespace InputCommon
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
KeySym wxCharCodeWXToX(int id);
|
||||
int wxKeyModWXToX(int modstate);
|
||||
#endif
|
||||
void XKeyToString(unsigned int keycode, char *keyStr);
|
||||
}
|
||||
#endif
|
||||
|
@ -48,20 +48,15 @@ void VideoConfig::Load(const char *ini_file)
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
// get resolution
|
||||
iniFile.Get("Hardware", "WindowedRes", &temp, "640x480");
|
||||
strncpy(cInternalRes, temp.c_str(), 16);
|
||||
iniFile.Get("Hardware", "FullscreenRes", &temp, "640x480");
|
||||
strncpy(cFSResolution, temp.c_str(), 16);
|
||||
|
||||
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
|
||||
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
|
||||
iniFile.Get("Hardware", "RenderToMainframe", &RenderToMainframe, false);
|
||||
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
|
||||
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
|
||||
iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
|
||||
iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
|
||||
iniFile.Get("Settings", "Crop", &bCrop, false);
|
||||
iniFile.Get("Settings", "HideCursor", &bHideCursor, false);
|
||||
iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
|
||||
iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0);
|
||||
iniFile.Get("Settings", "AutoScale", &bAutoScale, true);
|
||||
@ -156,17 +151,13 @@ void VideoConfig::Save(const char *ini_file)
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
iniFile.Set("Hardware", "WindowedRes", cInternalRes);
|
||||
iniFile.Set("Hardware", "FullscreenRes", cFSResolution);
|
||||
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
||||
iniFile.Set("Hardware", "VSync", bVSync);
|
||||
iniFile.Set("Hardware", "RenderToMainframe", RenderToMainframe);
|
||||
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
|
||||
iniFile.Set("Settings", "2xResolution", b2xResolution);
|
||||
iniFile.Set("Settings", "AspectRatio", iAspectRatio);
|
||||
iniFile.Set("Settings", "Crop", bCrop);
|
||||
iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
|
||||
iniFile.Set("Settings", "HideCursor", bHideCursor);
|
||||
iniFile.Set("Settings", "UseXFB", bUseXFB);
|
||||
iniFile.Set("Settings", "UseRealXFB", bUseRealXFB);
|
||||
iniFile.Set("Settings", "AutoScale", bAutoScale);
|
||||
|
@ -67,14 +67,10 @@ struct VideoConfig
|
||||
void UpdateProjectionHack();
|
||||
|
||||
// General
|
||||
bool bFullscreen;
|
||||
bool bHideCursor;
|
||||
bool RenderToMainframe;
|
||||
bool bVSync;
|
||||
|
||||
// Resolution control
|
||||
char cFSResolution[16];
|
||||
char cInternalRes[16];
|
||||
|
||||
bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native.
|
||||
bool bWidescreenHack;
|
||||
|
Reference in New Issue
Block a user