cheat-engine / cheat-engine

Cheat Engine. A development environment focused on modding
http://cheatengine.org
14.91k stars 2.22k forks source link

ceserver compile error #2945

Open krankfried opened 3 months ago

krankfried commented 3 months ago

Im on arch linux running kernel 6.9.7-arch1-1

When i try to compile ceserver it throws the following error:

..//api.c: In function ‘WriteProcessMemory’:
..//api.c:2884:16: error: assignment to ‘PROCESS_VM_WRITEV’ {aka ‘long int (*)(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)’} from incompatible pointer type ‘ssize_t (*)(pid_t,  struct iovec *, struct iovec *, int,  int)’ {aka ‘long int (*)(int,  struct iovec *, struct iovec *, int,  int)’} [-Wincompatible-pointer-types]
 2884 |         write_v=process_vm_writev2;
      |                ^

..//api.c: In function ‘ReadProcessMemory’:
..//api.c:3319:14: error: assignment to ‘PROCESS_VM_READV’ {aka ‘long int (*)(int,  const struct iovec *, long unsigned int,  const struct iovec *, long unsigned int,  long unsigned int)’} from incompatible pointer type ‘ssize_t (*)(pid_t,  struct iovec *, struct iovec *, int,  int)’ {aka ‘long int (*)(int,  struct iovec *, struct iovec *, int,  int)’} [-Wincompatible-pointer-types]
 3319 |         readv=process_vm_readv2;

Build then fails with make: *** [makefile:28: obj/api.o] Error 1

HalanoSiblee commented 1 week ago

October 2024 have the same issue, no fix.

cheat-engine commented 1 week ago

Easy to fix. Just use an older version of GCC what I do, or adjust the type so it matches, or use a typecast

HalanoSiblee commented 1 week ago

aaahh easy, thanks cheat engine for no native linux client and the broken ceserver code you are the best 👍🏻

here's a working definition

ssize_t process_vm_readv2(pid_t pid, const struct iovec *vec, unsigned long iovcnt,
                         const struct iovec *outvec, unsigned long ovecnt, unsigned long flags);

ssize_t process_vm_writev2(pid_t pid, const struct iovec *vec, unsigned long iovcnt,
                         const struct iovec *outvec, unsigned long ovecnt, unsigned long 

after that you will face hundreds of error because Mr.cheat engine want us to roll back gcc like cavemen.

HalanoSiblee commented 1 week ago

patch by mrAppleXZ -- alstruit from the aur will fix the issue for now 🥲

diff -ura --color "cheat-engine-7.5/Cheat Engine/ceserver/api.c" "cheat-engine-7.5-new/Cheat Engine/ceserver/api.c"
--- "cheat-engine-7.5/Cheat Engine/ceserver/api.c"  2023-02-23 14:52:23.000000000 -0600
+++ "cheat-engine-7.5-new/Cheat Engine/ceserver/api.c"  2024-09-09 03:58:50.868238356 -0500
@@ -2273,8 +2273,8 @@
           uintptr_t DR0,DR1,DR2,DR3,DR7, IP, SP;
           regDR6 DR6;
 #if defined __i386__
-          IP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, offsetof(struct user, regs.eip), 0);
-          SP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, offsetof(struct user, regs.esp), 0);
+          IP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, (void*)offsetof(struct user, regs.eip), 0);
+          SP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, (void*)offsetof(struct user, regs.esp), 0);
 #else
           IP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, (void*)offsetof(struct user, regs.rip), 0);
           SP=safe_ptrace(PTRACE_PEEKUSER, p->debuggedThreadEvent.threadid, (void*)offsetof(struct user, regs.rsp), 0);
diff -ura --color "cheat-engine-7.5/Cheat Engine/ceserver/ceservertest.c" "cheat-engine-7.5-new/Cheat Engine/ceserver/ceservertest.c"
--- "cheat-engine-7.5/Cheat Engine/ceserver/ceservertest.c" 2023-02-23 14:52:23.000000000 -0600
+++ "cheat-engine-7.5-new/Cheat Engine/ceserver/ceservertest.c" 2024-09-09 03:57:51.731644915 -0500
@@ -476,7 +476,7 @@
       {
         debug_log("going to set breakpoint\n");

-        i=cenet_setBreakpoint(fd, pHandle, -1, 0x00ce0000, 3, 4,0);
+        i=cenet_setBreakpoint(fd, pHandle, -1, (void *) 0x00ce0000, 3, 4,0);
         //cenet_setBreakpoint(fd, pHandle, -1, 0x85e4, 0, 1,2);
         //cenet_setBreakpoint(fd, pHandle, -1, 0x85e4, 0, 1,3);
        // cenet_setBreakpoint(fd, pHandle, -1, 0x85e4, 0, 1,4);
diff -ura --color "cheat-engine-7.5/Cheat Engine/ceserver/extension/server.c" "cheat-engine-7.5-new/Cheat Engine/ceserver/extension/server.c"
--- "cheat-engine-7.5/Cheat Engine/ceserver/extension/server.c" 2023-02-23 14:52:23.000000000 -0600
+++ "cheat-engine-7.5-new/Cheat Engine/ceserver/extension/server.c" 2024-09-09 03:58:15.958272891 -0500
@@ -335,7 +335,7 @@

       if (recvall(currentsocket, &params, sizeof(params),0)>0)
       {
-        char *modulepath[params.modulepathlength+1];
+        char modulepath[params.modulepathlength+1];
         if (recvall(currentsocket, modulepath, params.modulepathlength, 0)>0)
         {
           typedef void* (*_dlopen)(const char *filename, int flags);