Repository navigation
Protocol
The appserver speaks haxe.remoting over HTTP. The outer stream is the Haxe standard serializer; entity payloads use hxInflate.
| Item | Value |
|---|---|
| Request | POST {AppServerURL}/remoting/<conn>/<op> |
| Body |
application/x-www-form-urlencoded, single field __x
|
__x value |
na + serialized argument array + h
|
| Headers |
x-haxe-remoting: 1, x-hns-clientversion: HNS-release.2.7.31, Accept: */*, UA game=hns, engine=UE4, version=4.11.2-0+UE4
|
| Private plane |
/remoting-pvt/<conn>/<op> + X-HNS-Auth: Shared-256: <hmac>; needs HNS_SHARED_KEY (FUN_14056e100) |
| Reply |
hxr + serialized body, text/plain
|
| Compression | none; zlib/deflate (GUL_COMPRESS) unused |
POST /remoting/appserver/startSession
__x=naoy17%3AtrackingSessionIDy32%3A107F70544DC5B2029BAE59B8F38F17BFy3%3Adrmjy25%3Amodel.service.drm.DRMType%3A3%3A1y8%3Arestrea1y11%3AcountryCodey0%3Agh
Decoded: na, one anonymous object o…g with keys trackingSessionID, drm
(enum instance), countryCode, then h. No arguments: __x=nah.
A reply carries two values: echo and result.
hxr <value 1> <value 2>
- Value 1 is
n(null) in every accepted reply and is discarded. AVdeclaration there pre-fills the session type table. - Value 2 is a
model.Result:w…model.Result…Success:1<value>or…Error:1<value>; both constructors take the payload.
nwY12:model.ResultY7:Success:1VY42:appserver.remoting.DataStoreUpdateResponse:i-1:i0:i0:3:Y15:updatedEntitiesY14:entityTypeInfoY9:returnVal:ahY0:oY9:sessionIDY2:s1gg
V: base -1, version 0, custom 0, 3 fields; updatedEntities empty (branch A);
returnVal = oY9:sessionIDY2:s1g.
Omitting value 1 is a hard failure: LoginGameMode.hx:403: Invalid char, the second read stepping
past the body end. A bare DataStoreUpdateResponse reply fails this way; affected ops:
startSession, checkVersion, clientHeartbeat, getConfig, getOpenServer, getServerIp.
giveEndOfMatchRewards (declared on the private proxy, observed on the /remoting/appserver/ mount
under a redirect patch) answers Result.Success(<empty array>) inside the datastore envelope. Its
callback walks the array per player state and reads a rewards object out of each entry without a
null guard, so an object payload (or a missing entry) leaves the walk with a null pointer; the
array shape is part of the contract.
The client keeps one ModelWatcher long-poll per PGS resource, all on the same shape:
GET {pgs}<resource>/<id>/updates/<stamp> -> {"<resource>": [ {…} ]}
The request side shares a single /updates literal (0x142e67570); the resource prefix and the
callback that runs on each delivered update identify the watcher. The reply side is looked up by the
resource's plural name: each reply is read through that resource's accessor, and the accessor does
a dynamic field lookup with the plural key, then takes element 0.
| Resource | Reply key | Accessor | Update callback |
|---|---|---|---|
users |
users (0x142e6ca08) |
getFirstUser (0x142f47290) |
onUserUpdate (0x142e67608) |
parties |
parties (0x142e6a7f0) |
getFirstParty (0x142f47210) |
onPartyUpdate (0x142e67880) |
channels |
channels (0x142eb7de0) |
getFirstChannel (0x142f472c8) |
onChannelUpdate (0x142f7db78) |
polls |
polls (0x142f47248) |
getFirstPoll (0x142f47250) |
onVoteUpdated (0x142f39938) |
wagers |
wagers (0x142f47268) |
getFirstWager (0x142f47270) |
onUpdateWagers (0x142f02000) |
bingos |
bingos (0x142f47228) |
getFirstBingo (0x142f47230) |
onBingoUpdate (0x1430428f8) |
flash_sales |
flash_sales (0x142f472a8) |
— |
onFlashSaleUpdated (0x142f38b38) |
scoreboards |
scoreboards (0x142f472e0) |
— | — |
Two consequences for a server:
- A reply under the wrong key is not an error the client reports; the accessor simply reads null, so
the watcher behaves as if nothing arrived. A server that answers every
/updatesleg with ausersarray leaves every watcher except the user one permanently empty. - The list must stay non-empty. For the user watcher an empty or missing array is documented as an error that restarts the watcher every 10 s (Login).
Watchers start in different places: the user watcher at login, the party watcher when active_party
is non-empty, the channel watcher on the broadcast path (m_channelWatcher 0x142f7dd38, beside
onChannelUpdate and checkCanBroadcast). The cursor field is update_stamp on the user model; the
equivalent field on the other models is not established.
A reply's two-value envelope carries Result with a constructor index at +0x1C in the deserialised form:
1 is Success, 0 is Error, and values ≥ 2 are ignored by the handlers that switch on it. The
payload (returnVal, at +0x20) is only read on the branch that needs it, so a handler that never touches
it cannot be damaged by an empty DataStoreUpdateResponse.
refreshPlayer is the clearest example: the client calls POST …/appserver/refreshPlayer with no arguments
from the awards screen, and the continuation (0x140BE6F40) does nothing with a Success payload except set
one byte (this+0x42) and return; it stringifies the payload only on the Error branch
(error while trying to refresh player: …). Answering with Result.Success(<empty DSUR>) is therefore
correct for this leg, and a null reply would fault where the handler reads the tag. Player state does not
refresh through this reply on this build — it has to arrive on the datastore-push leg or another operation.
model.Result:
| field | offset | meaning |
|---|---|---|
| vtable | +0x00 |
Result_obj |
| name |
+0x08 / +0x10
|
inline String (Error / Success) |
| index | +0x18 |
Error writes an 8-byte store here, clearing +0x1c
|
| tag | +0x1c |
0 = Error, 1 = Success
|
| payload | +0x20 |
wrapped value (r+0x20 is what consumers read) |
FUN_1408ebde0 (Error) clears +0x1c; FUN_1408ebf00 (Success) sets +0x1c = 1.
Consumers read [rcx+0x1c]; tag 0 and a null payload take the error path.
appserver.remoting.DataStoreUpdateResponse fields, in order: updatedEntities, entityTypeInfo,
returnVal. Branch-B consumer FUN_1411f7750:
1411f7822 CMP [RCX+0x8],0 ; element's first field length
1411f7825 JLE 1411f7a91 ; length < 1 → branch A
1411f7844 MOV ECX,[RAX+0x10] ; element +0x10 = String length
1411f7852 MOV RCX,[RAX+0x18] ; element +0x18 = String pointer
1411f7862 CALL 0x14120e490 ; StringInflateStream(text, 0, -1, skipHeader=1, …)
| branch | condition | behaviour |
|---|---|---|
| A | updatedEntities.length < 1 |
deliver Success(returnVal) unchanged; entityTypeInfo not read |
| B | non-empty | element [0]'s inline String (+0x10/+0x18) inflated; entities pushed into SessionDataStore; returnVal not delivered |
Branches are mutually exclusive; op-level selection is required (GUL_DSUR_B_OPS). The
selector is the element's first field array length; the stream is that same element's inline
String at +0x10/+0x18, not the outer entityTypeInfo.
Anonymous objects are hash-laid-out; positional reads at +0x10 miss their fields. The
element must be a declared class instance (V… + T<idx>:…g) whose first field is an array and
whose string sits at +0x10/+0x18. Wrong shapes yield Invalid char {, Invalid char 1 or
version was 0.
V <name-as-serialized-value> : <base> : <version> : <custom> :
[if custom == 0] <fieldCount as RAW DIGITS> : <field name> … :
-
baseis serialized as a value (i-1).base = -1is the base-walk exit sentinel.base = 0on the first entry of a fresh table walks forever;FUN_141036c60walkstypeTable[base]whiletype+0x40 == 0 && type+0x48 == 0(Login). -
versionis a zero (i0orz; DSUR usesi0, theModelEntitycachez);customisz/i0/t. -
custom = true(hxSerialize/hxUnserialize) means no field list; the body is whateverhxUnserializereads, terminated byg. -
fieldCountis raw digits:3:, noti3. The reader loops digits then requires:, elseInvalid type format (fields). A non-custom class's count is its body arity. - Instances are
T<idx>:<values>g;idxis the declaration's position in the response table.
Strings are y<len>:<urlencoded> with -_.!~*'() safe (Haxe urlEncode). The first occurrence
enters the response string table; later occurrences are R<idx> back-references in wire order.
Ordering is load-bearing: serializing the context payload before the Result/Success prefix shifts
the table by two: playerIID emitted as R15 resolves to accounts, producing
accounts not in the datastore. Order: enum prefix, declarations, payload.
Format: proletariatgames/hxinflate (haxelib hxInflate), a fork of the Haxe std serializer.
if (getField(options,"skipHeader")) version = 3;
else { read 4 bytes; if == "ZVER" version = readDigits(); else { seek back; version = 0; } }| Stream | Role | Header |
|---|---|---|
entityTypeInfo |
external type cache — type-info tokens, in practice the declarations the elements reference | must start ZVER3
|
updatedEntities[i] |
one independently serialized object |
skipHeader = true, no ZVER
|
Both streams carry a purpose value after the header (offset 0 when skipped); the mock sends
purpose = "game" (GUL_DSUR_HX_PURPOSE); n is tolerated.
Token alphabet (Deflater.hx):
values n null t/f bool z 0 i<int> d<float> k/m/p NaN/-inf/+inf
y<len>:<url> string R<idx> ref a…h array (u<n> null runs) o…g object
q…h IntMap (raw digit keys) b…h StringMap l…h list r<idx> obj ref
s bytes v date w/j enum x exception
typeinfo V final type W base type T<idx>: cached ref | enum info
= enum value info _<idx>: cached enum Y raw string R<idx> ref S skipped (v3)
decl V name : base : version : custom : count : fields :
body one value per field (or hxUnserialize's own reads), then g
ZVER3 y4:game V y24:model.entity.ModelEntity i-1 z t y7:player1 …
Header, purpose as a serialized value (y4:game, or n), then V for ModelEntity,
custom = true, no field list. A cache without ZVER3 gives
Type inflater version was 0, but ours is 3; an outer-dialect token inside it gives
unexpected code in typeinfo.
Two forms, both reaching the constructor-by-name reader FUN_140e709e0:
| form | shape | validation |
|---|---|---|
w |
w<class><ctor>:<argc><args…> |
none beyond parse |
j |
j<class>:<idx>:<argc><args…> |
declares arity; mismatch throws |
The numeric index of j is not validated for UrlAction or model.Result; resolution is by
name. Digits after the name are the argument count (Success:1 = one argument). The
discriminator switched on is at +0x1c, written by that constructor's factory.
UrlAction tags (written by each factory, not declaration order):
| tag | constructor | args | behaviour |
|---|---|---|---|
| 0 | UJoinGame |
1 (object) | travel to host:port
|
| 1 | UNoGame |
0 | "no game" banner |
| 2 | UHostConnected |
1 (String) | party-join UI |
| 3 | UAccessDenied |
0 | error banner |
| 4 | UGameForbidden |
0 | error banner |
| 5 | UExternalNotAllowed |
0 | error banner |
| 6 | UProcessed |
1 ({title,message}) |
info dialog |
UJoinGame's factory writes its arity with a qword store at +0x18, zeroing +0x1c; its tag is
0 rather than a value it sets.
processUrl is a public-plane op, so its Success payload must be a DataStoreUpdateResponse (branch A)
whose returnVal is the UrlAction. A bare Result.Success(UrlAction) fails the consumer's dyncast
before the handler and dereferences null.