mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-07 13:39:55 +00:00
fix(libSceVrSetupDialog): return INVALID_ARGUMENT from sceVrSetupDialogGetResult for unwritable result
This commit is contained in:
1 parent
c4469b60da
commit
b5eb0a44fb
3 files changed
+17
-2
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "prx/libSceVrSetupDialog/include/Api.hpp"
|
||||
#include <atomic>
|
||||
#include <cerrno>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
@@ -52,7 +53,11 @@ int APS5_VABI sceVrSetupDialogGetResult(std::int32_t* result) {
|
||||
if (result == nullptr) return VR_SETUP_DIALOG_ERROR_INVALID_ARGUMENT;
|
||||
const int status = g_status.load();
|
||||
if (status == COMMON_DIALOG_STATUS_NONE) return VR_SETUP_DIALOG_ERROR_NOT_INITIALIZED;
|
||||
*result = COMMON_DIALOG_RESULT_USER_CANCELED;
|
||||
const std::int32_t canceled = COMMON_DIALOG_RESULT_USER_CANCELED;
|
||||
const int savedErrno = errno;
|
||||
const bool copied = GuestCopyOut_nid_no_patch(result, &canceled, sizeof(canceled));
|
||||
errno = savedErrno;
|
||||
if (!copied) return VR_SETUP_DIALOG_ERROR_INVALID_ARGUMENT;
|
||||
if (status != COMMON_DIALOG_STATUS_FINISHED) return VR_SETUP_DIALOG_ERROR_BUSY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "prx/libSceVrSetupDialog/include/Api.hpp"
|
||||
#include "prx/libc/include/general/VabiMacros.hpp"
|
||||
#include <cerrno>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include "prx/libSceCommonDialog/CommonDialog.hpp"
|
||||
@@ -58,6 +59,9 @@ int main() {
|
||||
Require(sceVrSetupDialogGetResult(result) == kErrNotFinished);
|
||||
Require(result[0] == kResultUserCanceled);
|
||||
Require(result[1] == -1);
|
||||
errno = 71;
|
||||
Require(sceVrSetupDialogGetResult(reinterpret_cast<std::int32_t*>(0x10)) == kErrArgNull);
|
||||
Require(errno == 71);
|
||||
|
||||
param.size = sizeof(param) - 1;
|
||||
Require(sceVrSetupDialogOpen(¶m) == kErrArgNull);
|
||||
@@ -76,6 +80,9 @@ int main() {
|
||||
Require(sceVrSetupDialogUpdateStatus() == kStatusFinished);
|
||||
|
||||
Require(sceVrSetupDialogGetResult(nullptr) == kErrArgNull);
|
||||
errno = 71;
|
||||
Require(sceVrSetupDialogGetResult(reinterpret_cast<std::int32_t*>(0x10)) == kErrArgNull);
|
||||
Require(errno == 71);
|
||||
Require(sceVrSetupDialogGetResult(result) == 0);
|
||||
Require(result[0] == kResultUserCanceled);
|
||||
Require(result[1] == -1);
|
||||
@@ -106,6 +113,9 @@ int main() {
|
||||
Require(sceVrSetupDialogUpdateStatus() == kStatusInitialized);
|
||||
Require(sceVrSetupDialogGetResult(result) == kErrNotFinished);
|
||||
Require(result[0] == kResultUserCanceled && result[1] == -1);
|
||||
errno = 71;
|
||||
Require(sceVrSetupDialogGetResult(reinterpret_cast<std::int32_t*>(0x10)) == kErrArgNull);
|
||||
Require(errno == 71);
|
||||
Require(sceVrSetupDialogTerminate() == 0);
|
||||
Require(sceVrSetupDialogTerminate() == kErrNotInitialized);
|
||||
Require(sceVrSetupDialogOpen(nullptr) == kErrArgNull);
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
### Silent stubs
|
||||
|
||||
- [libSceVrSetupDialog](../../../core/libs/prx/libSceVrSetupDialog/Export.cpp) - the VR setup dialog runs the common-dialog state machine but shows nothing and reports the user as having cancelled, as no headset is supported (see libSceHmd2). Initialization does not check the native process eligibility record, and the 46-byte setup payload remains opaque. Open validates the recovered 56-byte parameter header. GetResult writes one 32-bit result after initialization, including when returning the not-finished error; its error codes and validation order are recovered.
|
||||
- [libSceVrSetupDialog](../../../core/libs/prx/libSceVrSetupDialog/Export.cpp) - the VR setup dialog runs the common-dialog state machine but shows nothing and reports the user as having cancelled, as no headset is supported (see libSceHmd2). Initialization does not check the native process eligibility record, and the 46-byte setup payload remains opaque. Open validates the recovered 56-byte parameter header. GetResult writes one 32-bit result after initialization, including when returning the not-finished error; its error codes and validation order are recovered. Returning `0x8A7C0003` for an unwritable result pointer is a host-safety fallback with console behavior unmeasured.
|
||||
Reference in new issue
Block a user