mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-30 15:14:18 +01:00
-some more cleanup of things
-added support for wiiflow internal boot method in neek2o, so you can use cheats, debugger etc if you boot channels in neek2o (doesnt work if you are in real nand and just select boot neek)
This commit is contained in:
parent
3f55f129a6
commit
600437dedf
@ -152,22 +152,26 @@ u32 LoadChannel(u64 title, u32 *IOS)
|
||||
return entry;
|
||||
}
|
||||
|
||||
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u64 title)
|
||||
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio)
|
||||
{
|
||||
bool hook = false;
|
||||
bool hookpatched = false;
|
||||
for(u8 i = 0; i < dolchunkcount; i++)
|
||||
{
|
||||
patchVideoModes(dolchunkoffset[i], dolchunksize[i], vidMode, vmode, patchVidModes);
|
||||
if(vipatch) vidolpatcher(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(configbytes[0] != 0xCD) langpatcher(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(countryString) PatchCountryStrings(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(aspectRatio != -1) PatchAspectRatio(dolchunkoffset[i], dolchunksize[i], aspectRatio);
|
||||
if(hooktype != 0 && dogamehooks(dolchunkoffset[i], dolchunksize[i], true))
|
||||
hook = true;
|
||||
if(vipatch)
|
||||
vidolpatcher(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(configbytes[0] != 0xCD)
|
||||
langpatcher(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(countryString)
|
||||
PatchCountryStrings(dolchunkoffset[i], dolchunksize[i]);
|
||||
if(aspectRatio != -1)
|
||||
PatchAspectRatio(dolchunkoffset[i], dolchunksize[i], aspectRatio);
|
||||
if(hooktype != 0 && hookpatched == false)
|
||||
hookpatched = dogamehooks(dolchunkoffset[i], dolchunksize[i], true);
|
||||
DCFlushRange(dolchunkoffset[i], dolchunksize[i]);
|
||||
ICInvalidateRange(dolchunkoffset[i], dolchunksize[i]);
|
||||
prog(5);
|
||||
prog10();
|
||||
}
|
||||
if(hook)
|
||||
ocarina_do_code(title);
|
||||
if(hookpatched)
|
||||
ocarina_do_code();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ typedef struct _dolheader
|
||||
} __attribute__((packed)) dolheader;
|
||||
|
||||
void PatchChannel(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
||||
u8 patchVidModes, int aspectRatio, u64 title);
|
||||
u8 patchVidModes, int aspectRatio);
|
||||
u32 LoadChannel(u64 title, u32 *IOS);
|
||||
|
||||
#endif /* __CHANHANDLE_HPP_ */
|
||||
|
@ -24,7 +24,8 @@ typedef void (*app_entry)(void (**init)(void (*report)(const char *fmt, ...)),
|
||||
static u8 *appldr = (u8 *)0x81200000;
|
||||
|
||||
/* Constants */
|
||||
#define APPLDR_OFFSET 0x2440
|
||||
#define APPLDR_OFFSET 0x910
|
||||
#define APPLDR_CODE 0x918
|
||||
|
||||
/* Variables */
|
||||
static u32 buffer[0x20] ATTRIBUTE_ALIGN(32);
|
||||
@ -60,7 +61,7 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc
|
||||
appldr_len = buffer[5] + buffer[6];
|
||||
|
||||
/* Read apploader code */
|
||||
ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20);
|
||||
ret = WDVD_Read(appldr, appldr_len, APPLDR_CODE);
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -80,16 +81,17 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc
|
||||
while(appldr_main(&dst, &len, &offset))
|
||||
{
|
||||
/* Read data from DVD */
|
||||
WDVD_Read(dst, len, (u64)(offset << 2));
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString, patchVidModes, aspectRatio, returnTo);
|
||||
WDVD_Read(dst, len, offset);
|
||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString,
|
||||
patchVidModes, aspectRatio, returnTo);
|
||||
DCFlushRange(dst, len);
|
||||
ICInvalidateRange(dst, len);
|
||||
prog10();
|
||||
prog(20);
|
||||
}
|
||||
|
||||
free_wip();
|
||||
if(hooktype != 0 && hookpatched)
|
||||
ocarina_do_code(0);
|
||||
ocarina_do_code();
|
||||
|
||||
/* Set entry point from apploader */
|
||||
*entry = appldr_final();
|
||||
|
@ -13,21 +13,17 @@
|
||||
#include "wdvd.h"
|
||||
|
||||
/* Constants */
|
||||
#define PTABLE_OFFSET 0x40000
|
||||
|
||||
static u8 *diskid = (u8*)0x80000000;
|
||||
#define PART_INFO_OFFSET 0x10000
|
||||
|
||||
s32 Disc_Open()
|
||||
{
|
||||
/* Reset drive */
|
||||
s32 ret = WDVD_Reset();
|
||||
if (ret < 0) return ret;
|
||||
|
||||
memset(diskid, 0, 32);
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Read disc ID */
|
||||
ret = WDVD_ReadDiskId(diskid);
|
||||
|
||||
ret = WDVD_ReadDiskId((u8*)Disc_ID);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -41,85 +37,65 @@ void Disc_SetLowMem(u32 IOS)
|
||||
*Bus_Speed = 0x0E7BE2C0; // Console Bus Speed
|
||||
*CPU_Speed = 0x2B73A840; // Console CPU Speed
|
||||
*Assembler = 0x38A00040; // Assembler
|
||||
*(vu32*)0x800000E4 = 0x80431A80;
|
||||
*OS_Thread = 0x80431A80; // Thread Init
|
||||
*Dev_Debugger = 0x81800000; // Dev Debugger Monitor Address
|
||||
*Simulated_Mem = 0x01800000; // Simulated Memory Size
|
||||
*GameID_Address = 0x80000000; // Fix for Sam & Max (WiiPower)
|
||||
*(vu32*)0xCD00643C = 0x00000000; // 32Mhz on Bus
|
||||
|
||||
/* Fix for Sam & Max (WiiPower) */
|
||||
if(CurrentIOS.Type != IOS_TYPE_HERMES)
|
||||
*GameID_Address = 0x80000000;
|
||||
|
||||
/* Copy disc ID */
|
||||
memcpy((void *)Online_Check, (void *)Disc_ID, 4);
|
||||
|
||||
/* Error 002 Fix (thanks WiiPower and uLoader) */
|
||||
*(vu32*)0x80003140 = (IOS << 16) | 0xffff;
|
||||
//*(u32 *)0x80003140 = *(u32 *)0x80003188; // removes 002-Error (by WiiPower: http://gbatemp.net/index.php?showtopic=158885&hl=)
|
||||
*(vu32*)0x80003188 = *(vu32*)0x80003140;
|
||||
*Current_IOS = (IOS << 16) | 0xffff;
|
||||
*Apploader_IOS = (IOS << 16) | 0xffff;
|
||||
|
||||
/* Flush everything */
|
||||
DCFlushRange((void*)0x80000000, 0x3f00);
|
||||
}
|
||||
|
||||
s32 Disc_FindPartition(u64 *outbuf)
|
||||
{
|
||||
u8 TMP_Buffer_size = 0x20;
|
||||
u64 offset = 0;
|
||||
u32 cnt;
|
||||
/* Thanks Tinyload */
|
||||
static struct {
|
||||
u32 offset;
|
||||
u32 type;
|
||||
} partition_table[32] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 *TMP_Buffer = (u32*)memalign(32, TMP_Buffer_size);
|
||||
if(!TMP_Buffer)
|
||||
return -1;
|
||||
static struct {
|
||||
u32 count;
|
||||
u32 offset;
|
||||
u32 pad[6];
|
||||
} part_table_info ATTRIBUTE_ALIGN(32);
|
||||
|
||||
s32 Disc_FindPartition(u32 *outbuf)
|
||||
{
|
||||
u32 offset = 0;
|
||||
u32 cnt = 0;
|
||||
|
||||
/* Read partition info */
|
||||
s32 ret = WDVD_UnencryptedRead(TMP_Buffer, TMP_Buffer_size, PTABLE_OFFSET);
|
||||
s32 ret = WDVD_UnencryptedRead(&part_table_info, sizeof(part_table_info), PART_INFO_OFFSET);
|
||||
if(ret < 0)
|
||||
{
|
||||
free(TMP_Buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get data */
|
||||
u32 nb_partitions = TMP_Buffer[0];
|
||||
u64 table_offset = TMP_Buffer[1] << 2;
|
||||
|
||||
if(nb_partitions > 8)
|
||||
{
|
||||
free(TMP_Buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(TMP_Buffer, 0, TMP_Buffer_size);
|
||||
|
||||
/* Read partition table */
|
||||
ret = WDVD_UnencryptedRead(TMP_Buffer, TMP_Buffer_size, table_offset);
|
||||
if (ret < 0)
|
||||
{
|
||||
free(TMP_Buffer);
|
||||
ret = WDVD_UnencryptedRead(&partition_table, sizeof(partition_table), part_table_info.offset);
|
||||
if(ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Find game partition */
|
||||
for(cnt = 0; cnt < nb_partitions; cnt++)
|
||||
for(cnt = 0; cnt < part_table_info.count; cnt++)
|
||||
{
|
||||
u32 type = TMP_Buffer[cnt * 2 + 1];
|
||||
|
||||
/* Game partition */
|
||||
if(!type)
|
||||
offset = TMP_Buffer[cnt * 2] << 2;
|
||||
if(partition_table[cnt].type == 0)
|
||||
offset = partition_table[cnt].offset;
|
||||
}
|
||||
free(TMP_Buffer);
|
||||
|
||||
/* No game partition found */
|
||||
if (!offset)
|
||||
if(offset == 0)
|
||||
return -1;
|
||||
WDVD_Seek(offset);
|
||||
|
||||
/* Set output buffer */
|
||||
*outbuf = offset;
|
||||
|
||||
WDVD_Seek(offset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -158,13 +134,12 @@ GXRModeObj *Disc_SelectVMode(u8 videoselected, u32 *rmode_reg)
|
||||
break;
|
||||
}
|
||||
|
||||
char Region = diskid[3];
|
||||
|
||||
const char DiscRegion = ((u8*)Disc_ID)[3];
|
||||
switch(videoselected)
|
||||
{
|
||||
case 0: // DEFAULT (DISC/GAME)
|
||||
/* Select video mode */
|
||||
switch(Region)
|
||||
switch(DiscRegion)
|
||||
{
|
||||
case 'W':
|
||||
break; // Don't overwrite wiiware video modes.
|
||||
@ -208,7 +183,7 @@ GXRModeObj *Disc_SelectVMode(u8 videoselected, u32 *rmode_reg)
|
||||
break;
|
||||
case 5: // PROGRESSIVE 480P
|
||||
rmode = &TVNtsc480Prog;
|
||||
*rmode_reg = Region == 'P' ? TVEurgb60Hz480Prog.viTVMode >> 2 : rmode->viTVMode >> 2;
|
||||
*rmode_reg = DiscRegion == 'P' ? TVEurgb60Hz480Prog.viTVMode >> 2 : rmode->viTVMode >> 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -7,7 +7,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
s32 Disc_Open();
|
||||
s32 Disc_FindPartition(u64 *outbuf);
|
||||
s32 Disc_FindPartition(u32 *outbuf);
|
||||
s32 Disc_SetUSB(const u8 *id, bool frag);
|
||||
void Disc_SetLowMem(u32 IOS);
|
||||
void Disc_SetTime();
|
||||
|
@ -154,6 +154,7 @@ void load_handler()
|
||||
memcpy((void*)0x80001F5A, &codelist, 2);
|
||||
memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);
|
||||
DCFlushRange((void*)0x80001800,codehandler_size);
|
||||
ICInvalidateRange((void*)0x80001000,codehandler_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,12 +164,13 @@ void load_handler()
|
||||
memcpy((void*)0x80001906, &codelist, 2);
|
||||
memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
|
||||
DCFlushRange((void*)0x80001800,codehandleronly_size);
|
||||
ICInvalidateRange((void*)0x80001000,codehandleronly_size);
|
||||
}
|
||||
|
||||
// Load multidol handler
|
||||
memset((void*)0x80001000,0,multidol_size);
|
||||
memcpy((void*)0x80001000,multidol,multidol_size);
|
||||
DCFlushRange((void*)0x80001000,multidol_size);
|
||||
ICInvalidateRange((void*)0x80001000,multidol_size);
|
||||
switch(hooktype)
|
||||
{
|
||||
case 0x01:
|
||||
@ -217,29 +219,16 @@ void load_handler()
|
||||
}
|
||||
DCFlushRange((void*)0x80001198,16);
|
||||
}
|
||||
memcpy((void *)0x80001800, (void*)0x80000000, 6);
|
||||
}
|
||||
|
||||
int ocarina_do_code(u64 chantitle)
|
||||
int ocarina_do_code()
|
||||
{
|
||||
//if (!code_buf) return 0; // Need the handler loaded for hooking other than cheats!
|
||||
|
||||
memset((void *)0x80001800, 0, 0x1800);
|
||||
|
||||
char gameidbuffer[8];
|
||||
memset(gameidbuffer, 0, 8);
|
||||
if(chantitle != 0)
|
||||
{
|
||||
gameidbuffer[0] = (chantitle & 0xff000000) >> 24;
|
||||
gameidbuffer[1] = (chantitle & 0x00ff0000) >> 16;
|
||||
gameidbuffer[2] = (chantitle & 0x0000ff00) >> 8;
|
||||
gameidbuffer[3] = chantitle & 0x000000ff;
|
||||
}
|
||||
else
|
||||
strncpy(gameidbuffer, (char*)Disc_ID, 6);
|
||||
memset((void*)0x80001800, 0, 0x1800);
|
||||
load_handler();
|
||||
memcpy((void *)0x80001800, gameidbuffer, 8);
|
||||
DCFlushRange((void *)0x80001800, 8);
|
||||
memcpy((void*)0x80001800, (void*)Disc_ID, 8);
|
||||
DCFlushRange((void*)0x80001800, 0x1800);
|
||||
|
||||
if(codelist)
|
||||
memset(codelist, 0, (u32)codelistend - (u32)codelist);
|
||||
|
@ -32,7 +32,7 @@ extern u8 debuggerselect;
|
||||
|
||||
void app_gameconfig_set(u32 *gameconfig, u32 tempgameconfsize);
|
||||
void ocarina_set_codes(void *list, u8 *listend, u8 *cheats, u32 cheatSize);
|
||||
int ocarina_do_code(u64 chantitle);
|
||||
int ocarina_do_code();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "video_tinyload.h"
|
||||
#include "apploader.h"
|
||||
#include "patchcode.h"
|
||||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
#include "disc.h"
|
||||
#include "fst.h"
|
||||
#include "wdvd.h"
|
||||
@ -70,7 +72,14 @@ int main()
|
||||
frag_list = normalCFG.fragments;
|
||||
wbfsDev = normalCFG.wbfsDevice;
|
||||
wbfs_part_idx = normalCFG.wbfsPart;
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
s32 ret = BlockIOSReload();
|
||||
gprintf("Block IOS Reload using d2x %s.\n", ret < 0 ? "failed" : "succeeded");
|
||||
}
|
||||
prog10();
|
||||
|
||||
memset((u8*)Disc_ID, 0, 32);
|
||||
if(normalCFG.BootType == TYPE_WII_GAME)
|
||||
{
|
||||
WDVD_Init();
|
||||
@ -86,13 +95,12 @@ int main()
|
||||
if(CurrentIOS.Type == IOS_TYPE_HERMES)
|
||||
Hermes_shadow_mload(normalCFG.mload_rev);
|
||||
}
|
||||
prog10();
|
||||
prog(20);
|
||||
Disc_Open();
|
||||
u64 offset = 0;
|
||||
u32 offset = 0;
|
||||
Disc_FindPartition(&offset);
|
||||
WDVD_OpenPartition(offset, &GameIOS);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
prog10();
|
||||
Apploader_Run(&p_entry, normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString, normalCFG.patchVidMode,
|
||||
normalCFG.aspectRatio, normalCFG.returnTo);
|
||||
AppEntrypoint = (u32)p_entry;
|
||||
@ -101,10 +109,11 @@ int main()
|
||||
else if(normalCFG.BootType == TYPE_CHANNEL)
|
||||
{
|
||||
ISFS_Initialize();
|
||||
*Disc_ID = TITLE_LOWER(normalCFG.title);
|
||||
AppEntrypoint = LoadChannel(normalCFG.title, &GameIOS);
|
||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||
PatchChannel(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.title);
|
||||
normalCFG.patchVidMode, normalCFG.aspectRatio);
|
||||
ISFS_Deinitialize();
|
||||
}
|
||||
gprintf("Entrypoint: %08x, Requested Game IOS: %i\n", AppEntrypoint, GameIOS);
|
||||
|
@ -1,11 +1,6 @@
|
||||
#ifndef __MEMORY_H_
|
||||
#define __MEMORY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define Disc_ID ((vu32*)0x80000000)
|
||||
#define Disc_Region ((vu32*)0x80000003)
|
||||
#define Disc_Magic ((vu32*)0x80000018)
|
||||
@ -19,19 +14,22 @@ extern "C"
|
||||
#define Max_FST ((vu32*)0x8000003C)
|
||||
#define Assembler ((vu32*)0x80000060)
|
||||
#define Video_Mode ((vu32*)0x800000CC)
|
||||
#define OS_Thread ((vu32*)0x800000E4)
|
||||
#define Dev_Debugger ((vu32*)0x800000EC)
|
||||
#define Simulated_Mem ((vu32*)0x800000F0)
|
||||
#define BI2 ((vu32*)0x800000F4)
|
||||
#define Bus_Speed ((vu32*)0x800000F8)
|
||||
#define CPU_Speed ((vu32*)0x800000FC)
|
||||
#define Current_IOS ((vu32*)0x80003140)
|
||||
#define Online_Check ((vu32*)0x80003180)
|
||||
#define GameID_Address ((vu32*)0x80003184)
|
||||
#define Apploader_IOS ((vu32*)0x80003188)
|
||||
|
||||
#define Priiloader_CFG1 ((vu32*)0x8132FFFB)
|
||||
#define Priiloader_CFG2 ((vu32*)0x817FEFF0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define HW_GPIO_OUT ((vu32*)0xCD8000E0)
|
||||
#define HW_AHBPROT ((vu32*)0xCD800064)
|
||||
#define MEM_PROT ((vu32)0xCD8B420A)
|
||||
|
||||
#endif
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "apploader.h"
|
||||
#include "patchcode.h"
|
||||
#include "memory.h"
|
||||
|
||||
u32 hooktype;
|
||||
u8 configbytes[2];
|
||||
@ -218,24 +219,20 @@ bool dogamehooks(void *addr, u32 len, bool channel)
|
||||
|
||||
void langpatcher(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
if(memcmp(addr_start, langpatch, sizeof(langpatch))==0)
|
||||
if(configbytes[0] != 0xCD)
|
||||
langvipatch((u32)addr_start, len, configbytes[0]);
|
||||
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vidolpatcher(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
@ -243,7 +240,6 @@ void vidolpatcher(void *addr, u32 len)
|
||||
{
|
||||
if(memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0)
|
||||
vipatch((u32)addr_start, len);
|
||||
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
@ -449,7 +445,9 @@ void PatchCountryStrings(void *Address, int Size)
|
||||
SearchPattern[1] = 'U';
|
||||
SearchPattern[2] = 'S';
|
||||
}
|
||||
switch(((const u8 *)0x80000000)[3])
|
||||
|
||||
const char DiscRegion = ((u8*)Disc_ID)[3];
|
||||
switch(DiscRegion)
|
||||
{
|
||||
case 'J':
|
||||
PatchData[1] = 'J';
|
||||
@ -490,3 +488,23 @@ void PatchCountryStrings(void *Address, int Size)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 BlockIOSReload(void)
|
||||
{
|
||||
/* Open ES Module */
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
/* IOS Reload Block */
|
||||
static ioctlv block_vector[2] ATTRIBUTE_ALIGN(32);
|
||||
static u32 mode ATTRIBUTE_ALIGN(32);
|
||||
static u32 ios ATTRIBUTE_ALIGN(32);
|
||||
mode = 2;
|
||||
block_vector[0].data = &mode;
|
||||
block_vector[0].len = sizeof(u32);
|
||||
ios = IOS_GetVersion();
|
||||
block_vector[1].data = &ios;
|
||||
block_vector[1].len = sizeof(u32);
|
||||
s32 ret = IOS_Ioctlv(ESHandle, 0xA0, 2, 0, block_vector);
|
||||
/* Close ES Module */
|
||||
IOS_Close(ESHandle);
|
||||
return ret;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ void vidolpatcher(void *addr, u32 len);
|
||||
void PatchCountryStrings(void *Address, int Size);
|
||||
void PatchAspectRatio(void *addr, u32 len, u8 aspect);
|
||||
bool PatchReturnTo(void *Address, int Size, u32 id);
|
||||
s32 BlockIOSReload(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -95,13 +95,13 @@ s32 WDVD_ReadDiskId(void *id)
|
||||
return -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_Seek(u64 offset)
|
||||
s32 WDVD_Seek(u32 offset)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Drive seek */
|
||||
inbuf[0] = IOCTL_DI_SEEK << 24;
|
||||
inbuf[1] = (u32)(offset >> 2);
|
||||
inbuf[1] = offset;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_SEEK, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0) return ret;
|
||||
@ -109,67 +109,7 @@ s32 WDVD_Seek(u64 offset)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_Offset(u64 offset)
|
||||
{
|
||||
//u32 *off = (u32 *)((void *)&offset);
|
||||
union { u64 off64; u32 off32[2]; } off;
|
||||
off.off64 = offset;
|
||||
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Set offset */
|
||||
inbuf[0] = IOCTL_DI_OFFSET << 24;
|
||||
inbuf[1] = (off.off32[0]) ? 1: 0;
|
||||
inbuf[2] = (off.off32[1] >> 2);
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_OFFSET, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_StopLaser(void)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Stop laser */
|
||||
inbuf[0] = IOCTL_DI_STOPLASER << 24;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPLASER, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_StopMotor(void)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Stop motor */
|
||||
inbuf[0] = IOCTL_DI_STOPMOTOR << 24;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_Eject(void)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Stop motor */
|
||||
inbuf[0] = IOCTL_DI_STOPMOTOR << 24;
|
||||
/* Eject DVD */
|
||||
inbuf[1] = 1;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_STOPMOTOR, inbuf, sizeof(inbuf), outbuf, sizeof(outbuf));
|
||||
if (ret < 0) return ret;
|
||||
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_OpenPartition(u64 offset, u32 *IOS)
|
||||
s32 WDVD_OpenPartition(u32 offset, u32 *IOS)
|
||||
{
|
||||
if (di_fd < 0)
|
||||
return di_fd;
|
||||
@ -182,7 +122,7 @@ s32 WDVD_OpenPartition(u64 offset, u32 *IOS)
|
||||
memset(outbuf, 0, sizeof outbuf);
|
||||
|
||||
inbuf[0] = IOCTL_DI_OPENPART << 24;
|
||||
inbuf[1] = offset >> 2;
|
||||
inbuf[1] = offset;
|
||||
|
||||
Vectors[0].data = inbuf;
|
||||
Vectors[0].len = 0x20;
|
||||
@ -216,14 +156,14 @@ s32 WDVD_ClosePartition(void)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
s32 WDVD_UnencryptedRead(void *buf, u32 len, u32 offset)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Unencrypted read */
|
||||
inbuf[0] = IOCTL_DI_UNENCREAD << 24;
|
||||
inbuf[1] = len;
|
||||
inbuf[2] = (u32)(offset >> 2);
|
||||
inbuf[2] = offset;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_UNENCREAD, inbuf, sizeof(inbuf), buf, len);
|
||||
if (ret < 0) return ret;
|
||||
@ -231,14 +171,14 @@ s32 WDVD_UnencryptedRead(void *buf, u32 len, u64 offset)
|
||||
return (ret == 1) ? 0 : -ret;
|
||||
}
|
||||
|
||||
s32 WDVD_Read(void *buf, u32 len, u64 offset)
|
||||
s32 WDVD_Read(void *buf, u32 len, u32 offset)
|
||||
{
|
||||
memset(inbuf, 0, sizeof(inbuf));
|
||||
|
||||
/* Disc read */
|
||||
inbuf[0] = IOCTL_DI_READ << 24;
|
||||
inbuf[1] = len;
|
||||
inbuf[2] = (u32)(offset >> 2);
|
||||
inbuf[2] = offset;
|
||||
|
||||
s32 ret = IOS_Ioctl(di_fd, IOCTL_DI_READ, inbuf, sizeof(inbuf), buf, len);
|
||||
if (ret < 0) return ret;
|
||||
|
@ -11,19 +11,15 @@ s32 WDVD_Close(void);
|
||||
s32 WDVD_GetHandle(void);
|
||||
s32 WDVD_Reset(void);
|
||||
s32 WDVD_ReadDiskId(void *);
|
||||
s32 WDVD_Seek(u64);
|
||||
s32 WDVD_Offset(u64);
|
||||
s32 WDVD_StopLaser(void);
|
||||
s32 WDVD_StopMotor(void);
|
||||
s32 WDVD_OpenPartition(u64 offset, u32 *IOS);
|
||||
s32 WDVD_Seek(u32);
|
||||
s32 WDVD_OpenPartition(u32 offset, u32 *IOS);
|
||||
s32 WDVD_ClosePartition(void);
|
||||
s32 WDVD_UnencryptedRead(void *, u32, u64);
|
||||
s32 WDVD_Read(void *, u32, u64);
|
||||
s32 WDVD_UnencryptedRead(void *, u32, u32);
|
||||
s32 WDVD_Read(void *, u32, u32);
|
||||
s32 WDVD_LowRequestError(u32 *error);
|
||||
s32 WDVD_WaitForDisc(void);
|
||||
s32 WDVD_GetCoverStatus(u32 *);
|
||||
s32 WDVD_SetUSBMode(u32, const u8 *, s32);
|
||||
s32 WDVD_Eject(void);
|
||||
s32 WDVD_Read_Disc_BCA(void *);
|
||||
s32 WDVD_SetFragList(int device, void *fraglist, int size);
|
||||
s32 WDVD_SetStreaming(void);
|
||||
|
@ -88,7 +88,6 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
||||
/* Shutdown IOS subsystems */
|
||||
__IOS_ShutdownSubsystems();
|
||||
u32 level = IRQ_Disable();
|
||||
__lwp_thread_closeall();
|
||||
__exception_closeall();
|
||||
/* Boot it */
|
||||
exeEntryPoint();
|
||||
|
@ -15,23 +15,6 @@
|
||||
#include "unzip/lz77.h"
|
||||
#include "types.h"
|
||||
|
||||
s32 BootChannel(u64 chantitle, u32 ios, u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio)
|
||||
{
|
||||
// IOS Version Check
|
||||
*Real_IOSVersion = ((ios << 16)) | 0xFFFF;
|
||||
*Game_IOSVersion = ((ios << 16)) | 0xFFFF;
|
||||
DCFlushRange((void*)Real_IOSVersion, 4);
|
||||
DCFlushRange((void*)Game_IOSVersion, 4);
|
||||
|
||||
// Game ID Online Check
|
||||
memset((void*)Disc_ID, 0, 4);
|
||||
*Disc_ID = TITLE_LOWER(chantitle);
|
||||
DCFlushRange((void*)Disc_ID, 4);
|
||||
|
||||
WiiFlow_ExternalBooter(vidMode, vipatch, countryString, patchVidMode, aspectRatio, 0, TYPE_CHANNEL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Identify_GenerateTik(signed_blob **outbuf, u32 *outlen)
|
||||
{
|
||||
signed_blob *buffer = (signed_blob *)memalign(32, ALIGN32(STD_SIGNED_TIK_SIZE));
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "gecko/gecko.h"
|
||||
#include "loader/alt_ios.h"
|
||||
#include "loader/cios.h"
|
||||
#include "loader/nk.h"
|
||||
#include "loader/sys.h"
|
||||
#include "loader/wbfs.h"
|
||||
#include "memory/memory.h"
|
||||
@ -1083,7 +1082,7 @@ void Nand::Init_ISFS()
|
||||
{
|
||||
gprintf("Init ISFS\n");
|
||||
ISFS_Initialize();
|
||||
if(IOS_GetVersion() == 58 && !neek2o())
|
||||
if(IOS_GetVersion() == 58)
|
||||
Enable_ISFS_Patches();
|
||||
}
|
||||
|
||||
@ -1091,7 +1090,7 @@ void Nand::DeInit_ISFS()
|
||||
{
|
||||
gprintf("Deinit ISFS\n");
|
||||
ISFS_Deinitialize();
|
||||
if(IOS_GetVersion() == 58 && !neek2o())
|
||||
if(IOS_GetVersion() == 58)
|
||||
Disable_ISFS_Patches();
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,12 @@ bool loadIOS(int ios, bool MountDevices)
|
||||
{
|
||||
WDVD_Close();
|
||||
Close_Inputs();
|
||||
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
||||
NandHandle.Patch_AHB(); //No AHBPROT for the next IOS
|
||||
ShutdownBeforeExit();
|
||||
gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
|
||||
ret = IOS_ReloadIOS(ios) == 0;
|
||||
NandHandle.Init_ISFS();
|
||||
gprintf("AHBPROT after IOS Reload: %u\n", AHBRPOT_Patched());
|
||||
NandHandle.Init_ISFS();
|
||||
WDVD_Init();
|
||||
}
|
||||
|
||||
|
@ -189,3 +189,20 @@ void IOS_GetCurrentIOSInfo()
|
||||
CurrentIOS.Base = CurrentIOS.Version;
|
||||
DCFlushRange(&CurrentIOS, sizeof(IOS_Info));
|
||||
}
|
||||
|
||||
s32 D2X_PatchReturnTo(u32 returnTo)
|
||||
{
|
||||
/* Open ES Module */
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
/* Return to */
|
||||
static ioctlv rtn_vector[1] ATTRIBUTE_ALIGN(32);
|
||||
static u64 sm_title_id[8] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = ((u64)(0x00010001) << 32) | returnTo;
|
||||
rtn_vector[0].data = sm_title_id;
|
||||
rtn_vector[0].len = sizeof(u64);
|
||||
s32 ret = IOS_Ioctlv(ESHandle, 0xA1, 1, 0, rtn_vector);
|
||||
gprintf("Return to channel %.4s using d2x %s.\n", &returnTo, ret < 0 ? "failed" : "succeeded");
|
||||
/* Close ES Module */
|
||||
IOS_Close(ESHandle);
|
||||
return ret;
|
||||
}
|
||||
|
@ -31,8 +31,7 @@ void IOS_GetCurrentIOSInfo();
|
||||
bool IOS_D2X(u8 ios, u8 *base);
|
||||
u8 IOS_GetType(u8 slot);
|
||||
|
||||
bool Hermes_shadow_mload();
|
||||
void Hermes_Disable_EHC();
|
||||
s32 D2X_PatchReturnTo(u32 returnTo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,11 +1,6 @@
|
||||
#ifndef __MEMORY_H_
|
||||
#define __MEMORY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define Disc_ID ((vu32*)0x80000000)
|
||||
#define Disc_Region ((vu32*)0x80000003)
|
||||
#define Disc_Magic ((vu32*)0x80000018)
|
||||
@ -19,15 +14,16 @@ extern "C"
|
||||
#define Max_FST ((vu32*)0x8000003C)
|
||||
#define Assembler ((vu32*)0x80000060)
|
||||
#define Video_Mode ((vu32*)0x800000CC)
|
||||
#define OS_Thread ((vu32*)0x800000E4)
|
||||
#define Dev_Debugger ((vu32*)0x800000EC)
|
||||
#define Simulated_Mem ((vu32*)0x800000F0)
|
||||
#define BI2 ((vu32*)0x800000F4)
|
||||
#define Bus_Speed ((vu32*)0x800000F8)
|
||||
#define CPU_Speed ((vu32*)0x800000FC)
|
||||
#define Real_IOSVersion ((vu32*)0x80003140)
|
||||
#define Current_IOS ((vu32*)0x80003140)
|
||||
#define Online_Check ((vu32*)0x80003180)
|
||||
#define GameID_Address ((vu32*)0x80003184)
|
||||
#define Game_IOSVersion ((vu32*)0x80003188)
|
||||
#define Apploader_IOS ((vu32*)0x80003188)
|
||||
|
||||
#define Priiloader_CFG1 ((vu32*)0x8132FFFB)
|
||||
#define Priiloader_CFG2 ((vu32*)0x817FEFF0)
|
||||
@ -36,8 +32,4 @@ extern "C"
|
||||
#define HW_AHBPROT ((vu32*)0xCD800064)
|
||||
#define MEM_PROT ((vu32)0xCD8B420A)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -56,9 +56,6 @@ extern const u8 blank_png[];
|
||||
extern const u8 gc_ogg[];
|
||||
extern const u32 gc_ogg_size;
|
||||
|
||||
extern u32 boot2version;
|
||||
static u64 sm_title_id[8] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
bool m_zoom_banner = false;
|
||||
s16 m_gameBtnPlayFull;
|
||||
s16 m_gameBtnBackFull;
|
||||
@ -1024,7 +1021,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
string id = string(hdr->id);
|
||||
|
||||
bool NAND_Emu = !m_cfg.getBool("NAND", "disable", true);
|
||||
bool WII_Launch = neek2o() || (m_gcfg2.getBool(id, "custom", false) && !NAND_Emu);
|
||||
bool WII_Launch = (m_gcfg2.getBool(id, "custom", false) && (!NAND_Emu || neek2o()));
|
||||
|
||||
bool vipatch = m_gcfg2.testOptBool(id, "vipatch", m_cfg.getBool("GENERAL", "vipatch", false));
|
||||
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("NAND", "cheat", false));
|
||||
@ -1039,6 +1036,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
const char *rtrn = m_gcfg2.getBool(id, "returnto", true) ? m_cfg.getString("GENERAL", "returnto").c_str() : NULL;
|
||||
u8 patchVidMode = min((u32)m_gcfg2.getInt(id, "patch_video_modes", 0), ARRAY_SIZE(CMenu::_vidModePatch) - 1u);
|
||||
int aspectRatio = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u)-1;
|
||||
u32 returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||
|
||||
SmartBuf cheatFile;
|
||||
u32 cheatSize = 0;
|
||||
@ -1074,6 +1072,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
m_cat.save(true);
|
||||
m_cfg.save(true);
|
||||
cleanup();
|
||||
|
||||
if(NAND_Emu && !neek2o())
|
||||
{
|
||||
if(useNK2o)
|
||||
@ -1083,12 +1082,9 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
error(_t("errneek1", L"Cannot launch neek2o. Verify your neek2o setup"));
|
||||
Sys_Exit();
|
||||
}
|
||||
int rtrnID = 0;
|
||||
if(rtrn != NULL && strlen(rtrn) == 4)
|
||||
rtrnID = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||
|
||||
ShutdownBeforeExit();
|
||||
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL, rtrnID ? (((u64)(0x00010001) << 32) | (rtrnID & 0xFFFFFFFF)) : rtrnID);
|
||||
Launch_nk(gameTitle, emuPath.size() > 1 ? emuPath.c_str() : NULL,
|
||||
returnTo ? (((u64)(0x00010001) << 32) | (returnTo & 0xFFFFFFFF)) : 0);
|
||||
while(1);
|
||||
}
|
||||
DeviceHandle.UnMount(emuPartition);
|
||||
@ -1096,32 +1092,16 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
NandHandle.Enable_Emu();
|
||||
}
|
||||
gameIOS = ChannelHandle.GetRequestedIOS(gameTitle);
|
||||
if(NAND_Emu && !neek2o())
|
||||
NandHandle.Disable_Emu();
|
||||
if(_loadIOS(gameIOS, WII_Launch ? gameIOS : userIOS, id) == LOAD_IOS_FAILED)
|
||||
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
||||
Sys_Exit();
|
||||
if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && rtrn != NULL && strlen(rtrn) == 4)
|
||||
if((CurrentIOS.Type == IOS_TYPE_D2X || neek2o()) && returnTo != 0)
|
||||
{
|
||||
int rtrnID = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||
|
||||
static ioctlv vector[1] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (rtrnID & 0xFFFFFFFF));
|
||||
|
||||
vector[0].data = sm_title_id;
|
||||
vector[0].len = 8;
|
||||
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
gprintf("Return to channel %s %s. Using new d2x way\n", rtrn, IOS_Ioctlv(ESHandle, 0xA1, 1, 0, vector) != -101 ? "Succeeded" : "Failed!" );
|
||||
IOS_Close(ESHandle);
|
||||
if(D2X_PatchReturnTo(returnTo) >= 0)
|
||||
memset(&returnTo, 0, sizeof(u32));
|
||||
}
|
||||
if(WII_Launch)
|
||||
{
|
||||
ShutdownBeforeExit();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(gameTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(NAND_Emu)
|
||||
if(NAND_Emu && !neek2o())
|
||||
{
|
||||
NandHandle.SetPaths(emuPath.c_str(), emuPartition, false);
|
||||
if(emulate_mode == 1)
|
||||
@ -1135,11 +1115,20 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
|
||||
Sys_Exit();
|
||||
}
|
||||
}
|
||||
|
||||
if(WII_Launch)
|
||||
{
|
||||
ShutdownBeforeExit();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(gameTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
setLanguage(language);
|
||||
ocarina_load_code(cheatFile.get(), cheatSize);
|
||||
Identify(gameTitle);
|
||||
ExternalBooter_ChannelSetup(gameTitle);
|
||||
BootChannel(gameTitle, gameIOS, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio);
|
||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL);
|
||||
}
|
||||
Sys_Exit();
|
||||
}
|
||||
@ -1298,12 +1287,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
}
|
||||
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool("GAMES", "cheat", false));
|
||||
debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0; // debuggerselect is defined in fst.h
|
||||
hooktype = (u32)m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
|
||||
if(!debuggerselect && !cheat)
|
||||
hooktype = 0;
|
||||
|
||||
if(id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") // Prince of Persia, Rival Swords
|
||||
debuggerselect = false;
|
||||
hooktype = (u32)m_gcfg2.getInt(id, "hooktype", 0); // hooktype is defined in patchcode.h
|
||||
|
||||
SmartBuf cheatFile, gameconfig;
|
||||
u32 cheatSize = 0, gameconfigSize = 0, returnTo = 0;
|
||||
@ -1317,10 +1303,12 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
|
||||
setLanguage(language);
|
||||
|
||||
load_wip_patches((u8 *)m_wipDir.c_str(), (u8 *) &id);
|
||||
if(cheat)
|
||||
_loadFile(cheatFile, cheatSize, m_cheatDir.c_str(), fmt("%s.gct", id.c_str()));
|
||||
_loadFile(gameconfig, gameconfigSize, m_txtCheatDir.c_str(), "gameconfig.txt");
|
||||
load_wip_patches((u8 *)m_wipDir.c_str(), (u8 *) &id);
|
||||
if(!debuggerselect && !cheatFile.get())
|
||||
hooktype = 0;
|
||||
|
||||
if(rtrn != NULL && strlen(rtrn) == 4)
|
||||
returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3];
|
||||
@ -1338,33 +1326,10 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
||||
if(_loadIOS(gameIOS, userIOS, id) == LOAD_IOS_FAILED)
|
||||
Sys_Exit();
|
||||
}
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
if(CurrentIOS.Type == IOS_TYPE_D2X && returnTo != 0 && !m_directLaunch)
|
||||
{
|
||||
/* Open ES Module */
|
||||
s32 ESHandle = IOS_Open("/dev/es", 0);
|
||||
/* IOS Reload Block */
|
||||
static ioctlv block_vector[2] ATTRIBUTE_ALIGN(32);
|
||||
static u32 mode ATTRIBUTE_ALIGN(32);
|
||||
static u32 ios ATTRIBUTE_ALIGN(32);
|
||||
mode = 2;
|
||||
block_vector[0].data = &mode;
|
||||
block_vector[0].len = sizeof(u32);
|
||||
ios = IOS_GetVersion();
|
||||
block_vector[1].data = &ios;
|
||||
block_vector[1].len = sizeof(u32);
|
||||
gprintf("Block IOS Reload for %i %s\n", ios, IOS_Ioctlv(ESHandle, 0xA0, 2, 0, block_vector) < 0 ? "failed!" : "succeeded");
|
||||
/* Return to */
|
||||
if(!m_directLaunch && returnTo)
|
||||
{
|
||||
static ioctlv rtn_vector[1] ATTRIBUTE_ALIGN(32);
|
||||
sm_title_id[0] = (((u64)(0x00010001) << 32) | (returnTo & 0xFFFFFFFF));
|
||||
rtn_vector[0].data = sm_title_id;
|
||||
rtn_vector[0].len = sizeof(u64);
|
||||
gprintf("Return to channel %s %s. Using new d2x way\n", rtrn, IOS_Ioctlv(ESHandle, 0xA1, 1, 0, rtn_vector) != -101 ? "succeeded" : "failed!");
|
||||
returnTo = 0;
|
||||
}
|
||||
/* Close ES Module */
|
||||
IOS_Close(ESHandle);
|
||||
if(D2X_PatchReturnTo(returnTo) >= 0)
|
||||
memset(&returnTo, 0, sizeof(u32));
|
||||
}
|
||||
if(emulate_mode && !neek2o() && CurrentIOS.Type == IOS_TYPE_D2X)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user