mirror of
https://github.com/Thesola10/umd-livepatch.git
synced 2025-04-19 22:13:22 +00:00
WOOHOO I BROKE UMD READING WITHOUT CRASHING
This commit is contained in:
parent
500cefcb69
commit
cd6d4822fa
9
.ccls
9
.ccls
@ -1,2 +1,11 @@
|
||||
gcc
|
||||
-I/home/karim/GitRepos/ARK-4/common/include
|
||||
-I/home/karim/GitRepos/ARK-4/core/systemctrl/include
|
||||
-I/usr/local/pspdev/psp/include
|
||||
-I/usr/local/pspdev/psp/sdk/include
|
||||
-I.
|
||||
-std=c99
|
||||
-Os
|
||||
-G0
|
||||
-D_PSP_FW_VERSION=660
|
||||
-D__CCLS__
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ PARAM.SFO
|
||||
*.o
|
||||
*.elf
|
||||
*.prx
|
||||
*.a
|
||||
|
73
main.c
73
main.c
@ -11,30 +11,101 @@
|
||||
*/
|
||||
|
||||
#include <pspkernel.h>
|
||||
#include <systemctrl.h>
|
||||
#include <string.h>
|
||||
|
||||
PSP_MODULE_INFO("umd_livepatch", PSP_MODULE_KERNEL, 0, 8);
|
||||
PSP_MODULE_INFO("umd_livepatch", PSP_MODULE_KERNEL, 2, 1);
|
||||
|
||||
int module_found = 0;
|
||||
int loader_found = 0;
|
||||
|
||||
PspIoDrvFuncs reserveUmdFuncs;
|
||||
|
||||
PspIoDrvFuncs patchedUmdFuncs;
|
||||
|
||||
PspIoDrv originalUmdDriver;
|
||||
|
||||
PspIoDrv reserveUmdDriver = {
|
||||
.name = "umdraw",
|
||||
.dev_type = 4,
|
||||
.unk2 = 0x800,
|
||||
.name2 = "UMD_RAW",
|
||||
.funcs = &reserveUmdFuncs
|
||||
};
|
||||
|
||||
PspIoDrv patchedUmdDriver = {
|
||||
.name = "umd",
|
||||
.dev_type = 4, // block device
|
||||
.unk2 = 0x800,
|
||||
.name2 = "UMD9660",
|
||||
.funcs = &patchedUmdFuncs
|
||||
};
|
||||
|
||||
#define MAX_MODULE_NUMBER 256
|
||||
|
||||
|
||||
// Bogus read to test intercepting
|
||||
static int patched_IoRead(PspIoDrvFileArg *arg, char *data, int len)
|
||||
{
|
||||
Kprintf("Reading UMD data, hum dee dum...\n");
|
||||
return reserveUmdFuncs.IoRead(arg, data, len);
|
||||
}
|
||||
|
||||
int module_start(SceSize argc, void *argp)
|
||||
{
|
||||
PspIoDrv *umdDriver = 0;
|
||||
int ret;
|
||||
|
||||
Kprintf("------------------\nUMD Livepatch starting...\n");
|
||||
#ifdef CUSTOM_PATH
|
||||
//get_plugin_path(argp);
|
||||
#endif
|
||||
|
||||
umdDriver = sctrlHENFindDriver("umd");
|
||||
if (umdDriver) {
|
||||
originalUmdDriver = *umdDriver;
|
||||
reserveUmdFuncs = *umdDriver->funcs;
|
||||
Kprintf("Found UMD driver at 0x%08x\n", umdDriver);
|
||||
} else {
|
||||
Kprintf("Could not find UMD driver...\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
patchedUmdFuncs = reserveUmdFuncs;
|
||||
|
||||
patchedUmdFuncs.IoRead = &patched_IoRead;
|
||||
|
||||
if (ret = sceIoAddDrv(&reserveUmdDriver)) {
|
||||
Kprintf("Reserve failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
} else {
|
||||
Kprintf("Reserved previous UMD driver!\n");
|
||||
}
|
||||
|
||||
sceIoDelDrv("umd");
|
||||
|
||||
if (ret = sceIoAddDrv(&patchedUmdDriver)) {
|
||||
Kprintf("Install failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
} else {
|
||||
Kprintf("Installed our own UMD driver!\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int module_stop(void)
|
||||
{
|
||||
Kprintf("Unloading UMD Livepatch.");
|
||||
sceIoDelDrv("umd");
|
||||
|
||||
sceIoAddDrv(&originalUmdDriver);
|
||||
sceIoDelDrv("umdraw");
|
||||
Kprintf("Restored original UMD driver.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void infernoSetDiscType(void) {}
|
||||
void infernoCacheSetPolicy(void) {}
|
||||
void infernoCacheInit(void) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user