mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-15 22:21:25 +00:00
cellRudp improvements and fixes
This commit is contained in:
parent
93e850404e
commit
82733e1943
@ -144,7 +144,7 @@ static const g_module_list[] =
|
||||
{ 0x0053, "cellMusicDecode2", nullptr },
|
||||
{ 0x0055, "cellSync2", &cellSync2 },
|
||||
{ 0x0056, "sceNpUtil", nullptr },
|
||||
{ 0x0057, "cellRudp", nullptr },
|
||||
{ 0x0057, "cellRudp", &cellRudp },
|
||||
{ 0x0059, "sceNpSns", &sceNpSns },
|
||||
{ 0x005a, "cellGem", &cellGem },
|
||||
{ 0xf00a, "cellCelpEnc", nullptr },
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
|
||||
#include "sys_net.h"
|
||||
#include "cellRudp.h"
|
||||
|
||||
extern Module cellRudp;
|
||||
@ -9,6 +11,9 @@ extern Module cellRudp;
|
||||
struct cellRudpInternal
|
||||
{
|
||||
bool m_bInitialized;
|
||||
CellRudpAllocator allocator;
|
||||
vm::ptr<CellRudpEventHandler> handler;
|
||||
u32 argument;
|
||||
|
||||
cellRudpInternal()
|
||||
: m_bInitialized(false)
|
||||
@ -20,10 +25,18 @@ cellRudpInternal cellRudpInstance;
|
||||
|
||||
s32 cellRudpInit(vm::ptr<CellRudpAllocator> allocator)
|
||||
{
|
||||
cellRudp.Warning("cellRudpInit()");
|
||||
cellRudp.Warning("cellRudpInit(allocator_addr=0x%x)", allocator.addr());
|
||||
|
||||
if (cellRudpInstance.m_bInitialized)
|
||||
{
|
||||
cellRudp.Error("cellRudpInit(): cellRudp has already been initialized.");
|
||||
return CELL_RUDP_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
if (allocator)
|
||||
{
|
||||
cellRudpInstance.allocator = *allocator.get_ptr();
|
||||
}
|
||||
|
||||
cellRudpInstance.m_bInitialized = true;
|
||||
|
||||
@ -32,10 +45,13 @@ s32 cellRudpInit(vm::ptr<CellRudpAllocator> allocator)
|
||||
|
||||
s32 cellRudpEnd()
|
||||
{
|
||||
cellRudp.Log("cellRudpInit()");
|
||||
cellRudp.Log("cellRudpEnd()");
|
||||
|
||||
if (!cellRudpInstance.m_bInitialized)
|
||||
{
|
||||
cellRudp.Error("cellRudpEnd(): cellRudp has not been initialized.");
|
||||
return CELL_RUDP_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
cellRudpInstance.m_bInitialized = false;
|
||||
|
||||
@ -48,9 +64,19 @@ s32 cellRudpEnableInternalIOThread()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellRudpSetEventHandler()
|
||||
s32 cellRudpSetEventHandler(vm::ptr<CellRudpEventHandler> handler, vm::ptr<u32> arg)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellRudp);
|
||||
cellRudp.Todo("cellRudpSetEventHandler(handler=0x%x, arg_addr=0x%x)", handler, arg.addr());
|
||||
|
||||
if (!cellRudpInstance.m_bInitialized)
|
||||
{
|
||||
cellRudp.Error("cellRudpInit(): cellRudp has not been initialized.");
|
||||
return CELL_RUDP_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
cellRudpInstance.argument = *arg.get_ptr();
|
||||
cellRudpInstance.handler = handler;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,39 @@ enum
|
||||
CELL_RUDP_ERROR_KEEP_ALIVE_FAILURE = 0x80770026,
|
||||
};
|
||||
|
||||
// Context options
|
||||
enum
|
||||
{
|
||||
CELL_RUDP_OPTION_MAX_PAYLOAD = 1,
|
||||
CELL_RUDP_OPTION_SNDBUF = 2,
|
||||
CELL_RUDP_OPTION_RCVBUF = 3,
|
||||
CELL_RUDP_OPTION_NODELAY = 4,
|
||||
CELL_RUDP_OPTION_DELIVERY_CRITICAL = 5,
|
||||
CELL_RUDP_OPTION_ORDER_CRITICAL = 6,
|
||||
CELL_RUDP_OPTION_NONBLOCK = 7,
|
||||
CELL_RUDP_OPTION_STREAM = 8,
|
||||
CELL_RUDP_OPTION_CONNECTION_TIMEOUT = 9,
|
||||
CELL_RUDP_OPTION_CLOSE_WAIT_TIMEOUT = 10,
|
||||
CELL_RUDP_OPTION_AGGREGATION_TIMEOUT = 11,
|
||||
CELL_RUDP_OPTION_LAST_ERROR = 14,
|
||||
CELL_RUDP_OPTION_READ_TIMEOUT = 15,
|
||||
CELL_RUDP_OPTION_WRITE_TIMEOUT = 16,
|
||||
CELL_RUDP_OPTION_FLUSH_TIMEOUT = 17,
|
||||
CELL_RUDP_OPTION_KEEP_ALIVE_INTERVAL = 18,
|
||||
CELL_RUDP_OPTION_KEEP_ALIVE_TIMEOUT = 19,
|
||||
};
|
||||
|
||||
// Polling event flags
|
||||
enum
|
||||
{
|
||||
CELL_RUDP_POLL_EV_READ = 0x0001,
|
||||
CELL_RUDP_POLL_EV_WRITE = 0x0002,
|
||||
CELL_RUDP_POLL_EV_FLUSH = 0x0004,
|
||||
CELL_RUDP_POLL_EV_ERROR = 0x0008,
|
||||
};
|
||||
|
||||
typedef s32(CellRudpEventHandler)(s32 event_id, s32 soc, vm::cptr<u8> data, u32 datalen, vm::cptr<sys_net_sockaddr> addr, u32 addrlen, vm::ptr<u32> arg);
|
||||
|
||||
using CellRudpAllocatorFuncAlloc = func_def<vm::ptr<u32>(u32 size)>;
|
||||
using CellRudpAllocatorFuncFree = func_def<u32(vm::ptr<u32> ptr)>;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user