2012-11-22 10:28:01 +00:00
|
|
|
void Ananke::applyBeatPatch(vector<uint8_t> &buffer) {
|
2013-08-18 03:21:14 +00:00
|
|
|
string name = {information.path, nall::basename(information.name), ".bps"};
|
2012-11-22 10:28:01 +00:00
|
|
|
if(!file::exists(name)) return;
|
|
|
|
|
|
|
|
bpspatch patch;
|
|
|
|
if(patch.modify(name) == false) return;
|
|
|
|
patch.source(buffer.data(), buffer.size());
|
|
|
|
vector<uint8_t> output;
|
|
|
|
output.resize(patch.size());
|
|
|
|
patch.target(output.data(), output.size());
|
|
|
|
if(patch.apply() == bpspatch::result::success) {
|
|
|
|
buffer = output;
|
|
|
|
information.manifest = patch.metadata();
|
|
|
|
}
|
|
|
|
}
|