Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

tunetest: the regrouped Settings rows (dead zone is the 8th), the user's dead zones and trigger feel put back

Rafael Abud Ferreira978a74926ebe
diff --git a/src/app/app_core.cpp b/src/app/app_core.cpp
index 470d43c..3461fe4 100644
--- a/src/app/app_core.cpp
+++ b/src/app/app_core.cpp
@@ -197,6 +197,8 @@ std::unique_ptr<Core> g_core;
} // namespace
+bool saveSettingsChoice(const ui::SettingsChoice& choice) { return saveSettings(choice); }
+
// What the screens offer (ui::UiCaps): the pads' features (input_ext.h),
// the display's and the platform's. The PS5 offers every option as it
// always has: its pads are DualSense, and what its display can't honour at
diff --git a/src/app/app_core.h b/src/app/app_core.h
index e3935e1..ea5b9a8 100644
--- a/src/app/app_core.h
+++ b/src/app/app_core.h
@@ -23,5 +23,8 @@ int runApp();
// What the screens offer here (the pads', display's and shell's
// capabilities): every option on the PS5.
ui::UiCaps uiCaps();
+// Saves what Settings edits and applies the controller part (the autoplay
+// tests put the user's choices back with it); true when the language changed.
+bool saveSettingsChoice(const ui::SettingsChoice& choice);
} // namespace xc::app
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index 7ada912..3c8e0b3 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -4,6 +4,7 @@
#include "app/autoplay.h"
#include "ui/input_mode.h"
+#include "app/app_core.h"
#include "app/app_state.h"
#include "display/display.h"
#include "media/audio_in.h"
@@ -171,8 +172,19 @@ void autoplayPad(input::ControllerState& pad) {
if (in(from + 300u * static_cast<unsigned>(i), 120)) return true;
return false;
};
+ // The user's dead zones and trigger feel come back at the end (the
+ // test saves its own).
+ static std::optional<ui::SettingsChoice> before;
+ if (!before) before = g_ui->settings();
+ // Settings' rows on screen: the dead zone is the 8th (7 down), the
+ // trigger vibration right under it.
+ auto quick = [&](uint64_t from, int n) {
+ for (int i = 0; i < n; ++i)
+ if (in(from + 130u * static_cast<unsigned>(i), 60)) return true;
+ return false;
+ };
pad.btnOptions = in(500, 150);
- pad.dpadDown = pulses(1000, 3) || in(8000, 120) || in(9400, 120) || in(10200, 120) || in(11600, 120);
+ pad.dpadDown = quick(1000, 7) || in(8000, 120) || in(9400, 120) || in(10200, 120) || in(11600, 120);
pad.btnA = in(2000, 150) || in(8500, 150);
pad.btnB = in(7500, 150) || in(16500, 150);
pad.btnR1 = in(4600, 150);
@@ -184,8 +196,10 @@ void autoplayPad(input::ControllerState& pad) {
if (in(6500, 20)) tuneShot = "sticks.ppm";
if (in(15500, 20)) tuneShot = "triggers.ppm";
if (in(17500, 20)) {
+ g_ui->setSettings(*before);
+ saveSettingsChoice(*before);
g_autoplay.tuneTest = false;
- XC_LOGI("AUTOPLAY END: tune test");
+ XC_LOGI("AUTOPLAY END: tune test (dead zones and triggers put back as they were)");
}
}
if (g_autoplay.gameSettingsTest && uiSaved) {