HS Format (Major Stryker)

From ModdingWiki
Jump to navigation Jump to search
HS Format (Major Stryker)
Format typeConfiguration
StoringScores
Games

The Major Stryker high score format is used to store the top ten scores in Major Stryker.

File format

Header

The file begins with a single byte checksum in order to prevent tampering. The checksum is generated by summing most of the bytes in the high score file into a byte value, and throwing away the overflow. The first byte (the checksum itself) and the last two bytes of the file are excluded from this sum. The same algorithm is used to calculate the checksum of the Major Stryker Save Game Format.

Data type Name Description
BYTE checksum Checksum of the file.

Data

The data consists of a list of ten scores.

Data type Name Description
CHAR[...] score Player's score. Space (0x20) terminating.
CHAR[...] name Player's name. \r\n (0x0D, 0x0A) terminating. Maximum 12 characters.

Footer

The list contains an eleventh score which is really just an unnecessarily long end of file marker.

Data type Name Description
CHAR[5] score Always "1000". Space (0x20) terminating.
CHAR[2] name Always "..". \r\n (0x0D, 0x0A) terminating.

Code

This FreeBASIC program will generate a new high score file with whatever names and scores you like, and prefix the proper checksum header.

' Major Stryker High Score Generator.
' ------------------------------------------
' This program generates a high score file 
' with the proper checksum value.

' Declare work variables.
Dim Table As String
Dim File As String
Dim Checksum As Byte

' Change this file path to the location of your Major Stryker high score file.
File = "D:\Documents\Games\Stryker\HS.MS1"

' Generate the high score list.
' Change any of the scores and names to the value you desire, 
' but keep your scores less than 7 digits and your names 
' less that 12 characters long.
Table = ""
Table = Table + "50000    Hudson   " + Chr(13) + Chr(10)
Table = Table + "45000 Hicks D.    " + Chr(13) + Chr(10)
Table = Table + "40000 Vasquez J.  " + Chr(13) + Chr(10)
Table = Table + "35000 Bishop L.   " + Chr(13) + Chr(10)
Table = Table + "30000 Apone A.    " + Chr(13) + Chr(10)
Table = Table + "25000 Spunkmeyer  " + Chr(13) + Chr(10)
Table = Table + "20000 Dietrich C. " + Chr(13) + Chr(10)
Table = Table + "15000 Wierzbowski " + Chr(13) + Chr(10)
Table = Table + "10000 Berk C.     " + Chr(13) + Chr(10)
Table = Table + "5000 Ripley E.   " + Chr(13) + Chr(10)
Table = Table + "1000 .." + Chr(13) + Chr(10)

' Generate the checksum.
' The checksum simply adds the ASCII value of each character in the high 
' score file to a byte value, while throwing away the overflow.

' The checksum value is salted with 233 to make it harder to reverse 
' engineer. But that didn't stop me! ;-)
Checksum = 233

' Sum up each character in the file.
Dim X As UShort
For X = 1 To Len(Table)
    Checksum = Checksum + Asc(Mid(Table, X, 1))    
Next X

' Attach the checksum to the front of the high score list.
Table = Chr(Checksum) + Table

' Delete the high score file if it already exists.
Kill File

' Open the high score file, store the new list, and save it.
Open File For Binary As #1
Put #1, , Table
Close #1

Credits

This high score format was reverse engineered by TheAlmightyGuru. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)