redolution / gekkoboot

A utilitarian bootloader for the GameCube
GNU General Public License v2.0
123 stars 22 forks source link

Add GC Loader support #36

Open coolbho3k opened 2 years ago

coolbho3k commented 2 years ago

This PR adds support for loading from GC Loader, currently prioritized last, as trying to read from GC Loader hangs for 10 seconds if no disc drive is present. It's tested and working on my setup when compiled against the latest libogc2.

A slight modification was made to the FATFS struct to align the disk access window buffer to 32 bits, as libogc2 doesn't allow reading from GC Loader when it's not aligned. This shouldn't affect anything else. Let me know if there's a known better way to do this.

Why load from GC Loader when you've got an IPL replacement chip (or, why even install an IPL replacement when you already have a GC Loader)? Why not? :) It's always best to give the user more options. One practical reason is so we can use the shortcut buttons which aren't supported with GC Loader right now. Plus, projects like PicoBoot may add deeper features that GC Loader users may want to take advantage of, so it could be even more advantageous in the future to have both installed.

Extrems commented 2 years ago

FIL needs to be aligned as well.

One problem with this is, if there isn't any kind of disc drive present, iplboot will hang for 10 seconds when trying the GC Loader.

coolbho3k commented 2 years ago

I'll find and align, though it worked without that but probably by chance.

Hm, should we make it load last, after sd2sp2? If no disk drive present, then that should still be okay, as in that case nothing should be able to boot.

Extrems commented 2 years ago

No disc drive present is a configuration supported by Swiss.

coolbho3k commented 2 years ago

I moved GC Loader to the end. Can Swiss still possibly load if there's no disc drive and you get to the end?

At that point, it boots into the original IPL which tries to boot from disc. So if there's no drive, I'd think there's no remaining way to load Swiss. If that's the case, I think it should be ok if it hangs for 10 seconds here.

coolbho3k commented 2 years ago

It may make sense to wait for #31 to merge and then add GC Loader support as a configuration option, instead, perhaps avoiding trying to boot from it by default and the possibility of the 10 second hang.

coolbho3k commented 2 years ago

Ah that wouldn't work because presumably you would need a device to read the config from too. I think leaving GC Loader last may be the best option

9ary commented 2 years ago

This increases code size significantly, which is a problem for some modchips. This is going to be on hold until we can build multiple variants. In the meantime if you want to use this you can download the build from CI. For what it's worth I'm not at all convinced there is any point in having both an IPL replacement and a drive emulator in the same console. If you want iplboot on gcloader we can build an iso image like Swiss provides.

coolbho3k commented 2 years ago

Ah, I didn't consider impact on code size was that significant.

I will have an attempt at building an ISO image too. But, it still won't be able to actually read from the GC Loader after booting without this change.