mirror of
https://github.com/libretro/parallel-ps2.git
synced 2026-11-10 03:11:38 -10:00
The USB stack is C89 again, as the QEMU code it came from was: the OHCI controller, the generic device core, the descriptor builder, HID and the libretro front end (libretro/USB.c). Descriptor trees are counted arrays built by usb_desc_parse_config and released by usb_desc_device_free in place of std::vector; savestate copies go through usb_state_bytes. What the stack needs from the core - IOP RAM, the USB interrupt, the input callback - is declared with C linkage in USB/usb-host.h, and the EyeToy, still C++ on its camera side, is reached through usb-eyetoy/eyetoy.h. The unused RingBuffer goes. Pcsx2Types.h now reads as strict ISO C: u128's unnamed lo/hi view is left out only there, layout unchanged. On it, Konami Python 2 games load from their .py2 descriptor (usb-python2/py2desc.c). The P2IO board (p2io.c, C89, byte level, its whole state one struct) answers the game's commands: JAMMA inputs with the watchdog bit, Dallas dongles in either dump layout, DIP switches, the AV report, coins, and the two serial ports - ICCA card readers with keypads, the DDR extio, Thrill Drive's wheel and seatbelt, Toy's March's drum pads and Dance 86.4's stage handshake. The board takes USB port 1, read from RetroPads 1 and 2 with keypads on the keyboard, and rides in savestates. The descriptor's HDD image (raw, VHD or CHD) becomes the DEV9 drive with its paired SCE identity (DEV9.HddIdFile, else <image>.hddid); its NVRAM replaces the BIOS's and an i.Link ID file seeds a new one (cdvd_set_nvram_files); its pnach replaces the GameDB patches. Unlike reliquary, an SCI close request closes the port, and command arguments past a short packet read as zero. Tests: tests/p2io drives the board byte for byte and parses descriptors; tests/usbstate builds the C stack, parses every device model's descriptors and saves the board mid-answer; tests/ata loads HDD identities; tests/cdvdscmd loads, saves and seeds the game's NVRAM.