mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-01 09:05:06 +01:00
9e85032382
- fixed gc ciso games to show and launch via WFL. thanks CokeCookie for getting me to fix it. note banners do not show for ciso games unless you use a custom gc banner. - added (for wii u vwii) to be able to select Wii U channel as the exit to choice either via main cfg pg 4 exit to option or home menu>exit to menu and select wii u menu. - removed priiloader and bootmii as exit to options when on wii u vwii - added random select game option. manually edit wiiflow_lite.ini and under [GENERAL] set "random_select" to yes then while in wiiflow lite main screen hold B and press '-' to have WFL random select a game instead of random boot a game. - removed region change from savenand emulation types. why? because according to overjoy's commit he said it didn't work yet. it was for a future version of d2x cios when davebaol added it to d2x cios. i looked at all the d2x cios commits from that date to present and didn't see that it was ever added. if i'm wrong someone let me know and i will add it back into wfl. - made some small bootup changes in case of errors on bootup. - made some changes to the way wiiflow lite handles emunand switching and other minor emunand code editing.
116 lines
2.9 KiB
C++
116 lines
2.9 KiB
C++
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <malloc.h>
|
|
|
|
#include "channel_launcher.h"
|
|
#include "booter/external_booter.hpp"
|
|
#include "gecko/gecko.hpp"
|
|
#include "loader/disc.h"
|
|
#include "loader/fs.h"
|
|
#include "loader/fst.h"
|
|
#include "loader/utils.h"
|
|
#include "loader/sys.h"
|
|
#include "memory/mem2.hpp"
|
|
#include "memory/memory.h"
|
|
#include "unzip/lz77.h"
|
|
#include "types.h"
|
|
|
|
bool Identify_GenerateTik(signed_blob **outbuf, u32 *outlen)
|
|
{
|
|
signed_blob *buffer = (signed_blob*)MEM2_memalign(32, STD_SIGNED_TIK_SIZE);
|
|
if(!buffer)
|
|
return false;
|
|
memset(buffer, 0, STD_SIGNED_TIK_SIZE);
|
|
|
|
sig_rsa2048 *signature = (sig_rsa2048*)buffer;
|
|
signature->type = ES_SIG_RSA2048;
|
|
|
|
tik *tik_data = (tik *)SIGNATURE_PAYLOAD(buffer);
|
|
strcpy(tik_data->issuer, "Root-CA00000001-XS00000003");
|
|
memset(tik_data->cidx_mask, 0xFF, 32);
|
|
|
|
*outbuf = buffer;
|
|
*outlen = STD_SIGNED_TIK_SIZE;
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Identify(u64 titleid)
|
|
{
|
|
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
|
memset(filepath, 0, ISFS_MAXPATH);
|
|
|
|
gprintf("Reading TMD for %08x %08x...", TITLE_UPPER(titleid), TITLE_LOWER(titleid));
|
|
sprintf(filepath, "/title/%08x/%08x/content/title.tmd", TITLE_UPPER(titleid), TITLE_LOWER(titleid));
|
|
u32 tmdSize;
|
|
u8 *tmdBuffer = ISFS_GetFile(filepath, &tmdSize, -1);
|
|
if (tmdBuffer == NULL || tmdSize == 0)
|
|
{
|
|
gprintf("Failed!\n");
|
|
return false;
|
|
}
|
|
gprintf("Success!\n");
|
|
|
|
u32 tikSize;
|
|
signed_blob *tikBuffer = NULL;
|
|
|
|
gprintf("Generating fake ticket...");
|
|
if(!Identify_GenerateTik(&tikBuffer, &tikSize))
|
|
{
|
|
gprintf("Failed!\n");
|
|
return false;
|
|
}
|
|
gprintf("Success!\n");
|
|
|
|
gprintf("Reading certs...");
|
|
memset(filepath, 0, ISFS_MAXPATH);
|
|
strcpy(filepath, "/sys/cert.sys");
|
|
|
|
u32 certSize = 0;
|
|
u8 *certBuffer = ISFS_GetFile(filepath, &certSize, -1);
|
|
if (certBuffer == NULL || certSize == 0)
|
|
{
|
|
gprintf("Failed!\n");
|
|
free(tmdBuffer);
|
|
free(tikBuffer);
|
|
return false;
|
|
}
|
|
gprintf("Success!\n");
|
|
|
|
gprintf("ES_Identify\n");
|
|
u32 keyId = 0;
|
|
DCFlushRange(tmdBuffer, tmdSize);
|
|
DCFlushRange(tikBuffer, tikSize);
|
|
DCFlushRange(certBuffer, certSize);
|
|
s32 ret = ES_Identify((signed_blob*)certBuffer, certSize, (signed_blob*)tmdBuffer, tmdSize, tikBuffer, tikSize, &keyId);
|
|
if(ret < 0)
|
|
{
|
|
switch(ret)
|
|
{
|
|
case ES_EINVAL:
|
|
gprintf("Error! ES_Identify (ret = %d;) Data invalid!\n", ret);
|
|
break;
|
|
case ES_EALIGN:
|
|
gprintf("Error! ES_Identify (ret = %d;) Data not aligned!\n", ret);
|
|
break;
|
|
case ES_ENOTINIT:
|
|
gprintf("Error! ES_Identify (ret = %d;) ES not initialized!\n", ret);
|
|
break;
|
|
case ES_ENOMEM:
|
|
gprintf("Error! ES_Identify (ret = %d;) No memory!\n", ret);
|
|
break;
|
|
default:
|
|
gprintf("Error! ES_Identify (ret = %d)\n", ret);
|
|
break;
|
|
}
|
|
}
|
|
gprintf("AHBPROT: %d, Key ID: %u\n", AHBPROT_Patched(), keyId);
|
|
free(tmdBuffer);
|
|
free(tikBuffer);
|
|
free(certBuffer);
|
|
|
|
return ret < 0 ? false : true;
|
|
}
|