round-trip settings load/save (ish)

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 615bb9b2d7
commit d14aea2a4a
6 changed files with 57 additions and 27 deletions
+11 -9
View File
@@ -11,17 +11,19 @@ export function saveSettings(buf: Buffer): SaveSettingsRequest {
return {
type: "save_settings_req",
bgMusic: buf.readUInt16LE(0x0002),
profileId: buf.readUInt32LE(0x0004),
dpoint: buf.readUInt32LE(0x0008),
forceQuitEn: ((pack >> 0) & 1) !== 0,
steeringForce: (pack >> 1) & 15,
bgVolume: (pack >> 5) & 15,
seVolume: (pack >> 9) & 15,
cornerGuide: ((pack >> 13) & 1) !== 0,
lineGuide: ((pack >> 14) & 1) !== 0,
ghostEn: ((pack >> 15) & 1) !== 0,
taResultSkip: ((pack >> 16) & 1) !== 0,
settings: {
bgMusic: buf.readUInt16LE(0x0002),
forceQuitEn: ((pack >> 0) & 1) !== 0,
steeringForce: (pack >> 1) & 15,
bgVolume: (pack >> 5) & 15,
seVolume: (pack >> 9) & 15,
cornerGuide: ((pack >> 13) & 1) !== 0,
lineGuide: ((pack >> 14) & 1) !== 0,
ghostEn: ((pack >> 15) & 1) !== 0,
taResultSkip: ((pack >> 16) & 1) !== 0,
},
field_0010: buf.readUInt8(0x0010),
field_0011: buf.readUInt8(0x0011),
field_0012: buf.readUInt8(0x0012), // always 5 for some reason