Need help making sense of this data table in Soul Blazer

Started by Ballz, January 27, 2018, 08:35:53 PM

Previous topic - Next topic


Hey all, I've been working on a little something for the SNES game Soul Blazer. It's my first attempt at a rom hack in about 15+ years so I'm a tad rusty on some things.

The data crystal entry for the game has been immensely helpful, but there is one section I am trying to make sense of: the game's lair data.

Basically if you're not familiar with the game, most enemies come out of these portals and once you kill them all, you can step on the portal and revive a NPC. The table I linked to above supposedly indicates what enemies come out of the portal, how many come out, and what NPC gets revived from it. But I've spent a few hours playing around with it and have had trouble making heads or tails of it. 

Basically I want to change one entry for one NPC to point to a different NPC. The table states the following:

Quote09: Name of the NPC to revive. (0x154E6 + 2n = Pointer to text.)

I'm assuming "09" is the column 09 on the table, but it doesn't make it clear how the data in that column chooses which pointer at 0x154E6 to go to.

Hopefully that makes sense.  If you want to take a look at all this in the rom yourself, just a heads up that the offsets in the above link are for a rom that has a header added to it.
Ballzysoft Industries: Making rom hacks about once every 20 years. This decade's release: EarthBound MSU-1 Hip Hop Journey


Quote09: Name of the NPC to revive. (0x154E6 + 2n = Pointer to text.)
09 mean - in each entry at location +9 is where the Name of NPC is (I guess its not actual name rather, a pointer (it seems to me as index) in the actual text data)
Also the way the structure is decribed, it seems that index is 4 bytes.

Since you have the data in a table - the number of columns is an entry length. Each row show one entry. So the names are formed from columns 09, 0A, 0B, 0C
Welcome to the FF5 Den:


Thanks, I'm starting to put the pieces together here. The hex value at 09 appears to be the order the NPC appears on the pointer table.  So for example if the value is "01" then its the second pointer in the table (in this case, the NPC "an old woman").  But if it's like you said and we need to look at the four bytes from 09 to OC, then I need to make sense of the following three values.

One example is an NPC for a tulip.  There are multiple tulips to revive, but the four bytes are not identical for each of them.  The first tulip you revive is "0B 00 05 1F" while the second is "0B 00 06 08." 

The "0B" matches, showing it's the 12th entry on the pointer table. The second value at 0A is also identical; the values in this column seems to slowly increase the further you go down the table (generally from 00 up to 06). This might correspond with where the pointer is located beginning at 0x154E6, although the values don't seem to entirely match up.

Then that leaves the values at 0B and 0C, which are completely different between these two tulips. Any idea what these two do?
Ballzysoft Industries: Making rom hacks about once every 20 years. This decade's release: EarthBound MSU-1 Hip Hop Journey


Based on the description, you should assume 4 byte value ... but examining data it seems like 2 byte to me, so that are columns 0A and 0B. Then for tulip will be 0b 00, which is 000B = 11. So NPC name will be 0x154E6 + 2*11
Welcome to the FF5 Den:


Eek, that was a really old version of "soul_lairs.txt".

I've updated the links on the Soul Blazer page on Data Crystal with newer files. (Most are unchanged except for removing the copier header from addresses, but the lair file has a lot more stuff now.)

Byte 09 is an index into a pointer table at 0x152E6.

  • Let's consider... lair 008.
  • Byte 09 is 0x05 in that row.
  • 0x152E6 + (2 * 0x05) = 0x152E6 + 0x0A = 0x152F0.
  • The bytes at 0x152F0 are [76 D3] = $D376 in the same bank = 0x15376.
  • The text at 0x15376 is "The bridge guard" (using Soul Blazer's text encoding).
I think that only affects the resurrection message, though.

Changing how NPCs get resurrected involves changing their behaviour. Here's some of my notes on NPCs/enemies:
The behaviour pointer is to SNES assembly code (OK), but with the COP instruction repurposed to create a custom control code language (uhoh). Most of the NPC code starts with [02 14 XX XX YY YY], which branches to YYYY if lair XXXX is sealed.

Looking back over those files, some mention map numbers, so here's some more stuff:
I should probably stop here, before this post gets big enough to start rampaging Godzilla-style. If you have any questions, please let me know.