File: patch.cpp

package info (click to toggle)
higan 094-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,780 kB
  • ctags: 15,643
  • sloc: cpp: 103,963; ansic: 659; makefile: 531; sh: 25
file content (15 lines) | stat: -rwxr-xr-x 500 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void Ananke::applyBeatPatch(vector<uint8_t> &buffer) {
  string name = {information.path, nall::basename(information.name), ".bps"};
  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();
  }
}