rpcsx/rpcs3/Loader/PUP.h
Eladash 461fa6a88a
Firmware installation bugfixes (#9855)
* Fix race condition in PUP installation abortion.
* Fix freezes of emulator in case the PUP installation failed due to filesystem errors.
* Use fs::create_path as opposed to fs::create_dir as it is can create upper directories in case they are missing and is better in error handling.
* Report TAR errors on failure to create directories.
* Fix pup_object constructor to not crash on invalid PUP file header. (report an error)
* Fix pup_object::validate_hashes to not crash on invalid PUP file entries. (report an error)
* Do not call Qt functions inside a named_thread because it is wrong.
2021-02-28 22:59:27 +03:00

49 lines
756 B
C++

#pragma once
#include "util/types.hpp"
#include "../../Utilities/File.h"
#include <vector>
struct PUPHeader
{
le_t<u64> magic;
be_t<u64> package_version;
be_t<u64> image_version;
be_t<u64> file_count;
be_t<u64> header_length;
be_t<u64> data_length;
};
struct PUPFileEntry
{
be_t<u64> entry_id;
be_t<u64> data_offset;
be_t<u64> data_length;
u8 padding[8];
};
struct PUPHashEntry
{
be_t<u64> entry_id;
u8 hash[20];
u8 padding[4];
};
class pup_object
{
const fs::file& m_file;
bool isValid = false;
std::vector<PUPFileEntry> m_file_tbl;
std::vector<PUPHashEntry> m_hash_tbl;
public:
pup_object(const fs::file& file);
explicit operator bool() const { return isValid; }
fs::file get_file(u64 entry_id);
bool validate_hashes();
};