NEW: get_libruntimeiospatch_version / MOD: IosPatch_*

This commit is contained in:
Christopher Roy Bratusek 2012-12-28 21:07:29 +01:00
parent d7c7060a16
commit ed955234b9
4 changed files with 71 additions and 11 deletions

View File

@ -27,6 +27,10 @@ This function can be used to keep HW_AHBPROT access when going to reload IOS
>> Flags: [bool]verbose (whether to print messages on-screen)
>> Return:
-5: no HW_AHBPROT access
>0: success
******
if(have_ahbprot()) {
s32 ret;
@ -50,6 +54,10 @@ This function applies patches on current IOS
[bool]vwii (whether to apply extra vWii patches)
[bool]verbose (whether to print messages on-screen)
>> Return:
-5: no HW_AHBPROT access
>0: success (return equals to number of applied patches)
<< Patchsets:
Wii:
* DI Readlimit
@ -91,8 +99,30 @@ This function combines IosPatch_AHBPROT + IOS_ReloadIOS + IosPatch_RUNTIME
[bool]verbose (whether to print messages on-screen)
[int]ios (which IOS to reload into)
>> Return:
-5: no HW_AHBPROT access
-7: patching HW_AHBPROT access failed
>0: success (return equals to number of applied patches)
******
If(have_ahbprot()) {
IosPatch_FULL(true, false, false, false, 58);
}
******
******
libruntimeiospatch 1.2:
======================================
=== get_libruntimeiospatch_version ===
======================================
This function returns the version of libruntimeiospatch in MMM format.
MMM = MajorMinorMicro. 1.2 = 120, 1.9.1 = 191, and so on.
>> Flags: none
******
int lrip = 0;
lrip = get_libruntimeiospatch_version()
******

View File

@ -0,0 +1,17 @@
1,2:
[NEW] get_libruntimeiospatch_version()
[MOD] IosPatch_AHBPROT() - return code re-work
[MOD] IosPatch_RUNTIME() - return code re-work
[MOD] IosPatch_FULL() - retun code re-work
[MOD] API doc file updated
[NEW] CHANGES doc file
1.1:
[NEW] IosPatch_FULL()
[MOD] IosPatch_AHBPROT() - proper return work
[NEW] API doc file
1.0: initial release
[NEW] have_ahbprot()
[NEW] IosPatch_AHBPROT()
[NEW] IosPatch_RUNTIME()

View File

@ -14,6 +14,10 @@
//const u8 check_tmd_patch1[] = { 0x23, 0x01, 0x42, 0x5B };
int get_libruntimeiospatch_version() {
return 120;
}
bool have_ahbprot() {
if(!HAVE_AHBPROT)
return false;
@ -112,25 +116,29 @@ static u32 apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch,
u32 IosPatch_AHBPROT(bool verbose) {
s32 ret = 0;
s32 xret = 0;
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);
ret = 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);
return ret;
xret = ret;
} else {
xret = -5;
}
return 0;
return xret;
}
u32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) {
u32 count = 0;
u32 xret = 0;
if (have_ahbprot()) {
disable_memory_protection();
if(wii)
{
if(verbose)
printf(">> Applying standard Wii patches:\n");
printf(">> Applying standard Wii patches:\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);
@ -160,25 +168,29 @@ u32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose) {
count += apply_patch("Kill_AntiSysTitleInstallv2_pt4", Kill_AntiSysTitleInstallv2_pt4_old, sizeof(Kill_AntiSysTitleInstallv2_pt4_old), Kill_AntiSysTitleInstallv2_pt4_patch, sizeof(Kill_AntiSysTitleInstallv2_pt4_patch), 0, verbose);
count += apply_patch("Kill_AntiSysTitleInstallv2_pt5", Kill_AntiSysTitleInstallv2_pt5_old, sizeof(Kill_AntiSysTitleInstallv2_pt5_old), Kill_AntiSysTitleInstallv2_pt5_patch, sizeof(Kill_AntiSysTitleInstallv2_pt5_patch), 0, verbose);
}
xret = count;
} else {
xret = -5;
}
return count;
return xret;
}
u32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS) {
s32 count = 0;
s32 ret = 0;
s32 xret = 0;
if (have_ahbprot())
ret = IosPatch_AHBPROT(verbose);
ret = IosPatch_AHBPROT(verbose);
else
return -5;
if (ret) {
IOS_ReloadIOS(IOS);
xret = IosPatch_RUNTIME(wii, sciifii, vwii, verbose);
} else {
return 0;
xret = -7;
}
count = IosPatch_RUNTIME(wii, sciifii, vwii, verbose);
return count;
return xret;
}

View File

@ -11,6 +11,7 @@ bool have_ahbprot();
u32 IosPatch_AHBPROT(bool verbose);
u32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose);
u32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS);
int get_libruntimeiospatch_version();
#ifdef __cplusplus
}