Change by Graphene: Doesn't load in system/homebrew apps, only checks every 15 frames

This commit is contained in:
Furkan Mudanyali 2020-06-04 04:42:44 +03:00 committed by GitHub
parent 5248d0315a
commit 36ed28af3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,11 +14,13 @@
int sceShellUtilTextClipboardRead(void* data, SceSize size, SceSize *textlen); int sceShellUtilTextClipboardRead(void* data, SceSize size, SceSize *textlen);
int sceShellUtilTextClipboardWrite(const void* data, SceSize size); int sceShellUtilTextClipboardWrite(const void* data, SceSize size);
int sceAppMgrIsGameProgram(int);
int hook[2]; int hook[2];
static tai_hook_ref_t screenshot_hook; static tai_hook_ref_t screenshot_hook;
static tai_hook_ref_t screen_disable_hook; static tai_hook_ref_t screen_disable_hook;
const static int done_magic = DONE_MAGIC; const static int done_magic = DONE_MAGIC;
static int frames = 0;
void sceScreenShotDisable_patched() { void sceScreenShotDisable_patched() {
printf("INFO TrophyShot: Prevented disabling screenshot. \n"); printf("INFO TrophyShot: Prevented disabling screenshot. \n");
@ -26,22 +28,29 @@ void sceScreenShotDisable_patched() {
int sceDisplaySetFrameBuf_patched(const SceDisplayFrameBuf* pParam, SceDisplaySetBufSync sync) { int sceDisplaySetFrameBuf_patched(const SceDisplayFrameBuf* pParam, SceDisplaySetBufSync sync) {
int read_data; int read_data, screenshot_ret;
sceShellUtilTextClipboardRead(&read_data, sizeof(int), NULL);
if (read_data == TROPHY_MAGIC) {
printf("SHOOTING\n"); if (frames == 15) {
SceScreenShotCaptureFileInfo captureFileInfo; frames = 0;
sceClibMemset(&captureFileInfo, 0, sizeof(captureFileInfo)); sceShellUtilTextClipboardRead(&read_data, sizeof(int), NULL);
int screenshot_ret = sceScreenShotCapture(1, &captureFileInfo, NULL, NULL);
printf("INFO TrophyShot: sceScreenShotCapture() : 0x%08x path='%s'\n", screenshot_ret, captureFileInfo.path); if (read_data == TROPHY_MAGIC) {
sceShellUtilTextClipboardWrite(&done_magic, sizeof(int)); 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); return TAI_CONTINUE(int, screenshot_hook, pParam, sync);
} }
@ -49,22 +58,28 @@ void _start() __attribute__((weak, alias("module_start")));
int module_start(SceSize args, void *argp) { int module_start(SceSize args, void *argp) {
printf("TrophyShot APP PART 2.0 SALVO FIRE\n"); printf("TrophyShot APP PART 2.0 SALVO FIRE\n");
sceSysmoduleLoadModule(SCE_SYSMODULE_SCREEN_SHOT); int ret = sceAppMgrIsGameProgram(-2);
hook[1] = taiHookFunctionExport( printf("APP TYPE: %d\n", ret);
&screen_disable_hook,
"SceScreenShot",
0xF26FC97D, //SceScreenShot
0x50AE9FF9, //SceScreenShotDisable
sceScreenShotDisable_patched);
hook[0] = taiHookFunctionImport( if (ret == 1) {
&screenshot_hook, sceSysmoduleLoadModule(SCE_SYSMODULE_SCREEN_SHOT);
TAI_MAIN_MODULE, hook[1] = taiHookFunctionExport(
TAI_ANY_LIBRARY, //SceDisplayUser &screen_disable_hook,
0x7A410B64, //sceDisplaySetFrameBuf "SceScreenShot",
sceDisplaySetFrameBuf_patched); 0xF26FC97D, //SceScreenShot
0x50AE9FF9, //SceScreenShotDisable
sceScreenShotDisable_patched);
hook[0] = taiHookFunctionImport(
&screenshot_hook,
TAI_MAIN_MODULE,
TAI_ANY_LIBRARY, //SceDisplayUser
0x7A410B64, //sceDisplaySetFrameBuf
sceDisplaySetFrameBuf_patched);
printf("hooks: 0x%x 0x%x\n", hook[0], hook[1]);
}
printf("hooks: 0x%x 0x%x\n", hook[0], hook[1]);
return SCE_KERNEL_START_SUCCESS; return SCE_KERNEL_START_SUCCESS;
} }