Removed the hackery that was being done with the plugin configuration dialogs on windows. That was unnecessary and ugly. The HWND type is dead for non windows. Also cleaned up the gui a little.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5999 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-07-30 03:51:49 +00:00
parent 75bd5ed645
commit 06fb0c292a
21 changed files with 144 additions and 378 deletions

View File

@ -93,7 +93,7 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
} }
// Config: Open the Config window // Config: Open the Config window
void CPlugin::Config(HWND _hwnd) void CPlugin::Config(void *_hwnd)
{ {
if (m_DllConfig != NULL) if (m_DllConfig != NULL)
m_DllConfig(_hwnd); m_DllConfig(_hwnd);

View File

@ -25,7 +25,7 @@
namespace Common namespace Common
{ {
typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl * TDllConfig)(HWND); typedef void (__cdecl * TDllConfig)(void *);
typedef void* (__cdecl * TDllDebugger)(void *, bool); typedef void* (__cdecl * TDllDebugger)(void *, bool);
typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*);
typedef void (__cdecl * TInitialize)(void *); typedef void (__cdecl * TInitialize)(void *);
@ -47,8 +47,8 @@ public:
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals); void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
void *LoadSymbol(const char *sym); void *LoadSymbol(const char *sym);
void Config(HWND _hwnd); void Config(void *_hwnd);
void About(HWND _hwnd); void About(void *_hwnd);
void *Debug(void *Parent, bool Show); void *Debug(void *Parent, bool Show);
void DoState(unsigned char **ptr, int mode); void DoState(unsigned char **ptr, int mode);
void EmuStateChange(PLUGIN_EMUSTATE newState); void EmuStateChange(PLUGIN_EMUSTATE newState);

View File

@ -101,7 +101,7 @@ void Stop();
bool g_bStopping = false; bool g_bStopping = false;
bool g_bHwInit = false; bool g_bHwInit = false;
bool g_bRealWiimote = false; bool g_bRealWiimote = false;
HWND g_pWindowHandle = NULL; void *g_pWindowHandle = NULL;
Common::Thread* g_EmuThread = NULL; Common::Thread* g_EmuThread = NULL;
@ -367,7 +367,7 @@ THREAD_RETURN EmuThread(void *pArg)
Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll
// Under linux, this is an X11 Window, not a HWND! // Under linux, this is an X11 Window, not a HWND!
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle; g_pWindowHandle = VideoInitialize.pWindowHandle;
Callback_PeekMessages = VideoInitialize.pPeekMessages; Callback_PeekMessages = VideoInitialize.pPeekMessages;
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay; g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;

View File

@ -420,15 +420,15 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
{ {
case PLUGIN_TYPE_VIDEO: case PLUGIN_TYPE_VIDEO:
if (GetVideo() != NULL) if (GetVideo() != NULL)
GetVideo()->Config((HWND)_Parent); GetVideo()->Config(_Parent);
break; break;
case PLUGIN_TYPE_DSP: case PLUGIN_TYPE_DSP:
if (GetDSP() != NULL) if (GetDSP() != NULL)
GetDSP()->Config((HWND)_Parent); GetDSP()->Config(_Parent);
break; break;
case PLUGIN_TYPE_WIIMOTE: case PLUGIN_TYPE_WIIMOTE:
if (GetWiimote() != NULL) if (GetWiimote() != NULL)
GetWiimote()->Config((HWND)_Parent); GetWiimote()->Config(_Parent);
break; break;
default: default:
PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename); PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename);

View File

@ -1181,7 +1181,19 @@ void CConfigMain::CallConfig(wxChoice* _pChoice)
{ {
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index)); const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
if (pInfo != NULL) if (pInfo != NULL)
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type); {
#ifdef _WIN32
// Make sure only one dialog can be opened at a time in Windows,
// but is unnecessary and looks bad in linux.
Disable();
#endif
CPluginManager::GetInstance().OpenConfig(this,
pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type);
#ifdef _WIN32
Enable();
Raise();
#endif
}
} }
} }

View File

