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

Author Topic: Best ways to locate map data?  (Read 3346 times)

SpiralDrift

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Best ways to locate map data?
« on: August 10, 2011, 11:31:13 am »
Hi, everyone. First off I'm new to the site but not completely new to ROM hacking. I am still learning though and could use a few tips...

Is there a basic procedure to follow when looking for map data? Just to clarify, I mean where in the ROM the layout of a level or dungeon is stored. If I can just locate it I'm sure I could figure out how to edit it from there. I understand that data is sometimes stored differently on different systems, and sometimes it can be compressed, so I should say the game I'm interested in at the moment is Shadowrun (Genesis), though I'm looking more for general tips that could apply to other games as well.

So far it seems like the first step should be to corrupt part of the ROM, then load up the game and note the differences. This seems like it could take forever, though. What other methods are there?

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Best ways to locate map data?
« Reply #1 on: August 10, 2011, 04:16:46 pm »
There is the classical "try to look at bytes in a grid with different line widths" way. That usually identifies all sorts of tables and maps.

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 593
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Best ways to locate map data?
« Reply #2 on: August 10, 2011, 05:43:44 pm »
I've never been a fan of corrupting. Seems like there are so many more direct approaches. Making educated guesses on what the the data might look like and searching for it and using a debugger to reverse-engineer the game's code are two methods that have served me well.

I started typing out a long explanation of how I approach this task, and then realized I already typed this out the other day. In the Hacking the original Metal Gear topic I explain how I dissected the level data format.

Of course, there are various general formats. Learning all the ins and outs comes with experience. Metal Gear uses 32x32 blocks made up of tiles. Blaster Master uses 64x64 blocks made up of 32x32 blocks made up of 16x16 blocks made up of tiles (much more difficult to work with). Many games use "object-based" formats, where the game defines many arbitrarily sized objects from tiles, and these objects are re-used through-out the game (SMB 3 is a good example: pipes, those large "panels", and rows of bricks/coins are all examples of objects).

My experience is mostly with NES. I would expect you to run into more compression and more complex formats on a 16-bit platform, but the principles should be the same.

SpiralDrift

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Best ways to locate map data?
« Reply #3 on: August 10, 2011, 07:16:34 pm »
Thanks for the tips so far. Relative search seems like a good idea. I didn't even know it could be used for something other than text. :)

So this would be the correct procedure, right?:

1. Find a spot in-game and take note of which tiles are laid out in sequence.
2. Enter a tile editor, find those tiles and draw over them with a letter/number.
3. Run the game again and take note of the order of letters/numbers where the old graphics were.
4. Do a relative search for the string you got in the last step.

The graphics in Shadowrun seem pretty scrambled as far as finding/editing specific tiles goes, but it doesn't appear to be compressed. I guess finding specific tiles could be the hardest part now.

EDIT: Sorry, I think I misunderstood  a bit. I'll try it this way anyway though just as a learning exercise. ;D
« Last Edit: August 10, 2011, 07:29:05 pm by SpiralDrift »

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 593
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Best ways to locate map data?
« Reply #4 on: August 11, 2011, 05:50:20 pm »
Hmm... I wasn't trying to demonstrate a procedure, but more of a thought process. Sorry if I wasn't clear. The procedure I used to reverse engineer Metal Gear was based on guesses, assumptions, and conclusions made while examining and tinkering with the game. The approach I used might or might not be useful for Shadow Run. I don't know.

SpiralDrift

  • Jr. Member
  • **
  • Posts: 8
    • View Profile
Re: Best ways to locate map data?
« Reply #5 on: August 16, 2011, 03:48:02 pm »
I've gotten a little sidetracked learning VB to made an editor (just stats, items, etc for now), but this was a main goal to begin with so it'll be worth the extra time. I already have lots of the offsets mapped out and I hope to make the editor as fully featured as I can manage with my limited skills. Most importantly I'm having loads of fun and learning tons of new things. But once I get it to a good point with the offsets I've already mapped out I'll resume looking for more data.

I'll post back here again when I get to that point, or if I manage to find the layout data myself. Thanks to everyone here and all the tutorials I've found I still have a lot left to try.