Commit Graph

2191 Commits

Author SHA1 Message Date
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 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 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 815bcc8308 [Decompilation] [th03/th04/th05] Cutscenes: Input handling
Here's an entire commit to point out why the difference between these
function names matters and shouldn't be #define'd away in some central
input header file.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 19:08:02 +01:00
nmlgc 7cda9e28b2 [Decompilation] [th04/th05] Cutscenes: Text blending animation
Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 17:11:00 +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 ccd5b70b9f [Maintenance] [th03/th04/th05] Cutscenes: Move into a separate subdirectory
Thanks to TH03 having text-below-picture cutscenes before stages 8 and
9, the `/end/` directory is the wrong place to keep this code. And as
we're soon going to see, this feature did evolve during these three
games.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 17:02:34 +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 55d98369d9 [Maintenance] master.hpp: Pass element counts to the hmem_allocbyte() wrapper
Which gets rid of the declaration for `size_t` in a grand total of two
translation units.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 16:59:09 +01:00
nmlgc 753f73f5f2 [Maintenance] master.hpp: Centrally define packfile filename length
The later games need this constant for their buffers as well, and it's
not just needed for loading sound files. Might be overkill to force all
of `master.hpp` to be #included in some additional places, but the
alternative would have been to move it to a `fn_len.hpp` file.
Ultimately, this constant *is* related to master.lib.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 16:58:30 +01:00
nmlgc e83d0772b2 [Maintenance] Turn TRAM width types into Shift-JIS width types
These are more generally useful for general text width calculations
that don't necessarily involve TRAM.

Part of P0223, funded by Blue Bolt and rosenrose.
2022-11-30 16:46:35 +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 139746cca9 [Readme] We have fully decompiled a single game
Also, about time that the blog gets a more prominent place in the
README, now that it has arguably become the main attraction. Certain
new authors who wrote certain bad articles didn't seem to have realized
how the focus of this project has shifted over the last few years.
2022-11-30 16:33:38 +01:00
nmlgc a0f50a92ce [Readme] Fix the position independence explanation link
Thanks to 32th System for reporting this!
https://github.com/nmlgc/rec98.nmlgc.net/issues/5
2022-08-17 13:52:57 +02:00
nmlgc 1a0b9d4cc2 [Readme] Move all game-specific badges into the same column
The original plan was to move TH02 into TH01's column to hopefully get
a better table layout for small screen's out of GitHub's Markdown
renderer. Unfortunately, that backfired hard, and ended up displaying
TH02 *under* TH01, even on larger resolutions.
So let's just give up then. I'll just fix the badges at the source some
day.
2022-08-16 05:40:49 +02: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 e1b65b6eed [Naming] [th01] MDRV2: Rename the board check function
Since it also sets an activation flag, it does much more in context
than checking for a board. This name also highlights why OP.EXE and
FUUIN.EXE ignore the BGM mode specified in the option menu.

Part of P0216, funded by JonathKane.
2022-08-16 01:54:03 +02:00
nmlgc 77832e9e72 [Decompilation] [th01] OP.EXE: main()
0.

Part of P0216, funded by JonathKane.
2022-08-16 01:47:51 +02:00
nmlgc 2beb55d0c4 [Decompilation] [th01] Main menu: Music Test update/render function
1.

Part of P0216, funded by JonathKane.
2022-08-16 01:47:40 +02:00
nmlgc f00093f7c4 [Decompilation] [th01] Main menu: Playing the selected Music Test track
2.

Part of P0216, funded by JonathKane.
2022-08-16 01:47:26 +02:00
nmlgc 97a60b64fc [Decompilation] [th01] Main menu: Option menu update/render function
3.

Part of P0216, funded by JonathKane.
2022-08-16 01:46:55 +02:00
nmlgc a4b72d448d [Decompilation] [th01] Main menu: Top-level menu update/render function
4.

Part of P0216, funded by JonathKane.
2022-08-16 01:46:17 +02:00
nmlgc c714c53310 [Decompilation] [th01] Main menu, part 1 (reviewed)
5.

