Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapheneCt authored Aug 14, 2020
1 parent 18bb214 commit ed9a37f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()
endif()

set(PLUGIN_PROJECT CoreUnlocker80000H)
set(PLUGIN_PROJECT CapUnlocker)
project(${PLUGIN_PROJECT})
include("${DOLCESDK}/share/dolce.cmake" REQUIRED)

Expand All @@ -28,6 +28,6 @@ set_target_properties(${PLUGIN_PROJECT}
PROPERTIES LINK_FLAGS "-nostdlib"
)

dolce_create_self(CoreUnlocker80000H.skprx ${PLUGIN_PROJECT}
CONFIG ${CMAKE_SOURCE_DIR}/CoreUnlocker80000H.yml
dolce_create_self(CapUnlocker.skprx ${PLUGIN_PROJECT}
CONFIG ${CMAKE_SOURCE_DIR}/CapUnlocker.yml
)
8 changes: 8 additions & 0 deletions CapUnlocker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CapUnlocker:
attributes: 0
version:
major: 0
minor: 1
main:
start: module_start
stop: module_stop
32 changes: 24 additions & 8 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
#include <psp2kern/kernel/modulemgr.h>
#include <taihen.h>

static tai_hook_ref_t hook_ref;
static SceUID hook_id;
static tai_hook_ref_t hook_ref[2];
static SceUID hook_id[2];

static int isAllowedToMount_patched(int a1)
{
return 1;
}

// yes, it is really that easy
static int isIllegalAffinity_patched(int a1, int a2, int a3)
{
return 0;
Expand All @@ -19,22 +23,34 @@ int module_start(SceSize argc, const void *args)
{
tai_module_info_t info;
info.size = sizeof(tai_module_info_t);
taiGetModuleInfoForKernel(KERNEL_PID, "SceKernelThreadMgr", &info);
taiGetModuleInfoForKernel(KERNEL_PID, "SceAppMgr", &info);

hook_id = taiHookFunctionOffsetForKernel(
hook_id[0] = taiHookFunctionOffsetForKernel(
KERNEL_PID,
&hook_ref,
&hook_ref[0],
info.modid,
0,
0x114C,
0x15d54,
1,
isAllowedToMount_patched);

taiGetModuleInfoForKernel(KERNEL_PID, "SceKernelThreadMgr", &info);

hook_id[1] = taiHookFunctionOffsetForKernel(
KERNEL_PID,
&hook_ref[1],
info.modid,
0,
0x114C,
1,
isIllegalAffinity_patched);

return SCE_KERNEL_START_SUCCESS;
}

int module_stop(SceSize argc, const void *args)
{
if(hook_id >= 0) taiHookReleaseForKernel(hook_id, hook_ref);
if(hook_id[0] >= 0) taiHookReleaseForKernel(hook_id[0], hook_ref[0]);
if(hook_id[1] >= 0) taiHookReleaseForKernel(hook_id[1], hook_ref[1]);
return SCE_KERNEL_STOP_SUCCESS;
}

0 comments on commit ed9a37f

Please # to comment.