Added fs::file_ptr, fom::rewrite, cleanup

This commit is contained in:
Nekotekina 2015-11-01 13:33:28 +03:00
parent 009aa3dcb9
commit a4db58f5f2
19 changed files with 130 additions and 54 deletions

View file

@ -821,7 +821,7 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi
{
// Prepare the files.
fs::file input(input_file_name);
fs::file output(output_file_name, fom::write | fom::create | fom::trunc);
fs::file output(output_file_name, fom::rewrite);
fs::file rap(rap_file_name);
// Set keys (RIF and DEVKLIC).

View file

@ -59,7 +59,7 @@ static bool CheckHeader(const fs::file& pkg_f, PKGHeader& header)
}
// PKG Decryption
bool UnpackPKG(const fs::file& pkg_f, const std::string& dir, volatile f64& progress)
bool pkg_install(const fs::file& pkg_f, const std::string& dir, volatile f64& progress)
{
const std::size_t BUF_SIZE = 8192 * 1024; // 8 MB

View file

@ -57,4 +57,4 @@ struct PKGEntry
be_t<u32> pad; // Padding (zeros)
};
bool UnpackPKG(const class fs::file& pkg_f, const std::string& dir, volatile f64& progress);
bool pkg_install(const class fs::file& pkg_f, const std::string& dir, volatile f64& progress);

View file

@ -1085,8 +1085,8 @@ bool SELFDecrypter::DecryptData()
bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
{
// Create a new ELF file.
fs::file e(elf, fom::write | fom::create | fom::trunc);
if (!e)
fs::file e(elf, fom::rewrite);
if(!e)
{
LOG_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());
return false;
@ -1309,7 +1309,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
CHECK_ASSERTION(s.seek(elf_offset) != -1);
// Write the real ELF file back.
fs::file e(elf, fom::write | fom::create | fom::trunc);
fs::file e(elf, fom::rewrite);
if (!e)
{
LOG_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());