Commit Graph

339 Commits

Author SHA1 Message Date
nmlgc 6d977a9df7 [Decompilation] [th03/th04/th05] Cutscenes: Main script parsing loop
Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01:00
nmlgc 8118e61c77 [Decompilation] [th03/th04/th05] Cutscenes: Script opcode interpreter
Even that part's the same in these three games… except for the 27 small
places where it isn't, 7 of which are purely coding style cosmetics.

Completes P0224, funded by Splashman and -Tom-.
2022-11-30 22:46:22 +01:00
nmlgc ac3fba3dce [Decompilation] [th03/th04/th05] Cutscenes: Line and box feeds
Part of P0224, funded by Splashman and -Tom-.
2022-11-30 19:26:55 +01:00
nmlgc 0d85265931 [Decompilation] [th03/th04/th05] Cutscenes: 3-digit number parsing
Used for all ASCII number parameters to script functions, as well as
for TH04's dialog script.

Part of P0224, funded by Splashman and -Tom-.
2022-11-30 19:22:48 +01:00
nmlgc 371292dab2 [Decompilation] [th03/th04] Cutscenes: Box background blitting and unblitting
Completes P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:16:47 +01:00
nmlgc 6f8b32ca4a [Decompilation] [th03/th04/th05] Cutscenes: Masked blitting of new pictures
Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:16:35 +01:00
nmlgc 684c149bef [Decompilation] [th03/th04] Cutscenes: Copying pictures from VRAM page 0→1
And another variation of an EGC-accelerated inter-page copy. At least
it's slightly more optimized compared to TH01's horribly slow one.
But wait, page *0* to page *1*? That seems kind of backwards…

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:11:06 +01:00
nmlgc fb9f18e967 [Decompilation] [th03/th04/th05] Cutscenes: EGC initialization
That only leaves the TH02 versions of this function that really should
have been defined at one central location.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:08:52 +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 ee717c1d19 [Reverse-engineering] [th03/th04/th05] Cutscenes: State variables
You can fast-forward through cutscenes by holding Escape in these
games?! And the script interpreter adds automatic line breaks?!

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 17:10:19 +01:00
nmlgc 2458172c98 [Maintenance] [th02/th03/th04/th05] Define a constant for a white VRAM color
Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 17:00:42 +01:00
nmlgc d3abb3b3ec [Maintenance] Correctly declare egc_start_copy_*()
Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 16:40:12 +01:00
nmlgc 27f901c48d [Decompilation] [th03] High score menu: Name entering loop
Not jank-free by far, but thankfully much better than TH01's.

Completes P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00
nmlgc 1465731780 [Decompilation] [th03] High score menu: High-level row rendering functions
Part of P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00
nmlgc d452fc0f3d [Decompilation] [th03] High score menu: Rendering a single row
Oh, so the high score name is only stored backwards for aesthetic
reasons, to make both the name and score blitting loops look identical.

Part of P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00
nmlgc a823bec801 [Decompilation] [th03] High score menu: REGI*.BFT glyph blitting
Part of P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00
nmlgc ace067fd07 [Decompilation] [th03] High score menu: REGI*.BFT glyph unblitting
What's a EGC?

Part of P0173, funded by [Anonymous].
2021-12-27 03:59:33 +01:00
nmlgc bb4a9d7301 [Decompilation] [th03] High score menu: Alphabet ID → screen space transform
Nice, ZUN learned something from TH01's terrible high score menu code!

Part of P0173, funded by [Anonymous].
2021-12-27 03:59:33 +01:00
nmlgc 1658c0acd3 [Decompilation] [th03] High score menu: Initial alphabet rendering
Part of P0173, funded by [Anonymous].
2021-12-27 03:59:33 +01:00
nmlgc 8750e9e079 [Decompilation] [th03] High score menu: Making room for a new high score
Yup, that 10th score digit stored for every place is in fact unused.

Part of P0173, funded by [Anonymous].
2021-12-27 03:59:33 +01:00
nmlgc da3617a219 [Decompilation] [th03] High score menu: Loading and background blitting
Part of P0173, funded by [Anonymous].
2021-12-27 03:59:33 +01:00
nmlgc 2d5491e4a9 [Decompilation] [th03] YUME.NEM: Loading
"I don't need the return value in MAINL.EXE? Let's copy-paste the
function and remove all of its `return` statements then!" :zunpet:

