Commit Graph

36 Commits

Author SHA1 Message Date
David Korth
30b1588845 *** HACK DETECTION *** v1.0.2 2017-07-08 00:18:05 -04:00
David Korth
ec21fb96ed Show "COPY DETECTION" if both ROMs have identical content, ignoring padding. 2017-07-08 00:17:05 -04:00
David Korth
c77afa0c96 README.md: Removed MinGW because it doesn't work for me right now; added OpenBSD.
OpenBSD compatibility tested by Bast.
2017-07-08 00:01:35 -04:00
David Korth
85076d7737 build-msvc.bat: Use the static MSVC runtime.
Something's wrong with my MinGW-w64 setup. The compiled executable
doesn't work on Windows XP or Windows 7, or even on Wine. It simply
starts and then exits.

I'll rebuild it using MSVC 2017 for now. Unfortunately, this means
the executable will be bigger, since it statically links the MSVC
runtime instead of using MSVCRT.DLL.
2017-07-07 23:39:55 -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
27bd89c2d5 README.md: LICENSE isn't a Markdown file. 2017-07-07 23:18:08 -04:00
David Korth
6d1463e956 README.md: Added compilation instructions. 2017-07-07 23:08:00 -04:00
David Korth
6a808453c2 README.md: s/.bin/.gen/ 2017-07-07 23:02:49 -04:00
David Korth
ba0dde1634 README.md: More algorithm information. 2017-07-07 23:02:28 -04:00
David Korth
746a7cb271 Added README and screenshots. 2017-07-07 22:59:34 -04:00
David Korth
326deabcc2 Added the GNU AGPLv3 as the license. 2017-07-07 22:52:11 -04:00
David Korth
f6bed979a2 .gitignore: Ignore *.res files. 2017-07-07 22:39:17 -04:00
David Korth
f802a69e80 build-gcc.sh: Allow CC, OBJCOPY, STRIP, and RC to be overridden.
These affect cross-compilation with TARGET as well.
2017-07-07 22:38:39 -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
e59eddc182 hack-detection.ico: Simple icon. 2017-07-07 22:24:45 -04:00
David Korth
be38ff65e1 build-gcc.sh: Compile and link in the Windows resource file. 2017-07-07 22:19:24 -04:00
David Korth
77ef1b5ea0 build-gcc.sh: Specify -municode for Windows linkage.
This fixes a regression from commit 96edf7b3ae.
(Use Unicode functions on Windows. (TCHAR functions))
2017-07-07 22:15:02 -04:00
David Korth
42018e3075 Added a resource file and manifest file.
build-msvc.bat: Compile and link in the resource file.

TODO:
- Make a simple icon for Windows.
- Compile the resource file when building with gcc.
2017-07-07 22:12:01 -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
fdcef01062 build-msvc.bat: /incremental:no, not /noincremental. 2017-07-07 20:48:47 -04:00
David Korth
61373c0b2a build-msvc.bat: Build with debugging symbols and linker optimizations.
Disable incremental linking.

.gitignore: Ignore *.ilk.
2017-07-07 20:38:22 -04:00
David Korth
d8096f468f .gitignore: Ignore generated files. 2017-07-07 20:33:36 -04:00
David Korth
09c7818335 build-gcc.sh: Split debugging symbols.
Set TARGET to the gcc prefix instead of specifying CC.
This allows it to be set for objcopy and strip.
2017-07-07 20:31:59 -04:00
David Korth
6f146ab411 build-gcc.sh: Detect Windows/MinGW and append a ".exe" extension.
Build with optimizations. (-O2)
2017-07-07 20:28:03 -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