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 


Can CE Find ASM in Dolphin?
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Tue Apr 15, 2014 10:17 pm    Post subject: Can CE Find ASM in Dolphin? Reply with quote

Need a little help here. I know that CE can give you pcsx2's emulated ASM address when you select "find what reads/writes to this address", basically the ESI is what you want, just add a "2" to the beginning of the given address or several behind it. I also know that the RAM is mounted from 0x20000000 to 0x22000000. Thanks to DarkByte for this phenomenal tool I have been able to make walk through walls codes for several PS2 games (they are located at Gamehacking.org)

But now I have hit a roadblock, I want to make ASM codes for GameCube and Wii using CE and Dolphin. One thing I have found out is this after setting a read on Sonic's rings in SA2B:

105A58CE - 66 C1 C1 08 - rol cx,08
105A58D2 - 81 E2 FFFFFF3F - and edx,3FFFFFFF
105A58D8 - 66 89 8A 0000780A - mov [edx+0A780000],cx <<
105A58DF - 8B CF - mov ecx,edi
105A58E1 - 81 C1 68000000 - add ecx,00000068

EAX=00000007
EBX=00000000
ECX=00000800
EDX=001CC1D0
ESI=00000000
EDI=801CC168
ESP=1D94FC2C
EBP=00000008
EIP=105A58DF

The EDX value is the GameCube rings RAM address, but the problem is I don't how to get the ASM code that stops him from losing rings when he's hit. Another thing, this address here:0xA780000 is where the emulated RAM starts. There is one person I know that figured how to get the ASM by using CE with Dolphin but he's not answering me on how it's done.

So I will ask, is there anyone here that has figured how to do it? If not maybe someone can give me some ideas on where/how to start?

Thanks


Last edited by 47iscool on Fri Apr 18, 2014 11:05 am; edited 1 time in total
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Thu Apr 17, 2014 4:09 pm    Post subject: Reply with quote

You're best served by using debugging tools within the emulator itself, not something external.

http://code.google.com/p/dolphin-emu/wiki/DeveloperGuide

_________________
Back to top
View user's profile Send private message
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Fri Apr 18, 2014 10:59 am    Post subject: Reply with quote

Rydian wrote:
You're best served by using debugging tools within the emulator itself, not something external.


The problem is I can't ever get it to snap when a value has been written. I've even tried the debugfast versions of Dolphin running in interpreter mode and couldn't get a break. The regular Dolphin builds only supports execution breakpoints, not memory which I need.


Last edited by 47iscool on Fri Apr 18, 2014 3:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Apr 18, 2014 11:21 am    Post subject: Reply with quote

That one person probably had found "instruction pointer" or something like that.


"only support execution breakpoints"
Is there "instruction pointer" in that dolphin debugger? If yes, find address that keeps instruction pointer and add it to CE.

Find and add rings address, then set "break on write" breakpoint with CE.
How to set break on write? Highlight rings address, press ctrl+b, in "memory viewer" (hex view part) right click and choose "display type" and click data type you want (if rings is 4byte value, choose 4byte decimal, if 2bytes value, choose 2byte decimal), ok, now right click rings value (in hexview part) and choose "data breakpoint -> break on write".

Go to game, loose some rings ( if you accidentally gained some rings, game froze, you must press F9 in "memory viewer" window, press F9 it at least one time)


While you loose some rings, game will freeze. Look at "instruction pointer" value inside CE. Now you know which instruction (pointed by "instruction pointer" is overwriting rings).


Note: in above method, "instruction pointer" can point to exact instruction (the one which overwrites) or next instruction (instruction which is right after "overwriting instruction").

_________________
Back to top
View user's profile Send private message MSN Messenger
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Fri Apr 18, 2014 4:09 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
That one person probably had found "instruction pointer" or something like that.


"only support execution breakpoints"
Is there "instruction pointer" in that dolphin debugger? If yes, find address that keeps instruction pointer and add it to CE.

Find and add rings address, then set "break on write" breakpoint with CE.
How to set break on write? Highlight rings address, press ctrl+b, in "memory viewer" (hex view part) right click and choose "display type" and click data type you want (if rings is 4byte value, choose 4byte decimal, if 2bytes value, choose 2byte decimal), ok, now right click rings value (in hexview part) and choose "data breakpoint -> break on write".

