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 


Problem with simple code injection for XP

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
skippersp
Cheater
Reputation: 0

Joined: 27 Dec 2014
Posts: 28

PostPosted: Sat Dec 27, 2014 5:26 pm    Post subject: Problem with simple code injection for XP Reply with quote

I reopened Recettear and decided to do a cheat-through. The game compares your adventurer's current XP to its XP table. With XP >= table value and I gain XP, I level up. I started messing with one adventurer for now.

I had no problem with this simple script, assigned to a hotkey:
Code:

// Louie
"recettear.exe"+0411068c:
readmem(04510694,4)

I use code injection to automate this, but his XP turns into a ridiculous value:
Code:

[enable]
alloc(newmem,16)
label(returnhere)
label(originalcode)
label(exit)
alloc(xp,4)
registersymbol(xp)

newmem:
mov [xp],eax

originalcode:

exit:
jmp returnhere

"recettear.exe"+411068C:
jmp newmem
returnhere:

xp:
readmem(04510694,4)

[disable]
dealloc(newmem)
unregistersymbol(xp)
dealloc(xp)

"recettear.exe"+411068C:
readmem(04510694,4)

Result:
Code:

// actual (bad); 6 bytes changed
0451068C: [E9 6F F9 C7 08 85] 09 00 AC D1 09 00
// desired
0451068C: AC D1 09 00 2C 01 09 00 AC D1 09 00

Allocated memory:
Code:

0D190000: 89 05 10 00 19 0D E9 86 06 38 F7 00 00 00 00 00
0D190010: AC D1 09 00 00 00 00 00 00 00 00 00 00 00 00 00


What's wrong with my script, or what's the best way to go about this? I'm not really good with assembly code, and my current progress comes from skimming the forum and examples.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25819
Location: The netherlands

PostPosted: Sat Dec 27, 2014 5:53 pm    Post subject: Reply with quote

That is not an injectable spot (code injections only work on code, not data)

you're best off just freezing it to the next address

tip:
add "recettear.exe"+411068C and "recettear.exe"+4110694 to the addresslist named: current and max

freeze current, and then change the value to:
Code:

(max)


cheat engine will now freeze it to the same value that max has, even when it changes

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
skippersp
Cheater
Reputation: 0

Joined: 27 Dec 2014
Posts: 28

PostPosted: Sat Dec 27, 2014 6:24 pm    Post subject: Reply with quote

Edit:

I thought that would work too. It's not working as intended or I did something wrong. His max XP is still changing ahead of his current XP.

I have:
Code:

// Address list
[X] Louie EXP 0451068c (aka "recettear.exe"+411068C) 4 Bytes (max)
...
[ ] max 04510694 (aka "recettear.exe"+4110694) 4 Bytes ######

And I am still forced to manually update his current XP.

Oddly enough, I tried code injection last night (IT WORKED) and got a character to Lv99 in a few kills. I was half asleep and went to bed reassured I 'saved' something, but that was the game, not the script! FAIL
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