mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
Extract version info
This commit is contained in:
parent
2f6f1937a9
commit
eae24a1263
2 changed files with 82 additions and 67 deletions
|
|
@ -85,65 +85,65 @@ describe("standardframe.maki", () => {
|
|||
return typeName;
|
||||
})
|
||||
).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"d6f50f6449b793fa66baf193983eaeef",
|
||||
"INT",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"5ab9fa1545579a7d5765c8aba97cc6a6",
|
||||
"698eddcd4fec8f1e44f9129b45ff09f9",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"INT",
|
||||
"INT",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
]
|
||||
`);
|
||||
Array [
|
||||
"d6f50f6449b793fa66baf193983eaeef",
|
||||
"INT",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"45be95e5419120725fbb5c93fd17f1f9",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"5ab9fa1545579a7d5765c8aba97cc6a6",
|
||||
"698eddcd4fec8f1e44f9129b45ff09f9",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"INT",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"INT",
|
||||
"INT",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
]
|
||||
`);
|
||||
maki.variables.forEach(variable => {
|
||||
expect(variable.type).not.toBe(undefined);
|
||||
});
|
||||
|
|
@ -440,4 +440,10 @@ describe("standardframe.maki", () => {
|
|||
});
|
||||
expect(maki.commands.length).toBe(expectedCommands.length);
|
||||
});
|
||||
|
||||
// I don't know what either of these actually are.
|
||||
test("extracts version info", () => {
|
||||
expect(maki.version).toBe(1027);
|
||||
expect(maki.extraVersion).toBe(23);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -214,13 +214,15 @@ function decodeCode({ makiFile, classes, variables, methods }) {
|
|||
|
||||
// TODO: Refactor this to consume bytes directly off the end of MakiFile
|
||||
function parseComand({ makiFile, length, pos, localFunctions }) {
|
||||
const command = {};
|
||||
const opcode = makiFile.readUInt8();
|
||||
command.offset = pos;
|
||||
command.pos = pos;
|
||||
command.opcode = opcode;
|
||||
command.arguments = [];
|
||||
command.command = COMMANDS[opcode];
|
||||
const command = {
|
||||
offset: pos,
|
||||
pos,
|
||||
opcode,
|
||||
// TODO: This should just be a single nullable value I think
|
||||
arguments: [],
|
||||
command: COMMANDS[opcode],
|
||||
};
|
||||
|
||||
if (command.command == null) {
|
||||
throw new Error(`Unknown opcode "${opcode}"`);
|
||||
|
|
@ -285,6 +287,7 @@ function parseComand({ makiFile, length, pos, localFunctions }) {
|
|||
makiFile.readUInt32LE();
|
||||
}
|
||||
|
||||
// TODO: What even is this?
|
||||
if (opcode === 112) {
|
||||
makiFile.readUInt8();
|
||||
}
|
||||
|
|
@ -295,8 +298,12 @@ function parse(buffer) {
|
|||
const makiFile = new MakiFile(buffer);
|
||||
|
||||
const magic = readMagic(makiFile);
|
||||
readVersion(makiFile);
|
||||
makiFile.readUInt32LE(); // Not sure what we are skipping over here. Just some UInt 32.
|
||||
// TODO: What format is this? Does it even change between compiler versions?
|
||||
// Maybe it's the std.mi version?
|
||||
const version = readVersion(makiFile);
|
||||
// Not sure what we are skipping over here. Just some UInt 32.
|
||||
// Maybe it's additional version info?
|
||||
const extraVersion = makiFile.readUInt32LE();
|
||||
const classes = readClasses(makiFile);
|
||||
const methods = readMethods(makiFile);
|
||||
const variables = readVariables({ makiFile: makiFile, classes });
|
||||
|
|
@ -336,6 +343,8 @@ function parse(buffer) {
|
|||
bindings: resolvedBindings,
|
||||
commands,
|
||||
localFunctions,
|
||||
version,
|
||||
extraVersion,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue