mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-12-19 08:21:54 +01:00
*Reset/Power Button fix on Console by julienstephan
This commit is contained in:
parent
7f1c6a3a9c
commit
97d59a61aa
8006
source/menu.cpp
8006
source/menu.cpp
File diff suppressed because it is too large
Load Diff
189
source/sys.c
189
source/sys.c
@ -1,94 +1,95 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "wpad.h"
|
#include "wpad.h"
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define CERTS_LEN 0x280
|
#define CERTS_LEN 0x280
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
|
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
|
||||||
u8 shutdown = 0;
|
u8 shutdown = 0;
|
||||||
|
u8 reset = 0;
|
||||||
void __Sys_ResetCallback(void)
|
|
||||||
{
|
void __Sys_ResetCallback(void)
|
||||||
/* Reboot console */
|
{
|
||||||
Sys_Reboot();
|
/* Reboot console */
|
||||||
}
|
reset = 1;
|
||||||
|
}
|
||||||
void __Sys_PowerCallback(void)
|
|
||||||
{
|
void __Sys_PowerCallback(void)
|
||||||
/* Poweroff console */
|
{
|
||||||
shutdown = 1;
|
/* Poweroff console */
|
||||||
}
|
shutdown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void Sys_Init(void)
|
|
||||||
{
|
void Sys_Init(void)
|
||||||
/* Initialize video subsytem */
|
{
|
||||||
//VIDEO_Init();
|
/* Initialize video subsytem */
|
||||||
|
//VIDEO_Init();
|
||||||
/* Set RESET/POWER button callback */
|
|
||||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
/* Set RESET/POWER button callback */
|
||||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||||
}
|
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||||
|
}
|
||||||
void Sys_Reboot(void)
|
|
||||||
{
|
void Sys_Reboot(void)
|
||||||
/* Restart console */
|
{
|
||||||
STM_RebootSystem();
|
/* Restart console */
|
||||||
}
|
STM_RebootSystem();
|
||||||
|
}
|
||||||
void Sys_Shutdown(void)
|
|
||||||
{
|
void Sys_Shutdown(void)
|
||||||
/* Disconnect WPAD */
|
{
|
||||||
Wpad_Disconnect();
|
Wpad_Disconnect();
|
||||||
/* Poweroff console */
|
|
||||||
if(CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE) {
|
/* Poweroff console */
|
||||||
s32 ret;
|
if(CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE) {
|
||||||
|
s32 ret;
|
||||||
/* Set LED mode */
|
|
||||||
ret = CONF_GetIdleLedMode();
|
/* Set LED mode */
|
||||||
if(ret >= 0 && ret <= 2)
|
ret = CONF_GetIdleLedMode();
|
||||||
STM_SetLedMode(ret);
|
if(ret >= 0 && ret <= 2)
|
||||||
|
STM_SetLedMode(ret);
|
||||||
/* Shutdown to idle */
|
|
||||||
STM_ShutdownToIdle();
|
/* Shutdown to idle */
|
||||||
} else {
|
STM_ShutdownToIdle();
|
||||||
/* Shutdown to standby */
|
} else {
|
||||||
STM_ShutdownToStandby();
|
/* Shutdown to standby */
|
||||||
}
|
STM_ShutdownToStandby();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void Sys_LoadMenu(void)
|
|
||||||
{
|
void Sys_LoadMenu(void)
|
||||||
/* Return to the Wii system menu */
|
{
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
/* Return to the Wii system menu */
|
||||||
}
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
|
}
|
||||||
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
|
||||||
{
|
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
||||||
static signed_blob certificates[CERTS_LEN] ATTRIBUTE_ALIGN(32);
|
{
|
||||||
|
static signed_blob certificates[CERTS_LEN] ATTRIBUTE_ALIGN(32);
|
||||||
s32 fd, ret;
|
|
||||||
|
s32 fd, ret;
|
||||||
/* Open certificates file */
|
|
||||||
fd = IOS_Open(certs_fs, 1);
|
/* Open certificates file */
|
||||||
if (fd < 0)
|
fd = IOS_Open(certs_fs, 1);
|
||||||
return fd;
|
if (fd < 0)
|
||||||
|
return fd;
|
||||||
/* Read certificates */
|
|
||||||
ret = IOS_Read(fd, certificates, sizeof(certificates));
|
/* Read certificates */
|
||||||
|
ret = IOS_Read(fd, certificates, sizeof(certificates));
|
||||||
/* Close file */
|
|
||||||
IOS_Close(fd);
|
/* Close file */
|
||||||
|
IOS_Close(fd);
|
||||||
/* Set values */
|
|
||||||
if (ret > 0) {
|
/* Set values */
|
||||||
*certs = certificates;
|
if (ret > 0) {
|
||||||
*len = sizeof(certificates);
|
*certs = certificates;
|
||||||
}
|
*len = sizeof(certificates);
|
||||||
|
}
|
||||||
return ret;
|
|
||||||
}
|
return ret;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user