November 21, 2024, 07:38:48 AM

Author Topic: External playbook editor  (Read 74397 times)

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #45 on: July 06, 2016, 06:26:30 PM »
Inserting the images would be super easy, would be able to use the file export/import tool made for blitz. I should be able to add support for blitz 2001 also. Else we could for sure export the files using zoinkity's midwaydec and my NFL blitz image tool.

Also. Update on the playbook editor. It now can read blitz plays from memory pack files. I should be able to add saving pretty soon.

Been looking more into importing some of the 2001 plays into the hacked 2000 version. Based on everything I see, it seems like it should be possible, just need to copy+paste in that data and then update the tables.

If we could get these in there, I was hoping to also add the images for the plays. How exactly would we be able to import the image back into the ROM? I think there's a pointer for each playbook play image, so I'm wondering if we could stick the new images somewhere and just point to them. I'm just not sure how to add new image files into the ROM.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #46 on: July 06, 2016, 09:02:26 PM »
Sounds awesome, Jake! Can't wait to try it out!

I have some good news on getting the 2001 plays into 2000. I found the function that pulls in the pointers for the offensive/defensive play data. The way the data looks right now (where Zoinkity pointed out) is it has 45 addresses starting at 80336B24 that have pointers that correspond to the 45 default plays (which are all being accessed now with the extended playbook hack).

After these 45 addresses starting at 80336BD8 are pointers that look like they point to the offensive play names that are used when a play is flipped - not sure why they need a whole different set of play names, as the normal play is pulled from a different location. I'm thinking we can delete these to make room for extra pointers for new plays. Next at 80336C8C are pointers for the first defensive page of plays, and then 80336CB0 are the second page of defensive plays.

The next part is where things get somewhat confusing - 80336CD4 has some values that look like previous pointers to offensive play data. Deleting these seems to screw some stuff up, so I don't know if messing with them is smart.

I'm thinking of putting in new pointers for the new 2001 play data either a) after the first 45 offensive play pointers (where the play names are), or b) after all of these pointers where the "use team plays" data used to be (I cleared it out as the extended playbook has all the plays at all time accessible so it's no longer needed) at address 80336E20.

The nice thing is I think I just have to change the offset that the function pulling in the pointer tables to match where I move around these various things.

Probably the hardest part is getting all the actual play data in the game. Once that's done, I will have to go in line-by-line and update all the pointers.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #47 on: July 10, 2016, 06:20:04 PM »
Great news - I got "Short Jet", one of the default plays from 2001 not found in 2000, working in Zoinkity's hacked version! Based on this,  I think it should be quite easy (albeit time consuming) to import the remaining plays on the first page from 2001. None of these plays are found in 2000, so that will give us an entirely new page of plays to work with.

A few questions:

1. If we import new graphics altogether rather than simply replacing them, where will you put these?

2. Do you know the function that displays the graphics (or at least the playbook graphics)? I think I have an idea but wasn't sure if you already did.

3. Do you know how these graphics are called? I assume there's probably a table sort of like the play data tables, where it references some address where the graphic is.

4. If this is the case, how would I know where the graphical file starts and ends within the rom? I see images with the ".wms" extension near the end of the ROM, but don't know how to read the hex.

edit: Also got Stack it in there as well. Only issue I forsee going forward is finding room in the ROM to stick all this extra data. Each play has at least ~0x200  bytes, so it's not a small amount. I did find where Zoinkity cleared out area in the ROM for the extra teams, however when I tried sticking code there, it didn't work. It looks like that area is not loaded into memory during the actual game, which means we can't use it which is unfortunate because that is the largest amount of free space and I was hoping to dump all the new play data in the same spot.
« Last Edit: July 10, 2016, 08:48:26 PM by blitzmaster5000 »

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #48 on: July 11, 2016, 09:57:21 PM »
Okay got the first 3 plays in there from the 2001 playbook. I also got the pointers updated and names of the plays as well. I just need to finish adding in the rest of the play data for the remaining 6 plays and then add in the play images for the playbook and it should be good!

Only thing is I deleted the default values for the "records" and other things that show up on the screen related to the season mode. I never play this mode so I'm not too worried about it, and I needed to make some extra space for all the extra code necessary for all the plays.

