View Single Post
Old 17 August 2017, 12:59   #1
bloodline
Registered User
 
bloodline's Avatar
 
Join Date: Jan 2017
Location: London, UK
Posts: 433
Reverse engineering from an executable

Hi all,
I have a few days of free time coming up so I have decided to "reverse engineer" the old Megalomania executable to see where the sector data is stored, which would allow a more detailed trainer mode.
Over at the Ultimateamiga forum, Hungry Horace found the offsets for the island data.

The island type array can be found at offset 0x14080, it is an array of 28 bytes each one representing the land colour of the 28 islands:
0 = Light brown
1 = White
2 = Light Green
3 = Yellow
4 = Grey
5 = Dark Brown
6 = Dark Green

Change the values found here natural alters the island colour.

The next array is the island shape array and that can be found at 0x1409C.
This is a 448 byte array, with each island being represented by 16 bytes in a 4 by 4 grid like so:
0x0 0x1 0x2 0x3
0x4 0x5 0x6 0x7
0x8 0x9 0xA 0xB
0xC 0xD 0xE 0xF
With each byte representing the sector type (colour and coastline).

So far so good!

Now I need to try and find where the sector data is found. There appear to be two pieces of information store about each sector. The available elements (and their quantities) and the elements required for each weapon . Both of these things these appear to be fixed at the start of the game as they are the same each time you play the same sector, but are different per sector.

The location of the elements data is the first thing I want to find, this seems simple as no sector can have more than 4 elements, and we know


So my quest is to find where the elements for the first sector can be found.
My first assumption is that the element types will be an array of 4 bytes each indexing the element type (assuming 0 means no element) so the top sector of Aloha with Rocks (0x2), Slate (0x4), Solarium (0x8) and Herbrite (0xA) would probably look like 0x0204080A in the executable.
Searching through the executable does not find that sequence... Perhaps I made one too many assumptions?

So next I decided to search for the element quantities. The top sector starts with 100 Rock, 100 Slate, 50 Solarium and 75 Herbirite. Looking for the byte sequence 0x6464324B found nothing, so I thought about how elements are mined in 0.5 quantities. And since saving memory is a consideration, my guess the actual values used by the game engine are double what we see in the GUI, which probably divides by two for display… So I searched for 0xC8C86596, again this found nothing…

Is anyone here able to offer any advice?
bloodline is offline  
 
Page generated in 0.10008 seconds with 11 queries