Commit Graph

1226 Commits

Author SHA1 Message Date
nmlgc 485477bd56 [Maintenance] [th04/th05] Declare snd_se_update() as __cdecl
Part of P0119, funded by [Anonymous] and -Tom-.
2020-09-21 14:59:50 +02:00
nmlgc cbf14ebbe3 [Position independence] [th02/th04/th05] Final false positives in TH05's MAIN.EXE
I'm *so* looking forward to finally driving up the RE% bar again in the
next few pushes.

Completes P0118, funded by -Tom- and Ember2528.
2020-09-17 22:43:31 +02:00
nmlgc 23a7658672 [Position independence] [th05] Final false positives in MAINE.EXE
3996 4/4 measures of BGM ought to be enough for anybody, eh?

Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:39:11 +02:00
wintiger0222 ed197308d7 [Reverse-engineering] [th05] Extra staff roll: Background selection
I didn't know that extra staff roll cutscene order is different for
each character --WindowsTiger

Final actual data references in TH05's MAINE.EXE! 🎉 --Nmlgc

Reviewed and merged as part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:36:08 +02:00
nmlgc 6e61b07055 [Position independence] False positives: Divisions
Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:35:44 +02:00
nmlgc 7ff0950da8 [Position independence] [th04/th05] False positives: Verdict constants
Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:28:19 +02:00
nmlgc 1535aa7dd2 [Reverse-engineering] [th04/th05] X/Y turning for bouncing bullets
Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:27:19 +02:00
nmlgc a417b01634 [Reverse-engineering] [th04] Player shots: Option laser blitting
Used for Marisa's shot in TH04, but still present in TH05, so it makes
sense to cover it now.

Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:25:11 +02:00
nmlgc c790f5fba1 [Position independence] [th01/th02/th04/th05] False positives: Score values
Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:23:26 +02:00
nmlgc a3723364d6 [Reverse-engineering] [th04/th05] HUD: HP bar rendering
Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:23:14 +02:00
nmlgc fd66af1474 [Readme] Incorporate some build-related suggestions from Spaztron64 and -Tom-
Mainly elaborating a bit on choosing different compilers instead of
Borland C++ 5.5, and fixing a common issue with it. Also removing the
16-bit TASM section for the time being, if it's not required.

Part of P0118, funded by -Tom- and Ember2528.
2020-09-17 22:17:47 +02:00
nmlgc 0bb5bc39d9 [Position independence] False positives: Palette color arithmetic
Completes P0117, funded by [Anonymous].
2020-09-16 22:30:57 +02:00
nmlgc 6212a4c21b [Position independence] False positives: 0xFF / 255 / -1
Another dumb concession to the PI counter, leading to one of the single
biggest PI commits ever…

Part of P0117, funded by [Anonymous].
2020-09-16 22:30:57 +02:00
nmlgc 65c72929af [Position independence] False positives: I/O port accesses
… with either the port or the argument in registers. This is one of the
few actually dumb concessions to the PI counter on the website.
Then again, binary *is* a better representation for the contents of the
GRCG tile register than hex…

Part of P0117, funded by [Anonymous].
2020-09-16 22:30:56 +02:00
nmlgc 791d6d6085 [Build] [th04/th05] 16-bit: Rebuild ZUN.COM by default
Shoutout to Egor, who already implemented the necessary wrappers in
2018, which means that I don't have to spend a push on that. 🙂

Part of P0117, funded by [Anonymous].
2020-09-16 22:30:56 +02:00
nmlgc 79e8e41d02 [Build] [th05] gjinit: Include the gaiji compiled from th05/sprites/gaiji.bmp
Which means that edits to that image will now be immediately visible in
TH05 after recompilation!

Part of P0117, funded by [Anonymous].
2020-09-16 22:30:50 +02:00
nmlgc c5852610f6 [th05/gjinit] Initial state
And with that, we finally dumped every single PC-98 Touhou binary!
Since it'd be overkill to merge bmp2arr into the re-baseline branch
though, we also have to start out with the raw image bytes here.

