diff --git a/libruntimeiospatch/README b/libruntimeiospatch/README new file mode 100644 index 0000000..2be6ce4 --- /dev/null +++ b/libruntimeiospatch/README @@ -0,0 +1,47 @@ +=== libruntimeiospatch === + +a library providing necessary functions for patching IOS at runtime using HW_AHBPROT + +=== Including === + +include the library as + +#include // Code +LIBS := -lruntimeiospatch // Makefile + +=== API === + +have_ahbprot(): this function returns true, then there is HW_AHBPROT available + +IosPatch_AHBPROT(bool verbose): this function can be used to keep HW_AHBPROT when going to reload IOS + +example: +... +if(have_ahbprot()) { + IosPatch_AHBPROT(false); + IOS_ReloadIOS(36); + ... +} +... + +IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose): this function applies patches into IOS + +Flags: +wii: apply standard wii patches (DI Readlimit, ISFS Permissions, ES SetUID, ES SetIdentify, Hash Check (aka Trucha), New Hash Check (aka New Trucha)) +sciifii: apply additional sciifii patches (MEM2 Prot, ES OpenTitleContent 1+2, ES ReadContent Prot, ES CloseContent, Es TitleVersionCheck, ES TitleDeleteCheck) +vwii: apply special vwii-only patches (Kill Anti-SystemTitle-Install 1-5) + +example: + +... +If(have_ahbprot()) { + IosPatch_RUNTIME(true, false, false, false); + ... +} +... + += Thanks = +- libOGC devs +- Team Twizzers +- damysterman +- anyone I forgot to mention here diff --git a/libruntimeiospatch/source/runtimeiospatch.c b/libruntimeiospatch/source/runtimeiospatch.c index e98aa58..a963696 100644 --- a/libruntimeiospatch/source/runtimeiospatch.c +++ b/libruntimeiospatch/source/runtimeiospatch.c @@ -14,6 +14,12 @@ //const u8 check_tmd_patch1[] = { 0x23, 0x01, 0x42, 0x5B }; +bool have_ahbprot() { + if(!HAVE_AHBPROT) + return false; + return true; +} + static void disable_memory_protection() { write32(MEM_PROT, read32(MEM_PROT) & 0x0000FFFF); } @@ -102,7 +108,7 @@ static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch, } u32 IosPatch_AHBPROT(bool verbose) { - if (HAVE_AHBPROT) { + if (have_ahbprot()) { disable_memory_protection(); //return apply_patch("set_ahbprot", check_tmd_old, sizeof(check_tmd_old), check_tmd_patch, sizeof(check_tmd_patch), 6, verbose); return apply_patch("es_set_ahbprot", es_set_ahbprot_old, sizeof(es_set_ahbprot_old), es_set_ahbprot_patch, sizeof(es_set_ahbprot_patch), 25, verbose); @@ -113,7 +119,7 @@ u32 IosPatch_AHBPROT(bool verbose) { u32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) { u32 count = 0; - if (HAVE_AHBPROT) { + if (have_ahbprot()) { disable_memory_protection(); if(wii) { diff --git a/libruntimeiospatch/source/runtimeiospatch.h b/libruntimeiospatch/source/runtimeiospatch.h index a737bf7..40908f5 100644 --- a/libruntimeiospatch/source/runtimeiospatch.h +++ b/libruntimeiospatch/source/runtimeiospatch.h @@ -7,6 +7,7 @@ extern "C" { #endif +bool have_ahbprot(); u32 IosPatch_AHBPROT(bool verbose); u32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose);