idz: Split/fix "generic" response encoding

This commit is contained in:
BemaniWitch 2021-02-03 18:14:22 -05:00 committed by Tau
parent 3cdfef2ea8
commit 59ec2bf576
2 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import { GenericResponse } from "../response/generic";
export function generic(res: GenericResponse) {
export function generic1(res: GenericResponse) {
const buf = Buffer.alloc(0x0020);
buf.writeInt16LE(0x0001, 0x0000);
@ -8,3 +8,15 @@ export function generic(res: GenericResponse) {
return buf;
}
export function generic2(res: GenericResponse) {
const buf = Buffer.alloc(0x0030);
buf.writeInt16LE(0x0001, 0x0000);
buf.writeInt32LE(res.status || 0, 0x0004);
// write the AIME ID for createProfile in 2.12, kinda awkward but whatever.
buf.writeInt32LE(res.status || 0, 0x0008);
return buf;
}

View File

@ -10,7 +10,7 @@ import { checkTeamName1, checkTeamName2 } from "./checkTeamName";
import { createProfile1, createProfile2 } from "./createProfile";
import { createTeam1, createTeam2 } from "./createTeam";
import { discoverProfile1, discoverProfile2 } from "./discoverProfile";
import { generic } from "./generic";
import { generic1, generic2 } from "./generic";
import { lockProfile1, lockProfile2 } from "./lockProfile";
import { lockProfileExtend1, lockProfileExtend2 } from "./lockProfileExtend";
import {
@ -79,7 +79,7 @@ function encode110(res: Response): Buffer {
return discoverProfile1(res);
case "generic_res":
return generic(res);
return generic1(res);
case "load_2on2_ranking_points_res":
return load2on2RankingPoints1(res);
@ -190,7 +190,7 @@ function encode130(res: Response): Buffer {
return discoverProfile1(res);
case "generic_res":
return generic(res);
return generic1(res);
case "load_2on2_ranking_points_res":
return load2on2RankingPoints1(res);
@ -301,7 +301,7 @@ function encode210(res: Response): Buffer {
return discoverProfile2(res);
case "generic_res":
return generic(res);
return generic2(res);
case "load_2on2_ranking_points_res":
return load2on2RankingPoints2(res);