#include #include #include #include #include #include #include #include #include #define printf sceClibPrintf #define TROPHY_MAGIC 12345678 #define DONE_MAGIC 87654321 int sceShellUtilTextClipboardRead(void* data, SceSize size, SceSize *textlen); int sceShellUtilTextClipboardWrite(const void* data, SceSize size); int sceAppMgrIsGameProgram(int); int hook[1]; static tai_hook_ref_t screenshot_hook; const static int done_magic = DONE_MAGIC; static int frames = 0; int sceDisplaySetFrameBuf_patched(const SceDisplayFrameBuf* pParam, SceDisplaySetBufSync sync) { int read_data, screenshot_ret; if (frames == 5) { frames = 0; sceShellUtilTextClipboardRead(&read_data, sizeof(int), NULL); if (read_data == TROPHY_MAGIC) { printf("SHOOTING\n"); SceScreenShotCaptureFileInfo captureFileInfo; sceClibMemset(&captureFileInfo, 0, sizeof(captureFileInfo)); screenshot_ret = sceScreenShotCapture(1, &captureFileInfo, NULL, NULL); printf("INFO TrophyShot: sceScreenShotCapture() : 0x%08x path='%s'\n", screenshot_ret, captureFileInfo.path); sceShellUtilTextClipboardWrite(&done_magic, sizeof(int)); } } frames++; return TAI_CONTINUE(int, screenshot_hook, pParam, sync); } void _start() __attribute__((weak, alias("module_start"))); int module_start(SceSize args, void *argp) { printf("TrophyShot APP PART 2.0 SALVO FIRE\n"); int ret = sceAppMgrIsGameProgram(-2); printf("APP TYPE: %d\n", ret); if (ret == 1) { sceSysmoduleLoadModule(SCE_SYSMODULE_SCREEN_SHOT); hook[0] = taiHookFunctionImport( &screenshot_hook, TAI_MAIN_MODULE, TAI_ANY_LIBRARY, //SceDisplayUser 0x7A410B64, //sceDisplaySetFrameBuf sceDisplaySetFrameBuf_patched); printf("INFO TrophyShot_app: sceDisplaySetFrameBuf HOOK: 0x%x\n", hook[0]); } return SCE_KERNEL_START_SUCCESS; } int module_stop(SceSize args, void *argp) { if (hook[0] >= 0) taiHookRelease(hook[0], screenshot_hook); return SCE_KERNEL_STOP_SUCCESS; }