mirror of
https://github.com/djhackersdev/minime.git
synced 2026-07-17 00:20:52 -05:00
wip
This commit is contained in:
parent
3075e4960b
commit
679accd74d
|
|
@ -95,7 +95,7 @@ export class Encoder extends Transform {
|
|||
return callback(new Error("Unimplemented response type"));
|
||||
}
|
||||
|
||||
console.log("Aimedb: Send", buf);
|
||||
console.log("Aimedb: Send", buf.toString("hex"));
|
||||
|
||||
return callback(null, buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export class Deframer extends Transform {
|
|||
|
||||
const frame = this.state.slice(0, len);
|
||||
|
||||
console.log("Aimedb: Recv", frame);
|
||||
console.log("Aimedb: Recv", frame.toString("hex"));
|
||||
|
||||
this.state = this.state.slice(len);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,16 @@ readers.set(MSG.GET_SERVER_LIST_REQ, () => {
|
|||
return { type: "get_server_list_req" };
|
||||
});
|
||||
|
||||
readers.set(MSG.UPDATE_PROVISIONAL_STORE_RANK_REQ, buf => {
|
||||
return {
|
||||
type: "update_provisional_store_rank_req",
|
||||
aimeId: buf.readUInt32LE(0x0004),
|
||||
};
|
||||
});
|
||||
|
||||
readers.set(MSG.UPDATE_RECORD_REQ, buf => {
|
||||
return {
|
||||
type: "update_record_req",
|
||||
payload: buf, // hack
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,30 @@
|
|||
export const MSG = {
|
||||
GENERIC_RES: 0x0001,
|
||||
CREATE_RECORD_REQ: 0x0066,
|
||||
UPDATE_RECORD_REQ: 0x0068,
|
||||
CREATE_TEAM_REQ: 0x007b,
|
||||
CREATE_TEAM_RES: 0x007c,
|
||||
GET_CONFIG_REQ: 0x0004,
|
||||
GET_CONFIG_RES: 0x0005,
|
||||
GET_SERVER_LIST_REQ: 0x0006,
|
||||
GET_SERVER_LIST_RES: 0x0007,
|
||||
CREATE_RECORD_REQ: 0x0066,
|
||||
UPDATE_RECORD_REQ: 0x0068,
|
||||
ACCOUNT_LOCK_REQ: 0x0069,
|
||||
ACCOUNT_LOCK_RES: 0x006a,
|
||||
CREATE_TEAM_REQ: 0x007b,
|
||||
CREATE_TEAM_RES: 0x007c,
|
||||
UPDATE_STORY_CLEAR_REQ: 0x007f,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_REQ: 0x0082,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_RES: 0x0083,
|
||||
GET_CONFIG_DATA_2_REQ: 0x00ab,
|
||||
GET_CONFIG_DATA_2_RES: 0x00ac,
|
||||
};
|
||||
|
||||
export const REQ_LEN = new Map<number, number>();
|
||||
|
||||
REQ_LEN.set(MSG.ACCOUNT_LOCK_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.CREATE_RECORD_REQ, 0x00c0);
|
||||
REQ_LEN.set(MSG.CREATE_TEAM_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.GET_CONFIG_REQ, 0x0050);
|
||||
REQ_LEN.set(MSG.GET_CONFIG_DATA_2_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.ACCOUNT_LOCK_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.GET_SERVER_LIST_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.UPDATE_PROVISIONAL_STORE_RANK_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.UPDATE_RECORD_REQ, 0x0940);
|
||||
REQ_LEN.set(MSG.UPDATE_STORY_CLEAR_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.GET_SERVER_LIST_REQ, 0x0020);
|
||||
|
|
|
|||
|
|
@ -29,13 +29,6 @@ export class Encoder extends Transform {
|
|||
|
||||
break;
|
||||
|
||||
case "generic_res":
|
||||
buf = Buffer.alloc(0x0020);
|
||||
buf.writeUInt16LE(MSG.GENERIC_RES, 0x0000);
|
||||
buf.writeUInt32LE(obj.field_0004, 0x0004);
|
||||
|
||||
break;
|
||||
|
||||
case "create_team_res":
|
||||
buf = Buffer.alloc(0x0ca0);
|
||||
buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
|
||||
|
|
@ -43,6 +36,13 @@ export class Encoder extends Transform {
|
|||
|
||||
break;
|
||||
|
||||
case "generic_res":
|
||||
buf = Buffer.alloc(0x0020);
|
||||
buf.writeUInt16LE(MSG.GENERIC_RES, 0x0000);
|
||||
buf.writeUInt32LE(obj.field_0004, 0x0004);
|
||||
|
||||
break;
|
||||
|
||||
case "get_config_res":
|
||||
buf = Buffer.alloc(0x01a0);
|
||||
buf.writeUInt16LE(MSG.GET_CONFIG_RES, 0x0000);
|
||||
|
|
@ -85,6 +85,24 @@ export class Encoder extends Transform {
|
|||
|
||||
break;
|
||||
|
||||
case "update_provisional_store_rank_res":
|
||||
buf = Buffer.alloc(0x02b0);
|
||||
buf.writeUInt16LE(MSG.UPDATE_PROVISIONAL_STORE_RANK_RES, 0x0000);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const offset = 0x44 + i;
|
||||
const row = obj.rows[i];
|
||||
|
||||
if (row !== undefined) {
|
||||
buf.writeUInt16LE(row.field_0000, offset + 0x0000);
|
||||
buf.writeUInt32LE(row.field_0004, offset + 0x0004);
|
||||
iconv.encode(row.field_0010, sjis).copy(buf, offset + 0x0010);
|
||||
iconv.encode(row.field_003B, sjis).copy(buf, offset + 0x003b);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
return callback(new Error(`No writer fn for ${obj["type"]}`));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Socket } from "net";
|
|||
import { hostname } from "os";
|
||||
|
||||
import setup from "./setup";
|
||||
import { objectExpression } from "@babel/types";
|
||||
|
||||
export default async function idz(socket: Socket) {
|
||||
const { input, output } = setup(socket);
|
||||
|
|
@ -98,6 +99,19 @@ export default async function idz(socket: Socket) {
|
|||
|
||||
break;
|
||||
|
||||
case "update_provisional_store_rank_req":
|
||||
output.write({
|
||||
type: "update_provisional_store_rank_res",
|
||||
rows: [10, 11, 12, 13].map(rank => ({
|
||||
field_0000: rank,
|
||||
field_0004: msg.aimeId + rank - 11,
|
||||
field_0010: `x${rank}`,
|
||||
field_003B: `y${rank}`,
|
||||
})),
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case "update_record_req":
|
||||
output.write({
|
||||
type: "generic_res",
|
||||
|
|
|
|||
|
|
@ -50,9 +50,14 @@ export interface GetServerListRequest {
|
|||
type: "get_server_list_req";
|
||||
}
|
||||
|
||||
export interface UpdateProvisionalStoreRankRequest {
|
||||
type: "update_provisional_store_rank_req";
|
||||
aimeId: number;
|
||||
}
|
||||
|
||||
export interface UpdateRecordRequest {
|
||||
type: "update_record_req";
|
||||
payload: Buffer;
|
||||
// TODO
|
||||
}
|
||||
|
||||
export type Request =
|
||||
|
|
@ -62,4 +67,5 @@ export type Request =
|
|||
| GetConfigRequest
|
||||
| GetConfigRequest2
|
||||
| GetServerListRequest
|
||||
| UpdateProvisionalStoreRankRequest
|
||||
| UpdateRecordRequest;
|
||||
|
|
|
|||
|
|
@ -65,10 +65,23 @@ export interface GetServerListResponse {
|
|||
reportErrorUrl: string;
|
||||
}
|
||||
|
||||
export interface UpdateProvisionalStoreRankResponseRow {
|
||||
field_0000: number;
|
||||
field_0004: number;
|
||||
field_0010: string;
|
||||
field_003B: string;
|
||||
}
|
||||
|
||||
export interface UpdateProvisionalStoreRankResponse {
|
||||
type: "update_provisional_store_rank_res";
|
||||
rows: UpdateProvisionalStoreRankResponseRow[];
|
||||
}
|
||||
|
||||
export type Response =
|
||||
| AccountLockResponse
|
||||
| CreateTeamResponse
|
||||
| GenericResponse
|
||||
| GetConfigResponse
|
||||
| GetConfigResponse2
|
||||
| GetServerListResponse;
|
||||
| GetServerListResponse
|
||||
| UpdateProvisionalStoreRankResponse;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user