Part of P0216, funded by JonathKane.
2022-08-16 01:45:46 +02:00
32th-System cc77dc0f19 [Decompilation] [th01] Main menu, part 1
With just the amount of changes to get everything compiling again.
Thank you! --Nmlgc
2022-08-16 01:45:23 +02:00
nmlgc 47cd413064 [Maintenance] Reclassify previously labeled ZUN bugs as quirks where applicable
Part of P0216, funded by JonathKane.
2022-08-16 01:44:16 +02:00
nmlgc 650c1e3364 [Maintenance] Review any redundancies and label them as ZUN bloat
Or quirk, in the case of the slow TH01 ending picture blitting.

Part of P0216, funded by JonathKane.
2022-08-16 01:43:14 +02:00
nmlgc 201722d25a [Maintenance] [th01] Finally add a BGM mode type
And name the FM state in a way that already prepares modded PMD
support. That's the number 1 TH01 mod idea, after all.

Part of P0216, funded by JonathKane.
2022-08-16 01:42:29 +02:00
nmlgc c4302b4ab7 [Maintenance] [th01] #include common.h from the resident structure header
Part of P0216, funded by JonathKane.
2022-08-16 01:41:14 +02:00
nmlgc ed3fbde7d7 [Maintenance] Correctly define `nullptr` as `far` for far-data memory models
Turns out I've misread the execl() documentation. That function does in
fact *not* need a second `nullptr` parameter for envp, because it
doesn't pass envp.

Part of P0216, funded by JonathKane.
2022-08-16 01:41:02 +02:00
nmlgc 08fa2151ca [Maintenance] Make the locked condition handler macro publicly available
I've been thinking about a new directory for any core cross-platform
code that these game typically need. These range from stuff like the
hardware-independent pixel_t types (you shouldn't need to #include a
file named "pc98.h" for those), to stuff like this. "logic" might have
been a good directory name, but does it encompass rendering as well?
So, it'll just be "game" for now. 😶

Part of P0216, funded by JonathKane.
2022-08-16 01:39:29 +02:00
nmlgc 690b4df14b [Maintenance] Fix another bunch of accumulated typos and dead code
Part of P0216, funded by JonathKane.
2022-08-16 01:38:12 +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 08e064fce0 [Decompilation] [th01] REIIDEN.EXE: main()
Three nested infinite loops, and negative glitch stages in debug mode.
What a fitting end, indeed.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-15 00:44:05 +02:00
nmlgc 6a3c1e0f8d [Maintenance] [th01] REIIDEN.EXE: Fix the last remaining type mismatches
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:27:32 +02:00
nmlgc 0fbc674973 [Decompilation] [th01] Bosses: Freeing function switch
Alright, time for the last bigger one.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:27:11 +02:00
nmlgc 7b79d185bd [Decompilation] [th01] Pellets: Committing the destroy score
The final dumb function to remain in REIIDEN.EXE, and it only was the
4th last one to be decompiled…

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:26:48 +02:00
nmlgc 36958c2c1f [Decompilation] [th01] Error message for invalid resident state
The only game to show an error message if you try directly launching a
game through its main executable without setting up sound drivers or
the resident structure, and a really good one at that. "Please start
from the batch file" is the most user-friendly sentence you could print
in that case.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:26:20 +02:00
nmlgc 2174245229 [Decompilation] [th01] Redundant and incomplete graphics freeing function
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:25:57 +02:00
nmlgc 07ea484425 [Decompilation] [th01] In-game debug variable display
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:25:33 +02:00
nmlgc 414770c717 [Decompilation] [th01] Memory info screen
Hiding a lot of dynamic .PTN buffer size information behind misleading
labels. Nothing there to tell ZUN that he could have just easily saved
20% of all this memory by using a structure without an unneeded alpha
plane.

Completes P0214, funded by Ember2528.
2022-08-14 23:24:53 +02:00
nmlgc ea8e2a2f9f [Decompilation] [th01] REIIDEN.EXE: Out-of-memory handler
Part of P0214, funded by Ember2528.
2022-08-14 23:24:29 +02:00
nmlgc 44dbae8062 [Decompilation] [th01] Score-based extends
Part of P0214, funded by Ember2528.
2022-08-14 23:24:06 +02:00