Q: So how does the tool really work?
and/orQ: I'm a person who knows his way around hex editing. What should I be looking for to help you?
Here's a nice big post on how this tool works, and what the problem is.
So, NBA 2K12 keeps the Team Stats (that you can see in the NBA.com > Statistics > Team Stats) in neat 40 byte tables. Here's the first one in any Season 1 save, starting from Hex Address 0x00317254.
The order of the stats in each team is like this:Wins (single byte)
Losses (single byte)
Minutes played (double byte, everything below is too)
Hex 00 00
Hex 01 00
The tool works based on these tables to show you the stats, get you averages, scouting reports and allow you to update them. I don't know where the Box Scores are kept in the save, and it would probably be too much trouble to extract them.
So here's the problem.
The tool assumes that the order of the Teams in those tables (Team 0, Team 1, etc.) is preset, and never changes. At least, that was the original assumption. And that's what went wrong. Although in my original Association on which I was testing the tool Team 0 were the Nuggets, Team 1 the Trail Blazers, Team 2 the Pacers, etc, that order proved not to be something standard, but something that is determined somehow when the Association is created.
So in Onisak's save, for example, Team 2 weren't the Pacers, but the Bucks. Team 3 weren't the Pistons, but the Spurs. So when he loaded his save in the tool, the Bucks' stats were in the Pacers' ones in the tool, and the Spurs' stats were in the Pistons' ones in the tool, and that problem was there for 6 more teams. The problem worked both ways. If you updated the Pistons stats in the tool, you'd be in reality updating the Spurs' stats in-game.
When I created another save later on, the team order was again different than my older save, different than Onisak's save. So I thought I'd test what sets the team order like that. Rosters? Nope. Tried 3 different ones. Draft Class? Nope. EU/US version? Nope. System Locale? Nope.
I'm out of ideas. The same person creating two Associations at a different time could get a different Team Order in their save for no reason at all. I'm sure the game has one, but it's not telling me easy.EDIT:
The only time the game makes it easy to guess what the Team Order is, is during the first Playoffs. The teams in the save are in the opposite order of the teams in the playoff tree in the first round. So if the bottom team of the East are the 76ers and the team above them is the Heat, then during the playoffs, Team 0 will be the 76ers, and Team 1 will be the Heat. Continue reading the East's column upwards, and then start from the bottom of the West's column, and upwards.
In any Career file that isn't just Playoffs (Association, Season, My Player, Create A Legend), Team 0's stats during the first playoffs begin 1440 bytes earlier in the save than Team 0's first season stats. The other 15 teams follow every 40 bytes, in a continuous block.EDIT 2:
Team 0 season offsets depending on type of Career:
Association, Season: 0x317254
My Player: 0x575374
Playoffs: 0x1BAA24Q: So, what should we be looking for? What's going to solve this?
I'm glad you asked. The game has to know in which order the team stats are saved, otherwise it would mix them up itself too. But since it knows which stats are for each team and in each save this data is different, it means that this data is in the Saves somewhere. Somewhere in the save there's a list that tells the game where to look for the Nuggets' stats, where for the Knicks' ones, where for the Bulls' ones, etc. It's not absolute offsets, as I've tried searching for Hex 31 72 54 and even 31 72 52 and also 54 72 31, none of which worked. So it must be relative offsets. Somewhere in the file there's other info about the Nuggets, and there's some bytes that tell the game that for the Nuggets' team stats, it has to look (for example) 125042 bytes later in the file. Same for the other teams. There must be some place where these relative offsets are. And if we discover them and can link them to each team, then the tool can do that as well, and be compatible with any Association, any team order.Q: What about the Season 2 and later problem? What's that about?
Oh, yes. That one. Apparently, the game likes to keep previous years' stats in the position they were in, and write the current year's stats somewhere else. So in a rough sketch, this is how the game works:
.........................................................Season 1 Team Stats (current)......................
..........Season 2 Team Stats (current)............Season 1 Team Stats.................................
..........Season 2 Team Stats.......................Season 1 Team Stats.......Season 3 TS (current).
And after Season 1, the Team Stats aren't in a continuous 30x40 byte block (30 teams x 40 bytes for each team's stats), but they're broken up, so we have a continuous 3 team block, then some other game data, then a continuous 5 team block, then some other data, etc. And of course, the Team Order is again different.
So, only way to solve this, is to find the relative offsets I mentioned, because those, again, tell the game where to look for the team's current team stats in the save.
If we find those offsets, then the tool will always know where to look for each team's current stats, and be compatible with any Association, any team, any season year.
Vlad has promised to help with this in February, but even with his help, it's not a sure thing we'll find those offsets and actually make the tool compatible. Let's just hope it is that way. If any of you reading this right now think you can help, be my guest. I'd be glad to hear from you either in this topic or PM.Q: Is there any way I can avoid paying the $2 to get my Association working with the tool? I'm willing to spend half an hour if that means the tool will work with my Association for a whole season!
Well, actually, there is. Here's what I do when I want to make the tool compatible with a certain Association, and essentially how the donation versions are made.
1. Have a cup of tea next to you. You'll need something relaxing.
2. Start a new Association.
3. Save it right after choosing the Draft Class. Keep a copy of this save, by saving the Association again under a different name this time. The first save you made will be the backup, the one you'll use after all this is done, since it'll be compatible with the tool. The second save will be the one that will help you do the following.
4. With the second save loaded, simulate a month of games.
5. Save the Association under the second name again.
5.1 (Optional) Get the game into windowed mode. Trust me, it'll help a lot. Make sure you also have some additional screen space; that is, that the game's window doesn't fill up your desktop.
6. From in-game, go to NBA.com > Statistics > Team Stats. Sort by PTS and have the AST column also visible, like this:
7. Alt-Tab into the tool (or start it), and load your SECOND save. Select Mode 0 when asked.
If you're not asked, click on Erase Settings, and load your second save again. You should be asked this time.
If you have a spreadsheet tool that can import CSV...(Google Docs has a spreadsheet editor that works perfectly)
8. Export the league's stats from the tool to CSV.
9. Import it into the spreadsheet tool, make sure you split the data into columns with "comma" as a separator. You should get something like this:
10. Hide or delete any columns that aren't PF and AST. Sort the names, PF and AST columns by PF, descending order. You should have something like this now:
11. Okay, so now we have something similar in both the game window and the Excel window. The fact that some names are mixed up is to be expected, and that's what we want to check.
12. Team by team, check for differences in names. For example, in the above image, here's the differences that are apparent:
Grizzlies -> Warriors
Bucks -> Pacers
Knicks -> Clippers
Warriors -> Spurs
Pistons -> Knicks
There are others too that are lower in the game's team stats table. Note the differences for all 30 teams in the table.
13. Send me those differences in a PM or e-mail, I'll get to make a mode of the tool that works with your Association. When I send it to you, install it. Make note of the Mode I tell you to select when the tool asks you.
14. Load your first save in the tool's version I sent you (which should have replaced the older tool), and click on Erase Settings. Load it again. You should be asked for the number of games in the season and the mode you want, again. This time, select the mode I told you to in my reply.
15. Your save is now compatible with the tool.Q: Does that mean I can use the tool you sent me with any Association I start later?
Truth is, I don't know! Maybe, maybe not. Try it and tell me. If you want to avoid going through all that again, you can always get the donation package, that for $2 gets you 3 separate tools for 3 of your Associations, with me doing all the above work for you. But first, check if any of the modes already in the tool (especially the one I made for you) works with your new Association as well. If not, you'll have to either do all that again, or donate the $2.