@ -306,9 +306,6 @@ EVT_SIZE(CFrame::OnResize)
EVT_MOVE(CFrame::OnMove) EVT_MOVE(CFrame::OnMove)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated)
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
#if wxUSE_TIMER
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
#endif
EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose) EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose) EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose)
@ -338,14 +335,11 @@ CFrame::CFrame(wxFrame* parent,
, g_pCodeWindow(NULL) , g_pCodeWindow(NULL)
, bRenderToMain(false), bNoWiimoteMsg(false) , bRenderToMain(false), bNoWiimoteMsg(false)
, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL) , m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL) , m_GameListCtrl(NULL), m_Panel(NULL)
, m_RenderFrame(NULL), m_RenderParent(NULL) , m_RenderFrame(NULL), m_RenderParent(NULL)
, m_LogWindow(NULL), UseDebugger(_UseDebugger) , m_LogWindow(NULL), UseDebugger(_UseDebugger)
, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) , m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
, m_bControlsCreated(false), m_bGameLoading(false), m_StopDlg(NULL) , m_bGameLoading(false)
#if wxUSE_TIMER
, m_timer(this)
#endif
{ {
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++) for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
bFloatWindow[i] = false; bFloatWindow[i] = false;
@ -367,15 +361,8 @@ CFrame::CFrame(wxFrame* parent,
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW); g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
LoadIniPerspectives(); LoadIniPerspectives();
g_pCodeWindow->Load(); g_pCodeWindow->Load();
g_pCodeWindow->Hide();
} }
// Create timer
#if wxUSE_TIMER
const int TimesPerSecond = 10; // We don't need more than this
m_timer.Start(1000 / TimesPerSecond);
#endif
// Create toolbar bitmaps // Create toolbar bitmaps
InitBitmaps(); InitBitmaps();
@ -385,9 +372,9 @@ CFrame::CFrame(wxFrame* parent,
SetIcon(IconTemp); SetIcon(IconTemp);
// Give it a status bar // Give it a status bar
m_pStatusBar = CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR); SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR));
if (!SConfig::GetInstance().m_InterfaceStatusbar) if (!SConfig::GetInstance().m_InterfaceStatusbar)
m_pStatusBar->Hide(); GetStatusBar()->Hide();
// Give it a menu bar // Give it a menu bar
CreateMenu(); CreateMenu();
@ -413,26 +400,19 @@ CFrame::CFrame(wxFrame* parent,
if (g_pCodeWindow) if (g_pCodeWindow)
{ {
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show()); m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
} .Name(wxT("Pane 0")).Caption(wxT("Pane 0"))
else .CenterPane().PaneBorder(false).Show());
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Hide());
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Name(wxT("Pane 1")).Caption(wxT("Logging")).Hide());
}
// Setup perspectives
if (g_pCodeWindow)
{
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective(); AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true);
} }
else else
{ {
m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center(); m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(true).Layer(0) .Name(wxT("Pane 0")).Caption(wxT("Pane 0")).PaneBorder(false)
.FloatingSize(wxSize(600, 350)).CloseButton(false); .CaptionVisible(false).Layer(0).Center().Show());
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
.Name(wxT("Pane 1")).Caption(wxT("Logging")).CaptionVisible(true)
.Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide());
AuiFullscreen = m_Mgr->SavePerspective(); AuiFullscreen = m_Mgr->SavePerspective();
} }
@ -482,7 +462,6 @@ CFrame::CFrame(wxFrame* parent,
// ---------- // ----------
// Update controls // Update controls
m_bControlsCreated = true;
UpdateGUI(); UpdateGUI();
// If we are rerecording create the status bar now instead of later when a game starts // If we are rerecording create the status bar now instead of later when a game starts
@ -495,14 +474,7 @@ CFrame::CFrame(wxFrame* parent,
// Destructor // Destructor
CFrame::~CFrame() CFrame::~CFrame()
{ {
m_bControlsCreated = false;
drives.clear(); drives.clear();
/* The statbar sample has this so I add this to, but I guess timer will be deleted after
this anyway */
#if wxUSE_TIMER
if (m_timer.IsRunning()) m_timer.Stop();
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
delete m_XRRConfig; delete m_XRRConfig;
@ -641,15 +613,6 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
} }
#endif #endif
#if wxUSE_TIMER
void CFrame::OnTimer(wxTimerEvent& WXUNUSED(event))
{
// Process events. Primarily to update the statusbar text.
if (wxGetApp().Pending())
wxGetApp().ProcessPendingEvents();
}
#endif
void CFrame::OnHostMessage(wxCommandEvent& event) void CFrame::OnHostMessage(wxCommandEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())
@ -659,9 +622,9 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
break; break;
case IDM_UPDATESTATUSBAR: case IDM_UPDATESTATUSBAR:
if (m_pStatusBar != NULL) if (GetStatusBar() != NULL)
{ {
m_pStatusBar->SetStatusText(event.GetString(), event.GetInt()); GetStatusBar()->SetStatusText(event.GetString(), event.GetInt());
} }
break; break;

View File

@ -143,38 +143,9 @@ class CFrame : public CRenderFrame
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1]; bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
// Utility // Perspectives (Should find a way to make all of this private)
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32 NBId);
int GetNotebookCount();
wxString GetMenuLabel(int Id);
// Perspectives
void AddRemoveBlankPage();
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
void OnFloatWindow(wxCommandEvent& event);
void ToggleFloatWindow(int Id);
void OnTab(wxAuiNotebookEvent& event);
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void CloseAllNotebooks();
void DoAddPage(wxWindow *Win, int i, bool Float); void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true); void DoRemovePage(wxWindow *, bool bHide = true);
void TogglePane();
void SetPaneSize();
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);
void ToggleNotebookStyle(bool On, long Style);
void ResizeConsole();
// Float window
void DoUnfloatPage(int Id);
void OnFloatingPageClosed(wxCloseEvent& event);
void OnFloatingPageSize(wxSizeEvent& event);
void DoFloatNotebookPage(wxWindowID Id);
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY, const wxString& title = wxT(""), wxWindow * = NULL);
// User perspectives. Should find a way to make these private.
struct SPerspectives struct SPerspectives
{ {
std::string Name; std::string Name;
@ -182,39 +153,20 @@ class CFrame : public CRenderFrame
std::vector<int> Width, Height; std::vector<int> Width, Height;
}; };
std::vector<SPerspectives> Perspectives; std::vector<SPerspectives> Perspectives;
wxString AuiFullscreen, AuiCurrent;
wxArrayString AuiPerspective;
u32 ActivePerspective; u32 ActivePerspective;
void AddPane();
void UpdateCurrentPerspective();
void SaveIniPerspectives();
void LoadIniPerspectives();
void OnPaneClose(wxAuiManagerEvent& evt);
void ReloadPanes();
void DoLoadPerspective();
void OnDropDownToolbarSelect(wxCommandEvent& event);
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
void OnSelectPerspective(wxCommandEvent& event);
private: private:
wxStatusBar* m_pStatusBar;
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl; CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel; wxPanel* m_Panel;
CRenderFrame* m_RenderFrame; CRenderFrame* m_RenderFrame;
wxPanel* m_RenderParent; wxPanel* m_RenderParent;
wxToolBarToolBase* m_ToolPlay;
CLogWindow* m_LogWindow; CLogWindow* m_LogWindow;
bool UseDebugger; bool UseDebugger;
bool m_bBatchMode; bool m_bBatchMode;
bool m_bEdit; bool m_bEdit;
bool m_bTabSplit; bool m_bTabSplit;
bool m_bNoDocking; bool m_bNoDocking;
bool m_bControlsCreated;
bool m_bGameLoading; bool m_bGameLoading;
char newDiscpath[2048];
wxMessageDialog *m_StopDlg;
std::vector<std::string> drives; std::vector<std::string> drives;
@ -253,8 +205,52 @@ class CFrame : public CRenderFrame
void PopulateToolbarAui(wxAuiToolBar* toolBar); void PopulateToolbarAui(wxAuiToolBar* toolBar);
void RecreateToolbar(); void RecreateToolbar();
void CreateMenu(); void CreateMenu();
// Utility
wxString GetMenuLabel(int Id);
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32 NBId);
int GetNotebookCount();
wxAuiNotebook *CreateEmptyNotebook(); wxAuiNotebook *CreateEmptyNotebook();
// Perspectives
void AddRemoveBlankPage();
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
void OnFloatWindow(wxCommandEvent& event);
void ToggleFloatWindow(int Id);
void OnTab(wxAuiNotebookEvent& event);
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void CloseAllNotebooks();
void TogglePane();
void SetPaneSize();
void ResetToolbarStyle();
void TogglePaneStyle(bool On, int EventId);
void ToggleNotebookStyle(bool On, long Style);
void ResizeConsole();
// Float window
void DoUnfloatPage(int Id);
void OnFloatingPageClosed(wxCloseEvent& event);
void OnFloatingPageSize(wxSizeEvent& event);
void DoFloatNotebookPage(wxWindowID Id);
wxFrame * CreateParentFrame(wxWindowID Id = wxID_ANY,
const wxString& title = wxT(""),
wxWindow * = NULL);
wxString AuiFullscreen, AuiCurrent;
void AddPane();
void UpdateCurrentPerspective();
void SaveIniPerspectives();
void LoadIniPerspectives();
void OnPaneClose(wxAuiManagerEvent& evt);
void ReloadPanes();
void DoLoadPerspective();
void OnDropDownToolbarSelect(wxCommandEvent& event);
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
void OnSelectPerspective(wxCommandEvent& event);
#ifdef _WIN32 #ifdef _WIN32
// Override window proc for tricks like screensaver disabling // Override window proc for tricks like screensaver disabling
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
@ -329,21 +325,6 @@ class CFrame : public CRenderFrame
bool RendererIsFullscreen(); bool RendererIsFullscreen();
void StartGame(const std::string& filename); void StartGame(const std::string& filename);
// MenuBar
// File - Drive
wxMenuItem* m_pSubMenuDrive;
// Emulation
wxMenuItem* m_pSubMenuLoad;
wxMenuItem* m_pSubMenuSave;
wxMenuItem* m_pSubMenuFrameSkipping;
#if wxUSE_TIMER
// Used to process command events
void OnTimer(wxTimerEvent& WXUNUSED(event));
wxTimer m_timer;
#endif
// Event table // Event table
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
}; };

