drc: try to support w^x platforms like iOS
[pcsx_rearmed.git] / frontend / libretro.c
index 37cccc4..940ff05 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
+#ifdef __MACH__
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
 
 #include "../libpcsxcore/misc.h"
 #include "../libpcsxcore/psxcounters.h"
@@ -1202,6 +1206,11 @@ void retro_init(void)
        int i, ret;
        bool found_bios = false;
 
+#ifdef __MACH__
+       // magic sauce to make the dynarec work on iOS
+       syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0);
+#endif
+
        ret = emu_core_preinit();
        ret |= emu_core_init();
        if (ret != 0) {