Play your Steam library's Windows games on a jailbroken PS5.
C++
Apply Rumble with a kit that has input-rumble
Leonardo Lobato664a94c61a74
diff --git a/src/homebrew/runtime_host.cpp b/src/homebrew/runtime_host.cppindex 9d04ceb..10cc6fc 100644--- a/src/homebrew/runtime_host.cpp+++ b/src/homebrew/runtime_host.cpp@@ -1468,8 +1468,9 @@ rt::KitCapabilities RuntimeHost::TitleKit(const Composition& c, const rt::Runtimif (!c.kit) return {};const auto kit = rt::KitCapabilitiesFromManifest(c.kit->capabilities, true);// The title's markers are read only when the kit has something an older runtime would refuse.- return kit.display_120hz || kit.profile_version_2 ? rt::KitForTitleRuntime(kit, TitleRuntimeCurrent(c, record))- : kit;+ return kit.display_120hz || kit.profile_version_2 || kit.input_rumble+ ? rt::KitForTitleRuntime(kit, TitleRuntimeCurrent(c, record))+ : kit;}// The complete OWNER protocol for the publish-profile step: persist the exactdiff --git a/src/runtime/game_settings.cpp b/src/runtime/game_settings.cppindex c8094c7..1757a85 100644--- a/src/runtime/game_settings.cpp+++ b/src/runtime/game_settings.cpp@@ -496,8 +496,13 @@ std::string Unavailable(const SettingDefinition& definition, const std::string&return "Needs a prospero-win update that reads [environment].";if (id == "wheel_stick" && !kit.input_wheel) return "Needs a prospero-win update that turns the mouse wheel.";if (id == "volume" && !kit.audio_volume) return "Needs a prospero-win update with per-game volume.";+ // Rumble alone (input-rumble) or with the rest of controller tuning.+ if (id == "rumble" && !kit.input_tuning && !kit.input_rumble) {+ if (kit.input_rumble_needs_update) return kAppliesAfterKitUpdate;+ return "Needs a runtime kit with rumble control.";+ }if (id == "stick_deadzone" || id == "rumble" || id == "trigger_deadzone") {- if (!kit.input_tuning) return "Needs a prospero-win update with controller tuning.";+ if (!kit.input_tuning && id != "rumble") return "Needs a prospero-win update with controller tuning.";const auto controller = values.find("controller");if (controller == values.end() || controller->second.value != "xinput") return "Only with the Xbox controller.";}@@ -1159,7 +1164,8 @@ bool RenderProsperoProfile(const GameRecipe& recipe, const EffectiveSettings& seProsperoProfileFeatures features;features.environment_section = environment_section;features.debug_env = debug_env;- features.input_tuning = tuned_deadzone || tuned_rumble || tuned_triggers;+ features.input_tuning = tuned_deadzone || tuned_triggers;+ features.input_rumble = tuned_rumble;features.input_wheel = wheel;features.audio_section = audio_section;features.display_frame_rate = frame_rate;@@ -2907,8 +2913,8 @@ namespace playden::runtime {const std::vector<std::string>& SettingsKitCapabilityNames() {// Sorted, as a kit manifest lists them.- static const std::vector<std::string> names = {kKitDisplay120Hz, kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent,- kKitInputTuning, kKitInputWheel, kKitEnvironment};+ static const std::vector<std::string> names = {kKitDisplay120Hz, kKitInputRumble, kKitAudioVolume, kKitDxvkConfig,+ kKitDxvkPresent, kKitInputTuning, kKitInputWheel, kKitEnvironment};return names;}@@ -2934,6 +2940,7 @@ KitCapabilities KitCapabilitiesFromManifest(const std::vector<std::string>& capakit.vkd3d_proton = has(kKitVkd3dProton);kit.display_120hz = has(kKitDisplay120Hz);kit.profile_version_2 = has(kKitProfileVersion2);+ kit.input_rumble = has(kKitInputRumble);kit.registry = bottle_access;return kit;}@@ -2947,6 +2954,10 @@ KitCapabilities KitForTitleRuntime(KitCapabilities kit, bool title_runtime_currekit.profile_version_2 = false;kit.profile_version_2_needs_update = true;}+ if (!title_runtime_current && kit.input_rumble) {+ kit.input_rumble = false;+ kit.input_rumble_needs_update = true;+ }return kit;}@@ -3207,6 +3218,9 @@ bool CommunityPresetSupported(const CommunityPreset& community, const KitCapabil// A runtime name, not a settings one: its values apply once the game's title runs the kit's runtime, like the// rows they set (KitForTitleRuntime), so a title that waits for its update may choose the preset too.else if (feature == "display-120hz") { if (!kit.display_120hz && !kit.display_120hz_needs_update) return false; }+ else if (feature == "input-rumble") {+ if (!kit.input_tuning && !kit.input_rumble && !kit.input_rumble_needs_update) return false;+ }// Legacy PR references are informational sidecar provenance. Unknown feature// names or version requirements need verified support before a preset is shown.else if (feature.size() < 2 || feature.front() != '#' ||diff --git a/src/runtime/game_settings.h b/src/runtime/game_settings.hindex 1cf8dd5..980dcd0 100644--- a/src/runtime/game_settings.h+++ b/src/runtime/game_settings.h@@ -69,6 +69,10 @@ struct KitCapabilities {// profile without the key. Counts only for a title that runs this kit's runtime, like display_120hz.bool profile_version_2 = false;bool profile_version_2_needs_update = false;+ // [input] rumble = 0-100 alone, without the rest of controller tuning. Counts only for a title that runs this kit's+ // runtime, like display_120hz.+ bool input_rumble = false;+ bool input_rumble_needs_update = false;};struct SettingChoice {@@ -474,7 +478,8 @@ bool ParseCommunityRecipe(std::string_view json, CommunityRecipe* community, std// Whether the kit's runtime has every newer profile feature the sidecar declares in// requires.prospero_win: the kit capability names without "settings-" (profile-environment,-// input-tuning, input-wheel, audio-volume; see prospero-win-profiles SIDECARS.md) and display-120hz, which needs the+// input-tuning, input-wheel, audio-volume; see prospero-win-profiles SIDECARS.md), and display-120hz and input-rumble,+// which need the// game's own title on such a runtime: pass the kit as KitForTitleRuntime gives it for the game. Other entries// (pull requests, versions) are not checked.bool CommunityPresetSupported(const CommunityPreset& community, const KitCapabilities& kit);@@ -517,6 +522,9 @@ inline constexpr const char* kKitDisplay120Hz = "display-120hz";// The title reads [runtime] version: version 2 takes the driver's defaults (pixel shaders in wave32), a profile without// it (version 1) keeps wave64. Runtimes without it refuse a profile with [runtime] version.inline constexpr const char* kKitProfileVersion2 = "profile-version-2";+// The title scales the game's vibration, the DualSense's motors and its L2/R2 trigger vibration, by [input] rumble =+// 0-100 (0 turns it off). Runtimes without it refuse a profile with rumble.+inline constexpr const char* kKitInputRumble = "input-rumble";const std::vector<std::string>& SettingsKitCapabilityNames();// Settings gates from a verified kit's capabilities. bottle_access: the adapter can edit the@@ -526,7 +534,7 @@ KitCapabilities KitCapabilitiesFromManifest(const std::vector<std::string>& capa// The installed kit's capabilities for one game's title. A prepared title keeps its own copy of the runtime until// Update, so a capability that adds profile keys counts only when the title runs this kit's runtime// (title_runtime_current: the title's owner markers name this kit, PackageInstaller::TitleCurrent). Otherwise-// display_120hz and profile_version_2 are off and their _needs_update say why.+// display_120hz, profile_version_2 and input_rumble are off and their _needs_update say why.KitCapabilities KitForTitleRuntime(KitCapabilities kit, bool title_runtime_current);// Everything one game's settings put on disk for its next launch.diff --git a/src/runtime/kit_trust.cpp b/src/runtime/kit_trust.cppindex e33a831..99ccbb9 100644--- a/src/runtime/kit_trust.cpp+++ b/src/runtime/kit_trust.cpp@@ -14,7 +14,7 @@ KitAdmissionConfig DevelopmentKitAdmission() {kKitTitleAnyId, kKitGameRootUnowned, kKitBottleProfileShared, kKitOpenGLZink,kKitAudioVolume, kKitDxvkConfig, kKitDxvkPresent, kKitInputTuning,kKitInputWheel, kKitEnvironment, kKitWineMono, kKitVkd3dProton,- kKitDisplay120Hz, kKitProfileVersion2};+ kKitDisplay120Hz, kKitProfileVersion2, kKitInputRumble};std::sort(config.known_capabilities.begin(), config.known_capabilities.end());return config;}diff --git a/src/runtime/prospero_profile.cpp b/src/runtime/prospero_profile.cppindex 258ae32..8adf72a 100644--- a/src/runtime/prospero_profile.cpp+++ b/src/runtime/prospero_profile.cpp@@ -327,7 +327,8 @@ bool CheckProsperoProfile(std::string_view text, std::string* reason, ProsperoPrif (speed < 1 || speed > 20000) return bad("not 1-20000");} else if (features.input_wheel && key == "wheel") {if (!OneOf(value, {"none", "left_stick", "right_stick"})) return bad("unknown wheel stick");- } else if (features.input_tuning && (key == "stick_deadzone" || key == "rumble" || key == "trigger_deadzone")) {+ } else if ((features.input_tuning && (key == "stick_deadzone" || key == "trigger_deadzone")) ||+ ((features.input_tuning || features.input_rumble) && key == "rumble")) {const long maximum = key == "rumble" ? 100 : 50;if (!IsDigits(value, 3) || std::atol(std::string(value).c_str()) > maximum)return bad(key == "rumble" ? "not 0-100" : "not 0-50");diff --git a/src/runtime/prospero_profile.h b/src/runtime/prospero_profile.hindex c367066..f4607a5 100644--- a/src/runtime/prospero_profile.h+++ b/src/runtime/prospero_profile.h@@ -75,6 +75,7 @@ bool IsProsperoEnvironmentEntry(std::string_view name, std::string_view value);struct ProsperoProfileFeatures {bool environment_section = false; // [environment] (prospero-win 25abec9, kit H r5)bool input_tuning = false; // [input] stick_deadzone, rumble, trigger_deadzone+ bool input_rumble = false; // [input] rumble alone (kit capability input-rumble)bool input_wheel = false; // [input] wheelbool audio_section = false; // [audio] volumebool debug_env = false; // [debug] env = NAME=value (upstream prospero-win)diff --git a/tests/game_settings_test.cpp b/tests/game_settings_test.cppindex 5ca79cf..d3387f1 100644--- a/tests/game_settings_test.cpp+++ b/tests/game_settings_test.cpp@@ -846,6 +846,32 @@ int main(int argc, char** argv) {CHECK(BuildEffectiveSettings(hl2, nullptr, {{"controller", "keyboard"}, {"rumble", "0"}}, tuning_kit, &settings, &error));CHECK(!settings.values.at("rumble").available && settings.values.at("rumble").reason == "Only with the Xbox controller.");CHECK(!ValidateSettingValue(hl2, "stick_deadzone", "60", &reason) && ValidateSettingValue(hl2, "rumble", "25", &reason));+ // A kit with rumble alone (input-rumble) applies Rumble but not the dead zones, once the title runs its runtime.+ {+ const auto rumble_kit = KitCapabilitiesFromManifest({kKitInputRumble}, false);+ CHECK(rumble_kit.input_rumble && !rumble_kit.input_tuning);+ CHECK(BuildEffectiveSettings(hl2, nullptr, tuning, rumble_kit, &settings, &error));+ CHECK(settings.values.at("rumble").available && !settings.values.at("stick_deadzone").available);+ CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));+ CHECK(profile.text.find("\nrumble = 50\n") != std::string::npos && profile.text.find("stick_deadzone") == std::string::npos);+ CHECK(!CheckProsperoProfile(profile.text, &reason));+ CHECK(CheckProsperoProfile(profile.text, &reason, {.input_rumble = true}));+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"rumble", "0"}}, rumble_kit, &settings, &error));+ CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));+ CHECK(profile.text.find("\nrumble = 0\n") != std::string::npos);+ // A title on an older runtime keeps the choice for its update and writes nothing until then.+ const auto stale = KitForTitleRuntime(rumble_kit, false);+ CHECK(!stale.input_rumble && stale.input_rumble_needs_update);+ CHECK(KitForTitleRuntime(rumble_kit, true).input_rumble);+ CHECK(!KitForTitleRuntime(KitCapabilities{}, false).input_rumble_needs_update);+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"rumble", "0"}}, stale, &settings, &error));+ const auto& waiting = settings.values.at("rumble");+ CHECK(!waiting.available && waiting.waits_for_update && waiting.after_update == "0");+ CHECK(RenderProsperoProfile(hl2, settings, target, &profile, &reason));+ CHECK(profile.text.find("rumble") == std::string::npos);+ CHECK(BuildEffectiveSettings(hl2, nullptr, {{"controller", "keyboard"}, {"rumble", "0"}}, rumble_kit, &settings, &error));+ CHECK(settings.values.at("rumble").reason == "Only with the Xbox controller.");+ }// Trigger dead zone rides with controller tuning; the wheel and volume have their own gates.const std::map<std::string, std::string> more_tuning = {@@ -1109,6 +1135,12 @@ int main(int argc, char** argv) {CHECK(!CommunityPresetSupported(needs_display, KitCapabilitiesFromManifest({kKitDxvk}, false)));// A title that waits for its update may take the preset as well: its values wait with the rows they set.CHECK(CommunityPresetSupported(needs_display, KitForTitleRuntime(display, false)));+ auto needs_rumble = community;+ needs_rumble.requires_prospero_win.push_back("input-rumble");+ const auto rumble = KitCapabilitiesFromManifest({kKitInputRumble}, false);+ CHECK(CommunityPresetSupported(needs_rumble, rumble) && CommunityPresetSupported(needs_rumble, KitForTitleRuntime(rumble, false)));+ CHECK(CommunityPresetSupported(needs_rumble, KitCapabilitiesFromManifest({kKitInputTuning}, false)));+ CHECK(!CommunityPresetSupported(needs_rumble, KitCapabilitiesFromManifest({kKitDxvk}, false)));}CHECK(BuildEffectiveSettings(hl2, &community.preset, {}, KitCapabilities{}, &settings, &error));CHECK(settings.values.at("controller").value == "keyboard");diff --git a/tests/prospero_profile_test.cpp b/tests/prospero_profile_test.cppindex c811602..53ebe1e 100644--- a/tests/prospero_profile_test.cpp+++ b/tests/prospero_profile_test.cpp@@ -180,6 +180,9 @@ int main(int argc, char** argv) {CHECK(CheckProsperoProfile(base + "[input]\nstick_deadzone = 50\nrumble = 0\n", &reason, {.input_tuning = true}));CHECK(!CheckProsperoProfile(base + "[input]\nstick_deadzone = 51\n", &reason, {.input_tuning = true}));CHECK(!CheckProsperoProfile(base + "[input]\nrumble = 101\n", &reason, {.input_tuning = true}));+ CHECK(CheckProsperoProfile(base + "[input]\nrumble = 0\n", &reason, {.input_rumble = true})); // input-rumble alone+ CHECK(!CheckProsperoProfile(base + "[input]\nrumble = 101\n", &reason, {.input_rumble = true}));+ CHECK(!CheckProsperoProfile(base + "[input]\nstick_deadzone = 5\n", &reason, {.input_rumble = true}));CHECK(!CheckProsperoProfile(base + "[input]\nrumble = -1\n", &reason, {.input_tuning = true}));CHECK(CheckProsperoProfile(base + "[input]\ntrigger_deadzone = 50\n", &reason, {.input_tuning = true}));CHECK(!CheckProsperoProfile(base + "[input]\nwheel = left_stick\n", &reason, {.input_tuning = true}));