View File

@ -107,7 +107,7 @@ void CFrame::CreateMenu()
fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O")); fileMenu->Append(wxID_OPEN, _T("&Open...\tCtrl+O"));
wxMenu *externalDrive = new wxMenu; wxMenu *externalDrive = new wxMenu;
m_pSubMenuDrive = fileMenu->AppendSubMenu(externalDrive, _T("&Boot from DVD Drive...")); fileMenu->Append(IDM_DRIVES, _T("&Boot from DVD Drive..."), externalDrive);
drives = cdio_get_devices(); drives = cdio_get_devices();
// Windows Limitation of 24 character drives // Windows Limitation of 24 character drives
@ -139,7 +139,7 @@ void CFrame::CreateMenu()
emulationMenu->Append(IDM_FRAMESTEP, _T("&Frame Stepping"), wxEmptyString, wxITEM_CHECK); emulationMenu->Append(IDM_FRAMESTEP, _T("&Frame Stepping"), wxEmptyString, wxITEM_CHECK);
wxMenu *skippingMenu = new wxMenu; wxMenu *skippingMenu = new wxMenu;
m_pSubMenuFrameSkipping = emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping")); emulationMenu->AppendSubMenu(skippingMenu, _T("Frame S&kipping"));
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(_T("%i"), i), wxEmptyString, wxITEM_RADIO); skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(_T("%i"), i), wxEmptyString, wxITEM_RADIO);
@ -148,8 +148,8 @@ void CFrame::CreateMenu()
emulationMenu->AppendSeparator(); emulationMenu->AppendSeparator();
wxMenu *saveMenu = new wxMenu; wxMenu *saveMenu = new wxMenu;
wxMenu *loadMenu = new wxMenu; wxMenu *loadMenu = new wxMenu;
m_pSubMenuLoad = emulationMenu->AppendSubMenu(loadMenu, _T("&Load State")); fileMenu->Append(IDM_LOADSTATE, _T("&Load State"), loadMenu);
m_pSubMenuSave = emulationMenu->AppendSubMenu(saveMenu, _T("Sa&ve State")); fileMenu->Append(IDM_SAVESTATE, _T("&Load State"), saveMenu);
saveMenu->Append(IDM_SAVESTATEFILE, _T("Save State...")); saveMenu->Append(IDM_SAVESTATEFILE, _T("Save State..."));
loadMenu->Append(IDM_UNDOSAVESTATE, _T("Last Overwritten State\tShift+F12")); loadMenu->Append(IDM_UNDOSAVESTATE, _T("Last Overwritten State\tShift+F12"));
@ -311,16 +311,11 @@ wxString CFrame::GetMenuLabel(int Id)
Label = _T("&Stop\t"); Label = _T("&Stop\t");
break; break;
case HK_WIIMOTE1_CONNECT: case HK_WIIMOTE1_CONNECT:
Label = _T("Connect Wiimote 1\t");
break;
case HK_WIIMOTE2_CONNECT: case HK_WIIMOTE2_CONNECT:
Label = _T("Connect Wiimote 2\t");
break;
case HK_WIIMOTE3_CONNECT: case HK_WIIMOTE3_CONNECT:
Label = _T("Connect Wiimote 3\t");
break;
case HK_WIIMOTE4_CONNECT: case HK_WIIMOTE4_CONNECT:
Label = _T("Connect Wiimote 4\t"); Label = wxString::Format(_T("Connect Wiimote %i\t"),
Id - HK_WIIMOTE1_CONNECT + 1);
break; break;
} }
@ -604,6 +599,7 @@ void CFrame::DoOpen(bool Boot)
} }
else else
{ {
char newDiscpath[2048];
strncpy(newDiscpath, path.mb_str(), strlen(path.mb_str())+1); strncpy(newDiscpath, path.mb_str(), strlen(path.mb_str())+1);
DVDInterface::ChangeDisc(newDiscpath); DVDInterface::ChangeDisc(newDiscpath);
} }
@ -879,11 +875,7 @@ void CFrame::DoStop()
// Ask for confirmation in case the user accidentally clicked Stop / Escape // Ask for confirmation in case the user accidentally clicked Stop / Escape
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{ {
// Suppress duplicate dialog boxes wxMessageDialog *m_StopDlg = new wxMessageDialog(
if (m_StopDlg)
return;
m_StopDlg = new wxMessageDialog(
this, this,
wxT("Do you want to stop the current emulation?"), wxT("Do you want to stop the current emulation?"),
wxT("Please confirm..."), wxT("Please confirm..."),
@ -892,8 +884,7 @@ void CFrame::DoStop()
int Ret = m_StopDlg->ShowModal(); int Ret = m_StopDlg->ShowModal();
m_StopDlg->Destroy(); m_StopDlg->Destroy();
m_StopDlg = NULL; if (Ret != wxID_YES)
if (Ret == wxID_NO)
return; return;
} }
@ -933,10 +924,10 @@ void CFrame::DoStop()
UpdateGUI(); UpdateGUI();
// Clean framerate indications from the status bar. // Clean framerate indications from the status bar.
m_pStatusBar->SetStatusText(wxT(" "), 0); GetStatusBar()->SetStatusText(wxT(" "), 0);
// Clear wiimote connection status from the status bar. // Clear wiimote connection status from the status bar.
m_pStatusBar->SetStatusText(wxT(" "), 1); GetStatusBar()->SetStatusText(wxT(" "), 1);
// If batch mode was specified on the command-line, exit now. // If batch mode was specified on the command-line, exit now.
if (m_bBatchMode) if (m_bBatchMode)
@ -965,7 +956,7 @@ void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event))
{ {
CPluginManager::GetInstance().OpenConfig( CPluginManager::GetInstance().OpenConfig(
GetHandle(), this,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO PLUGIN_TYPE_VIDEO
); );
@ -974,7 +965,7 @@ void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
{ {
CPluginManager::GetInstance().OpenConfig( CPluginManager::GetInstance().OpenConfig(
GetHandle(), this,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP PLUGIN_TYPE_DSP
); );
@ -1007,7 +998,7 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event)) void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
{ {
CPluginManager::GetInstance().OpenConfig( CPluginManager::GetInstance().OpenConfig(
GetHandle(), this,
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str(),
PLUGIN_TYPE_WIIMOTE PLUGIN_TYPE_WIIMOTE
); );
@ -1231,9 +1222,6 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
// Update the enabled/disabled status // Update the enabled/disabled status
void CFrame::UpdateGUI() void CFrame::UpdateGUI()
{ {
if (!m_bControlsCreated)
return;
// Save status // Save status
bool Initialized = Core::isRunning(); bool Initialized = Core::isRunning();
bool Running = Core::GetState() == Core::CORE_RUN; bool Running = Core::GetState() == Core::CORE_RUN;
@ -1252,7 +1240,7 @@ void CFrame::UpdateGUI()
// File // File
GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized); GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized);
m_pSubMenuDrive->Enable(!Initialized); GetMenuBar()->FindItem(IDM_DRIVES)->Enable(!Initialized);
GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized); GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!Initialized);
@ -1274,24 +1262,33 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->SetItemLabel(GetMenuLabel(HK_WIIMOTE3_CONNECT)); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->SetItemLabel(GetMenuLabel(HK_WIIMOTE3_CONNECT));
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->SetItemLabel(GetMenuLabel(HK_WIIMOTE4_CONNECT)); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->SetItemLabel(GetMenuLabel(HK_WIIMOTE4_CONNECT));
m_pSubMenuLoad->Enable(Initialized); GetMenuBar()->FindItem(IDM_LOADSTATE)->Enable(Initialized);
m_pSubMenuSave->Enable(Initialized); GetMenuBar()->FindItem(IDM_SAVESTATE)->Enable(Initialized);
// Misc // Misc
GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized); GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized);
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader
(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid())
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Enable(Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii); 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);
if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) if (Initialized && SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{ {
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->AccessWiiMote(0x0100)->IsConnected() == 3); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(GetUsbPointer()->
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->AccessWiiMote(0x0101)->IsConnected() == 3); AccessWiiMote(0x0100)->IsConnected() == 3);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->AccessWiiMote(0x0102)->IsConnected() == 3); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(GetUsbPointer()->
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->AccessWiiMote(0x0103)->IsConnected() == 3); AccessWiiMote(0x0101)->IsConnected() == 3);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(GetUsbPointer()->
AccessWiiMote(0x0102)->IsConnected() == 3);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(GetUsbPointer()->
AccessWiiMote(0x0103)->IsConnected() == 3);
} }
if (Running) if (Running)
@ -1475,9 +1472,9 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked(); SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked();
if (SConfig::GetInstance().m_InterfaceStatusbar == true) if (SConfig::GetInstance().m_InterfaceStatusbar == true)
m_pStatusBar->Show(); GetStatusBar()->Show();
else else
m_pStatusBar->Hide(); GetStatusBar()->Hide();
this->SendSizeEvent(); this->SendSizeEvent();
} }

