News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: Objects in RAM  (Read 271 times)

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
Objects in RAM
« on: September 22, 2017, 08:13:05 pm »
Can anyone please explain to me HOW objects are loaded into RAM (or point me to the right document)? My game is DKC. I know where the objects are in ROM, but I would like to be able to change them at runtime.

FAST6191

  • Hero Member
  • *****
  • Posts: 2142
    • View Profile
Re: Objects in RAM
« Reply #1 on: September 23, 2017, 05:13:00 am »
I assume DKC is Donkey Kong Country. You probably want to spell such things out though as not everybody will use such abbreviations and there may be more than one (is GOW god of war or gears of war?).

Second question if so is what system? Donkey Kong Country appeared in non emulated form on the SNES, GBC and GBA and all three (though maybe less for the GBC) have been the target for hackers making some fairly extensive changes over the years.

http://adshomebrewersdiary.blogspot.co.uk/2012/02/unequivocal-answer.html for the DS covers some of the methods seen on later systems. Generally though you will want to look for DMA (direct memory access, used so you don't tie up the CPU fetching data and in most systems save for the oldest and simplest) and for any CPU instructions which can fetch data (usually easier than DMA but you tie up the CPU when you are doing it).

Going further if you know where something is in the ROM you can find a debugging emulator for that system and set a break on read (bpr) for that location. When said location is read the emulator will halt (or log if you set that) and tell you want instruction/method is reading it and the instructions leading to that. A simpler, but less effective, thing can be done by searching for the data you know in the ROM in the RAM. As processing data is expensive most things tend to be fairly similar in the ROM to how they end up in the RAM, though things like compression can get in the way of that.

Unless you did not mean the means by which they are loaded and instead where the stuff is found in RAM. This can be tricky and things tends to be swapped in and out which makes conventional cheats more of a pain. Though if you are going with a lua supporting emulator or a RAM fiddling program which has some logic it can use then so it goes.

http://datacrystal.romhacking.net/wiki/Donkey_Kong_Country:RAM_map does not appear to have much, https://web.archive.org/web/20090914001029/http://giangurgolo.home.att.net:80/dkc/bytes_levels.txt for the broken link at the end of that.

Also by objects do you mean pickups and such? Looking at http://www.dkc-atlas.com/forum/viewtopic.php?f=38&t=522 it does appear to be the term used within Donkey Kong Country hacking circles. I don't know what they will do in RAM though as there are various means of making levels within games and those can change with scrolling games too (often things get streamed just for that screen and the immediate surroundings).

rainbwsprinklez

  • Jr. Member
  • **
  • Posts: 20
    • View Profile
Re: Objects in RAM
« Reply #2 on: September 23, 2017, 05:26:34 pm »
Thank you for replying in depth! I am already a hacker of sorts. I haven't publically released any yet however. Donkey Kong Country for the SNES, yes. And I DO mean loading in RAM.

Objects are a bit of a tricky thing... I could say sprites, but not only sprites are included in that list. Level exits are part of the list, and you can't render that! That list includes:
-Enemies
-Barrels
-Bonuses
-Invisible walls
-Scripts/sets of objects

Currently I'm working on an extremely basic hack that morphs and moves objects. The whole set of objects is loaded at once on level load, so it is quite easy to edit the rom.

My end goal is to make the exit appear after all the kong letters are collected. There is a RAM value for that. https://docs.google.com/spreadsheets/d/1cpgw9Y73WL7vmUOfnK21utcTQ7sUeOZu4874buAmPf0/edit#gid=0 The kong letters I mean.

BTW, I am using no tools, just a simple hex editor AND geiger's snes9x debugger.
« Last Edit: September 23, 2017, 09:17:49 pm by rainbwsprinklez »