Go to game, loose some rings ( if you accidentally gained some rings, game froze, you must press F9 in "memory viewer" window, press F9 it at least one time)


While you loose some rings, game will freeze. Look at "instruction pointer" value inside CE. Now you know which instruction (pointed by "instruction pointer" is overwriting rings).


Note: in above method, "instruction pointer" can point to exact instruction (the one which overwrites) or next instruction (instruction which is right after "overwriting instruction").


I'm not sure how to find the "instruction pointer" in Dolphin's debugger, and yes I already knew about write breakpoints. Here take a look, getting rings or losing them gives the same instuctions:



Capture.JPG
 Description:
 Filesize:  160.99 KB
 Viewed:  21407 Time(s)

Capture.JPG


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Apr 18, 2014 5:50 pm    Post subject: Reply with quote

Dolphin is an emulator. That means that the code that accesses something, is the same for everything. That includes walking speed, rendering 3d objects and networking

One thing you could do is compare the saved stack snapshots and see if you can find a way to distinguish a ring loss from everything else. (e.g the stack might contain a pointer to the emulated instruction. And based on that instruction it's the ring loss code, or the render pixel code)

_________________
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
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Fri Apr 18, 2014 6:26 pm    Post subject: Reply with quote

Dark Byte wrote:
Dolphin is an emulator. That means that the code that accesses something, is the same for everything. That includes walking speed, rendering 3d objects and networking

One thing you could do is compare the saved stack snapshots and see if you can find a way to distinguish a ring loss from everything else. (e.g the stack might contain a pointer to the emulated instruction. And based on that instruction it's the ring loss code, or the render pixel code)


I don't see an option to save the stack, how do I do this?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Apr 18, 2014 6:42 pm    Post subject: Reply with quote

the find what accesses options save stack snapshots by default.

In more info, click on the S button. Then rightclick in the stackview window and you'll find a option to add a snapshot to the compare in a structure dissect window

_________________
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
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Fri Apr 18, 2014 7:05 pm    Post subject: Reply with quote

Dark Byte wrote:
the find what accesses options save stack snapshots by default.

In more info, click on the S button. Then rightclick in the stackview window and you'll find a option to add a snapshot to the compare in a structure dissect window


Thanks, I did right click but it only gave me these options:

I'm using CE 6.2 by the way.



sv.JPG
 Description:
 Filesize:  31.63 KB
 Viewed:  21362 Time(s)

sv.JPG


Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Apr 18, 2014 7:39 pm    Post subject: Reply with quote

choose "lock and add this view to a structure dissect window"
_________________
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
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Fri Apr 18, 2014 8:14 pm    Post subject: Reply with quote

Dark Byte wrote:
choose "lock and add this view to a structure dissect window"


Thanks

Still haven't found anything useful. I'm kind of confused with the addresses too, there's so many of them and I'm not sure which ones refer to the emulators memory or which ones refer to the emulated ASM memory (if any besides the EDX)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Apr 19, 2014 5:13 am    Post subject: Reply with quote

Put multiple besides eachother.
Find out what writes your rings and make sure the first access is the one where you lose one
Then again find what writes your rings and make sure the first access is the one where you gain one

Now compare the two stack snapshots with eachother

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Apr 19, 2014 11:39 am    Post subject: This post has 1 review(s) Reply with quote

@47iscool, launch dolphin with /d switch.

1) Run game. Click pause (main dolphin window). Now, choose from "view" this one "registers".

2) You will find PC register there. Double click it then right click it and choose "copy".

3) Paste this value to CE and do 4byte scan (exact, hex).

4) In dolphin click play, wait a while, click pause

5) repeat step 2 and 3 (next scan)

6) that way, you will find instruction pointer. PC register.

7) add it to CE. Name it "Dolphin GC - PC register"


You will have PC register from GameCube CPU, which is inside Dolphin process (because it is an emulator). For me, Dolphin4 32bit, PC register can be found here: Dolphin.exe+A4FB00