View File

@ -85,6 +85,7 @@ enum
IDM_FRAMESTEP, IDM_FRAMESTEP,
IDM_SCREENSHOT, IDM_SCREENSHOT,
IDM_BROWSE, IDM_BROWSE,
IDM_DRIVES,
IDM_DRIVE1, IDM_DRIVE1,
IDM_DRIVE24 = IDM_DRIVE1 + 23,//248, IDM_DRIVE24 = IDM_DRIVE1 + 23,//248,

View File

@ -42,10 +42,6 @@ enum PLUGIN_COMM
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
#endif #endif
// simulate something that looks like win32
// long term, kill these
#define HWND void*
#endif #endif
#if defined(__cplusplus) #if defined(__cplusplus)
@ -116,7 +112,7 @@ EXPORT void CALL GetDllInfo(PLUGIN_INFO* _pPluginInfo);
// input: A handle to the window that calls this function // input: A handle to the window that calls this function
// output: none // output: none
// //
EXPORT void CALL DllConfig(HWND _hParent); EXPORT void CALL DllConfig(void *_hParent);
// ___________________________________________________________________________ // ___________________________________________________________________________
// Function: DllDebugger // Function: DllDebugger

View File

@ -18,7 +18,7 @@ typedef bool (*TRendererHasFocus)(void);
// This data is passed from the core on initialization. // This data is passed from the core on initialization.
typedef struct typedef struct
{ {
HWND hWnd; void *hWnd;
u32 ISOId; u32 ISOId;
TLogv pLog; TLogv pLog;
TWiimoteInterruptChannel pWiimoteInterruptChannel; TWiimoteInterruptChannel pWiimoteInterruptChannel;

View File

@ -103,22 +103,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
} }
#endif #endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow *win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
#else
return new wxWindow();
#endif
}
#endif
void *DllDebugger(void *_hParent, bool Show) void *DllDebugger(void *_hParent, bool Show)
{ {
return NULL; return NULL;
@ -145,14 +129,13 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
LogManager::SetInstance((LogManager*)globals->logManager); LogManager::SetInstance((LogManager*)globals->logManager);
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// Load config settings // Load config settings
g_Config.Load(); g_Config.Load();
wxWindow *frame = GetParentedWxWindow(_hParent); m_ConfigFrame = new DSPConfigDialogHLE((wxWindow *)_hParent);
m_ConfigFrame = new DSPConfigDialogHLE(frame);
// add backends // add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends(); std::vector<std::string> backends = AudioCommon::GetSoundBackends();
@ -163,23 +146,8 @@ void DllConfig(HWND _hParent)
m_ConfigFrame->AddBackend((*iter).c_str()); m_ConfigFrame->AddBackend((*iter).c_str());
} }
// Only allow one open at a time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy(); m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif #endif
} }

View File

@ -95,22 +95,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
} }
#endif #endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
void GetDllInfo(PLUGIN_INFO* _PluginInfo) void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
@ -133,11 +117,10 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
LogManager::SetInstance((LogManager *)globals->logManager); LogManager::SetInstance((LogManager *)globals->logManager);
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent); m_ConfigFrame = new DSPConfigDialogLLE((wxWindow *)_hParent);
m_ConfigFrame = new DSPConfigDialogLLE(frame);
// add backends // add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends(); std::vector<std::string> backends = AudioCommon::GetSoundBackends();
@ -148,23 +131,9 @@ void DllConfig(HWND _hParent)
m_ConfigFrame->AddBackend((*iter).c_str()); m_ConfigFrame->AddBackend((*iter).c_str());
} }
// Only allow one open at a time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy(); m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif #endif
} }

View File

@ -96,15 +96,6 @@ bool IsD3D()
// This is used for the functions right below here which use wxwidgets // This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
wxWindow* GetParentedWxWindow(HWND Parent)
{
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow* win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
}
#endif #endif
void *DllDebugger(void *_hParent, bool Show) void *DllDebugger(void *_hParent, bool Show)
@ -186,9 +177,9 @@ void DllAbout(HWND _hParent)
MessageBoxA(NULL, "DllAbout not implemented, how did you come here? Anyway, report this to the devs.", "Error!", MB_OK); MessageBoxA(NULL, "DllAbout not implemented, how did you come here? Anyway, report this to the devs.", "Error!", MB_OK);
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
DlgSettings_Show(g_hInstance, _hParent); DlgSettings_Show(g_hInstance, (HWND)((wxWindow *)_hParent)->GetHandle());
} }
void Initialize(void* init) void Initialize(void* init)

