core: Some small pad stubs (#424)

* core: Some small pad stubs

* core: handle scePadSetLightBar wrong lightbar setting
This commit is contained in:
Dzmitry Dubrova 2024-08-16 20:11:55 +03:00 committed by GitHub
parent 1d1c88ad31
commit 9e810b7524
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 6 deletions

View File

@ -105,7 +105,7 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
pInfo->stickInfo.deadZoneRight = 2; pInfo->stickInfo.deadZoneRight = 2;
pInfo->connectionType = ORBIS_PAD_PORT_TYPE_STANDARD; pInfo->connectionType = ORBIS_PAD_PORT_TYPE_STANDARD;
pInfo->connectedCount = 1; pInfo->connectedCount = 1;
pInfo->connected = 1; pInfo->connected = true;
pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD; pInfo->deviceClass = ORBIS_PAD_DEVICE_CLASS_STANDARD;
return SCE_OK; return SCE_OK;
} }
@ -125,9 +125,16 @@ int PS4_SYSV_ABI scePadGetDeviceInfo() {
return ORBIS_OK; return ORBIS_OK;
} }
int PS4_SYSV_ABI scePadGetExtControllerInformation() { int PS4_SYSV_ABI scePadGetExtControllerInformation(s32 handle,
LOG_ERROR(Lib_Pad, "(STUBBED) called"); OrbisPadExtendedControllerInformation* pInfo) {
return ORBIS_OK; LOG_INFO(Lib_Pad, "called handle = {}", handle);
pInfo->padType1 = 0;
pInfo->padType2 = 0;
pInfo->capability = 0;
auto res = scePadGetControllerInformation(handle, &pInfo->base);
return res;
} }
int PS4_SYSV_ABI scePadGetExtensionUnitInfo() { int PS4_SYSV_ABI scePadGetExtensionUnitInfo() {
@ -237,7 +244,7 @@ int PS4_SYSV_ABI scePadOpen(s32 userId, s32 type, s32 index, const OrbisPadOpenP
int PS4_SYSV_ABI scePadOpenExt() { int PS4_SYSV_ABI scePadOpenExt() {
LOG_ERROR(Lib_Pad, "(STUBBED) called"); LOG_ERROR(Lib_Pad, "(STUBBED) called");
return ORBIS_OK; return 1; // dummy
} }
int PS4_SYSV_ABI scePadOpenExt2() { int PS4_SYSV_ABI scePadOpenExt2() {
@ -422,6 +429,12 @@ int PS4_SYSV_ABI scePadSetLightBar(s32 handle, const OrbisPadLightBarParam* pPar
if (pParam != nullptr) { if (pParam != nullptr) {
LOG_INFO(Lib_Pad, "scePadSetLightBar called handle = {} rgb = {} {} {}", handle, pParam->r, LOG_INFO(Lib_Pad, "scePadSetLightBar called handle = {} rgb = {} {} {}", handle, pParam->r,
pParam->g, pParam->b); pParam->g, pParam->b);
if (pParam->r < 0xD && pParam->g < 0xD && pParam->b < 0xD) {
LOG_INFO(Lib_Pad, "Invalid lightbar setting");
return ORBIS_PAD_ERROR_INVALID_LIGHTBAR_SETTING;
}
auto* controller = Common::Singleton<Input::GameController>::Instance(); auto* controller = Common::Singleton<Input::GameController>::Instance();
controller->SetLightBarRGB(pParam->r, pParam->g, pParam->b); controller->SetLightBarRGB(pParam->r, pParam->g, pParam->b);
return ORBIS_OK; return ORBIS_OK;

View File

@ -212,6 +212,19 @@ struct OrbisPadControllerInformation {
u8 reserve[8]; u8 reserve[8];
}; };
struct OrbisPadExtendedControllerInformation {
OrbisPadControllerInformation base;
u16 padType1;
u16 padType2;
u8 capability;
union {
u8 quantityOfSelectorSwitch;
int maxPhysicalWheelAngle;
u8 data[8];
};
};
struct OrbisPadOpenParam { struct OrbisPadOpenParam {
u8 reserve[8]; u8 reserve[8];
}; };
@ -248,7 +261,8 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn
int PS4_SYSV_ABI scePadGetDataInternal(); int PS4_SYSV_ABI scePadGetDataInternal();
int PS4_SYSV_ABI scePadGetDeviceId(); int PS4_SYSV_ABI scePadGetDeviceId();
int PS4_SYSV_ABI scePadGetDeviceInfo(); int PS4_SYSV_ABI scePadGetDeviceInfo();
int PS4_SYSV_ABI scePadGetExtControllerInformation(); int PS4_SYSV_ABI scePadGetExtControllerInformation(s32 handle,
OrbisPadExtendedControllerInformation* pInfo);
int PS4_SYSV_ABI scePadGetExtensionUnitInfo(); int PS4_SYSV_ABI scePadGetExtensionUnitInfo();
int PS4_SYSV_ABI scePadGetFeatureReport(); int PS4_SYSV_ABI scePadGetFeatureReport();
int PS4_SYSV_ABI scePadGetHandle(s32 userId, s32 type, s32 index); int PS4_SYSV_ABI scePadGetHandle(s32 userId, s32 type, s32 index);