rmccrystal / modernwarfare-cheat-rs-archive

A Cheat for Call of Duty: Modern Warfare written in Rust using my memlib-rs library
45 stars 17 forks source link

Can't compile #3

Open Shutakobein opened 4 years ago

Shutakobein commented 4 years ago

I am trying to compile your code but I get these errors do I need anything else than your memlib-rs dependancy?

error: failed to run custom build command for `modernwarfare-cheat-rs v0.1.0 (/home/ozgur/modernwarfare-cheat-rs)`

Caused by:
  process didn't exit successfully: `/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-fd07e3fcdf3226c0/build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge/CRATE" "-Wall" "-Wextra" "-std=c++20" "-o" "/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/cxxbridge/modernwarfare-cheat-rs/src/sdk/encryption.rs.o" "-c" "/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/cxxbridge/modernwarfare-cheat-rs/src/sdk/encryption.rs.cc"
cargo:warning=In file included from /home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/cxxbridge/modernwarfare-cheat-rs/src/sdk/encryption.rs.cc:1:
cargo:warning=/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge/CRATE/modernwarfare-cheat-rs/src/sdk/encryption.h:5:26: error: expected initializer before ‘QWORD’
cargo:warning=    5 | typedef unsigned __int64 QWORD;
cargo:warning=      |                          ^~~~~
exit code: 1
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge/CRATE" "-Wall" "-Wextra" "-std=c++20" "-o" "/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/src/sdk/encryption.o" "-c" "src/sdk/encryption.cpp"
cargo:warning=In file included from src/sdk/encryption.cpp:1:
cargo:warning=src/sdk/encryption.h:5:26: error: expected initializer before ‘QWORD’
cargo:warning=    5 | typedef unsigned __int64 QWORD;
cargo:warning=      |                          ^~~~~
cargo:warning=src/sdk/encryption.cpp: In function ‘uint64_t decrypt_client_info(uint64_t, uint64_t, uint64_t, uint64_t)’:
cargo:warning=src/sdk/encryption.cpp:4:63: warning: unused parameter ‘game_base_address’ [-Wunused-parameter]
cargo:warning=    4 | auto decrypt_client_info(uint64_t encrypted_address, uint64_t game_base_address, uint64_t last_key, uint64_t peb) -> uint64_t
cargo:warning=      |                                                      ~~~~~~~~~^~~~~~~~~~~~~~~~~
cargo:warning=src/sdk/encryption.cpp:4:110: warning: unused parameter ‘peb’ [-Wunused-parameter]
cargo:warning=    4 | auto decrypt_client_info(uint64_t encrypted_address, uint64_t game_base_address, uint64_t last_key, uint64_t peb) -> uint64_t
cargo:warning=      |                                                                                                     ~~~~~~~~~^~~
cargo:warning=src/sdk/encryption.cpp: In function ‘uint64_t decrypt_client_base(uint64_t, uint64_t, uint64_t, uint64_t)’:
cargo:warning=src/sdk/encryption.cpp:26:9: error: ‘QWORD’ was not declared in this scope
cargo:warning=   26 |         QWORD rbx, rcx, rdx, r10, r11, r14 = 0;
cargo:warning=      |         ^~~~~
cargo:warning=src/sdk/encryption.cpp:28:22: error: ‘_rotr64’ was not declared in this scope
cargo:warning=   28 |         auto index = _rotr64(not_peb, 0xC) & 0xF;
cargo:warning=      |                      ^~~~~~~
cargo:warning=src/sdk/encryption.cpp:33:17: error: ‘r11’ was not declared in this scope
cargo:warning=   33 |                 r11 = not_peb;
cargo:warning=      |                 ^~~
cargo:warning=src/sdk/encryption.cpp:34:17: error: ‘rcx’ was not declared in this scope; did you mean ‘rax’?
cargo:warning=   34 |                 rcx = rax;
cargo:warning=      |                 ^~~
cargo:warning=      |                 rax
cargo:warning=src/sdk/encryption.cpp:43:17: error: ‘rdx’ was not declared in this scope; did you mean ‘rax’?
cargo:warning=   43 |                 rdx = last_key; // DISPLACEMENT = 0x15, REVERSED_ADDRESS = 0x4D47115, _byteswap_uint64
cargo:warning=      |                 ^~~
cargo:warning=      |                 rax
cargo:warning=src/sdk/encryption.cpp:49:17: error: ‘rbx’ was not declared in this scope; did you mean ‘rax’?
cargo:warning=   49 |                 rbx = game_base_address;
cargo:warning=      |                 ^~~
cargo:warning=      |                 rax
cargo:warning=src/sdk/encryption.cpp:109:17: error: ‘r14’ was not declared in this scope
cargo:warning=  109 |                 r14 = game_base_address + 0x2AD7946E;
cargo:warning=      |                 ^~~
cargo:warning=src/sdk/encryption.cpp:393:17: error: ‘r10’ was not declared in this scope
cargo:warning=  393 |                 r10 = game_base_address + 0x9308;
cargo:warning=      |                 ^~~
exit code: 1

--- stderr

CXX include path:
  /home/ozgur/modernwarfare-cheat-rs/target/cxxbridge
  /home/ozgur/modernwarfare-cheat-rs/target/cxxbridge/CRATE

error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge" "-I" "/home/ozgur/modernwarfare-cheat-rs/target/cxxbridge/CRATE" "-Wall" "-Wextra" "-std=c++20" "-o" "/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/cxxbridge/modernwarfare-cheat-rs/src/sdk/encryption.rs.o" "-c" "/home/ozgur/modernwarfare-cheat-rs/target/debug/build/modernwarfare-cheat-rs-7267153592da52a6/out/cxxbridge/modernwarfare-cheat-rs/src/sdk/encryption.rs.cc" with args "c++" did not execute successfully (status code exit code: 1).

warning: build failed, waiting for other jobs to finish...
error: build failed
dtolnay commented 4 years ago

It looks like this is due to:

https://github.com/rmccrystal/modernwarfare-cheat-rs/blob/d59dcb700d0594beffdc2fd08bf2208959ec01ea/src/sdk/encryption.h#L5

because __int64 is a Windows thing. Maybe it would work as: typedef uint64_t QWORD; using the cross platform fixed width integer type from \<cstdint>: https://en.cppreference.com/w/cpp/types/integer.