Here is a screen shot of page 6 with the correct play names (but obviously incorrect routes as we still need to update the figures).


blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #49 on: July 12, 2016, 11:40:41 PM »
Well, I got all the plays from 2001 in... only that they're fudged. I couldn't find enough free space in the ROM to add all the data so I had to use some of the pointers from other plays for some of the WR routes. I tried to find similar routes to put in, but they aren't exactly the same.

Nonetheless, the best part about this is that I think I know how we could use the default data to create new "default" plays with the game data. Each play has the following data: 1) sets the offensive scheme - trips, tight ends, etc. 2)data for the WRs to follow.

Both of these are set by pointers. Therefore, one could create a whole mixture of pointers making new plays! The external playbook editor will probably make this obsolete, but nonetheless, it's good to know how the default plays work.

The only bottleneck as far as getting all the true data in from 2001 into 2000 is space - There just isn't enough free space to put in the data for all the routes.

A few notes about this like I mentioned before: I deleted the data related to the "top scorers" and "best record" etc. to stick data. So when you hit "b" multiple times and records show, it shows gibberish. It doesn't crash, but it isn't useful anyway.

Another thing is that I apparently slightly modified the game so that it thinks I "won" the superbowl... So when I boot up it shows a crazy ass image of a football player conquering a mountain. It's not an issue as far as gameplay goes, but funny nonetheless.

The last thing to do is incorporate the new images into the game for the 2001 plays. Not gonna lie - I'm surprised we got this far! I never thought we would be able to do all this.

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #50 on: July 13, 2016, 06:08:42 AM »
Hey sorry for taking awhile to reply,
I hurt my back a few days back and haven't been able to sit at my computer much.

1.   it's very easy to extend the table.  The header for the resource block is listed as "ROMIndex.off" in the filelist; should be located at 0x150C40. The word at 0x8 is the offset to from this address to the start of the filelist.  The word at 0xC is the number of entries. So when inserting a new file you add it to the end of all the other files, increment the # of files at 0XC and update 0x8 with the new table location (since we added a new file we had to move the table down). The filetable is the last thing in the ROM so you don't need to worry about overwriting anything else.


2. Not sure on this one.

3. See 4, table contains everything needed. Not sure which function uses the table though.

4. Each file table entry has an offset from the start of the file list and a file size associated with it.

Great news - I got "Short Jet", one of the default plays from 2001 not found in 2000, working in Zoinkity's hacked version! Based on this,  I think it should be quite easy (albeit time consuming) to import the remaining plays on the first page from 2001. None of these plays are found in 2000, so that will give us an entirely new page of plays to work with.

A few questions:

1. If we import new graphics altogether rather than simply replacing them, where will you put these?

2. Do you know the function that displays the graphics (or at least the playbook graphics)? I think I have an idea but wasn't sure if you already did.

3. Do you know how these graphics are called? I assume there's probably a table sort of like the play data tables, where it references some address where the graphic is.

4. If this is the case, how would I know where the graphical file starts and ends within the rom? I see images with the ".wms" extension near the end of the ROM, but don't know how to read the hex.

edit: Also got Stack it in there as well. Only issue I forsee going forward is finding room in the ROM to stick all this extra data. Each play has at least ~0x200  bytes, so it's not a small amount. I did find where Zoinkity cleared out area in the ROM for the extra teams, however when I tried sticking code there, it didn't work. It looks like that area is not loaded into memory during the actual game, which means we can't use it which is unfortunate because that is the largest amount of free space and I was hoping to dump all the new play data in the same spot.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #51 on: July 14, 2016, 09:25:56 AM »
A few questions about getting the images into the ROM:

1. At the end of the ROM, i see a bunch of "xx.wms"" values with what look to be addresses related to the location in the ROM - this is the filelist, correct? So I should be able to add in the data at the end for new images?

2. the address at 150c48, the offset to the start of the filelist, should be going to the first "xx.wms" line, correct?

