Commit Graph

12 Commits

Author SHA1 Message Date
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 a10fe95b31 [Maintenance] Fix comment↔code associations
• Comments that describe all lines of code until a blank one are placed
  into the lines immediately above
• Comments that describe an entire demarcated block are placed
  immediately below the dash row at the top
• In any case, there should be a blank line after the top comment of
  a demarcated block, to keep IntelliSense-style systems from applying
  the block comment to the first actual line of code…
• …but there shouldn't be one before the dash row at the bottom, where
  it'd be redundant.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:53 +02:00
nmlgc 901eda4594 [Maintenance] Consistently indent preprocessor macros
Let's see if anyone ever tries to compile this codebase with a pre-C89
compiler that enforces the # at the beginning of the line.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:06:26 +02:00
nmlgc bca1b7d38a [Maintenance] Add a `nullptr` polyfill to platform.h
Which allows us to remove <stddef.h> from translation units that just
needed it for `NULL`.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:02:51 +02:00
nmlgc 8fce97ea1c [Maintenance] Add a static_assert() polyfill to platform.h
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:50:31 +02:00
nmlgc a42b6c5ceb [Maintenance] Define `(u)int16_t` as `int` rather than `short`
Turbo C++ 4.0J considers them different types internally, even though
they have the same size and signedness. Using `int` allows us to
more correctly redeclare a bunch of functions that originally use
`(unsigned) int` parameters as `(u)int16_t`.

Part of P0134, funded by [Anonymous].
2021-02-20 15:49:20 +01:00
nmlgc 8b4fb566f3 [Maintenance] Move the generic function pointer types to `platform.h`
It kind of is a platform detail, after all. Those 4 `typedef`s don't
really justify their own header file.

Part of P0130, funded by Yanga.
2020-12-18 00:59:48 +01:00
nmlgc 0bfff60a0a [Maintenance] Define `bool` as unsigned
Wait, we can just do that, and nothing breaks?! All this time, we
could have avoided the `unsigned char` workaround???

Part of P0130, funded by Yanga.
2020-12-18 00:45:54 +01:00
nmlgc 389b9a1056 [Decompilation] [th01] Keyboard input in OP.EXE
Starting with the odd one out, the one that doesn't use master.lib and
has two input sense functions: one for the main menu, and one for the
option window.

Both of which also immediately perform the ring arithmetic on the menu
cursor variable… because there's nothing else to be done with these
inputs in OP.EXE? Separating input sensing from processing apparently
wasn't all too obvious of a thought, and it's only truly done in TH02
and later.

Part of P0090, funded by Yanga.
2020-05-12 14:55:09 +02:00
nmlgc 6222b78514 [Reverse-engineering] [th01] Current back page
Previously sloppily mis-RE'd as "some page variable, idk", back in
2015…
Now also with a page number typedef. And yeah, restricting bool to C++
has now proven to be stupid after all.

Part of P0067, funded by Splashman.
2020-01-14 21:48:40 +01:00
nmlgc 417ba80c00 [Decompilation] Add a separate segment type
At least wherever Turbo C++ and master.lib want us to use a
non-pointer, since both use uint16_t for segment values throughout
their APIs instead of the more sensible void __seg*. Maybe, integer
arithmetic on segment values was widely considered more important than
dereferencing?
2019-12-17 23:26:59 +01:00
nmlgc 9cb6cc527a [Decompilation] Finally declare <stdint.h> types
*Finally*. We already used `(unsigned) int` in quite a few places where
we actually want a 16-bit value, which was bound to annoy future port
developers.
2019-12-17 23:26:58 +01:00