League Data Format
Introduction
HardBall 5 stores league data in .LGD files.
There are multiple parts to a league, including, but not limited to:
- Header
- Section Table
- League Description
- Player Data
- Team Data
- Four different sets of Player Statistics
Header
HardBall 5 league files start with a four byte header:
95 19 10 00. If we presume this is a BCD-encoded date with months
starting at 1, that would give us October 1995.
These values differentiate HardBall 5 league data from HardBall 4 league data.
File offset 4 is a four-byte value pointing to the beginning of the league definition data. All the offsets in the Section Table need this value added to them for the "real" file address.
Section Table
The Section Table data begins at file offset 8, and goes until the beginning of the league definition data (as defined in the previous four bytes).
Each Section Table entry consists of 12 bytes:
- Offset 0: Data Type (1 byte)
- Offset 1: currently unknown usage (1 byte)
- Offset 2: currently unknown usage (1 byte)
- Offset 3: currently unknown usage (1 byte)
- Offset 4: Data Offset, relative to start of league definition data (4 bytes)
- Offset 6: Data Length (4 bytes)
Data Types
- 0x00 – Invalid or Unused
- 0x01 – League Definition
- 0x02 – Team Definitions
- 0x03 – Player Definitions
- 0x04 – unknown, season-related
- 0x05 – related to season schedule?
- 0x06 – related to season games played?
- 0x07 – Player Stats - Historical
- 0x08 – Player Stats - Season
- 0x09 – Player Stats - Weekly
- 0x0A – Player Stats - Lifetime
- 0x0B – unknown
- 0x0C – unknown, season-related
League Definition
This section defines the general league settings.
- Offset 0: League Type (2 bytes). Second byte MUST be
0x00for league to be valid. - Offset 2: Number of Teams in Division (6 bytes)
- Offset 8: Team ID list (28 bytes)
- Offset 0x1C: unknown (8 bytes, possibly multiple values)
Player Data
The player database only includes the general information and rating values for each player. Statistics are stored elsewhere.
- Offset 0: Number of players defined (2 bytes)
- Offset 2: Number of Batters defined (2 bytes)
The number of Pitchers is calculated by subtracting the number of Batters from the total.
Player data is stored with Batters first, followed by Pitchers. Each player type takes up a different amount of space:
- Batters are 0x28 bytes
- Pitchers are 0x2C bytes
Team Data
Team data is stored similarly to Team Export files, with a few differences.
Player Statistics
Four sets of Player Statistics are stored in League files: Historical, Season, Weekly, and Lifetime. Stats are stored in the same order as the player database, so Batters will appear first, followed by Pitchers.
The data is the same length for all possible setups: 0x166 bytes per player.