-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: USB hotswapping for replay storage #39
Conversation
Here's a sample of aforementioned game crash btw:
|
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
yes: on while usb inserted and write thread is keeping up stealth: flash when usb inserted, flash when end of game is successfully written no: no led behavior
I think we got away with this before cuz all __cycle invocations used the same command length. Not sure if this can actually cause errors but for correctness...
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some quick thoughts while i get my head around the rest
} | ||
if (ncfg->Version == 0xC) | ||
{ | ||
// 0 defaults are fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if replays are currently enabled and set the LED to stealth if so
bool failedToMount = false; | ||
bool hasFile = false; | ||
bool mounted = true; | ||
const bool use_usb = ConfigGetUseUSB() != 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u32 UseUSB = ConfigGetUseUSB(); // Returns 0 for SD, 1 for USB
based on the line above, shouldn't this be const bool use_usb = ConfigGetUseUSB() (== 1);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigGetUseUSB
refers to ISO device, so file write device is 'opposite'
loader/source/menu.c
Outdated
"How Drive LED should be used to", | ||
"indicate replay device status", | ||
"", | ||
" [Yes]", | ||
" Drive LED will stay lit as long", | ||
" as a replay device is inserted", | ||
" and working properly.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"How Drive LED should be used to", | |
"indicate replay device status", | |
"", | |
" [Yes]", | |
" Drive LED will stay lit as long", | |
" as a replay device is inserted", | |
" and working properly.", | |
"Use the Wii Disc Drive LED", | |
"to indicate replay device status.", | |
"The LED will remain on while", | |
"the replay device is inserted", | |
"and working properly.", |
the general methodology of this change is as follows
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