Completes P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 03:59:33 +01:00
nmlgc 4b7028c9d3 [Decompilation] [th03] YUME.NEM: Checksum verification
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 03:59:33 +01:00
nmlgc b20bf944be [Decompilation] [th03] YUME.NEM: Default data
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 03:59:33 +01:00
nmlgc 6d5918881f [Decompilation] [th03] YUME.NEM: Encryption and saving
Also "intransparently setting the clear flag, but only in the MAINL.EXE
version".

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 03:59:30 +01:00
nmlgc 79aeb8dccc [Decompilation] [th03] YUME.NEM: Decryption
Featuring inline assembly for a single ROR instruction. Turbo C++ 4.0J
unfortunately only offers intrinsics for 16-bit rotations.

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 03:59:02 +01:00
nmlgc 3361cd6991 [Reverse-engineering] [th03] YUME.NEM: Structure
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:16:03 +01:00
nmlgc 53ccdca29a [Reverse-engineering] [th03] YUME.NEM: File name
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:16:03 +01:00
nmlgc e3d611fa42 [Reverse-engineering] [th03] REGI1.BFT / REGI2.BFT sprite IDs
A score format that stores all its data in terms of the internal sprite
IDs…

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:16:03 +01:00
nmlgc 38f9db0592 [Maintenance] [th03] Assign segment #1 in OP and MAINL to a common group name
The YUME.NEM functions won't be decompilable in their natural order
otherwise.

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:15:59 +01:00
nmlgc b95450b026 [Maintenance] Remove the .ALPHA segment ordering workaround
We could have just abused the _TEXT segment all this time?!

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:06:26 +01:00
nmlgc f005eb023b [Maintenance] Remove all unused externs in ASM land
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc 6333643222 [Decompilation] [th03/th04/th05] cfg_load_resident_ptr()
Including the pointless DOS I/O variation in TH05's MAIN.EXE.
I'm slowly running out of characters to remove from the first segment
name in that file, though…

Part of P0148, funded by [Anonymous].
2021-07-21 00:34:59 +02:00
nmlgc 06dbb6335c [Naming] [th03/th04/th05] Clarify that cfg_load_resident() only loads a pointer
It shouldn't need a comment to communicate that this function does in
fact not load all values from the .CFG file that are part of the
resident structure, but only loads and sets the global pointer to that
structure.

Part of P0148, funded by [Anonymous].
2021-07-20 23:35:50 +02:00
nmlgc 531b044cb9 [Separate translation units] [th01/th02/th03/th04] vram_planes_set()
Boom! Clever segment renaming allows us to link the same .OBJ into 12
binaries.
(Well, 10 for now, due to alignment issues in TH04's OP.EXE and
MAINE.EXE.)

Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 17:40:11 +02:00
nmlgc 9d2cce16a2 [Translation unit catch-up] [th03] snd_determine_mode()
Wow, it's -WX, and no workaround necessary!

Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 17:28:59 +02:00
nmlgc e43e3a3fbb [Translation unit catch-up] [th03] snd_pmd_resident()
Not even used in this game.

Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 17:27:55 +02:00
nmlgc 1e5c677ae9 [Translation unit catch-up] [th03] snd_delay_until_volume()
Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 17:26:43 +02:00
nmlgc 0e11d33520 [Translation unit catch-up] [th03] snd_load()
Exhibit B for the theory that ZUN did *not* set the default calling
convention to `pascal` for TH03.

Part of P0138, funded by [Anonymous] and Blue Bolt.
2021-04-21 16:28:29 +02:00
nmlgc 8d953dc42e [Decompilation] [th03/th04/th05] 2D direction vector construction
Hey, a disgustingly impossible "decompilation" again, for a change!

Completes P0137, funded by [Anonymous].
2021-04-04 00:02:50 +02:00
nmlgc 6264ca743c [Translation unit catch-up] [th03/th04] game_exit()
Part of P0137, funded by [Anonymous].
2021-04-03 22:29:12 +02:00
nmlgc f7da96a504 [Separate translation units] [th03] .CDG display (undecompilable)
Reason: Self-modifying. -.-

Part of P0137, funded by [Anonymous].
2021-04-03 22:19:51 +02:00
nmlgc 2527e6ee7c [Translation unit catch-up] [th03] frame_delay()
Also requires more workarounds for TH02 so that we can share this
translation unit across the two games.

Part of P0137, funded by [Anonymous].
2021-04-03 22:15:51 +02:00
nmlgc f1a8d98dbc [Decompilation] [th03] Low-level input
Lovely. Turns out that all it needed to motivate the previous research
was one function that is simply too precious to be kept in ASM…

Part of P0137, funded by [Anonymous].
2021-04-03 22:09:26 +02:00
nmlgc 8bcf5d7b84 [Regression] Explicitly request 16-bit default segments when using .MODEL
Whoops, turns out that the build has been broken on TASM32 version 5.3
(the one in the DevKit) ever since 7897bf1. In contrast to version 5.0
(which I use for my development), 5.3 actually defines 32-bit segments
if you specify a .386 CPU before using .MODEL.

That might have been the reason for the .286 workaround all along?
Turns out there's the USE16 modifier, which makes this much more
explicit than switching CPUs.
2021-03-29 22:39:11 +02:00
nmlgc af13720486 [Translation unit catch-up] [th03] .PI blitting
Part of P0136, funded by [Anonymous].
2021-03-20 02:36:43 +01:00
nmlgc c6c724ac21 [Decompilation] [th03] pi_put_interlace_8()
Obvious copy-pasta…

Part of P0136, funded by [Anonymous].
2021-03-20 02:17:08 +01:00
nmlgc 1ad64dc514 [Translation unit catch-up] [th03] Sound effect playback
Part of P0136, funded by [Anonymous].
2021-03-20 02:17:07 +01:00
nmlgc 0929d91e50 [Translation unit catch-up] [th03] snd_kaja_interrupt()
Part of P0136, funded by [Anonymous].
2021-03-20 02:17:05 +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