Skip to content

Instantly share code, notes, and snippets.

@luckydonald
Last active December 13, 2018 01:41
Show Gist options
  • Save luckydonald/d128fe05acdfff76d8be to your computer and use it in GitHub Desktop.
Save luckydonald/d128fe05acdfff76d8be to your computer and use it in GitHub Desktop.
Fallout 4 Protocol description

luckydonald/JavaPipBoyServer/PROTOCOL.md Now summarizes this and other findings, and is generally more maintainend.

C Structs

struct Entry {
  uint8_t type;
  uint32_t id;
  switch (type) {
    case 0:
      uint8_t boolean;
      break;
    case 1:
      sint8_t integer;
      break;
    case 2:
      uint8_t integer;
      break;
    case 3:
      sint32_t integer;
      break;
    case 4:
      uint32_t integer;
      break;
    case 5:
      float32_t floating_point;
      break;
    case 6:
      char_t *string; // zero-terminated
      break;
    case 7: // list
      uint16_t count;
      uint32_t references[count];
      break;
    case 8:
      uint16_t insert_count;
      DictEntry[insert_count];
      uint16_t remove_count;
      uint32_t references[remove_count];
      break;
  }
};

struct DictEntry {
      uint32_t reference;
      char_t *name; // zero-terminated
};
//size 1 is a byte (00 - FF)
var DATA_UPDATE_TYPES = { // length : details
  0: 'BOOL', // 1: true if non zero
  1: 'INT_8', // 1: signed
  2: 'UINT_8', // 1: unsigned
  3: 'INT_32', // 4: signed
  4: 'UINT_32', // 4: unsigned
  5: 'FLOAT', // 4: float
  6: 'STRING', // n: null terminated, dynamic length
  7: 'ARRAY', // 2: element count; then $n 4 byte nodeId
  8: 'OBJECT', // 2: element count; then $n 4 byte nodeId with null terminated string following; then 2: removed element count; then $n 4 byte removed nodeId with null terminated string following
};

source

Types

T C-Type Bytes Java Values
0 BOOL 1 bool 0: false 1: true
1 INT_8 1 byte [0x00-0xFF]
2 UINT_8 1 ? [0-255]
3 INT_32 4 int [0x00000000-0xFFFFFFFF]
4 UINT_32 4 ? [0-4294967295]
5 FLOAT 4 float
6 STRING n String Null-Terminated. Encoding?
uint_16 2 short [0-65535] or [0x0000-0xFFFF]
  • 0: BOOL 1: true if non zero
  • 1: INT_8 1: signed
  • 2: UINT_8 1: unsigned
  • 3: INT_32 4: signed
  • 4: UINT_32 4: unsigned
  • 5: FLOAT 4: float
  • 6: STRING n: Null terminated (\0). What encoding is used? ASCII?
  • 7: LIST 2+(n*4): element count; then $n 4 byte nodeId
  • 8: DICT 2+(a*4)+2+(b*4): 2 element count; then $n 4 byte nodeId with null terminated string following; then 2: removed element count; then $n 4 byte removed nodeId with null terminated string following
  • The checkboxes marks if it is already implemented in my Java Server

Diagram

fallout4

Random notes

socketReceiveTimeoutMs = 10000;
socketSendTimeoutMs = 3000;
  • All Strings are UTF-8.

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment