mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-10-14 14:30:12 +02:00
RMG-Input: use SDL GUID (#518)
This commit is contained in:
1 parent
90ab075de4
commit
aadb31cd53
13 files changed
+93
-13
No files matched your search
@@ -13,6 +13,8 @@
|
||||
#include <RMG-Core/m64p/api/m64p_types.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "../Utilities/Sdl3GuidWithIndex.hpp"
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
SDLThread::SDLThread(QObject *parent) : QThread(parent)
|
||||
@@ -68,8 +70,11 @@ void SDLThread::run(void)
|
||||
QString name;
|
||||
QString path;
|
||||
QString serial;
|
||||
QString guid;
|
||||
QString errorMessage;
|
||||
|
||||
std::vector<std::string> guidsWithoutIndex;
|
||||
|
||||
SDL_Gamepad* controller;
|
||||
SDL_Joystick* joystick;
|
||||
|
||||
@@ -103,6 +108,7 @@ void SDLThread::run(void)
|
||||
name = SDL_GetGamepadName(controller);
|
||||
path = SDL_GetGamepadPath(controller);
|
||||
serial = SDL_GetGamepadSerial(controller);
|
||||
guid = QString::fromStdString(Utilities::Sdl3GuidWithIndex(guidsWithoutIndex, joystickId));
|
||||
SDL_CloseGamepad(controller);
|
||||
}
|
||||
else
|
||||
@@ -118,12 +124,13 @@ void SDLThread::run(void)
|
||||
name = SDL_GetJoystickName(joystick);
|
||||
path = SDL_GetJoystickPath(joystick);
|
||||
serial = SDL_GetJoystickSerial(joystick);
|
||||
guid = QString::fromStdString(Utilities::Sdl3GuidWithIndex(guidsWithoutIndex, joystickId));
|
||||
SDL_CloseJoystick(joystick);
|
||||
}
|
||||
|
||||
if (name != nullptr)
|
||||
{
|
||||
emit this->OnInputDeviceFound(name, path, serial, joystickId);
|
||||
emit this->OnInputDeviceFound(name, path, serial, guid, joystickId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user