Post subject: Question about Addresses
Joined: 11/26/2017
Posts: 13
Hello. First of all, I apologize if this is not the right place to put this topic. I also apologize if this question has been already made and I wasn't able to find it (I've been searching in both the 'main page' and here in the forums). Well, I guess I'll try to be short (I usually write a lot though). It's the first time I register here and write here, but I've been using Tool-Assisted emulators since a while now (probably around 3-4 years). I'm not a TASer though, and actually am, at specific circumstances (that: specific circumstances, otherwise I like TAS) against it. However, that's not the purpose of this post, so I'll get to the point. I'm currently working on a challenge run (not TAS run) on Haunted Castle (a Castlevania game released for the Arcade). Thing is, I've been trying to use some TAS tools to better understand the programming of this game. It's been like 6 months now, and a lot of time inverted on it. I've been able to decipher most of the game's programming without using any advanced TAS tools (only Savestates and a bit of Frame Advance), but at this point, I feel like I'll really need them to verify my theories. Again though, I'll try not to extend myself too much (I guess you prefer long posts, but just in case). So in the last days, I've been doing a lot of research on RAM Search, Lua Scripting, and programming in general. I was able to do some things like freeze my HP and lives at specific values, but now I'm trying to find an Address that allows me to skip levels and... can't find a way. I'm trying to first figure it out on NES games. So I took Battletoads (and Super Mario Bros 1, which seems to be taken a lot for TAS testings). But when I try to change an Address that I think is the level one, many things may happen. With some values, the screen goes completely black, and with others, the level layout remains the same but not the objects there (so sometimes the character gets at the upper section of the screen on an 'invisible floor'). I then tried Game Genie to see which is the Address that is changing the level. But the Address shown doesn't seem to be either (as it doesn't give the result I expect, that is, something 'weird' happens). My question is not really about these specific games. It's more about how level select Addresses work. After the tests with the Game Genie, I got quite confused, and even more after reading a few things about how the encoding (I think that's the word) works. I also got confused about RAM and ROM Addresses (I think after 0x8000). I would really appreciate if someone can clarify me a bit how all of these things work. The good thing is that I have experimented a bit on them, and done research as well, so I have an idea. Well, thanks for reading. And sorry again if this wasn't the right place to put it, and/or if this question was already made.
Pokota
He/Him
Joined: 2/5/2014
Posts: 779
I would expect that any change level routine refers to the 'current level' address for pointers rather than the game instantly changing the level to suit the address. It's what I'd do, at any rate. Are you freezing the address and then attempting to transition levels normally?
Adventures in Lua When did I get a vest?
Skilled player (1672)
Joined: 7/1/2013
Posts: 448
Level select cheats can be tricky. Even if you know the memory address, it is not always obvious which value to use, or when and how to manipulate the value. I don't know that I can help you to search, but here is an example for you to experiment with Haunted Castle Stage memory address 00000806
Joined: 11/26/2017
Posts: 13
Pokota wrote:
I would expect that any change level routine refers to the 'current level' address for pointers rather than the game instantly changing the level to suit the address. It's what I'd do, at any rate. Are you freezing the address and then attempting to transition levels normally?
Do you mean that, in order to see the change, I'd need to restart the game and then see if it works? If that's what you meant, I actually tried it as well, but 'weird' things happened. Visual glitches occurred for the intro, and then, when the Battletoads screen appeared (I am first trying with Battletoads, to have a clue about how it may work on other games), it just froze. All of this with the Level Address posted on TASVideos (Battletoads Address Set). I tried my own experiments too though, but didn't work either. I haven't tried the Level Config Pointer however. Maybe that's the key. Being honest, I don't know much about what pointers refer to. Although, I just made a bit of research, and maybe it really is the key. As for freezing, sadly I can't do that the 'normal' way on Haunted Castle (I don't know why both the 'Add Cheat' and the 'Cheats' section are 'blocked', that is, they can't be selected). So there I have no choice but to use Lua Script. But on Battletoads, the game either freezes or becomes very glitchy. That makes sense actually, since if it really is the Level Address, then it must glitch when getting to another level. I'll try the Level Config Pointer though. Woah, really weird. I froze it at 81 (Hex, value at Level 1), then took the Warp to Level 3, and this time it actually loaded (unlike with the other Level Address), but it played automatically. That is, the screen was moving all the way to the end. Very curiously, when it reached the final bit of the Turbo Tunnel, the music sped up, as it would normally. Watching the Level Config Pointer, it does change during a level, at least on 3. But the Address that according to the Addresses Sets is the Level one (0010) really seems to be it. It is constant on a level, never changes during them, but it does when switching screens though (like during cutscenes). The problem is how to change it. If I try to, the game just freezes. I also tried without looping, but it was still the same.
£e Nécroyeur wrote:
Level select cheats can be tricky. Even if you know the memory address, it is not always obvious which value to use, or when and how to manipulate the value. I don't know that I can help you to search, but here is an example for you to experiment with: Haunted Castle Stage memory address: 00000806
That's probably the problem. Maybe the 'how and when'. I wonder how the Game Genie does it. Thanks for the Address. I'll experiment with it. By the way, why do you guess that may be it? Is it a 'special' one for most games? I know some Addresses are common in some games (they have the same/similar function). Yes! I haven't tried Haunted Castle yet, but on Battletoads, it worked experimenting with 'when'. It turns out it works if you change the value just when the game tells you: "Level X". If you change it there, when the level loads, it actually loads the value you set. I'll keep this in mind for Haunted Castle, which in the end is my real objective. Woah!!! That Address worked!!! How did you find it? Thanks a lot! (Now let's see if I can find RNG values and some more data that may be useful... This game has a very particular programming I think. I am even starting to think there is no RNG at all.) What I don't understand is why on Battletoads the Game Genie shows me a ROM Address, and one that really isn't the Level one. Is there some explanation for that?[/quote]
Skilled player (1672)
Joined: 7/1/2013
Posts: 448
I'm glad that you looked into this a bit further.
ErisK wrote:
As for freezing, sadly I can't do that the 'normal' way on Haunted Castle (I don't know why both the 'Add Cheat' and the 'Cheats' section are 'blocked', that is, they can't be selected).
I surmise that you are using FBA-RR. "Add Cheat" does not function. "Enable cheats" is locked when an FBM file is created or loaded. It remains locked until the game is reloaded in the emulator with no FBM file active.
ErisK wrote:
Thanks for the Address. I'll experiment with it. By the way, why do you guess that may be it?
I didn't have to guess. It was drawn from Pugsy's legendary MAME cheat database. :)
ErisK wrote:
I am even starting to think there is no RNG at all.
Haunted Castle RNG memory address: 000018E1 While Pugsy's database is voluminous, it will not provide every memory address required for a TAS. For example, the RNG. Some searching will always be necessary. You might consider using MAME-RR rather than FBA-RR for Haunted Castle. The emulation is more accurate, the cheat engine is more sophisticated, and cheats can be enabled while recording. FBA-RR cheat database: http://haggar.emuunlim.com/cheating/files/fbcheat0294d.zip Pugsy's MAME cheat database: http://cheat.retrogames.com/download/cheat0187.zip
Joined: 11/26/2017
Posts: 13
First of all, sorry for taking so long in reading and replying. I checked my mail some days after the last post but then stopped doing it, then checked it today, and found this.
I'm glad that you looked into this a bit further.
I try to, yes :) . Sometimes I miss some important details and that makes it look like I didn't make any effort, but no, most of the times, I have worked really really hard, but didn't find/realize something because I simply missed it, but not because I almost didn't try. So thanks for noticing it. This particular case, I think I never worked so hard on a game (when speaking of studying; when speakiing of challenge runs themselves, it is a bit more complex to say). One month has passed, and I was finally able to figure it out. It was a counter, a frame counter, the one determining those 'weird' speed patterns that didn't seem to make any sense. I still haven't got the run because it's a challenge run so it's Single Segment, and it's pretty hard considering I add extra rules. But anyway, that's another subject I guess. And yes, I was using FBA-RR back then. Eventually I decided to use MAME-RR (yes, more things kept happening during this month), which gave me some weird results. But this game is pretty weird. Or perhaps it's because it is an Arcade, and Arcade have other programming. Really, I have almost no experience with Arcade games. But for example... sometimes, it looks like the game has a set pattern, even if I do different things. Some time passes, then the 'set pattern' changes. Like if it was based on dates, total attempts, total time played, or something like that. Loading savestates also produce some weird things, but most of the time is more a graphical thing. About MAME-RR, it seemed to have a different tendency towards RNG. I guess this is the 'weird' one, as MAME0.64, WolfMAME0.106 and FBA-RR they all gave essentially the same results, but not MAME-RR. Or who knows... maybe it's the other way around. I'd have to play the game on an actual Arcade. About the database, does that mean some TAS players actually played Haunted Castle, and actually took their time in finding such Addresses? I mean, it's not that much known, although I guess TAS players play more unknown games than known games. Well, I think. And do you know which players may have built the database for Haunted Castle? They may know a lot about the game and its programming. At this point I think I pretty much got it but I still like to have as many opinions as I can. There are still some weird phenomena I'm not sure about after all. Well, thanks a huge lot for all the information :) . Also, do you have an explanation for why the Game Genie doesn't seem to match with how Lua Script works? That's more or less what I meant with the last message.
Skilled player (1672)
Joined: 7/1/2013
Posts: 448
ErisK wrote:
About MAME-RR, it seemed to have a different tendency towards RNG. I guess this is the 'weird' one, as MAME0.64, WolfMAME0.106 and FBA-RR they all gave essentially the same results, but not MAME-RR.
I tested Haunted Castle on MAME-RR and FBA-RR to compare them. The only difference that I observed is that the transitions between stages are a few frames longer using FBA-RR. Whether using MAME-RR or FBA-RR, the length of the stages themselves is the same, and the gameplay is identical.
ErisK wrote:
And do you know which players may have built the database for Haunted Castle?
Pugsy's MAME cheat database credits 168 contributors (including some members of TASVideos.org), and Pugsy himself does a lot of work, so it is hard to say. However, at least one cheat for Haunted Castle was contributed by Abystus, who is a prolific and knowledgeable contributor to the database. He likely knows as much as anyone who contributed to Haunted Castle.
ErisK wrote:
Also, do you have an explanation for why the Game Genie doesn't seem to match with how Lua Script works?
I don't have any experience with using Game Genie in an emulator.
Joined: 11/26/2017
Posts: 13
"I tested Haunted Castle on MAME-RR and FBA-RR to compare them. The only difference that I observed is that the transitions between stages are a few frames longer using FBA-RR. Whether using MAME-RR or FBA-RR, the length of the stages themselves is the same, and the gameplay is identical." (Sorry for not using the quote function; I had a few problems with it. Not used to forums really.) Not exactly. Well, maybe after you mess a little with them. What I mean is, when I tried the Stage Address on both, MAME-RR had a very high tendency towards a certain pattern on Stage 3 beginning. To begin with, that shouldn't be random at all, but if you use the Stage Address, it is. With FBA-RR, it is random as well, but the tendency is different. "Pugsy's MAME cheat database credits 168 contributors (including some members of TASVideos.org), and Pugsy himself does a lot of work, so it is hard to say. However, at least one cheat for Haunted Castle was contributed by Abystus, who is a prolific and knowledgeable contributor to the database. He likely knows as much as anyone who contributed to Haunted Castle." So there was people actually playing the game and even more, studying it... Is there some way I can contact them? Maybe Abystus via PM? And about the Game Genie, theoretically it works changing the Addresses values, but there is a contradiction. If you try to change the same Address using Lua Script, you won't get the same result. That's what bugs me really, why does that happen? Do you have any theory? (Also, Game Genie changes ROM Addresses; does that matter? I think Lua Script can do that the same way, then again, maybe it's not the exact same.)
Joined: 10/18/2011
Posts: 64
I have no clue how the emulators implement it, but the actual Game Genie device is something that would run on the hardware itself. It would take up memory, and use up actual cycles on the processor to process the codes. An LUA script would happen 'outside' of the emulated hardware and not use any emulated memory. From the point of view of the emulated system, those changes would happen by magic instead of as a result of in-system commands.
Joined: 11/26/2017
Posts: 13
Wulf2k wrote:
I have no clue how the emulators implement it, but the actual Game Genie device is something that would run on the hardware itself. It would take up memory, and use up actual cycles on the processor to process the codes. An LUA script would happen 'outside' of the emulated hardware and not use any emulated memory. From the point of view of the emulated system, those changes would happen by magic instead of as a result of in-system commands.
Thanks a huge lot for the reply. I don't really know technical details, although I'm very interested in knowing such things. Maybe that explains why the Game Genie works on ROM addresses instead of RAM ones. As far as I know, the ROM contains some information about the hardware, although I don't know as much so I may be wrong. So, maybe... If the Game Genie does not only change the ROM address but also some hardware related to it... that would explain why Lua Script does not work when trying to do the same thing. I guess Lua Script can only change the value, while the Game Genie does much more. I tried using Lua Script on the same ROM addresses than the Game Genie does but the game simply glitches. I would highly appreciate if you can correct some things I may understand wrong, and/or if you can add more on it. Even though I know little about it, I'm very, very interested in knowing more. Also... Is it possible that you also have a YouTube channel, with the same username? Well, if you want I can send you a PM.
Skilled player (1672)
Joined: 7/1/2013
Posts: 448
ErisK wrote:
So there was people actually playing the game and even more, studying it... Is there some way I can contact them? Maybe Abystus via PM?
Abystus is a member of the Pugsy's Cheats forum. You may be able to contact him there, or at least post your questions publicly. Pugsy's Cheats forum: http://www.mamecheat.co.uk/forums Haunted Castle thread: http://www.mamecheat.co.uk/forums/viewtopic.php?f=4&t=5719
Joined: 11/26/2017
Posts: 13
£e Nécroyeur wrote:
ErisK wrote:
So there was people actually playing the game and even more, studying it... Is there some way I can contact them? Maybe Abystus via PM?
Abystus is a member of the Pugsy's Cheats forum. You may be able to contact him there, or at least post your questions publicly. Pugsy's Cheats forum: http://www.mamecheat.co.uk/forums Haunted Castle thread: http://www.mamecheat.co.uk/forums/viewtopic.php?f=4&t=5719
Well, thanks a lot for all the information and the help!