Commit Graph

1537 Commits

Author SHA1 Message Date
nmlgc c77a5fd8ed [Separate translation units] [th02] snd_delay_until_volume()
Part of P0133, funded by [Anonymous].
2021-01-31 15:14:55 +01:00
nmlgc d8bf578ad1 [Separate translation units] [th02] snd_load()
Almost not decompilable for alignment reasons!

Part of P0133, funded by [Anonymous].
2021-01-30 19:57:28 +01:00
nmlgc 3428739f80 [Separate translation units] [th02] .MPTN: Inner load functions
Part of P0133, funded by [Anonymous].
2021-01-30 19:53:00 +01:00
nmlgc ce25a6e579 [Separate translation units] [th02/th03/th05] game_init_main()
Oh look, new content! Gotta finish this push at some point, after all…

Part of P0133, funded by [Anonymous].
2021-01-30 19:50:32 +01:00
nmlgc 665f7d30bc [Maintenance] [th02] Move packfile declarations to their own header
Part of P0133, funded by [Anonymous].
2021-01-30 19:40:21 +01:00
nmlgc c876216c1d [Maintenance] Remove master.lib's original master.h 🎉
My repo will never include all of master.lib anyway, as explained in
https://rec98.nmlgc.net/blog/2020-11-03.
That gets me a median build time of 27 seconds for the entirety of
ReC98 on my system, just as estimated in that same blog post. And we're
far from done with #include optimizations…

Part of P0133, funded by [Anonymous].
2021-01-30 19:37:41 +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 eeb4e7ebfa [Maintenance] [th01/th02/th03] Compile the ZUN Soft logo animation as C++
This might have almost been the case that justified making master.hpp
compatible with C translation units… but even this one would like to
use the template functions from th01/math/vector.hpp.

Part of P0133, funded by [Anonymous].
2021-01-30 19:22:12 +01:00
nmlgc 9d23f26445 [Maintenance] [th02] Move HUUHI.DAT declarations to their own file
The `struct date` members in `scoredat_t` add a dependency on <dos.h>
to the entire header file. Makes sense to move it out as early as
possible.

Part of P0133, funded by [Anonymous].
2021-01-30 19:20:08 +01:00
nmlgc 72c32c8c9c [Maintenance] [th02] Compile more C translation units as C++
Everything that uses input and master.lib graphics functions.

Part of P0133, funded by [Anonymous].
2021-01-30 19:19:50 +01:00
nmlgc a186074af3 [Separate translation units] [th01] .PTN, .GRP, and .GRZ formats
Since I'd still prefer to not use include guards *and* to have that
standalone .GRZ viewer, these would have actually caused somewhat of
an issue with the upcoming final stretch of the master.hpp transition.

Part of P0133, funded by [Anonymous].
2021-01-30 19:17:16 +01:00
nmlgc 21d82fab04 [Maintenance] Declare the input bitflags in a consistent way
Turns out the inlining behavior of `const` variables at global scope
that we've been relying on lately is actually exclusive to C++ mode…
once again!

Part of P0133, funded by [Anonymous].
2021-01-30 19:13:11 +01:00
nmlgc 0d137ee526 [Maintenance] Move the vram_planes_set() declaration to its own header file
Might seem inconsistent, given that the function initializes pointers
that are declared in planar.h… but it's always called from other game
initialization functions that don't require pc98.h or planar.h.

Part of P0133, funded by [Anonymous].
2021-01-30 19:11:55 +01:00
nmlgc e4eed85c44 [Separate translation units] [th04/th05] Low-level input (undecompilable)
Reason: Manual "tail call optimization" of input_reset_sense(), with
execution falling through to input_sense() immediately below.

Part of P0133, funded by [Anonymous].
2021-01-30 19:11:01 +01:00
nmlgc 53d3a6fb73 [Maintenance] [th02] Move the resident structure declaration to its own file
Consistency at last.

Part of P0133, funded by [Anonymous].
2021-01-30 18:53:07 +01:00
nmlgc d3a1335e35 [Maintenance] master.hpp transition: Resident palette functions
Final one! Now we only need to get all translation units to use this
header…

