error_code cellGameGetParamString(s32 id, vm::ptr<char> buf, u32 bufsize) { cellGame.warning("cellGameGetParamString(id=%d, buf=*0x%x, bufsize=%d)", id, buf, bufsize); if (!buf || bufsize == 0) { return CELL_GAME_ERROR_PARAM; } const auto prm = fxm::get<content_permission>(); if (!prm) { return CELL_GAME_ERROR_FAILURE; } const auto key = get_param_string_key(id); if (!key) { return CELL_GAME_ERROR_INVALID_ID; } std::string value = psf::get_string(prm->sfo, key); value.resize(bufsize - 1); std::memcpy(buf.get_ptr(), value.c_str(), bufsize); return CELL_OK; }
error_code cellGameSetParamString(s32 id, vm::cptr<char> buf) { cellGame.warning("cellGameSetParamString(id=%d, buf=*0x%x)", id, buf); const auto prm = fxm::get<content_permission>(); if (!prm) { return CELL_GAME_ERROR_FAILURE; } const auto key = get_param_string_key(id); if (!key) { return CELL_GAME_ERROR_INVALID_ID; } u32 max_size = CELL_GAME_SYSP_TITLE_SIZE; switch (id) { case CELL_GAME_PARAMID_TITLE_ID: max_size = CELL_GAME_SYSP_TITLEID_SIZE; break; case CELL_GAME_PARAMID_VERSION: max_size = CELL_GAME_SYSP_VERSION_SIZE; break; case CELL_GAME_PARAMID_PS3_SYSTEM_VER: max_size = CELL_GAME_SYSP_PS3_SYSTEM_VER_SIZE; break; case CELL_GAME_PARAMID_APP_VER: max_size = CELL_GAME_SYSP_APP_VER_SIZE; break; } prm->sfo.emplace(key, psf::string(max_size, buf.get_ptr())); return CELL_OK; }