Commit Graph

33 Commits

Author SHA1 Message Date
nmlgc 49a6834c4a [Maintenance] Move OUT for 8-bit port numbers to x86real.h
We'd like to use this optimization in the platform layer as well.
Turning it into an inline function via __emit__() also allows us to
turn a bunch of other macros into proper inline functions.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc 010d6ae918 [Maintenance] [th01] Interpret redundant resident structure copies as such
And dissolve the "vars" units, which would be too annoying to merge on
the `debloated` branch otherwise. This interpretation of these globals
further highlights the type differences between REIIDEN.EXE and
FUUIN.EXE.
Placing them in directly in `resident.hpp`; on the `debloated` branch,
we could neatly define each of these fields in a matching .cpp file,
but that file would need to be compiled twice due to the aforementioned
differences between binaries. Better to keep those in `op_01.cpp`,
`main_01.cpp`, or `fuuin_01.cpp`, respectively.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 4716948b57 [Maintenance] [th01] Declare types for signed and unsigned scores
Will make it much easier for modders to resolve this inconsistency.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 24c07c72df [Maintenance] [th01] Replace generic C types with more specific ones
In all places visited during the next 6 pushes: The resident structure
and copies of its values, the packfile implementation, boss entities,
rendering font ROM glyphs to VRAM, and overall inconsistent code
between the three binaries.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 9b46ff7d99 [Maintenance] [th01] Move TH01-exclusive VRAM text functions to a new header
Neatly dissolves two of the three game-specific preprocessor branches
in `th01/hardware/grppsafx.h`. Moving at least one function into a
corresponding .cpp file will also simplify the corresponding debloating
commit on the respective branch.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc c26f885502 [Naming] [th01] Fix stage ID vs. stage number confusion
Part of P0214, funded by Ember2528.
2022-08-14 23:16:40 +02:00
nmlgc cf95cc8717 [Maintenance] [th01] Remove `extern "C"` from all remaining areas of code
Nothing says "we're getting things done" quite as much as this.

Part of P0214, funded by Ember2528.
2022-08-14 23:03:15 +02:00
nmlgc 90077fdc79 [Decompilation] [th01] Move FUUIN.EXE input and High Score data to C land
Might as well figure out that horribly entangled data layout sooner
rather than later…

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 60a7e44b53 [Maintenance] Introduce proper Shift-JIS and JIS X 0208 types
Much more semantic than that twobyte_t abomination.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:53:13 +02:00
nmlgc e4124ca004 [Maintenance] [th01] Move REYHI*.DAT declarations to the formats/ subdirectory
Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:52:41 +02:00
nmlgc 96510b3cba [Maintenance] [th01] Don't #include grppsafx.h inside graph.h
That file is about to gain a dependency on a Shift-JIS type header.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:50:46 +02:00
nmlgc d398a949fc [Decompilation] High score menu: Move all data to C land
Completes P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:29 +02:00
nmlgc a10fe95b31 [Maintenance] Fix comment↔code associations
• Comments that describe all lines of code until a blank one are placed
  into the lines immediately above
• Comments that describe an entire demarcated block are placed
  immediately below the dash row at the top
• In any case, there should be a blank line after the top comment of
  a demarcated block, to keep IntelliSense-style systems from applying
  the block comment to the first actual line of code…
• …but there shouldn't be one before the dash row at the bottom, where
  it'd be redundant.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:53 +02:00
nmlgc 3e79deeb3a [Contributing] Define function brace placement rules
I've been following them pretty consistently for a while now, time to
finally write them down.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:45:18 +02:00
nmlgc 91984de4b2 [Maintenance] [th01] Remove `extern "C"` from more areas of code
The additional hardware effect functions, as well as the High Score
menu code.

Part of P0193, funded by Ember2528.
2022-05-31 22:55:33 +02:00
nmlgc a2358bef47 [Maintenance] Remove `extern "C"` from `x86real.h` and `decomp.hpp`
One of those per delivery now, eh?

Part of P0189, funded by Arandui and Lmocinemod.
2022-04-16 23:53:46 +02:00
nmlgc ea54e59f93 [Maintenance] Macros: Avoid references to implicit local variables
If the macro itself is local to a function, these can work in certain
scenarios, but never for global ones.

Part of P0186, funded by [Anonymous] and Blue Bolt.
2022-03-25 14:03:53 +01:00
nmlgc 99aee2bdbe [Maintenance] Consistently use singular for entity structure and file names
Not too sure about "chars" yet, with TH03 and all.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 19:14:02 +01:00
nmlgc e07624a7be [Maintenance] [th01] Start a new header for clamping macros
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc ab4c1a9bad [Maintenance] Add a template for stupid bytewise access to logical structures
For the cases where ZUN's code would always be cleaner without it.

