MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / MakeFile

Method MakeFile

rpcs3/Crypto/unself.cpp:757–795  ·  view source on GitHub ↗

Each section gets put into its own file.

Source from the content-addressed store, hash-verified

755
756// Each section gets put into its own file.
757std::vector<fs::file> SCEDecrypter::MakeFile()
758{
759 std::vector<fs::file> vec;
760
761 // Set initial offset.
762 u32 data_buf_offset = 0;
763
764 // Write data.
765 for (u32 i = 0; i < meta_hdr.section_count; i++)
766 {
767 const MetadataSectionHeader& hdr = meta_shdr[i];
768 const u8* src = data_buf.get() + data_buf_offset;
769 fs::file out_f = fs::make_stream<std::vector<u8>>();
770
771 bool is_valid = true;
772
773 // Decompress if necessary.
774 if (hdr.compressed == 2)
775 {
776 is_valid = unzip(src, hdr.data_size, out_f);
777 }
778 else
779 {
780 // Write the data.
781 out_f.write(src, hdr.data_size);
782 }
783
784 // Advance the data buffer offset by data size.
785 data_buf_offset += ::narrow<u32>(hdr.data_size);
786
787 if (out_f.pos() != out_f.size())
788 fmt::throw_exception("MakeELF written bytes (%llu) does not equal buffer size (%llu).", out_f.pos(), out_f.size());
789
790 if (is_valid)
791 vec.push_back(std::move(out_f));
792 }
793
794 return vec;
795}
796
797SELFDecrypter::SELFDecrypter(const fs::file& s)
798 : self_f(s), key_v()

Callers 2

installPupFunction · 0.80
extract_tarFunction · 0.80

Calls 7

throw_exceptionClass · 0.85
push_backMethod · 0.80
unzipFunction · 0.70
getMethod · 0.45
writeMethod · 0.45
posMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected