Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

Commit d23dd19

Browse files
committed
Pad: Enhance controller settings and improve null safety
- Corrected capitalization of "Xbox" in XInput source description. - Improved null pointer safety in InputManager.cpp by adding checks before method calls on input sources.
1 parent d562af3 commit d23dd19

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

pcsx2-winrt/Package.appxmanifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<rescap:Capability Name="runFullTrust"/>
3535
<rescap:Capability Name="broadFileSystemAccess" />
3636
<rescap:Capability Name="expandedResources" />
37+
<rescap:Capability Name="hevcPlayback" />
3738
<uap:Capability Name="removableStorage"/>
3839
<Capability Name="internetClient" />
3940
<Capability Name="codeGeneration"/>

pcsx2/ImGui/FullscreenUI.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4633,7 +4633,7 @@ void FullscreenUI::DrawControllerSettingsPage()
46334633
{
46344634
DoSaveInputProfile();
46354635
}
4636-
4636+
#ifndef WINRT_XBOX
46374637
MenuHeading("Input Sources");
46384638
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable SDL Input Source"),
46394639
FSUI_CSTR("The SDL input source supports most controllers."), "InputSources", "SDL", true, true, false);
@@ -4647,9 +4647,10 @@ void FullscreenUI::DrawControllerSettingsPage()
46474647
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "SDL Raw Input"), FSUI_CSTR("Allow SDL to use raw access to input devices."),
46484648
"InputSources", "SDLRawInput", false, bsi->GetBoolValue("InputSources", "SDL", true), false);
46494649
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable XInput Input Source"),
4650-
FSUI_CSTR("The XInput source provides support for XBox 360/XBox One/XBox Series controllers."), "InputSources", "XInput", false,
4650+
FSUI_CSTR("The XInput source provides support for Xbox 360/Xbox One/Xbox Series controllers."), "InputSources", "XInput", false,
46514651
true, false);
4652-
#endif
4652+
#endif // _WIN32
4653+
#endif // WINRT_XBOX
46534654
MenuHeading(FSUI_CSTR("Multitap"));
46544655
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_PLUS_SQUARE, "Enable Console Port 1 Multitap"),
46554656
FSUI_CSTR("Enables an additional three controller slots. Not supported in all games."), "Pad", "MultitapPort1", false, true, false);

pcsx2/Input/InputManager.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ void InputManager::CloseSources()
16201620
{
16211621
for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++)
16221622
{
1623-
if (s_input_sources[i]->IsInitialized())
1623+
if (s_input_sources[i] && s_input_sources[i]->IsInitialized())
16241624
{
16251625
s_input_sources[i]->Shutdown();
16261626
}
@@ -1654,7 +1654,7 @@ std::vector<std::pair<std::string, std::string>> InputManager::EnumerateDevices(
16541654

16551655
for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++)
16561656
{
1657-
if (s_input_sources[i]->IsInitialized())
1657+
if (s_input_sources[i] != nullptr && s_input_sources[i]->IsInitialized())
16581658
{
16591659
std::vector<std::pair<std::string, std::string>> devs(s_input_sources[i]->EnumerateDevices());
16601660
if (ret.empty())
@@ -1673,7 +1673,7 @@ std::vector<InputBindingKey> InputManager::EnumerateMotors()
16731673

16741674
for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++)
16751675
{
1676-
if (s_input_sources[i]->IsInitialized())
1676+
if (s_input_sources[i] != nullptr && s_input_sources[i]->IsInitialized())
16771677
{
16781678
std::vector<InputBindingKey> devs(s_input_sources[i]->EnumerateMotors());
16791679
if (ret.empty())
@@ -1733,8 +1733,12 @@ InputManager::GenericInputBindingMapping InputManager::GetGenericBindingMapping(
17331733
{
17341734
for (u32 i = FIRST_EXTERNAL_INPUT_SOURCE; i < LAST_EXTERNAL_INPUT_SOURCE; i++)
17351735
{
1736-
if (s_input_sources[i]->IsInitialized() && s_input_sources[i]->GetGenericBindingMapping(device, &mapping))
1736+
if (s_input_sources[i] != nullptr &&
1737+
s_input_sources[i]->IsInitialized() &&
1738+
s_input_sources[i]->GetGenericBindingMapping(device, &mapping))
1739+
{
17371740
break;
1741+
}
17381742
}
17391743
}
17401744

0 commit comments

Comments
 (0)