There was one ASM-inaccuracy I missed last time, but now I've also
made the file's memory layout accurate (it appears that global
variable initialisation actually affects the order they reside in
memory).
Fixes#88
The issue was caused by Config.dat reading a CSE2E Config.dat, and
preserving its altered magic number, which Cave Story would reject,
causing it to fallback on default settings.
Applied some missing constants/macros, and corrected an
ASM-inaccuracy.
I always wondered why the original code only passed the first member
of the GUID struct, but it turned out it didn't: it actually passed
the whole thing.
Also, it's starting to bother me how many ASM-inaccuracies have
sneaked-through. v2.0 was *meant* to have fixed all this already.
Besides, these are defined in Main.cpp, not KeyControl.cpp.
Anyway, according to the Linux debug data, these two were never
declared outside of Main.cpp, showing they were never declared in a
header file.
Funny story: so, there's a bugged TSC command in this file, which
causes it to try to read a flag beyond the end of the flag array.
If the memory it reads happens to be set to true, then it will
attempt to jump to an invalid event number, causing a crash.
Since I don't want to riddle CSE2's codebase with ugly compatibility
hacks, I think it's best to just fix the TSC file directly.
The new mingw-w64-make package on Arch Linux's AUR enables
cross-compiling by overriding the CC, CXXFLAGS, and LDFLAGS
variables, but previously CSE2's Makefile wasn't designed to allow
this, causing it to break. Now, it should work properly.
Pixel's way of converting tiles to units is inconsistent: the ASM
shows he sometimes does '* 0x200 * 0x10', other times it's
'* 0x10 * 0x200', and in this file he does '* 0x2000'.
This means TILES_TO_UNITS won't be usable for every case, so I'm not
sure if we should even have it. It's pretty clear that Pixel just
multiplied things manually, without a macro to keep things
consistent. And if we're getting rid of that, then what does that
mean for PIXELS_TO_UNITS?