去哪里找Node的内容呢
This commit is contained in:
parent
2bfebc824e
commit
f1c880e7d0
|
@ -0,0 +1,63 @@
|
||||||
|
export interface Extlist {
|
||||||
|
numMons: number;
|
||||||
|
numCards: number;
|
||||||
|
checksum: number;
|
||||||
|
entries: ExtlistEntry[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExtlistEntry {
|
||||||
|
isCards: boolean;
|
||||||
|
id: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
numFrames: number;
|
||||||
|
frameRate: number;
|
||||||
|
checksum: number;
|
||||||
|
size: number;
|
||||||
|
lastUpdate: number;
|
||||||
|
compressedSize: number;
|
||||||
|
compressedChecksum: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Extlist = {
|
||||||
|
load(buf: Buffer): Extlist {
|
||||||
|
const numMons = buf.readUInt32LE(0);
|
||||||
|
const numCards = buf.readUInt32LE(4);
|
||||||
|
const sig = buf.readUInt32LE(8);
|
||||||
|
const checksum = buf.readUInt32LE(12);
|
||||||
|
if (sig !== 0x31545845) { // EXT1
|
||||||
|
throw new Error('invalid extlist.bin signature');
|
||||||
|
}
|
||||||
|
|
||||||
|
const entries: ExtlistEntry[] = [];
|
||||||
|
const numEntries = numMons + numCards;
|
||||||
|
const compressedInfoOffset = 0x10 + numEntries * 24;
|
||||||
|
for (let i = 0; i < numEntries; i++) {
|
||||||
|
const flags = buf.readUInt16LE(0x10 + i * 24 + 0);
|
||||||
|
const isCards = (flags & 0x4000) !== 0;
|
||||||
|
const id = flags & ~0x4000;
|
||||||
|
if (id === 0) continue;
|
||||||
|
|
||||||
|
entries.push({
|
||||||
|
isCards,
|
||||||
|
id,
|
||||||
|
width: buf.readUInt16LE(0x10 + i * 24 + 6),
|
||||||
|
height: buf.readUInt16LE(0x10 + i * 24 + 8),
|
||||||
|
numFrames: buf.readUInt16LE(0x10 + i * 24 + 10),
|
||||||
|
frameRate: buf.readUInt16LE(0x10 + i * 24 + 12),
|
||||||
|
checksum: buf.readUInt16LE(0x10 + i * 24 + 14),
|
||||||
|
size: buf.readUInt32LE(0x10 + i * 24 + 16),
|
||||||
|
lastUpdate: buf.readUInt32LE(0x10 + i * 24 + 20),
|
||||||
|
compressedSize: buf.readUInt32LE(compressedInfoOffset + i * 8 + 0),
|
||||||
|
compressedChecksum: buf.readUInt32LE(compressedInfoOffset + i * 8 + 4),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
numMons,
|
||||||
|
numCards,
|
||||||
|
checksum,
|
||||||
|
entries,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,4 +1,5 @@
|
||||||
import { basename } from "https://deno.land/std/path/mod.ts";
|
import { basename } from "https://deno.land/std/path/mod.ts";
|
||||||
|
import { Extlist } from './extlist.ts';
|
||||||
const regions = [
|
const regions = [
|
||||||
{path: 'pad', regionID: 'JA', baseJsonURL: 'https://dl.padsv.gungho.jp/base_adr.json'},
|
{path: 'pad', regionID: 'JA', baseJsonURL: 'https://dl.padsv.gungho.jp/base_adr.json'},
|
||||||
{path: 'padEN', regionID: 'NA', baseJsonURL: 'https://dl-na.padsv.gungho.jp/base-na-adr.json'},
|
{path: 'padEN', regionID: 'NA', baseJsonURL: 'https://dl-na.padsv.gungho.jp/base-na-adr.json'},
|
||||||
|
@ -27,4 +28,6 @@ for (const region of regions) {
|
||||||
const extdllistUrl = `${baseJsonData.efl}/extdllist.bin`;
|
const extdllistUrl = `${baseJsonData.efl}/extdllist.bin`;
|
||||||
console.log(`正在下载 ${extdllistUrl}`);
|
console.log(`正在下载 ${extdllistUrl}`);
|
||||||
const extdllistResponse = await downloadFile(extdllistUrl, region.path);
|
const extdllistResponse = await downloadFile(extdllistUrl, region.path);
|
||||||
}
|
const extlist = Extlist.load(extlistResponse);
|
||||||
|
extlist.entries.forEach((item)=>{console.log(item)});
|
||||||
|
}
|
|
@ -1,2 +1,2 @@
|
||||||
@echo off
|
@echo off
|
||||||
deno run --allow-net --allow-read --allow-write --unstable index.js
|
deno run --allow-net --allow-read --allow-write --unstable index.ts
|
Loading…
Reference in New Issue