Part of P0157, funded by Yanga.
2021-09-12 18:35:08 +02:00
nmlgc 1c5ed4b06e [Maintenance] Copy <dos.h>'s 16-bit x86 Real Mode declarations to a new file
DOS is not the same thing as the underlying CPU, after all. A separate
file not only indicates to future port authors which parts of the code
are x86-specific, but it also speeds up build times…

… in theory, because removing 677 lines from 49 files each doesn't seem
to speed up the build as much as I had hoped? But apparently my whole
system mysteriously got faster in the meantime, and I was getting 22-23
seconds for the entire repo even before this commit. Good enough.

Part of P0134, funded by [Anonymous].
2021-02-20 23:49:45 +01:00
nmlgc 0ce869c30a [Maintenance] Complete the master.hpp transition
Part of P0133, funded by [Anonymous].
2021-01-30 19:22:29 +01:00
nmlgc d1f1b7d405 [Maintenance] Move twobyte_t into its own header file
And hope that there won't be any more generic utility types like it…

Part of P0133, funded by [Anonymous].
2021-01-30 18:31:54 +01:00
nmlgc ec8be31cd3 [Maintenance] Move PC-98 keyboard declarations to their own header file
140 lines that are only used in, like, 7 translation units.

Part of P0133, funded by [Anonymous].
2021-01-30 18:26:46 +01:00
nmlgc eb89330f64 [Build] [th01] Move the -Z and -3 options onto the command line
Deactivating them is the exception, not the norm.

Part of P0122, funded by Yanga.
2020-10-06 13:27:33 +02:00
nmlgc 5c77db08ca [Decompilation] [th01] High score registration
Completing the high score menu with a final stupid set of
inconsistencies between REIIDEN.EXE and FUUIN.EXE. Oh well.

Part of P0094, funded by Yanga.
2020-05-25 15:16:40 +02:00
nmlgc 0e73029276 [Decompilation] [th01] High score menu: Name entering loop
The REIIDEN.EXE version (which is only shown when game-overing) has a
completely invisible timeout that force-enters a high score name after
1000... *keyboard inputs*? Not frames? Why. Like, how do even you
realistically to such a number.
(Best guess: It's a hidden easter egg to amuse players who place
drinking glasses on cursor keys. Or beer bottles.)

And hey, that initialization of the name variable with ASCII spaces.
The only actually meaningful byte-wise access… except that it's not,
because ZUN could have just used the Shift-JIS ideographic space for
the exact same effect.

Completes P0093, funded by Ember2528.
2020-05-25 15:11:12 +02:00
nmlgc 440330857a [Decompilation] [th01] High score menu: Shot key handling
In which inline functions are apparently the only way to trick Turbo
C++ into not actually optimizing away the useless `AND AL, 0FFh`.

But come on. Just accessing the high score name characters in chunks of
16-bit Shift-JIS codepoints (which is what they are!) instead of
breaking them down to bytes *everywhere* would have been both more
readable (no swapping of Shift-JIS literals, no bitshifts), more
efficient (this isn't running on an 8-bit CPU after all), and less of a
waste of my time…

Completes P0092, funded by Yanga.
2020-05-25 15:06:48 +02:00
nmlgc 57be510056 [Decompilation] [th01] High score menu: Initial table rendering
With ternary operator expressions straight out of Jigoku.
(TL note: Jigoku means hell.)
Nice to see that Turbo C++ apparently has no nesting limit on function
call inlining in general, though!

Part of P0092, funded by Yanga.
2020-05-25 15:03:55 +02:00
nmlgc 16ac6b4206 [Decompilation] [th01] High score menu: Initial alphabet rendering
Completes P0091, funded by Ember2528.
2020-05-12 15:06:12 +02:00
nmlgc 4f87ec8152 [Decompilation] [th01] Blitting full-width numbers onto VRAM
Part of P0091, funded by Ember2528.
2020-05-12 15:06:12 +02:00
nmlgc 651d09f5bd [Decompilation] [th01] Keyboard input in FUUIN.EXE
The only TH01 executable not supporting the numpad?

And that's the point where you just rewrite the distinct input_prev_*
values as a single array, because they're local to input_sense()
anyway.

Part of P0091, funded by Ember2528.
2020-05-12 15:06:11 +02:00
nmlgc c338305a61 [Decompilation] REYHI*.DAT loading and recreation
With master.lib file I/O in REIIDEN.EXE, and POSIX file I/O in
FUUIN.EXE… yup.

Part of P0084, funded by Yanga.
2020-03-22 10:16:08 +01:00