- Disable Wii front buttons (Power + Reset) while installing / removing a title

This commit is contained in:
0verjoY 2023-02-19 21:21:09 +01:00
parent 31d2402d59
commit 384ffbd8a1
3 changed files with 17 additions and 2 deletions

View File

@ -13,16 +13,20 @@
/* Variables */
static const char certs_fs[] ATTRIBUTE_ALIGN(32) = "/sys/cert.sys";
u32 boot2version;
static bool gDisablePRButtons = false;
void __Sys_ResetCallback(__attribute__((unused)) u32 irq, __attribute__((unused)) void *ctx)
{
/* Reboot console */
Sys_Reboot();
if (!gDisablePRButtons)
Sys_Reboot();
}
void __Sys_PowerCallback(void)
{
/* Poweroff console */
Sys_Shutdown();
if (!gDisablePRButtons)
Sys_Shutdown();
}
bool isIOSstub(u8 ios_number)
@ -186,3 +190,8 @@ s32 Sys_GetCerts(signed_blob **certs, u32 *len)
return ret;
}
void SetPRButtons(bool enabled)
{
gDisablePRButtons = !enabled;
}

View File

@ -10,5 +10,6 @@ void Sys_Reboot(void);
void Sys_Shutdown(void);
void Sys_LoadMenu(void);
s32 Sys_GetCerts(signed_blob **, u32 *);
void SetPRButtons(bool enabled);
#endif

View File

@ -479,6 +479,7 @@ bool skipRegionSafetyCheck = false;
s32 Wad_Install(FILE *fp)
{
SetPRButtons(false);
wadHeader *header = NULL;
signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL;
@ -892,11 +893,13 @@ out:
if (gForcedInstall)
return Wad_Install(fp);
SetPRButtons(true);
return ret;
}
s32 Wad_Uninstall(FILE *fp)
{
SetPRButtons(false);
wadHeader *header = NULL;
tikview *viewData = NULL;
@ -1047,5 +1050,7 @@ s32 Wad_Uninstall(FILE *fp)
out:
/* Free memory */
free(header);
SetPRButtons(true);
return ret;
}