mirror of
https://github.com/modmii/YAWM-ModMii-Edition.git
synced 2024-11-24 09:09:16 +01:00
- Fixed not able to select a source device
- The device select menu will now report info about the system: - IOS # and version currently loaded - Sysmenu version and region - AHB access - Whether Priiloader is installed or not - Unmount source devices and disconnect controls before launching another application Note: This version will work fine with orignal untweaked sysmenu's, but will likely cause problems if things like version #'s are tweaked. This is WIP and will be solved soon
This commit is contained in:
parent
dce3effdea
commit
be66aa76cf
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,8 +6,4 @@
|
|||||||
.vscode/
|
.vscode/
|
||||||
build/
|
build/
|
||||||
source/boot/build/
|
source/boot/build/
|
||||||
/yawmME.zip
|
|
||||||
/wiiload
|
/wiiload
|
||||||
/yawmMEfinB.7z
|
|
||||||
/yawmME700PM.zip
|
|
||||||
/yawmME415PM.7z
|
|
||||||
|
@ -323,6 +323,10 @@ void Menu_FatDevice(void)
|
|||||||
int codePosition = 0;
|
int codePosition = 0;
|
||||||
extern bool skipRegionSafetyCheck;
|
extern bool skipRegionSafetyCheck;
|
||||||
|
|
||||||
|
GetSysMenuRegion(&gMenuVersion, &gMenuRegion);
|
||||||
|
bool havePriiloader = IsPriiloaderInstalled();
|
||||||
|
u32 ios = *((u32*)0x80003140);
|
||||||
|
|
||||||
/* Select source device */
|
/* Select source device */
|
||||||
if (gConfig.fatDeviceIndex < 0)
|
if (gConfig.fatDeviceIndex < 0)
|
||||||
{
|
{
|
||||||
@ -332,6 +336,12 @@ void Menu_FatDevice(void)
|
|||||||
Con_Clear();
|
Con_Clear();
|
||||||
bool deviceOk = (FatGetDeviceCount() > 0);
|
bool deviceOk = (FatGetDeviceCount() > 0);
|
||||||
|
|
||||||
|
printf("\tIOS %d v%d, System menu: %s%c %s\n\n", ((ios >> 16) & 0xFF), (ios & 0xFFFF),
|
||||||
|
GetSysMenuVersionString(gMenuVersion), gMenuRegion > 0 ? gMenuRegion : ' ', GetSysMenuRegionString(gMenuRegion));
|
||||||
|
printf("\tAHB access: %s\n", AHBPROT_DISABLED ? "Yes" : "No");
|
||||||
|
printf("\tPriiloader: %s\n\n", havePriiloader ? "Installed" : "Not installed");
|
||||||
|
|
||||||
|
|
||||||
if (!deviceOk)
|
if (!deviceOk)
|
||||||
{
|
{
|
||||||
printf("\t[+] No source devices found\n\n");
|
printf("\t[+] No source devices found\n\n");
|
||||||
@ -408,6 +418,8 @@ void Menu_FatDevice(void)
|
|||||||
printf("[+] Disabled SM region checks\n");
|
printf("[+] Disabled SM region checks\n");
|
||||||
sleep(3);
|
sleep(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,7 +430,7 @@ void Menu_FatDevice(void)
|
|||||||
gSelected = gConfig.fatDeviceIndex;
|
gSelected = gConfig.fatDeviceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("[+] Selected source device: %s.", FatGetDeviceName(gSelected));
|
printf("[+] Selected source device: %s.\n", FatGetDeviceName(gSelected));
|
||||||
sleep(2);
|
sleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,7 +905,11 @@ void Menu_WadManage(fatFile *file, char *inFilePath)
|
|||||||
printf("launch dol/elf here \n");
|
printf("launch dol/elf here \n");
|
||||||
|
|
||||||
if(LoadApp(inFilePath, file->filename))
|
if(LoadApp(inFilePath, file->filename))
|
||||||
|
{
|
||||||
|
FatUnmount();
|
||||||
|
Wpad_Disconnect();
|
||||||
LaunchApp();
|
LaunchApp();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -931,6 +947,7 @@ void Menu_WadList(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Con_Clear();
|
||||||
printf("[+] Retrieving file list...");
|
printf("[+] Retrieving file list...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
@ -1356,7 +1373,6 @@ void Menu_Loop(void)
|
|||||||
|
|
||||||
/* Retrieve IOS version */
|
/* Retrieve IOS version */
|
||||||
iosVersion = IOS_GetVersion();
|
iosVersion = IOS_GetVersion();
|
||||||
GetSysMenuRegion(&gMenuVersion, &gMenuRegion);
|
|
||||||
|
|
||||||
ndev = &ndevList[0];
|
ndev = &ndevList[0];
|
||||||
|
|
||||||
|
@ -212,7 +212,6 @@ int ReadConfigFile(char* configFilePath)
|
|||||||
char* tmpStr = malloc(MAX_FILE_PATH_LEN);
|
char* tmpStr = malloc(MAX_FILE_PATH_LEN);
|
||||||
char tmpOutStr[40], path[128];
|
char tmpOutStr[40], path[128];
|
||||||
s32 i;
|
s32 i;
|
||||||
s32 ret = -1;
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (tmpStr == NULL)
|
if (tmpStr == NULL)
|
||||||
@ -230,8 +229,6 @@ int ReadConfigFile(char* configFilePath)
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
printf(" ERROR! (ret = %d)\n", ret);
|
|
||||||
// goto err;
|
|
||||||
retval = -1;
|
retval = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
55
source/wad.c
55
source/wad.c
@ -24,12 +24,12 @@
|
|||||||
// Turn upper and lower into a full title ID
|
// Turn upper and lower into a full title ID
|
||||||
#define TITLE_LOWER(x) ((u32)(x))
|
#define TITLE_LOWER(x) ((u32)(x))
|
||||||
|
|
||||||
const char RegionLookupList[16] =
|
const char RegionLookupTable[16] =
|
||||||
{
|
{
|
||||||
'J', 'E', 'P', 0, 0, 0, 'K', 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
'J', 'U', 'E', 0, 0, 0, 'K', 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u16 versionList[] =
|
const u16 VersionList[] =
|
||||||
{
|
{
|
||||||
// J E P K
|
// J E P K
|
||||||
|
|
||||||
@ -49,6 +49,18 @@ const u16 versionList[] =
|
|||||||
512, 513, 514, 518, // 4.3
|
512, 513, 514, 518, // 4.3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* VersionLookupTable[7][17] =
|
||||||
|
{
|
||||||
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||||
|
{ "", "", "1.0", "", "2.0", "", "2.2", "3.0", "3.1", "3.2", "", "3.3", "3.4", "4.0", "4.1", "4.2", "4.3", },
|
||||||
|
{ "", "1.0", "", "2.0", "", "", "2.2", "3.0", "3.1", "3.2", "", "3.3", "3.4", "4.0", "4.1", "4.2", "4.3", },
|
||||||
|
{ "", "", "1.0", "", "2.0", "2.1", "2.2", "3.0", "3.1", "3.2", "", "3.3", "3.4", "4.0", "4.1", "4.2", "4.3", },
|
||||||
|
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", },
|
||||||
|
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", },
|
||||||
|
{ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", },
|
||||||
|
{ "", "", "", "", "", "", "", "", "", "", "3.3", "", "3.5", "", "4.1", "4.2", "4.3", },
|
||||||
|
};
|
||||||
|
|
||||||
u32 WaitButtons(void);
|
u32 WaitButtons(void);
|
||||||
static u32 gPriiloaderSize = 0;
|
static u32 gPriiloaderSize = 0;
|
||||||
static bool gForcedInstall = false;
|
static bool gForcedInstall = false;
|
||||||
@ -145,24 +157,29 @@ s32 GetSysMenuRegion(u16* version, char* region)
|
|||||||
*version = v;
|
*version = v;
|
||||||
|
|
||||||
if (region)
|
if (region)
|
||||||
*region = RegionLookupList[(v & 0x0F)];
|
*region = RegionLookupTable[(v & 0x0F)];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetSysMenuRegionString(const char* region)
|
const char* GetSysMenuRegionString(const char region)
|
||||||
{
|
{
|
||||||
switch (*region)
|
switch (region)
|
||||||
{
|
{
|
||||||
case 'J': return "Japan (NTSC-J)";
|
case 'J': return "Japan (NTSC-J)";
|
||||||
case 'E': return "USA (NTSC-U/C)";
|
case 'U': return "USA (NTSC-U/C)";
|
||||||
case 'P': return "Europe (PAL)";
|
case 'E': return "Europe (PAL)";
|
||||||
case 'K': return "Korea (NTSC-K)";
|
case 'K': return "Korea (NTSC-K)";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* GetSysMenuVersionString(u16 version)
|
||||||
|
{
|
||||||
|
return VersionLookupTable[version % 32][version / 32];
|
||||||
|
};
|
||||||
|
|
||||||
static char* GetTitleExec(u64 tId, bool tweaked)
|
static char* GetTitleExec(u64 tId, bool tweaked)
|
||||||
{
|
{
|
||||||
u32 size;
|
u32 size;
|
||||||
@ -192,7 +209,7 @@ static char* GetTitleExec(u64 tId, bool tweaked)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPriiloaderInstalled()
|
bool IsPriiloaderInstalled()
|
||||||
{
|
{
|
||||||
char* path = GetTitleExec(0x100000002LL, true);
|
char* path = GetTitleExec(0x100000002LL, true);
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -481,10 +498,6 @@ bool skipRegionSafetyCheck = false;
|
|||||||
|
|
||||||
s32 Wad_Install(FILE *fp)
|
s32 Wad_Install(FILE *fp)
|
||||||
{
|
{
|
||||||
//fseek(fp, 0, SEEK_END);
|
|
||||||
//s32 wadSize = ftell(fp);
|
|
||||||
//fseek(fp, 0, SEEK_CUR);
|
|
||||||
|
|
||||||
SetPRButtons(false);
|
SetPRButtons(false);
|
||||||
wadHeader *header = NULL;
|
wadHeader *header = NULL;
|
||||||
signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL;
|
signed_blob *p_certs = NULL, *p_crl = NULL, *p_tik = NULL, *p_tmd = NULL;
|
||||||
@ -623,9 +636,9 @@ s32 Wad_Install(FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i, ret = -1;
|
int i, ret = -1;
|
||||||
for(i = 0; i < sizeof(versionList); i++)
|
for(i = 0; i < sizeof(VersionList); i++)
|
||||||
{
|
{
|
||||||
if(versionList[i] == tmd_data->title_version)
|
if(VersionList[i] == tmd_data->title_version)
|
||||||
{
|
{
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
@ -637,7 +650,7 @@ s32 Wad_Install(FILE *fp)
|
|||||||
ret = -999;
|
ret = -999;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if(region != RegionLookupList[(tmd_data->title_version & 0x0F)])
|
if(region != RegionLookupTable[(tmd_data->title_version & 0x0F)])
|
||||||
{
|
{
|
||||||
printf("\n I won't install the wrong regions SM by default.\n\n");
|
printf("\n I won't install the wrong regions SM by default.\n\n");
|
||||||
|
|
||||||
@ -723,12 +736,6 @@ skipChecks:
|
|||||||
/* Fix ticket */
|
/* Fix ticket */
|
||||||
__Wad_FixTicket(p_tik);
|
__Wad_FixTicket(p_tik);
|
||||||
|
|
||||||
//if (!MenuTestDevice())
|
|
||||||
//{
|
|
||||||
// ret = -996;
|
|
||||||
// goto err;
|
|
||||||
//}
|
|
||||||
|
|
||||||
printf("\t\t>> Installing ticket...");
|
printf("\t\t>> Installing ticket...");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
@ -781,10 +788,6 @@ skipChecks:
|
|||||||
if (size > BLOCK_SIZE)
|
if (size > BLOCK_SIZE)
|
||||||
size = BLOCK_SIZE;
|
size = BLOCK_SIZE;
|
||||||
|
|
||||||
//if (offset + size > wadSize)
|
|
||||||
// size = wadSize - offset;
|
|
||||||
|
|
||||||
//printf("\n>> Read Offset: %X (%d) Length: %d/%d", offset, size, idx, len);
|
|
||||||
/* Read data */
|
/* Read data */
|
||||||
ret = FSOPReadOpenFile(fp, &wadBuffer, offset, size);
|
ret = FSOPReadOpenFile(fp, &wadBuffer, offset, size);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
s32 Wad_Install(FILE* fp);
|
s32 Wad_Install(FILE* fp);
|
||||||
s32 Wad_Uninstall(FILE* fp);
|
s32 Wad_Uninstall(FILE* fp);
|
||||||
s32 GetSysMenuRegion(u16* version, char* region);
|
s32 GetSysMenuRegion(u16* version, char* region);
|
||||||
const char* GetSysMenuRegionString(const char* region);
|
const char* GetSysMenuRegionString(const char region);
|
||||||
|
const char* GetSysMenuVersionString(u16 version);
|
||||||
|
bool IsPriiloaderInstalled();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user