2024-02-23 22:32:32 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2023-10-07 11:03:03 +02:00
|
|
|
#pragma once
|
2023-10-13 08:40:59 +02:00
|
|
|
|
2023-11-06 00:11:54 +01:00
|
|
|
#include "common/types.h"
|
2024-03-14 13:18:16 +01:00
|
|
|
#include "src/core/libraries/libsceuserservice.h"
|
2023-10-07 11:03:03 +02:00
|
|
|
|
2024-03-14 13:18:16 +01:00
|
|
|
namespace Core::Loader {
|
|
|
|
class SymbolsResolver;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace OldLibraries::LibPad {
|
2023-10-07 11:03:03 +02:00
|
|
|
|
2024-04-01 13:45:27 +02:00
|
|
|
#define ORBIS_PAD_PORT_TYPE_STANDARD 0
|
|
|
|
#define ORBIS_PAD_PORT_TYPE_SPECIAL 2
|
|
|
|
|
|
|
|
#define ORBIS_PAD_DEVICE_CLASS_PAD 0
|
|
|
|
#define ORBIS_PAD_DEVICE_CLASS_GUITAR 1
|
|
|
|
#define ORBIS_PAD_DEVICE_CLASS_DRUMS 2
|
|
|
|
|
|
|
|
#define ORBIS_PAD_CONNECTION_TYPE_STANDARD 0
|
|
|
|
#define ORBIS_PAD_CONNECTION_TYPE_REMOTE 2
|
|
|
|
|
2023-11-06 00:11:54 +01:00
|
|
|
enum ScePadButton : u32 {
|
|
|
|
L3 = 0x00000002,
|
|
|
|
R3 = 0x00000004,
|
|
|
|
OPTIONS = 0x00000008,
|
|
|
|
UP = 0x00000010,
|
|
|
|
RIGHT = 0x00000020,
|
|
|
|
DOWN = 0x00000040,
|
|
|
|
LEFT = 0x00000080,
|
|
|
|
L2 = 0x00000100,
|
|
|
|
R2 = 0x00000200,
|
|
|
|
L1 = 0x00000400,
|
|
|
|
R1 = 0x00000800,
|
|
|
|
TRIANGLE = 0x00001000,
|
|
|
|
CIRCLE = 0x00002000,
|
|
|
|
CROSS = 0x00004000,
|
|
|
|
SQUARE = 0x00008000,
|
|
|
|
TOUCH_PAD = 0x00100000,
|
|
|
|
INTERCEPTED = 0x80000000,
|
|
|
|
};
|
2023-10-13 08:40:59 +02:00
|
|
|
|
2023-10-09 19:39:12 +02:00
|
|
|
struct ScePadOpenParam {
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 reserve[8];
|
2023-10-09 19:39:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ScePadAnalogStick {
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 x;
|
|
|
|
u8 y;
|
2023-10-09 19:39:12 +02:00
|
|
|
};
|
|
|
|
struct ScePadAnalogButtons {
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 l2;
|
|
|
|
u8 r2;
|
|
|
|
u8 padding[2];
|
2023-10-09 19:39:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SceFQuaternion {
|
|
|
|
float x, y, z, w;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SceFVector3 {
|
|
|
|
float x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScePadTouch {
|
|
|
|
u16 x;
|
|
|
|
u16 y;
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 id;
|
|
|
|
u8 reserve[3];
|
2023-10-09 19:39:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
constexpr int SCE_PAD_MAX_TOUCH_NUM = 2;
|
|
|
|
|
|
|
|
typedef struct ScePadTouchData {
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 touchNum;
|
|
|
|
u8 reserve[3];
|
2023-10-09 19:39:12 +02:00
|
|
|
u32 reserve1;
|
|
|
|
ScePadTouch touch[SCE_PAD_MAX_TOUCH_NUM];
|
|
|
|
} ScePadTouchData;
|
|
|
|
|
|
|
|
struct ScePadExtensionUnitData {
|
|
|
|
u32 extensionUnitId;
|
2024-02-23 22:32:32 +01:00
|
|
|
u8 reserve[1];
|
|
|
|
u8 dataLength;
|
|
|
|
u8 data[10];
|
2023-10-09 19:39:12 +02:00
|
|
|
};
|
|
|
|
|
2023-10-07 11:03:03 +02:00
|
|
|
struct ScePadData {
|
|
|
|
u32 buttons;
|
2023-10-09 19:39:12 +02:00
|
|
|
ScePadAnalogStick leftStick;
|
|
|
|
ScePadAnalogStick rightStick;
|
|
|
|
ScePadAnalogButtons analogButtons;
|
|
|
|
SceFQuaternion orientation;
|
|
|
|
SceFVector3 acceleration;
|
|
|
|
SceFVector3 angularVelocity;
|
|
|
|
ScePadTouchData touchData;
|
2023-10-07 11:03:03 +02:00
|
|
|
bool connected;
|
|
|
|
u64 timestamp;
|
2023-10-09 19:39:12 +02:00
|
|
|
ScePadExtensionUnitData extensionUnitData;
|
|
|
|
uint8_t connectedCount;
|
|
|
|
uint8_t reserve[2];
|
|
|
|
uint8_t deviceUniqueDataLen;
|
|
|
|
uint8_t deviceUniqueData[12];
|
2023-10-07 11:03:03 +02:00
|
|
|
};
|
2023-11-06 00:11:54 +01:00
|
|
|
|
2024-04-01 13:45:27 +02:00
|
|
|
struct OrbisPadInformation {
|
|
|
|
float touchpadDensity;
|
|
|
|
u16 touchResolutionX;
|
|
|
|
u16 touchResolutionY;
|
|
|
|
u8 stickDeadzoneL;
|
|
|
|
u8 stickDeadzoneR;
|
|
|
|
u8 connectionType;
|
|
|
|
u8 count;
|
|
|
|
s8 connected;
|
|
|
|
s8 deviceClass;
|
|
|
|
u8 unknown[8];
|
|
|
|
};
|
|
|
|
|
2023-10-07 11:03:03 +02:00
|
|
|
int PS4_SYSV_ABI scePadInit();
|
2024-03-14 13:18:16 +01:00
|
|
|
int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userId, s32 type,
|
|
|
|
s32 index, const ScePadOpenParam* pParam);
|
2023-10-09 19:39:12 +02:00
|
|
|
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData);
|
2023-10-07 11:03:03 +02:00
|
|
|
|
2024-03-14 13:18:16 +01:00
|
|
|
void padSymbolsRegister(Core::Loader::SymbolsResolver* sym);
|
2023-11-06 00:11:54 +01:00
|
|
|
|
2024-03-14 13:18:16 +01:00
|
|
|
}; // namespace OldLibraries::LibPad
|