Replay Custom Data Format - frto027/HeartBeatQuest GitHub Wiki
The mod records hearts data to the BeatLeader replay file with mod ID HeartBeatQuest. For compatibility reasons, HRCounter also uses this mod ID.
Little endian, 4-byte int, 4-byte float, string(length+bytes), which follows the BSOR format
version - int, the value is always 1
dataCount - int, how many {time, heartRate} data points we have later
{ - heart rate data, repeat dataCount times
time - float, timestamp
heartRate - int, heart rate data
}
heartRateDeviceName - string(4b-length int, follows length-bytes content), a utf-8 format byte array
- The remaining data may not exist in the replay file; check the replay custom data length before reading it.
hrAgent - string, just like 'user agent' for a browser, describes what the heart rate mod is. e.g. the mod name and mod version
- For future compatibility, you should assume that there may be more data in the replay file.
If you have any ideas/questions about the record data, please contact me.
the version number will not bump unless any existing field is changed/removed from the define.
If this number is not 1, you should not read the remains data. Your reader need update.
The HeartBeatQuest mod reads the timestamp from audioTimeSyncController->songTime, in seconds.
For the HeartBeatQuest mod:
- HeartBeatQuest does not post-process the heart data. The heart data is recorded even if it is not changed since last device report. The "time" refers to the song time when the mod received the data.
For the HeartBeatQuest mod:
- The Bluetooth device will record this as their own device name.
- Other data sources have no device name and are recorded as
<osc>,<hyperate>,<pulsoid>,<lan> - If the user disables the device name upload in mod config, the name will be
<hidden> - If the mod can't know the device name, it will be
<unknown>. This usually doesn't happen.
In most cases, no special handling is required. The Bluetooth device name is recorded using Modified UTF-8 encoding comes directly from JavaVM.
The string is encoded to standard UTF-8 format. Be careful because you need handle embbed '\0' byte if needed, or large unicode values.
Important
Always add this when you are recording
If you are developing a mod that reuses the HeartBeatQuest custom data ID and the structure for convenience, you MUST add a hrAgent to tell the reader that you are not the early version of the HeartBeatQuest mod. This value also tells the reader how to fix the data if your recorder has any bugs or unique behaviour, so please avoid using fake hrAgent.
This string in the record file helps you identify the mod name and version that records the data.
This field does not exist.
You can assume that heart data without this field comes from earlier versions of HeartBeatQuest.
The value looks like HeartBeatQuest/0.3.6 (bs_1_40_8), where 0.3.6 is the mod version and bs_1_40_8 is the build target game version.
-
beatleader 21925389 Recorded by HeartBeatQuest, earlier than v0.3.5, without
hrAgent. -
beatleader 27677169 Recorded by HeartBeatQuest v0.3.6, with
hrAgent. There is a game pause in this replay.