input_common: Fix settings errors
This commit is contained in:
@@ -165,7 +165,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<float, float> GetStatus() const override {
|
std::tuple<float, float> GetStatus() const override {
|
||||||
if (Settings::values.emulate_analog_keyboard) {
|
if (Settings::values.emulate_analog_keyboard.GetValue()) {
|
||||||
const auto now = std::chrono::steady_clock::now();
|
const auto now = std::chrono::steady_clock::now();
|
||||||
float angle_ = GetAngle(now);
|
float angle_ = GetAngle(now);
|
||||||
return std::make_tuple(std::cos(angle_) * amplitude, std::sin(angle_) * amplitude);
|
return std::make_tuple(std::cos(angle_) * amplitude, std::sin(angle_) * amplitude);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void Mouse::UpdateThread(std::stop_token stop_token) {
|
|||||||
info.motion.UpdateOrientation(update_time * 1000);
|
info.motion.UpdateOrientation(update_time * 1000);
|
||||||
info.tilt_speed = 0;
|
info.tilt_speed = 0;
|
||||||
info.data.motion = info.motion.GetMotion();
|
info.data.motion = info.motion.GetMotion();
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
info.last_mouse_change *= 0.96f;
|
info.last_mouse_change *= 0.96f;
|
||||||
info.data.axis = {static_cast<int>(16 * info.last_mouse_change.x),
|
info.data.axis = {static_cast<int>(16 * info.last_mouse_change.x),
|
||||||
static_cast<int>(16 * -info.last_mouse_change.y)};
|
static_cast<int>(16 * -info.last_mouse_change.y)};
|
||||||
@@ -74,7 +74,7 @@ void Mouse::PressButton(int x, int y, MouseButton button_) {
|
|||||||
|
|
||||||
void Mouse::StopPanning() {
|
void Mouse::StopPanning() {
|
||||||
for (MouseInfo& info : mouse_info) {
|
for (MouseInfo& info : mouse_info) {
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
info.data.axis = {};
|
info.data.axis = {};
|
||||||
info.tilt_speed = 0;
|
info.tilt_speed = 0;
|
||||||
info.last_mouse_change = {};
|
info.last_mouse_change = {};
|
||||||
@@ -84,7 +84,7 @@ void Mouse::StopPanning() {
|
|||||||
|
|
||||||
void Mouse::MouseMove(int x, int y, int center_x, int center_y) {
|
void Mouse::MouseMove(int x, int y, int center_x, int center_y) {
|
||||||
for (MouseInfo& info : mouse_info) {
|
for (MouseInfo& info : mouse_info) {
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
auto mouse_change =
|
auto mouse_change =
|
||||||
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
||||||
mouse_panning_timout = 0;
|
mouse_panning_timout = 0;
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ bool Client::DeviceConnected(std::size_t pad) const {
|
|||||||
void Client::ReloadSockets() {
|
void Client::ReloadSockets() {
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
std::stringstream servers_ss(static_cast<std::string>(Settings::values.udp_input_servers));
|
std::stringstream servers_ss(Settings::values.udp_input_servers.GetValue());
|
||||||
std::string server_token;
|
std::string server_token;
|
||||||
std::size_t client = 0;
|
std::size_t client = 0;
|
||||||
while (std::getline(servers_ss, server_token, ',')) {
|
while (std::getline(servers_ss, server_token, ',')) {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
format.setVersion(4, 6);
|
format.setVersion(4, 6);
|
||||||
format.setProfile(QSurfaceFormat::CompatibilityProfile);
|
format.setProfile(QSurfaceFormat::CompatibilityProfile);
|
||||||
format.setOption(QSurfaceFormat::FormatOption::DeprecatedFunctions);
|
format.setOption(QSurfaceFormat::FormatOption::DeprecatedFunctions);
|
||||||
if (Settings::values.renderer_debug) {
|
if (Settings::values.renderer_debug.GetValue()) {
|
||||||
format.setOption(QSurfaceFormat::FormatOption::DebugContext);
|
format.setOption(QSurfaceFormat::FormatOption::DebugContext);
|
||||||
}
|
}
|
||||||
// TODO: expose a setting for buffer value (ie default/single/double/triple)
|
// TODO: expose a setting for buffer value (ie default/single/double/triple)
|
||||||
@@ -440,7 +440,7 @@ void GRenderWindow::mouseMoveEvent(QMouseEvent* event) {
|
|||||||
input_subsystem->GetMouse()->MouseMove(x, y, center_x, center_y);
|
input_subsystem->GetMouse()->MouseMove(x, y, center_x, center_y);
|
||||||
this->TouchMoved(x, y, 0);
|
this->TouchMoved(x, y, 0);
|
||||||
|
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
QCursor::setPos(mapToGlobal({center_x, center_y}));
|
QCursor::setPos(mapToGlobal({center_x, center_y}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -756,7 +756,7 @@ void GRenderWindow::showEvent(QShowEvent* event) {
|
|||||||
|
|
||||||
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
|
||||||
if (event->type() == QEvent::HoverMove) {
|
if (event->type() == QEvent::HoverMove) {
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
auto* hover_event = static_cast<QMouseEvent*>(event);
|
auto* hover_event = static_cast<QMouseEvent*>(event);
|
||||||
mouseMoveEvent(hover_event);
|
mouseMoveEvent(hover_event);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -161,14 +161,14 @@ void GMainWindow::ShowTelemetryCallout() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UISettings::values.callout_flags =
|
UISettings::values.callout_flags.SetValue(UISettings::values.callout_flags.GetValue() |
|
||||||
UISettings::values.callout_flags.GetValue() | static_cast<uint32_t>(CalloutFlag::Telemetry);
|
static_cast<uint32_t>(CalloutFlag::Telemetry));
|
||||||
const QString telemetry_message =
|
const QString telemetry_message =
|
||||||
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
||||||
"data is collected</a> to help improve yuzu. "
|
"data is collected</a> to help improve yuzu. "
|
||||||
"<br/><br/>Would you like to share your usage data with us?");
|
"<br/><br/>Would you like to share your usage data with us?");
|
||||||
if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
|
if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
|
||||||
Settings::values.enable_telemetry = false;
|
Settings::values.enable_telemetry.SetValue(false);
|
||||||
Core::System::GetInstance().ApplySettings();
|
Core::System::GetInstance().ApplySettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ GMainWindow::GMainWindow()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::values.current_user = static_cast<s32>(selected_user);
|
Settings::values.current_user.SetValue(static_cast<s32>(selected_user));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,8 +998,9 @@ void GMainWindow::InitializeHotkeys() {
|
|||||||
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
|
dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
|
||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
|
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
|
||||||
&QShortcut::activated, this,
|
&QShortcut::activated, this, [] {
|
||||||
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
|
Settings::values.audio_muted.SetValue(!Settings::values.audio_muted.GetValue());
|
||||||
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Framerate Limit"), this),
|
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Framerate Limit"), this),
|
||||||
&QShortcut::activated, this, [] {
|
&QShortcut::activated, this, [] {
|
||||||
Settings::values.disable_fps_limit.SetValue(
|
Settings::values.disable_fps_limit.SetValue(
|
||||||
@@ -1007,8 +1008,8 @@ void GMainWindow::InitializeHotkeys() {
|
|||||||
});
|
});
|
||||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Mouse Panning"), this),
|
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Mouse Panning"), this),
|
||||||
&QShortcut::activated, this, [&] {
|
&QShortcut::activated, this, [&] {
|
||||||
Settings::values.mouse_panning = !Settings::values.mouse_panning;
|
Settings::values.mouse_panning.SetValue(!Settings::values.mouse_panning.GetValue());
|
||||||
if (Settings::values.mouse_panning) {
|
if (Settings::values.mouse_panning.GetValue()) {
|
||||||
render_window->installEventFilter(render_window);
|
render_window->installEventFilter(render_window);
|
||||||
render_window->setAttribute(Qt::WA_Hover, true);
|
render_window->setAttribute(Qt::WA_Hover, true);
|
||||||
}
|
}
|
||||||
@@ -1056,7 +1057,7 @@ void GMainWindow::RestoreUIState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
||||||
if (!UISettings::values.pause_when_in_background) {
|
if (!UISettings::values.pause_when_in_background.GetValue()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
|
if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
|
||||||
@@ -1223,8 +1224,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
|
|||||||
if (result == Core::System::ResultStatus::Success &&
|
if (result == Core::System::ResultStatus::Success &&
|
||||||
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
||||||
drd_callout) {
|
drd_callout) {
|
||||||
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
|
UISettings::values.callout_flags.SetValue(UISettings::values.callout_flags.GetValue() |
|
||||||
static_cast<u32>(CalloutFlag::DRDDeprecation);
|
static_cast<u32>(CalloutFlag::DRDDeprecation));
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
this, tr("Warning Outdated Game Format"),
|
this, tr("Warning Outdated Game Format"),
|
||||||
tr("You are using the deconstructed ROM directory format for this game, which is an "
|
tr("You are using the deconstructed ROM directory format for this game, which is an "
|
||||||
@@ -1299,7 +1300,7 @@ void GMainWindow::SelectAndSetCurrentUser() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::values.current_user = dialog.GetIndex();
|
Settings::values.current_user.SetValue(dialog.GetIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
|
void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index,
|
||||||
@@ -1337,7 +1338,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
|||||||
|
|
||||||
Settings::LogSettings();
|
Settings::LogSettings();
|
||||||
|
|
||||||
if (UISettings::values.select_user_on_boot) {
|
if (UISettings::values.select_user_on_boot.GetValue()) {
|
||||||
SelectAndSetCurrentUser();
|
SelectAndSetCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1374,12 +1375,12 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
|||||||
status_bar_update_timer.start(500);
|
status_bar_update_timer.start(500);
|
||||||
renderer_status_button->setDisabled(true);
|
renderer_status_button->setDisabled(true);
|
||||||
|
|
||||||
if (UISettings::values.hide_mouse || Settings::values.mouse_panning) {
|
if (UISettings::values.hide_mouse.GetValue() || Settings::values.mouse_panning.GetValue()) {
|
||||||
render_window->installEventFilter(render_window);
|
render_window->installEventFilter(render_window);
|
||||||
render_window->setAttribute(Qt::WA_Hover, true);
|
render_window->setAttribute(Qt::WA_Hover, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UISettings::values.hide_mouse) {
|
if (UISettings::values.hide_mouse.GetValue()) {
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2682,7 +2683,8 @@ void GMainWindow::OnConfigure() {
|
|||||||
|
|
||||||
config->Save();
|
config->Save();
|
||||||
|
|
||||||
if ((UISettings::values.hide_mouse || Settings::values.mouse_panning) && emulation_running) {
|
if ((UISettings::values.hide_mouse.GetValue() || Settings::values.mouse_panning.GetValue()) &&
|
||||||
|
emulation_running) {
|
||||||
render_window->installEventFilter(render_window);
|
render_window->installEventFilter(render_window);
|
||||||
render_window->setAttribute(Qt::WA_Hover, true);
|
render_window->setAttribute(Qt::WA_Hover, true);
|
||||||
} else {
|
} else {
|
||||||
@@ -2690,7 +2692,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
render_window->setAttribute(Qt::WA_Hover, false);
|
render_window->setAttribute(Qt::WA_Hover, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UISettings::values.hide_mouse) {
|
if (UISettings::values.hide_mouse.GetValue()) {
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2813,7 +2815,7 @@ void GMainWindow::OnCaptureScreenshot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (UISettings::values.enable_screenshot_save_as) {
|
if (UISettings::values.enable_screenshot_save_as.GetValue()) {
|
||||||
OnPauseGame();
|
OnPauseGame();
|
||||||
filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename,
|
filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename,
|
||||||
tr("PNG Image (*.png)"));
|
tr("PNG Image (*.png)"));
|
||||||
@@ -2898,7 +2900,7 @@ void GMainWindow::UpdateStatusBar() {
|
|||||||
} else {
|
} else {
|
||||||
emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
|
emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0));
|
||||||
}
|
}
|
||||||
if (Settings::values.disable_fps_limit) {
|
if (Settings::values.disable_fps_limit.GetValue()) {
|
||||||
game_fps_label->setText(
|
game_fps_label->setText(
|
||||||
tr("Game: %1 FPS (Unlocked)").arg(results.average_game_fps, 0, 'f', 0));
|
tr("Game: %1 FPS (Unlocked)").arg(results.average_game_fps, 0, 'f', 0));
|
||||||
} else {
|
} else {
|
||||||
@@ -2961,7 +2963,7 @@ void GMainWindow::UpdateUISettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::HideMouseCursor() {
|
void GMainWindow::HideMouseCursor() {
|
||||||
if (emu_thread == nullptr && UISettings::values.hide_mouse) {
|
if (emu_thread == nullptr && UISettings::values.hide_mouse.GetValue()) {
|
||||||
mouse_hide_timer.stop();
|
mouse_hide_timer.stop();
|
||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
return;
|
return;
|
||||||
@@ -2971,13 +2973,13 @@ void GMainWindow::HideMouseCursor() {
|
|||||||
|
|
||||||
void GMainWindow::ShowMouseCursor() {
|
void GMainWindow::ShowMouseCursor() {
|
||||||
render_window->unsetCursor();
|
render_window->unsetCursor();
|
||||||
if (emu_thread != nullptr && UISettings::values.hide_mouse) {
|
if (emu_thread != nullptr && UISettings::values.hide_mouse.GetValue()) {
|
||||||
mouse_hide_timer.start();
|
mouse_hide_timer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMouseActivity() {
|
void GMainWindow::OnMouseActivity() {
|
||||||
if (!Settings::values.mouse_panning) {
|
if (!Settings::values.mouse_panning.GetValue()) {
|
||||||
ShowMouseCursor();
|
ShowMouseCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3174,7 +3176,7 @@ std::optional<u64> GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProv
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GMainWindow::ConfirmClose() {
|
bool GMainWindow::ConfirmClose() {
|
||||||
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
|
if (emu_thread == nullptr || !UISettings::values.confirm_before_closing.GetValue())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QMessageBox::StandardButton answer =
|
QMessageBox::StandardButton answer =
|
||||||
|
|||||||
Reference in New Issue
Block a user