Merge pull request #8562 from jordan-woyak/sens-slider

Core/DolphinQt: Fix IR Sensitivity slider.
This commit is contained in:
Léo Lam 2020-01-15 00:29:24 +01:00 committed by GitHub
commit d2efad58af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/Swap.h"
namespace IOS::HLE::FS namespace IOS::HLE::FS
{ {
@ -55,14 +56,17 @@ public:
{ {
if (bytes.size() != sizeof(T)) if (bytes.size() != sizeof(T))
return default_value; return default_value;
T value; T value;
std::memcpy(&value, bytes.data(), bytes.size()); std::memcpy(&value, bytes.data(), bytes.size());
return value; return Common::FromBigEndian(value);
} }
template <typename T> template <typename T>
void SetData(T value) void SetData(T value)
{ {
ASSERT(sizeof(value) == bytes.size()); ASSERT(sizeof(value) == bytes.size());
value = Common::FromBigEndian(value);
std::memcpy(bytes.data(), &value, bytes.size()); std::memcpy(bytes.data(), &value, bytes.size());
} }

View File

@ -177,8 +177,9 @@ void WiiPane::CreateWiiRemoteSettings()
// i18n: IR stands for infrared and refers to the pointer functionality of Wii Remotes // i18n: IR stands for infrared and refers to the pointer functionality of Wii Remotes
m_wiimote_ir_sensitivity_label = new QLabel(tr("IR Sensitivity:")); m_wiimote_ir_sensitivity_label = new QLabel(tr("IR Sensitivity:"));
m_wiimote_ir_sensitivity = new QSlider(Qt::Horizontal); m_wiimote_ir_sensitivity = new QSlider(Qt::Horizontal);
m_wiimote_ir_sensitivity->setMinimum(4); // Wii menu saves values from 1 to 5.
m_wiimote_ir_sensitivity->setMaximum(127); m_wiimote_ir_sensitivity->setMinimum(1);
m_wiimote_ir_sensitivity->setMaximum(5);
// Speaker Volume Slider // Speaker Volume Slider
m_wiimote_speaker_volume_label = new QLabel(tr("Speaker Volume:")); m_wiimote_speaker_volume_label = new QLabel(tr("Speaker Volume:"));