diff options
Diffstat (limited to 'backends/platform/wii/main.cpp')
-rw-r--r-- | backends/platform/wii/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/backends/platform/wii/main.cpp b/backends/platform/wii/main.cpp index 7529df6de3..5753ecefe4 100644 --- a/backends/platform/wii/main.cpp +++ b/backends/platform/wii/main.cpp @@ -36,6 +36,17 @@ extern "C" { #endif +bool reset_btn_pressed = false; +bool power_btn_pressed = false; + +void reset_cb(void) { + reset_btn_pressed = true; +} + +void power_cb(void) { + power_btn_pressed = true; +} + int main(int argc, char *argv[]) { s32 res; @@ -50,6 +61,9 @@ int main(int argc, char *argv[]) { printf("startup\n"); + SYS_SetResetCallback(reset_cb); + SYS_SetPowerCallback(power_cb); + if (!fatInitDefault()) { printf("fatInitDefault failed\n"); } else { @@ -77,6 +91,11 @@ int main(int argc, char *argv[]) { fatUnsafeUnmount(PI_DEFAULT); } + if (power_btn_pressed) { + printf("shutting down\n"); + SYS_ResetSystem(SYS_POWEROFF, 0, 0); + } + printf("reloading\n"); return res; |