View File

@ -85,15 +85,6 @@ bool IsD3D()
// This is used for the functions right below here which use wxwidgets // This is used for the functions right below here which use wxwidgets
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
wxWindow* GetParentedWxWindow(HWND Parent)
{
wxSetInstance((HINSTANCE)g_hInstance);
wxWindow *win = new wxWindow();
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
return win;
}
#endif #endif
void *DllDebugger(void *_hParent, bool Show) void *DllDebugger(void *_hParent, bool Show)
@ -187,7 +178,7 @@ void DllAbout(HWND _hParent)
//DialogBox(g_hInstance,(LPCTSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc); //DialogBox(g_hInstance,(LPCTSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
// If not initialized, only init D3D so we can enumerate resolutions. // If not initialized, only init D3D so we can enumerate resolutions.
if (!s_PluginInitialized) if (!s_PluginInitialized)
@ -196,21 +187,11 @@ void DllConfig(HWND _hParent)
g_Config.GameIniLoad(globals->game_ini); g_Config.GameIniLoad(globals->game_ini);
UpdateActiveConfig(); UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent); m_ConfigFrame = new GFXConfigDialogDX((wxWindow *)_hParent);
m_ConfigFrame = new GFXConfigDialogDX(frame);
// Prevent user to show more than 1 config window at same time
frame->Disable();
m_ConfigFrame->CreateGUIControls(); m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
frame->Enable();
frame->SetFocus();
frame->SetHWND(NULL);
m_ConfigFrame->Destroy(); m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif #endif
if (!s_PluginInitialized) if (!s_PluginInitialized)
D3D::Shutdown(); D3D::Shutdown();

