diff --git a/src/duckstation-qt/advancedsettingswidget.cpp b/src/duckstation-qt/advancedsettingswidget.cpp index ac4b47e41..3df12f83d 100644 --- a/src/duckstation-qt/advancedsettingswidget.cpp +++ b/src/duckstation-qt/advancedsettingswidget.cpp @@ -199,6 +199,8 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(QtHostInterface* host_interface, "ShowStatusIndicators", true); addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display", "ShowEnhancements", false); + addBooleanTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Controller Enhanced Mode (PS4/PS5)"), "Main", + "ControllerEnhancedMode", false); addIntRangeTweakOption(m_host_interface, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, 0); @@ -275,36 +277,40 @@ AdvancedSettingsWidget::~AdvancedSettingsWidget() = default; void AdvancedSettingsWidget::onResetToDefaultClicked() { - setBooleanTweakOption(m_ui.tweakOptionTable, 0, false); // Disable all enhancements - setBooleanTweakOption(m_ui.tweakOptionTable, 1, true); // Show status indicators - setBooleanTweakOption(m_ui.tweakOptionTable, 2, false); // Show enhancement settings - setIntRangeTweakOption(m_ui.tweakOptionTable, 3, 0); // Display FPS limit - setChoiceTweakOption(m_ui.tweakOptionTable, 4, 0); // Multisample antialiasing - setBooleanTweakOption(m_ui.tweakOptionTable, 5, false); // PGXP vertex cache - setFloatRangeTweakOption(m_ui.tweakOptionTable, 6, -1.0f); // PGXP geometry tolerance - setFloatRangeTweakOption(m_ui.tweakOptionTable, 7, - Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD); // PGXP depth clear threshold - setBooleanTweakOption(m_ui.tweakOptionTable, 8, false); // Recompiler memory exceptions - setBooleanTweakOption(m_ui.tweakOptionTable, 9, true); // Recompiler block linking - setChoiceTweakOption(m_ui.tweakOptionTable, 10, Settings::DEFAULT_CPU_FASTMEM_MODE); // Recompiler fastmem mode - setBooleanTweakOption(m_ui.tweakOptionTable, 11, false); // Recompiler Icache - setBooleanTweakOption(m_ui.tweakOptionTable, 12, false); // VRAM write texture replacement - setBooleanTweakOption(m_ui.tweakOptionTable, 13, false); // Preload texture replacements - setBooleanTweakOption(m_ui.tweakOptionTable, 14, false); // Dump replacable VRAM writes - setBooleanTweakOption(m_ui.tweakOptionTable, 15, false); // Set dumped VRAM write alpha channel - setIntRangeTweakOption(m_ui.tweakOptionTable, 16, + int i = 0; + + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable all enhancements + setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Show status indicators + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Show enhancement settings + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Controller enhanced mode (PS4/PS5) + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, 0); // Display FPS limit + setChoiceTweakOption(m_ui.tweakOptionTable, i++, 0); // Multisample antialiasing + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // PGXP vertex cache + setFloatRangeTweakOption(m_ui.tweakOptionTable, i++, -1.0f); // PGXP geometry tolerance + setFloatRangeTweakOption(m_ui.tweakOptionTable, i++, + Settings::DEFAULT_GPU_PGXP_DEPTH_THRESHOLD); // PGXP depth clear threshold + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Recompiler memory exceptions + setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Recompiler block linking + setChoiceTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_CPU_FASTMEM_MODE); // Recompiler fastmem mode + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Recompiler Icache + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // VRAM write texture replacement + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Preload texture replacements + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Dump replacable VRAM writes + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Set dumped VRAM write alpha channel + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD); // Minimum dumped VRAM width - setIntRangeTweakOption(m_ui.tweakOptionTable, 17, + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD); // Minimum dumped VRAm height - setIntRangeTweakOption(m_ui.tweakOptionTable, 18, + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, static_cast(Settings::DEFAULT_DMA_MAX_SLICE_TICKS)); // DMA max slice ticks - setIntRangeTweakOption(m_ui.tweakOptionTable, 19, + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, static_cast(Settings::DEFAULT_DMA_HALT_TICKS)); // DMA halt ticks - setIntRangeTweakOption(m_ui.tweakOptionTable, 20, static_cast(Settings::DEFAULT_GPU_FIFO_SIZE)); // GPU FIFO size - setIntRangeTweakOption(m_ui.tweakOptionTable, 21, + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, + static_cast(Settings::DEFAULT_GPU_FIFO_SIZE)); // GPU FIFO size + setIntRangeTweakOption(m_ui.tweakOptionTable, i++, static_cast(Settings::DEFAULT_GPU_MAX_RUN_AHEAD)); // GPU max run-ahead - setBooleanTweakOption(m_ui.tweakOptionTable, 22, false); // Use debug host GPU device - setBooleanTweakOption(m_ui.tweakOptionTable, 23, true); // Increase timer resolution - setBooleanTweakOption(m_ui.tweakOptionTable, 24, false); // Allow booting without SBI file - setBooleanTweakOption(m_ui.tweakOptionTable, 25, false); // Create save state backups + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Use debug host GPU device + setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Increase timer resolution + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Allow booting without SBI file + setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Create save state backups } \ No newline at end of file diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index b1fbe1fcc..d44ffa35f 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -3169,6 +3169,7 @@ void CommonHostInterface::SetDefaultSettings(SettingsInterface& si) si.SetStringValue("Main", "ControllerBackend", ControllerInterface::GetBackendName(ControllerInterface::GetDefaultBackend())); + si.SetBoolValue("Main", "ControllerEnhancedMode", false); si.SetBoolValue("Display", "InternalResolutionScreenshots", false); diff --git a/src/frontend-common/sdl_controller_interface.cpp b/src/frontend-common/sdl_controller_interface.cpp index 20e81dafa..1bacefc8a 100644 --- a/src/frontend-common/sdl_controller_interface.cpp +++ b/src/frontend-common/sdl_controller_interface.cpp @@ -39,6 +39,16 @@ bool SDLControllerInterface::Initialize(CommonHostInterface* host_interface) } } + const bool ds4_rumble_enabled = host_interface->GetBoolSettingValue("Main", "ControllerEnhancedMode", false); + if (ds4_rumble_enabled) + { + Log_InfoPrintf("Enabling PS4/PS5 enhanced mode."); + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4, "true"); + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "true"); + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5, "true"); + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "true"); + } + if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0) { Log_ErrorPrintf("SDL_InitSubSystem(SDL_INIT_JOYSTICK |SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) failed");