Post subject: Looking for some advice on using LUA to get data from LttP
Joined: 4/10/2015
Posts: 3
Hey guys, some helpful fellow over at romhacking.net pointed me over here in the hopes you might be able to help me. I'm a software developer whos agreed to write a small program for someone, the basic idea is that when the player hits a trigger in the game, or acquires an item, etc, my program will pick up on that information and then trigger a real-world sound, stage light, video, whatever. I've got everything else covered, but the crucial part I haven't got a clue how to start on, and I was hoping that using an emulator with LUA script might be a good lead. Here's an example of the sort of thing I'm looking to do: Player picks up a specific item or enters a specific room -> the emulator/lua script detects this and informs my program -> my program then does whatever it's supposed to do in that event, playing a sound effect for example. Does anybody know where I might be able to find further information about getting that data out of Link to the Past while it's being played? I'm thinking that accessing the games memory won't be too much of a hassle, especially if I just directly modify the emulators source code. I just have no idea where to start looking in memory for the information I need, things like equipped items, players x/y coordinates, current map, etc. Thanks in advance for any help or advice, and I apologize profusely if this is in the wrong subforum.
GoddessMaria
She/Her
Reviewer, Experienced player (867)
Joined: 5/29/2009
Posts: 518
Location: Hell...
As far as Link to the Past is concerned, you could try to ask Tompa, our LttP expert.
Current projects: failing at life
Joined: 4/10/2015
Posts: 3
Awesome, thanks for the lead. I'll see if I can drop him a PM.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
It sounds like you're ultimately looking for a ram map (a list of ram addresses with corresponding descriptions), which Data Crystal doesn't have one yet for Link to the Past so that may be a fun project for me to work on once I finish up with Metroid II. As far as doing it yourself? Record an input file that does the things you want to watch for first, then play back while either manually watching the entirety of the ram in hex editor (much slower but it can pick up on storage patterns and abstruse unknowns when you get to that address, with a key drawback of slowing down play speed) or searching for changed values (which this works a lot better for stuff like health or XY position since they're either known values or relatively straightforward unknowns). Reason for recommending the input file is because both methods tend to slow the game down a fair bit and you don't really want to be sending commands while doing most of this anyway.
Adventures in Lua When did I get a vest?
Joined: 4/10/2015
Posts: 3
Ahh cool, thanks so much for the explanation. Now I know what it is I'm looking for (never heard of a RAM map before but the concept makes sense) I managed to find one somebody else was working on: https://dl.dropboxusercontent.com/u/29210231/RAM_Map.txt I'm not sure how complete or accurate it is, but it looks like it'll be worth me reading through because hopefully I can get the information I need from this, all I really need is a few things like players coordinates and current map name/number, simple stuff. I'll have a read through of this and report back.