Commit Graph

823 Commits

Author SHA1 Message Date
nmlgc 09f5292c0a [Decompilation] [th03] Player: Position update and clamping
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc 50afb0afa6 [Decompilation] [th02] Staff roll and verdict sequences
Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
nmlgc ddaf8c9495 [Decompilation] [th02] Endings / Staff roll: Picture blitting
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc c96952f47b [Research] Discover how pointer constness affects pointer parameter codegen
In most cases, this discovery will mean that we have to bite the bullet
and remove `const` from pointer parameters if the generated ASM
wouldn't match otherwise. That by itself doesn't really simplify the
code, but at least we get to remove a single bloated `reinterpret_cast`
from one function call already.

Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc e4ff9dae97 [Maintenance] Cutscenes: Centrally define picture coordinates
Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 2181fa22ba [Maintenance] [th02] graph_putsa_fx(): Explicitly declare as `extern "C"`
Needed for a constness overloading hack later. A certain single place
in TH02 will need the `str` parameter to not be `const` for code
generation reasons, but we don't want to force every call site into
passing non-`const` pointers for such a silly reason.

Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 2480c76a56 [Naming] [th04/th05] MAINE.EXE: Top-level menu and scene functions
Also formalizing the `*_menu()` naming convention I've been following
for a while.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc cb7fd94789 [Decompilation] [th03/th04/th05] Music Room: Falling polygon animation
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc 062aa7ae1d [Maintenance] Purge the C-style `typedef struct` syntax
I might change this convention again in the future, particularly once
someone wants to fund C89 conformance, but let's stay consistent for
now.

Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-02 23:59:34 +01:00
nmlgc c6c07e2c4d [Decompilation] [th04/th05] Main menu: Option menu update/render function
Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:43:53 +01:00
nmlgc f294ccb158 [Naming] [th04/th05] Rename the initial rank value to highlight its effect
`RANK_DEFAULT` raised the question why ZUN just didn't directly assign
the apparent default of `RANK_NORMAL`. Turns out that this is what
triggers the first-launch setup menu.

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 19:16:56 +01:00
nmlgc 214c404ef5 [Maintenance] Introduce a type for PC-98 text RAM attributes
No need for signed variants this time!

Part of P0262, funded by [Anonymous] and Blue Bolt.
2023-11-30 18:47:20 +01:00
nmlgc a874bd5408 [Decompilation] [th03] Win screen: Message rendering
A separate function just for the text? How gracious. As if it was
architected for translatability.

Part of P0261, funded by [Anonymous] and Yanga.
2023-11-01 23:17:52 +01:00
nmlgc 5876755977 [Maintenance] [th01] YuugenMagan: Turn the Phase 12 pentagram values into a bug
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 0ffa756cae [Contributing] Decide on `seg` and `off` for x86-segment-related identifiers
I could have equally argued the opposite way, and in favor of `sgm` and
`ofs`, but I've also been using `seg` and `off` more prevalently
throughout the years.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 8943b52167 [Maintenance] Introduce types for VRAM colors and their components
Finally differentiating between colors and columns at least at the type
level.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc f6757d90ea [Maintenance] Simplify vector-related header inclusions
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-10 18:34:16 +02:00
nmlgc 9aad9ad114 [Maintenance] Declare 8-bit pixel delta and length types
Part of P0242, funded by Yanga.
2023-06-06 21:02:47 +02:00
nmlgc be69ab6265 [Research] [th01] Document the bug that causes `game s` to work
Because it shouldn't. Thanks to mu021 for bringing this to my
attention!

Part of P0239, funded by Ember2528.
2023-04-30 17:12:57 +02:00
nmlgc 308b6bcd2c [Maintenance] [th01] Endings: Reclassify the ドカーン image tearing issue as a bug
And explicitly define observability in terms of an infinitely fast
PC-98. That's the only reasonable assumption to make when considering
ports to faster architectures that aren't bottlenecked by disappointing
blitter chips.

Part of P0239, funded by Ember2528.
2023-04-30 17:12:47 +02:00
nmlgc 0b13967de3 [Maintenance] [th01] Add some missing detail to existing comments
Part of P0239, funded by Ember2528.
2023-04-28 22:21:26 +02:00
nmlgc 45c9e71533 [Maintenance] Fix another bunch of accumulated typos and dead code
Part of P0239, funded by Ember2528.
2023-04-28 22:21:21 +02:00
nmlgc 172a6d2b2b [Maintenance] Add a macro for alternate-instruction VRAM offset calculations
Part of P0235, funded by Ember2528.
2023-03-29 12:36:54 +02:00
nmlgc f062e4b84e [Decompilation] Add a macro for faster VRAM offset calculation with bit shifts
Part of P0235, funded by Ember2528.
2023-03-25 21:28:15 +01:00
nmlgc 3afb73eada [Reverse-engineering] [th01] Pellets: Document missing resets for delay clouds
The exact reason why pellets can be carried over from Sariel's first
form to her second… and why you probably shouldn't carelessly use that
redundant count of alive pellets to skip loops in the Anniversary
Edition, because that count will be incorrect after a reset.
Thanks to mu021 for reporting this issue!
2023-03-14 00:18:23 +01:00
nmlgc 6370f96d9a [Reverse-engineering] [th01] Pellets: Correctly document interlacing
It *does* affect collision detection after all, making removal for the
Anniversary Edition slightly more tricky.

