From 457200e5b68c8c6e538bc0ad98de52c2c545b356 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 17 Nov 2015 13:05:16 -0800 Subject: [PATCH 1/6] Add document describing message spec --- README.md | 4 ++ msg-spec.md | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 msg-spec.md diff --git a/README.md b/README.md index 87e0553..aaa7a7a 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ npm install pipboylib In order for the utilities provided here to work, you'll need a running Fallout 4 game with the pip-boy app enabled. In order to do the full relay, you'll also want the mobile app running. +## Message spec + +[App to game](msg-spec.md) + ## TODO * [X] UDP Autodiscovery of PS4 pip boy servers on PS4 [Bronze] diff --git a/msg-spec.md b/msg-spec.md new file mode 100644 index 0000000..f229797 --- /dev/null +++ b/msg-spec.md @@ -0,0 +1,130 @@ +# Basic Structure + +TCP messages from the app to the console are ASCII encoded JSON strings of the form: + +```json +{"type":,"args":,"id":} +``` + +An example of this: + +```json +{"type":6,"args":[-71774.303255814,87841.2072351421,false],"id":11} +``` + +It appears that the app sends the console messages twice. It's unknown if this +is intentional or not. + +## Arguments +### type + +**integer** used to represent the type of the message + +### args + +**array** array of arguments, of any type, to pass to the handler + +### id + +**integer** starting at 1 and incrementing by one for each message sent + + +## Oddities + +Sometimes the JSON messages are prefixed with some binary data. An example of +this follows: + +```json +0x22 0x00 0x00 0x00 0x05 {"type":12,"args":[50308],"id":34} +``` + +### Theory A +`0x22` is `34`, which is the length of the ASCII contents that follows the binary +contents. `0x00000005` is 5, it's unknown what this stands for. + + +# Messages +Messages are by their **id** and nickname below. + +## **6** Set waypoint + +Sets a waypoint on the world map. + +### args +*longitude?* **double** +*latitude?* **double** +*?* **boolean** + +### Example + +```json +{"type":6,"args":[-71774.303255814,87841.2072351421,false],"id":11} +``` + + +## **9** Fast travel + +Fast travel to a location + +### args +*locationId* **integer** + +### Example + +```json +{"type":9,"args":[48363],"id":15} +``` + + +## **13** Toggle local map view + +Changes the map to/from world view from/to local view + +### args +none + +### Example + +```json +{"type":13,"args":[],"id":18} +``` + + +## **12** Toggle a radio station + +Toggles a radio station + +### args +*ID* **integer** Station ID + +### Known station IDs + +ID | Name +----- | ------------- +50313 | Diamond city +50308 | Classical + +### Example + +```json +{"type":12,"args":[50308],"id":34} +``` + + +## **1** Drop item + +Drop an item from the player's inventory + +### args +*?* **integer** +*pageIndex?* **integer** +*?* **integer** +*items?* **integer[]** + +### Example + +The following is an example of the item at index 0, a fedora, inside the apparel page (page index 1), getting dropped: + +```json +{"type":1,"args":[4207600413,1,0,[0]],"id":56} +``` From 344859d5f45647bd3c6ab91ba980971d7c1f83c2 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 17 Nov 2015 13:07:26 -0800 Subject: [PATCH 2/6] GitHub's formatting is killing me it's so ugly! --- msg-spec.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/msg-spec.md b/msg-spec.md index f229797..56e4fee 100644 --- a/msg-spec.md +++ b/msg-spec.md @@ -2,7 +2,7 @@ TCP messages from the app to the console are ASCII encoded JSON strings of the form: -```json +``` {"type":,"args":,"id":} ``` @@ -46,7 +46,7 @@ contents. `0x00000005` is 5, it's unknown what this stands for. # Messages Messages are by their **id** and nickname below. -## **6** Set waypoint +## **6**: Set waypoint Sets a waypoint on the world map. @@ -62,7 +62,7 @@ Sets a waypoint on the world map. ``` -## **9** Fast travel +## **9**: Fast travel Fast travel to a location @@ -76,7 +76,7 @@ Fast travel to a location ``` -## **13** Toggle local map view +## **13**: Toggle local map view Changes the map to/from world view from/to local view @@ -90,7 +90,7 @@ none ``` -## **12** Toggle a radio station +## **12**: Toggle a radio station Toggles a radio station @@ -111,7 +111,7 @@ ID | Name ``` -## **1** Drop item +## **1**: Drop item Drop an item from the player's inventory From e587a47cb483852311e651238fbafd4ceed434cc Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 17 Nov 2015 13:09:02 -0800 Subject: [PATCH 3/6] More formatting fixes.... --- msg-spec.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/msg-spec.md b/msg-spec.md index 56e4fee..a830b60 100644 --- a/msg-spec.md +++ b/msg-spec.md @@ -51,9 +51,9 @@ Messages are by their **id** and nickname below. Sets a waypoint on the world map. ### args -*longitude?* **double** -*latitude?* **double** -*?* **boolean** +- *longitude?* **double** +- *latitude?* **double** +- *?* **boolean** ### Example @@ -67,7 +67,7 @@ Sets a waypoint on the world map. Fast travel to a location ### args -*locationId* **integer** +- *locationId* **integer** ### Example @@ -95,7 +95,7 @@ none Toggles a radio station ### args -*ID* **integer** Station ID +- *ID* **integer** Station ID ### Known station IDs @@ -116,10 +116,10 @@ ID | Name Drop an item from the player's inventory ### args -*?* **integer** -*pageIndex?* **integer** -*?* **integer** -*items?* **integer[]** +- *?* **integer** +- *pageIndex?* **integer** +- *?* **integer** +- *items?* **integer[]** ### Example From 7220e61b44cec0703eb55f3b4c1ab185bc0dceb9 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Sun, 22 Nov 2015 12:30:30 -0600 Subject: [PATCH 4/6] Move the message spec into a docs dir --- msg-spec.md => docs/msg-spec.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename msg-spec.md => docs/msg-spec.md (100%) diff --git a/msg-spec.md b/docs/msg-spec.md similarity index 100% rename from msg-spec.md rename to docs/msg-spec.md From bb132bd2d929fd3f4af3899f733212fb5ca37e57 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Sun, 22 Nov 2015 12:36:47 -0600 Subject: [PATCH 5/6] Comment on the header field. --- docs/{msg-spec.md => app-msg-spec.md} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename docs/{msg-spec.md => app-msg-spec.md} (91%) diff --git a/docs/msg-spec.md b/docs/app-msg-spec.md similarity index 91% rename from docs/msg-spec.md rename to docs/app-msg-spec.md index a830b60..d76e2d3 100644 --- a/docs/msg-spec.md +++ b/docs/app-msg-spec.md @@ -1,4 +1,4 @@ -# Basic Structure +# App to Console structure TCP messages from the app to the console are ASCII encoded JSON strings of the form: @@ -39,8 +39,8 @@ this follows: ``` ### Theory A -`0x22` is `34`, which is the length of the ASCII contents that follows the binary -contents. `0x00000005` is 5, it's unknown what this stands for. +`0x22000000` is little-endian `34`, which is the length of the ASCII contents that follows the binary +contents. `0x05` is 5, which seems to be a type/id. # Messages From 8be13ceef9b6819c5a77c4566387493b0d48d985 Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Sun, 22 Nov 2015 12:43:14 -0600 Subject: [PATCH 6/6] Create documentation section. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aaa7a7a..b50b656 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,11 @@ npm install pipboylib In order for the utilities provided here to work, you'll need a running Fallout 4 game with the pip-boy app enabled. In order to do the full relay, you'll also want the mobile app running. -## Message spec +## Documentation -[App to game](msg-spec.md) +As we figure out the spec we'll document what we can over in [docs](docs): + +* [App to Server Message Spec](docs/app-msg-spec.md) ## TODO