diff --git a/boot.elf b/boot.elf index 90f24af..e9b24e6 100644 Binary files a/boot.elf and b/boot.elf differ diff --git a/source/gecko.c b/source/gecko.c index 27f5cff..4501362 100644 --- a/source/gecko.c +++ b/source/gecko.c @@ -8,18 +8,17 @@ bool geckoinit = false; bool textVideoInit = false; #ifndef NO_DEBUG - -//using the gprintf from crediar because it is smaller than mine void gprintf( const char *str, ... ) { if (!(geckoinit))return; - char astr[1024]; + char astr[4096]; + int length; va_list ap; va_start(ap,str); - vsnprintf(astr, sizeof(astr), str, ap); - usb_sendbuffer_safe(1, astr, strlen(astr)); + length = vsnprintf(astr, sizeof(astr), str, ap); + if (length > 0) usb_sendbuffer_safe(1, astr, length); va_end(ap); return; diff --git a/source/runtimeiospatch.c b/source/runtimeiospatch.c index 80a47a7..523fbac 100644 --- a/source/runtimeiospatch.c +++ b/source/runtimeiospatch.c @@ -21,6 +21,7 @@ #include "runtimeiospatch.h" #include "gecko.h" +#include "tools.h" #define MEM_REG_BASE 0xd8b4000 #define MEM_PROT (MEM_REG_BASE + 0x20a) @@ -101,8 +102,10 @@ static const u8 isfs_setattr_pt2_patch[] = { 0x2D, 0x00, 0xE0, 0x02, 0x20, 0x66 static u8 apply_patch(const char *name, const u8 *old, u32 old_size, const u8 *patch, size_t patch_size, u32 patch_offset, bool verbose) { u8 *ptr_start = (u8*)*((u32*)0x80003134), *ptr_end = (u8*)0x94000000; u8 found = 0; - if(verbose) + if(verbose) { gprintf(" Patching %-30s", name); + logfile(" Patching %-30s", name); + } u8 *location = NULL; while (ptr_start < (ptr_end - patch_size)) { if (!memcmp(ptr_start, old, old_size)) { @@ -119,10 +122,13 @@ static u8 apply_patch(const char *name, const u8 *old, u32 old_size, const u8 *p ptr_start++; } if(verbose){ - if (found) + if (found) { gprintf(" patched\n"); - else + logfile(" patched\r\n"); + } else { gprintf(" not patched\n"); + logfile(" not patched\r\n"); + } } return found; } @@ -146,7 +152,10 @@ s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) { disable_memory_protection(); if(wii) { - if(verbose) gprintf(">> Applying standard Wii patches:\n"); + if(verbose) { + gprintf(">> Applying standard Wii patches:\n"); + logfile(">> Applying standard Wii patches:\r\n"); + } count += apply_patch("di_readlimit", di_readlimit_old, sizeof(di_readlimit_old), di_readlimit_patch, sizeof(di_readlimit_patch), 12, verbose); count += apply_patch("isfs_permissions", isfs_permissions_old, sizeof(isfs_permissions_old), isfs_permissions_patch, sizeof(isfs_permissions_patch), 0, verbose); count += apply_patch("es_setuid", setuid_old, sizeof(setuid_old), setuid_patch, sizeof(setuid_patch), 0, verbose); @@ -162,7 +171,10 @@ s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) { } if(sciifii) { - if(verbose) gprintf(">> Applying Sciifii patches:\n"); + if(verbose) { + gprintf(">> Applying Sciifii patches:\n"); + logfile(">> Applying Sciifii patches:\r\n"); + } count += apply_patch("MEM2_prot", MEM2_prot_old, sizeof(MEM2_prot_old), MEM2_prot_patch, sizeof(MEM2_prot_patch), 0, verbose); count += apply_patch("ES_OpenTitleContent1", ES_OpenTitleContent1_old, sizeof(ES_OpenTitleContent1_old), ES_OpenTitleContent1_patch, sizeof(ES_OpenTitleContent1_patch), 0, verbose); count += apply_patch("ES_OpenTitleContent2", ES_OpenTitleContent2_old, sizeof(ES_OpenTitleContent2_old), ES_OpenTitleContent2_patch, sizeof(ES_OpenTitleContent2_patch), 0, verbose); @@ -173,7 +185,10 @@ s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) { } if(vwii) { - if(verbose) gprintf(">> Applying vWii patches:\n"); + if(verbose) { + gprintf(">> Applying vWii patches:\n"); + logfile(">> Applying vWii patches:\r\n"); + } count += apply_patch("Kill_AntiSysTitleInstallv3_pt1", Kill_AntiSysTitleInstallv3_pt1_old, sizeof(Kill_AntiSysTitleInstallv3_pt1_old), Kill_AntiSysTitleInstallv3_pt1_patch, sizeof(Kill_AntiSysTitleInstallv3_pt1_patch), 0, verbose); count += apply_patch("Kill_AntiSysTitleInstallv3_pt2", Kill_AntiSysTitleInstallv3_pt2_old, sizeof(Kill_AntiSysTitleInstallv3_pt2_old), Kill_AntiSysTitleInstallv3_pt2_patch, sizeof(Kill_AntiSysTitleInstallv3_pt2_patch), 0, verbose); count += apply_patch("Kill_AntiSysTitleInstallv3_pt3", Kill_AntiSysTitleInstallv3_pt3_old, sizeof(Kill_AntiSysTitleInstallv3_pt3_old), Kill_AntiSysTitleInstallv3_pt3_patch, sizeof(Kill_AntiSysTitleInstallv3_pt3_patch), 0, verbose); diff --git a/source/sys.c b/source/sys.c index bfda9f4..a039fee 100644 --- a/source/sys.c +++ b/source/sys.c @@ -12,12 +12,6 @@ #include #include -#include "sys.h" -#include "SysMenuInfo.h" - -#include "ticket_dat.h" -#include "tmd_dat.h" - #include "fatMounter.h" #include "gecko.h" #include "gui.h" @@ -25,10 +19,16 @@ #include "languages.h" #include "mload.h" #include "sha1.h" +#include "sys.h" +#include "SysMenuInfo.h" #include "title.h" #include "tmdIdentification.h" #include "wiibasics.h" + +#include "ticket_dat.h" +#include "tmd_dat.h" + #define DM_INSTALLED ((*(vu32*)(appfile+i)) == 0x44494F53 && (*(vu32*)(appfile+i+5)) == 0x4D494F53) // true = DM or DML installed #define DML_OR_DM (*(vu32*)(appfile+i+10) == 0x4C697465) // true = DML #define CMP_TIME(X) (difftime(unixTime, (X)) >= 0) @@ -408,7 +408,6 @@ inline bool CheckBeerTicket(u32 titleID) { } inline bool CheckIOSType(void) { - //if (AHB_ACCESS == false) return false; u32 start_address = IOS_TOP; const char WL_String[] = {0x57, 0x4C, 0x3A, 0x20, 0x30, 0x32, 0x2F, 0x30, 0x32, 0x2F, 0x31, 0x32}; // "WL: 02/02/12" u32 i; diff --git a/source/sysCheck.c b/source/sysCheck.c index 5aa727c..6a98374 100644 --- a/source/sysCheck.c +++ b/source/sysCheck.c @@ -14,9 +14,8 @@ #include #include #include -//#include -#include "runtimeiospatch.h" +#include "runtimeiospatch.h" #include "SysMenuInfo.h" #include "fatMounter.h" #include "gecko.h" @@ -631,8 +630,8 @@ int main(int argc, char **argv) else { // Reload IOS - gprintf("// IOS_ReloadIOS(%d)\n", ios[i].titleID); - logfile("// IOS_ReloadIOS(%d)\r\n", ios[i].titleID); + gprintf("IOS_ReloadIOS(%d)\n", ios[i].titleID); + logfile("IOS_ReloadIOS(%d)\r\n", ios[i].titleID); if (SystemInfo.deviceType == CONSOLE_WII_U) IosPatch_FULL(false, false, false, false, ios[i].titleID);