mirror of
https://github.com/captbaritone/webamp
synced 2024-11-23 00:34:42 +00:00
Be more strict when parsing
This commit is contained in:
parent
ba3a4fdb25
commit
d940c7db14
@ -25,15 +25,7 @@ class Command {
|
||||
this.size = 1;
|
||||
|
||||
if (this.command == null) {
|
||||
// I don't think this ever happens in a real .maki file
|
||||
// throw new Error(`Unknown opcode "${opcode}"`);
|
||||
// But the decompiler tries to do something...
|
||||
this.command = {
|
||||
name: `unknown ${opcode}`,
|
||||
in: 0,
|
||||
out: 0
|
||||
};
|
||||
return;
|
||||
throw new Error(`Unknown opcode "${opcode}"`);
|
||||
}
|
||||
|
||||
if (this.command.arg == null) {
|
||||
@ -45,13 +37,7 @@ class Command {
|
||||
let arg = null;
|
||||
switch (argType) {
|
||||
case "var": {
|
||||
const variable = commandsBuffer.readUInt32LE(pos + 1);
|
||||
if (variables[variable] != null) {
|
||||
arg = variables[variable];
|
||||
} else {
|
||||
arg = new Variable(-1, -0, "unknown");
|
||||
}
|
||||
arg.name = `Unknown ${variable}`;
|
||||
arg = commandsBuffer.readUInt32LE(pos + 1);
|
||||
break;
|
||||
}
|
||||
case "line": {
|
||||
@ -64,11 +50,7 @@ class Command {
|
||||
if (functionNames[variable] != null) {
|
||||
arg = functionNames[variable].function;
|
||||
} else {
|
||||
arg = {
|
||||
name: `unknown Object function ${variable}`,
|
||||
parameters: [],
|
||||
return: "unknown"
|
||||
};
|
||||
throw new Error("unknown Object function");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user