Commit Graph

330 Commits

Author SHA1 Message Date
nmlgc 974136a526 [Decompilation] [th04/th05] Stage tiles: Renderer activation
Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:49 +01:00
nmlgc 641cdec9f2 [Maintenance] [th04/th05] Dialog: Start a new translation unit with shared code
Thanks to the required word alignment of the `switch` jump table in
TH05's dialog_op(), we do in fact have to slice dialog code into
exactly two* translation units. Three might have been better because we
would have only needed to compile this shared code once, but TH05 also
has one exclusive function in the area covered by this new shared
translation unit anyway. At least we can meaningfully share the actual
source files between games here.

* With an additional one at the end for now, because I absolutely had
  to RE that EMS code in late 2021, but we'll catch up with that one in
  the end.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:29 +01:00
nmlgc 6515661dc8 [Decompilation] [th04/th05] Boss explosions
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 030908ebde [Decompilation] [th04] Stage 4 midboss: Rendering
Getting back one letter for the dummy segments within the first group.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 491f7b83d2 [Build] Compile shared translation units in 386 mode by default
By now, it has become clear that this the norm rather than the
exception among these units. Thankfully!

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 5de2186e57 [Reverse-engineering] [th04] Staff roll: State
And that's it…? All staff roll-related false positives removed, and we
didn't even have to decompile any of the staff roll blitting functions?

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 02:09:21 +02:00
nmlgc 53ac043833 [Naming] Drop the inconsistent `2` from vector translation unit names
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 02:09:17 +02:00
nmlgc 0efe76ab77 [Naming] Rename vector1_at() to polar()
"1D polar vectors" are a weird concept to wrap your head around,
especially if their constructor function takes a sine or cosine ratio
instead of an angle. This function is way closer to the polar_*()
family, which has these convenient `_x` and _y` suffixes that we could
just remove for this generic function to fit into there.

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 02:08:41 +02:00
nmlgc 916992e5d1 [Reverse-engineering] [th02] Items: Shared state
Part of P0243, funded by Yanga.
2023-06-07 15:38:32 +02:00
nmlgc 0d28c116c0 [Decompilation] [th02] HUD: Power bar rendering
Which also commits power changes to the shot level…

Part of P0242, funded by Yanga.
2023-06-06 21:37:07 +02:00
nmlgc 08352a5a81 [Decompilation] [th04] Stage tiles: Setting single tiles / .STD: Load function
Word alignment forces us to decompile these two barely related things
in a single commit. The former is at least much better and saner than
its TH02 counterpart.

Completes P0241, funded by [Anonymous] and Blue Bolt.
2023-05-30 01:31:46 +02:00
nmlgc 45df9ec0c6 [Decompilation] [th04] Scrolling checkerboard background
Used during the Stage 6 Yuuka fight, and, fortunately, decompilable
without ASM.

Part of P0240, funded by JonathKane.
2023-05-30 01:25:20 +02:00
nmlgc c5e51e6cb2 [Maintenance] [th02] Properly declare lives and bombs, and their limits
Completes P0237, funded by Yanga.
2023-03-29 18:03:06 +02:00
nmlgc 522976d668 [Decompilation] [th02] Bombs: Circle point rendering
An entire function that will just vanish in this game's Anniversary
Edition.

Part of P0237, funded by Yanga.
2023-03-29 18:03:05 +02:00
nmlgc eb52af752b [Decompilation] [th02] Point number popups: Initialization/reset function
Part of P0237, funded by Yanga.
2023-03-29 12:36:56 +02:00
nmlgc e1ccf2d67d [Decompilation] [th02] Stage tiles: EGC-accelerated single-tile blitting
From the tile source area to the right of the HUD, obviously. So glad
that vram_offset_shift_fast() is possible without inline ASM, we're
definitely going to see that one more often.

Part of P0235, funded by Ember2528.
2023-03-29 12:36:55 +02:00
nmlgc f8a774e1dc [Research] Get HOLDKEY.EXE compiling again
And finally compile this directory during the regular build process to
keep this from happening…

Part of P0233, funded by [Anonymous].
2023-03-04 19:40:55 +01:00
nmlgc d22c1e6db3 [Platform] [PC-98] Hardware palette setters
Optimally, these are called *at most* once per frame. No need to
micro-optimize here.

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 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 7fa4a59796 [Readme] Recommend the new `debloated` branch for nontrivial work
Part of P0229, funded by Ember2528.
2023-02-28 08:07:45 +01:00
nmlgc 3ccaac9d9e [Maintenance] Change Makefile line endings to LF
Part of P0229, funded by Ember2528.
2023-02-28 05:16:54 +01:00
nmlgc c8997cd500 [Maintenance] [th05] Lasers: Prepare for two segments in one translation unit
Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 12:10:52 +01:00
nmlgc ee58546025 [Decompilation] [th05] Lasers: 2D vector construction
More custom code generation!

Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 11:46:25 +01:00
nmlgc a31c5a4a4f [Decompilation] [th04] Player: Input → movement velocity
That's not nice to the call site!

Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 11:44:15 +01:00
nmlgc bcc2669afe [Reverse-engineering] [th05] Sara: State
Going for a union this time, as all but one of the used state bytes
have different semantics in phases 2, 3, and 4.

Part of P0227, funded by nrook.
2023-01-17 10:37:49 +01:00
nmlgc 4f853261fa [Decompilation] [th05] Stage 5 midboss: Rendering
15 lines of code, and still not quirk-free.

Completes P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01:00
nmlgc 944a66cf77 [Maintenance] [th04/th05] Bosses: Single-file, multi-segment code structure
As implied in adffa1c, a single segment-switching translation unit for
both rendering functions and game logic is the most straightforward
solution for those two games. Especially once you look at TH04, and
realize that the wildly chaotic order of the *_fg_render() functions in
the first code segment exactly matches the order of the *_update()
functions in the third.

Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01:00
nmlgc afbca78e6c [Decompilation] [th02] Text overlay: Right-aligned 8-digit number display
Oh look, a small TH02-only commit! Might as well decompile the small
function in front of TH02's overlay_wipe(), so that I can include it
in the next commit.

Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01:00
nmlgc f01e46700d [Maintenance] [th04/th05] Cutscenes: Move box code to the main translation unit
With the script parsing and picture/box rendering functions being as
interleaved as they are, it makes little sense to keep the cutscene
code in more than one translation unit. How would those translation
units even be called? This time, having everything in one file should
beat the few hundred preprocessor-removed lines of code that we end up
adding to each one of the three affected games – and ultimately, you'd
want to merge those systems into one translation unit anyway.

Part of P0224, funded by Splashman and -Tom-.
2022-11-30 19:31:14 +01:00
nmlgc 023cdacc36 [Decompilation] [th03/th04/th05] Cutscenes: Script loading and freeing
Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:08:28 +01:00
nmlgc 576f49129a [Decompilation] [th05] Cutscenes: Return key wait animation
Needlessly blitting glyphs to VRAM until the very end, eh?

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:08:05 +01:00
nmlgc a0ff3f13d2 [Maintenance] [th01] OP.EXE: Move master.lib data back to the ASM husk
Completes P0216, funded by JonathKane.
2022-08-16 01:54:03 +02:00
nmlgc ab7dbf0462 [Decompilation] [th01] OP.EXE: Move the final pieces of data to C land
100%.

Part of P0216, funded by JonathKane.
2022-08-16 01:54:03 +02:00
nmlgc 3123c9d3fd [Maintenance] [th01] REIIDEN.EXE: Move master.lib data back to the ASM husk
Completes P0215, funded by Ember2528 and Yanga.
2022-08-15 00:44:05 +02:00
nmlgc 65ce43443c [Decompilation] [th01] REIIDEN.EXE: Move the final pieces of data to C land
100%. What a giant, uncategorizable mess of data.

Part of P0215, funded by Ember2528.
2022-08-15 00:44:05 +02:00
nmlgc f075c0904e [Maintenance] [th01] REIIDEN.EXE: Merge the first two translation units again
Part of P0214, funded by Ember2528.
2022-08-14 23:22:35 +02:00
nmlgc ff42470c8d [Maintenance] [th01] REIIDEN.EXE: Merge the first two translation units
Yup, code generation details force us to merge these as soon as we can.

Part of P0214, funded by Ember2528.
2022-08-14 23:20:11 +02:00
nmlgc 40051f5ae2 [Maintenance] [th01] Move remaining non-literal data into a new assembly unit
Yeah, no, I'm not going to declare all of those as `extern` and then
"Move all data to C land" after decompiling the entire segment. Once
again (94372d2), it's not too bad – heck, in REIIDEN.EXE, it's less
than a screen worth of identifiers that are still being referenced.

Part of P0214, funded by Ember2528.
2022-08-14 23:02:39 +02:00
nmlgc 158a91e3ce [Maintenance] [th01] FUUIN.EXE: Move master.lib data back to the main ASM husk
Completes P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 1fd32fad0f [Decompilation] [th01] FUUIN.EXE: Move the final pieces of data to C land
100%.

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +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 643f662815 [Decompilation] [th01] VSync interrupt handler: Move all data to C land
Ending the data catch-up with… an unused mouse cursor graphic?!

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc e79f6c62bf [Decompilation] [th01] .GRP / .GRZ / .PTN: Move all data to C land
Cross-executable ZUN bloat 🤮

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc ce9f1ed0c0 [Maintenance] [th01] Move OP and REIIDEN master.lib data to new assembly units
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 738964a451 [Decompilation] [th01] Random resident structure stuff: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 04f5c27d13 [Maintenance] [th01] Move FUUIN.EXE's master.lib data to a new assembly unit
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:22 +02:00
nmlgc 613f340b33 [Decompilation] [th01] TOTLE screen: Metric digit animation
First function, already found a ZUN quirk.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc 00f3cacc5e [Translation unit catch-up] [th01] Archive functions
That was the one piece of technical debt in TH01 we've been carrying
around since March 2015! (0fd7f14)

Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:11 +02:00
nmlgc 813d54fd0d [Decompilation] [th01] Line bullets
Not really "lasers", as they're also what YuugenMagan's pentagram is
made out of.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:57 +02:00