Skip to content

Commit

Permalink
Allow license files to be automatically selected if it is already exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
nishinji committed Sep 9, 2023
1 parent de5a9a6 commit 0dc9291
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions vita3k/gui/src/pkg_install_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,24 @@ void draw_pkg_install_dialog(GuiState &gui, EmuEnvState &emuenv) {
if (draw_file_dialog) {
result = host::dialog::filesystem::open_file(pkg_path, { { "PlayStation Store Downloaded Package", { "pkg" } } });
draw_file_dialog = false;
if (result == host::dialog::filesystem::Result::SUCCESS)
if (result == host::dialog::filesystem::Result::SUCCESS) {
fs::ifstream infile(pkg_path.string(), std::ios::binary);
PkgHeader pkg_header{};
infile.read(reinterpret_cast<char *>(&pkg_header), sizeof(PkgHeader));
infile.seekg(sizeof(PkgHeader));
std::string title_id_str(pkg_header.content_id);
std::string title_id = title_id_str.substr(7, 9);
const auto work_path{ fs::path(emuenv.pref_path) / "ux0/license" / title_id / fmt::format("{}.rif", pkg_header.content_id) };
if (fs::exists(work_path), &gui) {
LOG_INFO("Found work file: {}", work_path.string());
fs::ifstream binfile(work_path.wstring(), std::ios::in | std::ios::binary | std::ios::ate);
zRIF = rif2zrif(binfile);
ImGui::OpenPopup("install");
state = "install";
} else {
ImGui::OpenPopup("install");
else if (result == host::dialog::filesystem::Result::CANCEL) {
}
} else if (result == host::dialog::filesystem::Result::CANCEL) {
gui.file_menu.pkg_install_dialog = false;
draw_file_dialog = true;
} else {
Expand Down

0 comments on commit 0dc9291

Please sign in to comment.