ClassiCube icon indicating copy to clipboard operation
ClassiCube copied to clipboard

Migrate GameCube port to libogc2

Open Extrems opened this issue 3 weeks ago • 3 comments

This adds support for the following:

  • exFAT filesystem and GPT partitioning
  • CUBEODE and GC Loader
  • MMCE (FlipperMCE and GCMCE)
  • Semi-passive SD card adapters (GC2SD Gen2, SD2SP2 2.0, etc.)
  • Combo SD card adapters (future products)
  • SD2SP1
  • Expanded MRAM in Dolphin, Orca boards and TDEV
  • Return to loader (Swiss)
  • ENC28J60 (ETH2GC Lite, ETH2GC Sidecar, GCNET, SP1ETH, etc.)
  • W5500, W6100 and W6300 (future products)
  • Possibly more, I forget

This also fixes:

  • RTC time being overwritten by logging data
  • Progressive scan mode being forcibly enabled when using component video
  • ~Garbled sounds due to wrong byte order~
  • Controller hotplug
  • Possibly more, I forget

Extrems avatar Dec 02 '25 21:12 Extrems

Thanks for this, great work!

I'll need a bit of time to go through all the changes.

One thing I have noticed though: You shouldn't need to be swapping endian for sounds, as Audio.c is meant to swap little endian samples to native endian when loading wav sounds - but mistakenly (along with Resources.c) checks for CC_BUILD_BIG_ENDIAN, whereas Core.h defines CC_BIG_ENDIAN when it detects a big endian system. I'll fix this in master.

On Wed., 3 Dec. 2025, 8:26 am Extrems, @.***> wrote:

This adds support for the following:

  • exFAT filesystem and GPT partitioning
  • CUBEODE and GC Loader
  • MMCE (FlipperMCE and GCMCE)
  • Semi-passive SD card adapters (GC2SD Gen2, SD2SP2 2.0, etc.)
  • Combo SD card adapters (future products)
  • SD2SP1
  • Expanded MRAM in Dolphin, Orca boards and TDEV
  • Return to loader (Swiss)
  • ENC28J60 (ETH2GC Lite, ETH2GC Sidecar, GCNET, SP1ETH, etc.)
  • W5500, W6100 and W6300 (future products)
  • Possibly more, I forget

This also fixes:

  • RTC time being overwritten by logging data
  • Progressive scan mode being forcibly enabled when using component video
  • Garbled sounds due to wrong byte order
  • Controller hotplug
  • Possibly more, I forget

You can view, comment on, or merge this pull request online at:

https://github.com/ClassiCube/ClassiCube/pull/1471 Commit Summary

File Changes

(9 files https://github.com/ClassiCube/ClassiCube/pull/1471/files)

Patch Links:

  • https://github.com/ClassiCube/ClassiCube/pull/1471.patch
  • https://github.com/ClassiCube/ClassiCube/pull/1471.diff

— Reply to this email directly, view it on GitHub https://github.com/ClassiCube/ClassiCube/pull/1471, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRVGJCIIFOLP5HHTBY36TT37X7YTAVCNFSM6AAAAACN26TFG2VHI2DSMVQWIX3LMV43ASLTON2WKOZTGY4DONRQGM2TEMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

UnknownShadow200 avatar Dec 03 '25 01:12 UnknownShadow200

In regards to not using SYS_Report, I did intentionally bypass that with the base libogc as the implementation of SYS_Report there relies on realloc and free. That can be a problem for Platform_Log, as it is not really meant to allocate memory (E.g. it can be called when the game is just about to be terminated due to being unable to satisfy a required memory allocation). If it's messing with RTC time though, that is unintentional.

Will libogc2 diverge further from libogc in the future? Platform_GCWii.h is meant to only contain code that is common to both wii and gamecube ports, but that may just become an extra burden if the GameCube and Wii backends grow further and further apart.

UnknownShadow200 avatar Dec 05 '25 11:12 UnknownShadow200

In regards to not using SYS_Report, I did intentionally bypass that with the base libogc as the implementation of SYS_Report there relies on realloc and free. That can be a problem for Platform_Log, as it is not really meant to allocate memory (E.g. it can be called when the game is just about to be terminated due to being unable to satisfy a required memory allocation). If it's messing with RTC time though, that is unintentional.

I see. Well, since libogc's implementation has the same problem, that can be reverted for it.

Will libogc2 diverge further from libogc in the future? Platform_GCWii.h is meant to only contain code that is common to both wii and gamecube ports, but that may just become an extra burden if the GameCube and Wii backends grow further and further apart.

That is the trajectory.

Extrems avatar Dec 05 '25 15:12 Extrems