Part of P0117, funded by [Anonymous].
2020-09-16 22:29:55 +02:00
nmlgc 9695c8d277 [th05/memchk] Initial state
No libc anymore, yet still no memory freeing…?

Part of P0117, funded by [Anonymous].
2020-09-16 22:29:35 +02:00
nmlgc 90b7ace180 [th04/memchk] Initial state
Needlessly linked with TCC rather than TLINK, adding almost 4 KB of
completely unnecessary libc startup code.

Or maybe not, since ZUN doesn't free the allocated memory himself, but
relies on libc to do that?

Part of P0117, funded by [Anonymous].
2020-09-16 22:20:34 +02:00
nmlgc 197202d8ee [th05/zuninit] Initial state
On the surface, Version1.02 of the `INTvector set program` seems to
be largely the same as Version1.01, just with fancier instructions,
some redundancy removed, and some slightly different wording in the
playful messages… or is there more to it? Stay tuned!

Part of P0117, funded by [Anonymous].
2020-09-16 22:17:18 +02:00
nmlgc f54cd0fe95 [th04/zuninit] Initial state
Yup, it's finally the right time to properly rebuild ZUN.COM. While
all of these small binaries would still need some RE attention, putting
in the few minutes to make them position-independent right now is
definitely worth it. Adding them to the PI calculation on the website
would take much longer 😅

Part of P0117, funded by [Anonymous].
2020-09-16 22:16:49 +02:00
nmlgc 03048c318d [Decompilation] [th04/th05] Cutscenes: Text blending
Completes P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 12:09:31 +02:00
nmlgc 84baa1d477 [Maintenance] Rename the `_FORCE_INT` enum members to indicate signedness
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 12:09:30 +02:00
nmlgc 461d83e9e4 [Maintenance] Move the value-first outw() variant to decomp.h
Not really PC-98-hardware-related, not really master.lib-related, so
yeah, that's really the best place for it.

Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 12:09:26 +02:00
nmlgc 650d863942 [Reverse-engineering] [th05] Cutscenes: Shift-JIS codepoint ➜ text color map
Populated by the `\c=<codepoint>,<color>` commands seen at the top of
the .TXT files.

Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:36:49 +02:00
nmlgc 0b7d541e30 [Reverse-engineering] [th03/th04/th05] Cutscene script buffer
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:35:44 +02:00
nmlgc e38602c108 [Reverse-engineering] [th05] High score menu: Floating glyph ball structure
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:35:32 +02:00
nmlgc 041b3a4f28 [Position independence] [th04/th05] Remaining references to the name alphabet
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:29:35 +02:00
nmlgc 10b60b3824 [Maintenance] [th03/th04/th05] Declare the symbol gaiji inherited from TH02
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:29:20 +02:00
nmlgc d973380a9c [Reverse-engineering] [th03/th04/th05] High score menu: Entered place
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:29:09 +02:00
nmlgc e5328a32fc [Reverse-engineering] [th05] Staff roll: Verdict bitmap
28,160 bytes of global data just for a overly large 320×704 bitmap
that allows you to scroll between the general verdict and the
individual end-of-stage scores with the Up and Down keys. That's one
benefit of splitting your game into multiple executables, I guess?

Completes P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:28:01 +02:00
nmlgc 827aee427c [Reverse-engineering] [th05] Staff roll: Star positions
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:27:51 +02:00
nmlgc d54fe1b041 [Reverse-engineering] [th05] Staff roll: Orb trail positions
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:27:41 +02:00
nmlgc ba1f9e230e [Reverse-engineering] [th05] Staff roll: Orb particle structure
Subpixels with 32-bit X and Y components?! That's new.
And yeah, they still just use 4 bits for the fractional part.

