From aeee973e081497fe7f8ead158b33a78e634e9860 Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sat, 22 Dec 2012 18:57:19 +0000 Subject: [PATCH] -fixed some things of r818 -slightly modified ios patching system --- source/channel/banner.cpp | 3 ++- source/channel/identify.c | 8 ++------ source/channel/nand.cpp | 22 +++++----------------- source/channel/nand.hpp | 2 -- 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/source/channel/banner.cpp b/source/channel/banner.cpp index f41f0877..96124910 100644 --- a/source/channel/banner.cpp +++ b/source/channel/banner.cpp @@ -37,6 +37,7 @@ #include "nand.hpp" #include "gecko/gecko.hpp" #include "loader/fs.h" +#include "loader/sys.h" #include "unzip/U8Archive.h" #define IMET_OFFSET 0x40 @@ -168,7 +169,7 @@ void Banner::GetBanner(u64 title, char *appname, bool imetOnly) u8 *buf = NULL; u32 size = 0; s32 len = imetOnly ? sizeof(IMET) + IMET_OFFSET : -1; - if(NandHandle.EmulationEnabled()) + if(NANDemuView) buf = NandHandle.GetEmuFile(appname, &size, len); else buf = ISFS_GetFile(appname, &size, len); diff --git a/source/channel/identify.c b/source/channel/identify.c index 65e99ff6..360697f5 100644 --- a/source/channel/identify.c +++ b/source/channel/identify.c @@ -20,14 +20,10 @@ static bool apply_patch(char *name, const u8 *old, u32 old_size, const u8 *patch { found = true; location = ptr + patch_offset; - u8 *start = location; u32 i; for(i = 0; i < patch_size; i++) - { - *location = patch[i]; - location++; - } - DCFlushRange((u8 *)(((u32)start) >> 5 << 5), (patch_size >> 5 << 5) + 64); + location[i] = patch[i]; + DCFlushRange(location, patch_size); break; } ptr++; diff --git a/source/channel/nand.cpp b/source/channel/nand.cpp index f220e624..15461a9a 100644 --- a/source/channel/nand.cpp +++ b/source/channel/nand.cpp @@ -1029,27 +1029,15 @@ s32 Nand::Do_Region_Change(string id) return 1; } -void Nand::Enable_ISFS_Patches(void) -{ - if(AHBRPOT_Patched()) - Patch_ISFS_Permission(true); -} - -void Nand::Disable_ISFS_Patches(void) -{ - if(AHBRPOT_Patched()) - Patch_ISFS_Permission(false); -} - void Nand::Init_ISFS() { - gprintf("Init ISFS\n"); - ISFS_Initialize(); - if(IOS_GetType(IOS_GetVersion()) == IOS_TYPE_NORMAL_IOS) + if(IOS_GetVersion() < 222) { - Enable_ISFS_Patches(); + Patch_ISFS_Permission(true); AccessPatched = true; } + gprintf("Init ISFS\n"); + ISFS_Initialize(); } void Nand::DeInit_ISFS(bool KeepPatches) @@ -1058,7 +1046,7 @@ void Nand::DeInit_ISFS(bool KeepPatches) ISFS_Deinitialize(); if(AccessPatched && !KeepPatches) { - Disable_ISFS_Patches(); + Patch_ISFS_Permission(false); AccessPatched = false; } } diff --git a/source/channel/nand.hpp b/source/channel/nand.hpp index af39508f..dc75edd6 100644 --- a/source/channel/nand.hpp +++ b/source/channel/nand.hpp @@ -106,8 +106,6 @@ private: void PatchAHB(void); bool ISFS_Check(void); - void Enable_ISFS_Patches(void); - void Disable_ISFS_Patches(void); void __Dec_Enc_TB(void); void __configshifttxt(char *str);