View File

@ -136,19 +136,6 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
extern HINSTANCE g_hInstance; extern HINSTANCE g_hInstance;
#endif #endif
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif #endif
void *DllDebugger(void *_hParent, bool Show) void *DllDebugger(void *_hParent, bool Show)
@ -160,35 +147,18 @@ void *DllDebugger(void *_hParent, bool Show)
#endif #endif
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(globals->game_ini); g_Config.GameIniLoad(globals->game_ini);
g_Config.UpdateProjectionHack(); g_Config.UpdateProjectionHack();
UpdateActiveConfig(); UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent); m_ConfigFrame = new GFXConfigDialogOGL((wxWindow *)_hParent);
m_ConfigFrame = new GFXConfigDialogOGL(frame);
// Prevent user to show more than 1 config window at same time
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->CreateGUIControls(); m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->CreateGUIControls();
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy(); m_ConfigFrame->Destroy();
m_ConfigFrame = NULL;
frame->Destroy();
#endif #endif
} }

View File

@ -66,7 +66,7 @@ void *DllDebugger(void *_hParent, bool Show)
return NULL; return NULL;
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
} }

View File

@ -213,11 +213,11 @@ void GetMousePos(float& x, float& y)
// Get the cursor position for the entire screen // Get the cursor position for the entire screen
GetCursorPos(&point); GetCursorPos(&point);
// Get the cursor position relative to the upper left corner of the rendering window // Get the cursor position relative to the upper left corner of the rendering window
ScreenToClient(g_WiimoteInitialize.hWnd, &point); ScreenToClient((HWND)g_WiimoteInitialize.hWnd, &point);
// Get the size of the rendering window. (In my case Rect.top and Rect.left was zero.) // Get the size of the rendering window. (In my case Rect.top and Rect.left was zero.)
RECT Rect; RECT Rect;
GetClientRect(g_WiimoteInitialize.hWnd, &Rect); GetClientRect((HWND)g_WiimoteInitialize.hWnd, &Rect);
// Width and height is the size of the rendering window // Width and height is the size of the rendering window
float WinWidth = (float)(Rect.right - Rect.left); float WinWidth = (float)(Rect.right - Rect.left);
float WinHeight = (float)(Rect.bottom - Rect.top); float WinHeight = (float)(Rect.bottom - Rect.top);

View File

