Update scePadGetInfo (#4234)

* Add OrbisPadInfo struct and return correct controller colours

* oof
This commit is contained in:
kalaposfos13 2026-04-08 09:08:53 +02:00 committed by GitHub
parent e64f038ad6
commit c11fa6ff81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 10 deletions

View File

@ -177,19 +177,18 @@ int PS4_SYSV_ABI scePadGetIdleCount() {
return ORBIS_OK;
}
int PS4_SYSV_ABI scePadGetInfo(u32* data) {
int PS4_SYSV_ABI scePadGetInfo(OrbisPadInfo* data) {
LOG_WARNING(Lib_Pad, "(DUMMY) called");
if (!data) {
return ORBIS_PAD_ERROR_INVALID_ARG;
}
data[0] = 0x1; // index but starting from one?
data[1] = 0x0; // index?
data[2] = 1; // pad handle
data[3] = 0x0101; // ???
data[4] = 0x0; // ?
data[5] = 0x0; // ?
data[6] = 0x00ff0000; // colour(?)
data[7] = 0x0; // ?
auto& controllers = *Common::Singleton<GameControllers>::Instance();
auto col = controllers[0]->GetLightBarRGB();
std::memset(data, 0, sizeof(OrbisPadInfo));
data->unk1 = 0x1;
data->pad_handle = 1;
data->unk3 = 0x00000101;
data->colour = col.r + (col.g << 8) + (col.b << 16);
return ORBIS_OK;
}

View File

@ -253,6 +253,18 @@ struct OrbisPadVibrationParam {
u8 smallMotor;
};
struct OrbisPadInfo {
u32 unk1;
u32 unk2;
u32 pad_handle;
u32 unk3;
u32 unk4;
u32 unk5;
u32 colour;
u32 unk6;
u32 unk[30];
};
int PS4_SYSV_ABI scePadClose(s32 handle);
int PS4_SYSV_ABI scePadConnectPort();
int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation(
@ -280,7 +292,7 @@ int PS4_SYSV_ABI scePadGetFeatureReport();
int PS4_SYSV_ABI scePadGetHandle(Libraries::UserService::OrbisUserServiceUserId userId, s32 type,
s32 index);
int PS4_SYSV_ABI scePadGetIdleCount();
int PS4_SYSV_ABI scePadGetInfo(u32* data);
int PS4_SYSV_ABI scePadGetInfo(OrbisPadInfo* data);
int PS4_SYSV_ABI scePadGetInfoByPortType();
int PS4_SYSV_ABI scePadGetLicenseControllerInformation();
int PS4_SYSV_ABI scePadGetMotionSensorPosition();

View File

@ -157,6 +157,10 @@ void GameController::SetLightBarRGB(u8 r, u8 g, u8 b) {
}
}
Colour GameController::GetLightBarRGB() {
return colour;
}
void GameController::PollLightColour() {
if (m_sdl_gamepad != nullptr) {
SDL_SetGamepadLED(m_sdl_gamepad, colour.r, colour.g, colour.b);

View File

@ -126,6 +126,7 @@ public:
void UpdateAcceleration(const float acceleration[3]);
void UpdateAxisSmoothing();
void SetLightBarRGB(u8 r, u8 g, u8 b);
Colour GetLightBarRGB();
void PollLightColour();
bool SetVibration(u8 smallMotor, u8 largeMotor);
void SetTouchpadState(int touchIndex, bool touchDown, float x, float y);