mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-30 12:25:49 +00:00
feat(libSceHmd): report the headset disconnected from sceHmdGetAssyError
This commit is contained in:
1 parent
fe6aba89a8
commit
a569d075ec
3 files changed
+14
-3
No files matched your search
@@ -498,9 +498,9 @@ int APS5_VABI sceHmdInternalIsGameVr2d(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceHmdGetAssyError(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
int APS5_VABI sceHmdGetAssyError(void* data) {
|
||||
if (!data) return Hmd::ParameterNull;
|
||||
return initialized.load() ? Hmd::DeviceDisconnected : Hmd::NotInitialized;
|
||||
}
|
||||
|
||||
int APS5_VABI sceHmdReprojectionFinalize(void) {
|
||||
|
||||
@@ -72,6 +72,7 @@ int APS5_VABI sceHmdReprojectionQueryOnionBuffSize(void);
|
||||
int APS5_VABI sceHmdGetFieldOfView(std::int32_t handle, void* fieldOfView);
|
||||
int APS5_VABI sceHmdGet2DEyeOffset(std::int32_t handle, void* leftOffset, void* rightOffset);
|
||||
int APS5_VABI sceHmdGetInertialSensorData(std::int32_t handle, void* data, std::int32_t count);
|
||||
int APS5_VABI sceHmdGetAssyError(void* data);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -53,6 +53,14 @@ void CheckHandleQueries(std::int32_t expected) {
|
||||
for (const auto byte : sensor) Require(byte == 0x5a, "a refused sensor query wrote its output");
|
||||
}
|
||||
|
||||
void CheckAssyError(std::int32_t expected) {
|
||||
unsigned char data[32];
|
||||
std::memset(data, 0x5a, sizeof(data));
|
||||
Require(sceHmdGetAssyError(nullptr) == Hmd::ParameterNull, "null assembly error output accepted");
|
||||
Require(sceHmdGetAssyError(data) == expected, "assembly error query without a headset");
|
||||
for (const auto byte : data) Require(byte == 0x5a, "a refused assembly error query wrote its output");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
@@ -70,6 +78,7 @@ int main() {
|
||||
Require(sceHmdGetDeviceInformation(&info) == Hmd::NotInitialized, "query before initialize");
|
||||
Require(std::memcmp(&info, &untouched, sizeof(info)) == 0, "failed query modified output");
|
||||
CheckHandleQueries(Hmd::NotInitialized);
|
||||
CheckAssyError(Hmd::NotInitialized);
|
||||
Require(sceHmdGetDeviceInformationByHandle(0, &info) == Hmd::NotInitialized,
|
||||
"handle query before initialize");
|
||||
Require(sceHmdInitialize(nullptr) == Hmd::ParameterNull, "null initialize");
|
||||
@@ -107,6 +116,7 @@ int main() {
|
||||
Require(std::memcmp(&info, &expected, sizeof(info)) == 0, "invalid handle modified output");
|
||||
}
|
||||
CheckHandleQueries(Hmd::InvalidHandle);
|
||||
CheckAssyError(Hmd::DeviceDisconnected);
|
||||
Require(sceHmdGetDeviceInformationByHandle(0, nullptr) == Hmd::InvalidHandle,
|
||||
"null query accepted invalid handle");
|
||||
Require(sceHmdTerminate() == 0, "terminate failed");
|
||||
|
||||
Reference in new issue
Block a user