Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- decodeColumnEvalsResponse = (buffer, encoding, logger) ->
- reader = new BufferReader(buffer)
- messageLength = reader.readUInt32LE() & 0x0FFFFFFF
- evalCount = reader.readUInt32LE()
- screenCount = reader.readUInt32LE()
- screens = {}
- # Column eval numbers
- for s in [1 .. screenCount] by 1
- name = reader.readString(encoding)
- reader.align(4)
- columnCount = reader.readUInt32LE()
- columns = []
- for c in [1 .. columnCount] by 1
- columns[c] = reader.readInt32LE()
- screens[name] = {columns}
- # Button eval numbers
- for s in [1 .. screenCount] by 1
- name = reader.readString(encoding)
- reader.align(4)
- # This is actually the count of integers, not buttons, each button has an active and disabled state
- buttonCount = reader.readUInt32LE() # For each button there is BUTTONEVAL_, BUTTONDISABLEVAL_
- buttons = []
- buttonsDisabled = []
- for c in [0 ... buttonCount / 2]
- buttons[c + 1] = reader.readInt32LE()
- buttonsDisabled[c + 1] = reader.readInt32LE()
- screens[name].buttons = buttons
- screens[name].buttonsDisabled = buttonsDisabled
- # State eval numbers
- for s in [1 .. screenCount] by 1
- name = reader.readString(encoding)
- reader.align(4)
- stateCount = reader.readUInt32LE()
- states = []
- for c in [1 .. stateCount] by 1
- states[c] = reader.readInt32LE()
- screens[name].states = states
- return {
- message: new ColumnEvalsResponse {screens, evalCount}
- consumed: messageLength
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement