mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-23 19:59:16 +01:00
-made exit to neek2o more safe to use (codedumps should be gone)
This commit is contained in:
parent
6639e1977c
commit
4664af265f
@ -35,6 +35,8 @@
|
||||
|
||||
bool checked = false;
|
||||
bool neek = false;
|
||||
u32 kernelSize = 0;
|
||||
void *Kernel = NULL;
|
||||
|
||||
bool neek2o(void)
|
||||
{
|
||||
@ -48,66 +50,72 @@ bool neek2o(void)
|
||||
return neek;
|
||||
}
|
||||
|
||||
bool Load_Neek2o_Kernel()
|
||||
{
|
||||
if(neek2o())
|
||||
return true;
|
||||
|
||||
FILE *file = NULL;
|
||||
file = fopen("usb1:/sneek/kernel.bin", "rb");
|
||||
if(!file)
|
||||
file = fopen("sd:/sneek/kernel.bin", "rb");
|
||||
if(file)
|
||||
{
|
||||
fseek(file , 0 , SEEK_END);
|
||||
kernelSize = ftell(file);
|
||||
rewind(file);
|
||||
Kernel = malloc(kernelSize);
|
||||
if(!Kernel)
|
||||
{
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
fread(Kernel, 1, kernelSize, file);
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Launch_nk(u64 TitleID, const char *nandpath)
|
||||
{
|
||||
if(neek2o())
|
||||
{
|
||||
SYS_ResetSystem(SYS_RESTART, 0, 0);
|
||||
SYS_ResetSystem(SYS_RESTART, 0, 0);
|
||||
return 1;
|
||||
}
|
||||
memcpy((void*)0x91000000, Kernel, kernelSize);
|
||||
DCFlushRange((void*)0x91000000, kernelSize);
|
||||
free(Kernel);
|
||||
|
||||
FILE *file = NULL;
|
||||
long fsize;
|
||||
|
||||
file = fopen( "usb1:/sneek/kernel.bin", "rb" );
|
||||
|
||||
if(!file)
|
||||
file = fopen( "sd:/sneek/kernel.bin", "rb" );
|
||||
|
||||
if(file)
|
||||
{
|
||||
fseek(file , 0 , SEEK_END);
|
||||
fsize = ftell(file);
|
||||
rewind(file);
|
||||
fread((void *)0x91000000, 1, fsize, file);
|
||||
DCFlushRange((void *)0x91000000, fsize);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
fclose(file);
|
||||
|
||||
memcfg *MC = (memcfg*)malloc(sizeof(memcfg));
|
||||
if(MC == NULL)
|
||||
return 0;
|
||||
|
||||
memset(MC, 0, sizeof(memcfg));
|
||||
|
||||
MC->magic = 0x666c6f77;
|
||||
MC->titleid = TitleID;
|
||||
|
||||
|
||||
if(nandpath != NULL)
|
||||
{
|
||||
strcpy(MC->nandpath, nandpath);
|
||||
MC->config |= NCON_EXT_NAND_PATH;
|
||||
}
|
||||
|
||||
memcpy((void *)0x81200000, MC, sizeof(memcfg));
|
||||
DCFlushRange((void *)(0x81200000), sizeof(memcfg));
|
||||
DCFlushRange((void *)(0x81200000), sizeof(memcfg));
|
||||
free(MC);
|
||||
|
||||
|
||||
/*** Thnx giantpune! ***/
|
||||
void *mini = MEM1_memalign(32, armboot_size);
|
||||
if(!mini)
|
||||
return 0;
|
||||
|
||||
memcpy(mini, armboot, armboot_size);
|
||||
DCFlushRange(mini, armboot_size);
|
||||
*(u32*)0xc150f000 = 0x424d454d;
|
||||
asm volatile("eieio");
|
||||
*(u32*)0xc150f004 = MEM_VIRTUAL_TO_PHYSICAL(mini);
|
||||
asm volatile("eieio");
|
||||
IOS_ReloadIOS(0xfe);
|
||||
void *mini = MEM1_memalign(32, armboot_size);
|
||||
if(!mini)
|
||||
return 0;
|
||||
|
||||
memcpy(mini, armboot, armboot_size);
|
||||
DCFlushRange(mini, armboot_size);
|
||||
*(u32*)0xc150f000 = 0x424d454d;
|
||||
asm volatile("eieio");
|
||||
*(u32*)0xc150f004 = MEM_VIRTUAL_TO_PHYSICAL(mini);
|
||||
asm volatile("eieio");
|
||||
IOS_ReloadIOS(0xfe);
|
||||
MEM1_free(mini);
|
||||
return 1;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
s32 Launch_nk(u64 TitleID, const char *nandpath);
|
||||
bool Load_Neek2o_Kernel();
|
||||
bool neek2o(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -12,22 +12,24 @@
|
||||
#include "mload.h"
|
||||
#include "sys.h"
|
||||
#include "channel/channel_launcher.h"
|
||||
#include "loader/nk.h"
|
||||
#include "gecko/gecko.h"
|
||||
#include "memory/mem2.hpp"
|
||||
#include "memory/memory.h"
|
||||
#include "wiiuse/wpad.h"
|
||||
|
||||
/* Variables */
|
||||
static bool reset = false;
|
||||
static bool shutdown = false;
|
||||
bool reset = false;
|
||||
bool shutdown = false;
|
||||
bool exiting = false;
|
||||
|
||||
static bool priiloader_def = false;
|
||||
static bool return_to_hbc = false;
|
||||
static bool return_to_menu = false;
|
||||
static bool return_to_priiloader = false;
|
||||
static bool return_to_disable = false;
|
||||
static bool return_to_bootmii = false;
|
||||
bool priiloader_def = false;
|
||||
bool return_to_hbc = false;
|
||||
bool return_to_menu = false;
|
||||
bool return_to_priiloader = false;
|
||||
bool return_to_disable = false;
|
||||
bool return_to_bootmii = false;
|
||||
bool return_to_neek2o = false;
|
||||
|
||||
extern void __exception_closeall();
|
||||
extern u32 __PADDisableRecalibration(s32 disable);
|
||||
@ -85,6 +87,7 @@ void Sys_ExitTo(int option)
|
||||
return_to_priiloader = option == EXIT_TO_PRIILOADER;
|
||||
return_to_disable = option == EXIT_TO_DISABLE;
|
||||
return_to_bootmii = option == EXIT_TO_BOOTMII;
|
||||
return_to_neek2o = option == EXIT_TO_NEEK2O;
|
||||
|
||||
//magic word to force wii menu in priiloader.
|
||||
if(return_to_menu)
|
||||
@ -114,6 +117,12 @@ void Sys_Exit(void)
|
||||
/* Shutdown Inputs */
|
||||
Close_Inputs();
|
||||
|
||||
if(return_to_neek2o)
|
||||
{
|
||||
Launch_nk(0x1000144574641LL, NULL);
|
||||
while(1);
|
||||
}
|
||||
|
||||
WII_Initialize();
|
||||
if(return_to_menu || return_to_priiloader || priiloader_def)
|
||||
Sys_LoadMenu();
|
||||
|
@ -14,12 +14,16 @@ extern "C" {
|
||||
#define RETURN_CHANNEL 0x0001000857494948ULL
|
||||
#define SYSTEM_MENU 0x0000000100000002ULL
|
||||
|
||||
#define PRIILOADER_DEF 0
|
||||
#define EXIT_TO_MENU 1
|
||||
#define EXIT_TO_HBC 2
|
||||
#define EXIT_TO_PRIILOADER 3
|
||||
#define EXIT_TO_DISABLE 4
|
||||
#define EXIT_TO_BOOTMII 5
|
||||
enum
|
||||
{
|
||||
PRIILOADER_DEF = 0,
|
||||
EXIT_TO_MENU,
|
||||
EXIT_TO_HBC,
|
||||
EXIT_TO_PRIILOADER,
|
||||
EXIT_TO_DISABLE,
|
||||
EXIT_TO_BOOTMII,
|
||||
EXIT_TO_NEEK2O,
|
||||
};
|
||||
|
||||
/* Prototypes */
|
||||
void Sys_Init(void);
|
||||
|
@ -1087,12 +1087,13 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
|
||||
if(useNK2o && !emu_disabled)
|
||||
{
|
||||
cleanup(true);
|
||||
if(!Launch_nk(gameTitle, emuPath.c_str()))
|
||||
if(!Load_Neek2o_Kernel())
|
||||
{
|
||||
error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
cleanup();
|
||||
Launch_nk(gameTitle, emuPath.c_str());
|
||||
while(1);
|
||||
}
|
||||
else
|
||||
|
@ -139,11 +139,13 @@ bool CMenu::_ExitTo(void)
|
||||
}
|
||||
else if(m_btnMgr.selected(m_homeBtnExitToNeek))
|
||||
{
|
||||
if(!Launch_nk(0x1000144574641LL, NULL))
|
||||
if(!Load_Neek2o_Kernel())
|
||||
{
|
||||
error(sfmt("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
|
||||
exitHandler(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
exitHandler(5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -241,8 +241,9 @@ void CMenu::exitHandler(int ExitTo)
|
||||
else
|
||||
Sys_ExitTo(EXIT_TO_HBC);
|
||||
}
|
||||
else if(ExitTo == 5) //Neek2o kernel
|
||||
Sys_ExitTo(EXIT_TO_NEEK2O);
|
||||
}
|
||||
|
||||
m_reload = (BTN_B_HELD || m_disable_exit);
|
||||
if(m_exit)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user