diff --git a/rpcs3/Emu/Cell/lv2/sys_event.cpp b/rpcs3/Emu/Cell/lv2/sys_event.cpp index 4713809bfb..a1457da750 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_event.cpp @@ -11,6 +11,16 @@ LOG_CHANNEL(sys_event); +lv2_event_queue::lv2_event_queue(u32 protocol, s32 type, u64 name, u64 ipc_key, s32 size) noexcept + : protocol{protocol} + , id(idm::last_id()) + , type(type) + , name(name) + , key(ipc_key) + , size(size) +{ +} + std::shared_ptr lv2_event_queue::find(u64 ipc_key) { if (ipc_key == SYS_EVENT_QUEUE_LOCAL) @@ -112,7 +122,7 @@ error_code sys_event_queue_create(cpu_thread& cpu, vm::ptr equeue_id, vm::p } const u32 pshared = ipc_key == SYS_EVENT_QUEUE_LOCAL ? SYS_SYNC_NOT_PROCESS_SHARED : SYS_SYNC_PROCESS_SHARED; - constexpr u32 flags = SYS_SYNC_NEWLY_CREATED; // NOTE: This is inaccurate for multi-process + constexpr u32 flags = SYS_SYNC_NEWLY_CREATED; const u64 name = attr->name_u64; if (const auto error = lv2_obj::create(pshared, ipc_key, flags, [&]() @@ -409,7 +419,6 @@ error_code sys_event_port_connect_local(cpu_thread& cpu, u32 eport_id, u32 equeu } port->queue = idm::get_unlocked(equeue_id); - port->queue_id = equeue_id; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_event.h b/rpcs3/Emu/Cell/lv2/sys_event.h index 0977079813..c939b08f56 100644 --- a/rpcs3/Emu/Cell/lv2/sys_event.h +++ b/rpcs3/Emu/Cell/lv2/sys_event.h @@ -81,6 +81,7 @@ struct lv2_event_queue final : public lv2_obj static const u32 id_base = 0x8d000000; const lv2_protocol protocol; + const u32 id; const s32 type; const u64 name; const u64 key; @@ -90,14 +91,7 @@ struct lv2_event_queue final : public lv2_obj std::deque events; std::deque sq; - lv2_event_queue(u32 protocol, s32 type, u64 name, u64 ipc_key, s32 size) - : protocol{protocol} - , type(type) - , name(name) - , key(ipc_key) - , size(size) - { - } + lv2_event_queue(u32 protocol, s32 type, u64 name, u64 ipc_key, s32 size) noexcept; CellError send(lv2_event); @@ -120,7 +114,6 @@ struct lv2_event_port final : lv2_obj const s32 type; // Port type, either IPC or local const u64 name; // Event source (generated from id and process id if not set) - u32 queue_id = 0; // Event queue ID (if IPC is used this value is meaningless) std::shared_ptr queue; // Event queue this port is connected to diff --git a/rpcs3/Emu/Cell/lv2/sys_sync.h b/rpcs3/Emu/Cell/lv2/sys_sync.h index 1f33670959..997af54ad9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_sync.h +++ b/rpcs3/Emu/Cell/lv2/sys_sync.h @@ -224,13 +224,13 @@ public: default: return CELL_EINVAL; } - std::shared_ptr result = make(); - // EAGAIN for IDM IDs shortage CellError error = CELL_EAGAIN; if (!idm::import([&]() -> std::shared_ptr { + std::shared_ptr result = make(); + auto finalize_construct = [&]() -> std::shared_ptr { if ((error = result->on_id_create())) diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index 847ccf443a..b476f99044 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -372,18 +372,15 @@ void kernel_explorer::Update() if (const auto queue = ep.queue.get(); queue && queue->exists) { - if (queue == idm::check_unlocked(ep.queue_id)) + if (queue == idm::check_unlocked(queue->id)) { - // Type must be LOCAL here, but refer to the note below for why it is showed - add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (ID): 0x%08x", id, type, ep.name, ep.queue_id))); + add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (ID): 0x%08x", id, type, ep.name, queue->id))); break; } + // This code is unused until multi-process is implemented if (queue == lv2_event_queue::find(queue->key).get()) { - // There are cases in which the attached queue by ID also has an IPC - // And the ID was destroyed but another was created for that same IPC - // So show event port type as well here because it not guaranteed to be IPC add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (IPC): %s", id, type, ep.name, queue->key))); break; }