Compare commits

...

24 commits

Author SHA1 Message Date
Al. Lopez
a2f98428b0
Merge 2385bd435a into 3c1badf183 2025-08-04 12:28:48 -04:00
squidbus
3c1badf183
Enable D3D12 Agility SDK in plume submodule. (#1646)
Some checks failed
validate-internal / build (push) Has been cancelled
2025-08-04 15:39:26 +03:00
Al. Lopez
2385bd435a
Merge branch 'hedge-dev:main' into ControllerHotplugImprovements 2025-04-12 21:29:47 -04:00
Al. Lopez
6e7a2f6a13
Merge branch 'hedge-dev:main' into ControllerHotplugImprovements 2025-04-06 16:10:02 -04:00
Al. Lopez
b1d446cf2d
Merge branch 'hedge-dev:main' into ControllerHotplugImprovements 2025-03-29 21:17:08 -04:00
AL2009man
de94e9004f proper Daytime Lightbar and Player LED priority
This adds a else portion for the IsNight Lightbar code. This is done by replicating isNight's dimmer lights and apply it to the Day portion for consistency.

additionally: Player LED indicator should now play nicely when Player 0 (onboard inputs) and Player 1 (external) will respect it, although: you'll see the controller showing "Player 2" for a brief moment.
2025-03-24 01:07:45 -04:00
AL2009man
cebf5e6a1b remove code leftover
this is to ensure there isn't any conflictions with other PRs
2025-03-22 02:04:43 -04:00
AL2009man
8758808d6e Improved Virtual Gamepad and Lightbar/Player LED detection
When Player 0 (which is typically a Virtual Controller, or Onboard Inputs like Steam Deck under Steam Input mode): it'll attempt to provide or change Player LED numbers or lightbar (in DualShock 4's case). Now: Player LED Index color will only apply if it's explificially "Player 1" and not "Player 0".

it also improves PlayStation lightbar when hotswapping controllers. it should now follow Player 1's Lightbar (due to being tied to Player 1) instead of doing it's own thing. (You REALLY should check your connected controller!)
2025-03-22 01:52:32 -04:00
AL2009man
aedc26bf70 Rebase PR branch
to avoid conflictions with other PRs (https://github.com/hedge-dev/UnleashedRecomp/pull/1086 and https://github.com/hedge-dev/UnleashedRecomp/pull/1045): the remaining codebae was restore to how the master build look.

the downside is that it makes it far harder to test it's behavior with Steam Input mode. but this is only temporarily until it gets added to the Master branch.
2025-03-22 01:11:08 -04:00
Al. Lopez
bbad87a0ed
Merge branch 'hedge-dev:main' into ControllerHotplugImprovements 2025-03-12 01:07:03 -04:00
Al. Lopez
5fc38a1b81
Merge branch 'hedge-dev:main' into ControllerHotplugImprovements 2025-03-07 14:36:12 -05:00
AL2009man
75dacf5578 Lightbar active fix when gamepad plugged first prior to game launch
Another attempt to fix the lightbar by redoing the controller state mangement. For some reason: the Lightbar gets disabled when a controller is already plugged prior to game launch. It reverts back to normal until the next game event.
2025-03-06 20:44:15 -05:00
AL2009man
458938c2ae Attempt to reduce Input leaking
To avoid "the Controller is leaking" situation, there's now a Gamepad stat management that should reset Controller state based on connected controller.
2025-03-06 20:09:24 -05:00
AL2009man
a96fc60dcd Lightbar detection when using multiple PlayStation controllers at the same time.
An attempt to remedy the Lightbar activation. While Player 2/3/4 will override the in-game lightbar event upon connection: it'll later revert back to the in-game event.
2025-03-06 19:45:13 -05:00
AL2009man
c9b3a5e03f Initial Gamepad Hotplug Logic improvements
This changes the way how a Controller will be prioritized. By default: it'll always prioritize based on Player 1. It should play nicely with Steam Deck's internal inputs when Steam Input is active
2025-03-06 16:44:40 -05:00
Al. Lopez
a8cac8763d
Merge branch 'hedge-dev:main' into SDL2-Steam 2025-03-06 02:27:30 -05:00
AL2009man
ef4e37cb41 restoring notes for Button Labels. 2025-03-06 02:16:09 -05:00
Al. Lopez
bec2cf65ba added experimental Steam Virtual Gamepad support 2025-03-06 01:59:35 -05:00
Al. Lopez
43091838af
Merge branch 'hedge-dev:main' into main 2025-03-05 21:27:07 -05:00
Al. Lopez
90b35bc593 removing the workflows 2025-03-04 22:48:07 -05:00
Al. Lopez
9a181e0839
Create apply-patch.yml 2025-03-04 22:40:40 -05:00
Al. Lopez
176bb625e2
Create cmake-multi-platform.yml 2025-03-04 22:37:24 -05:00
Al. Lopez
07d193e229
Create c-cpp.yml 2025-03-04 22:37:09 -05:00
Al. Lopez
574afdf53d Experimenting Button Label
Experimenting a way to add a hint for Button Labels. It should attempt to fix the Nintendo Layout issue when using a Nintendo Switch controller
2025-03-04 17:03:02 -05:00
5 changed files with 128 additions and 101 deletions

View file

@ -23,10 +23,6 @@ if (APPLE)
enable_language(OBJC OBJCXX)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SDL_VULKAN_ENABLED ON CACHE BOOL "")
endif()
if (CMAKE_OSX_ARCHITECTURES)
set(UNLEASHED_RECOMP_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES})
elseif(CMAKE_SYSTEM_PROCESSOR)

