-Improved code for "Beer Ticket" check

-Fixed runtime IOS type check

TODO:
-Update function definitely isn't working, need to fix it
-Integrate vIOS check by version number
This commit is contained in:
joostinonline 2015-10-06 15:12:36 +00:00
parent 2899777e11
commit b541f5dc53
4 changed files with 9 additions and 16 deletions

BIN
boot.elf

Binary file not shown.

View File

@ -55,6 +55,7 @@ typedef struct {
u8 priiloader; u8 priiloader;
bool nandAccess; bool nandAccess;
u32 runningIOS; u32 runningIOS;
bool runningIOSType;
u32 runningIOSRevision; u32 runningIOSRevision;
} SysSettings_t; } SysSettings_t;

View File

@ -389,31 +389,22 @@ inline s32 RemoveBogusTMD(void)
return ES_DeleteTitle(0x100000000LL); return ES_DeleteTitle(0x100000000LL);
} }
/* Probably doesn't work */
inline bool CheckBeerTicket(u32 titleID) { inline bool CheckBeerTicket(u32 titleID) {
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(0x20); char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(0x20);
u8 *buffer = NULL; u8 *buffer = NULL;
u32 tik_size = 0; u32 tik_size = 0;
//tik *ticket; s32 ret = 0;
sprintf(filepath, "/ticket/00000001/%08x.tik", titleID); sprintf(filepath, "/ticket/00000001/%08x.tik", titleID);
if (read_isfs(filepath, &buffer, &tik_size)) { if (read_isfs(filepath, &buffer, &tik_size)) {
gprintf("Failed to read IOS%u ticket\n", titleID); gprintf("Failed to read IOS%u ticket\n", titleID);
return false; return false;
} }
//ticket = (tik*)(buffer);
//gprintf("Key in IOS%08x ticket is %s.\n", titleID, ticket->cipher_title_key); if (tik_size != 676) return false;
int i; ret = !strcmp((char*)buffer + 0x01BF, "GottaGetSomeBeer");
for (i = 0; i < tik_size - sizeof("GottaGetSomeBeer")-1; i++)
{
if (!strncmp((char*)buffer + i, "GottaGetSomeBeer", sizeof("GottaGetSomeBeer")-1)) {
free(buffer);
return true;
}
}
free(buffer); free(buffer);
return false; return ret;
//return !strcmp((char*)ticket->cipher_title_key, "GottaGetSomeBeer");
} }
inline bool CheckIOSType(void) { inline bool CheckIOSType(void) {

View File

@ -50,6 +50,7 @@ int main(int argc, char **argv)
arguments.USB = strlen(argv[0]) && (argv[0][0] == 'U' || argv[0][0] == 'u'); arguments.USB = strlen(argv[0]) && (argv[0][0] == 'U' || argv[0][0] == 'u');
InitGecko(); InitGecko();
gprintf("==============================================================================");
if(argc>=1){ if(argc>=1){
int i; int i;
for(i=0; i<argc; i++){ for(i=0; i<argc; i++){
@ -336,7 +337,7 @@ int main(int argc, char **argv)
if (SystemInfo.nandAccess) get_miosinfo(SystemInfo.miosInfo); if (SystemInfo.nandAccess) get_miosinfo(SystemInfo.miosInfo);
// Check running IOS type so we don't have to reload it later // Check running IOS type so we don't have to reload it later
if(SystemInfo.deviceType == CONSOLE_WII_U) ios[SystemInfo.runningIOS].infovIOS = CheckIOSType(); SystemInfo.runningIOSType = (SystemInfo.deviceType == CONSOLE_WII_U) && CheckIOSType();
// For each titles found // For each titles found
for (i = SystemInfo.countIOS; i--;) for (i = SystemInfo.countIOS; i--;)
@ -707,7 +708,7 @@ int main(int argc, char **argv)
// Display Title // Display Title
sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion); sprintf(ReportBuffer[APP_TITLE], TXT_AppTitle, TXT_AppVersion);
sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, ios[SystemInfo.runningIOS].infovIOS ? "v" : "", SystemInfo.runningIOS, SystemInfo.runningIOSRevision); sprintf(ReportBuffer[APP_IOS], TXT_AppIOS, SystemInfo.runningIOSType ? "v" : "", SystemInfo.runningIOS, SystemInfo.runningIOSRevision);
SystemInfo.validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN; SystemInfo.validregion = SystemInfo.systemRegion >= CONF_REGION_JP && SystemInfo.systemRegion <= CONF_REGION_CN;
// Display the console region // Display the console region