fix(libSceMove): refuse a second open of the same controller with ALREADY_OPENED

This commit is contained in:
Yossi Yadgar committed 2026-10-20 10:02:04 +03:00
1 parent 808d67e715
commit c478789949
2 files changed
+5 -2

No files matched your search

+2 -1
View File
@@ -14,6 +14,7 @@ constexpr int MOVE_ERROR_NOT_INIT = static_cast<int>(0x80EE0001);
constexpr int MOVE_ERROR_ALREADY_INIT = static_cast<int>(0x80EE0002);
constexpr int MOVE_ERROR_INVALID_ARG = static_cast<int>(0x80EE0003);
constexpr int MOVE_ERROR_INVALID_HANDLE = static_cast<int>(0x80EE0004);
constexpr int MOVE_ERROR_ALREADY_OPENED = static_cast<int>(0x80EE0007);
constexpr int32_t MOVE_FIRST_HANDLE = 0x30B0100;
constexpr int32_t MOVE_HANDLE_STEP = 0x100;
@@ -57,7 +58,7 @@ int APS5_VABI sceMoveOpen(int32_t userId, int32_t type, int32_t index) {
if (!initialized) return MOVE_ERROR_NOT_INIT;
if (userId != USER_SERVICE_INITIAL_USER_ID) NotImplemented_nid_no_patch(__func__);
for (const auto& [openHandle, slot] : openHandles) {
if (slot.type == type && slot.index == index) NotImplemented_nid_no_patch(__func__);
if (slot.type == type && slot.index == index) return MOVE_ERROR_ALREADY_OPENED;
}
const int32_t handle = nextHandle;
nextHandle += MOVE_HANDLE_STEP;
+3 -1
View File
@@ -28,6 +28,7 @@ constexpr int kNotInit = static_cast<int>(0x80EE0001);
constexpr int kAlreadyInit = static_cast<int>(0x80EE0002);
constexpr int kInvalidArg = static_cast<int>(0x80EE0003);
constexpr int kInvalidHandle = static_cast<int>(0x80EE0004);
constexpr int kAlreadyOpened = static_cast<int>(0x80EE0007);
constexpr std::int32_t kUserId = 0x10000000;
constexpr std::int32_t kFirstHandle = 0x30B0100;
constexpr std::int32_t kHandleStep = 0x100;
@@ -104,7 +105,8 @@ int main() {
const std::int32_t second = sceMoveOpen(kUserId, 0, 1);
Require(first == kFirstHandle);
Require(second == kFirstHandle + kHandleStep);
Require(Throws([] { sceMoveOpen(kUserId, 0, 0); }));
Require(sceMoveOpen(kUserId, 0, 0) == kAlreadyOpened);
Require(sceMoveOpen(kUserId, 0, 1) == kAlreadyOpened);
Require(Throws([] { sceMoveOpen(kUserId + 1, 0, 2); }));
Require(sceMoveGetDeviceInfo(first, nullptr) == kInvalidArg);