View file

@ -352,23 +352,13 @@ if (UNLEASHED_RECOMP_FLATPAK)
)
endif()
if (UNLEASHED_RECOMP_D3D12)
find_package(directx-headers CONFIG REQUIRED)
find_package(directx12-agility CONFIG REQUIRED)
target_compile_definitions(UnleashedRecomp PRIVATE
UNLEASHED_RECOMP_D3D12
D3D12MA_USING_DIRECTX_HEADERS
D3D12MA_OPTIONS16_SUPPORTED
)
endif()
if (SDL_VULKAN_ENABLED)
target_compile_definitions(UnleashedRecomp PRIVATE SDL_VULKAN_ENABLED)
endif()
find_package(CURL REQUIRED)
if (UNLEASHED_RECOMP_D3D12)
find_package(directx-headers CONFIG REQUIRED)
find_package(directx12-agility CONFIG REQUIRED)
target_compile_definitions(UnleashedRecomp PRIVATE UNLEASHED_RECOMP_D3D12)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D3D12)
add_custom_command(TARGET UnleashedRecomp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:Microsoft::DirectX12-Core,IMPORTED_LOCATION_RELEASE> $<TARGET_FILE_DIR:UnleashedRecomp>/D3D12
@ -379,9 +369,6 @@ if (UNLEASHED_RECOMP_D3D12)
)
target_link_libraries(UnleashedRecomp PRIVATE
Microsoft::DirectX-Headers
Microsoft::DirectX-Guids
Microsoft::DirectX12-Agility
Microsoft::DirectXShaderCompiler
Microsoft::DXIL
dxgi

View file

@ -209,13 +209,29 @@ static void SetControllerInputDevice(Controller* controller)
}
}
static void SetControllerTimeOfDayLED(Controller& controller, bool isNight)
static void SetControllerTimeOfDayLED(Controller& ctrl, bool isNight)
{
auto r = isNight ? 22 : 0;
auto g = isNight ? 0 : 37;
auto b = isNight ? 101 : 184;
// Fetch the lightbar color based on the time of day
uint8_t r = 0, g = 0, b = 0;
controller.SetLED(r, g, b);
if (isNight)
{
r = 22; // Night: Red tone
g = 0; // Night: No green
b = 101; // Night: Cool blue
}
else
{
r = 0; // Day: No red
g = 0; // Day: No green
b = 60; // Day: Dimmer blue
}
// Apply the lightbar color to the specified controller
if (ctrl.CanPoll())
{
ctrl.SetLED(r, g, b);
}
}
int HID_OnSDLEvent(void*, SDL_Event* event)
@ -228,13 +244,32 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
if (freeIndex != -1)
{
// Initialize the new controller
auto controller = Controller(event->cdevice.which);
g_controllers[freeIndex] = controller;
SetControllerTimeOfDayLED(controller, App::s_isWerehog);
// Assign "Player 1 LED" for Player 0 and Player 1
if (freeIndex == 0 || freeIndex == 1) // Player 0 and Player 1 both use "Player 1 LED"
{
SDL_GameControllerSetPlayerIndex(controller.controller, 1); // Force Player LED to "Player 1"
}
else // Additional external controllers (Player 2+)
{
SDL_GameControllerSetPlayerIndex(controller.controller, freeIndex); // Assign correct LED for Player 2+
}
// Apply lightbar settings immediately for the new controller
SetControllerTimeOfDayLED(controller, App::s_isWerehog);
// Refresh LEDs for all connected controllers
for (auto& ctrl : g_controllers)
{
if (ctrl.CanPoll())
{
SDL_GameControllerSetPlayerIndex(ctrl.controller, ctrl.index); // Ensure correct LED updates
}
}
}
break;
}
@ -243,8 +278,43 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
auto* controller = FindController(event->cdevice.which);
if (controller)
{
controller->Close();
// If Player 1 disconnects, promote the next available controller to Player 1
if (controller == &g_controllers[1]) // Player 1 removed
{
for (auto& ctrl : g_controllers)
{
if (ctrl.CanPoll() && &ctrl != &g_controllers[0]) // Skip Player 0
{
g_controllers[1] = ctrl; // Promote next available controller to Player 1
SDL_GameControllerSetPlayerIndex(ctrl.controller, 1); // Reflect Player 1 LED
SetControllerTimeOfDayLED(ctrl, App::s_isWerehog); // Update lightbar
break;
}
}
}
// Update Player LED indices for all controllers immediately
for (std::size_t i = 2; i < g_controllers.size(); ++i) // Start from Player 2 onward
{
if (g_controllers[i].CanPoll())
{
SDL_GameControllerSetPlayerIndex(g_controllers[i].controller, static_cast<int>(i)); // Assign correct LED index
SetControllerTimeOfDayLED(g_controllers[i], App::s_isWerehog); // Update lightbars
}
}
// Refresh lightbar settings for all connected controllers
for (auto& ctrl : g_controllers)
{
if (ctrl.CanPoll())
{
SetControllerTimeOfDayLED(ctrl, App::s_isWerehog);
}
}
}
break;
}
@ -258,6 +328,7 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
if (!controller)
break;
// Process input
if (event->type == SDL_CONTROLLERAXISMOTION)
{
if (abs(event->caxis.value) > 8000)
@ -276,43 +347,8 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
controller->Poll();
}
break;
}
case SDL_KEYDOWN:
case SDL_KEYUP:
hid::g_inputDevice = hid::EInputDevice::Keyboard;
break;
case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
if (!GameWindow::IsFullscreen() || GameWindow::s_isFullscreenCursorVisible)
SDL_ShowCursor(SDL_ENABLE);
hid::g_inputDevice = hid::EInputDevice::Mouse;
break;
}
case SDL_WINDOWEVENT:
{
if (event->window.event == SDL_WINDOWEVENT_FOCUS_LOST)
{
// Stop vibrating controllers on focus lost.
for (auto& controller : g_controllers)
controller.SetVibration({ 0, 0 });
}
break;
}
case SDL_USER_EVILSONIC:
{
for (auto& controller : g_controllers)
SetControllerTimeOfDayLED(controller, event->user.code);
// Instantly apply updated lightbar settings during input
SetControllerTimeOfDayLED(*controller, App::s_isWerehog);
break;
}
}

View file

@ -15,6 +15,14 @@ set(SDL2MIXER_OPUS OFF)
set(SDL2MIXER_VORBIS "VORBISFILE")
set(SDL2MIXER_WAVPACK OFF)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SDL_VULKAN_ENABLED ON CACHE BOOL "")
endif()
if (WIN32)
set(D3D12_AGILITY_SDK_ENABLED ON CACHE BOOL "")
endif()
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/msdf-atlas-gen")
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/nativefiledialog-extended")
add_subdirectory("${UNLEASHED_RECOMP_THIRDPARTY_ROOT}/o1heap")

2
thirdparty/plume vendored

@ -1 +1 @@
Subproject commit fffeb35f836d8c945697ec82b735e77db401e2de
Subproject commit 11926860e878e68626ea99ec88562ce2b8badc4f