Commit Graph

13 Commits

Author SHA1 Message Date
nmlgc 110d0534ed [Maintenance] Move `extern "C"` into the headers it applies to
The translation units were probably a better place back when most of
the codebase was still compiled in C mode, we only had a few C++ TUs,
almost everything needed to be declared as `extern "C"`, and moving
these declarations into the headers would have been really noisy with
all the `#ifdef __cplusplus` / `#endif` required. Nowadays though,
we've greatly reduced that surface area. And given that headers will
include even more headers as part of the upcoming `#include` cleanup,
it makes sense to make the jump now.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:49 +02:00
nmlgc c85c0e2483 [Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
  player_pos_update_and_clamp(), score_update_and_render(), and
  slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
  stage2_invalidate(), stage2_update(), and space_window_set()

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:43 +02:00
nmlgc 6d702988af [Maintenance] Remove `extern "C"` from more areas of code
Covering every input function across all games.

Part of P0278, funded by Yanga.
2024-04-11 23:17:45 +02:00
nmlgc c57992caa9 [Maintenance] [th03/th04/th05] Move resident pointer loading to its own header
Which also highlights that TH05 uses both a master.lib and raw DOS
implementation.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc cafdd6ee3e [Maintenance] [th05] #include `common.h` directly inside `resident.hpp`
The asymmetry of having to do this for TH05's resident structure but
not for TH04's has finally become annoying enough.

Part of P0263, funded by [Anonymous].
2023-11-30 19:55:18 +01:00
nmlgc 741d889c07 [Decompilation] [th04/th05] Main menu: Move decompiled data to C land
Completes P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:50:52 +01:00
nmlgc b4980bbd8a [Decompilation] [th04/th05] OP.EXE: main()
Not the final function to be decompiled this time around!

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:43:57 +01:00
nmlgc ad4cd15bb6 [Decompilation] [th04/th05] Main menu: Top-level menu update/render function
Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:37:58 +01:00
nmlgc 050afe83b5 [Decompilation] [th04/th05] Main menu: Top-level menu blitting
We don't really gain anything from pretending that these description
IDs are anything other than raw array indices.

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:30:31 +01:00
nmlgc dfb48561d6 [Maintenance] [th04] Move MIKO.CFG code into the main menu translation unit
Wait, *what*, the alignment issues even stretch up to those functions?
And since TH05's version of the MIKO.CFG code lies much further down,
we now end up with this horrible #include placement asymmetry between
the two games. At least we now don't need a cross-TU workaround for
TH04's "MIKO.CFG" string either.

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:30:17 +01:00
nmlgc 86f1f44522 [Maintenance] [th04/th05] #include game start code from a shared source file
Once again, word alignment of a `switch` jump table forces us to put
both the game start and main menu code into the same translation unit,
despite the former being fundamentally different between the two games.
Oh well, this also avoids the need for a cross-TU workaround for the
"main" and "deb" binary filename strings.

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:22:42 +01:00
nmlgc ae2fc2865a [Decompilation] [th04] Starting the game
Completes P0261, funded by [Anonymous] and Yanga.
2023-11-01 23:17:52 +01:00
nmlgc 412df0c961 [Maintenance] [th05] Assign proper names to decompiled OP.EXE segments
Having to comb through them and change their `#pragma option -zC` names
after adding a new one is pretty annoying, after all. This way, we also
get to move some of those 2020 decompilations out of the `th05/`
subdirectory, matching the more consistent directory hierarchy that
this project has converged on in the years since.

Part of P0261, funded by [Anonymous] and Yanga.
2023-11-01 23:17:52 +01:00