Building LinksGridColour from source
====================================

The program is plain C using only the Windows API. It has no external
dependencies and needs no libraries beyond what Windows already provides.

Built with MinGW-w64 (32-bit). MSYS2, w64devkit or any similar toolchain works.


BUILD
-----
    windres gui.rc -o gui.o
    gcc -O2 -mwindows -o LinksGridColour.exe linksgridgui.c gui.o ^
        -lcomctl32 -lcomdlg32 -ladvapi32 -lgdi32 -lgdiplus -lole32

gui.rc embeds two things: a manifest asking for administrator rights (the game
normally lives in Program Files, which is not writable otherwise) and version
information.

You may see a linker warning about "multiple non-default manifests". That is
harmless - it means our manifest replaced the compiler's default one, which is
what we want.


FILES
-----
    linksgridgui.c   the whole program: patch logic and window
    gui.rc           resource script (manifest, icon, version info)
    gui.manifest     the manifest itself
    off.jpg          real Links green, grid OFF  (preview backdrop)
    on.jpg           real Links green, colour-coded grid at 100% (height colours)
    cov.png          grayscale grid footprint, from a uniform 100% yellow grid
    app.ico          application icon, with artwork drawn separately for
                     16/20/24/32/48/64 and 256 pixels


CHECKING THE PREVIEW DRAWING
----------------------------
The preview panel can be rendered to .bmp files without opening the window,
which is handy if you want to see what it draws:

    gcc -O2 -DPREVIEW_TEST -o prevtest.exe linksgridgui.c ^
        -lcomctl32 -lcomdlg32 -ladvapi32 -lgdi32
    prevtest.exe

This writes a handful of prev_*.bmp files to the current directory. The test
code is excluded from the normal build.


WHAT THE PATCH DOES
-------------------
See "WHAT IT ACTUALLY CHANGES" in README.txt for the plain-English version.

In code terms: FindSites() locates the grid colour routine by matching a byte
pattern rather than a fixed address, so an unrecognised build is refused instead
of being corrupted. ApplyPatch() then points all seven height bands at one band,
replaces the instruction that varies the colour with two NOPs, writes the chosen
colour into the immediate operand, and sets the alpha byte. Roughly thirty bytes
in total, all inside that one routine.
