idz: Add implicit version field to requests

This commit is contained in:
Tau
2020-09-26 23:47:43 -04:00
committed by da5669c09fdb0a288ba01e259a609d7779ac7fc9
parent eb276128c2
commit 198256e6ff
33 changed files with 34 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ export function createAutoTeam(buf: Buffer): CreateAutoTeamRequest {
return {
type: "create_auto_team_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
field_0008: buf.readUInt32LE(0x0008),
field_000C: buf.readUInt8(0x000c),
};

View File

@@ -11,6 +11,7 @@ export function createProfile(buf: Buffer): CreateProfileRequest {
return {
type: "create_profile_req",
aimeId: buf.readInt32LE(0x0004) as AimeId,
version: 1,
luid: readAsciiStr(buf, 0x0008, 0x001e),
name: readSjisStr(buf, 0x001e, 0x0034),
field_0034: buf.readUInt32LE(0x0034),

View File

@@ -9,6 +9,7 @@ export function createTeam(buf: Buffer): CreateTeamRequest {
return {
type: "create_team_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
teamName: readSjisStr(buf, 0x0008, 0x0028),
field_0028: buf.readUInt16LE(0x0028),
field_002C: buf.readUInt32LE(0x002c),

View File

@@ -8,5 +8,6 @@ export function discoverProfile(buf: Buffer): DiscoverProfileRequest {
return {
type: "discover_profile_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
};
}

View File

@@ -8,6 +8,7 @@ export function loadGarage(buf: Buffer): LoadGarageRequest {
return {
type: "load_garage_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
fetchOffset: buf.readUInt8(0x0008),
field_000A: buf.readUInt16LE(0x000a),
};

View File

@@ -13,6 +13,7 @@ export function loadProfile2(buf: Buffer): LoadProfileRequest2 {
type: "load_profile_req",
format: 2,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
luid: readAsciiStr(buf, 0x0008, 0x0020),
};
}
@@ -25,6 +26,7 @@ export function loadProfile3(buf: Buffer): LoadProfileRequest3 {
type: "load_profile_req",
format: 3,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
luid: readAsciiStr(buf, 0x0008, 0x0020),
};
}

View File

@@ -8,5 +8,6 @@ export function loadStocker(buf: Buffer): LoadStockerRequest {
return {
type: "load_stocker_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
};
}

View File

@@ -11,6 +11,7 @@ export function loadTeam(buf: Buffer): LoadTeamRequest {
return {
type: "load_team_req",
aimeId: buf.readUInt32LE(0x0004),
version: 1,
teamExtId: extId !== 0xffffffff ? (extId as ExtId<Team>) : undefined,
};
}

View File

@@ -10,6 +10,7 @@ export function saveNewCar(buf: Buffer): SaveNewCarRequest {
return {
type: "save_new_car_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
luid: readAsciiStr(buf, 0x0008, 0x001e),
car: car(buf.slice(0x0020, 0x0080)),
field_0080: buf.readUInt32LE(0x0080),

View File

@@ -47,6 +47,7 @@ export function saveProfile2(buf: Buffer): SaveProfileRequest2 {
type: "save_profile_req",
format: 2,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
lv: buf.readUInt16LE(0x0026),
exp: buf.readUInt32LE(0x0028),
fame: buf.readUInt32LE(0x0468),

View File

@@ -49,6 +49,7 @@ export function saveProfile3(buf: Buffer): SaveProfileRequest2 {
type: "save_profile_req",
format: 2,
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
lv: buf.readUInt16LE(0x0026),
exp: buf.readUInt32LE(0x0028),
fame: buf.readUInt32LE(0x04fc),

View File

@@ -8,6 +8,7 @@ export function saveSettings(buf: Buffer): SaveSettingsRequest {
return {
type: "save_settings_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
dpoint: buf.readUInt32LE(0x0008),
settings: {
music: buf.readUInt16LE(0x0002),

View File

@@ -11,7 +11,7 @@ export function saveStocker(buf: Buffer): SaveStockerRequest {
return {
type: "save_stocker_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
backgrounds: bitmap(buf.slice(0x0008, 0x002c)),
selectedCar: buf.readUInt16LE(0x009c) as CarSelector,
chara: chara(buf.slice(0x009e, 0x00b2)),

View File

@@ -9,6 +9,7 @@ export function saveTeamBanner(buf: Buffer): SaveTeamBannerRequest {
return {
type: "save_team_banner_req",
teamExtId: buf.readUInt32LE(0x0004) as ExtId<Team>,
version: 1,
nameBg: buf.readUInt32LE(0x0008),
nameFx: buf.readUInt32LE(0x000c),
};

View File

@@ -7,6 +7,7 @@ function saveTimeAttack(buf: Buffer): SaveTimeAttackRequest {
return {
type: "save_time_attack_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
dayNight: buf.readUInt8(0x0054) & 1,
payload: {
routeNo: (buf.readUInt8(0x0054) >> 1) as RouteNo,

View File

@@ -11,6 +11,7 @@ export function updateTeamLeader(buf: Buffer): UpdateTeamLeaderRequest {
return {
type: "update_team_leader_req",
aimeId: buf.readUInt32LE(0x0004) as AimeId,
version: 1,
teamExtId: buf.readUInt32LE(0x0008) as ExtId<Team>,
field_000C: readAsciiStr(buf, 0x000c, 0x0020),
};

View File

@@ -11,6 +11,7 @@ export function updateTeamMember(buf: Buffer): UpdateTeamMemberRequest {
type: "update_team_member_req",
action: buf.readUInt8(0x0004) === 0 ? "add" : "remove",
aimeId: buf.readUInt32LE(0x0008) as AimeId,
version: 1,
teamExtId: buf.readUInt32LE(0x000c) as ExtId<Team>,
};
}

View File

@@ -3,6 +3,7 @@ import { AimeId } from "../../../model";
export interface CreateAutoTeamRequest {
type: "create_auto_team_req";
aimeId: AimeId;
version: number;
field_0008: number;
field_000C: number;
}

View File

@@ -5,6 +5,7 @@ import { AimeId } from "../../../model";
export interface CreateProfileRequest {
type: "create_profile_req";
aimeId: AimeId;
version: number;
luid: string;
name: string;
field_0034: number;

View File

@@ -3,6 +3,7 @@ import { AimeId } from "../../../model";
export interface CreateTeamRequest {
type: "create_team_req";
aimeId: AimeId;
version: number;
teamName: string; // len 0x20
field_0028: number; // u16
field_002C: number; // u32 (but only holds a u8)

View File

@@ -3,4 +3,5 @@ import { AimeId } from "../../../model";
export interface DiscoverProfileRequest {
type: "discover_profile_req";
aimeId: AimeId;
version: number;
}

View File

@@ -3,6 +3,7 @@ import { AimeId } from "../../../model";
export interface LoadGarageRequest {
type: "load_garage_req";
aimeId: AimeId;
version: number;
fetchOffset: number;
field_000A: number;
}

View File

@@ -3,6 +3,7 @@ import { AimeId } from "../../../model";
interface LoadProfileRequestBase {
type: "load_profile_req";
aimeId: AimeId;
version: number;
luid: string;
}

View File

@@ -3,4 +3,5 @@ import { AimeId } from "../../../model";
export interface LoadStockerRequest {
type: "load_stocker_req";
aimeId: AimeId;
version: number;
}

View File

@@ -4,5 +4,6 @@ import { Team } from "../model/team";
export interface LoadTeamRequest {
type: "load_team_req";
aimeId: number;
version: number;
teamExtId?: ExtId<Team>;
}

View File

@@ -4,6 +4,7 @@ import { AimeId } from "../../../model";
export interface SaveNewCarRequest {
type: "save_new_car_req";
aimeId: AimeId;
version: number;
luid: string;
car: Car;
field_0080: number;

View File

@@ -10,6 +10,7 @@ import { AimeId } from "../../../model";
interface SaveProfileRequestBase {
type: "save_profile_req";
aimeId: AimeId;
version: number;
lv: number;
exp: number;
fame: number;

View File

@@ -4,6 +4,7 @@ import { AimeId } from "../../../model";
export interface SaveSettingsRequest {
type: "save_settings_req";
aimeId: AimeId;
version: number;
dpoint: number; // ?? why
settings: Settings;
field_0010: number;

View File

@@ -6,6 +6,7 @@ import { AimeId } from "../../../model";
export interface SaveStockerRequest {
type: "save_stocker_req";
aimeId: AimeId;
version: number;
selectedCar: CarSelector;
backgrounds: Set<BackgroundCode>;
chara: Chara;

View File

@@ -4,6 +4,7 @@ import { Team } from "../model/team";
export interface SaveTeamBannerRequest {
type: "save_team_banner_req";
teamExtId: ExtId<Team>;
version: number;
nameBg: number;
nameFx: number;
}

View File

@@ -4,6 +4,7 @@ import { AimeId } from "../../../model";
export interface SaveTimeAttackRequest {
type: "save_time_attack_req";
aimeId: AimeId;
version: number;
dayNight: number;
payload: TimeAttackScore;
field_0002: number; // u16, always 1

View File

@@ -5,6 +5,7 @@ import { AimeId } from "../../../model";
export interface UpdateTeamLeaderRequest {
type: "update_team_leader_req";
aimeId: AimeId;
version: number;
teamExtId: ExtId<Team>;
field_000C: string;
}

View File

@@ -6,5 +6,6 @@ export interface UpdateTeamMemberRequest {
type: "update_team_member_req";
action: "add" | "remove";
aimeId: AimeId;
version: number;
teamExtId: ExtId<Team>;
}