3. If I were to dump the image data from 2001 into 2000 for these plays, can I just copy+paste the data right before the filelist (and update the pointers? I assume that the data just before the start of the file list is image data that I can just append the new data to.

I found the function that reads in the "pointer" to the image files... What is odd is the pointers don't actually seem to go anywhere. It must be calling the images somehow using this strange notation. They all are of the format "0x0A000XXX" where xxx is some value. Once I can get the filetable updated and images in there, it should be pretty easy to figure out how this function actually works.

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #52 on: July 15, 2016, 02:01:03 PM »
Honestly, I would suggest just using the NFL Blitz Graphic/File Editor tool. It will create the appropriate entries, move the table and update everything for you. I'll even see if I can add a batch import to make it super quick to import all the 2001 pay images.


EDIT: What if we put the custom plays into the file table? It should get loaded in memory then I think?

EDIT 2: Working on some code for the blitz file editor, forgot that Zoinktiy had also compressed the file table format. Here is some notes from him I found in my old messages:
Quote
  File entries are at the same location but have been shrunk to 0x20 each.  A compression flag is no longer used.  If a file is uncompressed the compressed size will be 0.  Also, filenames can be 20 chars long not counting the NULL.  The first byte of the decompressed size must always be 00, so that doubles as a NULL in case you need it.
Code: [Select]
0x0 0x14 name
0x14 4 decompressed size
0x18 4 pos
0x1C 4 compressed size

This is the original file table format (so whats used in unhacked versions of blitz):
Code: [Select]
0x0 0x18 filename
0x18 0x4 decompressed size
0x1C 0x4 offset (from start of header)
0x20 0x4 flags
04 file
01 uncompressed
0x24 0x4 compressed size

So I'll just have to add a toggle for hacked versus unhacked so the code knows which filetable entry format to use.


EDIT 3: Also the file tables are in alphabetical order, so not all the play images are grouped together. Do you know where in ROM the references to the images are? I could add a tab for play images. Also, just re-read your other post. you deleted the default values? does the record screen still work? Any thoughts on putting plays into the file table?


EDIT 4: Exported blitz 2001 image

So the exporting works for 2001 ATM now... I'll have to clean some things up with it but hopefully will be able to publish a newer version of the application soon. I've added the code to github also, its super dirty but feel free to check it out:
https://github.com/thompjake/NFL-Blitz-File-Editor
« Last Edit: July 16, 2016, 09:24:56 AM by jaker3 »

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #53 on: July 17, 2016, 05:52:15 PM »
I cleared out all the data for the "records" screens that show up if you let the game go idle. Below is one with the default values that I cleared out. So now in the ROM this area has play data. It still shows the screens as seen in the second image, but the values don't really mean anything any more as it's just play data in there. Ideally I wouldn't have done this, but I couldn't find anywhere else to put it. But I like your idea of possibly moving all the custom data to the end. I will see if that could work.

default values for records:

values after writing over this area w/ play data:



I used Zoinkity's midwaydec tool to extract out the 9 play *.wms files from the 2001 ROM. I tried using your graphical tool editor to insert the new files, but it just crashed. Would I have to edit the actual *.wms files first? I wasn't sure if these files needed to be modified to fit Zoinkity's changes to the file table.

Your question about where in the ROM the references to the play images are - I'm not really sure about this. Wouldn't it be the 0x18 bit that dictates the position  (in zoinkity's modified table)?

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #54 on: July 18, 2016, 10:43:15 AM »
hmmm, send me the 9 plays you extracted and I'll try it on my end.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #55 on: July 18, 2016, 07:37:50 PM »
I just added a ton of new lines with FFFFFFFF like all the last ones in the ROM and it still worked.. I wonder if we can just increase the size of the ROM like that?? If so, we should very easily be able to just stick all the play data from 2001 there, as well as the custom data - assuming we can access those addresses in game. I would much prefer this as I didn't like having to delete all that other stuff and overwrite areas of previous data. Plus it will make book keeping much easier as far as where everything is in the ROM.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #56 on: July 19, 2016, 07:03:11 PM »
Got the 2001 play images into the game! Here's a screen shot with all the correct routes displayed:


I sort of figured out how the strange pointers work and was able to update them to point to the correct play images that I imported using your tool. All I need to do now is move the table to allow for these extra pointers.

I will then try and move some play data to the end of the rom to see if we can load it from there. That will be basically the last thing needed for this hack.

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #57 on: July 20, 2016, 01:07:56 PM »
awesome! so how do those pointers work? Are you going to put it directly at the end? I'm wondering if its possible to add it directly to the file table so it doesn't get in the way when we add new files to the game.

blitzmaster5000

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: External playbook editor
« Reply #58 on: July 20, 2016, 04:32:42 PM »
Actually, I didn't have to move the pointers to a completely new place. I had cleared out 9 lines of code just before this that weren't being used and was able to move the pointers up the perfect amount for 9 plays. Again I'm not sure how the pointers actually work (they aren't just addresses like most other pointer tables), but I found the pointer to the last image in the ROM. It was some image related to the texans stuff. I was able to just add pointers sequentially that referenced each play image. Here they are in the ROM I have:
Code: [Select]
pointer      target in rom play
0A0007BF FDFB36 short jet
0A0007C0 FDFB56 STACKIT
0A0007C1 FDFB76 SMACKYOU
0A0007C2 FDFB96 POSTDRAG
0A0007C3 FDFBA6 FLOODSLIT
0A0007C4 FDFBB6 DEEP ATTACK
0A0007C5 FDFBC6 TASTY TREET
0A0007C6 FDFBD6 BLACKRAIN
0A0007C7 FDFBE6 KOMBAT

I'm not sure we can add the code at the end of the ROM unfortunately. I played around with it a bit, but when I load the game, I see that data is loaded up immediately after the image table in RAM. I will try adding some stuff here to see if it's overwritten or anything, but it doesn't look that promising unfortunately.

edit: talked to some guys over at origami64.net. They mentioned this could possibly work by a) expanding the ROM (sounds difficult as you would need to make space for stuff and then update every pointer that's changed), or b) try and fix the code that loads the table data so that it also loads the data after it into memory. Both sound rather difficult, but if they would work, this would be awesome as we would be able to have plenty of empty space for extra stuff.
« Last Edit: July 21, 2016, 10:26:15 AM by blitzmaster5000 »

jaker3

  • Administrator
  • Sr. Member
  • *****
  • Posts: 334
    • View Profile
Re: External playbook editor
« Reply #59 on: July 22, 2016, 10:46:17 AM »
Hold up.... I still don't get whats stopping us from exporting the play data you need, save it in a .bin file, and insert it (don't compress it) into the file table. This way it would be loaded into memory along with the rest of the file table (graphic, sound, ect...).  Is the whole table not loaded into RAM?

