Help with injecting a DLL, my first time!

Ask gaming related questions
sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

Help with injecting a DLL, my first time!

Post by sashaatx » 28 May 2023, 11:41

Hi AHK, (Preamble) I have a very either simple or moderately complex requests of this community and the more experienced users. My experience with python, JS, and auto hotkey has never dipped into the dll import world because a lot of the functional translation for me is a bit tough to understand. Broadly, I understand that there are bits like 32 and 64, and even that might be wrong, and then the function for let's say C sharp Unity script will have things like integer call-outs, I roughly know that these things correlate but I do not know how to use them in this use case or really any.

At the core of what I'm looking to do is using CheatEngine's speed hack for a white hat mod, or non cheating purposes, and apply it to a game without the cheat engine executable. The game being "Railway Empire 2" (new release). I will have a slider AHK GUI, this will apply the multiplier (2x, 5x speed, etc)

This is what I have gathered, and this is what I know.
image.png
image.png (66.7 KiB) Viewed 716 times
- CheatEngine is a GUI to apply basic adjustments to a games code, and the Speedhack displayed above is something I want to isolate and use.
- CheatEngine's SpeedHack is a DLL labeled speedhack-i386.dll with the packaged install.
- This DLL can be injected to the game with a standard DLL injector
- It appears to use this properly, I need to tell the DLL (maybe with LUA) what multiplier and executable I'd like to use it with
- I want to either CUT OUT the inject, and use AHK, or have AHK as a translation layer to the LUA script to the injector, as a GUI.

______________________________


- I need help in DllCall() or DllLoad() functions, I don't even know roughly how to start looking for the function bits and integers and headers.


I would never post GoogleBard AHK code, but I did run the speedhack.dll through Bard to potentially get more info for calling the DLL and the response was:
DllCall("speedhack-i386.dll", "uint", "SetSpeed", "uint", 100)

This code will call the SetSpeed function in the speedhack-i386.dll library and set the speed to 100%. You can change the value of 100 to any number you want to change the speed to.

Here is a breakdown of the code:

DllCall: This function is used to call a function in a DLL library.
"speedhack-i386.dll": This is the name of the DLL library that contains the SetSpeed function.
"uint": This is the data type of the return value of the SetSpeed function.
"SetSpeed": This is the name of the function in the speedhack-i386.dll library that we want to call.
"uint": This is the data type of the first argument to the SetSpeed function.
100: This is the value of the first argument to the SetSpeed function.
- More details quoted from a forum post: https://forum.cheatengine.org/viewtopic.php?t=606565&sid=ddfcc3718f4ac9c34b9194d3faabf4dd
"""Then just use the "speedhack-i386.dll" or the "speedhack-x86_64.dll" DLLs, and inject one in to the process and call what ever functions you need."""

"""But "speedhack_setSpeed" is a Lua function added by Cheat Engine."""
Here is an example LUA script that utilizes this DLL. I have experience with LUA as well.

Code: Select all

"""
strings_add(getAutoAttachList(), "fifa11.exe")  --or whatever your fifa11 exe is called

function setSpeed(bla)
  speedhack_setSpeed(0.93)
  timer_setEnabled(t,false)
end

function onOpenProcess(pid)
  t=createTimer(nil)
  timer_onTimer(t, setSpeed)
  timer_setInterval(t,1) --really short wait (setting the speed on open won't work)
  timer_setEnabled(t, true)
 
end
"""

[Mod action: Moved topic to “Gaming”]
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

Return to “Gaming”