Jump to content
NHL'94 Forums

Working on a python library for editing NHL94 bin files. Need some help with offsets


Recommended Posts

Finally exams are done, so I can go back to wasting time on my github. :D

I’ve been working on creating a python library for editing sega genesis bin files. The goal of the project is to allow applications to modify the raw hex that the bin is written in via an object oriented interface that any dumb schmuck like me can understand without looking up reference tables.

What Ive got so far is here:

https://github.com/BruceJohnJennerLawso/ninety-four

Which does mostly everything except actually interact with the bin file. My next goal is to get the project to a point where it can read the vanilla NHL94 bin file, and load the players & teams into the program as objects. Then, obviously I hope to implement the reverse, so edits can be made.

A couple of things about editing the bin file have been confusing me:

-What exactly is the bin file? Is it something like a compiled executable created specifically to run on the sega genesis console? I have heard some people say that it would have originally written in a special dialect of assembly, can anyone confirm that?
-The original nhl94 bin file always appears to be 1048 kb, but many of the custom roms like the NHL2016 versions and other years available are at 2097 kb. Opening these files in NOSE and other editors is no problem, but Im not sure how to adjust for the differences. For example, the new 2097 kb roms have an extra 9 teams that were not possible in the original 21 team rom, and they are located at spots in the file that originally contained other data. How exactly is the layout of the new roms different from the original (and for that matter, where did the new one come from?)

Link to comment
Share on other sites

Finally exams are done, so I can go back to wasting time on my github. :D

I’ve been working on creating a python library for editing sega genesis bin files. The goal of the project is to allow applications to modify the raw hex that the bin is written in via an object oriented interface that any dumb schmuck like me can understand without looking up reference tables.

What Ive got so far is here:

https://github.com/BruceJohnJennerLawso/ninety-four

Which does mostly everything except actually interact with the bin file. My next goal is to get the project to a point where it can read the vanilla NHL94 bin file, and load the players & teams into the program as objects. Then, obviously I hope to implement the reverse, so edits can be made.

A couple of things about editing the bin file have been confusing me:

-What exactly is the bin file? Is it something like a compiled executable created specifically to run on the sega genesis console? I have heard some people say that it would have originally written in a special dialect of assembly, can anyone confirm that?

-The original nhl94 bin file always appears to be 1048 kb, but many of the custom roms like the NHL2016 versions and other years available are at 2097 kb. Opening these files in NOSE and other editors is no problem, but Im not sure how to adjust for the differences. For example, the new 2097 kb roms have an extra 9 teams that were not possible in the original 21 team rom, and they are located at spots in the file that originally contained other data. How exactly is the layout of the new roms different from the original (and for that matter, where did the new one come from?)