Part of P0234, funded by Ember2528.
2023-03-04 19:40:55 +01:00
nmlgc 6713b1bf9c [Maintenance] [th01] 16× TRAM letters: Fix macro copy-pasting accidents
Part of P0234, funded by Ember2528.
2023-03-04 19:40:55 +01:00
nmlgc abeaf851a4 [Platform] [PC-98] EGC rectangle copies
Yup, unaligned! The prefilling case is quite broken on T98-Next, but
given that this emulator hasn't seen any development since 2010 and
every other emulator gets it right, we can reasonably assume that to be
a bug in that emulator.

Completes P0232, funded by [Anonymous].
2023-03-04 19:40:55 +01:00
nmlgc 82f27f3771 [Platform] [PC-98] Page flipping
Inline functions wouldn't generate optimal code in some cases.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc 4548b874d6 [Platform] [PC-98] Font ROM glyph types
Moving the code from TH01 to a new platform layer, and deciding against
the `pc98_` prefix, which is sort of implied by the directory of the
header file it came from. Namespaces would be ideal, but Turbo C++ 4.0J
sadly doesn't support them.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc 49a6834c4a [Maintenance] Move OUT for 8-bit port numbers to x86real.h
We'd like to use this optimization in the platform layer as well.
Turning it into an inline function via __emit__() also allows us to
turn a bunch of other macros into proper inline functions.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc bff375d99d [Maintenance] Introduce a VRAM byte bit constant
log₂(BYTE_DOTS), just like SUBPIXEL_FACTOR and SUBPIXEL_BITS.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc f16144a131 [Naming] Rename peek() and poke() macros to look more intrinsic
And correctly move them to a separate part of x86real.h, as they are
not part of Turbo C++ 4.0J's DOS.H.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:16 +01:00
nmlgc f7ef7f8f30 [Reverse-engineering] [th01] Packfiles: RLE decompression landmines
The things you find by just switching out the memory allocator…

Part of P0231, funded by [Anonymous].
2023-02-28 08:08:16 +01:00
nmlgc c22299e0c8 [Contributing] Introduce a new "ZUN landmine" label for invisible bugs
Thanks to Clerish for the naming inspiration:

	https://twitter.com/Clerish/status/1623990678937034752

Part of P0231, funded by [Anonymous].
2023-02-28 08:08:10 +01:00
nmlgc 7191f62dde [Maintenance] [th01] Packfiles: Update to current coding standards
Part of P0231, funded by [Anonymous].
2023-02-28 08:07:53 +01:00
nmlgc 4a0d2f3f20 [Maintenance] [th01] Introduce a top/left coordinate type for other branches
I'd really like to keep the semantics in usage code instead of using
`screen_point_t` everywhere.

Part of P0230, funded by [Anonymous].
2023-02-28 08:07:53 +01:00
nmlgc a503ba3095 [Maintenance] [th01] Fix temporary macros
We have, in fact, already decompiled all FPU code in PC-98 Touhou.

Part of P0230, funded by [Anonymous].
2023-02-28 08:07:53 +01:00
nmlgc 8ab99e2feb [Maintenance] [th01] Fix wrong type semantics
Part of P0230, funded by [Anonymous].
2023-02-28 08:07:52 +01:00
nmlgc b326f1df11 [Maintenance] [th01] Endings: Spell out the end_flag condition
Will clarify how the merged frame_delay() function on the `debloated`
branch can switch between binaries.

Part of P0230, funded by [Anonymous].
2023-02-28 08:07:52 +01:00
nmlgc b1487295e8 [Maintenance] [th01] REYHI*.DAT: Fix parameter type of scoredat_name_get()
Part of P0230, funded by [Anonymous].
2023-02-28 08:07:52 +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 8e24c92bd9 [Maintenance] [th01] High Score menu: Consistently use the ENDM_A.GRP constant
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 6e9c4c7b9d [Maintenance] [th01] High Score menu: Change pixel macros to constants
Allows us to use them as switch cases in the `debloated` branch, in
exchange for turning some inline functions to macros.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc cb7b67bfe3 [Naming] [th01] Extra bombs per life lost
This variable makes more sense if we name it after its one actual and
consistent usage. All others make more sense when interpreted as a bug
or bloat.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 357573eaf7 [Naming] [th01] Use a consistent `rem_` prefix for current lives and bombs
Same rationale here – this naming scheme clarifies how these variables
are just redundant copies out of the resident structure.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc e0e9741f92 [Naming] [th01] Use a consistent `credit_` prefix for starting lives
The `credit_` prefix may seem redundant within the REIIDEN.CFG
structure, but consistency seems more important here. Makes it much
easier to follow how these fields are copied around.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc d0dcb5309e [Naming] [th01] .GRP: Palette fade delay frames per step
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 4716948b57 [Maintenance] [th01] Declare types for signed and unsigned scores
Will make it much easier for modders to resolve this inconsistency.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 841d8be376 [Maintenance] [th01] Stage objects: Define X/Y counts without playfield metrics
Clean subsystem hierarchy restored.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00