Lots of defect fixes

This commit is contained in:
Raul Tambre 2015-10-17 20:47:18 +03:00
parent 5dfc22a604
commit fac9d74344
21 changed files with 341 additions and 95 deletions

View file

@ -86,7 +86,11 @@ bool UnpackPKG(const fs::file& pkg_f, const std::string& dir, volatile f64& prog
// Define decryption subfunction (`psp` arg selects the key for specific block)
auto decrypt = [&](u64 offset, u64 size, bool psp) -> u64
{
pkg_f.seek(start_offset + header.data_offset + offset);
if (pkg_f.seek(start_offset + header.data_offset + offset) < 0)
{
LOG_ERROR(LOADER, "PKG: Package file seek to %u failed.", start_offset + header.data_offset + offset);
return -1;
}
// Read the data and set available size
const u64 read = pkg_f.read(buf.get(), size);