mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
The last platform that was missing this - it was held back waiting for the SDL 3.0 migration, which has now happened. Without it, whatever was held when the pad vanished stays held, which tends to walk the player off a cliff. Fixes #20418 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JvJR8oJNSCimCM9KXVLjfq
32 lines
776 B
C++
32 lines
776 B
C++
#pragma once
|
|
#include <SDL3/SDL.h>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include "Common/Input/InputState.h"
|
|
#include "Common/Input/KeyCodes.h"
|
|
#include "Common/Net/Resolve.h"
|
|
|
|
class SDLJoystick{
|
|
public:
|
|
SDLJoystick(bool init_SDL = false);
|
|
~SDLJoystick();
|
|
|
|
void registerEventHandler();
|
|
void ProcessInput(const SDL_Event &event);
|
|
|
|
private:
|
|
void setUpController(SDL_JoystickID deviceID);
|
|
void setUpControllers();
|
|
InputKeyCode getKeycodeForButton(SDL_GamepadButton button);
|
|
int getDeviceIndex(int instanceId);
|
|
void releaseAllKeys();
|
|
|
|
bool registeredAsEventHandler;
|
|
std::vector<SDL_Gamepad *> controllers;
|
|
std::map<int, int> controllerDeviceMap;
|
|
|
|
// Deduplicate axis events. Pair is device, axis.
|
|
std::map<std::pair<InputDeviceID, InputAxis>, float> prevAxisValue_;
|
|
};
|