various memory access violation fixes (and friends) (#3930)

* various memory access violation fixes

* Another fix, for motorstorm demo

* Better stub cellGameUpdateCheckStartAsync and FinishAsync, Fixes #3934
This commit is contained in:
Zion 2017-12-15 16:03:49 -08:00 committed by Ivan
parent a122924c8e
commit 17bfb3beaf
4 changed files with 42 additions and 17 deletions

View file

@ -246,6 +246,8 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
size->sysSizeKB = 0;
}
if (!type)
return CELL_GAME_ERROR_PARAM;
// According to testing (in debug mode) cellGameBootCheck doesn't return an error code, when PARAM.SFO doesn't exist.
psf::registry sfo = psf::load_object(fs::file(vfs::get("/app_home/../PARAM.SFO")));

View file

@ -266,15 +266,26 @@ error_code cellGameUpdateTerm()
return CELL_OK;
}
error_code cellGameUpdateCheckStartAsync(vm::cptr<CellGameUpdateParam> param, vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
error_code cellGameUpdateCheckStartAsync(ppu_thread& ppu, vm::cptr<CellGameUpdateParam> param, vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
{
cellNetCtl.todo("cellGameUpdateCheckStartAsync(param=*0x%x, cb_func=*0x%x, userdata=*0x%x)", param, cb_func, userdata);
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
cb_func(ppu, CELL_OK, CELL_OK, userdata);
return CELL_OK;
});
return CELL_OK;
}
error_code cellGameUpdateCheckFinishAsync(vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
error_code cellGameUpdateCheckFinishAsync(ppu_thread& ppu, vm::ptr<CellGameUpdateCallback> cb_func, vm::ptr<void> userdata)
{
cellNetCtl.todo("cellGameUpdateCheckFinishAsync(cb_func=*0x%x, userdata=*0x%x)", cb_func, userdata);
const u32 PROCESSING_COMPLETE = 5;
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
cb_func(ppu, PROCESSING_COMPLETE, CELL_OK, userdata);
return CELL_OK;
});
return CELL_OK;
}

View file

@ -40,6 +40,9 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
id = 1;
}
if (!stat)
return CELL_USERINFO_ERROR_PARAM;
const std::string& path = vfs::get(fmt::format("/dev_hdd0/home/%08d/", id));
if (!fs::is_dir(path))

View file

@ -514,6 +514,9 @@ error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
{
sys_fs.warning("sys_fs_stat(path=%s, sb=*0x%x)", path, sb);
if (!path)
return CELL_EFAULT;
const std::string local_path = vfs::get(path.get_ptr());
if (local_path.empty())
@ -687,6 +690,12 @@ error_code sys_fs_unlink(vm::cptr<char> path)
{
sys_fs.warning("sys_fs_unlink(path=%s)", path);
// If path is just an empty string
if (!*path.get_ptr())
{
return CELL_ENOENT;
}
const std::string local_path = vfs::get(path.get_ptr());
if (local_path.empty())