Now, with CE, find rings address. Do "what accesses this address". I got this:
Code:
105FC8DB - 8B C1  - mov eax,ecx
105FC8DD - 81 E0 FFFFFF3F - and eax,3FFFFFFF
105FC8E3 - 0FB7 80 0000C80A  - movzx eax,word ptr [eax+0AC80000] <<
105FC8EA - 0FC8 - bswap eax
105FC8EC - C1 F8 10 - sar eax,10

EAX=00007100
EBX=7C9010E0
ECX=801CC1D0
EDX=0F6E0020
ESI=801CC168
EDI=00000000
ESP=1FF5FF0C
EBP=1FF5FF24
EIP=105FC8EA


ECX (=801CC1D0) keeps rings address (the address that will be in real GameCube).
(801CC1D0 & 3FFFFFFF) + 0AC80000 = is address you found with CE.

Close "what access" window. Set "break on access" breakpoint. Emulation will freeze immediately.
Look at "PC register". It will be:
800625B8

OK, remove all breakpoints (CE breakpoints). And resume thread execution (F9 key).
Set breakpoint in Dolphin. Try 800625B8.

I got it here:
Code:
800625b4 rlwinm   r0, r29, 1, 0, 30 (7fffffff)
800625b8 add   r3, r3, r0                        <---- break here
800625bc lha   r0, 0x0068 (r3)
800625c0 stw   r0, 0x0904 (r31)
800625c4 lwz   r0, 0x0904 (r31)


hmm, lha instruction, at address 800625bc.
lha r0, 0x0068 (r3) - translates to: store value into R0 register, value from memory pointed by R3+68.



Quick glance at "registers tab", R3 is 801cc168

801CC168 + 68 is 801CC1D0. Bingo.


Summary:
Our "Dolphin GC - PC register" address added to CE is not accurate. On breakpoint, made with CE, it points to previous instruction instead to current.

_________________
Back to top
View user's profile Send private message MSN Messenger
47iscool
Cheater
Reputation: 0

Joined: 15 Apr 2014
Posts: 34

PostPosted: Sat Apr 19, 2014 1:06 pm    Post subject: Reply with quote

@mgr.inz.Player Thank you so much!!! Now I can make GC and Wii ASM codes! Very very happy now thanks a million! Would you mind if I copied and pasted this info over at Gamehacking.org and credited you?

A lot of people would love to be able to make ASM codes for these two systems but don't have a USB gecko.

So again thank you @DarkByte for the awesome Cheat Engine amd thank you @mgr.inz.Player for the info on how to get the ASM.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Apr 19, 2014 1:40 pm    Post subject: Reply with quote

Above method isn't perfect. Sometimes "Dolphin GC - PC register" is much older. (still, not far from exact instruction)

Example (this time, writing data - you used "break on write" in CE):
You've got "Dolphin GC - PC register" value: 800637EC




To get exact instruction do this:

1) remove breakpoints from CE
2) with dolphin set breakpoint to 800637EC
3) do something in game, so it will trigger breakpoint.
4) in CE, set "break on access" (or "break on write") on "rings" address
5) do clicks on "step" button in Dolphin, keep looking at memory viewer from CE.
6) if it main window caption change to "debugging", you got right instruction.




That way, I found this address of instruction (which updates "rings"): 8006381C
(as you see "Dolphin GC - PC register" was close enough, 12 clicks on "step" button)


Code:
8006380c rlwinm   r24, r3, 0, 31, 31 (00000001)
80063810 li   r28, 0
80063814 lha   r29, 0x0068 (r31)
80063818 add   r0, r29, r4
8006381c sth   r0, 0x0068 (r31)    <--- store updated "rings" value
80063820 lha   r0, 0x0068 (r31)
80063824 addi   r31, r31, 104





also, instruction set for PowerPC CPU:
http://pds.twi.tudelft.nl/vakken/in101/labcourse/instruction-set/


47iscool wrote:
@mgr.inz.Player Thank you so much!!! Now I can make GC and Wii ASM codes! Very very happy now thanks a million! Would you mind if I copied and pasted this info over at Gamehacking.org and credited you?

OK

_________________


Last edited by mgr.inz.Player on Sat Apr 19, 2014 7:29 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
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