Decoding .REC Files (Emu, 2k11)

Collapse

Recommended Videos

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SQNNET
    Rookie
    • Jun 2023
    • 10

    #1

    Decoding .REC Files (Emu, 2k11)

    Hey all, recently have started messing around with emulated 2K11 with intention to get an old sim league of mine back up and running. I have the roster editing CLI tool up and running, which saves SO much time when it comes to updating attributes while also making it feasible to do so programmatically.

    One of the other huge headaches that comes with running the league is recording stats, which child me did by hand. Be it on sheets of paper or Excel spreadsheets, I would literally just write down the stats I wanted to keep and call it a day.

    I know that 2k11 actually keeps box score records under the Features section of the menu, where you can browse games previously played in Quick Play and see how they turned out. I've noticed the presence of a "Game Re1.REC" file in the same location as the Roster and Settings files, and I'm wondering if that would have everything I need in order to parse through games programmatically.

    So all of that to pose two questions: what do we know about .REC files, and how did we go about decoding the .ROS files when that CLI tool was made? If .REC files work in a similar fashion, it would be pretty easy to just decode the .REC files and parse whatever information I want to keep.
    I'd love if this site was updated enough to let me use a VGK logo as my avatar.
  • nikethebike
    MVP
    • Aug 2007
    • 1183

    #2
    Re: Decoding .REC Files (Emu, 2k11)

    I figured out that the first four bytes in the roster file is a checksum calculated on the rest of the file (not the checksum itself ofcourse).
    Here is python code used to calculate and write it. I hope you can figure out the blanks.

    Code:
        #############################################
        # Calculates checksum of a file except beginning checksum
        def calculateChecksum(self):
            buffersize = 65536
            with open(self.absPathToFile, 'rb') as afile:
                afile.read(4) #do not read the old checksum value
                buffr = afile.read(buffersize)
                crcvalue = 0
                while len(buffr) > 0:
                    crcvalue = zlib.crc32(buffr, crcvalue)
                    buffr = afile.read(buffersize)
            return crcvalue
        
        #############################################
        # Calculates and stores checksum at the beginning of a file
        def writeChecksum(self):
            checksum = self.calculateChecksum()
            valueAsBytes = checksum.to_bytes(4, "big", signed=False)
            self.writeAt(0, valueAsBytes)
    Last edited by nikethebike; 07-05-2023, 03:55 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

    • SQNNET
      Rookie
      • Jun 2023
      • 10

      #3
      Re: Decoding .REC Files (Emu, 2k11)

      So I should have known this before rushing to a .REC conclusion-- the "box scores" under the Features tab that I'm looking for are actually stored in the corresponding .ROS file. Which means the information I'm after is somewhere in that file, as well.

      Is there a TL;DR of how the roster CSV extraction works? Do we just know exactly which bytes contain player information and look only at those? Somewhere within that file is the information I'm looking to extract, which should be a good thing since there's already some knowledge surrounding it.
      I'd love if this site was updated enough to let me use a VGK logo as my avatar.

      Comment

      • MuzzUK
        Rookie
        • Dec 2016
        • 130

        #4
        Re: Decoding .REC Files (Emu, 2k11)

        DJ Neo who made the NHL 2K11 mod 2KHS and 2KHS lite might be worth having a chat with he knows the game very well.
        https://discord.gg/BeCHnu86 Project 20s 2K10 MOD

        Comment

        Working...