The VM manager is C: vm_* functions over an enum vm_state, boot
parameters that point at the caller's strings rather than owning copies,
and the frontend reached through C host functions in Host.h. The game
database's fixes take the config by pointer. What the manager calls of
the C++ units (the pads', DEV9's, the VIF dynarec's and the GS's start and
stop) is declared with C linkage in their C headers, and the headers it
includes from common/ and pcsx2/ use C comments.
The cheat archives stay in the buffer the file was read into instead of
being copied into a vector, and the content name and boot disc sit in
fixed buffers. The hot-config check scans the C units as well as the C++:
the units that write the settings are now C, and a scan of the C++ alone
would pass with none of them in it.
The unit that holds EmuConfig and EmuFolders, their functions and the
accessors the C units read the configuration through is C89. It includes
every header that declares one of its accessors, so a declaration that
drifts from its definition stops it compiling; those headers' common/
and pcsx2/ dependencies use C comments to allow that. EmuConfig takes
its defaults at retro_init rather than from a static constructor, so a
deinit and init starts from them again.
The frame rate in milli-hertz is rounded half up in double instead of by
lrintf, whose result followed the live rounding mode: called from the
EE's SetGsCrt under its round-to-zero control register, 59.94 Hz came out
as 59939 mHz rather than 59940. The settings suite checks both rounding
modes, builds the config units with the C compiler as C89, and runs in
the mingw-w64 and AArch64 lanes.
Pcsx2Config is a plain C struct over the Emu* option structs, with
emu_config_init, emu_config_equal, emu_config_copy_runtime,
emu_config_apply_option_fixups and the BIOS, memory-card and multitap
helpers in place of its methods, and EmuFolders is a struct of paths with
emu_folders_load_config and emu_folders_ensure_exist. Config.h, with what
it takes from common/, now compiles as C89 on GCC, MinGW and aarch64:
common/Pcsx2Defs.h, General.h and VectorIntrin.h use C comments and the
BitScan fallbacks are __inline__. configstd compiles the header as a C89
unit, so it stays that way, and the settings and patch tests use the C
functions.
A settings reload sets aside just the runtime fields (fast boot, the IRX
and the game arguments) instead of moving the whole 25 KB config, and the
frontend resets its option config in place rather than copying a static
default. dbload's GS fix pass now starts from the default GS options
rather than uninitialised ones.
Sio.cpp, MemoryCardProtocol.cpp, MultitapProtocol.cpp and MemoryCardFile.cpp
become C89 units, and their headers C ones every unit can read. Sio0 and
Sio2 are plain structs with functions (sio0_set_tx_data, sio2_write and so
on) in place of methods; a state carries both whole, so their members keep
their order and types and a build check holds them to the layout states
have had on 64-bit hosts. The byte FIFOs move to SioFifo.c with their
state freeze, which tests/savestate now exercises directly instead of a
copy. The memory card images keep their slots in plain arrays, and read
what they need of the configuration through three functions in
Pcsx2Config.cpp; the card type the configuration carried at run time is
gone with them, since an open card file is what makes a card present. The
pads' three SIO entry points get C linkage (PAD/PADsio.h), and
sioConvertPadToPortAndSlot hands its port and slot back through pointers.
tests/sio drives SIO0, SIO2, the cards and the multitap through every
command a game sends, PS2 and PS1 cards, keyed and unkeyed MagicGate, DMA
blocks, auto-eject, the Python 1 slot latch and a state saved mid-command,
and compares every byte that comes back, the card files and the SIO state
blocks with the transcript the C++ made: they are the same. The tests that
built the C++ files now build the C ones.