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 


Discovering unknown address after known function is executed
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
jungletek
Advanced Cheater
Reputation: 0

Joined: 02 Oct 2011
Posts: 72

PostPosted: Thu Jan 03, 2019 12:11 pm    Post subject: Reply with quote

FYI, a strategy I find useful for Mono games is to try to find some sort of update function and hook (injection copy) a pointer to the player character's structure (the so-called player base).

So for example, you find an update function that is executed regularly (the idea being that you don't have to perform a specific action to get your injection code executed, and therefore the pointer you want copied to an address you control) and figure out what register is holding the address you need (often RCX, but not always, YMMV), and copy it to an address you can reference from your table or other scripts (do this by using registersymbol(), naming it whatever you want). Then you can just add a new address to your table, type pointer, with the base address being the name of the symbol you registered. The idea being that once you have the playerbase address, you can just build a table that consists of pointer entries in the format of 'symbolname+offset'.

Make sense? Perhaps not, but I'll try to keep an eye on this thread if you have questions, and respond when I can.
Back to top
View user's profile Send private message
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Thu Jan 03, 2019 6:36 pm    Post subject: Reply with quote

That does make sense. I hadn't tried taking my base pointer (from Hunger updates, for example) and tried mapping it out to see if I could reference other interesting values from there. For this particular game, I'm quite satisfied with what I've achieved based on the help I've received so far-- using Mono references to code inject where certain values are changed.

There is one thing still plaguing me, however. It's not a showstopper, but I came across it while attempting to freeze item quantities when swapping items from my inventory into storage containers or NPC inventories during bartering. In this case, I noticed that the code that modifies the quantities comes from the exact same-named function, but in very different parts of memory. This confounds my attempts to inject into one of those functions (the latter one).

For example, in my current play session, here are the two functions and their address ranges:

Code:
068AE58E - 00 00                 - add [rax],al
<DropToBackpack>c__AnonStorey0:<>m__0- 55                    - push rbp
<DropToBackpack>c__AnonStorey0:<>m__0+1- 48 8B EC              - mov rbp,rsp
<DropToBackpack>c__AnonStorey0:<>m__0+4- 56                    - push rsi
<DropToBackpack>c__AnonStorey0:<>m__0+5- 57                    - push rdi
<DropToBackpack>c__AnonStorey0:<>m__0+6- 41 57                 - push r15
<DropToBackpack>c__AnonStorey0:<>m__0+8- 48 83 EC 08           - sub rsp,08 { 8 }
<DropToBackpack>c__AnonStorey0:<>m__0+c- 48 8B F9              - mov rdi,rcx
<DropToBackpack>c__AnonStorey0:<>m__0+f- 48 8B F2              - mov rsi,rdx
<DropToBackpack>c__AnonStorey0:<>m__0+12- 83 FE 01              - cmp esi,01 { 1 }
<DropToBackpack>c__AnonStorey0:<>m__0+15- 0F8C 59010000         - jl <DropToBackpack>c__AnonStorey0:<>m__0+174
<DropToBackpack>c__AnonStorey0:<>m__0+1b- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+1f- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+22- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+25- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+29- 48 63 40 30           - movsxd  rax,dword ptr [rax+30]
<DropToBackpack>c__AnonStorey0:<>m__0+2d- 3B F0                 - cmp esi,eax
<DropToBackpack>c__AnonStorey0:<>m__0+2f- 0F84 A6000000         - je <DropToBackpack>c__AnonStorey0:<>m__0+db
<DropToBackpack>c__AnonStorey0:<>m__0+35- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+39- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+3c- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+3f- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+43- 48 63 48 30           - movsxd  rcx,dword ptr [rax+30]
<DropToBackpack>c__AnonStorey0:<>m__0+47- 2B CE                 - sub ecx,esi
<DropToBackpack>c__AnonStorey0:<>m__0+49- 89 48 30              - mov [rax+30],ecx
<DropToBackpack>c__AnonStorey0:<>m__0+4c- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+50- 48 8B 57 10           - mov rdx,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+54- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+58- 49 BB A040DF1E00000000 - mov r11,BarterHUD:InvalidateCostSlot { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+62- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+65- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+69- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+6d- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+70- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+73- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+77- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+7a- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+7e- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+81- 49 BB 80C1DF1E002BCE00 - mov r11,00CE2B001EDFC180 { 517980544 }
<DropToBackpack>c__AnonStorey0:<>m__0+8b- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+8e- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+92- 4C 8B F8              - mov r15,rax
<DropToBackpack>c__AnonStorey0:<>m__0+95- 41 89 77 30           - mov [r15+30],esi
<DropToBackpack>c__AnonStorey0:<>m__0+99- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+9d- 48 8B 57 18           - mov rdx,[rdi+18]
<DropToBackpack>c__AnonStorey0:<>m__0+a1- 4C 8B 47 20           - mov r8,[rdi+20]
<DropToBackpack>c__AnonStorey0:<>m__0+a5- 4D 8B CF              - mov r9,r15
<DropToBackpack>c__AnonStorey0:<>m__0+a8- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+ac- 49 BB B0EC7C1600000000 - mov r11,BarterHUD:DropItemToBackpack { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+b6- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+b9- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+bd- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+c1- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+c5- 49 BB 10F77C1600000000 - mov r11,BarterHUD:Invalidate { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+cf- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+d2- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+d6- E9 99000000           - jmp <DropToBackpack>c__AnonStorey0:<>m__0+174
<DropToBackpack>c__AnonStorey0:<>m__0+db- 48 8B 47 28           - mov rax,[rdi+28]
<DropToBackpack>c__AnonStorey0:<>m__0+df- 48 8B 4F 10           - mov rcx,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+e3- 48 8B D1              - mov rdx,rcx
<DropToBackpack>c__AnonStorey0:<>m__0+e6- 83 3A 00              - cmp dword ptr [rdx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+e9- 48 8B 51 18           - mov rdx,[rcx+18]
<DropToBackpack>c__AnonStorey0:<>m__0+ed- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+f0- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+f4- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+f7- 49 BB 9046E01E00000000 - mov r11,Inventory:Remove { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+101- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+104- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+108- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+10c- 48 8B 57 18           - mov rdx,[rdi+18]
<DropToBackpack>c__AnonStorey0:<>m__0+110- 4C 8B 47 20           - mov r8,[rdi+20]
<DropToBackpack>c__AnonStorey0:<>m__0+114- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+118- 4C 8B C8              - mov r9,rax
<DropToBackpack>c__AnonStorey0:<>m__0+11b- 41 83 39 00           - cmp dword ptr [r9],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+11f- 4C 8B 48 18           - mov r9,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+123- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+127- 49 BB B0EC7C1600000000 - mov r11,BarterHUD:DropItemToBackpack { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+131- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+134- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+138- 48 8B 47 30           - mov rax,[rdi+30]
<DropToBackpack>c__AnonStorey0:<>m__0+13c- 48 8B 57 10           - mov rdx,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+140- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+143- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+147- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+14a- 49 BB F0C87C1600000000 - mov r11,BackpackHUD:RemoveSlot { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+154- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+157- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+15b- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+15f- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+163- 49 BB 60E77C1600000000 - mov r11,BarterHUD:InvalidateWiegth { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+16d- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+170- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+174- 48 8D 65 E8           - lea rsp,[rbp-18]
<DropToBackpack>c__AnonStorey0:<>m__0+178- 41 5F                 - pop r15
<DropToBackpack>c__AnonStorey0:<>m__0+17a- 5F                    - pop rdi
<DropToBackpack>c__AnonStorey0:<>m__0+17b- 5E                    - pop rsi
<DropToBackpack>c__AnonStorey0:<>m__0+17c- C9                    - leave
<DropToBackpack>c__AnonStorey0:<>m__0+17d- C3                    - ret
068AE70E - 00 00                 - add [rax],al


and

Code:
167CBD5E - 00 00                 - add [rax],al
<DropToBackpack>c__AnonStorey0:<>m__0- 55                    - push rbp
<DropToBackpack>c__AnonStorey0:<>m__0+1- 48 8B EC              - mov rbp,rsp
<DropToBackpack>c__AnonStorey0:<>m__0+4- 56                    - push rsi
<DropToBackpack>c__AnonStorey0:<>m__0+5- 57                    - push rdi
<DropToBackpack>c__AnonStorey0:<>m__0+6- 41 57                 - push r15
<DropToBackpack>c__AnonStorey0:<>m__0+8- 48 83 EC 08           - sub rsp,08 { 8 }
<DropToBackpack>c__AnonStorey0:<>m__0+c- 48 8B F9              - mov rdi,rcx
<DropToBackpack>c__AnonStorey0:<>m__0+f- 48 8B F2              - mov rsi,rdx
<DropToBackpack>c__AnonStorey0:<>m__0+12- 83 FE 01              - cmp esi,01 { 1 }
<DropToBackpack>c__AnonStorey0:<>m__0+15- 0F8C 4B010000         - jl <DropToBackpack>c__AnonStorey0:<>m__0+166
<DropToBackpack>c__AnonStorey0:<>m__0+1b- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+1f- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+23- 48 8B D0              - mov rdx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+26- 83 3A 00              - cmp dword ptr [rdx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+29- 48 8B 50 18           - mov rdx,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+2d- 48 8B 47 18           - mov rax,[rdi+18]
<DropToBackpack>c__AnonStorey0:<>m__0+31- 48 63 40 48           - movsxd  rax,dword ptr [rax+48]
<DropToBackpack>c__AnonStorey0:<>m__0+35- 85 C0                 - test eax,eax
<DropToBackpack>c__AnonStorey0:<>m__0+37- 41 0F94 C0            - sete r8l
<DropToBackpack>c__AnonStorey0:<>m__0+3b- 4D 0FB6 C0            - movzx r8,r8l
<DropToBackpack>c__AnonStorey0:<>m__0+3f- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+43- 49 BB 30BF7C1600000000 - mov r11,PocketHUD:CheckRedhanded { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+4d- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+50- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+54- 85 C0                 - test eax,eax
<DropToBackpack>c__AnonStorey0:<>m__0+56- 0F85 23010000         - jne <DropToBackpack>c__AnonStorey0:<>m__0+17f
<DropToBackpack>c__AnonStorey0:<>m__0+5c- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+60- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+63- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+66- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+6a- 48 63 40 30           - movsxd  rax,dword ptr [rax+30]
<DropToBackpack>c__AnonStorey0:<>m__0+6e- 3B F0                 - cmp esi,eax
<DropToBackpack>c__AnonStorey0:<>m__0+70- 0F84 70000000         - je <DropToBackpack>c__AnonStorey0:<>m__0+e6
<DropToBackpack>c__AnonStorey0:<>m__0+76- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+7a- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+7d- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+80- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+84- 48 63 48 30           - movsxd  rcx,dword ptr [rax+30]
<DropToBackpack>c__AnonStorey0:<>m__0+88- 2B CE                 - sub ecx,esi
<DropToBackpack>c__AnonStorey0:<>m__0+8a- 89 48 30              - mov [rax+30],ecx
<DropToBackpack>c__AnonStorey0:<>m__0+8d- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+91- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+94- 83 39 00              - cmp dword ptr [rcx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+97- 48 8B 40 18           - mov rax,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+9b- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+9e- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+a2- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+a5- 49 BB 80C1DF1E00000000 - mov r11,Item:Clone { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+af- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+b2- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+b6- 4C 8B F8              - mov r15,rax
<DropToBackpack>c__AnonStorey0:<>m__0+b9- 41 89 77 30           - mov [r15+30],esi
<DropToBackpack>c__AnonStorey0:<>m__0+bd- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+c1- 48 8B 57 18           - mov rdx,[rdi+18]
<DropToBackpack>c__AnonStorey0:<>m__0+c5- 4C 8B 47 20           - mov r8,[rdi+20]
<DropToBackpack>c__AnonStorey0:<>m__0+c9- 4D 8B CF              - mov r9,r15
<DropToBackpack>c__AnonStorey0:<>m__0+cc- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+d0- 49 BB C0C77C1600000000 - mov r11,PocketHUD:DropItemToBackpack { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+da- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+dd- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+e1- E9 80000000           - jmp <DropToBackpack>c__AnonStorey0:<>m__0+166
<DropToBackpack>c__AnonStorey0:<>m__0+e6- 48 8B 47 28           - mov rax,[rdi+28]
<DropToBackpack>c__AnonStorey0:<>m__0+ea- 48 8B 4F 10           - mov rcx,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+ee- 48 8B D1              - mov rdx,rcx
<DropToBackpack>c__AnonStorey0:<>m__0+f1- 83 3A 00              - cmp dword ptr [rdx],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+f4- 48 8B 51 18           - mov rdx,[rcx+18]
<DropToBackpack>c__AnonStorey0:<>m__0+f8- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+fb- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+ff- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+102- 49 BB 9046E01E00000000 - mov r11,Inventory:Remove { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+10c- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+10f- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+113- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+117- 48 8B 57 18           - mov rdx,[rdi+18]
<DropToBackpack>c__AnonStorey0:<>m__0+11b- 4C 8B 47 20           - mov r8,[rdi+20]
<DropToBackpack>c__AnonStorey0:<>m__0+11f- 48 8B 47 10           - mov rax,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+123- 4C 8B C8              - mov r9,rax
<DropToBackpack>c__AnonStorey0:<>m__0+126- 41 83 39 00           - cmp dword ptr [r9],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+12a- 4C 8B 48 18           - mov r9,[rax+18]
<DropToBackpack>c__AnonStorey0:<>m__0+12e- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+132- 49 BB C0C77C1600000000 - mov r11,PocketHUD:DropItemToBackpack { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+13c- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+13f- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+143- 48 8B 47 30           - mov rax,[rdi+30]
<DropToBackpack>c__AnonStorey0:<>m__0+147- 48 8B 57 10           - mov rdx,[rdi+10]
<DropToBackpack>c__AnonStorey0:<>m__0+14b- 48 8B C8              - mov rcx,rax
<DropToBackpack>c__AnonStorey0:<>m__0+14e- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+152- 83 38 00              - cmp dword ptr [rax],00 { 0 }
<DropToBackpack>c__AnonStorey0:<>m__0+155- 49 BB F0C87C1600000000 - mov r11,BackpackHUD:RemoveSlot { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+15f- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+162- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+166- 48 8B 4F 38           - mov rcx,[rdi+38]
<DropToBackpack>c__AnonStorey0:<>m__0+16a- 48 83 EC 20           - sub rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+16e- 49 BB 80CC7C1600000000 - mov r11,PocketHUD:Invalidate { (-326416299) }
<DropToBackpack>c__AnonStorey0:<>m__0+178- 41 FF D3              - call r11
<DropToBackpack>c__AnonStorey0:<>m__0+17b- 48 83 C4 20           - add rsp,20 { 32 }
<DropToBackpack>c__AnonStorey0:<>m__0+17f- 48 8D 65 E8           - lea rsp,[rbp-18]
<DropToBackpack>c__AnonStorey0:<>m__0+183- 41 5F                 - pop r15
<DropToBackpack>c__AnonStorey0:<>m__0+185- 5F                    - pop rdi
<DropToBackpack>c__AnonStorey0:<>m__0+186- 5E                    - pop rsi
<DropToBackpack>c__AnonStorey0:<>m__0+187- C9                    - leave
<DropToBackpack>c__AnonStorey0:<>m__0+188- C3                    - ret
167CBEE9 - 00 00                 - add [rax],al


During barter transactions with NPCs, <DropToBackpack>c__AnonStorey0:<>m__0+47 from the first function is what decrements my item quantities. During storage transactions with containers, <DropToBackpack>c__AnonStorey0:<>m__0+88 is what decrements my item quantities. But any attempts to code inject or use aobscanregion() only find entries from the earlier function.

I'm not familiar enough with Mono to know if this is normal or if there's any workaround to be able to patch both functions.
Back to top
View user's profile Send private message
jungletek
Advanced Cheater
Reputation: 0

Joined: 02 Oct 2011
Posts: 72

PostPosted: Thu Jan 03, 2019 8:04 pm    Post subject: Reply with quote

What's wrong with just using AOB's to find the code in each instance of the 'same' function to patch what you want patched? Am I missing something? Is it that the AOB would return the first instance when you wanted the second, or vice versa?

Having proper symbol names is nice for understanding what you're looking at from a macro scale, but you don't need them; you can always just find the same place by AOB scanning...
Back to top
View user's profile Send private message
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Fri Jan 04, 2019 4:49 am    Post subject: Reply with quote

I just like the improved speeds I get with aobscanregion() or especially code injection with mono references. I was hoping there was a way to take advantage of either in this situation, but certainly a regular AOB scan is effective.
Back to top
View user's profile Send private message
jungletek
Advanced Cheater
Reputation: 0

Joined: 02 Oct 2011
Posts: 72

PostPosted: Fri Jan 04, 2019 12:03 pm    Post subject: Reply with quote

aobscanmodule() should be fast enough, certainly faster than scanning all of your system memory space.
Back to top
View user's profile Send private message
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Sat Jan 05, 2019 3:35 pm    Post subject: Reply with quote

I wasn't aware of that one. Seems I have to RTFM some more.

On that note, I'm trying to RTFM to solve a new problem with allocating multiple vars in my header script. The idea is to activate the header script, which declares a couple address placeholders, then a couple of the child scripts will store addresses in those placeholder vars. This allows me to deactivate the child scripts but keep the pointer references.

This works when I use just one:

Code:
[enable]

alloc(hunger,4)
registersymbol(hunger)

[disable]

dealloc(hunger)
unregistersymbol(hunger)


but when I try with two vars, the first one (hunger) becomes both addresses appended into one, and the second (player) stores the correct address:

Code:
[enable]

alloc(hunger,4)
registersymbol(hunger)

alloc(player,4)
registersymbol(player)

[disable]

dealloc(hunger)
unregistersymbol(hunger)

dealloc(player)
unregistersymbol(player)


With the second header script example, after both child scripts store their values, I end up with something like the following:

hunger = P -> 5C431CB0252AA5B0
player = P -> 5C431CB0

After Googling a bit and reading around, I tried using a single larger alloc() and then registering a symbol at its base and another at +4, but that didn't work. I also tried a similar thing using define(). No dice. Seems I'm having a hard time learning just the basics =(

EDIT:

Messing around, apparently it was as simple as changing each alloc() to 8 bytes. I'm unsure why that's the case.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4291

PostPosted: Sat Jan 05, 2019 4:38 pm    Post subject: Reply with quote

It fails because you're trying to store an 8-byte value in a 4-byte storage space.
_________________
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
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Sat Jan 05, 2019 5:03 pm    Post subject: Reply with quote

The relevant lines in the two child scripts are:

Code:
mov [HUNGER],edi
and
Code:
mov [PLAYER],eax


Both of these are 4-byte registers, right?
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Sat Jan 05, 2019 5:48 pm    Post subject: Reply with quote

yes, both. (remember to tell ce how do you want it to be read in address list, as a byte? 2? 4? more? other float ...)
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Sat Jan 05, 2019 5:56 pm    Post subject: Reply with quote

Glad we're all following the same thought patterns so far... I did make sure that the addresses in my table were both 4-byte pointers. Any other ideas? Could it be a bug?
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Sat Jan 05, 2019 6:05 pm    Post subject: Reply with quote

cant think of it as a bug, many users do such things.

maybe posting a screen shot of address list + symbol and offset + hex dump of the region where the symbol resides, can help me and/or others to help you.

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Sat Jan 05, 2019 6:41 pm    Post subject: Reply with quote

Included as many details as I could in the screenshot...


8-byte address in 4-byte var.png
 Description:
Shows first 4-byte alloc() with 8-byte address in it while second 4-byte alloc() has expected 4-byte address.
 Filesize:  224.32 KB
 Viewed:  1892 Time(s)

8-byte address in 4-byte var.png


Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Sat Jan 05, 2019 6:46 pm    Post subject: Reply with quote

haha, sounds like a real bug here.

using symbols as a pointer huh, what if you read 4 bytes before hunger.

edit:
tried to make two scripts like what you did, and used symbols as a pointers.

but it worked perfectly, not sure why tho (i thought it would read and display it as an 8 byte long address) .. so yeah maybe something wrong with your ce.



Code:
checksum
Cheat Engine.exe
version 6.8.2

CRC32
25DB11D1

CRC64
F599117A445105FD

SHA1
C22A3FFFB73674599547ED3FB5C16D1D633B3220

SHA256
3A4B106791B0A17B4268819746A423B510A318898D27882650A4C10CD7F86ABF

MD5
62808B4BA1B949332E3F54FEC29018DD

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
ymiu
Cheater
Reputation: 0

Joined: 16 Dec 2018
Posts: 41

PostPosted: Sat Jan 05, 2019 7:24 pm    Post subject: Reply with quote

hmmm... quite the conundrum. How do I read 4 bytes before? I'm trying to put "hunger-4" in the pointer address, but that's not working.


CE_6.8.2_Checksum.png
 Description:
 Filesize:  24.75 KB
 Viewed:  1871 Time(s)

CE_6.8.2_Checksum.png




Last edited by ymiu on Sat Jan 05, 2019 7:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4291

PostPosted: Sat Jan 05, 2019 7:29 pm    Post subject: Reply with quote

It's a bug with your code.

Pointers in a 64-bit process take up 8 bytes. You're accessing pointers through 4-byte registers. Even if the upper 32 bits of the pointers are 0, it's still a stupid method because people that don't know what they're doing end up with problems like this.

Use rdi / rax instead of edi/eax.

_________________
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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