project-slippi / Nintendont

A Wii Homebrew Project to play GC Games on Wii
42 stars 9 forks source link

feat: USB hotswapping for replay storage #39

Closed jmlee337 closed 1 month ago

jmlee337 commented 1 year ago

the general methodology of this change is as follows

  1. copy the technique from HID.c to set up a thread and addition to main loop to manage the IOCTLs and keep track of devices being inserted or removed
  2. copy enough of libogc/usb.c and libogc/usbstorage.c in to mount inserted devices
  3. modify SlippiFileWriter logic to enable hotswap for usb

caveat: as currently implemented, the game will still not boot without the usb replay device inserted. I am working on removing this limitation as a follow-up.

another note: this may require some closed testing before wide use. I encountered some game crashes while implementing. However I believe those were attributable solely to errors at the time. Additionally the crashes always occurred as the game started (between stage select and go) and not during the middle of games

please feel free to @ me in discord if there are any questions or explanations required

jmlee337 commented 1 year ago

Here's a sample of aforementioned game crash btw:

HSD ArchiveParse: byte-order mismatch! Please check data format 20004002 56
HSD ArchiveParse error!
assertion "0" failed in lbarchive.c on line 73.
DATE Feb 13 2002 TIME 22:06:27

SN v1.11.1-5-9bc7eda8-dirty
 Console runtime: 2415 frames
 Scene runtime: 144 frames

- STACK -----------------------
 Address:  Back Chain  LR Save
804EE9A8:   804EE9D0   803882EC
804EE9D0:   804EE9F0   80388260
804EE9F0:   804EEA18   80016AA4
804EEA18:   804EEAB8   80016D20
804EEAB8:   804EEB10   800222E4
804EEB10:   804EEB30   8016E7C8
804EEB30:   804EEB48   8016E94C
804EEB48:   804EEB80   801A40E8
804EEB80:   804EEBB0   801A44C4
804EEBB0:   804EEBD0   801A45C8
804EEBD0:   804EEBF8   801601AC
804EEBF8:   FFFFFFFF   8000533C

PXL_20230926_140715561

jmlee337 commented 1 month ago

squashed commits.

To reiterate from discord, I've had testers running weeklies for 10 months and larger locals (up to 64 entrants) for 3 months. No regressions or confirmed bugs have been found

jmlee337 commented 1 month ago

Removed "stealth" Replays LED setting as discussed in discord As well see below, Replays LED setting description with the existing UCF setting description for comparison PXL_20240925_120155904 PXL_20240925_085314432