mirror of
https://github.com/modmii/Any-Region-Changer-ModMii-Edition.git
synced 2024-11-22 08:09:18 +01:00
mm scrap that
This commit is contained in:
parent
d7df66655f
commit
2456595f8b
@ -217,15 +217,15 @@ char get_sysmenu_region(void)
|
|||||||
tikview view ATTRIBUTE_ALIGN(0x20) = {};
|
tikview view ATTRIBUTE_ALIGN(0x20) = {};
|
||||||
s32 cfd;
|
s32 cfd;
|
||||||
char region = 0;
|
char region = 0;
|
||||||
unsigned char buffer[0x2000] ATTRIBUTE_ALIGN(0x20) = {};
|
|
||||||
const char search[] = "ipl\\bin\\RVL\\Final_";
|
const char search[] = "ipl\\bin\\RVL\\Final_";
|
||||||
|
unsigned char* buffer = NULL;
|
||||||
|
|
||||||
ret = ES_GetTicketViews(TITLE_ID(1, 2), &view, 1);
|
ret = ES_GetTicketViews(TITLE_ID(1, 2), &view, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("Error! ES_GetTicketViews (ret = %i)\n", ret);
|
printf("Error! ES_GetTicketViews (ret = %i)\n", ret);
|
||||||
wait_anyKey();
|
wait_anyKey();
|
||||||
return 0;
|
return '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
// .......right, this isn't a vWii with Priiloader installed lol
|
// .......right, this isn't a vWii with Priiloader installed lol
|
||||||
@ -234,45 +234,45 @@ char get_sysmenu_region(void)
|
|||||||
{
|
{
|
||||||
printf("Error! ES_OpenTitleContent (ret = %i)\n", ret);
|
printf("Error! ES_OpenTitleContent (ret = %i)\n", ret);
|
||||||
wait_anyKey();
|
wait_anyKey();
|
||||||
return 0;
|
return '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
size_t size = ret = ES_SeekContent(cfd, 0, SEEK_END);
|
||||||
|
ES_SeekContent(cfd, 0, SEEK_SET);
|
||||||
|
|
||||||
|
buffer = memalign(0x20, size);
|
||||||
|
if (!buffer)
|
||||||
{
|
{
|
||||||
ret = ES_ReadContent(cfd, buffer, sizeof(buffer) / 2);
|
printf("Out of memory!\n");
|
||||||
if (ret <= 0)
|
wait_anyKey();
|
||||||
break;
|
exit(1);
|
||||||
|
|
||||||
for (int i = 0; i < ret; i++) // Ok this is really bad. What if it cuts off at the 4kb boundary........ i have an idea
|
|
||||||
{
|
|
||||||
if (memcmp(buffer + i, search, MIN(sizeof(search) - 1, (ret - i))) == 0)
|
|
||||||
{
|
|
||||||
if ((ret - i) < sizeof(search))
|
|
||||||
// printf("Region string was in the middle of the 4KB boundary.\nFilling in the other 4kb.\n");
|
|
||||||
ES_ReadContent(cfd, buffer + ret, sizeof(buffer) / 2);
|
|
||||||
|
|
||||||
printf("%s\n", buffer + i);
|
|
||||||
region = *(buffer + i + strlen(search));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (region)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = ES_ReadContent(cfd, buffer, size);
|
||||||
ES_CloseContent(cfd);
|
ES_CloseContent(cfd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("Error! ES_ReadContent (ret = %i)\n", ret);
|
printf("Error! ES_ReadContent (ret = %i)\n", ret);
|
||||||
wait_anyKey();
|
wait_anyKey();
|
||||||
}
|
}
|
||||||
else if (!region)
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
printf("Unable to identify system menu region!!\n");
|
if (memcmp(buffer + i, search, sizeof(search) - 1) == 0)
|
||||||
wait_anyKey();
|
{
|
||||||
|
printf("Found you!!! offset=%08x\n%s\n", i, buffer + i);
|
||||||
|
region = *(buffer + i + strlen(search));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
free(buffer);
|
||||||
|
if (!region)
|
||||||
|
{
|
||||||
|
printf("Unable to identify system menu region!!\n");
|
||||||
|
sleep(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return region ? region : '?';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ int main(int argc, char **argv)
|
|||||||
int Current_Ios = 0;
|
int Current_Ios = 0;
|
||||||
|
|
||||||
videoInit();
|
videoInit();
|
||||||
ret = IosPatch_FULL(true, true, false, false, IOS_GetVersion());
|
ret = 0; // IosPatch_FULL(true, true, false, false, IOS_GetVersion());
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ret = IOS_ReloadIOS(236);
|
ret = IOS_ReloadIOS(236);
|
||||||
|
Loading…
Reference in New Issue
Block a user