diff --git a/rpcs3/Emu/Cell/Modules/cellRudp.cpp b/rpcs3/Emu/Cell/Modules/cellRudp.cpp index a68a30066d..0c5f83e51e 100644 --- a/rpcs3/Emu/Cell/Modules/cellRudp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellRudp.cpp @@ -7,7 +7,7 @@ LOG_CHANNEL(cellRudp); -struct rudp_t +struct rudp_info { // allocator functions std::function(ppu_thread& ppu, u32 size)> malloc; @@ -22,9 +22,9 @@ s32 cellRudpInit(vm::ptr allocator) { cellRudp.warning("cellRudpInit(allocator=*0x%x)", allocator); - const auto rudp = fxm::make(); + const auto rudp = g_fxo->get(); - if (!rudp) + if (rudp->malloc) { return CELL_RUDP_ERROR_ALREADY_INITIALIZED; } @@ -57,11 +57,17 @@ s32 cellRudpEnd() { cellRudp.warning("cellRudpEnd()"); - if (!fxm::remove()) + const auto rudp = g_fxo->get(); + + if (!rudp->malloc) { return CELL_RUDP_ERROR_NOT_INITIALIZED; } + rudp->malloc = nullptr; + rudp->free = nullptr; + rudp->handler = vm::null; + return CELL_OK; } @@ -75,9 +81,9 @@ s32 cellRudpSetEventHandler(vm::ptr handler, vm::ptr { cellRudp.todo("cellRudpSetEventHandler(handler=*0x%x, arg=*0x%x)", handler, arg); - const auto rudp = fxm::get(); + const auto rudp = g_fxo->get(); - if (!rudp) + if (!rudp->malloc) { return CELL_RUDP_ERROR_NOT_INITIALIZED; }