sys_net and cellRudp fixes

This commit is contained in:
Raul Tambre 2015-07-16 20:28:47 +03:00
parent 746be46f1e
commit 67e647a2ca
4 changed files with 49 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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)
@ -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());
@ -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)

View File

@ -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];
};