Post subject: Tutorial: Display RAM Watches on the screen
Masterjun
He/Him
Site Developer, Expert player (2047)
Joined: 10/12/2010
Posts: 1185
Location: Germany
This tutorial hopefully shows you how to do this: This tutorial works on both 32 and 64 bit of Dolphin! First you need to modify my Lua script starting at line 67 so that it is correctly adjusted for your Dolphin. In the Lua script are the necessary steps explained to get correct addresses. After editing the 5 variables (DolphinIs64bit, GameRAMStartAddress, TexturesCreatedAddr, ArrayOfBytesAddress, FrameCounterAddress) you can add RAM Addresses after line 144 by entering
local VariableName = readBytes(AddressOffset+o,NumOfBytes,GiveAsTable)
VariableName: name you want to give that RAM Address, for example xpos. AddressOffset: offset of the RAM Address, for example 0x8C6504 (xposition in PMTTYD). NumOfBytes: number of bytes you want to read, for example 4. GiveAsTable: return a single table instead of multiple bytes, true or false. Examples:
Language: lua

local xpos = readBytes(0x8C6504+o,4,true) local byte1,byte2 = readBytes(0x123456+o,2,false)
To convert the table to a hex string you can use my function tabletostr(x). So for example you write now:
Language: lua

xpos = tabletostr(xpos)
For more functions like readBytes in Cheat Engine see here or here Now, you have to add it to the table t like this:
Language: lua

