Building CESERVER from source code for android emulator device
Initially my workspace is powered by x64 intel and windows os across multiple machines (not virtual) and this tutorial will be around windows os and targeting x86_64 virtual android 9 (nox).
(…)
Chapters:
CESERVER -- INTRO
CESERVER -- VERSION
CESERVER -- BUILD REQUIREMENTS
CESERVER -- DEVICE
NDK -- INSTALL
NDK -- SETUP AND CONFIGURATION
ADB -- SETUP
ECLIPSE -- INSTALL
ECLIPSE -- SETUP
ECLIPSE -- BUILD
CESERVER -- PUSH
CESERVER -- ADDITIONAL PUSH
CESERVER -- LAUNCH
CESERVER -- SPEEDHACK
CESERVER -- DIAGNOSTIC
CESERVER -- DEBUGGING
ECLIPSE – TROUBLESHOOTERS
OUTTAKES
CESERVER: INTRO.
Building manually might not be required since you can download pre-compiled files from official source.
note: that as for prebuilt 7.5 ceserver, "r23c" NDK is used.
https://www.cheatengine.org/downloads.php under header of "Server (For network scanning)"
Based for Nox Emulator.
CESERVER: VERSION. (! IMPORTANT)
Across each version of cheat engine -- (...as for newest cheat engine (at least for 751 GitHub build), cheat engine version can be found in a "about" menu else you can print version from Lua engine..) -- is required to build-/-have ceserver for that cheat engine specific version. I meant like this:
Cheat Engine 7.5 | Cheat Engine 7.4 ceserver plugin <- and that won't work.
So, this must be like,
Cheat Engine 7.5 | Cheat Engine 7.5 ceserver plugin
or
Cheat Engine GitHub latest source code | Cheat Engine GitHub ceserver latest source code
Else ceserver won't work.
In that case expect "Invalid ceserver" error
CESERVER: BUILD REQUIREMENTS
If you decided you want to build yourself from source code using this tutorial then requirements are
Intel x64Bits, Windows. As well to have network connection and at least 30GB of space. Also, if you are on your account isn’t administrator you need have administrator privileges in order to install, build and run.
So firstly, you also need to have cheat engine from source code in order to work with ceserver.
(As I did mention in CESERVER: VERSION.)
download cheat-engine source from here:
https://github.com/cheat-engine/cheat-engine
to download source code, click code and drop-down menu should appear:
select Download ZIP
note: that mono and ceserver source code (compilable code) is included there.
you will need this also, since android apps runs on mostly IL2CP and java (I did tried few apps)
To compile you will have to compile (MonoDataCollector.sln)
I compiled with Microsoft Visual Studio Community (/w SDK/MSVCP)
after download extract folder anywhere, you wish to work from.
example you can extract into your desktop, or you can extract directly into drive C:/
(Example: C:\cheat-engine-master)
Install cheat engine compiling tools aka. Lazarus:
https://sourceforge.net/projects/lazaru ... s%202.2.2/
first download and install Lazarus-...-win64.exe then Lazarus-...-cross...
I recommend keep installation path as it is C:/lazarus.
... After installation open folder: cheat-engine-master >
Cheat Engine and there is file: cheatengine.lpi
Note: if Lazarus installation was successful no errors should be occurred during project “cheatengine.lpi” opening.
... After opening file select sub menu code > build many modes > mark according your needs and hit OK.
If you don’t know – mark at least 32bit, 64bit, 64bit AVX2.
.. After compiling a message will pop up saying x modes were successfully compiled.
.. A New cheat engine file was generated at cheat-engine-master > cheat engine > bin > cheatengine-x86_64.exe
Now you are ready to setup NDK!
CESERVER: ANDROID DEVICE.
To have working ceserver, you need have rooted device or emulator.
ceserver recommendations are to have at least minimum android 7 or up.
Emulators usually have their own root applications/methods.
Recommended root options: https://github.com/topjohnwu/Magisk
Note: Rooting device can brick your device unrecoverably, be careful when rooting your device. You are solely responsible for your device.
Note: If you going to root your device, check out for your device model recovery custom rom as well such as TWRP or CWM. So, to speaking, back up your android device.
Set Nox to Root.
Set to developer mode at settings -> about device -> build (tap 5 times to unlock):
settings -> Developer options -> ON (slider) -> USB DEBUGGING Slider to ON.
NDK: INSTALL.
Required tools for ceserver:
NDK-Build (Latest): https://developer.android.com/ndk/downloads
OR
NDK Outdated: https://github.com/android/ndk/wiki/Uns ... -Downloads
note: if you are going to debug ceserver then you should need go with NDK (23) unsupported version (am on 23 version) -- since gdbserver is departed from recent NDK versions. if you still chosen newer version alike 27 -- Currently -- you should be ready to deal issues like this:
error: incompatible pointer to integer conversion initializing 'int' with an expression of type '__sighandler_t' (aka 'void (*)(int)') [-Wint-conversion]
and so on...
(…)
NDK: SETUP & CONFIGURATION.
1#
Get NDK-build (links provided above)
2#
(Optional) set path to nox_adb
This is how you can set up ndk path:
A. Extract ndk into your local drive if haven’t done that already.
B. After doing so, Open windows explorer
C. right click on my computer ("This PC") and select properties
C-1. In windows 11 should open ms:settings page "About."
D. Click on "Advanced system settings" in "Related links".
D-1. This should open System Properties
E. In System Properties select environment variables...
E-1. Environment Variables should open.
F. Edit user and system variable Path by adding new separate lines: e.g. X:\Nox\bin
G. Restart machine (or just sing out and then sing in – if you are rushing trough)
G-1. Check if ndk-path is correctly working by opening terminal and entering "nox_adb”. If you get some output, then you have successfully set path to ndk. If you get something "not recognized as an internal or external command" – then the path is set incorrectly.
Notes: if you have separate adb (newer version of) and you have configurated path for it when it could make conflict with nox_adb and its adb.
3#
Edit android.mk files in ceserver directory (if you are building for x86_64)
(as example)
APP_ABI:= x86_64 x86 armeabi-v7a arm64-v8a
LOCAL_PATH := $(call my-dir)
Now you are ready to get into eclipse program...
ADB: SETUP.
As you have done environment setup for ndk you can also setup adb/nox_adb to system environment for faster files transfer (if you haven’t done that). This is required if you want to have automated push to emulator device.
adb driver (google) -/+
(...)
ECLIPSE: INSTALL.
1#
Download from
https://www.eclipse.org/downloads/packa ... developers
2#
Extract there you need.
(...)
ECLIPSE: SETUP.
Open eclipse.
close welcome page if haven’t done that.
choose open projects from file system or archive.
now, don't get confused and don't select "\cheat-engine-master\Cheat Engine\MonoDataCollector\MonoDataCollector"
select folder "\cheat-engine-master\Cheat Engine\MonoDataCollector" and press finish button.
and do the same for folder "\cheat-engine-master\Cheat Engine\ceserver"
at left side project explorer window should be now populated.
~ Repeatable ~
right click on recently populated module and press Preferences
search for "tool" which should bring up Tool Chain Editor. Select that.
(If you are missing this option, try closing eclipse and opening again project.)
In that preferences tab you should see configuration default [Active], to change architecture for selected module, click on manage configurations...
Select according to your needs. set to active. Since this is example for nox emu press active button on android-x86_64 and so press OK.
in same tool chain editor page select recently clicked to active configuration, in this example android-x86_64 [Active] (if didn't bring up by setting to active).
Select (toolchain) Cross GCC over (builder) CDT Internal Builder and click apply (not apply and close, not yet).
Now go to C/C++ (Build)
and select Internal builder.
(if isn't set) make sure it has active configuration and is proper for the case. (x86_64)
Now go to C/C++ (Build) -> Settings page:
Cross Settings:
"C:\android-ndk-r23c\toolchains\llvm\prebuilt\windows-x86_64\bin" -- path to subfolder from ndk folder. Select inside prebuilt folder architecture folder to your needs.
Apply
A rebuild index prompt will show up click OK.
While on the same page check "Includes" at Cross GCC Compiler and change following line into suitable folder (depends on what you chosen to build)
e.g.
... \android-ndk-r27c\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include
While on still same settings page navigate to "Build Steps" tab,
And edit a post-build step following command field:
e.g. From
cp ${BuildArtifactFilePrefix}${BuildArtifactFileName} "${WorkspaceDirPath}/ceserverbin"
To
cmd.exe /c move ${BuildArtifactFilePrefix}${BuildArtifactFileName} "${WorkspaceDirPath}/${BuildArtifactFilePrefix}${BuildArtifactFileName} "
scroll down and press apply (if button isn’t visible) and finally press apply and close.
~ end of configuration ~
note paths (if needed), you will have to replace paths for different modules several times (depending on what you build: one or few or all ceserver files).
Also recheck paths and configuration make sure that properties set to active and
so repeat these steps for (the rest) ceserver and or ceserver-extension and or MonoDataCollector (if needed).
ECLIPSE: BUILD.
press tool icon to build, a new .so mono lib file should appear in your new workspace directory.
now you can move new .so and without extension files into android device
else if you have environments set -- files should be directly pushed there (if emulator is running) ...
Files should been outputted (depending what you chosen to build (import)):
ceserver* (without extension)
libceserver-extension* (.so file)
libMonoDataCollector-*
If Some files wasn’t compiled -- but whatsoever no errors -- check paths and output command at build step.
(…)
CESERVER: PUSH
I use following commands to transfer files to device/emulator:
adb push " WINDOWS_PATH_TO_FILE\ceserver_x86_64" "/data/ceserver"
adb push " WINDOWS_PATH_TO_FILE\libceserver-extension_x86_64.so" "/data/ceserver"
adb push " WINDOWS_PATH_TO_FILE\libMonoDataCollector-x86_64.so" "/data/ceserver"
nox_adb shell chmod 777 /data/ceserver/ceserver_x86_64
nox_adb shell chmod 777 /data/ceserver/libceserver-extension_x86_64.so
nox_adb shell chmod 777 /data/ceserver/libMonoDataCollector-x86_64.so
note : you can setup push if you have configurated nox_adb/adb path at eclipse after build step.
CESERVER: ADDITIONAL PUSH
In order to work you need also need to have these files on targeted device (this is for 32-bit emu):
you can find these files in NDK folder (...\android-ndk-r23c\sources\cxx-stl\llvm-libc++\libs\x86_64):
libc++_shared.so,
Push an copy of file into
/data/ceserver
/lib/
/system/lib64/
adb push "WINDOWS_PATH_TO_FILE\libc++shared.so" "/data/ceserver"
adb push "WINDOWS_PATH_TO_FILE\libc++shared.so" "/lib/"
adb push "WINDOWS_PATH_TO_FILE\libc++_shared.so" "/system/lib64/"
If you are not willing to deal with this, you can skip this but keep in mind if device doesn’t have that file and ceserver will request module then will be an issue... make sure you have it on your device, just in case.
In general, for easier (friendlier GUI moving method) you can use androids root explorer or any similar application that would allow you to change folders & files and their permissions, so you could move files around. Console/Terminal then will be required to open ports and launching ceserver.
(...)
CESERVER: LAUNCH.
This depends on there you placed ceserver in emulator and .so libraries...
example if you placed in /data/ceserver
also, you need to do chmod on new written files inside emulator which allows read/write/execute (777)7)
In order to launch ceserver, you need to forward port first in order to launch ceserver (when emulator is running) open CMD/Terminal:
nox_adb forward tcp:52736 tcp:52736
and then
nox_adb shell
su
/data/ceserver/ceserver_x86_64
This command will launch ceserver. While the server is running you can try to open emulator app and then try to attach with Cheat engine.
To connect to ceserver from cheat engine, do via process list -> Network -> localhost 52736 -> Android emulator processes should appear in cheat engine’s process list (…)
(...)
CESERVER: SPEEDHACK
Ceserver has component (extension) called "ceserver-extension" which is (essential in order ceserver to work) responsible for speed control also known as speed hack. If extension fails to load -- output would be something like this:
OpenPipe("ceserver_extensionXXXXXX”) trying to connect to ceserver_extensionXXXXXX
connect returned -1
it means -- speed hack for targeted platform-process won't work …
(...)
CESERVER: DIAGNOSTIC.
In order to have better log output from ceserver (trace) is recommended to use logcat/syslog. It can provide important information about why and what fails in a more detailed way.
This is what am using:
nox_adb logcat -s CESERVER:V MonoDataCollector:V CESERVER_EXTENSION:V
With this command will be only displayed ceserver output only.
(...)
CESERVER: DEBUGGING.
You can also debug, ceserver with gdbserver which requires opening/forwarding addition ports, configurating eclipse (setting gdbserver settings in eclipse to manual TCP connection) and moving some additional files into targeted device (which also exist in android-ndk 23).
Or as an alternative to eclipse you can try to launch gdbserver directly from Console/PowerShell.
Example in how to launch (alternatively) gdbserver:
Nox_adb shell
SU
/data/ceserver/gdbserver :2345 /data/ceserver/ceserver_x86_64
(...)
ECLIPSE: TROUBLESHOOTERS.
If builders empty and you installed eclipse C/C++ -- if that happens then there is misconfiguration going on, try restarting eclipse.
if you are missing internal builder option -- delete current monodatacollector and import again from cheat-engine-master zip monodatacollector and try again loading folder (also restart eclipse but not PC)
Note: indication that project successfully loaded is when you can go to project properties and select
(C/C++ Build) -> tool chain editor and (C/C++ Build) -> settings and you can see internal builder option at dirrect C/C++ Build page.
Info: Nothing to build for MonoDataCollector/selected module. (Clean project. Note as default eclipse will try clean with command rm which by default on windows doesn't exist -- you have either two options: clean manually yourself or edit cprojects file) (…)
I get an error while compiling:
Error: Program "make" not found in PATH
PATH=[...:/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_
Solution: One of properties isn't set to active or you forgot to set internal. Recheck configuration.
Also, you could try removing unnecessary configurations (which you are not going to build) yet,
doing so you might encounter "Illegal state" or "Internal" eclipse error.
Keep in mind you will still have at one point, or another look into code for mistakes or/and issues like this:
error: unknown type name 'INT32'; did you mean 'UINT32'?
Just, after fixing or adjusting or modifying or expanding code don't forget to do clean up before build.
OUTTAKES.
Rundown on Cross GCC:
Cross GCC/android-NDK is all you need, and you don't need to install any components like cygwin64 (that has make) -- I tried installing cygwin64 but just wasted my time debugging installation problems (incompatibility). As default or at least for for that version I tried, cygwin64 build comes with installation incompatibilities. Which causes problems when using cygwin64 libraries such as "make" to compile things... If “make” needed to you then I could recommend use MinGW.
How can I get *.apk files from google play store?
Install application from google play store and then get *.apk file from 3rd application which can save from application into *.apk file...
another approach is to use online services:
https://apkcombo.com/downloader/
note: this service doesn’t allow direct *.apk downloads from paid apps.
As for paid applications. There is another online service which allows download apks from google play store if you own application (you must connect your google account with their service in order to download). Yet I currently don't recall website URI.
Currently it seems apkcombo method doesn't work, at least not always, due DMCA stuff, as alternative :
F-Droid (open source) --> Aurora Store
If you trust any 3rd store source --> Aurora Store apk.
(Which allows you download region restricted apps)
when entering command while in nox_adb or adb shell, you can press [ <-> T A B ] to see possible commands -- note with is when launching shell without using su! tab
Also,
Thanks to Dark byte for additional help going through this, because uhm ceserver mono collector didn't wanted to be loaded at all, If not additional script .. H E R E .. (I can share this since now its public) I wouldn't have finished testing, and I wouldn't began writing this.
So cheers to all,