add have_abhprot() + README

This commit is contained in:
Christopher Roy Bratusek 2012-12-22 10:20:59 +01:00
parent 3c1991aedc
commit 3510fe1b6c
3 changed files with 56 additions and 2 deletions

47
libruntimeiospatch/README Normal file
View File

@ -0,0 +1,47 @@
=== libruntimeiospatch ===
a library providing necessary functions for patching IOS at runtime using HW_AHBPROT
=== Including ===
include the library as
#include <libruntimeiospatch.h> // 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

View File

@ -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)
{

View File

@ -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);