mirror of
https://github.com/mogzol/sharpii.git
synced 2024-11-22 10:19:17 +01:00
bc65416cf7
- You can now download an IOS with -ios # in NUSD - Downloaded IOS wads are now named like so: IOS##-64-####.wad - Under certain conditions, when downloading a wad with NUS, it will not be saved in a folder, just as the WAD (see ReadMe) - If missing dll's are detected (WadInstaller or libWiiSharp), Sharpii will ask to download them, if they are required. - You can now use a .dol file instead of a .wad with the '-dol' in the WAD editor/packer - Probably a few other little things I have forgotten - Even more code cleanup and bug fixes
99 lines
1.6 KiB
C
99 lines
1.6 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ogcsys.h>
|
|
|
|
#include "sys.h"
|
|
|
|
/* Constants */
|
|
#define CERTS_LEN 0x280
|
|
|
|
/* Variables */
|
|
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
|
|
|
|
|
|
void __Sys_ResetCallback(void)
|
|
{
|
|
/* Reboot console */
|
|
Sys_Reboot();
|
|
}
|
|
|
|
void __Sys_PowerCallback(void)
|
|
{
|
|
/* Poweroff console */
|
|
Sys_Shutdown();
|
|
}
|
|
|
|
|
|
void Sys_Init(void)
|
|
{
|
|
/* Initialize video subsytem */
|
|
VIDEO_Init();
|
|
|
|
/* Set RESET/POWER button callback */
|
|
SYS_SetResetCallback(__Sys_ResetCallback);
|
|
SYS_SetPowerCallback(__Sys_PowerCallback);
|
|
}
|
|
|
|
void Sys_Reboot(void)
|
|
{
|
|
/* Restart console */
|
|
STM_RebootSystem();
|
|
}
|
|
|
|
void Sys_Shutdown(void)
|
|
{
|
|
/* Poweroff console */
|
|
if(CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE) {
|
|
s32 ret;
|
|
|
|
/* Set LED mode */
|
|
ret = CONF_GetIdleLedMode();
|
|
if(ret >= 0 && ret <= 2)
|
|
STM_SetLedMode(ret);
|
|
|
|
/* Shutdown to idle */
|
|
STM_ShutdownToIdle();
|
|
} else {
|
|
/* Shutdown to standby */
|
|
STM_ShutdownToStandby();
|
|
}
|
|
}
|
|
|
|
void Sys_LoadMenu(void)
|
|
{
|
|
u32 *stub = (u32 *)0x80001800;
|
|
|
|
/* Homebrew Channel stub */
|
|
if (*stub)
|
|
exit(0);
|
|
|
|
/* Return to the Wii system menu */
|
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
|
}
|
|
|
|
s32 Sys_GetCerts(signed_blob **certs, u32 *len)
|
|
{
|
|
static signed_blob certificates[CERTS_LEN] ATTRIBUTE_ALIGN(32);
|
|
|
|
s32 fd, ret;
|
|
|
|
/* Open certificates file */
|
|
fd = IOS_Open(certs_fs, 1);
|
|
if (fd < 0)
|
|
return fd;
|
|
|
|
/* Read certificates */
|
|
ret = IOS_Read(fd, certificates, sizeof(certificates));
|
|
|
|
/* Close file */
|
|
IOS_Close(fd);
|
|
|
|
/* Set values */
|
|
if (ret > 0) {
|
|
*certs = certificates;
|
|
*len = sizeof(certificates);
|
|
}
|
|
|
|
return ret;
|
|
}
|