Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Getting base address from THREADSTACK or changing src to fix

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
jrobin30
How do I cheat?
Reputation: 0

Joined: 13 Jun 2020
Posts: 4

PostPosted: Thu Jun 18, 2020 3:06 pm    Post subject: Getting base address from THREADSTACK or changing src to fix Reply with quote

I was able to determine where a variable for the number of levels completed in the game is, however, cheat engine returns THREADSTACK0 instead of an exe or dll. The software I am using this for does not support the use of threadstack (it is the asl autosplitting language used with livesplit). Is there a way to get the address that references threadstack that would work in this case?

Alternatively, I have been in contact with the developer of this game and she has been extremely helpful in making changes to the code in order to set up the autosplitter (she changed a local variable to a global one so that it could be found in cheat engine). Is there a change to the source code that would fix this instead? Something that would give the variable a static address that could be pointed to instead of the threadstack?

Information on either of these solutions would be greatly appreciated.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 153

Joined: 06 Jul 2014
Posts: 4731

PostPosted: Thu Jun 18, 2020 4:03 pm    Post subject: Reply with quote

jrobin30 wrote:
Is there a way to get the address that references threadstack that would work in this case?
Just using asl, I highly doubt it, but I haven't looked at it much.
This seems like an issue that you should report. Perhaps link them to this post for help. Or perhaps do it yourself and make a pull request if you're confident in C#.

jrobin30 wrote:
Is there a change to the source code that would fix this instead?
From within Lua itself, probably not; however, from the language that sets up Lua, certainly. This is obviously language-dependent.
e.g. from the C code on Lua.org:
Code:
int main (int argc, char **argv) {
  int status, result;
  lua_State *L = luaL_newstate();  /* create state */
  //...
"L", the pointer to the Lua state, is stored locally in the stack (hence THREADSTACK0 base address). An alternative pointer path could be created by adding a couple lines like so:
Code:
static lua_State *easy_autosplit_base;

int main (int argc, char **argv) {
  int status, result;
  lua_State *L = luaL_newstate();  /* create state */
  easy_autosplit_base = L;  /* copy ptr to state for speedrunners and autosplit */
  //...
Here, the pointer "easy_autosplit_base" is outside any function and hence will be stored in the exe.
You could also just declare L as static:
Code:
static lua_State *L = luaL_newstate();  /* create state */
This should be fine too, but it changes the program more than one might expect.
The previous modification didn't really change anything - it just added another pointer path that can be used.

Is that pointer path in CE actually consistent? It likely goes through a few hash tables.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites