Restarting an application January 26, 2010 05:57AM | Registered: 14 years ago Posts: 12 |
SYS_ResetSystem(SYS_HOTRESET, 0, 0);Is there any way to restart my application instead of returning to the Homebrew Channel?
Re: Restarting an application January 26, 2010 06:55AM | Registered: 15 years ago Posts: 703 |
Re: Restarting an application January 26, 2010 10:03PM | Registered: 15 years ago Posts: 45 |
Re: Restarting an application January 26, 2010 10:04PM | Registered: 14 years ago Posts: 12 |
Re: Restarting an application January 26, 2010 11:48PM | Registered: 14 years ago Posts: 12 |
Re: Restarting an application January 27, 2010 12:52AM | Admin Registered: 15 years ago Posts: 5,132 |
Re: Restarting an application May 24, 2010 04:09AM | Registered: 14 years ago Posts: 223 |
Re: Restarting an application May 25, 2010 03:52AM | Registered: 14 years ago Posts: 12 |
Quote
Arikado
scanff already answered your question. Restart it yourself.
For example, in Wii Shooting Gallery, I restart the application by setting all of the variables back to zero and sending the player back to the main menu. Thus, you are given the illusion of restarting the application even though it was not actually restarted. This is an allegory of sorts for what scanff is telling you to do.
Re: Restarting an application May 25, 2010 04:16PM | Registered: 14 years ago Posts: 552 |
SYS_RESTART /*!< Reboot the gamecube, force, if necessary, to boot the IPL menu. Cold reset is issued */ SYS_HOTRESET /*!< Restart the application. Kind of softreset */ SYS_SHUTDOWN /*!< Shutdown the thread system, card management system etc. Leave current thread running and return to caller */ SYS_RETURNTOMENU /*!< Directly load the Wii Channels menu, without actually cold-resetting the system */ SYS_POWEROFF /*!< Powers off the Wii, automatically choosing Standby or Idle mode depending on the user's configuration */ SYS_POWEROFF_STANDBY /*!< Powers off the Wii to standby (red LED, WC24 off) mode. */ SYS_POWEROFF_IDLE /*!< Powers off the Wii to idle (yellow LED, WC24 on) mode. */
Re: Restarting an application May 25, 2010 05:57PM | Registered: 14 years ago Posts: 379 |
Re: Restarting an application May 26, 2010 12:24AM | Registered: 14 years ago Posts: 12 |
Quote
Daid
I think you could just 'jump' to the real entry point of the executable.
I think:_start();Might work (_start is an label in the startup assembly code) This wil reset the stack and all variables to initial values, as the startup code handles all this.
#include <ogc/lwp_watchdog.h> #include <wiiuse/wpad.h> #include <ogc/pad.h> #include <ogc/system.h> #include <stdio.h> #include "wiiport.h" #include "version.h" #include "control.h" #define PAD_START 1 #define MAX_PADS 4 #define PAD_END (MAX_BUTTONS*MAX_PADS) void _start(); static int usejoy; static int initialized; static int hwbutton = 0; static int using_gc[MAX_PADS]; static int lastkey[MAX_PADS]; static int rumbling[MAX_PADS]; static long long unsigned rumble_msec[MAX_PADS]; static long long unsigned time2rumble[MAX_PADS]; void poweroff() { hwbutton = WII_SHUTDOWN; } void reset() { hwbutton = WII_RESET; } void wiimote_poweroff(int playernum) { poweroff(); } // Resets or powers off the Wii if the corresponding buttons are pressed. // Resetting currently returns to the Homebrew Channel. void respondToPowerReset() { printf( "OpenBoR %s, Compile Date: " __DATE__ "\n" "Presented by Team Senile.\n" "This Version is unofficial and based on the Senile Source Code.\n" "\n" "Special thanks to SEGA and SNK.\n\n", VERSION ); if (hwbutton == WII_SHUTDOWN) SYS_ResetSystem(SYS_POWEROFF, 0, 0); else if (hwbutton == WII_RESET) _start(); // borExit(0); } static int flag_to_index(unsigned long flag) { int index = 0; unsigned long bit = 1; while(!((bit<<index)&flag) && index<31) ++index; return index; } void control_exit() { int i; for(i=0; i<MAX_PADS; i++) { rumbling = 0; rumble_msec = 0; } usejoy = 0; } void control_init(int joy_enable) { int i; if(initialized) return; for(i=0; i<MAX_PADS; i++) { rumbling = 0; rumble_msec = 0; } usejoy = joy_enable; hwbutton = 0; PAD_Init(); WPAD_Init(); // set callbacks for power/reset buttons SYS_SetResetCallback(reset); SYS_SetPowerCallback(poweroff); WPAD_SetPowerButtonCallback(wiimote_poweroff); initialized = 1; }