mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
apply the new wxw method to dsp hle, wiimote, and padsimple.
wiimote config now loads way faster :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3649 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -21,9 +21,10 @@
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "ConfigDlg.h"
|
||||
DSPConfigDialogHLE* m_ConfigFrame = NULL;
|
||||
#include "Debugger/File.h" // For file logging
|
||||
#include "Debugger/Debugger.h" // For the CDebugger class
|
||||
CDebugger* m_frame = NULL;
|
||||
#include "Debugger/Debugger.h"
|
||||
DSPDebuggerHLE* m_DebuggerFrame = NULL;
|
||||
#endif
|
||||
|
||||
#include "ChunkFile.h"
|
||||
@ -65,7 +66,10 @@ struct DSPState
|
||||
};
|
||||
DSPState g_dspState;
|
||||
|
||||
// wxWidgets: Create the wxApp
|
||||
// Standard crap to make wxWidgets happy
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
class wxDLLApp : public wxApp
|
||||
{
|
||||
@ -74,72 +78,69 @@ class wxDLLApp : public wxApp
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
|
||||
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
|
||||
#endif
|
||||
|
||||
// DllMain
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance = NULL;
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
|
||||
// more stuff wx needs
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxSetInstance((HINSTANCE)hinstDLL);
|
||||
int argc = 0;
|
||||
char **argv = NULL;
|
||||
wxEntryStart(argc, argv);
|
||||
|
||||
// This is for ?
|
||||
if ( !wxTheApp || !wxTheApp->CallOnInit() )
|
||||
if (!wxTheApp || !wxTheApp->CallOnInit())
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
wxEntryCleanup(); // use this or get a crash
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
wxEntryCleanup();
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
#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
|
||||
|
||||
|
||||
// Exported fuctions
|
||||
|
||||
// Create debugging window - We could use use wxWindow win; new CDebugger(win)
|
||||
// like nJoy but I don't know why it would be better. - There's a lockup
|
||||
// problem with ShowModal(), but Show() doesn't work because then
|
||||
// DLL_PROCESS_DETACH is called immediately after DLL_PROCESS_ATTACH.
|
||||
void DllDebugger(HWND _hParent, bool Show)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (m_frame && Show) // if we have created it, let us show it again
|
||||
{
|
||||
m_frame->DoShow();
|
||||
}
|
||||
else if (!m_frame && Show)
|
||||
{
|
||||
m_frame = new CDebugger(NULL);
|
||||
m_frame->Show();
|
||||
}
|
||||
else if (m_frame && !Show)
|
||||
{
|
||||
m_frame->DoHide();
|
||||
}
|
||||
if (!m_DebuggerFrame)
|
||||
m_DebuggerFrame = new DSPDebuggerHLE(GetParentedWxWindow(_hParent));
|
||||
|
||||
if (Show)
|
||||
m_DebuggerFrame->Show();
|
||||
else
|
||||
m_DebuggerFrame->Hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -169,18 +170,23 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// (shuffle2) TODO: reparent dlg with DolphinApp
|
||||
ConfigDialog dlg(NULL);
|
||||
if (!m_ConfigFrame)
|
||||
m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent));
|
||||
|
||||
// add backends
|
||||
std::vector<std::string> backends = AudioCommon::GetSoundBackends();
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter = backends.begin();
|
||||
iter != backends.end(); ++iter) {
|
||||
dlg.AddBackend((*iter).c_str());
|
||||
iter != backends.end(); ++iter)
|
||||
{
|
||||
m_ConfigFrame->AddBackend((*iter).c_str());
|
||||
}
|
||||
// Show the window
|
||||
dlg.ShowModal();
|
||||
|
||||
// Only allow one open at a time
|
||||
if (!m_ConfigFrame->IsShown())
|
||||
m_ConfigFrame->ShowModal();
|
||||
else
|
||||
m_ConfigFrame->Hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -211,12 +217,12 @@ void Shutdown()
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// Reset mails
|
||||
if (m_frame)
|
||||
if (m_DebuggerFrame)
|
||||
{
|
||||
sMailLog.clear();
|
||||
sMailTime.clear();
|
||||
m_frame->sMail.clear();
|
||||
m_frame->sMailEnd.clear();
|
||||
m_DebuggerFrame->sMail.clear();
|
||||
m_DebuggerFrame->sMailEnd.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user