From da1dba8f2b8724d89a28fbbe8759f44d6abd1ba6 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sun, 9 May 2021 19:18:48 +0000 Subject: [PATCH] Implement GET_TIME opcode used by some DDR PS3 files. --- bemani/format/afp/decompile.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bemani/format/afp/decompile.py b/bemani/format/afp/decompile.py index bce0272..63e3d2c 100644 --- a/bemani/format/afp/decompile.py +++ b/bemani/format/afp/decompile.py @@ -489,6 +489,12 @@ class FunctionCall(Expression): return f"{name}({', '.join(params)})" +class GetTimeFunctionCall(FunctionCall): + # Call the built-in 'get time' method which returns the current playback position. + def __init__(self) -> None: + super().__init__("builtin_GetCurrentPlaybackPosition", []) + + class MethodCall(Expression): # Call a method on an object. def __init__(self, objectref: Any, name: Union[str, int, Expression], params: List[Any]) -> None: @@ -2895,6 +2901,11 @@ class ByteCodeDecompiler(VerboseOutput): chunk.actions[i] = NopStatement() continue + if action.opcode == AP2Action.GET_TIME: + stack.append(GetTimeFunctionCall()) + chunk.actions[i] = NopStatement() + continue + if isinstance(action, NullReturnStatement): # We already handled this continue