implement getSizeKB functions

bugfix in sys_net. id 0 is acceptable socket id
This commit is contained in:
Inviuz 2017-03-22 11:09:10 +01:00 committed by Ivan
parent cec75e8567
commit 149c08ba78
3 changed files with 37 additions and 9 deletions

View file

@ -181,9 +181,16 @@ s32 cellHddGameCheck2()
s32 cellHddGameGetSizeKB(vm::ptr<u32> size)
{
cellGame.todo("cellHddGameGetSizeKB(size=*0x%x)", size);
cellGame.warning("cellHddGameGetSizeKB(size=*0x%x)", size);
const std::string& local_dir = vfs::get("/dev_hdd0/game/" + Emu.GetTitleID());
if (!fs::is_dir(local_dir))
{
return CELL_HDDGAME_ERROR_FAILURE;
}
*size = (u32)fs::get_dir_size(local_dir);
*size = 0;
return CELL_OK;
}
@ -200,10 +207,18 @@ s32 cellHddGameExitBroken()
s32 cellGameDataGetSizeKB(vm::ptr<u32> size)
{
cellGame.todo("cellGameDataGetSizeKB(size=*0x%x)", size);
cellGame.warning("cellGameDataGetSizeKB(size=*0x%x)", size);
const std::string& local_dir = vfs::get("/dev_hdd0/game/" + Emu.GetTitleID());
if (!fs::is_dir(local_dir))
{
return CELL_GAMEDATA_ERROR_FAILURE;
}
*size = (u32)fs::get_dir_size(local_dir);
*size = 0;
return CELL_OK;
}
s32 cellGameDataSetSystemVer()
@ -701,9 +716,22 @@ error_code cellGameSetParamString(s32 id, vm::cptr<char> buf)
s32 cellGameGetSizeKB(vm::ptr<s32> size)
{
cellGame.todo("cellGameGetSizeKB(size=*0x%x)", size);
cellGame.warning("cellGameGetSizeKB(size=*0x%x)", size);
const auto prm = fxm::get<content_permission>();
if (!prm)
{
return CELL_GAME_ERROR_FAILURE;
}
const std::string& local_dir = prm->is_temporary? vfs::get("/dev_hdd1/game/"s + prm->dir) : vfs::get("/dev_hdd0/game/"s + prm->dir); //should we check the temporary folder?
if (!fs::is_dir(local_dir))
{
return CELL_GAME_ERROR_FAILURE;
}
*size = (u32)fs::get_dir_size(local_dir);
*size = 0;
return CELL_OK;
}

View file

@ -808,9 +808,9 @@ s32 cellGcmSetQueueHandler()
return CELL_OK;
}
s32 cellGcmSetSecondVHandler()
s32 cellGcmSetSecondVHandler(vm::ptr<void(u32)> handler)
{
UNIMPLEMENTED_FUNC(cellGcmSys);
cellGcmSys.todo("cellGcmSetSecondVHandler(handler=0x%x)", handler);
return CELL_OK;
}

View file

@ -444,7 +444,7 @@ namespace sys_net
memcpy(&_addr, addr.get_ptr(), sizeof(::sockaddr));
_addr.sa_family = addr->sa_family;
if (s <= 0) {
if (s < 0) {
libnet.error("recvfrom(): invalid socket %d", s);
return SYS_NET_EBADF;
}