Commit Graph

810 Commits

Author SHA1 Message Date
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
nmlgc 24c07c72df [Maintenance] [th01] Replace generic C types with more specific ones
In all places visited during the next 6 pushes: The resident structure
and copies of its values, the packfile implementation, boss entities,
rendering font ROM glyphs to VRAM, and overall inconsistent code
between the three binaries.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc cc42f949e1 [Maintenance] Remove the vsync_reset_*() macros
They obscure the simple nature of these VSync counters more than they
help.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 9b46ff7d99 [Maintenance] [th01] Move TH01-exclusive VRAM text functions to a new header
Neatly dissolves two of the three game-specific preprocessor branches
in `th01/hardware/grppsafx.h`. Moving at least one function into a
corresponding .cpp file will also simplify the corresponding debloating
commit on the respective branch.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc a309e3f549 [Maintenance] [th01] Avoid direct usage of VRAM plane pointers where possible
Might not read as nicely for the 8-dot cases, but makes it easier to
get rid of the pointers if necessary.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 41156c0e76 [Maintenance] [th01] .GRP: Describe the format
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc fde7152cde [Maintenance] [th01] Remove unnecessary #includes
The route selection literal redefinitions should have been removed in
09d4577.

Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc b68a61933f [Maintenance] [th01] Bosses: Classify the end-of-boss scene load as ZUN bloat
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 97c16daa0f [Maintenance] [th01] Palettes: Move specific-color flashing to `palette.h`
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc 02e12786d3 [Maintenance] [th01] Move the boss post-defeat palette to the palette header
Part of P0229, funded by Ember2528.
2023-02-28 08:07:52 +01:00
nmlgc bb42f673e9 [Decompilation] [th05] Lasers: Collision detection
Started out with the usual amount of decompilation workarounds for this
low-level laser code, but ended up requiring one on almost every line
just because ZUN reversed the function prolog… 🙄

Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 11:58:17 +01:00
nmlgc ee58546025 [Decompilation] [th05] Lasers: 2D vector construction
More custom code generation!

Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 11:46:25 +01:00
nmlgc eb8a4506dc [Naming] Change the _HP suffix to a prefix
Auto-completes much better.

Part of P0227, funded by nrook.
2023-01-16 10:20:28 +01:00
nmlgc 6a29e43b43 [Reverse-engineering] graph_putsa_fx(): Weight function cutoffs and glitches
It's easy to blame ASM micro-optimizations for bugs like these, but the
original C++ version from TH01 was equally bugged for FX_WEIGHT_BLACK.

Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01:00