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:
Shawn Hoffman 2009-07-02 19:00:27 +00:00
parent 12efada734
commit 99a33ccba9
24 changed files with 618 additions and 689 deletions

View file

@ -19,17 +19,17 @@
#include "Config.h" #include "Config.h"
#include "ConfigDlg.h" #include "ConfigDlg.h"
BEGIN_EVENT_TABLE(ConfigDialog, wxDialog) BEGIN_EVENT_TABLE(DSPConfigDialogHLE, wxDialog)
EVT_BUTTON(wxID_OK, ConfigDialog::SettingsChanged) EVT_BUTTON(wxID_OK, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, ConfigDialog::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_HLE_AUDIO, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, ConfigDialog::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, ConfigDialog::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_RE0_FIX, ConfigDialog::SettingsChanged) EVT_CHECKBOX(ID_ENABLE_RE0_FIX, DSPConfigDialogHLE::SettingsChanged)
EVT_CHECKBOX(ID_DISABLE_STREAMING, ConfigDialog::SettingsChanged) EVT_CHECKBOX(ID_DISABLE_STREAMING, DSPConfigDialogHLE::SettingsChanged)
EVT_COMMAND_SCROLL(ID_VOLUME, ConfigDialog::VolumeChanged) EVT_COMMAND_SCROLL(ID_VOLUME, DSPConfigDialogHLE::VolumeChanged)
END_EVENT_TABLE() END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
// Load config settings // Load config settings
@ -107,7 +107,7 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
} }
// Add audio output options // Add audio output options
void ConfigDialog::AddBackend(const char* backend) void DSPConfigDialogHLE::AddBackend(const char* backend)
{ {
// Update values // Update values
m_BackendSelection->Append(wxString::FromAscii(backend)); m_BackendSelection->Append(wxString::FromAscii(backend));
@ -124,11 +124,11 @@ void ConfigDialog::AddBackend(const char* backend)
#endif #endif
} }
ConfigDialog::~ConfigDialog() DSPConfigDialogHLE::~DSPConfigDialogHLE()
{ {
} }
void ConfigDialog::VolumeChanged(wxScrollEvent& WXUNUSED(event)) void DSPConfigDialogHLE::VolumeChanged(wxScrollEvent& WXUNUSED(event))
{ {
ac_Config.m_Volume = m_volumeSlider->GetValue(); ac_Config.m_Volume = m_volumeSlider->GetValue();
ac_Config.Update(); ac_Config.Update();
@ -136,7 +136,7 @@ void ConfigDialog::VolumeChanged(wxScrollEvent& WXUNUSED(event))
m_volumeText->SetLabel(wxString::Format(wxT("%d %%"), m_volumeSlider->GetValue())); m_volumeText->SetLabel(wxString::Format(wxT("%d %%"), m_volumeSlider->GetValue()));
} }
void ConfigDialog::SettingsChanged(wxCommandEvent& event) void DSPConfigDialogHLE::SettingsChanged(wxCommandEvent& event)
{ {
g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue(); g_Config.m_EnableHLEAudio = m_buttonEnableHLEAudio->GetValue();
g_Config.m_EnableRE0Fix = m_buttonEnableRE0Fix->GetValue(); g_Config.m_EnableRE0Fix = m_buttonEnableRE0Fix->GetValue();

View file

@ -24,16 +24,16 @@
#include <wx/statbox.h> #include <wx/statbox.h>
#include "AudioCommon.h" #include "AudioCommon.h"
class ConfigDialog : public wxDialog class DSPConfigDialogHLE : public wxDialog
{ {
public: public:
ConfigDialog(wxWindow *parent, DSPConfigDialogHLE(wxWindow *parent,
wxWindowID id = 1, wxWindowID id = 1,
const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"), const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE); long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog(); virtual ~DSPConfigDialogHLE();
void AddBackend(const char *backend); void AddBackend(const char *backend);
private: private:

View file

@ -42,7 +42,7 @@
// Make the wxTextCtrls scroll with each other // Make the wxTextCtrls scroll with each other
void CDebugger::DoScrollBlocks() void DSPDebuggerHLE::DoScrollBlocks()
{ {
// ShowPosition = in letters // ShowPosition = in letters
// GetScrollPos = number of lines from the top // GetScrollPos = number of lines from the top
@ -75,13 +75,13 @@ void CDebugger::DoScrollBlocks()
}*/ }*/
} }
void CDebugger::ScrollBlocksMouse(wxMouseEvent& event) void DSPDebuggerHLE::ScrollBlocksMouse(wxMouseEvent& event)
{ {
DoScrollBlocks(); DoScrollBlocks();
event.Skip(); // otherwise we remove the regular behavior, for example scrolling event.Skip(); // otherwise we remove the regular behavior, for example scrolling
} }
void CDebugger::ScrollBlocksCursor(wxScrollWinEvent& event) void DSPDebuggerHLE::ScrollBlocksCursor(wxScrollWinEvent& event)
{ {
DoScrollBlocks(); DoScrollBlocks();
event.Skip(); // otherwise we remove the regular behavior, for example scrolling event.Skip(); // otherwise we remove the regular behavior, for example scrolling

View file

@ -42,38 +42,38 @@
// ======================================================================================= // =======================================================================================
// Event table and class // Event table and class
BEGIN_EVENT_TABLE(CDebugger,wxDialog) BEGIN_EVENT_TABLE(DSPDebuggerHLE,wxDialog)
EVT_CLOSE(CDebugger::OnClose) // on close event EVT_CLOSE(DSPDebuggerHLE::OnClose) // on close event
EVT_BUTTON(ID_UPD,CDebugger::OnUpdate) // buttons EVT_BUTTON(ID_UPD,DSPDebuggerHLE::OnUpdate) // buttons
// left cotrols // left cotrols
EVT_CHECKLISTBOX(IDC_CHECKLIST5, CDebugger::OnOptions) // options EVT_CHECKLISTBOX(IDC_CHECKLIST5, DSPDebuggerHLE::OnOptions) // options
EVT_CHECKLISTBOX(IDC_CHECKLIST6, CDebugger::OnShowAll) EVT_CHECKLISTBOX(IDC_CHECKLIST6, DSPDebuggerHLE::OnShowAll)
EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase) // update frequency EVT_RADIOBOX(IDC_RADIO0,DSPDebuggerHLE::ShowBase) // update frequency
// right cotrols // right cotrols
EVT_RADIOBOX(IDC_RADIO0,CDebugger::ShowBase) EVT_RADIOBOX(IDC_RADIO0,DSPDebuggerHLE::ShowBase)
EVT_RADIOBOX(IDC_RADIO1,CDebugger::ChangeFrequency) // update frequency EVT_RADIOBOX(IDC_RADIO1,DSPDebuggerHLE::ChangeFrequency) // update frequency
EVT_RADIOBOX(IDC_RADIO2,CDebugger::ChangePreset) // presets EVT_RADIOBOX(IDC_RADIO2,DSPDebuggerHLE::ChangePreset) // presets
EVT_CHECKLISTBOX(IDC_CHECKLIST1, CDebugger::OnSettingsCheck) // settings EVT_CHECKLISTBOX(IDC_CHECKLIST1, DSPDebuggerHLE::OnSettingsCheck) // settings
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, CDebugger::UpdateMail) // mails EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, DSPDebuggerHLE::UpdateMail) // mails
EVT_RADIOBOX(IDC_RADIO3,CDebugger::ChangeMail) EVT_RADIOBOX(IDC_RADIO3,DSPDebuggerHLE::ChangeMail)
EVT_CHECKLISTBOX(IDC_CHECKLIST2, CDebugger::OnGameChange) // gc EVT_CHECKLISTBOX(IDC_CHECKLIST2, DSPDebuggerHLE::OnGameChange) // gc
EVT_CHECKLISTBOX(IDC_CHECKLIST3, CDebugger::OnGameChange) // wii EVT_CHECKLISTBOX(IDC_CHECKLIST3, DSPDebuggerHLE::OnGameChange) // wii
EVT_CHECKLISTBOX(IDC_CHECKLIST4, CDebugger::MailSettings) // settings EVT_CHECKLISTBOX(IDC_CHECKLIST4, DSPDebuggerHLE::MailSettings) // settings
//EVT_RIGHT_DOWN(CDebugger::ScrollBlocks) //EVT_RIGHT_DOWN(DSPDebuggerHLE::ScrollBlocks)
//EVT_LEFT_DOWN(CDebugger::ScrollBlocks) //EVT_LEFT_DOWN(DSPDebuggerHLE::ScrollBlocks)
//EVT_MOUSE_EVENTS(CDebugger::ScrollBlocks) //EVT_MOUSE_EVENTS(DSPDebuggerHLE::ScrollBlocks)
//EVT_MOTION(CDebugger::ScrollBlocks) //EVT_MOTION(DSPDebuggerHLE::ScrollBlocks)
//EVT_SCROLL(CDebugger::ScrollBlocks) //EVT_SCROLL(DSPDebuggerHLE::ScrollBlocks)
//EVT_SCROLLWIN(CDebugger::ScrollBlocks) //EVT_SCROLLWIN(DSPDebuggerHLE::ScrollBlocks)
END_EVENT_TABLE() END_EVENT_TABLE()
CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title, DSPDebuggerHLE::DSPDebuggerHLE(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style) const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
, m_GPRListView(NULL) , m_GPRListView(NULL)
@ -131,16 +131,16 @@ CDebugger::CDebugger(wxWindow *parent, wxWindowID id, const wxString &title,
//m_bl95, m_PageBlock, sBlock //m_bl95, m_PageBlock, sBlock
m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBTRACK, m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBTRACK,
wxScrollWinEventHandler(CDebugger::ScrollBlocksCursor), (wxObject*)NULL, this); wxScrollWinEventHandler(DSPDebuggerHLE::ScrollBlocksCursor), (wxObject*)NULL, this);
m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBRELEASE, m_bl95->Connect(wxID_ANY, wxEVT_SCROLLWIN_THUMBRELEASE,
wxScrollWinEventHandler(CDebugger::ScrollBlocksCursor), (wxObject*)NULL, this); wxScrollWinEventHandler(DSPDebuggerHLE::ScrollBlocksCursor), (wxObject*)NULL, this);
m_bl95->Connect(wxID_ANY, wxEVT_MOTION, m_bl95->Connect(wxID_ANY, wxEVT_MOTION,
wxMouseEventHandler(CDebugger::ScrollBlocksMouse), (wxObject*)NULL, this); wxMouseEventHandler(DSPDebuggerHLE::ScrollBlocksMouse), (wxObject*)NULL, this);
m_bl95->Connect(wxID_ANY, wxEVT_MOUSEWHEEL, m_bl95->Connect(wxID_ANY, wxEVT_MOUSEWHEEL,
wxMouseEventHandler(CDebugger::ScrollBlocksMouse), (wxObject*)NULL, this); wxMouseEventHandler(DSPDebuggerHLE::ScrollBlocksMouse), (wxObject*)NULL, this);
} }
CDebugger::~CDebugger() DSPDebuggerHLE::~DSPDebuggerHLE()
{ {
// empty // empty
IniFile file; IniFile file;
@ -154,7 +154,7 @@ CDebugger::~CDebugger()
// ======================================================================== // ========================================================================
// System functions // System functions
// -------------- // --------------
void CDebugger::OnClose(wxCloseEvent& /*event*/) void DSPDebuggerHLE::OnClose(wxCloseEvent& /*event*/)
{ {
// Save the window position when we hide the window to // Save the window position when we hide the window to
IniFile file; IniFile file;
@ -165,18 +165,7 @@ void CDebugger::OnClose(wxCloseEvent& /*event*/)
EndModal(0); EndModal(0);
} }
void CDebugger::DoHide() void DSPDebuggerHLE::OnUpdate(wxCommandEvent& /*event*/)
{
Hide();
}
void CDebugger::DoShow()
{
Show();
DoShowConsole(); // The console goes with the wx window
}
void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
{ {
this->NotifyUpdate(); this->NotifyUpdate();
} }
@ -186,19 +175,18 @@ void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
// ========================================================================== // ==========================================================================
// Save and load settings // Save and load settings
// -------------- // --------------
void CDebugger::Save(IniFile& _IniFile) const void DSPDebuggerHLE::Save(IniFile& _IniFile) const
{ {
// TODO2: get the screen resolution and make limits from that // TODO2: get the screen resolution and make limits from that
if(GetPosition().x < 1000 && GetPosition().y < 1000 if(GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000 && GetSize().GetWidth() < 1000 && GetSize().GetHeight() < 1000)
)
{ {
_IniFile.Set("SoundWindow", "x", GetPosition().x); _IniFile.Set("SoundWindow", "x", GetPosition().x);
_IniFile.Set("SoundWindow", "y", GetPosition().y); _IniFile.Set("SoundWindow", "y", GetPosition().y);
_IniFile.Set("SoundWindow", "w", GetSize().GetWidth()); _IniFile.Set("SoundWindow", "w", GetSize().GetWidth());
_IniFile.Set("SoundWindow", "h", GetSize().GetHeight()); _IniFile.Set("SoundWindow", "h", GetSize().GetHeight());
} }
_IniFile.Set("SoundWindow", "Console", m_options->IsChecked(3)); // save settings // save settings
_IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection()); _IniFile.Set("SoundWindow", "UpdateFrequency", m_RadioBox[1]->GetSelection());
_IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0)); _IniFile.Set("SoundWindow", "ScanMails", m_gcwiiset->IsChecked(0));
_IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1)); _IniFile.Set("SoundWindow", "StoreMails", m_gcwiiset->IsChecked(1));
@ -206,7 +194,7 @@ void CDebugger::Save(IniFile& _IniFile) const
} }
void CDebugger::Load(IniFile& _IniFile) void DSPDebuggerHLE::Load(IniFile& _IniFile)
{ {
int x,y,w,h; int x,y,w,h;
_IniFile.Get("SoundWindow", "x", &x, GetPosition().x); _IniFile.Get("SoundWindow", "x", &x, GetPosition().x);
@ -215,12 +203,6 @@ void CDebugger::Load(IniFile& _IniFile)
_IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight()); _IniFile.Get("SoundWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h); SetSize(x, y, w, h);
// Show console or not
bool Console;
_IniFile.Get("SoundWindow", "Console", &Console, m_options->IsChecked(3));
m_options->Check(3, Console);
DoShowConsole();
// Show number base // Show number base
_IniFile.Get("SoundWindow", "ShowBase", &bShowBase, !m_RadioBox[0]->GetSelection()); _IniFile.Get("SoundWindow", "ShowBase", &bShowBase, !m_RadioBox[0]->GetSelection());
m_RadioBox[0]->SetSelection(!bShowBase); m_RadioBox[0]->SetSelection(!bShowBase);
@ -241,7 +223,7 @@ void CDebugger::Load(IniFile& _IniFile)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Create GUI controls // Create GUI controls
// ------------- // -------------
void CDebugger::CreateGUIControls() void DSPDebuggerHLE::CreateGUIControls()
{ {
SetTitle(wxT("Sound Debugging")); SetTitle(wxT("Sound Debugging"));
@ -350,12 +332,10 @@ SetTitle(wxT("Sound Debugging"));
m_options->Append(wxT("Save to file")); m_options->Append(wxT("Save to file"));
m_options->Append(wxT("Only looping")); m_options->Append(wxT("Only looping"));
m_options->Append(wxT("Show all")); m_options->Append(wxT("Show all"));
m_options->Append(wxT("Show console"));
m_options->Check(0, gSaveFile); m_options->Check(0, gSaveFile);
m_options->Check(1, gOnlyLooping); m_options->Check(1, gOnlyLooping);
m_options->Check(2, gShowAll); m_options->Check(2, gShowAll);
m_options->Check(3, gSaveFile);
m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40, m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40,
m_options->GetCount() * 15)); m_options->GetCount() * 15));
@ -563,7 +543,7 @@ SetTitle(wxT("Sound Debugging"));
// ======================================================================================= // =======================================================================================
// Settings // Settings
void CDebugger::OnSettingsCheck(wxCommandEvent& event) void DSPDebuggerHLE::OnSettingsCheck(wxCommandEvent& event)
{ {
gSSBM = m_settings->IsChecked(0); gSSBM = m_settings->IsChecked(0);
gSSBMremedy1 = m_settings->IsChecked(1); gSSBMremedy1 = m_settings->IsChecked(1);
@ -576,12 +556,12 @@ void CDebugger::OnSettingsCheck(wxCommandEvent& event)
// ======================================================================================= // =======================================================================================
// Change preset // Change preset
void CDebugger::ChangePreset(wxCommandEvent& event) void DSPDebuggerHLE::ChangePreset(wxCommandEvent& event)
{ {
DoChangePreset(); DoChangePreset();
} }
void CDebugger::DoChangePreset() void DSPDebuggerHLE::DoChangePreset()
{ {
if(m_RadioBox[2]->GetSelection() == 0) if(m_RadioBox[2]->GetSelection() == 0)
gPreset = 0; gPreset = 0;
@ -595,7 +575,7 @@ void CDebugger::DoChangePreset()
// ======================================================================================= // =======================================================================================
// Show base // Show base
void CDebugger::ShowBase(wxCommandEvent& event) void DSPDebuggerHLE::ShowBase(wxCommandEvent& event)
{ {
if(m_RadioBox[0]->GetSelection() == 0) if(m_RadioBox[0]->GetSelection() == 0)
bShowBase = true; bShowBase = true;
@ -605,12 +585,12 @@ void CDebugger::ShowBase(wxCommandEvent& event)
// ======================================================================================= // =======================================================================================
// Change update frequency // Change update frequency
void CDebugger::ChangeFrequency(wxCommandEvent& event) void DSPDebuggerHLE::ChangeFrequency(wxCommandEvent& event)
{ {
DoChangeFrequency(); DoChangeFrequency();
} }
void CDebugger::DoChangeFrequency() void DSPDebuggerHLE::DoChangeFrequency()
{ {
if(m_RadioBox[1]->GetSelection() == 0) if(m_RadioBox[1]->GetSelection() == 0)
gUpdFreq = 0; gUpdFreq = 0;
@ -624,17 +604,14 @@ void CDebugger::DoChangeFrequency()
// ======================================================================================= // =======================================================================================
// Options // Options
void CDebugger::OnOptions(wxCommandEvent& event) void DSPDebuggerHLE::OnOptions(wxCommandEvent& event)
{ {
gSaveFile = m_options->IsChecked(0); gSaveFile = m_options->IsChecked(0);
gOnlyLooping = m_options->IsChecked(1); gOnlyLooping = m_options->IsChecked(1);
gShowAll = m_options->IsChecked(2); gShowAll = m_options->IsChecked(2);
gSaveFile = m_options->IsChecked(3);
if(event.GetInt() == 3) DoShowConsole();
} }
void CDebugger::OnShowAll(wxCommandEvent& event) void DSPDebuggerHLE::OnShowAll(wxCommandEvent& event)
{ {
/// Only allow one selection at a time /// Only allow one selection at a time
for (u32 i = 0; i < m_opt_showall->GetCount(); ++i) for (u32 i = 0; i < m_opt_showall->GetCount(); ++i)
@ -647,24 +624,7 @@ void CDebugger::OnShowAll(wxCommandEvent& event)
else giShowAll = -1; else giShowAll = -1;
} }
// -------------- void DSPDebuggerHLE::NotifyUpdate()
// =======================================================================================
// Show or hide console window
void CDebugger::ShowHideConsole(wxCommandEvent& event)
{
DoShowConsole();
}
void CDebugger::DoShowConsole()
{
ConsoleListener* console = LogManager::GetInstance()->getConsoleListener();
if(m_options->IsChecked(3) && !console->IsOpen())
console->Open();
}
void CDebugger::NotifyUpdate()
{ {
if (m_GPRListView != NULL) if (m_GPRListView != NULL)
{ {

View file

@ -19,8 +19,8 @@
// //
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
#ifndef __CDebugger_h__ #ifndef __DSPDebuggerHLE_h__
#define __CDebugger_h__ #define __DSPDebuggerHLE_h__
// general things // general things
#include <iostream> #include <iostream>
@ -51,42 +51,41 @@
class CPBView; class CPBView;
class IniFile; class IniFile;
// Window settings
#undef CDebugger_STYLE
#define CDebugger_STYLE wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE
class CDebugger : public wxDialog class DSPDebuggerHLE : public wxDialog
{ {
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
public: public:
CDebugger(wxWindow *parent, wxWindowID id = 1, const wxString &title = _("Sound Debugger"), DSPDebuggerHLE(wxWindow *parent,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, wxWindowID id = 1,
long style = CDebugger_STYLE); const wxString &title = wxT("Sound Debugger"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~CDebugger(); virtual ~DSPDebuggerHLE();
void Save(IniFile& _IniFile) const; void Save(IniFile& _IniFile) const;
void Load(IniFile& _IniFile); void Load(IniFile& _IniFile);
void DoHide(); void DoShow();
void NotifyUpdate(); void NotifyUpdate();
void OnUpdate(wxCommandEvent& event); void OnUpdate(wxCommandEvent& event);
void ShowHideConsole(wxCommandEvent& event); // options // options
void ShowBase(wxCommandEvent& event); void ShowBase(wxCommandEvent& event);
void DoShowConsole();
//void OnlyLooping(wxCommandEvent& event);
void OnOptions(wxCommandEvent& event); void OnOptions(wxCommandEvent& event);
void OnShowAll(wxCommandEvent& event); void OnShowAll(wxCommandEvent& event);
void ChangeFrequency(wxCommandEvent& event); // update frequency // update frequency
void ChangeFrequency(wxCommandEvent& event);
void DoChangeFrequency(); void DoChangeFrequency();
void ChangePreset(wxCommandEvent& event); void ChangePreset(wxCommandEvent& event);
void DoChangePreset(); void DoChangePreset();
void OnSettingsCheck(wxCommandEvent& event); // settings // settings
void OnSettingsCheck(wxCommandEvent& event);
// ============== Mail // ============== Mail
void DoUpdateMail(); void DoUpdateMail();
@ -161,8 +160,6 @@ class CDebugger : public wxDialog
ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook ID_NOTEBOOK, ID_PAGEMAIN, ID_PAGEMAIL, ID_PAGEBLOCK, // notebook
ID_LOG, ID_LOG1, // mails ID_LOG, ID_LOG1, // mails
ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92, ID_BL0, ID_BL95, ID_BL94, ID_BL93, ID_BL92,
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
}; };
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);

View file

@ -27,7 +27,7 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h" #include "../Debugger/Debugger.h"
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
#endif #endif
#include "../Debugger/File.h" #include "../Debugger/File.h"
@ -88,7 +88,7 @@ int PrintFile(int a, char *fmt, ...)
{ {
#if defined(DEBUG_HLE) && defined(_WIN32) #if defined(DEBUG_HLE) && defined(_WIN32)
if(m_frame->gSaveFile) if(m_DebuggerFrame->gSaveFile)
{ {
char s[StringSize]; char s[StringSize];
va_list argptr; va_list argptr;

View file

@ -51,7 +51,7 @@
// ------------- // -------------
// Externals // Externals
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
//int PBSize = 128; //int PBSize = 128;
// Parameter blocks // Parameter blocks
@ -148,7 +148,7 @@ std::vector<int> numberRunning(NUMBER_OF_PBS);
// Classes // Classes
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
////////////////////////// //////////////////////////
@ -160,7 +160,7 @@ std::string writeTitle(int a, bool Wii)
std::string b; std::string b;
if(a == 0) if(a == 0)
{ {
if(m_frame->bShowBase) // show base 10 if(m_DebuggerFrame->bShowBase) // show base 10
{ {
b = " adpcm adpcm_loop\n"; b = " adpcm adpcm_loop\n";
b = b + " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n"; b = b + " Nr m pos / end lpos | voll volr | isl iss | pre yn1 yn2 pre yn1 yn2 | frac ratio[hi lo]\n";
@ -173,7 +173,7 @@ std::string writeTitle(int a, bool Wii)
} }
else if(a == 1) else if(a == 1)
{ {
if(m_frame->bShowBase) // show base 10 if(m_DebuggerFrame->bShowBase) // show base 10
{ {
b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n"; b = " Nr pos / end lpos | voll volr | src form coef | 1 2 3 4 5 addr value\n";
} }
@ -184,7 +184,7 @@ std::string writeTitle(int a, bool Wii)
} }
else if(a == 2) else if(a == 2)
{ {
if(m_frame->bShowBase) // show base 10 if(m_DebuggerFrame->bShowBase) // show base 10
{ {
b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n"; b = " Nr pos / end lpos | voll volr | isl iss | e-l e-s\n";
} }
@ -195,7 +195,7 @@ std::string writeTitle(int a, bool Wii)
} }
else if(a == 3) else if(a == 3)
{ {
if(m_frame->bShowBase) // show base 10 if(m_DebuggerFrame->bShowBase) // show base 10
{ {
if(Wii) if(Wii)
b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n"; b = " Nr voll volr dl dr curv delt mixc r | v1 v2 v3 v4 v5 v6 v7 | d1 d2 d3 d4 d5 d6 d7\n";
@ -244,7 +244,7 @@ std::string writeMessage(int a, int i, bool Wii)
*/ */
if(a == 0) if(a == 0)
{ {
if(m_frame->bShowBase) // base 10 (decimal) if(m_DebuggerFrame->bShowBase) // base 10 (decimal)
{ {
if(Wii) // Wii if(Wii) // Wii
{ {
@ -280,7 +280,7 @@ std::string writeMessage(int a, int i, bool Wii)
} }
else if(a == 1) else if(a == 1)
{ {
if(m_frame->bShowBase) // base 10 (decimal) if(m_DebuggerFrame->bShowBase) // base 10 (decimal)
{ {
sprintf(buf,"%c%02i %10s/%10s %10s | %6s %6s | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x %08x", sprintf(buf,"%c%02i %10s/%10s %10s | %6s %6s | %u %u %u | %u %u %u %u %u %08x %08x %08x %08x %08x %08x",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(), 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
@ -316,7 +316,7 @@ std::string writeMessage(int a, int i, bool Wii)
} }
else if(a == 2) else if(a == 2)
{ {
if(m_frame->bShowBase) if(m_DebuggerFrame->bShowBase)
{ {
sprintf(buf,"%c%02i %10s/%10s %10s | %05i %05i | %i %i | %10s %10s", sprintf(buf,"%c%02i %10s/%10s %10s | %05i %05i | %i %i | %10s %10s",
223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(), 223, i, ThS(gsamplePos[i]).c_str(), ThS(gsampleEnd[i]).c_str(), ThS(gloopPos[i]).c_str(),
@ -342,7 +342,7 @@ std::string writeMessage(int a, int i, bool Wii)
*/ */
else if(a == 3) else if(a == 3)
{ {
if(m_frame->bShowBase) if(m_DebuggerFrame->bShowBase)
{ {
if(Wii) // Wii if(Wii) // Wii
{ {
@ -532,23 +532,23 @@ bool PrepareConditions(bool Wii, int i, ParamBlockType &PBs)
{ {
bool Conditions; bool Conditions;
if (m_frame->gOnlyLooping) // show only looping blocks if (m_DebuggerFrame->gOnlyLooping) // show only looping blocks
{ {
Conditions = PBs[i].audio_addr.looping ? true : false; Conditions = PBs[i].audio_addr.looping ? true : false;
} }
else if (m_frame->gShowAll) // show all blocks else if (m_DebuggerFrame->gShowAll) // show all blocks
{ {
Conditions = true; Conditions = true;
} }
else if (m_frame->giShowAll > -1) // show all blocks else if (m_DebuggerFrame->giShowAll > -1) // show all blocks
{ {
if (m_frame->giShowAll == 0) if (m_DebuggerFrame->giShowAll == 0)
Conditions = (i < 31); Conditions = (i < 31);
else if(m_frame->giShowAll == 1) else if(m_DebuggerFrame->giShowAll == 1)
Conditions = (i > 30 && i < 61); Conditions = (i > 30 && i < 61);
else if(m_frame->giShowAll == 2) else if(m_DebuggerFrame->giShowAll == 2)
Conditions = (i > 60 && i < 91); Conditions = (i > 60 && i < 91);
else if(m_frame->giShowAll == 3) else if(m_DebuggerFrame->giShowAll == 3)
Conditions = (i > 90 && i < 121); Conditions = (i > 90 && i < 121);
} }
else // show only the ones that have recently been running else // show only the ones that have recently been running
@ -640,7 +640,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// Control how often the screen is updated, and then update the screen // Control how often the screen is updated, and then update the screen
// -------------- // --------------
if(a == 0) count1++; // a == 0 when Logging is called before the blocks are updated if(a == 0) count1++; // a == 0 when Logging is called before the blocks are updated
if (m_frame->gUpdFreq > 0 && count1 > (200/m_frame->gUpdFreq)) if (m_DebuggerFrame->gUpdFreq > 0 && count1 > (200/m_DebuggerFrame->gUpdFreq))
{ {
// ======================================================================================= // =======================================================================================
@ -712,7 +712,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// -------------- // --------------
char buffer [1000] = ""; char buffer [1000] = "";
std::string sbuff; std::string sbuff;
sbuff = writeTitle(m_frame->gPreset, Wii); sbuff = writeTitle(m_DebuggerFrame->gPreset, Wii);
// ============== // ==============
@ -733,7 +733,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// -------------------------------------- // --------------------------------------
// Save playback history text string for the console and GUI debugger // Save playback history text string for the console and GUI debugger
// ------------------ // ------------------
if(m_frame) if(m_DebuggerFrame)
{ {
std::string guipr; // gui progress std::string guipr; // gui progress
@ -750,7 +750,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
} }
u32 run = atoi( guipr.c_str()); u32 run = atoi( guipr.c_str());
m_frame->m_GPRListView->m_CachedRegs[1][i] = run; m_DebuggerFrame->m_GPRListView->m_CachedRegs[1][i] = run;
guipr.clear(); guipr.clear();
} }
@ -771,41 +771,41 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// Hopefully this is false if we don't have a debugging window and so it doesn't cause a crash // Hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
if(m_frame) if(m_DebuggerFrame)
{ {
m_frame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[2][i] = gsamplePos[i];
m_frame->m_GPRListView->m_CachedRegs[3][i] = gsampleEnd[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[3][i] = gsampleEnd[i];
m_frame->m_GPRListView->m_CachedRegs[4][i] = gloopPos[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[4][i] = gloopPos[i];
m_frame->m_GPRListView->m_CachedRegs[5][i] = gvolume_left[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[5][i] = gvolume_left[i];
m_frame->m_GPRListView->m_CachedRegs[6][i] = gvolume_right[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[6][i] = gvolume_right[i];
m_frame->m_GPRListView->m_CachedRegs[7][i] = glooping[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[7][i] = glooping[i];
m_frame->m_GPRListView->m_CachedRegs[8][i] = gloop1[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[8][i] = gloop1[i];
m_frame->m_GPRListView->m_CachedRegs[9][i] = gloop2[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[9][i] = gloop2[i];
m_frame->m_GPRListView->m_CachedRegs[10][i] = gloop3[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[10][i] = gloop3[i];
m_frame->m_GPRListView->m_CachedRegs[11][i] = gis_stream[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[11][i] = gis_stream[i];
m_frame->m_GPRListView->m_CachedRegs[12][i] = gaudioFormat[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[12][i] = gaudioFormat[i];
m_frame->m_GPRListView->m_CachedRegs[13][i] = gsrc_type[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[13][i] = gsrc_type[i];
m_frame->m_GPRListView->m_CachedRegs[14][i] = gcoef[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[14][i] = gcoef[i];
m_frame->m_GPRListView->m_CachedRegs[15][i] = gfrac[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[15][i] = gfrac[i];
m_frame->m_GPRListView->m_CachedRegs[16][i] = gratio[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[16][i] = gratio[i];
m_frame->m_GPRListView->m_CachedRegs[17][i] = gratiohi[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[17][i] = gratiohi[i];
m_frame->m_GPRListView->m_CachedRegs[18][i] = gratiolo[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[18][i] = gratiolo[i];
m_frame->m_GPRListView->m_CachedRegs[19][i] = gupdates1[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[19][i] = gupdates1[i];
m_frame->m_GPRListView->m_CachedRegs[20][i] = gupdates2[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[20][i] = gupdates2[i];
m_frame->m_GPRListView->m_CachedRegs[21][i] = gupdates3[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[21][i] = gupdates3[i];
m_frame->m_GPRListView->m_CachedRegs[22][i] = gupdates4[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[22][i] = gupdates4[i];
m_frame->m_GPRListView->m_CachedRegs[23][i] = gupdates5[i]; m_DebuggerFrame->m_GPRListView->m_CachedRegs[23][i] = gupdates5[i];
} }
// add new line // add new line
sbuff = sbuff + writeMessage(m_frame->gPreset, i, Wii); strcpy(buffer, ""); sbuff = sbuff + writeMessage(m_DebuggerFrame->gPreset, i, Wii); strcpy(buffer, "");
sbuff = sbuff + "\n"; sbuff = sbuff + "\n";
} // end of if(Conditions) } // end of if(Conditions)
@ -818,13 +818,13 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// Write global values // Write global values
// --------------- // ---------------
int nOfBlocks; int nOfBlocks;
int span = m_frame->gLastBlock - m_addressPBs; int span = m_DebuggerFrame->gLastBlock - m_addressPBs;
if(Wii) if(Wii)
nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 256; nOfBlocks = (m_DebuggerFrame->gLastBlock-m_addressPBs) / 256;
else else
nOfBlocks = (m_frame->gLastBlock-m_addressPBs) / 192; nOfBlocks = (m_DebuggerFrame->gLastBlock-m_addressPBs) / 192;
sprintf(buffer, "\nThe parameter blocks span from %08x to %08x (%s bytes) impl. %i blocks | numberOfPBs %i | _iSize %i\n", sprintf(buffer, "\nThe parameter blocks span from %08x to %08x (%s bytes) impl. %i blocks | numberOfPBs %i | _iSize %i\n",
m_addressPBs, m_frame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize); m_addressPBs, m_DebuggerFrame->gLastBlock, ThS(span).c_str(), nOfBlocks, numberOfPBs, _iSize);
sbuff = sbuff + buffer; strcpy(buffer, ""); sbuff = sbuff + buffer; strcpy(buffer, "");
// =============== // ===============
@ -834,7 +834,7 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// --------------- // ---------------
sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n", sprintf(buffer, "\nSettings: SSBM fix %i | SSBM rem1 %i | SSBM rem2 %i\nSequenced %i | Volume %i | Reset %i | Only looping %i | Save file %i\n",
gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced, gSSBM, gSSBMremedy1, gSSBMremedy2, gSequenced,
gVolume, gReset, m_frame->gOnlyLooping, m_frame->gSaveFile); gVolume, gReset, m_DebuggerFrame->gOnlyLooping, m_DebuggerFrame->gSaveFile);
sbuff = sbuff + buffer; strcpy(buffer, ""); sbuff = sbuff + buffer; strcpy(buffer, "");
// =============== // ===============
@ -895,9 +895,9 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// New values are written so update - DISABLED - It flickered a lot, even worse than a // New values are written so update - DISABLED - It flickered a lot, even worse than a
// console window. So for now only the console windows is updated. // console window. So for now only the console windows is updated.
/* /*
if(m_frame) if(m_DebuggerFrame)
{ {
m_frame->NotifyUpdate(); m_DebuggerFrame->NotifyUpdate();
} }
*/ */
@ -914,7 +914,7 @@ void CUCode_AX::Logging(short* _pBuffer, int _iSize, int a, bool Wii)
{ {
/* Doing all this may have a noticable CPU effect, so we can disable it completely /* Doing all this may have a noticable CPU effect, so we can disable it completely
this way. But remember that "Save to file" will not write anything then either. */ this way. But remember that "Save to file" will not write anything then either. */
if (m_frame->gUpdFreq > 0) if (m_DebuggerFrame->gUpdFreq > 0)
{ {
int version; // AX version int version; // AX version
int numberOfPBs; int numberOfPBs;

View file

@ -46,14 +46,14 @@
// Declarations and definitions // Declarations and definitions
// ------------- // -------------
extern std::vector<std::string> sMailLog, sMailTime; extern std::vector<std::string> sMailLog, sMailTime;
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
/////////////////////////////// ///////////////////////////////
// ======================================================================================= // =======================================================================================
// Update mail window // Update mail window
// -------------- // --------------
void CDebugger::DoUpdateMail() void DSPDebuggerHLE::DoUpdateMail()
{ {
//Console::Print("i %i %i\n", sFullMail.size(), sMailLog.size()); //Console::Print("i %i %i\n", sFullMail.size(), sMailLog.size());
@ -68,17 +68,17 @@ void CDebugger::DoUpdateMail()
} }
void CDebugger::UpdateMail(wxNotebookEvent& event) void DSPDebuggerHLE::UpdateMail(wxNotebookEvent& event)
{ {
DoUpdateMail(); DoUpdateMail();
/* This may be called before m_frame is fully created through the /* This may be called before m_DebuggerFrame is fully created through the
EVT_NOTEBOOK_PAGE_CHANGED, in that case it will crash because this EVT_NOTEBOOK_PAGE_CHANGED, in that case it will crash because this
is accessing members of it */ is accessing members of it */
if(StoreMails && m_frame) ReadDir(); if(StoreMails && m_DebuggerFrame) ReadDir();
} }
// Change mail from radio button change // Change mail from radio button change
void CDebugger::ChangeMail(wxCommandEvent& event) void DSPDebuggerHLE::ChangeMail(wxCommandEvent& event)
{ {
//Console::Print("abc"); //Console::Print("abc");
DoUpdateMail(); DoUpdateMail();
@ -91,7 +91,7 @@ void CDebugger::ChangeMail(wxCommandEvent& event)
// ======================================================================================= // =======================================================================================
// Read out mails from dir // Read out mails from dir
// -------------- // --------------
void CDebugger::ReadDir() void DSPDebuggerHLE::ReadDir()
{ {
CFileSearch::XStringVector Directories; CFileSearch::XStringVector Directories;
//Directories.push_back("Logs/Mail"); //Directories.push_back("Logs/Mail");
@ -157,7 +157,7 @@ void CDebugger::ReadDir()
// ======================================================================================= // =======================================================================================
// Check for duplicates and count files from all_all_files // Check for duplicates and count files from all_all_files
// -------------- // --------------
bool CDebugger::NoDuplicate(std::string FileName) bool DSPDebuggerHLE::NoDuplicate(std::string FileName)
{ {
for (u32 i = 0; i < all_files.size(); i++) for (u32 i = 0; i < all_files.size(); i++)
{ {
@ -168,7 +168,7 @@ bool CDebugger::NoDuplicate(std::string FileName)
} }
// Count the number of files for each game // Count the number of files for each game
u32 CDebugger::CountFiles(std::string FileName) u32 DSPDebuggerHLE::CountFiles(std::string FileName)
{ {
int match = 0; int match = 0;
@ -187,7 +187,7 @@ u32 CDebugger::CountFiles(std::string FileName)
// ======================================================================================= // =======================================================================================
// Read file from harddrive // Read file from harddrive
// -------------- // --------------
std::string CDebugger::Readfile_(std::string FileName) std::string DSPDebuggerHLE::Readfile_(std::string FileName)
{ {
char c; // declare a char variable char c; // declare a char variable
FILE *file; // declare a FILE pointer FILE *file; // declare a FILE pointer
@ -220,7 +220,7 @@ std::string CDebugger::Readfile_(std::string FileName)
} }
// Read file // Read file
void CDebugger::Readfile(std::string FileName, bool GC) void DSPDebuggerHLE::Readfile(std::string FileName, bool GC)
{ {
u32 n = CountFiles(FileName); // count how many mails we have u32 n = CountFiles(FileName); // count how many mails we have
u32 curr_n = 0; u32 curr_n = 0;
@ -264,7 +264,7 @@ void CDebugger::Readfile(std::string FileName, bool GC)
// ======================================================================================= // =======================================================================================
// Read the file to the text window // Read the file to the text window
// --------------- // ---------------
void CDebugger::OnGameChange(wxCommandEvent& event) void DSPDebuggerHLE::OnGameChange(wxCommandEvent& event)
{ {
if(event.GetId() == 2006) if(event.GetId() == 2006)
{ {
@ -286,7 +286,7 @@ void CDebugger::OnGameChange(wxCommandEvent& event)
} }
// Settings // Settings
void CDebugger::MailSettings(wxCommandEvent& event) void DSPDebuggerHLE::MailSettings(wxCommandEvent& event)
{ {
//for (int i = 0; i < all_all_files.size(); ++i) //for (int i = 0; i < all_all_files.size(); ++i)
//Console::Print("s: %s \n", all_all_files.at(i).c_str()); //Console::Print("s: %s \n", all_all_files.at(i).c_str());

View file

@ -20,7 +20,7 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h" #include "../Debugger/Debugger.h"
//#include "../Logging/File.h" // For PrintFile() //#include "../Logging/File.h" // For PrintFile()
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
#endif #endif
#include <sstream> #include <sstream>
#include "../Config.h" #include "../Config.h"
@ -98,7 +98,7 @@ void CUCode_AX::SaveLog_(bool Wii, const char* _fmt, va_list ap)
vsprintf(Msg, _fmt, ap); vsprintf(Msg, _fmt, ap);
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_frame->ScanMails) if(m_DebuggerFrame->ScanMails)
{ {
if(strcmp(Msg, "Begin") == 0) if(strcmp(Msg, "Begin") == 0)
@ -128,12 +128,12 @@ if(m_frame->ScanMails)
sMailLog.push_back(TmpMailLog); sMailLog.push_back(TmpMailLog);
// Save file to disc // Save file to disc
if(m_frame->StoreMails) if(m_DebuggerFrame->StoreMails)
{ {
SaveLogFile(TmpMailLog, saveNext, 1, Wii); SaveLogFile(TmpMailLog, saveNext, 1, Wii);
} }
m_frame->DoUpdateMail(); // update the view m_DebuggerFrame->DoUpdateMail(); // update the view
saveNext = 0; saveNext = 0;
} }
} }
@ -157,7 +157,7 @@ if(m_frame->ScanMails)
void CUCode_AX::SaveMail(bool Wii, u32 _uMail) void CUCode_AX::SaveMail(bool Wii, u32 _uMail)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_frame->ScanMails) if(m_DebuggerFrame->ScanMails)
{ {
int i = 0; int i = 0;
std::string sTemp; std::string sTemp;
@ -192,11 +192,11 @@ if(m_frame->ScanMails)
// Compare this mail to old mails // Compare this mail to old mails
u32 addnew = 0; u32 addnew = 0;
for (u32 j = 0; j < m_frame->sMail.size(); j++) for (u32 j = 0; j < m_DebuggerFrame->sMail.size(); j++)
{ {
if(m_frame->sMail.at(j).length() != sTemp.length()) if(m_DebuggerFrame->sMail.at(j).length() != sTemp.length())
{ {
//wxMessageBox( wxString::Format("%s \n\n%s", m_frame->sMail.at(i).c_str(), //wxMessageBox( wxString::Format("%s \n\n%s", m_DebuggerFrame->sMail.at(i).c_str(),
// sTemp.c_str()) ); // sTemp.c_str()) );
addnew++; addnew++;
} }
@ -204,10 +204,10 @@ if(m_frame->ScanMails)
// In case the mail didn't match any saved mail, save it // In case the mail didn't match any saved mail, save it
if(addnew == m_frame->sMail.size()) if(addnew == m_DebuggerFrame->sMail.size())
{ {
//Console::Print("%i | %i\n", addnew, m_frame->sMail.size()); //Console::Print("%i | %i\n", addnew, m_DebuggerFrame->sMail.size());
u32 resizeTo = (u32)(m_frame->sMail.size() + 1); u32 resizeTo = (u32)(m_DebuggerFrame->sMail.size() + 1);
// ------------------------------------ // ------------------------------------
// get timestamp // get timestamp
@ -219,15 +219,15 @@ if(m_frame->ScanMails)
sMailTime.push_back(Msg); sMailTime.push_back(Msg);
// ------------------------------------ // ------------------------------------
m_frame->sMail.push_back(sTemp); // save the main comparison mail m_DebuggerFrame->sMail.push_back(sTemp); // save the main comparison mail
std::string lMail = sTemp + "------------------\n" + sTempEnd; std::string lMail = sTemp + "------------------\n" + sTempEnd;
m_frame->sFullMail.push_back(lMail); m_DebuggerFrame->sFullMail.push_back(lMail);
// enable the radio button and update view // enable the radio button and update view
if(resizeTo <= m_frame->m_RadioBox[3]->GetCount()) if(resizeTo <= m_DebuggerFrame->m_RadioBox[3]->GetCount())
{ {
m_frame->m_RadioBox[3]->Enable(resizeTo - 1, true); m_DebuggerFrame->m_RadioBox[3]->Enable(resizeTo - 1, true);
m_frame->m_RadioBox[3]->Select(resizeTo - 1); m_DebuggerFrame->m_RadioBox[3]->Select(resizeTo - 1);
} }
addnew = 0; addnew = 0;
@ -235,9 +235,9 @@ if(m_frame->ScanMails)
// ------------------------------------ // ------------------------------------
// Save as file // Save as file
if(m_frame->StoreMails) if(m_DebuggerFrame->StoreMails)
{ {
//Console::Print("m_frame->sMail.size(): %i | resizeTo:%i\n", m_frame->sMail.size(), resizeTo); //Console::Print("m_DebuggerFrame->sMail.size(): %i | resizeTo:%i\n", m_DebuggerFrame->sMail.size(), resizeTo);
SaveLogFile(lMail, resizeTo, 0, Wii); SaveLogFile(lMail, resizeTo, 0, Wii);
} }
@ -268,7 +268,7 @@ int ReadOutPBs(u32 pbs_address, AXParamBlock* _pPBs, int _num)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location if(m_DebuggerFrame) m_DebuggerFrame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif #endif
#endif #endif
} }
@ -321,7 +321,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger // write logging data to debugger
if (m_frame && _pBuffer) if (m_DebuggerFrame && _pBuffer)
{ {
CUCode_AX::Logging(_pBuffer, _iSize, 0, false); CUCode_AX::Logging(_pBuffer, _iSize, 0, false);
} }
@ -408,7 +408,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
} }
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger again after the update // write logging data to debugger again after the update
if (m_frame && _pBuffer) if (m_DebuggerFrame && _pBuffer)
{ {
CUCode_AX::Logging(_pBuffer, _iSize, 1, false); CUCode_AX::Logging(_pBuffer, _iSize, 1, false);
} }
@ -453,7 +453,7 @@ void CUCode_AX::SaveLog(const char* _fmt, ...)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
va_list ap; va_start(ap, _fmt); va_list ap; va_start(ap, _fmt);
if(m_frame) SaveLog_(false, _fmt, ap); if(m_DebuggerFrame) SaveLog_(false, _fmt, ap);
va_end(ap); va_end(ap);
#endif #endif
} }
@ -488,7 +488,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
bool bExecuteList = true; bool bExecuteList = true;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_frame) SaveMail(false, _uMail); // Save mail for debugging if(m_DebuggerFrame) SaveMail(false, _uMail); // Save mail for debugging
#endif #endif
while (bExecuteList) while (bExecuteList)
{ {

View file

@ -20,7 +20,7 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "../Debugger/Debugger.h" #include "../Debugger/Debugger.h"
//#include "../Logging/File.h" // For PrintFile //#include "../Logging/File.h" // For PrintFile
extern CDebugger * m_frame; extern DSPDebuggerHLE * m_DebuggerFrame;
#endif #endif
#include "../MailHandler.h" #include "../MailHandler.h"
@ -110,7 +110,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
// ------------------------------------------- // -------------------------------------------
// write logging data to debugger // write logging data to debugger
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (m_frame && _pBuffer) if (m_DebuggerFrame && _pBuffer)
{ {
lCUCode_AX->Logging(_pBuffer, _iSize, 0, true); lCUCode_AX->Logging(_pBuffer, _iSize, 0, true);
@ -119,7 +119,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
int p = numberOfPBs - 1; int p = numberOfPBs - 1;
if(numberOfPBs > p) if(numberOfPBs > p)
{ {
if(PBs[p].running && !m_frame->upd95) if(PBs[p].running && !m_DebuggerFrame->upd95)
{ {
const u32 blockAddr = (u32)(PBs[p].this_pb_hi<< 16) | PBs[p].this_pb_lo; const u32 blockAddr = (u32)(PBs[p].this_pb_hi<< 16) | PBs[p].this_pb_lo;
const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr); const short *pSrc = (const short *)g_dspInitialize.pGetMemoryPointer(blockAddr);
@ -127,24 +127,24 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
{ {
if(i == 10 || i == 34 || i == 41 || i == 46 || i == 46 || i == 58 || i == 60 if(i == 10 || i == 34 || i == 41 || i == 46 || i == 46 || i == 58 || i == 60
|| i == 68 || i == 88 || i == 95) || i == 68 || i == 88 || i == 95)
{m_frame->str0 += "\n"; m_frame->str95 += "\n";} {m_DebuggerFrame->str0 += "\n"; m_DebuggerFrame->str95 += "\n";}
std::string line = StringFromFormat("%02i|%02i : %s : %s", std::string line = StringFromFormat("%02i|%02i : %s : %s",
i/2, i, i/2, i,
m_frame->PBn[i].c_str(), m_frame->PBp[i].c_str() m_DebuggerFrame->PBn[i].c_str(), m_DebuggerFrame->PBp[i].c_str()
); );
for (u32 j = 0; j < 50 - line.length(); ++j) for (u32 j = 0; j < 50 - line.length(); ++j)
line += " "; line += " ";
m_frame->str0 += line; m_DebuggerFrame->str0 += line;
m_frame->str0 += "\n"; m_DebuggerFrame->str0 += "\n";
m_frame->str95 += StringFromFormat(" : %02i|%02i : %04x%04x\n", m_DebuggerFrame->str95 += StringFromFormat(" : %02i|%02i : %04x%04x\n",
i/2, i, i/2, i,
Common::swap16(pSrc[i]), Common::swap16(pSrc[i+1])); Common::swap16(pSrc[i]), Common::swap16(pSrc[i+1]));
} }
m_frame->m_bl95->AppendText(wxString::FromAscii(m_frame->str95.c_str())); m_DebuggerFrame->m_bl95->AppendText(wxString::FromAscii(m_DebuggerFrame->str95.c_str()));
m_frame->m_bl0->AppendText(wxString::FromAscii(m_frame->str0.c_str())); m_DebuggerFrame->m_bl0->AppendText(wxString::FromAscii(m_DebuggerFrame->str0.c_str()));
m_frame->upd95 = true; m_DebuggerFrame->upd95 = true;
} }
} }
} }
@ -217,7 +217,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// write logging data to debugger again after the update // write logging data to debugger again after the update
if (m_frame && _pBuffer) if (m_DebuggerFrame && _pBuffer)
{ {
lCUCode_AX->Logging(_pBuffer, _iSize, 1, true); lCUCode_AX->Logging(_pBuffer, _iSize, 1, true);
} }
@ -241,7 +241,7 @@ void CUCode_AXWii::SaveLog(const char* _fmt, ...)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
va_list ap; va_list ap;
va_start(ap, _fmt); va_start(ap, _fmt);
if(m_frame) if(m_DebuggerFrame)
lCUCode_AX->SaveLog_(true, _fmt, ap); lCUCode_AX->SaveLog_(true, _fmt, ap);
va_end(ap); va_end(ap);
#endif #endif
@ -271,7 +271,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
bool bExecuteList = true; bool bExecuteList = true;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(m_frame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging if(m_DebuggerFrame) lCUCode_AX->SaveMail(true, uAddress); // Save mail for debugging
#endif #endif
if (false) if (false)
{ {

View file

@ -60,7 +60,7 @@ inline int ReadOutPBsWii(u32 pbs_address, ParamBlockType& _pPBs, int _num)
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
if(m_frame) m_frame->gLastBlock = blockAddr + p*2 + 2; // save last block location if(m_DebuggerFrame) m_DebuggerFrame->gLastBlock = blockAddr + p*2 + 2; // save last block location
#endif #endif
#endif #endif
} }

View file

@ -21,9 +21,10 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "ConfigDlg.h" #include "ConfigDlg.h"
DSPConfigDialogHLE* m_ConfigFrame = NULL;
#include "Debugger/File.h" // For file logging #include "Debugger/File.h" // For file logging
#include "Debugger/Debugger.h" // For the CDebugger class #include "Debugger/Debugger.h"
CDebugger* m_frame = NULL; DSPDebuggerHLE* m_DebuggerFrame = NULL;
#endif #endif
#include "ChunkFile.h" #include "ChunkFile.h"
@ -65,7 +66,10 @@ struct DSPState
}; };
DSPState g_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 #if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp class wxDLLApp : public wxApp
{ {
@ -74,72 +78,69 @@ class wxDLLApp : public wxApp
return true; return true;
} }
}; };
IMPLEMENT_APP_NO_MAIN(wxDLLApp) IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif #endif
// DllMain BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
#ifdef _WIN32 DWORD dwReason, // reason called
HINSTANCE g_hInstance = NULL; LPVOID lpvReserved) // reserved
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{ {
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
{ {
#if defined(HAVE_WX) && HAVE_WX
// more stuff wx needs
wxSetInstance((HINSTANCE)hinstDLL); wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0; int argc = 0;
char **argv = NULL; char **argv = NULL;
wxEntryStart(argc, argv); wxEntryStart(argc, argv);
if (!wxTheApp || !wxTheApp->CallOnInit())
// This is for ?
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
#endif
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); // use this or get a crash #if defined(HAVE_WX) && HAVE_WX
wxEntryCleanup();
#endif
break; break;
default: default:
break; break;
} }
g_hInstance = hinstDLL; 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 #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) void DllDebugger(HWND _hParent, bool Show)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (m_frame && Show) // if we have created it, let us show it again if (!m_DebuggerFrame)
{ m_DebuggerFrame = new DSPDebuggerHLE(GetParentedWxWindow(_hParent));
m_frame->DoShow();
} if (Show)
else if (!m_frame && Show) m_DebuggerFrame->Show();
{ else
m_frame = new CDebugger(NULL); m_DebuggerFrame->Hide();
m_frame->Show();
}
else if (m_frame && !Show)
{
m_frame->DoHide();
}
#endif #endif
} }
@ -169,18 +170,23 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// (shuffle2) TODO: reparent dlg with DolphinApp if (!m_ConfigFrame)
ConfigDialog dlg(NULL); m_ConfigFrame = new DSPConfigDialogHLE(GetParentedWxWindow(_hParent));
// add backends // add backends
std::vector<std::string> backends = AudioCommon::GetSoundBackends(); std::vector<std::string> backends = AudioCommon::GetSoundBackends();
for (std::vector<std::string>::const_iterator iter = backends.begin(); for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter) { iter != backends.end(); ++iter)
dlg.AddBackend((*iter).c_str()); {
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 #endif
} }
@ -211,12 +217,12 @@ void Shutdown()
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
// Reset mails // Reset mails
if (m_frame) if (m_DebuggerFrame)
{ {
sMailLog.clear(); sMailLog.clear();
sMailTime.clear(); sMailTime.clear();
m_frame->sMail.clear(); m_DebuggerFrame->sMail.clear();
m_frame->sMailEnd.clear(); m_DebuggerFrame->sMailEnd.clear();
} }
#endif #endif

View file

@ -23,7 +23,7 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h" #include "Debugger/Debugger.h"
extern CDebugger* m_frame; extern DSPDebuggerHLE* m_DebuggerFrame;
#endif #endif
extern SoundStream *soundStream; extern SoundStream *soundStream;

View file

@ -50,6 +50,7 @@ SoundStream *soundStream = NULL;
bool bIsRunning = false; bool bIsRunning = false;
// Standard crap to make wxWidgets happy
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE g_hInstance; HINSTANCE g_hInstance;

View file

@ -26,48 +26,48 @@
DInput m_dinput; DInput m_dinput;
#endif #endif
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) BEGIN_EVENT_TABLE(PADConfigDialogSimple,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose) EVT_CLOSE(PADConfigDialogSimple::OnClose)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick) EVT_BUTTON(ID_CLOSE,PADConfigDialogSimple::OnCloseClick)
EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout) EVT_BUTTON(ID_PAD_ABOUT,PADConfigDialogSimple::DllAbout)
EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_ATTACHED,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_X360PAD,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged) EVT_CHOICE(ID_X360PAD_CHOICE,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_RUMBLE,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_DISABLE,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_DISABLE,PADConfigDialogSimple::ControllerSettingsChanged)
// Input recording // Input recording
#ifdef RERECORDING #ifdef RERECORDING
EVT_CHECKBOX(ID_RECORDING,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_RECORDING,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_CHECKBOX(ID_PLAYBACK,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_PLAYBACK,PADConfigDialogSimple::ControllerSettingsChanged)
EVT_BUTTON(ID_SAVE_RECORDING,ConfigDialog::ControllerSettingsChanged) EVT_BUTTON(ID_SAVE_RECORDING,PADConfigDialogSimple::ControllerSettingsChanged)
#endif #endif
EVT_BUTTON(CTL_A,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_A,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_B,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_B,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_X,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_X,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_Y,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_Y,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_Z,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_Z,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_START,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_START,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_L,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_L,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_R,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_R,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_MAINUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINUP,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_MAINDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINDOWN,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_MAINLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINLEFT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_MAINRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_MAINRIGHT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_SUBUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBUP,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_SUBDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBDOWN,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_SUBLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBLEFT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_SUBRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_SUBRIGHT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_DPADUP,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADUP,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_DPADDOWN,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADDOWN,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_DPADLEFT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADLEFT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_DPADRIGHT,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_DPADRIGHT,PADConfigDialogSimple::OnButtonClick)
EVT_BUTTON(CTL_HALFPRESS,ConfigDialog::OnButtonClick) EVT_BUTTON(CTL_HALFPRESS,PADConfigDialogSimple::OnButtonClick)
END_EVENT_TABLE() END_EVENT_TABLE()
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style) PADConfigDialogSimple::PADConfigDialogSimple(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -79,11 +79,11 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
// Connect keydown to the window // Connect keydown to the window
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
wxKeyEventHandler(ConfigDialog::OnKeyDown), wxKeyEventHandler(PADConfigDialogSimple::OnKeyDown),
(wxObject*)NULL, this); (wxObject*)NULL, this);
} }
ConfigDialog::~ConfigDialog() PADConfigDialogSimple::~PADConfigDialogSimple()
{ {
} }
@ -118,7 +118,7 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
//////////////////////////////////// ////////////////////////////////////
void ConfigDialog::CreateGUIControls() void PADConfigDialogSimple::CreateGUIControls()
{ {
// Notebook // Notebook
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
@ -324,7 +324,7 @@ void ConfigDialog::CreateGUIControls()
} }
} }
void ConfigDialog::OnClose(wxCloseEvent& event) void PADConfigDialogSimple::OnClose(wxCloseEvent& event)
{ {
#ifdef _WIN32 #ifdef _WIN32
m_dinput.Free(); m_dinput.Free();
@ -332,7 +332,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event)
EndModal(0); EndModal(0);
} }
void ConfigDialog::OnKeyDown(wxKeyEvent& event) void PADConfigDialogSimple::OnKeyDown(wxKeyEvent& event)
{ {
char keyStr[10] = {0}; char keyStr[10] = {0};
if(ClickedButton != NULL) if(ClickedButton != NULL)
@ -368,7 +368,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
} }
// We have clicked a button // We have clicked a button
void ConfigDialog::OnButtonClick(wxCommandEvent& event) void PADConfigDialogSimple::OnButtonClick(wxCommandEvent& event)
{ {
// Check if the Space key was set, to solve the problem that the Space key calls this function // Check if the Space key was set, to solve the problem that the Space key calls this function
#ifdef _WIN32 #ifdef _WIN32
@ -386,12 +386,12 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event)
ClickedButton->SetWindowStyle(wxWANTS_CHARS); ClickedButton->SetWindowStyle(wxWANTS_CHARS);
} }
void ConfigDialog::OnCloseClick(wxCommandEvent& event) void PADConfigDialogSimple::OnCloseClick(wxCommandEvent& event)
{ {
Close(); Close();
} }
void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event) void PADConfigDialogSimple::ControllerSettingsChanged(wxCommandEvent& event)
{ {
int page = m_Notebook->GetSelection(); int page = m_Notebook->GetSelection();
@ -438,7 +438,7 @@ void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
} }
} }
void ConfigDialog::DllAbout(wxCommandEvent& event) void PADConfigDialogSimple::DllAbout(wxCommandEvent& event)
{ {
wxString message; wxString message;
#ifdef _WIN32 #ifdef _WIN32

View file

@ -33,15 +33,15 @@
#include "../XInputBase.h" #include "../XInputBase.h"
#endif #endif
class ConfigDialog : public wxDialog class PADConfigDialogSimple : public wxDialog
{ {
public: public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"), PADConfigDialogSimple(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Pad Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE); const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
virtual ~ConfigDialog(); virtual ~PADConfigDialogSimple();
private: private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();

View file

@ -16,9 +16,8 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Include // Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
@ -32,6 +31,7 @@
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "GUI/ConfigDlg.h" #include "GUI/ConfigDlg.h"
PADConfigDialogSimple* m_ConfigFrame = NULL;
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@ -55,23 +55,81 @@
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
bool KeyStatus[NUMCONTROLS]; bool KeyStatus[NUMCONTROLS];
#endif #endif
////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Declarations // Declarations
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
SPads pad[4]; SPads pad[4];
HINSTANCE g_hInstance;
SPADInitialize g_PADInitialize; SPADInitialize g_PADInitialize;
////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Standard crap to make wxWidgets happy
#ifdef _WIN32
HINSTANCE g_hInstance;
#if defined(HAVE_WX) && HAVE_WX
class wxDLLApp : public wxApp
{
bool OnInit()
{
return true;
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
#if defined(HAVE_WX) && HAVE_WX
wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0;
char **argv = NULL;
wxEntryStart(argc, argv);
if (!wxTheApp || !wxTheApp->CallOnInit())
return FALSE;
#endif
}
break;
case DLL_PROCESS_DETACH:
#if defined(HAVE_WX) && HAVE_WX
wxEntryCleanup();
#endif
break;
default:
break;
}
g_hInstance = hinstDLL;
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
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Input Recording // Input Recording
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// Enable these to record or play back // Enable these to record or play back
//#define RECORD_REPLAY //#define RECORD_REPLAY
@ -83,7 +141,6 @@ PLUGIN_GLOBALS* globals = NULL;
SPADStatus recordBuffer[RECORD_SIZE]; SPADStatus recordBuffer[RECORD_SIZE];
int count = 0; int count = 0;
bool g_EmulatorRunning = false; bool g_EmulatorRunning = false;
////////////////////////////////
//****************************************************************************** //******************************************************************************
// Supporting functions // Supporting functions
@ -169,57 +226,11 @@ bool IsFocus()
#endif #endif
} }
#ifdef _WIN32
class wxDLLApp : public wxApp
{
bool OnInit()
{
return true;
}
};
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines
wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0;
char **argv = NULL;
wxEntryStart(argc, argv);
if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break;
default:
break;
}
g_hInstance = hinstDLL;
return(TRUE);
}
#endif
const float kDeadZone = 0.1f;
// Implement circular deadzone // Implement circular deadzone
const float kDeadZone = 0.1f;
void ScaleStickValues(unsigned char* outx, void ScaleStickValues(unsigned char* outx,
unsigned char* outy, unsigned char* outy,
short inx, short iny) short inx, short iny)
{ {
float x = ((float)inx + 0.5f) / 32767.5f; float x = ((float)inx + 0.5f) / 32767.5f;
float y = ((float)iny + 0.5f) / 32767.5f; float y = ((float)iny + 0.5f) / 32767.5f;
@ -616,21 +627,19 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
//Console::Open(70, 5000);
// Load configuration // Load configuration
LoadConfig(); LoadConfig();
// Show wxDialog // Show wxDialog
#ifdef _WIN32 #if defined(HAVE_WX) && HAVE_WX
wxWindow win; if (!m_ConfigFrame)
win.SetHWND(_hParent); m_ConfigFrame = new PADConfigDialogSimple(GetParentedWxWindow(_hParent));
ConfigDialog frame(&win);
frame.ShowModal(); // Only allow one open at a time
win.SetHWND(0); if (!m_ConfigFrame->IsShown())
#elif defined(HAVE_WX) && HAVE_WX m_ConfigFrame->ShowModal();
ConfigDialog frame(NULL); else
frame.ShowModal(); m_ConfigFrame->Hide();
#endif #endif
// Save configuration // Save configuration
@ -641,18 +650,13 @@ void DllDebugger(HWND _hParent, bool Show) {}
void Initialize(void *init) void Initialize(void *init)
{ {
//Console::Open(70, 5000);
// We are now running a game // We are now running a game
g_EmulatorRunning = true; g_EmulatorRunning = true;
// Load configuration // Load configuration
LoadConfig(); LoadConfig();
// ------------------------------------------- #ifdef RERECORDING
// Rerecording
// ----------------------
#ifdef RERECORDING
/* Check if we are starting the pad to record the input, and an old file exists. In that case ask /* Check if we are starting the pad to record the input, and an old file exists. In that case ask
if we really want to start the recording and eventually overwrite the file */ if we really want to start the recording and eventually overwrite the file */
if (pad[0].bRecording && File::Exists("pad-record.bin")) if (pad[0].bRecording && File::Exists("pad-record.bin"))
@ -670,8 +674,7 @@ void Initialize(void *init)
// Load recorded input if we are to play it back, otherwise begin with a blank recording // Load recorded input if we are to play it back, otherwise begin with a blank recording
if (pad[0].bPlayback) LoadRecord(); if (pad[0].bPlayback) LoadRecord();
#endif #endif
// ----------------------
g_PADInitialize = *(SPADInitialize*)init; g_PADInitialize = *(SPADInitialize*)init;
@ -706,18 +709,13 @@ void DoState(unsigned char **ptr, int mode)
void Shutdown() void Shutdown()
{ {
//Console::Print("ShutDown()\n");
// -------------------------------------------
// Save the recording and reset the counter // Save the recording and reset the counter
// ---------------------- #ifdef RERECORDING
#ifdef RERECORDING
// Save recording // Save recording
if (pad[0].bRecording) SaveRecord(); if (pad[0].bRecording) SaveRecord();
// Reset the counter // Reset the counter
count = 0; count = 0;
#endif #endif
// ----------------------
// We have stopped the game // We have stopped the game
g_EmulatorRunning = false; g_EmulatorRunning = false;
@ -737,7 +735,6 @@ void Shutdown()
// Set buttons status from wxWidgets in the main application // Set buttons status from wxWidgets in the main application
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Input(u16 _Key, u8 _UpDown) {} void PAD_Input(u16 _Key, u8 _UpDown) {}
@ -746,17 +743,14 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// Check if all is okay // Check if all is okay
if (_pPADStatus == NULL) return; if (_pPADStatus == NULL) return;
// -------------------------------------------
// Play back input instead of accepting any user input // Play back input instead of accepting any user input
// ---------------------- #ifdef RERECORDING
#ifdef RERECORDING
if (pad[0].bPlayback) if (pad[0].bPlayback)
{ {
*_pPADStatus = PlayRecord(); *_pPADStatus = PlayRecord();
return; return;
} }
#endif #endif
// ----------------------
const int base = 0x80; const int base = 0x80;
// Clear pad // Clear pad
@ -788,14 +782,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
cocoa_Read(_numPAD, _pPADStatus); cocoa_Read(_numPAD, _pPADStatus);
#endif #endif
// ------------------------------------------- #ifdef RERECORDING
// Rerecording
// ----------------------
#ifdef RERECORDING
// Record input // Record input
if (pad[0].bRecording) RecordInput(*_pPADStatus); if (pad[0].bRecording) RecordInput(*_pPADStatus);
#endif #endif
// ----------------------
} }
@ -950,7 +940,6 @@ void LoadConfig()
file.Get(SectionName, "RumbleStrength", &pad[i].RumbleStrength, 8000); file.Get(SectionName, "RumbleStrength", &pad[i].RumbleStrength, 8000);
file.Get(SectionName, "XPad#", &pad[i].XPadPlayer); file.Get(SectionName, "XPad#", &pad[i].XPadPlayer);
// Recording
#ifdef RERECORDING #ifdef RERECORDING
file.Get(SectionName, "Recording", &pad[0].bRecording, false); file.Get(SectionName, "Recording", &pad[0].bRecording, false);
file.Get(SectionName, "Playback", &pad[0].bPlayback, false); file.Get(SectionName, "Playback", &pad[0].bPlayback, false);
@ -986,7 +975,7 @@ void SaveConfig()
file.Set(SectionName, "Rumble", pad[i].bRumble); file.Set(SectionName, "Rumble", pad[i].bRumble);
file.Set(SectionName, "RumbleStrength", pad[i].RumbleStrength); file.Set(SectionName, "RumbleStrength", pad[i].RumbleStrength);
file.Set(SectionName, "XPad#", pad[i].XPadPlayer); file.Set(SectionName, "XPad#", pad[i].XPadPlayer);
// Recording
#ifdef RERECORDING #ifdef RERECORDING
file.Set(SectionName, "Recording", pad[0].bRecording); file.Set(SectionName, "Recording", pad[0].bRecording);
file.Set(SectionName, "Playback", pad[0].bPlayback); file.Set(SectionName, "Playback", pad[0].bPlayback);
@ -999,5 +988,3 @@ void SaveConfig()
} }
file.Save(FULL_CONFIG_DIR "pad.ini"); file.Save(FULL_CONFIG_DIR "pad.ini");
} }

View file

@ -51,111 +51,111 @@ enum
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Event table // Event table
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
BEGIN_EVENT_TABLE(ConfigDialog,wxDialog) BEGIN_EVENT_TABLE(WiimoteConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose) EVT_CLOSE(WiimoteConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE, ConfigDialog::CloseClick) EVT_BUTTON(ID_CLOSE, WiimoteConfigDialog::CloseClick)
EVT_BUTTON(ID_APPLY, ConfigDialog::CloseClick) EVT_BUTTON(ID_APPLY, WiimoteConfigDialog::CloseClick)
EVT_BUTTON(ID_ABOUTOGL, ConfigDialog::AboutClick) EVT_BUTTON(ID_ABOUTOGL, WiimoteConfigDialog::AboutClick)
EVT_CHECKBOX(ID_SIDEWAYSDPAD, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_NUNCHUCKCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_CLASSICCONTROLLERCONNECTED, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_CONNECT_REAL, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_USE_REAL, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_USE_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_UPDATE_REAL, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_UPDATE_REAL, WiimoteConfigDialog::GeneralSettingsChanged)
// Recording // Recording
EVT_CHOICE(IDC_RECORD + 1, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 1, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 2, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 2, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 3, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 3, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 4, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 4, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 5, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 5, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 6, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 6, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 7, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 7, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 8, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 8, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 9, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 9, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 10, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 10, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 11, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 11, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 12, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 12, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 13, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 13, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 14, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 14, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHOICE(IDC_RECORD + 15, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_RECORD + 15, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_BUTTON(IDB_RECORD + 1, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 1, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 2, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 2, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 3, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 3, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 4, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 4, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 5, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 5, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 6, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 6, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 7, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 7, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 8, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 8, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 9, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 9, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 10, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 10, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 11, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 11, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 12, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 12, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 13, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 13, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 14, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 14, WiimoteConfigDialog::RecordMovement)
EVT_BUTTON(IDB_RECORD + 15, ConfigDialog::RecordMovement) EVT_BUTTON(IDB_RECORD + 15, WiimoteConfigDialog::RecordMovement)
// Gamepad // Gamepad
EVT_COMBOBOX(IDC_JOYNAME, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDC_JOYNAME, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(ID_TRIGGER_TYPE, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TRIGGER_TYPE, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(ID_TILT_INPUT, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TILT_INPUT, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(ID_TILT_RANGE_ROLL, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TILT_RANGE_ROLL, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(ID_TILT_RANGE_PITCH, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TILT_RANGE_PITCH, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_LEFT_C2S, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(IDC_LEFT_C2S, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_TILT_INVERT_ROLL, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_TILT_INVERT_ROLL, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_TILT_INVERT_PITCH, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_TILT_INVERT_PITCH, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_CC_LEFT_STICK, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_CC_LEFT_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, WiimoteConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDCB_CC_TRIGGERS, ConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(IDCB_CC_TRIGGERS, WiimoteConfigDialog::GeneralSettingsChanged)
// Wiimote // Wiimote
EVT_BUTTON(IDB_WM_A, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_1, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_1, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_P, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_H, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_SHAKE, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_SHAKE, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_PITCH_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, WiimoteConfigDialog::OnButtonClick)
// IR cursor // IR cursor
EVT_COMMAND_SCROLL(IDS_WIDTH, ConfigDialog::GeneralSettingsChangedScroll) EVT_COMMAND_SCROLL(IDS_WIDTH, WiimoteConfigDialog::GeneralSettingsChangedScroll)
EVT_COMMAND_SCROLL(IDS_HEIGHT, ConfigDialog::GeneralSettingsChangedScroll) EVT_COMMAND_SCROLL(IDS_HEIGHT, WiimoteConfigDialog::GeneralSettingsChangedScroll)
EVT_COMMAND_SCROLL(IDS_LEFT, ConfigDialog::GeneralSettingsChangedScroll) EVT_COMMAND_SCROLL(IDS_LEFT, WiimoteConfigDialog::GeneralSettingsChangedScroll)
EVT_COMMAND_SCROLL(IDS_TOP, ConfigDialog::GeneralSettingsChangedScroll) EVT_COMMAND_SCROLL(IDS_TOP, WiimoteConfigDialog::GeneralSettingsChangedScroll)
// Nunchuck // Nunchuck
EVT_BUTTON(IDB_NC_Z, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_Z, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_NC_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_L, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_NC_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_U, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_D, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_NC_SHAKE, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_SHAKE, WiimoteConfigDialog::OnButtonClick)
// Classic Controller // Classic Controller
EVT_BUTTON(IDB_CC_A, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_A, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_B, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_X, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_Y, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_P, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_P, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_M, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_H, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_TL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_ZR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_TR, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_DL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_DL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_DD, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_LL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_CC_RL, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RL, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, WiimoteConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, WiimoteConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_ANALOG_LEFT_X, ConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimoteConfigDialog::GetButtons)
EVT_BUTTON(IDB_ANALOG_LEFT_Y, ConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimoteConfigDialog::GetButtons)
EVT_BUTTON(IDB_ANALOG_RIGHT_X, ConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimoteConfigDialog::GetButtons)
EVT_BUTTON(IDB_ANALOG_RIGHT_Y, ConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimoteConfigDialog::GetButtons)
EVT_BUTTON(IDB_TRIGGER_L, ConfigDialog::GetButtons) EVT_BUTTON(IDB_TRIGGER_L, WiimoteConfigDialog::GetButtons)
EVT_BUTTON(IDB_TRIGGER_R, ConfigDialog::GetButtons) EVT_BUTTON(IDB_TRIGGER_R, WiimoteConfigDialog::GetButtons)
EVT_TIMER(IDTM_UPDATE, ConfigDialog::Update) EVT_TIMER(IDTM_UPDATE, WiimoteConfigDialog::Update)
EVT_TIMER(IDTM_UPDATE_ONCE, ConfigDialog::UpdateOnce) EVT_TIMER(IDTM_UPDATE_ONCE, WiimoteConfigDialog::UpdateOnce)
EVT_TIMER(IDTM_SHUTDOWN, ConfigDialog::ShutDown) EVT_TIMER(IDTM_SHUTDOWN, WiimoteConfigDialog::ShutDown)
EVT_TIMER(IDTM_BUTTON, ConfigDialog::OnButtonTimer) EVT_TIMER(IDTM_BUTTON, WiimoteConfigDialog::OnButtonTimer)
EVT_TIMER(IDTM_UPDATE_PAD, ConfigDialog::UpdatePad) EVT_TIMER(IDTM_UPDATE_PAD, WiimoteConfigDialog::UpdatePad)
END_EVENT_TABLE() END_EVENT_TABLE()
////////////////////////////////////// //////////////////////////////////////
@ -163,7 +163,7 @@ END_EVENT_TABLE()
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Class // Class
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, WiimoteConfigDialog::WiimoteConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style) const wxPoint &position, const wxSize& size, long style)
: wxDialog(parent, id, title, position, size, style) : wxDialog(parent, id, title, position, size, style)
{ {
@ -197,15 +197,15 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
UpdateGUI(); UpdateGUI();
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
wxKeyEventHandler(ConfigDialog::OnKeyDown), wxKeyEventHandler(WiimoteConfigDialog::OnKeyDown),
(wxObject*)0, this); (wxObject*)0, this);
} }
ConfigDialog::~ConfigDialog() WiimoteConfigDialog::~WiimoteConfigDialog()
{ {
} }
void ConfigDialog::OnKeyDown(wxKeyEvent& event) void WiimoteConfigDialog::OnKeyDown(wxKeyEvent& event)
{ {
event.Skip(); event.Skip();
@ -263,7 +263,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
} }
// Input button clicked // Input button clicked
void ConfigDialog::OnButtonClick(wxCommandEvent& event) void WiimoteConfigDialog::OnButtonClick(wxCommandEvent& event)
{ {
//INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed); //INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed);
@ -282,7 +282,7 @@ void ConfigDialog::OnButtonClick(wxCommandEvent& event)
} }
void ConfigDialog::OnClose(wxCloseEvent& event) void WiimoteConfigDialog::OnClose(wxCloseEvent& event)
{ {
g_FrameOpen = false; g_FrameOpen = false;
m_UpdatePad->Stop(); m_UpdatePad->Stop();
@ -297,7 +297,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event)
/* Timeout the shutdown. In Windows at least the g_pReadThread execution will hang at any attempt to /* Timeout the shutdown. In Windows at least the g_pReadThread execution will hang at any attempt to
call a frame function after the main thread has entered WaitForSingleObject() or any other loop. call a frame function after the main thread has entered WaitForSingleObject() or any other loop.
We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */ We must therefore shut down the thread from here and wait for that before we can call ShutDown(). */
void ConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event)) void WiimoteConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event))
{ {
// Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy(). // Close() is a wxWidgets function that will trigger EVT_CLOSE() and then call this->Destroy().
if(!WiiMoteReal::g_ThreadGoing) if(!WiiMoteReal::g_ThreadGoing)
@ -307,7 +307,7 @@ void ConfigDialog::ShutDown(wxTimerEvent& WXUNUSED(event))
} }
} }
void ConfigDialog::CloseClick(wxCommandEvent& event) void WiimoteConfigDialog::CloseClick(wxCommandEvent& event)
{ {
switch(event.GetId()) switch(event.GetId())
{ {
@ -333,12 +333,12 @@ void ConfigDialog::CloseClick(wxCommandEvent& event)
} }
} }
void ConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event)) void WiimoteConfigDialog::AboutClick(wxCommandEvent& WXUNUSED (event))
{ {
} }
// Execute a delayed function // Execute a delayed function
void ConfigDialog::UpdateOnce(wxTimerEvent& event) void WiimoteConfigDialog::UpdateOnce(wxTimerEvent& event)
{ {
switch(event.GetId()) switch(event.GetId())
{ {
@ -367,7 +367,7 @@ void ConfigDialog::UpdateOnce(wxTimerEvent& event)
Input: ChangePad needs to be used when we change the pad for a slot. Slot needs to be used when Input: ChangePad needs to be used when we change the pad for a slot. Slot needs to be used when
we only want to save changes to one slot. we only want to save changes to one slot.
*/ */
void ConfigDialog::DoSave(bool ChangePad, int Slot) void WiimoteConfigDialog::DoSave(bool ChangePad, int Slot)
{ {
// Replace "" with "-1" before we are saving // Replace "" with "-1" before we are saving
ToBlank(false); ToBlank(false);
@ -399,7 +399,7 @@ void ConfigDialog::DoSave(bool ChangePad, int Slot)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Bitmap box and dot // Bitmap box and dot
// ---------------- // ----------------
wxBitmap ConfigDialog::CreateBitmap() wxBitmap WiimoteConfigDialog::CreateBitmap()
{ {
BoxW = 70, BoxH = 70; BoxW = 70, BoxH = 70;
wxBitmap bitmap(BoxW, BoxH); wxBitmap bitmap(BoxW, BoxH);
@ -419,7 +419,7 @@ wxBitmap ConfigDialog::CreateBitmap()
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
return bitmap; return bitmap;
} }
wxBitmap ConfigDialog::CreateBitmapDot() wxBitmap WiimoteConfigDialog::CreateBitmapDot()
{ {
int w = 2, h = 2; int w = 2, h = 2;
wxBitmap bitmap(w, h); wxBitmap bitmap(w, h);
@ -437,7 +437,7 @@ wxBitmap ConfigDialog::CreateBitmapDot()
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
return bitmap; return bitmap;
} }
wxBitmap ConfigDialog::CreateBitmapDeadZone(int Radius) wxBitmap WiimoteConfigDialog::CreateBitmapDeadZone(int Radius)
{ {
wxBitmap bitmap(Radius*2, Radius*2); wxBitmap bitmap(Radius*2, Radius*2);
wxMemoryDC dc; wxMemoryDC dc;
@ -453,7 +453,7 @@ wxBitmap ConfigDialog::CreateBitmapDeadZone(int Radius)
//dc.SelectObject(wxNullBitmap); //dc.SelectObject(wxNullBitmap);
return bitmap; return bitmap;
} }
wxBitmap ConfigDialog::CreateBitmapClear() wxBitmap WiimoteConfigDialog::CreateBitmapClear()
{ {
wxBitmap bitmap(BoxW, BoxH); wxBitmap bitmap(BoxW, BoxH);
wxMemoryDC dc; wxMemoryDC dc;
@ -470,7 +470,7 @@ wxBitmap ConfigDialog::CreateBitmapClear()
////////////////////////////////////// //////////////////////////////////////
void ConfigDialog::CreateGUIControls() void WiimoteConfigDialog::CreateGUIControls()
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -1426,7 +1426,7 @@ void ConfigDialog::CreateGUIControls()
// =================================================== // ===================================================
/* Do connect real wiimote */ /* Do connect real wiimote */
// ---------------- // ----------------
void ConfigDialog::DoConnectReal() void WiimoteConfigDialog::DoConnectReal()
{ {
g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked(); g_Config.bConnectRealWiimote = m_ConnectRealWiimote[Page]->IsChecked();
@ -1440,15 +1440,6 @@ void ConfigDialog::DoConnectReal()
if (g_RealWiiMoteInitialized) if (g_RealWiiMoteInitialized)
{ {
WiiMoteReal::Shutdown(); WiiMoteReal::Shutdown();
/*
if (g_WiimoteUnexpectedDisconnect)
{
#ifdef _WIN32
PostMessage(g_ParentHWND, WM_USER, WIIMOTE_RECONNECT, 0);
g_WiimoteUnexpectedDisconnect = false;
#endif
}
*/
} }
} }
} }
@ -1458,7 +1449,7 @@ void ConfigDialog::DoConnectReal()
/* Do use real wiimote. We let the game set up the real Wiimote reporting mode and init the Extension when we change /* Do use real wiimote. We let the game set up the real Wiimote reporting mode and init the Extension when we change
want to use it again. */ want to use it again. */
// ---------------- // ----------------
void ConfigDialog::DoUseReal() void WiimoteConfigDialog::DoUseReal()
{ {
// Clear any eventual events in the Wiimote queue // Clear any eventual events in the Wiimote queue
WiiMoteReal::ClearEvents(); WiiMoteReal::ClearEvents();
@ -1493,7 +1484,7 @@ void ConfigDialog::DoUseReal()
// =================================================== // ===================================================
/* Generate connect/disconnect status event */ /* Generate connect/disconnect status event */
// ---------------- // ----------------
void ConfigDialog::DoExtensionConnectedDisconnected(int Extension) void WiimoteConfigDialog::DoExtensionConnectedDisconnected(int Extension)
{ {
// There is no need for this if no game is running // There is no need for this if no game is running
if(!g_EmulatorRunning) return; if(!g_EmulatorRunning) return;
@ -1509,7 +1500,7 @@ void ConfigDialog::DoExtensionConnectedDisconnected(int Extension)
// =================================================== // ===================================================
/* Change settings */ /* Change settings */
// ---------------- // ----------------
void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) void WiimoteConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
{ {
long TmpValue; long TmpValue;
@ -1660,7 +1651,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
// ======================================================= // =======================================================
// Apparently we need a scroll event version of this for the sliders // Apparently we need a scroll event version of this for the sliders
// ------------- // -------------
void ConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event) void WiimoteConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())
{ {
@ -1685,7 +1676,7 @@ void ConfigDialog::GeneralSettingsChangedScroll(wxScrollEvent& event)
// ======================================================= // =======================================================
// Update the IR pointer calibration sliders // Update the IR pointer calibration sliders
// ------------- // -------------
void ConfigDialog::UpdateControls() void WiimoteConfigDialog::UpdateControls()
{ {
// Update the slider position if a configuration has been loaded // Update the slider position if a configuration has been loaded
m_SliderWidth[Page]->SetValue(g_Config.iIRWidth); m_SliderWidth[Page]->SetValue(g_Config.iIRWidth);
@ -1705,7 +1696,7 @@ void ConfigDialog::UpdateControls()
// ======================================================= // =======================================================
// Update the enabled/disabled status // Update the enabled/disabled status
// ------------- // -------------
void ConfigDialog::UpdateGUI(int Slot) void WiimoteConfigDialog::UpdateGUI(int Slot)
{ {
//INFO_LOG(CONSOLE, "UpdateGUI: \n"); //INFO_LOG(CONSOLE, "UpdateGUI: \n");

View file

@ -34,14 +34,16 @@
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/progdlg.h> #include <wx/progdlg.h>
class ConfigDialog : public wxDialog class WiimoteConfigDialog : public wxDialog
{ {
public: public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1, WiimoteConfigDialog(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("Wii Remote Plugin Configuration"), const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS); long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
virtual ~ConfigDialog(); virtual ~WiimoteConfigDialog();
// General open, close and event functions // General open, close and event functions
void CloseClick(wxCommandEvent& event); void CloseClick(wxCommandEvent& event);
@ -270,6 +272,6 @@ class ConfigDialog : public wxDialog
int GetButtonWaitingID, GetButtonWaitingTimer; int GetButtonWaitingID, GetButtonWaitingTimer;
}; };
extern ConfigDialog *frame; extern WiimoteConfigDialog *m_ConfigFrame;
#endif #endif

View file

@ -41,7 +41,7 @@
/* Function: When changing the joystick we save and load the settings and update the PadMapping /* Function: When changing the joystick we save and load the settings and update the PadMapping
and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout
the plugin. Joyinfo[].joy is only used the first time the pads are checked. */ the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
void ConfigDialog::DoChangeJoystick() void WiimoteConfigDialog::DoChangeJoystick()
{ {
// Close the current pad, unless it's used by another slot // Close the current pad, unless it's used by another slot
//if (PadMapping[notebookpage].enabled) PadClose(notebookpage); //if (PadMapping[notebookpage].enabled) PadClose(notebookpage);
@ -56,7 +56,7 @@ void ConfigDialog::DoChangeJoystick()
// Open the new pad // Open the new pad
if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page); if (WiiMoteEmu::PadMapping[Page].enabled) PadOpen(Page);
} }
void ConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4 void WiimoteConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
{ {
// Check that we got a good pad // Check that we got a good pad
if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good) if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good)
@ -69,13 +69,13 @@ void ConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID); INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID);
WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID); WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID);
} }
void ConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4 void WiimoteConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
{ {
if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[Close].joy); if (SDL_JoystickOpened(WiiMoteEmu::PadMapping[Close].ID)) SDL_JoystickClose(WiiMoteEmu::PadState[Close].joy);
WiiMoteEmu::PadState[Close].joy = NULL; WiiMoteEmu::PadState[Close].joy = NULL;
} }
void ConfigDialog::DoChangeDeadZone(bool Left) void WiimoteConfigDialog::DoChangeDeadZone(bool Left)
{ {
if(Left) if(Left)
{ {
@ -104,7 +104,7 @@ void ConfigDialog::DoChangeDeadZone(bool Left)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Set the button text for all four Wiimotes // Set the button text for all four Wiimotes
void ConfigDialog::SetButtonTextAll(int id, char text[128]) void WiimoteConfigDialog::SetButtonTextAll(int id, char text[128])
{ {
for (int i = 0; i < 1; i++) for (int i = 0; i < 1; i++)
{ {
@ -116,7 +116,7 @@ void ConfigDialog::SetButtonTextAll(int id, char text[128])
} }
void ConfigDialog::SaveButtonMappingAll(int Slot) void WiimoteConfigDialog::SaveButtonMappingAll(int Slot)
{ {
//INFO_LOG(CONSOLE, "SaveButtonMappingAll()\n"); //INFO_LOG(CONSOLE, "SaveButtonMappingAll()\n");
@ -131,7 +131,7 @@ void ConfigDialog::SaveButtonMappingAll(int Slot)
// Set dialog items from saved values // Set dialog items from saved values
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::UpdateGUIButtonMapping(int controller) void WiimoteConfigDialog::UpdateGUIButtonMapping(int controller)
{ {
// Temporary storage // Temporary storage
wxString tmp; wxString tmp;
@ -217,7 +217,7 @@ void ConfigDialog::UpdateGUIButtonMapping(int controller)
/* Populate the PadMapping array with the dialog items settings (for example /* Populate the PadMapping array with the dialog items settings (for example
selected joystick, enabled or disabled status and so on) */ selected joystick, enabled or disabled status and so on) */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) void WiimoteConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot)
{ {
// Temporary storage // Temporary storage
wxString tmp; wxString tmp;
@ -265,7 +265,7 @@ void ConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int From
} }
// Save keyboard key mapping // Save keyboard key mapping
void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key) void WiimoteConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
{ {
switch(Id) switch(Id)
{ {
@ -325,7 +325,7 @@ void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
// Replace the harder to understand -1 with "" for the sake of user friendliness // Replace the harder to understand -1 with "" for the sake of user friendliness
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::ToBlank(bool ToBlank) void WiimoteConfigDialog::ToBlank(bool ToBlank)
{ {
if (!ControlsCreated) return; if (!ControlsCreated) return;
@ -354,7 +354,7 @@ void ConfigDialog::ToBlank(bool ToBlank)
// Update the textbox for the buttons // Update the textbox for the buttons
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::SetButtonText(int id, char text[128], int _Page) void WiimoteConfigDialog::SetButtonText(int id, char text[128], int _Page)
{ {
// Set controller value // Set controller value
int controller; int controller;
@ -426,7 +426,7 @@ void ConfigDialog::SetButtonText(int id, char text[128], int _Page)
// Get the text in the textbox for the buttons // Get the text in the textbox for the buttons
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxString ConfigDialog::GetButtonText(int id, int _Page) wxString WiimoteConfigDialog::GetButtonText(int id, int _Page)
{ {
//INFO_LOG(CONSOLE, "GetButtonText: %i\n", id); //INFO_LOG(CONSOLE, "GetButtonText: %i\n", id);
@ -464,12 +464,12 @@ wxString ConfigDialog::GetButtonText(int id, int _Page)
is that we start another parallel loop (at least in Windows) that blocks the old loop. And our only is that we start another parallel loop (at least in Windows) that blocks the old loop. And our only
option to wait for the old loop to finish is with a new loop, and that will block the old loop for as option to wait for the old loop to finish is with a new loop, and that will block the old loop for as
long as it's going on. Therefore a timer is easier to control. */ long as it's going on. Therefore a timer is easier to control. */
void ConfigDialog::GetButtons(wxCommandEvent& event) void WiimoteConfigDialog::GetButtons(wxCommandEvent& event)
{ {
DoGetButtons(event.GetId()); DoGetButtons(event.GetId());
} }
void ConfigDialog::DoGetButtons(int GetId) void WiimoteConfigDialog::DoGetButtons(int GetId)
{ {
// ============================================= // =============================================
// Collect the starting values // Collect the starting values
@ -644,7 +644,7 @@ void ConfigDialog::DoGetButtons(int GetId)
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
// Convert the 0x8000 range values to BoxW and BoxH for the plot // Convert the 0x8000 range values to BoxW and BoxH for the plot
void ConfigDialog::Convert2Box(int &x) void WiimoteConfigDialog::Convert2Box(int &x)
{ {
// Border adjustment // Border adjustment
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2; int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2;
@ -655,7 +655,7 @@ void ConfigDialog::Convert2Box(int &x)
// Update the input status boxes // Update the input status boxes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::PadGetStatus() void WiimoteConfigDialog::PadGetStatus()
{ {
//INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0)); //INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0));
@ -821,7 +821,7 @@ void ConfigDialog::PadGetStatus()
// Populate the advanced tab // Populate the advanced tab
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event)) void WiimoteConfigDialog::UpdatePad(wxTimerEvent& WXUNUSED(event))
{ {
// Show the current status // Show the current status
/* /*

View file

@ -35,7 +35,7 @@
void ConfigDialog::LoadFile() void WiimoteConfigDialog::LoadFile()
{ {
INFO_LOG(CONSOLE, "LoadFile()\n"); INFO_LOG(CONSOLE, "LoadFile()\n");
@ -77,7 +77,7 @@ void ConfigDialog::LoadFile()
file.Get(SaveName.c_str(), "PlaybackSpeed", &iTmp, -1); m_RecordPlayBackSpeed[i]->SetSelection(iTmp); file.Get(SaveName.c_str(), "PlaybackSpeed", &iTmp, -1); m_RecordPlayBackSpeed[i]->SetSelection(iTmp);
} }
} }
void ConfigDialog::SaveFile() void WiimoteConfigDialog::SaveFile()
{ {
INFO_LOG(CONSOLE, "SaveFile\n"); INFO_LOG(CONSOLE, "SaveFile\n");
@ -126,7 +126,7 @@ void ConfigDialog::SaveFile()
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// Create GUI // Create GUI
// ------------ // ------------
void ConfigDialog::CreateGUIControlsRecording() void WiimoteConfigDialog::CreateGUIControlsRecording()
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Real Wiimote // Real Wiimote
@ -356,7 +356,7 @@ void ConfigDialog::CreateGUIControlsRecording()
/* Record movement */ /* Record movement */
// ------------ // ------------
void ConfigDialog::ConvertToString() void WiimoteConfigDialog::ConvertToString()
{ {
// Load ini file // Load ini file
IniFile file; IniFile file;
@ -428,7 +428,7 @@ void ConfigDialog::ConvertToString()
} }
// Timeout the recording // Timeout the recording
void ConfigDialog::Update(wxTimerEvent& WXUNUSED(event)) void WiimoteConfigDialog::Update(wxTimerEvent& WXUNUSED(event))
{ {
m_bWaitForRecording = false; m_bWaitForRecording = false;
m_bRecording = false; m_bRecording = false;
@ -436,7 +436,7 @@ void ConfigDialog::Update(wxTimerEvent& WXUNUSED(event))
UpdateGUI(); UpdateGUI();
} }
void ConfigDialog::RecordMovement(wxCommandEvent& event) void WiimoteConfigDialog::RecordMovement(wxCommandEvent& event)
{ {
m_iRecordTo = event.GetId() - 2000; m_iRecordTo = event.GetId() - 2000;
@ -467,7 +467,7 @@ void ConfigDialog::RecordMovement(wxCommandEvent& event)
m_TimeoutTimer->Start(5000, true); m_TimeoutTimer->Start(5000, true);
} }
void ConfigDialog::DoRecordA(bool Pressed) void WiimoteConfigDialog::DoRecordA(bool Pressed)
{ {
// Return if we are not waiting or recording // Return if we are not waiting or recording
if (! (m_bWaitForRecording || m_bRecording)) return; if (! (m_bWaitForRecording || m_bRecording)) return;
@ -501,7 +501,7 @@ void ConfigDialog::DoRecordA(bool Pressed)
UpdateGUI(); UpdateGUI();
} }
void ConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes) void WiimoteConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes)
{ {
//std::string Tmp1 = ArrayToString(_IR, 20, 0, 30); //std::string Tmp1 = ArrayToString(_IR, 20, 0, 30);
//INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str()); //INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str());

View file

@ -114,8 +114,8 @@ void handle_event(struct wiimote_t* wm)
// Print battery status // Print battery status
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(frame && g_Config.bUpdateRealWiimote) if(m_ConfigFrame && g_Config.bUpdateRealWiimote)
frame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5)); m_ConfigFrame->m_GaugeBattery->SetValue((int)floor((wm->battery_level * 100) + 0.5));
#endif #endif
// Create shortcut to the nunchuck // Create shortcut to the nunchuck
struct nunchuk_t* nc = NULL; struct nunchuk_t* nc = NULL;
@ -170,7 +170,7 @@ void handle_event(struct wiimote_t* wm)
//INFO_LOG(CONSOLE, "%s\n\n", Tmp.c_str()); //INFO_LOG(CONSOLE, "%s\n\n", Tmp.c_str());
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(frame) if(m_ConfigFrame)
{ {
// Produce adjusted accelerometer values // Produce adjusted accelerometer values
float _Gx = (float)(wm->accel.x - wm->accel_calib.cal_zero.x) / (float)wm->accel_calib.cal_g.x; float _Gx = (float)(wm->accel.x - wm->accel_calib.cal_zero.x) / (float)wm->accel_calib.cal_g.x;
@ -194,37 +194,37 @@ void handle_event(struct wiimote_t* wm)
if(g_Config.bUpdateRealWiimote) if(g_Config.bUpdateRealWiimote)
{ {
// Update gauges // Update gauges
frame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180); m_ConfigFrame->m_GaugeRoll[0]->SetValue(wm->orient.roll + 180);
frame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180); m_ConfigFrame->m_GaugeRoll[1]->SetValue(wm->orient.pitch + 180);
// Show g. forces between -3 and 3 // Show g. forces between -3 and 3
frame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5)); m_ConfigFrame->m_GaugeGForce[0]->SetValue((int)floor((wm->gforce.x * 100) + 300.5));
frame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5)); m_ConfigFrame->m_GaugeGForce[1]->SetValue((int)floor((wm->gforce.y * 100) + 300.5));
frame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5)); m_ConfigFrame->m_GaugeGForce[2]->SetValue((int)floor((wm->gforce.z * 100) + 300.5));
frame->m_GaugeAccel[0]->SetValue(wm->accel.x); m_ConfigFrame->m_GaugeAccel[0]->SetValue(wm->accel.x);
frame->m_GaugeAccel[1]->SetValue(wm->accel.y); m_ConfigFrame->m_GaugeAccel[1]->SetValue(wm->accel.y);
frame->m_GaugeAccel[2]->SetValue(wm->accel.z); m_ConfigFrame->m_GaugeAccel[2]->SetValue(wm->accel.z);
frame->m_TextIR->SetLabel(wxString::Format( m_ConfigFrame->m_TextIR->SetLabel(wxString::Format(
wxT("Cursor: %03u %03u\nDistance:%4.0f"), wm->ir.x, wm->ir.y, wm->ir.z)); wxT("Cursor: %03u %03u\nDistance:%4.0f"), wm->ir.x, wm->ir.y, wm->ir.z));
//frame->m_TextAccNeutralCurrent->SetLabel(wxString::Format( //m_ConfigFrame->m_TextAccNeutralCurrent->SetLabel(wxString::Format(
// wxT("Current: %03u %03u %03u"), Gx, Gy, Gz)); // wxT("Current: %03u %03u %03u"), Gx, Gy, Gz));
if(frame->m_bRecording) if(m_ConfigFrame->m_bRecording)
INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", Gx, Gy, Gz); INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i\n", Gx, Gy, Gz);
//INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x\n", Gx, Gy, Gz); //INFO_LOG(CONSOLE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x\n", Gx, Gy, Gz);
} }
// Send the data to be saved // Send the data to be saved
//const u8* data = (const u8*)wm->event_buf; //const u8* data = (const u8*)wm->event_buf;
frame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6), m_ConfigFrame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6),
(WIIUSE_USING_EXP(wm) ? 10 : 12)); (WIIUSE_USING_EXP(wm) ? 10 : 12));
// Turn recording on and off // Turn recording on and off
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) frame->DoRecordA(true); if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_ConfigFrame->DoRecordA(true);
else frame->DoRecordA(false); else m_ConfigFrame->DoRecordA(false);
// ------------------------------------ // ------------------------------------
// Show roll and pitch in the status box // Show roll and pitch in the status box
@ -239,10 +239,10 @@ void handle_event(struct wiimote_t* wm)
int Roll = (int)wm->orient.roll * (0x8000 / 180); int Roll = (int)wm->orient.roll * (0x8000 / 180);
int Pitch = (int)wm->orient.pitch * (0x8000 / 180); int Pitch = (int)wm->orient.pitch * (0x8000 / 180);
// Convert it to the box // Convert it to the box
frame->Convert2Box(Roll); m_ConfigFrame->Convert2Box(Roll);
frame->Convert2Box(Pitch); m_ConfigFrame->Convert2Box(Pitch);
// Show roll and pitch in the axis boxes // Show roll and pitch in the axis boxes
frame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));*/ m_ConfigFrame->m_bmpDotRightOut[0]->SetPosition(wxPoint(Roll, Pitch));*/
// --------------------- // ---------------------
} }
#endif #endif
@ -251,20 +251,20 @@ void handle_event(struct wiimote_t* wm)
else else
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) if (m_ConfigFrame)
{ {
frame->m_GaugeRoll[0]->SetValue(0); m_ConfigFrame->m_GaugeRoll[0]->SetValue(0);
frame->m_GaugeRoll[1]->SetValue(0); m_ConfigFrame->m_GaugeRoll[1]->SetValue(0);
frame->m_GaugeGForce[0]->SetValue(0); m_ConfigFrame->m_GaugeGForce[0]->SetValue(0);
frame->m_GaugeGForce[1]->SetValue(0); m_ConfigFrame->m_GaugeGForce[1]->SetValue(0);
frame->m_GaugeGForce[2]->SetValue(0); m_ConfigFrame->m_GaugeGForce[2]->SetValue(0);
frame->m_GaugeAccel[0]->SetValue(0); m_ConfigFrame->m_GaugeAccel[0]->SetValue(0);
frame->m_GaugeAccel[1]->SetValue(0); m_ConfigFrame->m_GaugeAccel[1]->SetValue(0);
frame->m_GaugeAccel[2]->SetValue(0); m_ConfigFrame->m_GaugeAccel[2]->SetValue(0);
frame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:")); m_ConfigFrame->m_TextIR->SetLabel(wxT("Cursor:\nDistance:"));
} }
#endif #endif
} }

View file

@ -46,6 +46,7 @@ worked.
#include "Logging.h" #include "Logging.h"
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include "ConfigDlg.h" #include "ConfigDlg.h"
WiimoteConfigDialog *m_ConfigFrame = NULL;
#endif #endif
#include "Config.h" #include "Config.h"
#include "pluginspecs_wiimote.h" #include "pluginspecs_wiimote.h"
@ -93,34 +94,22 @@ std::vector<int> g_UpdateTimeList (5, 0);
// Movement recording // Movement recording
std::vector<SRecordingAll> VRecording(RECORDING_ROWS); std::vector<SRecordingAll> VRecording(RECORDING_ROWS);
// DLL instance // Standard crap to make wxWidgets happy
#ifdef _WIN32
HINSTANCE g_hInstance; HINSTANCE g_hInstance;
#ifdef _WIN32
HWND g_ParentHWND = NULL;
#endif
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxWindow win; class wxDLLApp : public wxApp
ConfigDialog *frame = NULL; {
bool OnInit()
class wxDLLApp : public wxApp
{ {
bool OnInit() return true;
{ }
return true; };
} IMPLEMENT_APP_NO_MAIN(wxDLLApp)
}; WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif #endif
////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Main function and WxWidgets initialization
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved LPVOID lpvReserved) // reserved
@ -128,18 +117,22 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
{ //use wxInitialize() if you don't want GUI instead of the following 12 lines {
#if defined(HAVE_WX) && HAVE_WX
wxSetInstance((HINSTANCE)hinstDLL); wxSetInstance((HINSTANCE)hinstDLL);
int argc = 0; int argc = 0;
char **argv = NULL; char **argv = NULL;
wxEntryStart(argc, argv); wxEntryStart(argc, argv);
if (!wxTheApp || !wxTheApp->CallOnInit()) if (!wxTheApp || !wxTheApp->CallOnInit())
return FALSE; return FALSE;
#endif
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI #if defined(HAVE_WX) && HAVE_WX
wxEntryCleanup();
#endif
break; break;
default: default:
break; break;
@ -149,25 +142,38 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
return TRUE; return TRUE;
} }
#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
//****************************************************************************** //******************************************************************************
extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo) void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_WIIMOTE; _PluginInfo->Type = PLUGIN_TYPE_WIIMOTE;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin"); sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin");
#else #else
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)"); sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (Debug)");
#endif #endif
#endif #endif
} }
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
@ -182,36 +188,25 @@ void DllConfig(HWND _hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#ifdef _WIN32
win.SetHWND(_hParent);
#endif
//Console::Open();
DoInitialize(); DoInitialize();
frame = new ConfigDialog(&win); if (!m_ConfigFrame)
g_FrameOpen = true; m_ConfigFrame = new WiimoteConfigDialog(GetParentedWxWindow(_hParent));
/* We don't need to use ShowModal() anymore becaue FreeLibrary() is not called after this function
anymore */
frame->Show();
#ifdef _WIN32
win.SetHWND(0);
#endif
// Only allow one open at a time
if (!m_ConfigFrame->IsShown())
m_ConfigFrame->ShowModal();
else
m_ConfigFrame->Hide();
#endif #endif
} }
extern "C" void Initialize(void *init) void Initialize(void *init)
{ {
// Declarations // Declarations
SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init; SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init;
g_WiimoteInitialize = _WiimoteInitialize; g_WiimoteInitialize = _WiimoteInitialize;
#ifdef _WIN32
g_ParentHWND = GetParent(g_WiimoteInitialize.hWnd);
#endif
g_EmulatorRunning = true; g_EmulatorRunning = true;
// Update the GUI if the configuration window is already open // Update the GUI if the configuration window is already open
@ -224,7 +219,7 @@ extern "C" void Initialize(void *init)
g_ISOId = g_WiimoteInitialize.ISOId; g_ISOId = g_WiimoteInitialize.ISOId;
// Load the settings // Load the settings
g_Config.Load(); g_Config.Load();
if(frame) frame->UpdateGUI(); if(m_ConfigFrame) m_ConfigFrame->UpdateGUI();
} }
#endif #endif
@ -237,7 +232,7 @@ extern "C" void Initialize(void *init)
} }
// If a game is not running this is called by the Configuration window when it's closed // If a game is not running this is called by the Configuration window when it's closed
extern "C" void Shutdown(void) void Shutdown(void)
{ {
// Not running // Not running
g_EmulatorRunning = false; g_EmulatorRunning = false;
@ -245,11 +240,11 @@ extern "C" void Shutdown(void)
// Reset the game ID in all cases // Reset the game ID in all cases
g_ISOId = 0; g_ISOId = 0;
// We will only shutdown when both a game and the frame is closed // We will only shutdown when both a game and the m_ConfigFrame is closed
if (g_FrameOpen) if (g_FrameOpen)
{ {
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if(frame) frame->UpdateGUI(); if(m_ConfigFrame) m_ConfigFrame->UpdateGUI();
#endif #endif
// Reset the variables // Reset the variables
@ -264,12 +259,10 @@ extern "C" void Shutdown(void)
if (g_RealWiiMoteInitialized) WiiMoteReal::Shutdown(); if (g_RealWiiMoteInitialized) WiiMoteReal::Shutdown();
#endif #endif
WiiMoteEmu::Shutdown(); WiiMoteEmu::Shutdown();
// Console::Close();
} }
extern "C" void DoState(unsigned char **ptr, int mode) void DoState(unsigned char **ptr, int mode)
{ {
#if HAVE_WIIUSE #if HAVE_WIIUSE
WiiMoteReal::DoState(ptr, mode); WiiMoteReal::DoState(ptr, mode);
@ -286,7 +279,7 @@ extern "C" void DoState(unsigned char **ptr, int mode)
so that it knows the channel ID and the data reporting mode at all times. so that it knows the channel ID and the data reporting mode at all times.
*/ */
// ---------------- // ----------------
extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
DEBUG_LOG(WII_IPC_WIIMOTE, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
@ -315,7 +308,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32
// =================================================== // ===================================================
/* Function: Used for the initial Bluetooth HID handshake. */ /* Function: Used for the initial Bluetooth HID handshake. */
// ---------------- // ----------------
extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
{ {
DEBUG_LOG(WII_IPC_WIIMOTE, "============================================================="); DEBUG_LOG(WII_IPC_WIIMOTE, "=============================================================");
const u8* data = (const u8*)_pData; const u8* data = (const u8*)_pData;
@ -327,7 +320,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
g_EmulatorRunning = false; g_EmulatorRunning = false;
g_WiimoteUnexpectedDisconnect = true; g_WiimoteUnexpectedDisconnect = true;
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) frame->UpdateGUI(); if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
#endif #endif
return; return;
} }
@ -356,16 +349,16 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _
/* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this /* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this
update. */ update. */
// ---------------- // ----------------
extern "C" void Wiimote_Update() void Wiimote_Update()
{ {
// Tell us about the update rate, but only about once every second to avoid a major slowdown // Tell us about the update rate, but only about once every second to avoid a major slowdown
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) if (m_ConfigFrame)
{ {
GetUpdateRate(); GetUpdateRate();
if (g_UpdateWriteScreen > g_UpdateRate) if (g_UpdateWriteScreen > g_UpdateRate)
{ {
frame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate)); m_ConfigFrame->m_TextUpdateRate->SetLabel(wxString::Format(wxT("Update rate: %03i times/s"), g_UpdateRate));
g_UpdateWriteScreen = 0; g_UpdateWriteScreen = 0;
} }
g_UpdateWriteScreen++; g_UpdateWriteScreen++;
@ -398,7 +391,7 @@ extern "C" void Wiimote_Update()
#endif #endif
} }
extern "C" unsigned int Wiimote_GetAttachedControllers() unsigned int Wiimote_GetAttachedControllers()
{ {
return 1; return 1;
} }
@ -458,7 +451,7 @@ bool IsFocus()
HWND Parent = GetParent(RenderingWindow); HWND Parent = GetParent(RenderingWindow);
HWND TopLevel = GetParent(Parent); HWND TopLevel = GetParent(Parent);
// Allow updates when the config window is in focus to // Allow updates when the config window is in focus to
HWND Config = NULL; if (frame) Config = (HWND)frame->GetHWND(); HWND Config = NULL; if (m_ConfigFrame) Config = (HWND)m_ConfigFrame->GetHWND();
// Support both rendering to main window and not // Support both rendering to main window and not
if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config) if (GetForegroundWindow() == TopLevel || GetForegroundWindow() == RenderingWindow || GetForegroundWindow() == Config)
return true; return true;
@ -525,7 +518,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
{ {
DisableExtensions(); DisableExtensions();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) frame->UpdateGUI(); if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
#endif #endif
} }
} }
@ -565,7 +558,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
g_Config.Save(); g_Config.Save();
WiiMoteEmu::UpdateEeprom(); WiiMoteEmu::UpdateEeprom();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) frame->UpdateGUI(); if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
#endif #endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str()); INFO_LOG(CONSOLE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]); INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x\n\n", data[7], data[8]);
@ -578,7 +571,7 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
g_Config.Save(); g_Config.Save();
WiiMoteEmu::UpdateEeprom(); WiiMoteEmu::UpdateEeprom();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
if (frame) frame->UpdateGUI(); if (m_ConfigFrame) m_ConfigFrame->UpdateGUI();
#endif #endif
INFO_LOG(CONSOLE, "%s", TmpData.c_str()); INFO_LOG(CONSOLE, "%s", TmpData.c_str());
INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]); INFO_LOG(CONSOLE, "Game got the decrypted extension ID: %02x%02x%02x%02x%02x%02x\n\n", data[7], data[8], data[9], data[10], data[11], data[12]);
@ -1083,9 +1076,6 @@ int GetUpdateRate()
void DoInitialize() void DoInitialize()
{ {
// Open console
//OpenConsole(true);
// Run this first so that WiiMoteReal::Initialize() overwrites g_Eeprom // Run this first so that WiiMoteReal::Initialize() overwrites g_Eeprom
WiiMoteEmu::Initialize(); WiiMoteEmu::Initialize();
@ -1099,5 +1089,3 @@ void DoInitialize()
if (g_Config.bConnectRealWiimote) WiiMoteReal::Initialize(); if (g_Config.bConnectRealWiimote) WiiMoteReal::Initialize();
#endif #endif
} }

View file

@ -59,9 +59,6 @@ struct SRecordingAll
extern bool g_RealWiiMoteInitialized; extern bool g_RealWiiMoteInitialized;
extern bool g_EmulatedWiiMoteInitialized; extern bool g_EmulatedWiiMoteInitialized;
extern bool g_WiimoteUnexpectedDisconnect; extern bool g_WiimoteUnexpectedDisconnect;
#ifdef _WIN32
extern HWND g_ParentHWND;
#endif
// Settings // Settings
extern accel_cal g_wm; extern accel_cal g_wm;