The .bin file is the game itself, the ROM, written in 68000 Assembly Language (I'm no expert in this)

The original '94 game was 28 teams (not 21?) and a community member legend named wboy expanded that into a 2MB ROM. He added 2 more teams to go to 30, decompressed the graphics to make it very easy to edit, and used a whole bunch of that space to expand player picture cards. So every hacked ROM uses the wboy 30-team ROM as a base, as it's the easiest to edit using NOSE and TileMolester.

That's the gist of it, I'm not sure if you need more information than that. And anything more specific I wouldn't know, you'd have to dig through the forum archives, or perhaps someone with more knowledge can reply.

Can you explain more what your program seeks out to do? Will this be similar to NOSE?

Link to comment
Share on other sites

The .bin file is the game itself, the ROM, written in 68000 Assembly Language (I'm no expert in this)

The original '94 game was 28 teams (not 21?) and a community member legend named wboy expanded that into a 2MB ROM. He added 2 more teams to go to 30, decompressed the graphics to make it very easy to edit, and used a whole bunch of that space to expand player picture cards. So every hacked ROM uses the wboy 30-team ROM as a base, as it's the easiest to edit using NOSE and TileMolester.

That's the gist of it, I'm not sure if you need more information than that. And anything more specific I wouldn't know, you'd have to dig through the forum archives, or perhaps someone with more knowledge can reply.

Can you explain more what your program seeks out to do? Will this be similar to NOSE?

Ah damn, sorry, yes 28 teams. I was thinking of the 21 number because the NHL stayed at 21 for many years before expanding in the 90s. Shoulda checked that before I posted.

Ok, that makes more sense with Wboy creating a custom rom. As far as I can tell, that rom was used to create some retro roms with fewer than 30 teams as well? Someone created a set of roms stretching from 1971-1989 seasons on wboys model, but they somehow made it so that the additional teams are not in the game (ie for 1970-71, there are only 14 teams) but Im not sure how they modified the rom to drop teams?

With regards to editing the game, the guides here:

http://www.nhl94.com/html/editing/edit_bin.php

Are the offsets that they mention here for the original file, or wboys edit version? (Or does it not matter which version)

With regards to what Im trying to do, its not really a matter of creating a program as much as a library that other programs can use to make editing the bin file much easier. For example, the current library can do things like generate a roster of players with randomly generated names, stats, etc., so you could run the script on the file you want to edit and instantly generate a random set of players for every team in the game. (You can see the best example of this if you run team.py, imagine the output of that script creating a complete team in the rom from scratch)

The ultimate goal for this project is to create a NHL94 season/franchise mode, but that project will need to do much, much more complicated things, like retrieving information about what the score of the game was from the memory of the emulator. (I hear this has been done before, but it sounds super tricky to implement from scratch)

Edited by BruceJohnJennerLawso
Link to comment
Share on other sites

smozoma's EARE program allows you to limit selectable teams very nicely: http://forum.nhl94.com/index.php/topic/10443-eare-ea-rom-editor-for-nhl94/

Here's the actual thread that explains how to do it via Hex: http://forum.nhl94.com/index.php/topic/2935-how-to-limit-selectable-teams/

I'd have to go back and look at the nhl94.com editing notes, but the offsets from the original and the 30-team ROM are different.

Link to comment
Share on other sites

In your code, you have both roughness and aggression. I can never remember which one it is, but one of them does not appear in the game (Team Roster / Edit Lines). That value is actually the "shooting bias". Having a high value in that one means the player had a lot of goals compared to their number of assists in the 92-93 season. Players with lots of assists have a low number.. even if they scored a lot of goals (Gretz, Lemieux, Oates = 0).

I would also count numbers 27-29 as goalie numbers, and maybe 40 as well :)

List of canadian first names needs Dougie of course

Link to comment
Share on other sites

The smozROM hack applicator is written in python. Source code is included. (GPL v3 license)

http://forum.nhl94.com/index.php/topic/12181-tool-hack-applicator/

Taking a look at that now to see how it works. Thanks for linking it.

In your code, you have both roughness and aggression. I can never remember which one it is, but one of them does not appear in the game (Team Roster / Edit Lines). That value is actually the "shooting bias". Having a high value in that one means the player had a lot of goals compared to their number of assists in the 92-93 season. Players with lots of assists have a low number.. even if they scored a lot of goals (Gretz, Lemieux, Oates = 0).

I would also count numbers 27-29 as goalie numbers, and maybe 40 as well :)

List of canadian first names needs Dougie of course

Roughness is the hidden passing stat. Aggressiveness appears in the game.

Ok, so based on the table on this page

http://www.nhl94.com/html/editing/edit_bin.php#edit_bin_player_info

Aggressiveness is in the game (I think it controls how likely the player is to try to run over an opponent when not controlled by the player) and roughness is not? (Why did I write roughness down when I made the list of attributes? odd) If I understand correctly, this hidden passing stat that you mention is not listed in the game menus, but does affect the behavior of players in game? I don't see it listed in the reference table I linked, could it possibly be that 12th digit that was unsure?

Heh, I will add in those other goalie numbers I guess. The test uses an arbitrary list of integers just to confirm that the function does work as expected, the list of 'bad numbers' will include both ones not usually used for skaters (1, 31, etc.), but also any numbers already taken by other players on the roster. I guess I can write a function to lay out those "unacceptable" numbers beforehand as well tho.

I'll add in Dougie. Leafs fans ;)

By the way, if someone could create a list of common first/last names for Quebecois, swedish, finnish, russian, etc., it would be very helpful for me.

Link to comment
Share on other sites