Actually, I didn't have to move the pointers to a completely new place. I had cleared out 9 lines of code just before this that weren't being used and was able to move the pointers up the perfect amount for 9 plays. Again I'm not sure how the pointers actually work (they aren't just addresses like most other pointer tables), but I found the pointer to the last image in the ROM. It was some image related to the texans stuff. I was able to just add pointers sequentially that referenced each play image. Here they are in the ROM I have:
Code: [Select]
pointer      target in rom play
0A0007BF FDFB36 short jet
0A0007C0 FDFB56 STACKIT
0A0007C1 FDFB76 SMACKYOU
0A0007C2 FDFB96 POSTDRAG
0A0007C3 FDFBA6 FLOODSLIT
0A0007C4 FDFBB6 DEEP ATTACK
0A0007C5 FDFBC6 TASTY TREET
0A0007C6 FDFBD6 BLACKRAIN
0A0007C7 FDFBE6 KOMBAT

I'm not sure we can add the code at the end of the ROM unfortunately. I played around with it a bit, but when I load the game, I see that data is loaded up immediately after the image table in RAM. I will try adding some stuff here to see if it's overwritten or anything, but it doesn't look that promising unfortunately.

edit: talked to some guys over at origami64.net. They mentioned this could possibly work by a) expanding the ROM (sounds difficult as you would need to make space for stuff and then update every pointer that's changed), or b) try and fix the code that loads the table data so that it also loads the data after it into memory. Both sound rather difficult, but if they would work, this would be awesome as we would be able to have plenty of empty space for extra stuff.