Part of P0133, funded by [Anonymous].
2021-01-30 18:51:29 +01:00
nmlgc e8ac905d25 [Maintenance] master.hpp transition: Machine identification
Part of P0133, funded by [Anonymous].
2021-01-30 18:47:35 +01:00
nmlgc 952a1e47f7 [Maintenance] master.hpp transition: Gaiji functions
Part of P0133, funded by [Anonymous].
2021-01-30 18:46:21 +01:00
nmlgc 27bf06751a [Maintenance] master.hpp transition: Keyboard functions
Part of P0133, funded by [Anonymous].
2021-01-30 18:34:14 +01:00
nmlgc c27e7a1b01 [Maintenance] master.hpp transition: Superimpose sprite functions
Part of P0133, funded by [Anonymous].
2021-01-30 18:33:18 +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 7b409a086a [Maintenance] Add address constants for the PC-98 BIOS key press bitmap
Part of P0133, funded by [Anonymous].
2021-01-30 18:30:57 +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 6e91c4f99a [Decompilation] [th05] input_reset_sense_held(), input_wait_for_change()
Nope, not keeping this in ASM just because of some function calls
either.

Part of P0133, funded by [Anonymous].
2021-01-30 18:26:34 +01:00
nmlgc 4229054137 [Decompilation] [th05] snd_bgm_measure(), snd_delay_until_measure()
Umm… but this can't be in the same translation unit as frame_delay(),
because OP.EXE has cdg_put_nocolors() inbetween, which means we'd have
to compile it twice.

What probably happened there: ZUN originally wrote this in C when
frame_delay() was still next to it, then generated ASM from it,
tinkered with that, and ultimately only linked that ASM into the final
game, with the NOPCALL still in there. That might very well be the one
temporary NOPCALL workaround we can never get rid of…

Oh well, at least we got lucky with the padding, and can keep the
cdg_put_nocolors() decompilation from the last commit.

Part of P0133, funded by [Anonymous].
2021-01-30 18:23:03 +01:00
nmlgc c8160b9f94 [Decompilation] [th05] .CDG: Non-color blitting
And this is how you make code less undecompilable by improving your
pointless micro-optimizations to use more registers instead of
self-modifying code. Worth it if only to get rid of the branches in
TH04's undecompilable ASM implementation.

Part of P0133, funded by [Anonymous].
2021-01-30 18:20:44 +01:00
nmlgc 045450c788 [Decompilation] [th03] .CDG: Loading and freeing
Completes P0132, funded by [Anonymous].
2021-01-05 22:17:48 +01:00
nmlgc c12f9ea5f6 [Decompilation] [th03] game_exit_from_mainl_to_main()
Stupid one-off functions deserve stupid names…

Part of P0132, funded by [Anonymous].
2021-01-05 22:16:19 +01:00
nmlgc 120dda99e4 [Maintenance] master.hpp transition: Packfile data and functions
Part of P0132, funded by [Anonymous].
2021-01-05 22:09:13 +01:00
nmlgc 55fb6f2e56 [Maintenance] master.hpp transition: Joystick data and functions
Part of P0132, funded by [Anonymous].
2021-01-05 22:08:57 +01:00
nmlgc 3f61342898 [Decompilation] [th03] graph_putsa_fx()
Part of P0132, funded by [Anonymous].
2021-01-05 22:08:56 +01:00
nmlgc f539cca15d [Decompilation] [th03/th04] snd_delay_until_measure()
Part of P0132, funded by [Anonymous].
2021-01-05 21:56:57 +01:00
nmlgc cd4f94736a [Decompilation] [th03] input_wait_for_ok_or_measure()
… well, unless you put the call at the beginning of the loop.

Part of P0132, funded by [Anonymous].
2021-01-05 21:54:02 +01:00
nmlgc 8ef8f78cc9 [Maintenance] Add a PMD/MMD-independent wrapper for KAJA_GET_SONG_MEASURE
No pseudo-registers in the usage code! Awesome!

