This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 3075e4960b
commit 679accd74d
8 changed files with 78 additions and 18 deletions
+25 -7
View File
@@ -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"]}`));
}