From 64982688033c23feb547c94517bd7be8baec44d3 Mon Sep 17 00:00:00 2001 From: Destrozw Date: Mon, 26 Jan 2026 18:57:30 -0400 Subject: [PATCH] Diff Error Check If there is an issue with patching from the diff file, it will output the error to the console. I'm not modifying the diff manually anymore but should still be useful. --- dist/wcpatch/src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dist/wcpatch/src/main.cpp b/dist/wcpatch/src/main.cpp index 09d96ae..4785572 100644 --- a/dist/wcpatch/src/main.cpp +++ b/dist/wcpatch/src/main.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -401,7 +402,16 @@ bool apply_dif(stdext::multi_ref file_data, ui seekable.seek(stdext::seek_from::begin, offset); auto value = stream.read(); if (value != original_value) + { + unsigned file_b = std::to_integer(value); + unsigned expect_b = std::to_integer(original_value); + unsigned repl_b = std::to_integer(replacement_value); + std::cerr << "apply_dif: mismatch at offset 0x" << std::hex << offset + << ": file=0x" << std::setw(2) << std::setfill('0') << file_b + << " expected=0x" << std::setw(2) << expect_b + << " replace=0x" << std::setw(2) << repl_b << std::dec << "\n"; return false; + } seekable.seek(stdext::seek_from::current, -1); stream.write(replacement_value); }