PKG: Pack multiple PKGs into fast+efficient install (#13147)

This commit is contained in:
Elad Ashkenazi 2023-01-03 14:31:39 +02:00 committed by GitHub
parent 7423abb136
commit 7c2d6f8a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 364 additions and 266 deletions

View file

@ -83,27 +83,28 @@ namespace rpcs3::utils
{
sys_log.success("Installing package: %s", path);
atomic_t<double> progress(0.);
int int_progress = 0;
std::deque<package_reader> reader;
reader.emplace_back(path);
// Run PKG unpacking asynchronously
named_thread worker("PKG Installer", [&]
{
package_reader reader(path);
return reader.extract_data(progress);
std::deque<std::string> bootables;
return package_reader::extract_data(reader, bootables);
});
// Wait for the completion
while (std::this_thread::sleep_for(5ms), worker <= thread_state::aborting)
{
// TODO: update unified progress dialog
double pval = progress;
pval < 0 ? pval += 1. : pval;
pval *= 100.;
const int pval = reader[0].get_progress(100);
if (static_cast<int>(pval) > int_progress)
if (pval > int_progress)
{
int_progress = static_cast<int>(pval);
int_progress = pval;
sys_log.success("... %u%%", int_progress);
}
}