Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
Changed screenshot function, now a single main plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
FMudanyali committed Sep 27, 2020
1 parent 23bf7d3 commit 7fedb92
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 274 deletions.
32 changes: 10 additions & 22 deletions main/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
endif()
endif()

project(trophyshot_shell)
project(TrophyShot)
include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)

dolce_gen_libs(SceShellSvc_stubs
SceShellSvc.yml
LIB SceShellSvc_stub_weak)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions")
Expand All @@ -24,27 +20,19 @@ link_directories(
)

add_executable(${PROJECT_NAME}
trophy_shell.c
main.c
)

target_link_libraries(${PROJECT_NAME}
SceLibKernel_stub
SceKernelModulemgr_stub
SceKernelThreadMgr_stub
SceSysmem_stub
SceScreenShot_stub_weak
SceShellSvc_stub_weak
SceSysmodule_stub
SceShellSvc_stub
ScePaf_stub_weak
SceRtc_stub
gcc
k
taihen_stub
taihenModuleUtils_stub
SceLibKernel_stub
SceThreadmgr_stub
SceScreenShot_stub_weak
SceModulemgr_stub
SceSysmodule_stub
taihenModuleUtils_stub
taihen_stub
)
dolce_create_self(${PROJECT_NAME}.suprx ${PROJECT_NAME}
UNSAFE
CONFIG ${CMAKE_SOURCE_DIR}/TrophyShot.yml
)

)
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ Get it from here: https://github.com/FMudanyali/TrophyShot/releases

In config.txt inside tai folder,

TrophyShot_shell.suprx goes under *main

TrophyShot_app.suprx goes under *ALL
TrophyShot.suprx goes under *main

like this:
```
*main
ur0:tai/TrophyShot_shell.suprx
*ALL
ur0:tai/TrophyShot_app.suprx
ur0:tai/TrophyShot.suprx
```
After modifying the config, reboot.

Expand Down
2 changes: 1 addition & 1 deletion app/TrophyShot.yml → TrophyShot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TrophyShotApp:
TrophyShot:
attributes: 0
version:
major: 1
Expand Down
51 changes: 0 additions & 51 deletions app/CMakeLists.txt

This file was deleted.

12 changes: 0 additions & 12 deletions app/SceShellSvc.yml

This file was deleted.

79 changes: 0 additions & 79 deletions app/trophy_app.c

This file was deleted.

68 changes: 68 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <taihen.h>
#include <psp2/kernel/modulemgr.h>
#include <psp2/kernel/threadmgr.h>
#include <psp2/kernel/clib.h>
#include <psp2/sysmodule.h>

#define printf sceClibPrintf

int hook[1];
static tai_hook_ref_t shell_hook;

int (*shellShot)(void);

// Taken from sysident - taihen_min.c https://github.com/cuevavirus/sysident
int module_get_offset(SceUID modid, int segidx, uint32_t offset, void *stub_out){
int res = 0;
SceKernelModuleInfo info;

if(segidx > 3) return -1;
if(stub_out == NULL) return -2;

res = sceKernelGetModuleInfo(modid, &info);
if(res < 0) return res;
if(offset > info.segments[segidx].memsz) return -3;

*(uint32_t *)stub_out = (uint32_t)(info.segments[segidx].vaddr + offset);
return 0;
}

int sub_81229FAC_patched(int arg1, int arg2){
int ret = TAI_CONTINUE(int, shell_hook, arg1, arg2);
sceKernelDelayThread(1800000);
printf("INFO TrophyShot: Trophy unlocked.\n");
shellShot();
return ret;
}

void _start() __attribute__((weak, alias("module_start")));
int module_start(SceSize args, void *argp) {
tai_module_info_t tai_info;
tai_info.size = sizeof(tai_module_info_t);
int ret = taiGetModuleInfo("SceShell", &tai_info);
if (ret < 0) return SCE_KERNEL_START_SUCCESS;
//function found by teakhanirons
module_get_offset(
tai_info.modid,
0,
0x14a928 | 1,
&shellShot
);
//function found by Graphene
hook[0] = taiHookFunctionOffset(
&shell_hook,
tai_info.modid,
0,
0x229fac,
1,
sub_81229FAC_patched
);

printf("INFO sub_81229FAC_patched: 0x%x\n", hook[0]);
return SCE_KERNEL_START_SUCCESS;
}

int module_stop(SceSize args, void *argp) {
if (hook[0] >= 0) taiHookRelease(hook[0], shell_hook);
return SCE_KERNEL_STOP_SUCCESS;
}
12 changes: 0 additions & 12 deletions main/SceShellSvc.yml

This file was deleted.

8 changes: 0 additions & 8 deletions main/TrophyShot.yml

This file was deleted.

Loading

0 comments on commit 7fedb92

Please sign in to comment.