Commit Graph

78 Commits

Author SHA1 Message Date
nmlgc 1e41fa0617 [Maintenance] Remove redundant `#include`s
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:51 +02:00
nmlgc b61e612fdf [Maintenance] #include each header's dependencies within the header itself
OK, this is the big one. We still keep using `#include` guards only
where we absolutely need to, but with each header now being valid in
isolation, this can now actually help *minimize* the length of each
translation unit's `#include` list. Turns out that after removing all
the duplicates, we only *actually* need to guard 29 headers across all
5 games.

Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:42 +02:00
nmlgc 15f89da4ee [Maintenance] master.hpp: Split off all PC-98 graphics-related declarations
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:33 +02:00
nmlgc 3fad323d14 [Maintenance] master.hpp: Move into the master.lib directory
With the upcoming `#include` cleanup, it finally makes sense to split
off all graphics-related code into its own header. In turn, it makes
more sense to store all of these future master.lib headers in, well,
the master.lib directory, which provides a new 8 characters for their
file names. Turns out that the rationale I gave for the root directory
placement in 8266bbd didn't hold up 3½ years later…
(Also, the `pc98.h` declarations will eventually be split into
`game/coords.hpp` and something in `platform/x86real/pc98/`.)

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:24 +02:00
nmlgc 0109bc6aa3 [Build] Compile bmp2arr with Turbo C++, using MS-DOS Player on 64-bit systems
Yup, no more 32-bit C++ compiler required!

Part of P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc b86a2b1119 [Build] Rules: Properly split TLINK response file `echo` commands
Completes P0283, funded by [Anonymous].
2024-07-09 08:38:28 +02:00
nmlgc 816f3a083a [Build] Rules: Split long `echo` lines at Windows 9x limits
I have no words.

Part of P0283, funded by [Anonymous].
2024-07-09 08:38:23 +02:00
nmlgc 056085b478 [Build] Rules: Batch TCC invocations with identical command lines
Compiling as many source files as possible within a single TCC process
is the single most important build time optimization we can do. Sadly,
it won't work with Tup's parallel nature, but it can really shine in a
dumb batch build. This is the reason why Windows 9x can compile this
entire codebase on a single core in half the time it takes MS-DOS
Player to do the same on 64-bit Windows, on the same hardware.

That weird double-spacing, however, is the most ridiculous workaround
for a bug I have seen in a long while…

Completes P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc dd129f4f6f [Build] Rules: Add output directory creation to the dumb batch file
`tup generate` does this as well, but only emits the `mkdir` calls for
the directories that are missing in the current working tree, requiring
a clean checkout to actually emit all necessary ones. This is much more
convenient.

Part of P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc 6842b64f5c [Build] Reimplement `tup generate` in Lua and Batch
Part of P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc 10db923251 [Build] [Pipeline] Compile with optimization flags
The ones we use in `Research/` and for the Anniversary Edition. Better
code generation at the cost of having to explicitly declare `main` as
`__cdecl` so that the linker can find it.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc c95d7c5aa8 [Build] Move ZUN.COM generation code into the `Pipeline/` directory
These are just as much of a part of the PC-98 Touhou build pipeline as
the sprite compiler. The future Tupfile will use the tupblocks concept
of treating the build configuration as a branching tree, so we'd like
everything under `Pipeline/` to share a single set of configuration
flags.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc a214f329a7 [Maintenance] grzview: Copy-paste .GRZ stream arrays
Unfortunate, but we won't be able to reuse the same .OBJ file once we
compile all pipeline tools with the `pascal` calling convention.
Separately compiling `th01/formats/img_data.cpp` would also turn into a
mess with the upcoming `#include` cleanup:

• `img_data.cpp` requires `ptn.hpp`,
• which will require `egc.h`,
• which requires `defconv.h`,
• which requires `GAME` to be defined,
• which makes no sense for pipeline tools.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:14 +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 d22c1e6db3 [Platform] [PC-98] Hardware palette setters
Optimally, these are called *at most* once per frame. No need to
micro-optimize here.

Part of P0232, funded by [Anonymous].
2023-02-28 08:08:17 +01:00
nmlgc cf95cc8717 [Maintenance] [th01] Remove `extern "C"` from all remaining areas of code
Nothing says "we're getting things done" quite as much as this.

Part of P0214, funded by Ember2528.
2022-08-14 23:03:15 +02:00
nmlgc e79f6c62bf [Decompilation] [th01] .GRP / .GRZ / .PTN: Move all data to C land
Cross-executable ZUN bloat 🤮

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc a0096e19c1 [Pipeline] bmp2arr: Emit 16- and 32-bit arrays in C++ mode
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:48:40 +02:00
nmlgc 3ea61a8fa7 [Pipeline] bmp2arr: Emit trailing commas in C modes
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:46:54 +02:00
nmlgc 73670108ae [Pipeline] bmp2arr: Add a C++ output format
This one will use the DotRect template from `planar.h` and generate a
single 16- or 32-dot value per row. Since this converter has a goal of
maximum portability, it makes sense to keep raw the multidimensional
C-style arrays around as a possible output format.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:45:14 +02:00
nmlgc caf48cf3ef [Pipeline] bmp2arr: Move C type generation into a single function
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:40:36 +02:00
nmlgc 47dc6a6285 [Pipeline] bmp2arr: Support sprite widths of 32 pixels
It's more appropriate to have a single check in the task verification
code.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:35:33 +02:00
nmlgc a2358bef47 [Maintenance] Remove `extern "C"` from `x86real.h` and `decomp.hpp`
One of those per delivery now, eh?

