Hapsby uses external save game definitions to determine what games and game information it can edit. The files are stored in the \hsd\ folder:
Step one to adding support for a new game would be creating a new file (or copying an existing one as a template). The file should be named in the following format:
Game_Title_-_Emulator_Name.hsd.json
Underscores should be used instead of spaces because Hapsby runs on Java which runs on multiple platforms, some of which may not support spaces in file names.
The contents of the file should be in the following format:
{"properties":
[
{
"name":"Lives",
"description":"Number of lives.",
"byteOrder":"LOW_BYTE_FIRST",
"dataType":"TYPE_INTEGER",
"address":1930,
"length":1,
"maxValue":99,
"minValue":1
}
],
"gameTitle":"Super Mario Brothers III (NES .fc#)",
"gameDescription":"FCE Ultra save state for Super Mario Brothers III.",
"saveFilePattern":"*.fc*"
}
What do all these fields mean?
properties: This is an array of properies. This works like any other JSON array.
name: The name of the property, this is what displays in the property list on the Hapsby window.
description: A more verbose description for this property, including any advice on how it works.
byteOrder: For integers this is the order that the bytes are stored in the file. The valid values are LOW_BYTE_FIRST (Little-Endian) or HIGH_BYTE_FIRST (Big-Endian). For strings this is almost always LOW_BYTE_FIRST.
dataType: The valid values are TYPE_INTEGER and TYPE_STRING, most of the time this will be TYPE_INTEGER.
address: The address of the first byte of the value in decimal. Repeat, in decimal. If you are finding addresses in a hex editor you'll need to convert it to decimal.
length: The number of bytes for this value.
maxValue: The maximum value for an integer. The maximum value is not necessarily 2^length. For example, a game may crash if the character gains more than 9,999 experience points even if 65,535 could be put into the save state. Maximum value is ignored for strings.
minValue: The minimum value for an integer, also ignored for strings.
gameTitle: The title of the game.
gameDescription: A more verbose description of the game.
saveFilePattern: The file name (ie. save.dat) or pattern (ie. *.dat) for the save game/save state.