1
0
Fork 0
forked from suyu/suyu

general: Fix compiler warnings on linux and miscellaneous changes

This commit is contained in:
Morph 2020-10-27 13:33:25 -04:00
parent 117bdc71e0
commit 97b2220a82
12 changed files with 31 additions and 22 deletions

View file

@ -287,7 +287,7 @@ void Controller_NPad::OnLoadInputDevices() {
void Controller_NPad::OnRelease() { void Controller_NPad::OnRelease() {
for (std::size_t npad_idx = 0; npad_idx < vibrations.size(); ++npad_idx) { for (std::size_t npad_idx = 0; npad_idx < vibrations.size(); ++npad_idx) {
for (std::size_t device_idx = 0; device_idx < vibrations[npad_idx].size(); ++device_idx) { for (std::size_t device_idx = 0; device_idx < vibrations[npad_idx].size(); ++device_idx) {
VibrateControllerAtIndex(npad_idx, device_idx); VibrateControllerAtIndex(npad_idx, device_idx, {});
} }
} }
} }
@ -720,11 +720,14 @@ bool Controller_NPad::VibrateControllerAtIndex(std::size_t npad_index, std::size
last_vibration_timepoints[npad_index][device_index] = now; last_vibration_timepoints[npad_index][device_index] = now;
} }
return vibrations[npad_index][device_index]->SetRumblePlay( auto& vibration = vibrations[npad_index][device_index];
std::min(vibration_value.amp_low * player.vibration_strength / 100.0f, 1.0f), const auto player_vibration_strength = static_cast<f32>(player.vibration_strength);
vibration_value.freq_low, const auto amp_low =
std::min(vibration_value.amp_high * player.vibration_strength / 100.0f, 1.0f), std::min(vibration_value.amp_low * player_vibration_strength / 100.0f, 1.0f);
vibration_value.freq_high); const auto amp_high =
std::min(vibration_value.amp_high * player_vibration_strength / 100.0f, 1.0f);
return vibration->SetRumblePlay(amp_low, vibration_value.freq_low, amp_high,
vibration_value.freq_high);
} }
void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_handle, void Controller_NPad::VibrateController(const DeviceHandle& vibration_device_handle,
@ -855,7 +858,7 @@ void Controller_NPad::DisconnectNpad(u32 npad_id) {
void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) {
for (std::size_t device_idx = 0; device_idx < vibrations[npad_index].size(); ++device_idx) { for (std::size_t device_idx = 0; device_idx < vibrations[npad_index].size(); ++device_idx) {
// Send an empty vibration to stop any vibrations. // Send an empty vibration to stop any vibrations.
VibrateControllerAtIndex(npad_index, device_idx); VibrateControllerAtIndex(npad_index, device_idx, {});
vibration_devices_mounted[npad_index][device_idx] = false; vibration_devices_mounted[npad_index][device_idx] = false;
} }

View file

@ -149,7 +149,7 @@ public:
void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode); void SetNpadMode(u32 npad_id, NpadAssignments assignment_mode);
bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index, bool VibrateControllerAtIndex(std::size_t npad_index, std::size_t device_index,
const VibrationValue& vibration_value = {}); const VibrationValue& vibration_value);
void VibrateController(const DeviceHandle& vibration_device_handle, void VibrateController(const DeviceHandle& vibration_device_handle,
const VibrationValue& vibration_value); const VibrationValue& vibration_value);

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <thread>
#include "common/assert.h" #include "common/assert.h"
#include "common/string_util.h" #include "common/string_util.h"
@ -356,7 +357,7 @@ bool QtControllerSelectorDialog::CheckIfParametersMet() {
} }
void QtControllerSelectorDialog::SetSupportedControllers() { void QtControllerSelectorDialog::SetSupportedControllers() {
const QString theme = [this] { const QString theme = [] {
if (QIcon::themeName().contains(QStringLiteral("dark"))) { if (QIcon::themeName().contains(QStringLiteral("dark"))) {
return QStringLiteral("_dark"); return QStringLiteral("_dark");
} else if (QIcon::themeName().contains(QStringLiteral("midnight"))) { } else if (QIcon::themeName().contains(QStringLiteral("midnight"))) {
@ -445,7 +446,7 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index)
} }
}(); }();
const QString theme = [this] { const QString theme = [] {
if (QIcon::themeName().contains(QStringLiteral("dark"))) { if (QIcon::themeName().contains(QStringLiteral("dark"))) {
return QStringLiteral("_dark"); return QStringLiteral("_dark");
} else if (QIcon::themeName().contains(QStringLiteral("midnight"))) { } else if (QIcon::themeName().contains(QStringLiteral("midnight"))) {

View file

@ -4,6 +4,7 @@
#include "ui_configure_debug_controller.h" #include "ui_configure_debug_controller.h"
#include "yuzu/configuration/configure_debug_controller.h" #include "yuzu/configuration/configure_debug_controller.h"
#include "yuzu/configuration/configure_input_player.h"
ConfigureDebugController::ConfigureDebugController(QWidget* parent, ConfigureDebugController::ConfigureDebugController(QWidget* parent,
InputCommon::InputSubsystem* input_subsystem, InputCommon::InputSubsystem* input_subsystem,

View file

@ -6,10 +6,11 @@
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include "yuzu/configuration/configure_input_player.h"
class QPushButton; class QPushButton;
class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace InputCommon { namespace InputCommon {

View file

@ -8,17 +8,16 @@
#include <memory> #include <memory>
#include <QKeyEvent> #include <QKeyEvent>
#include <QList>
#include <QWidget> #include <QWidget>
#include "yuzu/configuration/configure_input_advanced.h"
#include "yuzu/configuration/configure_input_player.h"
#include "ui_configure_input.h"
class QCheckBox; class QCheckBox;
class QString; class QString;
class QTimer; class QTimer;
class ConfigureInputAdvanced;
class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace InputCommon { namespace InputCommon {

View file

@ -68,8 +68,7 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent)
for (std::size_t button_idx = 0; button_idx < color_buttons.size(); ++button_idx) { for (std::size_t button_idx = 0; button_idx < color_buttons.size(); ++button_idx) {
connect(color_buttons[button_idx], &QPushButton::clicked, this, connect(color_buttons[button_idx], &QPushButton::clicked, this,
[this, player_idx, button_idx] { [this, player_idx, button_idx] {
OnControllerButtonClick(static_cast<int>(player_idx), OnControllerButtonClick(player_idx, button_idx);
static_cast<int>(button_idx));
}); });
} }
} }
@ -94,7 +93,8 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent)
ConfigureInputAdvanced::~ConfigureInputAdvanced() = default; ConfigureInputAdvanced::~ConfigureInputAdvanced() = default;
void ConfigureInputAdvanced::OnControllerButtonClick(int player_idx, int button_idx) { void ConfigureInputAdvanced::OnControllerButtonClick(std::size_t player_idx,
std::size_t button_idx) {
const QColor new_bg_color = QColorDialog::getColor(controllers_colors[player_idx][button_idx]); const QColor new_bg_color = QColorDialog::getColor(controllers_colors[player_idx][button_idx]);
if (!new_bg_color.isValid()) { if (!new_bg_color.isValid()) {
return; return;

View file

@ -35,7 +35,7 @@ private:
void RetranslateUI(); void RetranslateUI();
void UpdateUIEnabled(); void UpdateUIEnabled();
void OnControllerButtonClick(int player_idx, int button_idx); void OnControllerButtonClick(std::size_t player_idx, std::size_t button_idx);
void LoadConfiguration(); void LoadConfiguration();

View file

@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <thread>
#include <utility> #include <utility>
#include <QGridLayout> #include <QGridLayout>
#include <QInputDialog> #include <QInputDialog>
@ -857,7 +858,7 @@ void ConfigureInputPlayer::UpdateControllerIcon() {
} }
}(); }();
const QString theme = [this] { const QString theme = [] {
if (QIcon::themeName().contains(QStringLiteral("dark"))) { if (QIcon::themeName().contains(QStringLiteral("dark"))) {
return QStringLiteral("_dark"); return QStringLiteral("_dark");
} else if (QIcon::themeName().contains(QStringLiteral("midnight"))) { } else if (QIcon::themeName().contains(QStringLiteral("midnight"))) {

View file

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "ui_configure_input_profile_dialog.h" #include "ui_configure_input_profile_dialog.h"
#include "yuzu/configuration/configure_input_player.h"
#include "yuzu/configuration/configure_input_profile_dialog.h" #include "yuzu/configuration/configure_input_profile_dialog.h"
ConfigureInputProfileDialog::ConfigureInputProfileDialog( ConfigureInputProfileDialog::ConfigureInputProfileDialog(

View file

@ -6,10 +6,11 @@
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include "yuzu/configuration/configure_input_player.h"
class QPushButton; class QPushButton;
class ConfigureInputPlayer;
class InputProfiles; class InputProfiles;
namespace InputCommon { namespace InputCommon {

View file

@ -58,6 +58,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include <QMessageBox> #include <QMessageBox>
#include <QProgressBar> #include <QProgressBar>
#include <QProgressDialog> #include <QProgressDialog>
#include <QPushButton>
#include <QShortcut> #include <QShortcut>
#include <QStatusBar> #include <QStatusBar>
#include <QSysInfo> #include <QSysInfo>