NHL2K editing (technical discussion)

Collapse

Recommended Videos

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WWEDX2007
    Rookie
    • Jan 2015
    • 465

    #31
    Re: NHL2K editing (technical discussion)

    Originally posted by nikethebike
    I've figured out how the ages work now.


    We can set real birth dates - the limit between 1960 and 1992 is purely a UI thing, they will show up correctly in game, might break franchise though, have not tied it.


    So now the question is whether we want real ages or if we want real birth dates.





    We can probably change start year somewhere too, but finding that will be tough.




    So here is how ages work:


    Three bytes are used:
    7C 11 0B, 1985-01-01
    7C 21 0B, 1986-01-01
    7C 31 0B, 1987-01-01
    7C 32 13, 1987-02-02
    7A 81 0B, 1960-01-01
    7B 8C FB, 1976-12-31
    7C 8C FB, 1992-12-31
    7D 8C FB, 2008-12-31
    79 01 0B, 1936-01-01
    70 01 0B, 1792-01-01 => Hx700 = 1792!


    The third and last byte is used for day. 01 is Hx0B and to add a day you add 8 to the value. So 02 is Hx13 and 31 is HxFB.

    -- -- XX => Day


    The second part of the second byte is used for month of year. 1 is january, 2 is February, C is December.

    -- -X -- => Month


    The more complicated part is the year, since we can not control this with just one byte. The first byte and first part of the second byte is what we change for the year. 7A 8 is 1960, 7B 8 is 1976, 7C 8 is 1992, 7D 8 is 2008. So the second part of byte 1 is stepped for each 16 years. The first part of byte 2 steps one for each year. 7C 1 is 1985, 7C 2 is 1986 and 7C 3 is 1987.

    XX X- -- => Year


    Finally:

    So to calculate the total value of these three bytes we use this formula:
    Birthdate = (((Hx(year)*Hx10)+Hx(month))*Hx100)+((Hx(day)*Hx8) +Hx3))
    Formula in hex: (year*10+month)*100 + day*8 + 3
    Formula in decimal: (year*16+month)*256 + day*8 + 3

    Example:
    1992-12-31

    1992 = 7C8
    12 = C
    31 = 1F


    (year*10+month)*100 + day*8 + 3
    7C8*10 = 7C80
    7C80+C = 7C8C
    7C8C*100 = 7C8C00
    1F*8 = F8
    F8+3 = FB
    7C8C00 + FB = 7C8CFB
    Excellent work, personally I care more about the age that shows on the roster screen than the birthdate (because you gotta edit the skater to see that)

    Age is a very important part of these games because it determines when a player retires and (I assume) when their attributes degrade.
    Fandom:
    NHL - Vancouver Canucks (since 2011)
    NFL - Green Bay Packers (since 1998)
    NBA - Los Angeles Lakers (since 2004)
    MLB - New York Yankees (since 2004)
    NCAA - Michigan State Spartans (since 2004)
    UFL - Michigan Panthers (since 2023)

    Comment

    • nikethebike
      MVP
      • Aug 2007
      • 1183

      #32
      Re: NHL2K editing (technical discussion)

      Oh man.


      Some of the attributes are stored not at offsets in bytes but in half a byte, so when we edit the file we should not count bytes but half bytes. That is 4 bits. So things are not aligned to be read byte by byte from the file.


      For example jersey number.
      I have found the jersey number to be stored in total a size of a byte.

      However the offset at which it is stored is not an even byte. It is stored in the last 4 bits at byte offset 45 and the first 4 bits at byte offset 46 for a player.


      This makes these attributes a little more complex to edit...
      Last edited by nikethebike; 09-14-2019, 04:53 PM.
      Now go play NHL Two K!

      Download the NHL2K20 roster at:
      http://PlayNHL.TK

      Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

      Comment

      • nikethebike
        MVP
        • Aug 2007
        • 1183

        #33
        Re: NHL2K editing (technical discussion)

        Guys, I have this crazy idea. Might not work and I might be wrong. But I thought I'd share...


        The offset for player names seem to be relative to the actual profile (the section containing attribute data and pointers to strings).
        At the end of every profile there is an area of FF FF... values. I'd say these values are probably not used, only padding. As far as I've seen these are always 30 FF values. Remember what the maximum length of player name strings for a player in the game is? 14 characters! 14 characters plus a 0 to end the string makes 15 characters. 15 + 15 = 30.


        What if, just what if, this was the place where player names were stored before they decided using references to one large string list?
        If this section is not read by the game, we could probably reuse this area for names for every player again, making it way easier to see directly in the file what player data belongs to what player. No need for advanced lookups.



        The only thing we'd need to do is rewrite all player name pointers to use the same two offsets, that would point within the player section.


        Well, this is just a theory, might or might not work. However it would eliminate the problem of overwriting team names or destroying the possibility of creating players or using the ingame editor for strings as we would not use any of the "default" lists to write our names with the editor, we'd just leave them as is and use already reserved unused space within the actual player profile instead.
        Now go play NHL Two K!

        Download the NHL2K20 roster at:
        http://PlayNHL.TK

        Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

        Comment

        • nikethebike
          MVP
          • Aug 2007
          • 1183

          #34
          Re: NHL2K editing (technical discussion)

          Seems I was wrong. Since the game takes 60 bytes to store 30 characters for names as I realized when I saw your code snowdrift, my idea does not work for more than one name. The other area, that you now use snowdrift, I think is where colours of equipment etcetera is stored. But I need to double check.
          Now go play NHL Two K!

          Download the NHL2K20 roster at:
          http://PlayNHL.TK

          Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

          Comment

          • nikethebike
            MVP
            • Aug 2007
            • 1183

            #35
            Re: NHL2K editing (technical discussion)

            Would be nice to find the contract length/value offsets. But I don't know where these are stored and have no idea how I can find them in the profile section since they aren't editable anywhere outside of franchise I believe...


            Any ideas?
            Now go play NHL Two K!

            Download the NHL2K20 roster at:
            http://PlayNHL.TK

            Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

            Comment

            • snowdrift
              Rookie
              • Nov 2016
              • 205

              #36
              Re: NHL2K editing (technical discussion)

              Originally posted by nikethebike
              Would be nice to find the contract length/value offsets.

              In 2K8 that's nowhere near the player data, it's in a separate section. Franchise/Season saves are a larger file size and contain lots of additional data you won't find in a roster save.

              Comment

              • nikethebike
                MVP
                • Aug 2007
                • 1183

                #37
                Re: NHL2K editing (technical discussion)

                Well the default start contract settings must be somewhere in the roster file. Perhaps one can find them by analyzing what changes in a franchise save and then look for similar patterns...
                Now go play NHL Two K!

                Download the NHL2K20 roster at:
                http://PlayNHL.TK

                Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                Comment

                • snowdrift
                  Rookie
                  • Nov 2016
                  • 205

                  #38
                  Re: NHL2K editing (technical discussion)

                  Originally posted by nikethebike
                  Well the default start contract settings must be somewhere in the roster file.

                  Nope. It's hard-coded on the disk. In 2K8 at least. Basically, that section of the file is just read from the disk if it's not found in the save file itself.

                  Comment

                  • nikethebike
                    MVP
                    • Aug 2007
                    • 1183

                    #39
                    Re: NHL2K editing (technical discussion)

                    It is?


                    Considering even text strings are stored on the save file I was sure stuff like that would be in the save somewhere.
                    Now go play NHL Two K!

                    Download the NHL2K20 roster at:
                    http://PlayNHL.TK

                    Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                    Comment

                    • snowdrift
                      Rookie
                      • Nov 2016
                      • 205

                      #40
                      Re: NHL2K editing (technical discussion)

                      Originally posted by nikethebike
                      getPrimaryPosition and getPositionValue in SaveFile swaps R/L-values, am I right or am I misunderstanding something?

                      G-D-L-R-C gives C-L-R-D-G... I think one of them should probably be swapped right?
                      I'll move this here if you don't mind, so people following the other thread don't lose hair scratching their heads...

                      I don't think there's a problem because the numbers aren't incremented at regular intervals in the second case. The numbers go 27, 18, 36.

                      They're out of order on purpose to make the abbreviations easier to follow. We tend to read from left to right, so I usually think left wing first... either L C R or C L R... easier on my brain.

                      Comment

                      • nikethebike
                        MVP
                        • Aug 2007
                        • 1183

                        #41
                        Re: NHL2K editing (technical discussion)

                        A ok. Well, I am still learning the code...


                        Having big problems getting the right values out in the csv files from my new offsets, don't know if the offsets are off. It's probably just me and my "not yet perfected python skills", lol.
                        Now go play NHL Two K!

                        Download the NHL2K20 roster at:
                        http://PlayNHL.TK

                        Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                        Comment

                        • nikethebike
                          MVP
                          • Aug 2007
                          • 1183

                          #42
                          Re: NHL2K editing (technical discussion)

                          At last I succeeded with something!!! LOL.
                          I've just exported the player ingame faces.
                          It seems to be stored in two bytes at offset=190.
                          Now go play NHL Two K!

                          Download the NHL2K20 roster at:
                          http://PlayNHL.TK

                          Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                          Comment

                          • nikethebike
                            MVP
                            • Aug 2007
                            • 1183

                            #43
                            Re: NHL2K editing (technical discussion)

                            Did you have an idea about the overwritten team names snowdrift? The only thing I can think of is to make sure the player names matching team names don't get changed by coding som kind of reserved area that you can't write to that will be skipped when you allocate your strings...
                            Now go play NHL Two K!

                            Download the NHL2K20 roster at:
                            http://PlayNHL.TK

                            Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                            Comment

                            • snowdrift
                              Rookie
                              • Nov 2016
                              • 205

                              #44
                              Re: NHL2K editing (technical discussion)

                              Haven't gotten to work on the program at all. If we knew where the pointer to the team names was, I guess we could just redirect it the same way we edit player names. Maybe it could be figured out by renaming created teams and seeing what changes in the file?

                              Otherwise, we could create a list of specific "protected" addresses (like St. Louis, Dallas) and just write "around" them so they never change. Then we could provide different lists for different versions of the game as needed (360, Wii, etc.). This will only work if the game doesn't ever change the location of the team names.

                              Comment

                              • nikethebike
                                MVP
                                • Aug 2007
                                • 1183

                                #45
                                Re: NHL2K editing (technical discussion)

                                Yeah idea number 2 was the same thing I meant with protected areas. I think that will be the easiest. There's no guarantee created teams are written in the same place as default teams.
                                Now go play NHL Two K!

                                Download the NHL2K20 roster at:
                                http://PlayNHL.TK

                                Discussion: https://forums.operationsports.com/f...s-nhl2k11.html

                                Comment

                                Working...