Return matching clusters in the stock response envelope
Return recognizable regions from fetch_clusters_list and place matching results in data.data. Document the handshake, heartbeat, and EULA requirements. The offline client remains logged in after the cluster reply.
This commit is contained in:
1 parent
5a1fd594e0
commit
ce389c2154
3 files changed
+34
-3
No files matched your search
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* wtmm_static.fetch_clusters_list: the list of server regions ("clusters") the player can
|
||||||
|
* pick for matchmaking.
|
||||||
|
*
|
||||||
|
* The stock UI script asks for it right after the matching sign-in
|
||||||
|
* (gui.vromfs.bin scripts/onlineInfo/clustersManagement.nut, updateClustersList): the answer
|
||||||
|
* must carry a non-empty array "clusters" of cluster names, otherwise the script retries and,
|
||||||
|
* after MAX_FETCH_RETRIES (5), signs the player out — the endless re-login loop seen in lab
|
||||||
|
* run 6. The names are the ones the stock scripts know (scripts/onlineInfo/defaultClusters.nut
|
||||||
|
* maps every country to one of them and preselects it; the UI shows loc "cluster/<name>").
|
||||||
|
*
|
||||||
|
* Everything runs on the player's machine, so the region has no effect on where anything
|
||||||
|
* connects; the list only has to be valid for the stock UI.
|
||||||
|
*/
|
||||||
|
import type { MatchingRequestHandler } from './matching-requests.ts';
|
||||||
|
|
||||||
|
const CLUSTERS = ['EU', 'NA', 'CIS', 'SA'] as const;
|
||||||
|
|
||||||
|
export const fetchClustersList: MatchingRequestHandler = () => ({ clusters: [...CLUSTERS] });
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
* 0x44e9bc0, kind passed to the sender at 0x44ea3b9).
|
* 0x44e9bc0, kind passed to the sender at 0x44ea3b9).
|
||||||
* - The client sorts what it receives by kind (matching::ClientImpl::handleServerPacket,
|
* - The client sorts what it receives by kind (matching::ClientImpl::handleServerPacket,
|
||||||
* 0x44e7540): kind 0x1b goes to the answer queue, handled at 0x44ec4b0, which finds the
|
* 0x44e7540): kind 0x1b goes to the answer queue, handled at 0x44ec4b0, which finds the
|
||||||
* pending request by "id", treats a missing or zero "error" as success and passes "data" on;
|
* pending request by "id", treats a missing or zero "error" as success and passes "data" on
|
||||||
|
* (the result itself is inside it, see answerTo);
|
||||||
* every other kind is a server notification (0x44eab40). Every message needs a "type",
|
* every other kind is a server notification (0x44eab40). Every message needs a "type",
|
||||||
* otherwise the client drops it ("bad message. type not set").
|
* otherwise the client drops it ("bad message. type not set").
|
||||||
*/
|
*/
|
||||||
@@ -62,6 +63,15 @@ export function asRequest(message: MatchingMessage): MatchingRequest | undefined
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function answerTo(request: MatchingRequest, data: Record<string, unknown>): MatchingMessage {
|
/**
|
||||||
return { kind: MessageKind.Answer, json: { id: request.id, type: request.type, data } };
|
* The answer's result sits one level deeper than "data", mirroring the request envelope:
|
||||||
|
* {"id", "type", "data": {"data": <result>}}. The answer handler (0x44ec4b0) passes the
|
||||||
|
* message's "data" to the request's completion wrapper (0x44f1c00, set by the request sender
|
||||||
|
* 0x44e9bc0), which logs "got response on …" and hands that object's own "data" to the
|
||||||
|
* caller; for script requests (matching_call, 0x46e1e70) that is the table the UI script
|
||||||
|
* receives, with "error" added (0x46e5ee0). local verification: a result placed directly in "data"
|
||||||
|
* reached the script as an empty table.
|
||||||
|
*/
|
||||||
|
export function answerTo(request: MatchingRequest, result: Record<string, unknown>): MatchingMessage {
|
||||||
|
return { kind: MessageKind.Answer, json: { id: request.id, type: request.type, data: { data: result } } };
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
* Nothing local checks the credentials (single-player machine); the session key is needed
|
* Nothing local checks the credentials (single-player machine); the session key is needed
|
||||||
* because the client encrypts everything after this request.
|
* because the client encrypts everything after this request.
|
||||||
*/
|
*/
|
||||||
|
import { fetchClustersList } from './cluster-list.ts';
|
||||||
import type { MatchingRequest } from './matching-message.ts';
|
import type { MatchingRequest } from './matching-message.ts';
|
||||||
import { jwtDecryptsWith, unwrapSessionKey } from './session-crypto/session-key.ts';
|
import { jwtDecryptsWith, unwrapSessionKey } from './session-crypto/session-key.ts';
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ export type MatchingRequestHandler = (request: MatchingRequest, session: Matchin
|
|||||||
|
|
||||||
export const MATCHING_REQUESTS: ReadonlyMap<string, MatchingRequestHandler> = new Map([
|
export const MATCHING_REQUESTS: ReadonlyMap<string, MatchingRequestHandler> = new Map([
|
||||||
['mlogin.login', signIn],
|
['mlogin.login', signIn],
|
||||||
|
['wtmm_static.fetch_clusters_list', fetchClustersList],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function signIn(request: MatchingRequest, session: MatchingSessionControl): Record<string, unknown> {
|
function signIn(request: MatchingRequest, session: MatchingSessionControl): Record<string, unknown> {
|
||||||
|
|||||||
Reference in new issue
Block a user