mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 05:34:15 +01:00
-using isfs patches of postloader because they are open source
and work just fine with the wiiu wii mode compared to the old one
This commit is contained in:
parent
5028f33930
commit
470e40a9e6
@ -115,8 +115,7 @@ export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(JPGFILES:.jpg=.jpg.o) \
|
||||
$(OGGFILES:.ogg=.ogg.o) $(TXTFILES:.txt=.txt.o) \
|
||||
$(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(BINFILES)) \
|
||||
$(CURDIR)/data/binary/magic_patcher.o
|
||||
$(WAVFILES:.wav=.wav.o) $(addsuffix .o,$(BINFILES))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
|
Binary file not shown.
47
source/channel/identify.c
Normal file
47
source/channel/identify.c
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
/* Code from postloader - thanks to stfour */
|
||||
|
||||
#include <gccore.h>
|
||||
#include <ogc/machine/processor.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "identify.h"
|
||||
|
||||
const u8 isfs_permissions_old[] = { 0x42, 0x8B, 0xD0, 0x01, 0x25, 0x66 };
|
||||
const u8 isfs_permissions_patch[] = { 0x42, 0x8B, 0xE0, 0x01, 0x25, 0x66 };
|
||||
|
||||
static bool apply_patch(const u8 *old, u32 old_size, const u8 *patch, u32 patch_size)
|
||||
{
|
||||
u8 *ptr = (u8*)0x93A00000;
|
||||
bool found = false;
|
||||
u8 *location = NULL;
|
||||
while((u32)ptr < 0x93B00000)
|
||||
{
|
||||
if(!memcmp(ptr, old, old_size))
|
||||
{
|
||||
found = true;
|
||||
location = ptr;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
bool Patch_ISFS_Permission(bool enable)
|
||||
{
|
||||
if(enable)
|
||||
return apply_patch(isfs_permissions_old, sizeof(isfs_permissions_old),
|
||||
isfs_permissions_patch, sizeof(isfs_permissions_patch));
|
||||
else /* Just revert it */
|
||||
return apply_patch(isfs_permissions_patch, sizeof(isfs_permissions_patch),
|
||||
isfs_permissions_old, sizeof(isfs_permissions_old));
|
||||
}
|
15
source/channel/identify.h
Normal file
15
source/channel/identify.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef _PATCHER_H_
|
||||
#define _PATCHER_H_
|
||||
|
||||
bool Patch_ISFS_Permission(bool enable);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -36,6 +36,7 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include "nand.hpp"
|
||||
#include "identify.h"
|
||||
#include "fileOps/fileOps.h"
|
||||
#include "gecko/gecko.h"
|
||||
#include "loader/alt_ios.h"
|
||||
@ -1049,18 +1050,30 @@ s32 Nand::Do_Region_Change(string id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C" { extern s32 MagicPatches(s32); }
|
||||
|
||||
void Nand::Enable_ISFS_Patches(void)
|
||||
{
|
||||
if(AHBRPOT_Patched())
|
||||
gprintf("Enabling ISFS Patches: %i\n", MagicPatches(1));
|
||||
{
|
||||
// Disable memory protection
|
||||
write16(MEM_PROT, 0);
|
||||
// Do patches
|
||||
gprintf("Enabling ISFS Patches: %d\n", Patch_ISFS_Permission(true));
|
||||
// Enable memory protection
|
||||
write16(MEM_PROT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Nand::Disable_ISFS_Patches(void)
|
||||
{
|
||||
if(AHBRPOT_Patched())
|
||||
gprintf("Disabling ISFS Patches: %i\n", MagicPatches(0));
|
||||
{
|
||||
// Disable memory protection
|
||||
write16(MEM_PROT, 0);
|
||||
// Do patches
|
||||
gprintf("Disabling ISFS Patches: %d\n", Patch_ISFS_Permission(false));
|
||||
// Enable memory protection
|
||||
write16(MEM_PROT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Nand::Init_ISFS()
|
||||
|
Loading…
Reference in New Issue
Block a user