Part of P0132, funded by [Anonymous].
2021-01-05 20:02:28 +01:00
nmlgc 3bf078b68c [Separate translation units] [th02/th03/th04] pi_load()
Part of P0132, funded by [Anonymous].
2021-01-05 20:01:44 +01:00
nmlgc c8fa3311b1 [Separate translation units] [th02] Unaccelerated page 1→0 rectangle blitting
Not using the EGC, because we gotta go slow in the main menus…?

Part of P0132, funded by [Anonymous].
2021-01-05 19:55:42 +01:00
nmlgc a1653146da [Separate translation units] [th02] 2D vector functions
Part of P0132, funded by [Anonymous].
2021-01-05 19:51:41 +01:00
nmlgc 39aa257a5d [Decompilation] [th03/th04] pi_put_quarter_8()
Part of P0132, funded by [Anonymous].
2021-01-05 19:47:12 +01:00
nmlgc d70db0e3dc [Maintenance] Move .PI row pointer arithmetic to its own macros
Part of P0132, funded by [Anonymous].
2021-01-05 19:35:31 +01:00
nmlgc dd7e200f3b [Separate translation units] [th02] .PI blitting
Part of P0132, funded by [Anonymous].
2021-01-05 19:34:59 +01:00
nmlgc 8580251c06 [Separate translation units] [th02] snd_kaja_interrupt()
Part of P0132, funded by [Anonymous].
2021-01-05 19:33:37 +01:00
nmlgc b9c24cf931 [Separate translation units] [th02] snd_delay_until_measure()
How was this game even *built*, originally, if it uses *both* a common
shared set of library functions *and* obviously copy-pasted and
separately compiled versions of some of these functions?

Part of P0132, funded by [Anonymous].
2021-01-05 19:32:18 +01:00
nmlgc aac0108c63 [Separate translation units] [th02] Sound effect playback (undecompilable)
Reason: Same as hflip_lut_generate() – wants to be word-aligned, and
the function before it has an odd length :(

Part of P0132, funded by [Anonymous].
2021-01-05 19:29:10 +01:00
nmlgc 52fdb33d1d [Separate translation units] [th02] frame_delay()
Part of P0132, funded by [Anonymous].
2021-01-05 19:23:31 +01:00
nmlgc dc9e3ee475 [Decompilation] [th01] Bosses: Collision handling
Functions with 12 parameters are hard to describe, y'know. Looking
forward to decompiling these giant expressions for the actual
boss↔orb collision parameter passed to this function…

Oh well, at least we're now totally ready for some boss code next
year. 😌

Completes P0131, funded by Yanga.
2020-12-18 01:38:52 +01:00
nmlgc bcdc073403 [Reverse-engineering] [th01] Frame-based random number
Yes, no "generator", just a single number. Used to add some very
minimal randomness to certain things, by taking it modulo a small
number.

Part of P0131, funded by Yanga.
2020-12-18 01:38:51 +01:00
nmlgc 21da5a330d [Reverse-engineering] [th01] Bomb damage flag
Part of P0131, funded by Yanga.
2020-12-18 01:38:50 +01:00
nmlgc 89fbec0a79 [Reverse-engineering] [th01] Test mode damage flag
Part of P0131, funded by Yanga.
2020-12-18 01:38:50 +01:00
nmlgc f80001d34b [Reverse-engineering] [th01] Bosses: Current HP
And once again, SinGyoku is the only boss to get its own variable.
Maybe this means that it was the first boss to be implemented after
all?

Part of P0131, funded by Yanga.
2020-12-18 01:38:49 +01:00
nmlgc d5fd70c458 [Decompilation] [th01] HUD: HP rendering
And we're right back to things not being nice. Because yeah, why
shouldn't these three distinct rendering functions be part of a single
function, selected by magic numbers?
Or why shouldn't the 16×16 wrapper around a 32×32 set of graphics
functions be used to handle backgrounds for 16×8 sprites, resulting in
needlessly complex parameter calculations that lead to sloppy code?

Part of P0131, funded by Yanga.
2020-12-18 01:38:48 +01:00