Skip to content

Commit

Permalink
sys_net and cellRudp fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tambry committed Jul 16, 2015
1 parent 746be46 commit 67e647a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
10 changes: 7 additions & 3 deletions rpcs3/Emu/SysCalls/Modules/cellRudp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,19 @@ s32 cellRudpSetEventHandler(vm::ptr<CellRudpEventHandler> handler, vm::ptr<u32>
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;
}

Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
41 changes: 35 additions & 6 deletions rpcs3/Emu/SysCalls/Modules/sys_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char> buf, u32 len, s32 flags)
Expand Down Expand Up @@ -348,7 +348,7 @@ return CELL_OK;
return CELL_OK;
}

s32 socketselect(s32 nfds, vm::ptr<fd_set> readfds, vm::ptr<sys_net_fd_set> writefds, vm::ptr<sys_net_fd_set> exceptfds, vm::ptr<timeval> timeout)
s32 socketselect(s32 nfds, vm::ptr<sys_net_fd_set> readfds, vm::ptr<sys_net_fd_set> writefds, vm::ptr<sys_net_fd_set> exceptfds, vm::ptr<timeval> 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());
Expand All @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion rpcs3/Emu/SysCalls/Modules/sys_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ struct sys_net_sockaddr_in
u8 unused[8];
};

struct sys_net_in_addr
{
be_t<u32> sa_addr;
};

struct sys_net_fd_set
{
s32 fds_bits[8];
be_t<s32> fds_bits[8];
};

0 comments on commit 67e647a

Please sign in to comment.