Also, let's try something revolutionary for these declarations that are
only used in a single .ASM dump file, and put them all straight before
the first function they are used in. Then we certainly don't forget to
delete them once we're done decompiling that stuff 🙃

Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:23:41 +02:00
nmlgc 498fa0c7fc [Reduction] #713: super_put_tiny_small
Still finding new unmodified master.lib functions in 2020, apparently…

Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:21:54 +02:00
nmlgc 4e6bedf20d [Decompilation] [th05] Staff roll: Space window coordinates
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:21:44 +02:00
nmlgc c59283969e [Reverse-engineering] [th05] Staff roll: Space camera velocity
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:11:40 +02:00
nmlgc 967bb8b633 [Decompilation] [th03] Input mode and delay functions
Nice to see that Borland C++ optimizes bit-tests to cover just the high
or low byte of a word if possible, and that these don't have to be
two-byte structures after all.

Completes P0114, funded by Lmocinemod.
2020-09-07 21:18:40 +02:00
nmlgc aee8a13958 [Separate translation units] [th02] game_exit_to_dos(), zun_error(), graph_putsa_fx()
Oh, wait. Due to ridiculously unlucky alignment, we can't actually
approach TH03's OP.EXE from the top of code segment 2… without
covering way too many functions at once, that is.
At least TH02 works out with "just" three functions at once. *If* we
add seg2 back to OP.EXE, where we previously needed to delete it… 😵

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:40 +02:00
nmlgc f467b6818f [Maintenance] Declare game_exit() and game_exit_to_dos() as __cdecl
Again, no `pascal` convention unless necessary…

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:40 +02:00
nmlgc 716a925636 [Decompilation] [th03] YUME.CFG loading and saving
Oh, I just needed something in TH03's OP.EXE before code segment 2.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:40 +02:00
nmlgc f6757fe76a [Maintenance] Fix DEFCONV declarations, and remove them where possible
Wow, this is the first time we're about to call any of these from C
land in ≥TH03? Found no built-in way to just uppercase an identifier
in TASM, so apparently we have to spell out the names in both lower-
and uppercase.
So, let's go back to regular, non-macro PUBLIC / PROC / ENDP code
wherever we can – for all functions introduced in ≥TH03, and for
everything that takes no parameters. It's simply not worth the
trouble.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc d40547e601 [Maintenance] Drop the `slot` infix for PI-related identifiers
ZUN doesn't ever use PI functions without these slots, making that infix
kind of redundant.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc 50b17d640b [Reverse-engineering] [th03] SPRITE16 setup for double-buffered blitting
Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc 5a6ac29f50 [Separate translation units] [th03] CDG: Non-alpha display (undecompilable)
Reason: Self-modifying. -.-

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc 97ce07bfc9 [Reverse-engineering] [th03] CDG: VRAM plane iteration
Which is where ZUN adds those additional 0x2000 to make the jump from
the 0xB800 plane to the 0xE000 plane.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:38 +02:00
nmlgc ecc1372842 [Decompilation] [th03] Lookup table for horizontally flipping planar pixels
In which we exchange variable names for the ability to decompile more
than just 3 instructions here.
… yeah, "decompilation" is still a stretch.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:38 +02:00
nmlgc 6204fdd450 [Separate translation units] [th02/th03/th04] frame_delay_2()
Completes P0113, funded by Lmocinemod.
2020-09-07 21:18:38 +02:00
nmlgc f0511221b7 [Maintenance] [th02/th03/th04/th05] Establish a common name for code segment 2
About time I finally developed this piece of tech. Towards TH05, this
segment got more and more undecompilable ASM functions mixed inbetween
C ones. Which means that pretty much all of the current ASM land
`#include`s in that segment will have to become translation units. And
we *really* don't want an additional layer of numbered, per-binary
translation units that just `#include` maybe one or two functions.

Also yeah, no _TEXT suffix, to drive home the point that this is a
"library" segment, and not really "owned" by any one file.

Part of P0113, funded by Lmocinemod.
2020-09-07 21:18:38 +02:00
nmlgc 687752160c [Maintenance] Start a new file for x86 FLAGS comparison macros
Part of P0113, funded by Lmocinemod.
2020-09-07 21:18:38 +02:00