@ -115,21 +115,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
} }
#endif #endif
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
// Exports // Exports
void GetDllInfo(PLUGIN_INFO* _PluginInfo) void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
@ -157,7 +142,7 @@ void *DllDebugger(void *_hParent, bool Show)
return NULL; return NULL;
} }
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL) if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL)
@ -177,24 +162,9 @@ void DllConfig(HWND _hParent)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxWindow *frame = GetParentedWxWindow(_hParent); m_BasicConfigFrame = new WiimoteBasicConfigDialog((wxWindow *)_hParent);
m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame);
#ifdef _WIN32
frame->Disable();
m_BasicConfigFrame->ShowModal(); m_BasicConfigFrame->ShowModal();
frame->Enable();
#else
m_BasicConfigFrame->ShowModal();
#endif
#ifdef _WIN32
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_BasicConfigFrame->Destroy(); m_BasicConfigFrame->Destroy();
m_BasicConfigFrame = NULL;
frame->Destroy();
#endif #endif
} }
@ -347,7 +317,7 @@ void Wiimote_ControlChannel(int _number, u16 _channelID, const void* _pData, u32
WiiMoteEmu::g_ReportingAuto[_number] = false; WiiMoteEmu::g_ReportingAuto[_number] = false;
WARN_LOG(WIIMOTE, "Wiimote: #%i Disconnected", _number); WARN_LOG(WIIMOTE, "Wiimote: #%i Disconnected", _number);
#ifdef _WIN32 #ifdef _WIN32
PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number); PostMessage((HWND)g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, _number);
#endif #endif
return; return;
} }

View File

@ -794,7 +794,7 @@ THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg)
void ToggleEmulatorState(bool stop) { void ToggleEmulatorState(bool stop) {
PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0); PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0);
if (stop) { if (stop) {
while (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) Sleep(50); while (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) Sleep(50);
} }
@ -832,7 +832,7 @@ int PairUpRefreshWiimote(bool addwiimote)
Allocate(); Allocate();
ToggleEmulatorState(false); ToggleEmulatorState(false);
if (addwiimote) if (addwiimote)
PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot)); PostMessage(GetParent((HWND)g_WiimoteInitialize.hWnd), WM_USER, WM_USER_KEYDOWN, (3 + connectslot));
} }
return 0; return 0;

View File

@ -53,23 +53,6 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
HINSTANCE g_hInstance; HINSTANCE g_hInstance;
#endif #endif
// copied from GCPad
#if defined(HAVE_WX) && HAVE_WX
wxWindow* GetParentedWxWindow(HWND Parent)
{
#ifdef _WIN32
wxSetInstance((HINSTANCE)g_hInstance);
#endif
wxWindow *win = new wxWindow();
#ifdef _WIN32
win->SetHWND((WXHWND)Parent);
win->AdoptAttributesFromHWND();
#endif
return win;
}
#endif
// /
#ifdef _WIN32 #ifdef _WIN32
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{ {
@ -271,7 +254,7 @@ void GetDllInfo(PLUGIN_INFO* _pPluginInfo)
// input: A handle to the window that calls this function // input: A handle to the window that calls this function
// output: none // output: none
// //
void DllConfig(HWND _hParent) void DllConfig(void *_hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
const bool was_init = g_plugin.controller_interface.IsInit(); const bool was_init = g_plugin.controller_interface.IsInit();
@ -279,34 +262,18 @@ void DllConfig(HWND _hParent)
if (false == was_init) if (false == was_init)
{ {
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window); Window win = GDK_WINDOW_XID(GTK_WIDGET(((wxWindow *)_hParent)->GetHandle())->window);
InitPlugin((void *)win); InitPlugin((void *)win);
#else #else
InitPlugin(_hParent); InitPlugin(((wxWindow *)_hParent)->GetHandle());
#endif #endif
} }
wxWindow *frame = GetParentedWxWindow(_hParent); WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag((wxWindow *)_hParent, g_plugin);
WiimoteConfigDiag* const m_ConfigFrame = new WiimoteConfigDiag(frame, g_plugin);
//InputConfigDialog* const m_ConfigFrame = new InputConfigDialog(frame, g_plugin, PLUGIN_FULL_NAME);
#ifdef _WIN32
frame->Disable();
m_ConfigFrame->ShowModal(); m_ConfigFrame->ShowModal();
frame->Enable();
#else
m_ConfigFrame->ShowModal();
#endif
#ifdef _WIN32
wxMilliSleep(50); // hooray for hacks
frame->SetFocus();
frame->SetHWND(NULL);
#endif
m_ConfigFrame->Destroy(); m_ConfigFrame->Destroy();
frame->Destroy();
// /
if (false == was_init) if (false == was_init)
DeInitPlugin(); DeInitPlugin();