Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpkg/edat: Extract and check for edat on the correct directory #10891

Merged
merged 3 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion rpcs3/Crypto/unpkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,9 @@ bool package_reader::extract_data(atomic_t<double>& sync)
break;
}

dir += m_install_dir + '/';
// TODO: Verify whether other content types require appending title ID
if (m_metadata.content_type != PKG_CONTENT_TYPE_LICENSE)
dir += m_install_dir + '/';

// If false, an existing directory is being overwritten: cannot cancel the operation
const bool was_null = !fs::is_dir(dir);
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/Modules/sceNp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ error_code npDrmVerifyUpgradeLicense(vm::cptr<char> content_id)
const std::string content_str(content_id.get_ptr(), std::find(content_id.get_ptr(), content_id.get_ptr() + 0x2f, '\0'));
sceNp.warning("npDrmVerifyUpgradeLicense(): content_id='%s'", content_id);

if (!rpcs3::utils::verify_c00_unlock_edat(Emu.GetTitleID(), content_str))
if (!rpcs3::utils::verify_c00_unlock_edat(content_str))
return SCE_NP_DRM_ERROR_LICENSE_NOT_FOUND;

return CELL_OK;
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Emu/system_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace rpcs3::utils
return rap_path;
}

std::string get_c00_unlock_edat_path(const std::string_view& title_id, const std::string_view& content_id)
std::string get_c00_unlock_edat_path(const std::string_view& content_id)
{
const std::string home_dir = get_hdd0_dir() + "home";

Expand All @@ -167,7 +167,7 @@ namespace rpcs3::utils
{
if (entry.is_directory && check_user(entry.name))
{
edat_path = fmt::format("%s/%s/exdata/%s/%s.edat", home_dir, entry.name, title_id, content_id);
edat_path = fmt::format("%s/%s/exdata/%s.edat", home_dir, entry.name, content_id);
if (fs::is_file(edat_path))
{
return edat_path;
Expand All @@ -179,9 +179,9 @@ namespace rpcs3::utils
return edat_path;
}

bool verify_c00_unlock_edat(const std::string_view& title_id, const std::string_view& content_id)
bool verify_c00_unlock_edat(const std::string_view& content_id)
{
const std::string edat_path = rpcs3::utils::get_c00_unlock_edat_path(title_id, content_id);
const std::string edat_path = rpcs3::utils::get_c00_unlock_edat_path(content_id);

// Check if user has unlock EDAT installed
if (!fs::is_file(edat_path))
Expand Down Expand Up @@ -287,7 +287,7 @@ namespace rpcs3::utils
// This is a trial game. Check if the user has EDAT file to unlock it.
const auto c00_title_id = psf::get_string(psf, "TITLE_ID");

if (fs::is_file(game_path + "/C00/PARAM.SFO") && verify_c00_unlock_edat(c00_title_id, content_id))
if (fs::is_file(game_path + "/C00/PARAM.SFO") && verify_c00_unlock_edat(content_id))
{
// Load full game data.
sys_log.notice("Verified EDAT file %s.edat for trial game %s", content_id, c00_title_id);
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/system_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace rpcs3::utils
std::string get_cache_dir();

std::string get_rap_file_path(const std::string_view& rap);
bool verify_c00_unlock_edat(const std::string_view& title_id, const std::string_view& content_id);
bool verify_c00_unlock_edat(const std::string_view& content_id);
std::string get_sfo_dir_from_game_path(const std::string& game_path, const std::string& title_id = "");

std::string get_custom_config_dir();
Expand Down