Commit Graph

16 Commits

Author SHA1 Message Date
David Korth
ec21fb96ed Show "COPY DETECTION" if both ROMs have identical content, ignoring padding. 2017-07-08 00:17:05 -04:00
David Korth
6033f08539 Use _T() for empty strings.
Fixes compile warnings with MSVC 2017.
2017-07-07 23:33:34 -04:00
David Korth
d1e30aa3fa Truncate argv[0] to only contain the filename if launched from Windows Explorer. 2017-07-07 22:35:50 -04:00
David Korth
a210fe20ba Handle launching from Explorer differently than launching from console.
Pause before exiting if launched from Explorer directly.

If launched from Explorer with no parameters, show usage information.
2017-07-07 22:33:26 -04:00
David Korth
9cedbe932e Windows: Print a newline after the "*** HACK DETECTION ***" banner if we're at the end of the buffer.
Tested on Windows XP and Windows 7.
2017-07-07 22:02:07 -04:00
David Korth
e6efd8280f Print "*** HACK DETECTION ***" in color on Windows.
Includes some hacks to prevent extra lines from being printed if we're at
the end of the screen buffer. Tested on Windows XP.
2017-07-07 21:50:49 -04:00
David Korth
da864a04db Usage information: Added copyright, license, and GitHub information. 2017-07-07 21:28:17 -04:00
David Korth
ccf5b4859a Print the number of checked bytes in addition to common and differing bytes. 2017-07-07 21:26:58 -04:00
David Korth
8afdf0f064 print_hack_detection(): New function to print the "*** HACK DETECTION ***" banner.
Added a color ANSI escape version for Linux. This checks if stdout
is a tty and is a supported tty.

Based on some code from rom-properties' GcnFstPrint, which is based
on Google Test.
2017-07-07 21:25:35 -04:00
David Korth
d8a8780ceb Changed the identical/differing/percentage output.
The number of differing bytes is now printed instead of the total
number of bytes.
2017-07-07 21:03:51 -04:00
David Korth
e51d4c2bdd Removed a stray ')'.
This fixes a regression from commit 96edf7b3ae.
(Use Unicode functions on Windows. (TCHAR functions))
2017-07-07 21:01:04 -04:00
David Korth
e5b04552bc build-msvc.bat: Set /W3.
hack-detection.c:
- Disable MSVC "secure" CRT warnings.
- Added a cast to eliminate a double to int truncation warning.
2017-07-07 20:59:31 -04:00
David Korth
991b0e5b51 Round the percentage down.
524155/524288 should round down to 99.9%, not round up to 100.0%.

Process the percentage as an integer after the division to make this
a bit easier.

build-gcc.sh: Link to -lm, which is required for trunc(), which is
used by floor() on Linux.
2017-07-07 20:56:03 -04:00
David Korth
96edf7b3ae Use Unicode functions on Windows. (TCHAR functions)
tchar_xplt.h: TCHAR definitions for non-Windows platforms.
2017-07-07 20:52:31 -04:00
David Korth
dd34a053e6 Added build scripts for gcc and MSVC.
hack-detection.c: Fix compilation with MSVC 2010.
2017-07-07 20:20:37 -04:00
David Korth
3c399f3088 *** HACK DETECTION ***
This program will detect if a hacked ROM is a simple binary hex-edit
of the source ROM. It does this by checking how many bytes are the
same between the two ROMs. If more than 50% of the common size is
the same, the ROM is assumed to be a binary edit.

The "common size" is the size of the smallest ROM. Padding bytes from
the source ROM are ignored, so it will likely be smaller than the
source ROM.

TODO:
- Fancy colorization on terminals on Windows and Linux.
- Unicode filenames on Windows.
- Round percentages down.
2017-07-07 20:14:50 -04:00