1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-05 10:42:37 +01:00

[swfinterp] Interpret yet more opcodes

This commit is contained in:
Philipp Hagemeister 2014-11-17 04:00:31 +01:00
parent 0ab1ca5501
commit e983cf5277
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,24 @@
// input: []
// output: 123
package {
public class NeOperator {
public static function main(): int {
var res:int = 0;
if (1 != 2) {
res += 3;
} else {
res += 4;
}
if (2 != 2) {
res += 10;
} else {
res += 20;
}
if (9 == 9) {
res += 100;
}
return res;
}
}
}

View File

@ -393,7 +393,10 @@ def resfunc(args):
self._classes_by_name, avm_class.variables])
while True:
opcode = _read_byte(coder)
if opcode == 17: # iftrue
if opcode == 16: # jump
offset = s24()
coder.seek(coder.tell() + offset)
elif opcode == 17: # iftrue
offset = s24()
value = stack.pop()
if value:
@ -403,6 +406,20 @@ def resfunc(args):
value = stack.pop()
if not value:
coder.seek(coder.tell() + offset)
elif opcode == 19: # ifeq
offset = s24()
value2 = stack.pop()
value1 = stack.pop()
if value2 == value1:
coder.seek(coder.tell() + offset)
elif opcode == 20: # ifne
offset = s24()
value2 = stack.pop()
value1 = stack.pop()
if value2 != value1:
coder.seek(coder.tell() + offset)
elif opcode == 32: # pushnull
stack.append(None)
elif opcode == 36: # pushbyte
v = _read_byte(coder)
stack.append(v)