7 std::string rom_filename = arg_vec[1];
8 std::string patch_filename = arg_vec[2];
11 std::ifstream patch_file(patch_filename, std::ios::binary);
12 std::vector<uint8_t> patch;
14 patch_file.read((
char*)patch.data(), patch.size());
17 std::vector<uint8_t> patched;
21 std::ofstream patched_rom(
"patched.sfc", std::ios::binary);
22 patched_rom.write((
char*)patched.data(), patched.size());
24 return absl::OkStatus();
28 std::string patch_filename = arg_vec[1];
29 std::string rom_filename = arg_vec[2];
33 if (!asar_patch(patch_filename.c_str(), rom_filename.data(), buflen,
35 std::string error_message =
"Failed to apply patch: ";
37 const errordata* errors = asar_geterrors(&num_errors);
38 for (
int i = 0; i < num_errors; i++) {
39 error_message += absl::StrFormat(
"%s", errors[i].fullerrdata);
41 return absl::InternalError(error_message);
43 return absl::OkStatus();