From 67e647a2ca4836600bd6cd4073191720e6fa5d55 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Thu, 16 Jul 2015 20:28:47 +0300 Subject: [PATCH] sys_net and cellRudp fixes --- rpcs3/Emu/SysCalls/Modules/cellRudp.cpp | 10 +++-- rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/sys_net.cpp | 41 ++++++++++++++++++--- rpcs3/Emu/SysCalls/Modules/sys_net.h | 7 +++- 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp index 095e523fee..de1eb2cee1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRudp.cpp @@ -74,15 +74,19 @@ s32 cellRudpSetEventHandler(vm::ptr handler, vm::ptr return CELL_RUDP_ERROR_NOT_INITIALIZED; } - cellRudpInstance.argument = *arg.get_ptr(); + if (arg) + { + cellRudpInstance.argument = *arg.get_ptr(); + } + cellRudpInstance.handler = handler; return CELL_OK; } -s32 cellRudpSetMaxSegmentSize() +s32 cellRudpSetMaxSegmentSize(u16 mss) { - UNIMPLEMENTED_FUNC(cellRudp); + cellRudp.Todo("cellRudpSetMaxSegmentSize(mss=%d)", mss); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 166b40b6bb..474e400e99 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -389,7 +389,7 @@ never_inline s32 savedata_op( } statGet->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB - statGet->isNewData = save_entry.isNew = psf; + statGet->isNewData = save_entry.isNew = !psf; statGet->dir.atime = save_entry.atime = dir_info.atime; statGet->dir.mtime = save_entry.mtime = dir_info.mtime; diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index 9d689348a5..9fd1c508b5 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -268,7 +268,7 @@ namespace sys_net_func s32 recvmsg() { UNIMPLEMENTED_FUNC(sys_net); -return CELL_OK; + return CELL_OK; } s32 send(s32 s, vm::cptr buf, u32 len, s32 flags) @@ -348,7 +348,7 @@ return CELL_OK; return CELL_OK; } - s32 socketselect(s32 nfds, vm::ptr readfds, vm::ptr writefds, vm::ptr exceptfds, vm::ptr timeout) + s32 socketselect(s32 nfds, vm::ptr readfds, vm::ptr writefds, vm::ptr exceptfds, vm::ptr timeout) { sys_net.Todo("socketselect(nfds=%d, readfds_addr=0x%x, writefds_addr=0x%x, exceptfds_addr=0x%x, timeout_addr=0x%x)", nfds, readfds.addr(), writefds.addr(), exceptfds.addr(), timeout.addr()); @@ -359,20 +359,49 @@ return CELL_OK; if (readfds) { - memcpy(&_readfds, readfds.get_ptr(), sizeof(fd_set)); + for (int c = 0; c < 8; c++) + { +#ifdef _WIN32 + _readfds.fd_array[c] = readfds->fds_bits[c]; +#else + _readfds.fds_bits[c] = readfds->fds_bits[c]; +#endif + } } if (writefds) { - memcpy(&_writefds, writefds.get_ptr(), sizeof(fd_set)); + for (int c = 0; c < 8; c++) + { +#ifdef _WIN32 + _writefds.fd_array[c] = writefds->fds_bits[c]; +#else + _writefds.fds_bits[c] = writefds->fds_bits[c]; +#endif + } } if (exceptfds) { - memcpy(&_exceptfds, exceptfds.get_ptr(), sizeof(fd_set)); + for (int c = 0; c < 8; c++) + { +#ifdef _WIN32 + _exceptfds.fd_array[c] = exceptfds->fds_bits[c]; +#else + _exceptfds.fds_bits[c] = writefds->fds_bits[c]; +#endif + } } - s32 ret = ::select(nfds, readfds.get_ptr(), &_writefds, &_exceptfds, timeout.get_ptr()); + /*for (int c = 0; c < 8; c++) + { + if (!FD_ISSET(nfds, &_readfds.fd_array[c])) + { + sys_net.Error("!FD_ISSET: %d", c); + } + }*/ + + s32 ret = ::select(nfds, &_readfds, &_writefds, &_exceptfds, timeout.get_ptr()); *g_lastError = getLastError(); if (getLastError() >= 0) diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.h b/rpcs3/Emu/SysCalls/Modules/sys_net.h index 7d729504cd..09d39f0321 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.h +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.h @@ -26,7 +26,12 @@ struct sys_net_sockaddr_in u8 unused[8]; }; +struct sys_net_in_addr +{ + be_t sa_addr; +}; + struct sys_net_fd_set { - s32 fds_bits[8]; + be_t fds_bits[8]; }; \ No newline at end of file