diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 9753df7285..09397c0c69 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -126,6 +126,7 @@ struct content_permission final stx::init_mutex init; atomic_t can_create = 0; + atomic_t exists = false; atomic_t restrict_sfo_params = true; content_permission() = default; @@ -134,6 +135,16 @@ struct content_permission final content_permission& operator=(const content_permission&) = delete; + void reset() + { + dir.clear(); + sfo.clear(); + temp.clear(); + can_create = 0; + exists = false; + restrict_sfo_params = true; + } + ~content_permission() { bool success = false; @@ -388,9 +399,6 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr perm->dir = std::move(dir); perm->sfo = std::move(sfo); - perm->temp.clear(); - perm->can_create = 0; - return CELL_OK; } @@ -427,9 +435,6 @@ error_code cellGamePatchCheck(vm::ptr size, vm::ptr r perm->dir = Emu.GetTitleID(); perm->sfo = std::move(sfo); - perm->temp.clear(); - perm->can_create = 0; - return CELL_OK; } @@ -473,8 +478,6 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrdir = std::move(name); - perm->sfo.clear(); - perm->temp.clear(); if (type == CELL_GAME_GAMETYPE_GAMEDATA) { @@ -489,6 +492,7 @@ error_code cellGameDataCheck(u32 type, vm::cptr dirName, vm::ptrexists = true; perm->sfo = psf::load_object(fs::file(vfs::get(dir + "/PARAM.SFO"))); return CELL_OK; } @@ -515,6 +519,7 @@ error_code cellGameContentPermit(vm::ptr contentInfoPa if (perm->can_create && perm->temp.empty() && !fs::is_dir(vfs::get(dir))) { + perm->reset(); strcpy_trunc(*contentInfoPath, ""); strcpy_trunc(*usrdirPath, ""); return CELL_OK; @@ -539,6 +544,9 @@ error_code cellGameContentPermit(vm::ptr contentInfoPa } } + // Cleanup + perm->reset(); + strcpy_trunc(*contentInfoPath, dir); strcpy_trunc(*usrdirPath, dir + "/USRDIR"); return CELL_OK; @@ -694,6 +702,11 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptrget(); const auto _init = prm->init.access(); @@ -708,6 +721,11 @@ error_code cellGameCreateGameData(vm::ptr init, vm::ptrexists) + { + return CELL_GAME_ERROR_EXIST; + } + std::string dirname = "_GDATA_" + std::to_string(steady_clock::now().time_since_epoch().count()); std::string tmp_contentInfo = "/dev_hdd0/game/" + dirname; std::string tmp_usrdir = "/dev_hdd0/game/" + dirname + "/USRDIR"; @@ -894,7 +912,7 @@ error_code cellGameGetParamString(s32 id, vm::ptr buf, u32 bufsize) error_code cellGameSetParamString(s32 id, vm::cptr buf) { - cellGame.warning("cellGameSetParamString(id=%d, buf=*0x%x)", id, buf); + cellGame.warning("cellGameSetParamString(id=%d, buf=*0x%x %s)", id, buf, buf); if (!buf) {