Also
* Move backends implementations under backends directory.
* Rework file_storage to be a real implementation of storage_backend.
* Fixup PIF_PDT_EEPROM types
* Extract joybus stuff from pif module.
* Extract cart stuff from pif module.
* Extract controllers and paks from si module.
Main changes in this partial rewrite are:
- channel processing is done in 2 separate steps. First is the channel
setup done when 0x1 is written in the "pif status byte". The second step
is the effective channel processing which allow each channel device to
answer. This step is done just before DMA reads. This is in accordance
with Patent 6394905. (Fig5B - Pif Macro). This allowed to greatly
simplify pif channel processing (no more strange bytes to parse in pif
ram and no duplicated code for that).
- "pif status byte" is treated as a bitfield with each flag indicating
which action to take.
- command processing interface has been reworked to separate the
transmitted data (Tx,TxBuf) from the the received data (Rx, RxBuf).
- reworked the code to allow custom pif channel processing
callback. This should allow to implement "raw" processor to let an
external device (such as a Raphnet controller) do the channel
processing.
- Validate pif commands
- Fixed eeprom write command which missed the status byte.
- Updated the controller input backend to split pak detection from
controller connection test.
- Consolidated all input plugin compatibility code inside one module
(eg. controller_input, rumble and pif processings functions).
- Added PIF channel printing debug
- Explicitly name asm_defines_gas.h and asm_defines_nasm.h rather than
using a wildcard rule: otherwise make automatically deletes the latter
after the build is complete(!?) - see [1].
- Add missing dependency of the awk rule on ../../tools/gen_asm_defines.awk.
[1]
https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
This didn't work correctly for two reasons:
- The symbols were being marked as undefined (imported) rather than
exported. I could fix that by adding an initializer (= {0}), but then
the binary gets huge; not sure if there's a way around that.
- Mach-O binaries don't store symbol sizes. You can get nm to try to
calculate them with --size-sort, but I'm not sure if this will always
output the correct result.
In lieu of more complicated platform-specific fixes, I switched to an
approach that renders the value as hex, allowing the object file to be
piped directly to awk on all platforms.
- Fix BITS=32 build (-Wl,-m,elf_i386 obviously doesn't work, and -m32
isn't needed since another part adds '-arch i686' to CFLAGS).
- Change -bundle to -dynamiclib. (-bundle has been effectively
deprecated altogether since the early days of OS X, and was never the
right setting for .dylib files.)
- Only pass '-read_only_relocs suppress' on 32-bit. On x86-64 this flag
just emits a warning saying that it has no effect, and evidently isn't
necessary. (On 32-bit x86 it enables text relocations, which are used
by some of the asm stuff.)
It seems to better convey the idea of implementing the storage_backend,
without being too similar (one has _storage prefix, the other has t as suffix).
I changed the way to export offsets values to make them portable to
msvc. In theory, it could work as it doesn't rely on inline assembly
anymore. The MSVC project file has been updated with something that
could more or less give the desired output, BUT I CANNOT TEST IT.