Make continuous scanning optional.
This commit is contained in:
parent
f3d25f2cb0
commit
fa10335c55
|
@ -241,6 +241,7 @@ void SConfig::SaveSettings()
|
||||||
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
|
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
|
||||||
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
|
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
|
||||||
ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad);
|
ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad);
|
||||||
|
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
|
||||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||||
ini.Set("Core", "FrameLimit", m_Framelimit);
|
ini.Set("Core", "FrameLimit", m_Framelimit);
|
||||||
|
@ -390,7 +391,8 @@ void SConfig::LoadSettings()
|
||||||
|
|
||||||
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
|
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
|
||||||
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
|
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
|
||||||
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
|
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
|
||||||
|
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, true);
|
||||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||||
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
|
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct SConfig : NonCopyable
|
||||||
bool m_WiiSDCard;
|
bool m_WiiSDCard;
|
||||||
bool m_WiiKeyboard;
|
bool m_WiiKeyboard;
|
||||||
bool m_WiimoteReconnectOnLoad;
|
bool m_WiimoteReconnectOnLoad;
|
||||||
|
bool m_WiimoteContinuousScanning;
|
||||||
|
|
||||||
// name of the last used filename
|
// name of the last used filename
|
||||||
std::string m_LastFilename;
|
std::string m_LastFilename;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Host.h"
|
#include "Host.h"
|
||||||
|
#include "ConfigManager.h"
|
||||||
|
|
||||||
#include "WiimoteReal.h"
|
#include "WiimoteReal.h"
|
||||||
|
|
||||||
|
@ -303,9 +304,9 @@ void WiimoteScanner::WantWiimotes(bool do_want)
|
||||||
|
|
||||||
void WiimoteScanner::StartScanning()
|
void WiimoteScanner::StartScanning()
|
||||||
{
|
{
|
||||||
m_run_thread = true;
|
if (!m_run_thread && IsReady())
|
||||||
if (IsReady())
|
|
||||||
{
|
{
|
||||||
|
m_run_thread = true;
|
||||||
m_scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this);
|
m_scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,19 +414,23 @@ void LoadSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// config dialog calls this when some settings change
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
|
if (SConfig::GetInstance().m_WiimoteContinuousScanning)
|
||||||
|
g_wiimote_scanner.StartScanning();
|
||||||
|
else
|
||||||
|
g_wiimote_scanner.StopScanning();
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
|
std::lock_guard<std::recursive_mutex> lk(g_refresh_lock);
|
||||||
|
|
||||||
|
g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes());
|
||||||
|
|
||||||
if (g_real_wiimotes_initialized)
|
if (g_real_wiimotes_initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize");
|
NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize");
|
||||||
|
|
||||||
g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes());
|
|
||||||
|
|
||||||
g_wiimote_scanner.StartScanning();
|
|
||||||
|
|
||||||
g_real_wiimotes_initialized = true;
|
g_real_wiimotes_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +539,7 @@ void Refresh()
|
||||||
HandleFoundWiimotes(found_wiimotes);
|
HandleFoundWiimotes(found_wiimotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_wiimote_scanner.StartScanning();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size)
|
void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size)
|
||||||
|
|
|
@ -60,14 +60,22 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
|
||||||
wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition);
|
wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition);
|
||||||
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
||||||
|
|
||||||
// "Real wiimotes" layout
|
|
||||||
wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes"));
|
wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes"));
|
||||||
|
|
||||||
|
wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
if (!WiimoteReal::g_wiimote_scanner.IsReady())
|
if (!WiimoteReal::g_wiimote_scanner.IsReady())
|
||||||
real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n"
|
real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n"
|
||||||
"You must manually pair your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
|
"You must manually pair your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
|
||||||
|
wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
|
||||||
|
continuous_scanning->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &WiimoteConfigDiag::OnContinuousScanning, this);
|
||||||
|
continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning);
|
||||||
|
|
||||||
real_wiimotes_group->Add(refresh_btn, 0, wxALIGN_CENTER);
|
real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
real_wiimotes_sizer->AddStretchSpacer(1);
|
||||||
|
real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5);
|
||||||
|
real_wiimotes_group->Add(real_wiimotes_sizer, 1, wxEXPAND);
|
||||||
|
|
||||||
// "General Settings" controls
|
// "General Settings" controls
|
||||||
const wxString str[] = { _("Bottom"), _("Top") };
|
const wxString str[] = { _("Bottom"), _("Top") };
|
||||||
|
|
|
@ -57,6 +57,12 @@ public:
|
||||||
SConfig::GetInstance().m_WiimoteReconnectOnLoad = event.IsChecked();
|
SConfig::GetInstance().m_WiimoteReconnectOnLoad = event.IsChecked();
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
void OnContinuousScanning(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
SConfig::GetInstance().m_WiimoteContinuousScanning = event.IsChecked();
|
||||||
|
WiimoteReal::Initialize();
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Cancel(wxCommandEvent& event);
|
void Cancel(wxCommandEvent& event);
|
||||||
|
|
Loading…
Reference in New Issue