From d43dbefab4d766f7b8aff0eb27682481d4bc0be7 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 29 Jul 2023 10:26:25 +1000 Subject: [PATCH] Wii/GameCube: Fix broken due to last commit, and respond to wiit shutdown signal --- src/Platform_GCWii.c | 3 +-- src/Window_GCWii.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Platform_GCWii.c b/src/Platform_GCWii.c index 44b3ca7b1..6cd7f6cdd 100644 --- a/src/Platform_GCWii.c +++ b/src/Platform_GCWii.c @@ -637,9 +637,8 @@ static void AppendDevice(cc_string* path, char* cwd) { int deviceEnd = String_IndexOf(&cwd_, ':'); if (deviceEnd >= 0) { - cc_string dev = String_UNSAFE_Substring(&cwd_, 0, deviceEnd); // e.g. "card0:/" becomes "card0" - String_Append(path, &dev); + String_AppendAll(path, cwd, deviceEnd); } else { String_AppendConst(path, "sd"); } diff --git a/src/Window_GCWii.c b/src/Window_GCWii.c index 6134602fe..fa5e70955 100644 --- a/src/Window_GCWii.c +++ b/src/Window_GCWii.c @@ -16,8 +16,17 @@ static void* xfb; static GXRModeObj* rmode; void* Window_XFB; +static void OnPowerOff(void) { + Event_RaiseVoid(&WindowEvents.Closing); + WindowInfo.Exists = false; +} -void Window_Init(void) { +void Window_Init(void) { + // TODO: SYS_SetResetCallback(reload); too? not sure how reset differs on GC/WII + #if defined HW_RVL + SYS_SetPowerCallback(OnPowerOff); + #endif + // Initialise the video system VIDEO_Init(); @@ -81,6 +90,7 @@ void Window_Close(void) { /* TODO implement */ } + static void HandlePADInput(void) { PADStatus pads[4]; PAD_Read(pads); @@ -356,5 +366,4 @@ void Window_DisableRawMouse(void) { RegrabMouse(); Input_RawMode = false; } - -#endif \ No newline at end of file +#endif