Sign in to follow this  
smozoma

HOW TO: expand player names

Recommended Posts

some notes on expanding player names for Statto's editor..

First, here is a document on pointers in SNES. They are waaay more confusing than in the Genesis. http://www.romhacking.net/docs/%5B50%5Dxcalpointers.txt.

Here is an example:

  • I thought that there must be a pointer to the start of the All Stars East team. I figured/guessed that the start was at offset 0E2857
    in the ROM, where there is a "U" character (value 55), since this character appeared right after all the rink names, except for the last team.
  • So, my starting pointer is E2857.
  • In SNES pointers, you only need the last 4 numbers in an address (don't ask why.. long story..), so you have 2857.
  • Next, subtract the ROM header size, which is 0200. This gives you 2657.
  • Next, you need the pointer's first digit to be between 8-F. So, if it's 0-7, add 8 to it. This gives you A657.
  • Next, the SNES CPU is "little endian", so you reverse the bytes in the number, giving you 57A6.

It turns out that this value, 57A6, appears in the ROM twice, and the 2nd time is the 'team pointer.' The pointers to the other teams are also in this area. Team Pointers are each followed by the value "9C00" (I don't know why.. (EDIT: this is the "bank" number.. it's part of the pointer, though sometimes it is found separate from the other part))

The team pointer table is from E27E7-E2857 (ie, it ends right were the ASE team data starts)

post-253-1269550795_thumb.pngpost-253-1269550359_thumb.png

As an excel sheet:snes94.zip

To be continued.. I need to figure out how it can find the rink name after a player's name length has been changed...

Edited by smozoma

Share this post


Link to post
Share on other sites

can you tell me where SNES stores the number of goalies? (i found it for forwards and D)

Team Data format:

starting at byte 0, using Anaheim as an example.

  0: 55 (same for all teams?)
 1: 00 (same for all teams?)
... 
 4: DD
 5: 01
...
14: 07 (0 offense, 7 defense strength)
15: 02 (0 home, 2 away strength)
16: 13 (1 PP, 3 PK strength)
17: 97 (9 forwards, 7 D)
18: 33 (team rating, 51 in decimal)

...

If you combine bytes 4-5 in reverse, you get 01DD (477 in decimal). This is the offset from the start of the team data to the City Name string ("..Anaheim" where ".." has the value "0900", which is 9, the length of the Anaheim string +2)

If you change the length of a player name, you need to change the values in bytes 4-5 to match the change.

Edited by smozoma

Share this post


Link to post
Share on other sites
can you tell me where SNES stores the number of goalies? (i found it for forwards and D)

There are two bytes somewhere... for instance 00 00... but if they are 11 00 then there are two goalies... 11 10 then there are three... 11 11 then there are four... but the thing is, they can be any number between 1 and F, and I don't know what that is for.

Also, the editor has hard-coded pointers programmed in, so messing with where the data is stored will negatively impact your ability to use the editor...

The number of characters in the name of the arena precedes it by two bytes... so the "11" before "Pond in Anaheim" refers to the 17(decimal) bytes after and including that one...

Share this post


Link to post
Share on other sites

thanks

i updated teh post above with some findings. there is an offset that needs to be updated if you change player name lengths, in the 4-5 bytes.

Edited by smozoma

Share this post


Link to post
Share on other sites

The bytes from E6F5B to E7159... any idea if are those are used for anything?

I thought they were 'free bytes' that could be used as a buffer area when expanding player names, but they actually have non-zero values... If you expanded the team data into that area, it could cause something else in the ROM to break.

After that area, it looks like a string data area (Wins, Edit Lines, etc..).

At the end of that string data area, there are definitely some 'free bytes' from E7B45-E8200. If you want to use those bytes as free bytes, you'll have to find the pointers corresponding to all those other strings following the team data.. not fun!

EDIT: i found a workaround, posted in the next messages.

Edited by smozoma

Share this post


Link to post
Share on other sites

i had an idea to get around the issue of the team data being 'sandwiched' in before the string data:

just outright move a couple teams from their original position into the free bytes area (E7B45-E8200).

There is room there for 2 big teams or 3 small ones.

So, you'd have 26 teams in the original area with about 0400-0600 extra bytes to work with freed up by the moved teams, and you'd have 2 teams in the free bytes area.

Share this post


Link to post
Share on other sites

I was able to add letters to vanbiesbrouck's name!

post-253-1269564895_thumb.png

What I did:

Part 1, move FLA and ANA to free bytes:

  • Copy data from E6B4D-E6F59. This is the FLA and ANA team data.
  • Paste (overwrite not insert) to E7B46. This puts FLA at E7B46 and ANA at E7D4B.
  • Go back to E6B4D-E6F59 and overwrite it all with FFFFFF...
  • Update the FLA team pointer at E2807 (see table in post above) to the value 46F9 (E7B46->7B46->7946->F946->46F9)
  • Update the ANA team pointer at E27E7 (see table in post above) to the value 48FB (E7D48->7D48->7B48->FB48->48FB)

Part 2, extend player's name:

  • Insert the missing characters in Vanbiesbrouck's name ("ouc", 3 extra characters)
  • Update the length of Vanb's name from 1100 to 1400.
  • Because data was inserted, you need to remove some of the 'free bytes'. Delete 3 of the FF bytes from before E8200.
  • Update the "player info size" value in the 4-5th bytes of the team data. Old value: DD01. New value: DD01+0300=E001.
  • Because we changed the total length of FLA's data, we need up update the pointers for all teams AFTER Florida in the ROM. In this case, it's just ANA:
  • Team Pointer Location: E27E7. Old data location: E7D48. New data location: E7D48+0003=E7D4B -> 4BFB

NOTE: The 'data' section of the ROM ends at 0E81FF. The code starts at 0E8200. You have to make sure the code section doesn't move.

NHL___94__U_____smoz.zip

Edited by chaos
Updated ANA pointer address

Share this post


Link to post
Share on other sites

give up the dark side and go further forth toward this light.

Share this post


Link to post
Share on other sites

I am trying very hard to grasp this stuff. I'm hoping NorthStar will come back to the forums and confirm that all of the information he needed to pull off the '12 Altered ROM's expansion successes are in the texts above. pointers (and how to change them) baffle(s) me. thanks and apologies are hereby extended to Smozoma. he must be sick of holding my hand through every step I try to take in furthering my abilities to edit this game.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this