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 


Need help modifying game with JIT code and dynamic memory

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

Joined: 29 Nov 2016
Posts: 4

PostPosted: Wed Sep 11, 2019 1:53 am    Post subject: Need help modifying game with JIT code and dynamic memory Reply with quote

So I'm trying to modify River City Girls, and it is the hardest game I have ever tried hacking. All I'm trying to do is make the game harder by trying to either make it so you don't gain any stats when leveling up, or to just disable leveling up altogether.

The biggest problem I am running into is the JIT code. I'm not sure if I'm using JIT in the correct sense, but basically if you want to the see the asm routine for leveling up, it WON'T show up in memory UNTIL you level up. So basically, code routines are only searchable and viewable after they are first called. This is very problematic because even if I can hack the routine to do what I want, everytime I start up the game I can't just aobscan to find it in memory because it doesn't show up until you've actually leveled up. So if I wanted to modify the routine everytime I would have to enter the game, level up, then run my aobscan which is a huge pain. I also tried searching for the level up asm routine in the game's exe, but of course, it wasn't in there. I have no idea how they program new games these days, but it's just getting harder and harder to hack!

I also tried finding the character stats in memory, which should all just be simple integers, but of course, can't find them. I really have no idea why they aren't stored in memory and I can't find them through the simple exact value scanning method (ie. scan for value, change the value, scan for new value, etc. until you filter results to a small enough number of results). Is it common for games to encrypt character stats or something to prevent cheating? It's stupid because this game isn't even online or anything.

Anyways, I had to settle for just modifying the level up routine, which is simple enough once you can actually find it, but the JIT code makes it a huge pain in the ass to modify each time you start up the game. Is there any utility in CE 7.0 that can deal with this easily that I'm unaware of? Or do you have no choice but to modify the routine only after it has been loaded into memory?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 70

Joined: 06 Jul 2014
Posts: 2296

PostPosted: Wed Sep 11, 2019 9:58 am    Post subject: Reply with quote

delpo wrote:
I'm not sure if I'm using JIT in the correct sense, but basically if you want to the see the asm routine for leveling up, it WON'T show up in memory UNTIL you level up.

Yes, that's correct usage- the code is compiled "just in time" for it to be run.

delpo wrote:
I also tried finding the character stats in memory, which should all just be simple integers, but of course, can't find them.

There's a virtually infinite number of ways information can be stored. The simplest isn't always the one that's used. Sometimes it's because software developers are bad, and other times they're doing it on purpose. It doesn't matter; just use unknown initial value and changed/unchanged scans.

delpo wrote:
Is there any utility in CE 7.0 that can deal with this easily that I'm unaware of? Or do you have no choice but to modify the routine only after it has been loaded into memory?

Find and modify the intermediate language bytecode. I don't know what language it was written in, but there are disassemblers out there for most popular ILs (e.g. .net/C#/mono, java, as3). I can't walk you through it, but you can use a search engine and/or look through loaded dlls to figure out the language and respective decompiler to use.

_________________
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
t328163
!BEWARE! Deletes post on answer
Reputation: 2

Joined: 19 Dec 2017
Posts: 37

PostPosted: Wed Sep 11, 2019 10:19 am    Post subject: Reply with quote

modify their panties
Back to top
View user's profile Send private message
delpo
How do I cheat?
Reputation: 0

Joined: 29 Nov 2016
Posts: 4

PostPosted: Wed Sep 11, 2019 10:28 am    Post subject: Reply with quote

Quote:
There's a virtually infinite number of ways information can be stored. The simplest isn't always the one that's used. Sometimes it's because software developers are bad, and other times they're doing it on purpose. It doesn't matter; just use unknown initial value and changed/unchanged scans.


I tried that too but still can't find it. I feel like the stats are not stored as ints but perhaps floats. I've given up trying to find it, because as you say, there's an infinite number of ways it could be represented.

Quote:
Find and modify the intermediate language bytecode. I don't know what language it was written in, but there are disassemblers out there for most popular ILs (e.g. .net/C#/mono, java, as3). I can't walk you through it, but you can use a search engine and/or look through loaded dlls to figure out the language and respective decompiler to use.


What? I thought the exe has the bytecode, which translates one to one with IA32 assembly? Are you saying you have to decompile it to get the assembly code? Then after modifying the decompiled code you recompile it? What happens if it uses a checksum? I can't imagine it would be simple to get around that.

I feel like CE is falling behind quickly while games are getting much harder to hack, even when they aren't server-based (in which case you can't even hack them at all).[/quote]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 70

Joined: 06 Jul 2014
Posts: 2296

PostPosted: Wed Sep 11, 2019 11:04 am    Post subject: Reply with quote

JIT stands for "just in time" and refers to a method of compilation. A virtual machine is responsible for managing the compilation.

Compilation refers to taking some form of source code and turning it into lower-level object code. In this case, the virtual machine takes intermediate language bytecode and turns it into machine code.

Bytecode is a sequence of instructions that is designed to be executed in some manner by way of interpretation, including but not limited to JIT compilation. This is opposed to machine code which native hardware is designed to execute (the code you see in CE).

(look on wikipedia for more information)

Try learning how software is developed first. Taking something apart becomes easier if you know how it's built.

_________________
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
atom0s
Moderator
Reputation: 149

Joined: 25 Jan 2006
Posts: 7737
Location: 127.0.0.1

PostPosted: Wed Sep 11, 2019 2:00 pm    Post subject: Reply with quote

There are a handful of tutorials regarding hooking the JIT engine of .NET/Mono online which you can use to intercept the code you are focused on when it is first invoked. Generally for .NET targets this is going to be your best option for runtime alterations.

Otherwise patching and modding the actual game binaries is generally the other solution. (You can do this at runtime using tools like Mono.Cecil, dnlib, Harmony, etc.)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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