mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 09:05:06 +01:00
* Small fix for ppl that use an usb device with 4k sectors
* Added better region free support that fix some issue games (Menu option will follow)
This commit is contained in:
parent
0d6cc80527
commit
ecbed6571a
@ -31,6 +31,7 @@ struct the_CFG {
|
|||||||
WIP_Code *wip_list;
|
WIP_Code *wip_list;
|
||||||
u32 wip_count;
|
u32 wip_count;
|
||||||
bool use_led;
|
bool use_led;
|
||||||
|
bool patchregion;
|
||||||
/* needed for channels */
|
/* needed for channels */
|
||||||
u64 title;
|
u64 title;
|
||||||
bool use_dol;
|
bool use_dol;
|
||||||
|
@ -29,7 +29,7 @@ static const char *GameID = (const char*)0x80000000;
|
|||||||
#define APPLDR_CODE 0x918
|
#define APPLDR_CODE 0x918
|
||||||
|
|
||||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch,
|
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch,
|
||||||
bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo);
|
bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion);
|
||||||
static void patch_NoDiscinDrive(void *buffer, u32 len);
|
static void patch_NoDiscinDrive(void *buffer, u32 len);
|
||||||
static void Anti_002_fix(void *Address, int Size);
|
static void Anti_002_fix(void *Address, int Size);
|
||||||
static bool Remove_001_Protection(void *Address, int Size);
|
static bool Remove_001_Protection(void *Address, int Size);
|
||||||
@ -47,7 +47,7 @@ static struct
|
|||||||
s32 padding;
|
s32 padding;
|
||||||
} apploader_hdr ATTRIBUTE_ALIGN(32);
|
} apploader_hdr ATTRIBUTE_ALIGN(32);
|
||||||
|
|
||||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo)
|
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion)
|
||||||
{
|
{
|
||||||
PrinceOfPersiaPatch();
|
PrinceOfPersiaPatch();
|
||||||
NewSuperMarioBrosPatch();
|
NewSuperMarioBrosPatch();
|
||||||
@ -94,7 +94,7 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
|||||||
/* Read data from DVD */
|
/* Read data from DVD */
|
||||||
WDVD_Read(dst, len, offset);
|
WDVD_Read(dst, len, offset);
|
||||||
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString,
|
maindolpatches(dst, len, vidMode, vmode, vipatch, countryString,
|
||||||
patchVidModes, aspectRatio, returnTo);
|
patchVidModes, aspectRatio, returnTo, patchregion);
|
||||||
DCFlushRange(dst, len);
|
DCFlushRange(dst, len);
|
||||||
ICInvalidateRange(dst, len);
|
ICInvalidateRange(dst, len);
|
||||||
prog(20);
|
prog(20);
|
||||||
@ -107,7 +107,7 @@ u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryStrin
|
|||||||
return (u32)appldr_final();
|
return (u32)appldr_final();
|
||||||
}
|
}
|
||||||
|
|
||||||
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo)
|
void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString, u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion)
|
||||||
{
|
{
|
||||||
do_wip_code((u8 *)dst, len);
|
do_wip_code((u8 *)dst, len);
|
||||||
Remove_001_Protection(dst, len);
|
Remove_001_Protection(dst, len);
|
||||||
@ -133,6 +133,8 @@ void maindolpatches(void *dst, int len, u8 vidMode, GXRModeObj *vmode, bool vipa
|
|||||||
PatchAspectRatio(dst, len, aspectRatio);
|
PatchAspectRatio(dst, len, aspectRatio);
|
||||||
if(returnTo)
|
if(returnTo)
|
||||||
PatchReturnTo(dst, len, returnTo);
|
PatchReturnTo(dst, len, returnTo);
|
||||||
|
if(patchregion)
|
||||||
|
PatchRegion(dst, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void patch_NoDiscinDrive(void *buffer, u32 len)
|
static void patch_NoDiscinDrive(void *buffer, u32 len)
|
||||||
|
@ -7,7 +7,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
u32 Apploader_Run(u8 vidMode, GXRModeObj *vmode, bool vipatch, bool countryString,
|
||||||
u8 patchVidModes, int aspectRatio, u32 returnTo);
|
u8 patchVidModes, int aspectRatio, u32 returnTo, bool patchregion);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ int main()
|
|||||||
WDVD_OpenPartition(offset, &GameIOS);
|
WDVD_OpenPartition(offset, &GameIOS);
|
||||||
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
vmode = Disc_SelectVMode(normalCFG.vidMode, &vmode_reg);
|
||||||
AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
AppEntrypoint = Apploader_Run(normalCFG.vidMode, vmode, normalCFG.vipatch, normalCFG.countryString,
|
||||||
normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.returnTo);
|
normalCFG.patchVidMode, normalCFG.aspectRatio, normalCFG.returnTo, normalCFG.patchregion);
|
||||||
WDVD_Close();
|
WDVD_Close();
|
||||||
}
|
}
|
||||||
else if(normalCFG.BootType == TYPE_CHANNEL)
|
else if(normalCFG.BootType == TYPE_CHANNEL)
|
||||||
|
@ -127,6 +127,62 @@ unsigned char patch_fwrite[144] =
|
|||||||
0x7F, 0x86, 0x20, 0x00, 0x40, 0x9E, 0xFF, 0xA0, 0x7C, 0xA3, 0x2B, 0x78, 0x4E, 0x80, 0x00, 0x20,
|
0x7F, 0x86, 0x20, 0x00, 0x40, 0x9E, 0xFF, 0xA0, 0x7C, 0xA3, 0x2B, 0x78, 0x4E, 0x80, 0x00, 0x20,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned char sig_setting[40] =
|
||||||
|
{
|
||||||
|
0x2f, 0x74, 0x69, 0x74,
|
||||||
|
0x6c, 0x65, 0x2f, 0x30,
|
||||||
|
0x30, 0x30, 0x30, 0x30,
|
||||||
|
0x30, 0x30, 0x31, 0x2f,
|
||||||
|
0x30, 0x30, 0x30, 0x30,
|
||||||
|
0x30, 0x30, 0x30, 0x32,
|
||||||
|
0x2f, 0x64, 0x61, 0x74,
|
||||||
|
0x61, 0x2f, 0x73, 0x65,
|
||||||
|
0x74, 0x74, 0x69, 0x6e,
|
||||||
|
0x67, 0x2e, 0x74, 0x78,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char sig_SYSCONF[20] =
|
||||||
|
{
|
||||||
|
0x2f, 0x73, 0x68, 0x61,
|
||||||
|
0x72, 0x65, 0x64, 0x32,
|
||||||
|
0x2f, 0x73, 0x79, 0x73,
|
||||||
|
0x2f, 0x53, 0x59, 0x53,
|
||||||
|
0x43, 0x4f, 0x4e, 0x46,
|
||||||
|
};
|
||||||
|
|
||||||
|
//unsigned char patch_SYSCONF[20] =
|
||||||
|
//{
|
||||||
|
// 0x2f, 0x74, 0x6d, 0x70,
|
||||||
|
// 0x2f, 0x73, 0x79, 0x73,
|
||||||
|
// 0x2f, 0x53, 0x59, 0x53,
|
||||||
|
// 0x43, 0x4f, 0x4e, 0x46,
|
||||||
|
// 0x00, 0x00, 0x00, 0x00,
|
||||||
|
//};
|
||||||
|
|
||||||
|
unsigned char patch_SYSCONF[20] =
|
||||||
|
{
|
||||||
|
0x2f, 0x73, 0x79, 0x73,
|
||||||
|
0x2f, 0x77, 0x69, 0x69,
|
||||||
|
0x66, 0x6c, 0x6f, 0x77,
|
||||||
|
0x2e, 0x72, 0x65, 0x67,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char patch_setting[44] =
|
||||||
|
{
|
||||||
|
0x2f, 0x74, 0x6d, 0x70,
|
||||||
|
0x2f, 0x73, 0x79, 0x73,
|
||||||
|
0x2f, 0x73, 0x65, 0x74,
|
||||||
|
0x74, 0x69, 0x6e, 0x67,
|
||||||
|
0x2e, 0x74, 0x78, 0x74,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
};
|
||||||
|
|
||||||
bool dogamehooks(void *addr, u32 len, bool channel)
|
bool dogamehooks(void *addr, u32 len, bool channel)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -563,3 +619,19 @@ s32 BlockIOSReload(void)
|
|||||||
IOS_Close(ESHandle);
|
IOS_Close(ESHandle);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PatchRegion(void *Address, int Size)
|
||||||
|
{
|
||||||
|
u8 *addr_start = (u8*)Address;
|
||||||
|
u8 *addr_end = (u8*)(Address + Size);
|
||||||
|
|
||||||
|
while(addr_start < addr_end)
|
||||||
|
{
|
||||||
|
if(!memcmp(addr_start, sig_setting, sizeof(sig_setting)))
|
||||||
|
memcpy(addr_start, patch_setting, sizeof(patch_setting));
|
||||||
|
if(!memcmp(addr_start, sig_SYSCONF, sizeof(sig_SYSCONF)))
|
||||||
|
memcpy(addr_start, patch_SYSCONF, sizeof(patch_SYSCONF));
|
||||||
|
|
||||||
|
addr_start += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -39,6 +39,7 @@ void PatchAspectRatio(void *addr, u32 len, u8 aspect);
|
|||||||
bool PatchReturnTo(void *Address, int Size, u32 id);
|
bool PatchReturnTo(void *Address, int Size, u32 id);
|
||||||
void Patch_fwrite(void *Address, int Size);
|
void Patch_fwrite(void *Address, int Size);
|
||||||
s32 BlockIOSReload(void);
|
s32 BlockIOSReload(void);
|
||||||
|
void PatchRegion(void *Address, int Size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ struct the_CFG {
|
|||||||
WIP_Code *wip_list;
|
WIP_Code *wip_list;
|
||||||
u32 wip_count;
|
u32 wip_count;
|
||||||
bool use_led;
|
bool use_led;
|
||||||
|
bool patchregion;
|
||||||
/* needed for channels */
|
/* needed for channels */
|
||||||
u64 title;
|
u64 title;
|
||||||
bool use_dol;
|
bool use_dol;
|
||||||
|
@ -112,7 +112,7 @@ bool ExternalBooter_LoadBooter(const char *booter_path)
|
|||||||
extern FragList *frag_list;
|
extern FragList *frag_list;
|
||||||
extern s32 wbfsDev;
|
extern s32 wbfsDev;
|
||||||
extern u32 wbfs_part_idx;
|
extern u32 wbfs_part_idx;
|
||||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID)
|
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, const char *ID)
|
||||||
{
|
{
|
||||||
memset(&normalCFG, 0, sizeof(the_CFG));
|
memset(&normalCFG, 0, sizeof(the_CFG));
|
||||||
normalCFG.GameBootType = dvd ? TYPE_WII_DISC : (wbfs ? TYPE_WII_WBFS : TYPE_WII_WBFS_EXT);
|
normalCFG.GameBootType = dvd ? TYPE_WII_DISC : (wbfs ? TYPE_WII_WBFS : TYPE_WII_WBFS_EXT);
|
||||||
@ -120,6 +120,7 @@ void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID)
|
|||||||
normalCFG.fragments = frag_list;
|
normalCFG.fragments = frag_list;
|
||||||
normalCFG.wbfsDevice = wbfsDev;
|
normalCFG.wbfsDevice = wbfsDev;
|
||||||
normalCFG.wbfsPart = wbfs_part_idx;
|
normalCFG.wbfsPart = wbfs_part_idx;
|
||||||
|
normalCFG.patchregion = patchregion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalBooter_ChannelSetup(u64 title, bool dol)
|
void ExternalBooter_ChannelSetup(u64 title, bool dol)
|
||||||
|
@ -32,7 +32,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
|
|||||||
int aspectRatio, u32 returnTo, u8 BootType, bool use_led);
|
int aspectRatio, u32 returnTo, u8 BootType, bool use_led);
|
||||||
bool ExternalBooter_LoadBooter(const char *booter_path);
|
bool ExternalBooter_LoadBooter(const char *booter_path);
|
||||||
void ExternalBooter_ChannelSetup(u64 title, bool dol);
|
void ExternalBooter_ChannelSetup(u64 title, bool dol);
|
||||||
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID);
|
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, bool patchregion, const char *ID);
|
||||||
void ShutdownBeforeExit(void);
|
void ShutdownBeforeExit(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,10 +48,9 @@
|
|||||||
#include "memory/memory.h"
|
#include "memory/memory.h"
|
||||||
#include "wiiuse/wpad.h"
|
#include "wiiuse/wpad.h"
|
||||||
|
|
||||||
u8 *confbuffer ATTRIBUTE_ALIGN(32);
|
u8 *confbuffer = (u8*)NULL;
|
||||||
u8 CCode[0x1008];
|
u8 CCode[0x1008];
|
||||||
char SCode[4];
|
char *txtbuffer = (char *)NULL;
|
||||||
char *txtbuffer ATTRIBUTE_ALIGN(32);
|
|
||||||
|
|
||||||
config_header *cfg_hdr;
|
config_header *cfg_hdr;
|
||||||
|
|
||||||
@ -296,28 +295,73 @@ void Nand::__GetNameList(const char *source, namelist **entries, int *count)
|
|||||||
free(names);
|
free(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 Nand::__GetSystemMenuRegion(void)
|
||||||
|
{
|
||||||
|
u32 Region = EUR;
|
||||||
|
char *source = (char *)memalign(32, 256);
|
||||||
|
strcpy(source, SMTMDPATH);
|
||||||
|
|
||||||
|
s32 fd = ISFS_Open(source, ISFS_OPEN_READ);
|
||||||
|
if(fd >= 0)
|
||||||
|
{
|
||||||
|
fstats *status = (fstats *)memalign(32, ALIGN32(sizeof(fstats)));
|
||||||
|
ISFS_GetFileStats(fd, status);
|
||||||
|
char *TMD = (char*)memalign(32, status->file_length);
|
||||||
|
ISFS_Read(fd, TMD, status->file_length);
|
||||||
|
Region = *(u16*)(TMD+0x1DC) & 0xF;
|
||||||
|
ISFS_Close(fd);
|
||||||
|
free(TMD);
|
||||||
|
free(status);
|
||||||
|
}
|
||||||
|
free(source);
|
||||||
|
return Region;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 Nand::__configclose(void)
|
||||||
|
{
|
||||||
|
__Dec_Enc_TB();
|
||||||
|
free(confbuffer);
|
||||||
|
free(txtbuffer);
|
||||||
|
configloaded = !configloaded;
|
||||||
|
return configloaded;
|
||||||
|
}
|
||||||
|
|
||||||
s32 Nand::__configread(void)
|
s32 Nand::__configread(void)
|
||||||
{
|
{
|
||||||
confbuffer = (u8 *)malloc(0x4000);
|
confbuffer = (u8 *)memalign(32, 0x4000);
|
||||||
txtbuffer = (char *)malloc(0x100);
|
txtbuffer = (char *)memalign(32, 0x100);
|
||||||
if(confbuffer == NULL || txtbuffer == NULL)
|
if(confbuffer == NULL || txtbuffer == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cfg_hdr = (config_header *)NULL;
|
char *source = (char *)memalign(32, 256);
|
||||||
|
strcpy(source, SYSCONFPATH);
|
||||||
|
|
||||||
FILE *f = fopen(cfgpath, "rb");
|
s32 fd = ISFS_Open(source, ISFS_OPEN_READ);
|
||||||
if(f)
|
if(fd < 0)
|
||||||
{
|
{
|
||||||
fread(confbuffer, 1, 0x4000, f);
|
free(confbuffer);
|
||||||
fclose(f);
|
free(txtbuffer);
|
||||||
|
free(source);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(settxtpath, "rb");
|
ISFS_Read(fd, confbuffer, 0x4000);
|
||||||
if(f)
|
ISFS_Close(fd);
|
||||||
|
|
||||||
|
strcpy(source, TXTPATH);
|
||||||
|
fd = ISFS_Open(source, ISFS_OPEN_READ);
|
||||||
|
if(fd < 0)
|
||||||
{
|
{
|
||||||
fread(txtbuffer, 1, 0x100, f);
|
free(confbuffer);
|
||||||
fclose(f);
|
free(txtbuffer);
|
||||||
|
free(source);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISFS_Read(fd, txtbuffer, 0x100);
|
||||||
|
ISFS_Close(fd);
|
||||||
|
free(source);
|
||||||
|
|
||||||
cfg_hdr = (config_header *)confbuffer;
|
cfg_hdr = (config_header *)confbuffer;
|
||||||
|
|
||||||
__Dec_Enc_TB();
|
__Dec_Enc_TB();
|
||||||
@ -330,13 +374,50 @@ s32 Nand::__configread(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Nand::__configwrite(void)
|
s32 Nand::__configwrite(bool realnand)
|
||||||
{
|
{
|
||||||
if(configloaded)
|
if(configloaded)
|
||||||
{
|
{
|
||||||
__Dec_Enc_TB();
|
__Dec_Enc_TB();
|
||||||
|
|
||||||
if(!tbdec)
|
if(!tbdec)
|
||||||
|
{
|
||||||
|
if(realnand)
|
||||||
|
{
|
||||||
|
char *dest = (char *)memalign(32, 256);
|
||||||
|
strcpy(dest, TSYSCONFPATH);
|
||||||
|
ISFS_Delete(dest);
|
||||||
|
ISFS_CreateFile(dest, 0, 3, 3, 3);
|
||||||
|
s32 fd = ISFS_Open(dest, ISFS_OPEN_RW);
|
||||||
|
if(fd < 0)
|
||||||
|
{
|
||||||
|
free(confbuffer);
|
||||||
|
free(txtbuffer);
|
||||||
|
free(dest);
|
||||||
|
configloaded = !configloaded;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ISFS_Write(fd, confbuffer, 0x4000);
|
||||||
|
ISFS_Close(fd);
|
||||||
|
|
||||||
|
strcpy(dest, TTXTPATH);
|
||||||
|
ISFS_Delete(dest);
|
||||||
|
ISFS_CreateFile(dest, 0, 3, 3, 3);
|
||||||
|
fd = ISFS_Open(dest, ISFS_OPEN_RW);
|
||||||
|
if(fd < 0)
|
||||||
|
{
|
||||||
|
free(confbuffer);
|
||||||
|
free(txtbuffer);
|
||||||
|
free(dest);
|
||||||
|
configloaded = !configloaded;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
ISFS_Write(fd, txtbuffer, 0x100);
|
||||||
|
ISFS_Close(fd);
|
||||||
|
configloaded = !configloaded;
|
||||||
|
free(dest);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* SYSCONF */
|
/* SYSCONF */
|
||||||
fsop_WriteFile(cfgpath, confbuffer, 0x4000);
|
fsop_WriteFile(cfgpath, confbuffer, 0x4000);
|
||||||
@ -344,10 +425,15 @@ s32 Nand::__configwrite(void)
|
|||||||
fsop_WriteFile(settxtpath, txtbuffer, 0x100);
|
fsop_WriteFile(settxtpath, txtbuffer, 0x100);
|
||||||
|
|
||||||
configloaded = !configloaded;
|
configloaded = !configloaded;
|
||||||
|
}
|
||||||
if(!tbdec && !configloaded)
|
if(!tbdec && !configloaded)
|
||||||
|
{
|
||||||
|
free(confbuffer);
|
||||||
|
free(txtbuffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free(confbuffer);
|
free(confbuffer);
|
||||||
free(txtbuffer);
|
free(txtbuffer);
|
||||||
return 0;
|
return 0;
|
||||||
@ -957,66 +1043,81 @@ s32 Nand::PreNandCfg(bool miis, bool realconfig)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 Nand::Do_Region_Change(string id)
|
bool Nand::Do_Region_Change(string id, bool realnand)
|
||||||
{
|
{
|
||||||
if(__configread())
|
if(__configread())
|
||||||
{
|
{
|
||||||
switch(id[3])
|
switch(id[3])
|
||||||
{
|
{
|
||||||
case 'J':
|
case 'J':
|
||||||
|
if(realnand && __GetSystemMenuRegion() == JAP)
|
||||||
|
return __configclose();
|
||||||
|
|
||||||
gprintf("Switching region to NTSC-J \n");
|
gprintf("Switching region to NTSC-J \n");
|
||||||
CCode[0] = 1;
|
CCode[0] = 1;
|
||||||
__configsetbyte( "IPL.LNG", 0 );
|
__configsetbyte("IPL.LNG", 0);
|
||||||
__configsetbigarray( "SADR.LNG", CCode, 0x1007 );
|
__configsetbigarray("SADR.LNG", CCode, 0x1007);
|
||||||
__configsetsetting( "AREA", "JPN" );
|
__configsetsetting("AREA", "JPN");
|
||||||
__configsetsetting( "MODEL", "RVL-001(JPN)" );
|
__configsetsetting("MODEL", "RVL-001(JPN)");
|
||||||
__configsetsetting( "CODE", "LJM" );
|
__configsetsetting("CODE", "LJM");
|
||||||
__configsetsetting( "VIDEO", "NTSC" );
|
__configsetsetting("VIDEO", "NTSC");
|
||||||
__configsetsetting( "GAME", "JP" );
|
__configsetsetting("GAME", "JP");
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
|
if(realnand && __GetSystemMenuRegion() == USA)
|
||||||
|
return __configclose();
|
||||||
|
|
||||||
gprintf("Switching region to NTSC-U \n");
|
gprintf("Switching region to NTSC-U \n");
|
||||||
CCode[0] = 31;
|
CCode[0] = 31;
|
||||||
__configsetbyte( "IPL.LNG", 1 );
|
__configsetbyte("IPL.LNG", 1);
|
||||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
__configsetbigarray("IPL.SADR", CCode, 0x1007);
|
||||||
__configsetsetting( "AREA", "USA" );
|
__configsetsetting("AREA", "USA");
|
||||||
__configsetsetting( "MODEL", "RVL-001(USA)" );
|
__configsetsetting("MODEL", "RVL-001(USA)");
|
||||||
__configsetsetting( "CODE", "LU" );
|
__configsetsetting("CODE", "LU");
|
||||||
__configsetsetting( "VIDEO", "NTSC" );
|
__configsetsetting("VIDEO", "NTSC");
|
||||||
__configsetsetting( "GAME", "US" );
|
__configsetsetting("GAME", "US");
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D': // Germany
|
||||||
case 'F':
|
case 'F': // France
|
||||||
case 'I':
|
case 'I': // Italy
|
||||||
case 'M':
|
case 'M': // American Import
|
||||||
case 'P':
|
case 'P': // Regular
|
||||||
case 'S':
|
case 'S': // Spain
|
||||||
case 'U':
|
case 'U': // United Kingdom
|
||||||
|
case 'L': // Japanese Import
|
||||||
|
if(realnand && __GetSystemMenuRegion() == EUR)
|
||||||
|
return __configclose();
|
||||||
|
|
||||||
gprintf("Switching region to PAL \n");
|
gprintf("Switching region to PAL \n");
|
||||||
CCode[0] = 110;
|
CCode[0] = 110; // UK
|
||||||
__configsetbyte( "IPL.LNG", 1 );
|
__configsetbyte("IPL.LNG", 1);
|
||||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
__configsetbigarray("IPL.SADR", CCode, 0x1007);
|
||||||
__configsetsetting( "AREA", "EUR" );
|
__configsetsetting("AREA", "EUR");
|
||||||
__configsetsetting( "MODEL", "RVL-001(EUR)" );
|
__configsetsetting("MODEL", "RVL-001(EUR)");
|
||||||
__configsetsetting( "CODE", "LEH" );
|
__configsetsetting("CODE", "LEH");
|
||||||
__configsetsetting( "VIDEO", "PAL" );
|
__configsetsetting("VIDEO", "PAL");
|
||||||
__configsetsetting( "GAME", "EU" );
|
__configsetsetting("GAME", "EU");
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
|
case 'Q':
|
||||||
|
case 'T':
|
||||||
|
if(realnand && __GetSystemMenuRegion() == KOR)
|
||||||
|
return __configclose();
|
||||||
|
|
||||||
gprintf("Switching region to NTSC-K \n");
|
gprintf("Switching region to NTSC-K \n");
|
||||||
CCode[0] = 137;
|
CCode[0] = 137;
|
||||||
__configsetbyte( "IPL.LNG", 9 );
|
__configsetbyte("IPL.LNG", 9);
|
||||||
__configsetbigarray( "IPL.SADR", CCode, 0x1007 );
|
__configsetbigarray("IPL.SADR", CCode, 0x1007);
|
||||||
__configsetsetting( "AREA", "KOR" );
|
__configsetsetting( "AREA", "KOR" );
|
||||||
__configsetsetting( "MODEL", "RVL-001(KOR)" );
|
__configsetsetting("MODEL", "RVL-001(KOR)");
|
||||||
__configsetsetting( "CODE", "LKM" );
|
__configsetsetting("CODE", "LKM");
|
||||||
__configsetsetting( "VIDEO", "NTSC" );
|
__configsetsetting("VIDEO", "NTSC");
|
||||||
__configsetsetting( "GAME", "KR" );
|
__configsetsetting("GAME", "KR");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__configwrite();
|
__configwrite(realnand);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nand::Init_ISFS()
|
void Nand::Init_ISFS()
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
#define SYSCONFPATH "/shared2/sys/SYSCONF"
|
#define SYSCONFPATH "/shared2/sys/SYSCONF"
|
||||||
#define MIIPATH "/shared2/menu/FaceLib/RFL_DB.dat"
|
#define MIIPATH "/shared2/menu/FaceLib/RFL_DB.dat"
|
||||||
#define TXTPATH "/title/00000001/00000002/data/setting.txt"
|
#define TXTPATH "/title/00000001/00000002/data/setting.txt"
|
||||||
|
#define SMTMDPATH "/title/00000001/00000002/content/title.tmd"
|
||||||
|
#define TSYSCONFPATH "/sys/wiiflow.reg"
|
||||||
|
#define TTXTPATH "/tmp/setting.txt"
|
||||||
|
|
||||||
#define BLOCK 2048
|
#define BLOCK 2048
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ public:
|
|||||||
s32 CreateConfig();
|
s32 CreateConfig();
|
||||||
|
|
||||||
s32 PreNandCfg(bool miis, bool realconfig);
|
s32 PreNandCfg(bool miis, bool realconfig);
|
||||||
s32 Do_Region_Change(string id);
|
bool Do_Region_Change(string id, bool realnand);
|
||||||
s32 FlashToNAND(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);
|
s32 FlashToNAND(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);
|
||||||
s32 DoNandDump(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);
|
s32 DoNandDump(const char *source, const char *dest, dump_callback_t i_dumper, void *i_data);
|
||||||
s32 CalcFlashSize(const char *source, dump_callback_t i_dumper, void *i_data);
|
s32 CalcFlashSize(const char *source, dump_callback_t i_dumper, void *i_data);
|
||||||
@ -101,6 +104,17 @@ public:
|
|||||||
void ResetCounters(void);
|
void ResetCounters(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum GameRegion
|
||||||
|
{
|
||||||
|
JAP = 0,
|
||||||
|
USA,
|
||||||
|
EUR,
|
||||||
|
KOR,
|
||||||
|
ASN,
|
||||||
|
LTN,
|
||||||
|
UNK,
|
||||||
|
ALL,
|
||||||
|
};
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
s32 Nand_Mount(NandDevice *Device);
|
s32 Nand_Mount(NandDevice *Device);
|
||||||
s32 Nand_Unmount(NandDevice *Device);
|
s32 Nand_Unmount(NandDevice *Device);
|
||||||
@ -113,8 +127,10 @@ private:
|
|||||||
void __Dec_Enc_TB(void);
|
void __Dec_Enc_TB(void);
|
||||||
void __configshifttxt(char *str);
|
void __configshifttxt(char *str);
|
||||||
void __GetNameList(const char *source, namelist **entries, int *count);
|
void __GetNameList(const char *source, namelist **entries, int *count);
|
||||||
|
u32 __GetSystemMenuRegion(void);
|
||||||
|
s32 __configclose(void);
|
||||||
s32 __configread(void);
|
s32 __configread(void);
|
||||||
s32 __configwrite(void);
|
s32 __configwrite(bool realnand);
|
||||||
u32 __configsetbyte(const char *item, u8 val);
|
u32 __configsetbyte(const char *item, u8 val);
|
||||||
u32 __configsetbigarray(const char *item, void *val, u32 size);
|
u32 __configsetbigarray(const char *item, void *val, u32 size);
|
||||||
u32 __configsetsetting(const char *item, const char *val);
|
u32 __configsetsetting(const char *item, const char *val);
|
||||||
|
@ -33,7 +33,7 @@ static inline void wbfs_error(const char *x)
|
|||||||
|
|
||||||
static inline void *wbfs_malloc(size_t size)
|
static inline void *wbfs_malloc(size_t size)
|
||||||
{
|
{
|
||||||
void *p = MEM2_memalign(32, size);
|
void *p = MEM1_memalign(32, size);
|
||||||
if(p) memset(p, 0, size);
|
if(p) memset(p, 0, size);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -1404,12 +1404,17 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
else if(emulate_mode > 2)
|
else if(emulate_mode > 2)
|
||||||
{
|
{
|
||||||
NandHandle.CreateConfig();
|
NandHandle.CreateConfig();
|
||||||
NandHandle.Do_Region_Change(id);
|
NandHandle.Do_Region_Change(id, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emulate_mode = 0;
|
emulate_mode = 0;
|
||||||
|
|
||||||
|
bool patchregion = false;
|
||||||
|
|
||||||
|
if(emulate_mode <= 2 && !neek2o() && m_cfg.getBool("GENERAL", "tempregionrn", true))
|
||||||
|
patchregion = NandHandle.Do_Region_Change(id, true);
|
||||||
|
|
||||||
bool use_led = m_gcfg2.getBool(id, "led", false);
|
bool use_led = m_gcfg2.getBool(id, "led", false);
|
||||||
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
|
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
|
||||||
debuggerselect = m_gcfg2.getInt(id, "debugger", 0); // debuggerselect is defined in fst.h
|
debuggerselect = m_gcfg2.getInt(id, "debugger", 0); // debuggerselect is defined in fst.h
|
||||||
@ -1501,7 +1506,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
free(gameconfig);
|
free(gameconfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
|
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, patchregion, id.c_str());
|
||||||
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
|
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
|
||||||
|
|
||||||
Sys_Exit();
|
Sys_Exit();
|
||||||
|
Loading…
Reference in New Issue
Block a user