In the player attributes, the shot/pass bias attribute is the 3rd last one. The reason you wrote roughness was because no one knew what that attribute was, so someone guessed it was roughness based on which players had which values, so there are a lot of resources out there (such as NOSE) that still refer to it as roughness, but someone randomly showed up on the forums and told us that it was the pass/shot bias then disappeared, and when I checked out the player stats for the 92-93 season, it make perfect sense, so now we know that it's not roughness, it's pass/shot bias. (aaaand breath!)

Link to comment
Share on other sites

This is funny, because I've just started truly looking into fixing the faceoff music/goal music for teams that have been moved around for the 30-team ROM. Teams like Boston, Buffalo, Chicago and Montreal have very distinctive faceoff music, but they got thrown off when moved in the 30-team ROM. For example, I cannot figure out why Carolina still has Chicago's "Here Come the Blackhawks" faceoff music, and I am having a lot of trouble locating the offset to make the switches. I was able to successfully switch Boston and Buffalo's faceoff music for the correct ones, but cannot figure out where their goal music is located in offset hex editing.

Please please please let me know if you figure out the mapping for teams in the 30-team ROM. My v6 is already a bit "corrupted" in the sense that I have moved some music pointers around to try and fix Boston, Buffalo, Calgary, Carolina and Chicago by moving them all up 1 spot (to account for adding Arizona in between Anaheim and Boston, which bumped all of the teams up one spot)

Edited by skip
Link to comment
Share on other sites

In the player attributes, the shot/pass bias attribute is the 3rd last one. The reason you wrote roughness was because no one knew what that attribute was, so someone guessed it was roughness based on which players had which values, so there are a lot of resources out there (such as NOSE) that still refer to it as roughness, but someone randomly showed up on the forums and told us that it was the pass/shot bias then disappeared, and when I checked out the player stats for the 92-93 season, it make perfect sense, so now we know that it's not roughness, it's pass/shot bias. (aaaand breath!)

Yup, just went and played a few tests. Gretzky almost always seems to pass the puck, but Hull (I would assume heavy on the shot side, but I haven't checked the bin file just yet) shoots the puck from anywhere as soon as he picks it up. Thanks for the heads up on that one.

This is funny, because I've just started truly looking into fixing the faceoff music/goal music for teams that have been moved around for the 30-team ROM. Teams like Boston, Buffalo, Chicago and Montreal have very distinctive faceoff music, but they got thrown off when moved in the 30-team ROM. For example, I cannot figure out why Carolina still has Chicago's "Here Come the Blackhawks" faceoff music, and I am having a lot of trouble locating the offset to make the switches. I was able to successfully switch Boston and Buffalo's faceoff music for the correct ones, but cannot figure out where their goal music is located in offset hex editing.

Please please please let me know if you figure out the mapping for teams in the 30-team ROM. My v6 is already a bit "corrupted" in the sense that I have moved some music pointers around to try and fix Boston, Buffalo, Calgary, Carolina and Chicago by moving them all up 1 spot (to account for adding Arizona in between Anaheim and Boston, which bumped all of the teams up one spot)

I did some more 'research'. In the original nhl94 bin file, several teams have distinctive songs (Chicago - here come the hawks, Montreal - I cant remember the name of this, Hartford - Brass Bonanza <3, St Louis - The Saints come marching in). I think this applies to all of the teams in the original rom, with generic music applied for teams where no particular song really applied (panthers, lightning, mighty ducks, leafs, etc.). The team music almost always (not 100% sure on this, I think it may very rarely do something different) plays at the start of periods, and after every home goal.

In the new 30 team rom, I think the old team musics are still there, but randomly distributed on all the wrong teams (probably shifted to keep everything in alphabetical order in the menu). I think (and please don't quote me on this) the new team slots that did not exist in the original rom now just play random music at period start/goals, all this having to do with whatever witchcraft wboy used to create the 30 team rom in the first place.

I vaguely remember seeing an article a year or three ago about a way that it was possible to edit genesis roms music and extract/overwrite them with midi files, but I may be misremembering. If that is possible, I would think it would be much easier to just overwrite the existing musics with the appropriate music files to get the right music for each team.

If we could overwrite the goal music for chicago with this, it would be amazing:

A little side note skip, I really love your up to date roms each year. Thank you so much for making them :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...