t = appendstr(t,"xpos: "..xpos) -- or you can do it like this t = appendstr(t,"xpos: "..xpos.." ohman even more to come "..ypos.." you get it")
When you have correctly modified the script you can run it in Cheat Engine by clicking on Table > Show Cheat Table Lua Script. There you have to paste the lua script and press on the Execute script Button.[/i] If you have any questions, please ask =D
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
RachelB
She/Her
Player (132)
Joined: 12/3/2011
Posts: 1579
-- Has to be adjusted: Once every game start local TexturesCreatedAddr = 0x1DAEF6DC
Just search for the address and you'll find a pointer that will always work. edit: but only for d3d9...
Experienced player (658)
Joined: 5/16/2009
Posts: 235
I'm having problems with displaying 2-byte big endian addresses. I display them, but sometimes it keeps telling me "Access violation" from time to time. I'm not sure the exact reason, it seems like the tabletostr doesn't work propertly for 2-byte, but I actually have no idea. Could anyone help me with this?
Masterjun
He/Him
Site Developer, Expert player (2047)
Joined: 10/12/2010
Posts: 1185
Location: Germany
you have to make sure that every single variable is "local", since these variables are faster and work better
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Experienced player (658)
Joined: 5/16/2009
Posts: 235
Masterjun wrote:
you have to make sure that every single variable is "local", since these variables are faster and work better
I'm pretty sure all of them are local. I'll try to paste the code later when I get home. The thing is that sometimes it works, but sometimes it gives me the violation access message and I can't watch the addresses, so I don't really know what is happening
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
I get an "Access Violation" dialog in Cheat Engine sometimes, even when just working with Cheat Engine's address list. Maybe it's the same thing you're experiencing? I'm not at all certain about when it happens, but it seems to happen often after I change my dual-monitor display settings (or disconnect/connect my external monitor from my laptop). It fixes itself if I just close and re-open Cheat Engine.
Experienced player (658)
Joined: 5/16/2009
Posts: 235
yoshifan wrote:
I get an "Access Violation" dialog in Cheat Engine sometimes, even when just working with Cheat Engine's address list. Maybe it's the same thing you're experiencing? I'm not at all certain about when it happens, but it seems to happen often after I change my dual-monitor display settings (or disconnect/connect my external monitor from my laptop). It fixes itself if I just close and re-open Cheat Engine.
It may be something similar: This is the modified lua: http://pastebin.com/bkivpgt8 As I said sometimes it just work properly: Link to video But then suddenly, this starts happening (sometimes it just happens from the beginning): And once it starts happening, it never stops. I have no clue why is this.
itsPersonnal
He/Him
Player (234)
Joined: 1/20/2012
Posts: 542
could someone walk me through this? Or rather, do it for me? I'm completely lost and have no idea what any of this means, but I'm sick of using debug mode to view addresses. I'm planning on starting an SMS Any% TAS as soon as I get this working, so maybe that can be some incentive for someone to help me out.
Completed: 2010-Current | Sonic Adventure 2: Battle - Individual Level TASes 2014 | Spongebob: Battle For Bikini Bottom - Any% in 1:05:03.23 2014 | Sonic Adventure 2: Battle - Hero Story (w/ THC98) in 25:11.87 2016 | Metroid Prime - Any% in 00:37 (In-Game Time) 2018 | Spongebob: Battle For Bikini Bottom - Cheat% in 1:42.350 2020 | Spongebob: Battle For Bikini Bottom - Any% in 0:39:20.10 2022 | Spongebob: Battle For Bikini Bottom - Cheat% in 1:25.567 Currently working on: SA2:B DARK STORY
Experienced player (589)
Joined: 2/5/2011
Posts: 1417
Location: France
I helped you, did I ?
Current: Rayman 3 maybe? idk xD Paused: N64 Rayman 2 (with Funnyhair) GBA SMA 4 : E Reader (With TehSeven) TASVideos is like a quicksand, you get in, but you cannot quit the sand
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
I was trying to help someone use a variant of this Lua script, but upon trying to run the script, he got: "Error:Failure determining what Dolphin.exe means" Any idea what could cause this? It seems that he already had Dolphin.exe open in Cheat Engine, although it's also possible that there was some confusion (since the Lua engine's error console doesn't clear itself when you re-run the script...). EDIT: He got the script to work now, so it might've been that. Oh, but while I'm here again, I'd also like to say that this script has been immensely helpful. I've been using it a lot for testing things in F-Zero GX and Super Mario Galaxy 2.
Joined: 1/13/2014
Posts: 56
I went through the process for this and got all the values, but when I execute the script, I get: "Error:[string "-- Script made by Masterjun to display stuf..."]:145: attempt to perform arithmetic on local 'o' (a nil value)" Any idea on how to fix this?
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4038
drizor wrote:
Edit: I've found out, it's because of "graphics > show statistics" check box. Well, how to hide then all these informations ? If I uncheck it, will I still have the informations I'd like to have on screen ?
The Show Statistics checkbox is required to show any blue text on the screen. This tutorial replaces those statistics with RAM Watch addresses to be useful for TASers. I don't know what went wrong, but you'll definitely want to keep that box checked. EDIT: Apparently you deleted your post before I posted, but if you're still here, hopefully this helps you.
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
Just wanted to point out that the script doesn't seem to work in OpenGL (with Dolphin 4.0-1997). The closest thing I've found to the "Textures created" string is an address that has all the stats text starting from "xtures created"... but at least from what I tried, I couldn't find a static address or static pointer for this. I'll have to stick to older versions (which support D3D9) if I want to use this script, since D3D11 is just too laggy for me with Mario Galaxy.
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
There's actually a bigger issue with the script in recent Dolphin versions - the scan to get the ArrayOfBytesAddress doesn't seem to work. (Works in 4.0.2, doesn't work in 4.0-1997-x64, doesn't work in 4.0-2826-x64.) Here's the array of bytes that Masterjun's script says to scan for:
-- 48 63 D8 48 03 DF 48 83 7D C0 10
-- if you have 64 bit Dolphin
--
-- 83 C4 0C 83 7C 24 1C 10 8D 3C 06
-- if you have 32 bit Dolphin
In 4.0.2 and below, the bytes correspond to three particular compiled instructions in Dolphin, starting with the highlighted "movsxd" here: But again, scanning for these bytes in more recent Dolphin versions turns up nothing. My guess is this part of the Dolphin code has changed since then, and now there may be a different array of bytes we can scan for to make the script work again. But what would that new array of bytes be? What instructions am I looking for here?
Active player (274)
Joined: 2/1/2014
Posts: 928
I dont believe this has worked since 3.5. It may work soon, rachelbs newest commit adds on screen framecounter, so that may be an easier way to get the bytesofarray or whatever its called
Experienced player (589)
Joined: 2/5/2011
Posts: 1417
Location: France
It was working until the removal of Direct3D9 I think?
Current: Rayman 3 maybe? idk xD Paused: N64 Rayman 2 (with Funnyhair) GBA SMA 4 : E Reader (With TehSeven) TASVideos is like a quicksand, you get in, but you cannot quit the sand
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
I got a little closer to making the script work on Dolphin 4.0-2826 + OpenGL: I guess you were getting at this, solarplex, but I realized the Lua script's breakpoint just needed to be on an instruction that ran once every frame. There's already a decent amount of addresses in Dolphin.exe incremented once every frame (without updating to the commit you mentioned), so I used one of those addresses. Then I used Cheat Engine to see what instruction wrote to that address. Then I used that instruction for the breakpoint. But... The display still isn't showing my text. There's a couple of possibilities: (1) I just made a silly mistake in the script somewhere (quite possible), or (2) The instruction I'm breakpointing on is run before the Dolphin code that normally updates the statistics, so my text keeps getting overwritten before it can be displayed. I tried a few different instructions, but I still can't say for sure whether (2) is being a problem. I don't know how to guarantee that my breakpoint is hit after the normal statistics are written. (At least, that problem makes sense in my head; maybe I'm just off the mark in general.) Edit: I've just realized that Cheat Engine has more than enough GUI capabilities to make overwriting Dolphin's text unnecessary. So that's probably the route I'll take from here. Now (2) above is not a concern, and TexturesCreatedAddress is out of the picture. Just need to make sure this thing updates exactly once per frame, now.
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
(Ignore the bottom right part, that's just my desktop) Works up to 4.0-2826 now. The Lua script is in this pastebin. I've set it up so that it's possible to change just one variable, DolphinVersion, in order to get the script working (as long as you have one of the exact Dolphin versions listed there). Otherwise, you will have to look for a few addresses like in Masterjun's original script. For convenience, I plan to add a version that has Wiimote + Nunchuk TAS Input, once RachelB has merged the Nunchuk input code. Like Masterjun's script, all the addresses under the "function debugger_onBreakpoint()" part are for one game specifically (in this case, Super Mario Galaxy 2). The stuff above that it is applicable to any game. All in all, I made the script quite a bit longer, but that's largely because of the SMG2 stuff and my comments...
JoselleAstrid
She/Her
Joined: 9/9/2013
Posts: 35
I've added some more structure to the Lua script. Now the utility functions and Dolphin config are in separate files from the game-specific addresses and stuff. This should make things easier if you often switch between multiple games. Go here for the instructions and Lua code, including example scripts for F-Zero GX, Galaxy 1, Galaxy 2, and Metroid Prime: https://github.com/yoshifan/ram-watch-cheat-engine