Part of P0189, funded by Arandui and Lmocinemod.
2022-04-16 23:53:46 +02:00
nmlgc 15b4011ff2 [Maintenance] Remove inconsistent newlines before `extern "C"` braces
Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 18:53:09 +01:00
nmlgc 1c5ed4b06e [Maintenance] Copy <dos.h>'s 16-bit x86 Real Mode declarations to a new file
DOS is not the same thing as the underlying CPU, after all. A separate
file not only indicates to future port authors which parts of the code
are x86-specific, but it also speeds up build times…

… in theory, because removing 677 lines from 49 files each doesn't seem
to speed up the build as much as I had hoped? But apparently my whole
system mysteriously got faster in the meantime, and I was getting 22-23
seconds for the entire repo even before this commit. Good enough.

Part of P0134, funded by [Anonymous].
2021-02-20 23:49:45 +01:00
nmlgc e8ac905d25 [Maintenance] master.hpp transition: Machine identification
Part of P0133, funded by [Anonymous].
2021-01-30 18:47:35 +01:00
nmlgc ec8668264c [Pipeline] bmp2arr: Fail if any non-#000/#FFF pixels are found
And that's all the minimum functionality I wanted to have.
Closes #8.

Part of P0113, funded by Lmocinemod.
2020-09-07 21:18:34 +02:00
nmlgc fea00067d7 [Pipeline] bmp2arr: Extend debug output to cover *all* relevant fields
And with that, we might even get away with not having command-line
help 😛

Part of P0113, funded by Lmocinemod.
2020-09-07 17:36:01 +02:00
nmlgc 23bf61b773 [Pipeline] bmp2arr: Add -q for silencing debug output on stderr
Part of P0113, funded by Lmocinemod.
2020-09-07 17:32:04 +02:00
nmlgc ea8d2466fe [Pipeline] bmp2arr: Require the output type to be provided explicitly
Part of P0113, funded by Lmocinemod.
2020-09-07 17:29:45 +02:00
nmlgc 24699942e6 [Pipeline] bmp2arr: Introduce error codes, and a separate reporting function
Part of P0113, funded by Lmocinemod.
2020-09-07 17:29:44 +02:00
nmlgc 66b72477d2 [Pipeline] bmp2arr: Use bitflags for the preshift/upside-down/debug BMP options
More ergonomic in initializer lists when used as a library.

Part of P0113, funded by Lmocinemod.
2020-09-07 17:29:43 +02:00
nmlgc dfc153ccaa [Pipeline] Merge Jonathan Campbell's sprite converter
Original code at

	https://github.com/joncampbell123/doslib/tree/master/tool/rec98/touhou

Thanks a lot! Almost completes issue #8.
2020-07-09 13:14:44 +02:00
Jonathan Campbell 3e0f8286df [Pipeline] bmp2arr: use malloc/free in a way that would make C++ compilers and their type checking happy 2020-07-09 00:39:06 -07:00
Jonathan Campbell 86c4d541a8 [Pipeline] bmp2arr: __BORLANDC__ and __TURBOC__ case 2020-07-09 00:37:00 -07:00
Jonathan Campbell 44b0313b38 [Pipeline] bmp2arr: write_sprite inner function should be private 2020-07-06 15:16:05 -07:00
Jonathan Campbell 2e4d0b3b8f [Pipeline] bmp2arr: conversion to lib finish 2020-07-06 15:14:50 -07:00
Jonathan Campbell feba961470 [Pipeline] bmp2arr: begin moving to lib 2020-07-06 15:09:42 -07:00
Jonathan Campbell 7afb28dc06 [Pipeline] bmp2arr: Follow MSVC 1.5 warnings 2020-06-27 17:42:55 -07:00
Jonathan Campbell bd7e028609 [Pipeline] bmp2arr: Complete changes. I can now compile bmp2arr.c using Microsoft Visual C++ 1.5 (the 16-bit compiler) 2020-06-27 17:39:45 -07:00
Jonathan Campbell e1e8be3d0d [Pipeline] bmp2arr: Try to work for Borland C and Microsoft C++ 2020-06-27 17:36:46 -07:00
Jonathan Campbell 80a1c99318 [Pipeline] bmp2arr: Remove OMF 2020-06-27 17:17:52 -07:00
Jonathan Campbell 2ac9e7c970 [Pipeline] bmp2arr: preshift grouping 2020-06-26 20:16:32 -07:00
Jonathan Campbell c3b46f6e5d [Pipeline] bmp2arr: Fix C commas 2020-06-26 20:14:35 -07:00
Jonathan Campbell 00da4aa422 [Pipeline] bmp2arr: preshift for sparks, begin 2020-06-26 20:12:46 -07:00
Jonathan Campbell 6485b8c88d [Pipeline] bmp2arr: Fix preshift, do not use data from sprite following the current 2020-06-26 19:58:50 -07:00
Jonathan Campbell 54288cfe60 [Pipeline] bmp2arr: preshift BMP 2020-06-26 19:51:02 -07:00
Jonathan Campbell 1ff658c307 [Pipeline] bmp2arr: more preshift 2020-06-26 19:50:09 -07:00
Jonathan Campbell d857f579e2 [Pipeline] bmp2arr: Begin preshift 2020-06-26 19:43:12 -07:00
Jonathan Campbell cc466c4654 [Pipeline] bmp2arr: more 2020-06-26 17:46:51 -07:00