Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded SDL controller mapping from UWP build #6965

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions uwp-project/src/SDL_winrt_main_NonXAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <SDL.h>
#include <diablo.h>
#include <wrl.h>
#include <iostream>
#include <string>

/* At least one file in any SDL/WinRT app appears to require compilation
with C++/CX, otherwise a Windows Metadata file won't get created, and
Expand Down Expand Up @@ -60,26 +58,6 @@ void OnBackRequested(Platform::Object^, Windows::UI::Core::BackRequestedEventArg
void onInitialized()
{
Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += ref new Windows::Foundation::EventHandler<Windows::UI::Core::BackRequestedEventArgs^>(OnBackRequested);

// workaround untill new config is released
std::string controllerMapping = ",*,a:b1,b:b0,x:b3,y:b2,back:b6,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:b10,dpdown:b12,dpleft:b13,dpright:b11,leftx:a1,lefty:a0~,rightx:a3,righty:a2~,lefttrigger:a4,righttrigger:a5,platform:WinRT";

for(int i = 0; i < SDL_NumJoysticks(); ++i)
{
SDL_JoystickType type = SDL_JoystickGetDeviceType(i);

if(type == SDL_JOYSTICK_POWER_UNKNOWN)
continue;

SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(i);

if(!guid.data)
continue;

char guidString[33];
SDL_JoystickGetGUIDString(guid, guidString, 33);
SDL_GameControllerAddMapping((guidString + controllerMapping).c_str());
}
}

int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
Expand Down
Loading