update resolvers

This commit is contained in:
xensik 2022-09-13 16:22:14 +02:00
parent 6d85d0969d
commit 7cc15969db
28 changed files with 86579 additions and 9936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -297,160 +297,160 @@ auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesy
const std::array<std::pair<std::uint8_t, const char*>, 154> opcode_list
{{
{ 0x17, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x18, "EVAL_SELF_FIELD_VARIABLE" },
{ 0x19, "RETN" },
{ 0x1A, "CALL_BUILTIN_FUNC_0" },
{ 0x1B, "CALL_BUILTIN_FUNC_1" },
{ 0x1C, "CALL_BUILTIN_FUNC_2" },
{ 0x1D, "CALL_BUILTIN_FUNC_3" },
{ 0x1E, "CALL_BUILTIN_FUNC_4" },
{ 0x1F, "CALL_BUILTIN_FUNC_5" },
{ 0x20, "CALL_BUILTIN_FUNC" },
{ 0x21, "BOOL_NOT" },
{ 0x22, "CALL_FAR_METHOD_THEAD" },
{ 0x23, "JMP_EXPR_TRUE" },
{ 0x24, "SET_LEVEL_FIELD_VARIABLE_FIELD" },
{ 0x25, "CAST_BOOL" },
{ 0x26, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED0" },
{ 0x27, "CALL_BUILTIN_FUNC_POINTER" },
{ 0x28, "INEQUALITY" },
{ 0x29, "GET_THISTHREAD" },
{ 0x2A, "CLEAR_FIELD_VARIABLE" },
{ 0x2B, "GET_FLOAT" },
{ 0x2C, "SAFE_CREATE_VARIABLE_FIELD_CACHED" },
{ 0x2D, "CALL_FAR_FUNC2" },
{ 0x2E, "CALL_FAR_FUNC" },
{ 0x2F, "CALL_FAR_FUNC_CHILD_THREAD" },
{ 0x30, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x31, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x32, "CHECK_CLEAR_PARAMS" },
{ 0x33, "CAST_FIELD_OBJ" },
{ 0x34, "END" },
{ 0x35, "SIZE" },
{ 0x36, "EMPTY_ARRAY" },
{ 0x37, "BIT_AND" },
{ 0x38, "LESSEQUAL" },
{ 0x39, "VOIDCODEPOS" },
{ 0x3A, "CALL_METHOD_THREAD_POINTER" },
{ 0x3B, "ENDSWITCH" },
{ 0x3C, "CLEAR_VARIABLE_FIELD" },
{ 0x3D, "DIV" },
{ 0x3E, "CALL_FAR_METHOD_CHILD_THEAD" },
{ 0x3F, "GET_USHORT" },
{ 0x40, "JMP_TRUE" },
{ 0x41, "GET_SELF" },
{ 0x42, "CALL_FAR_FUNC_THREAD" },
{ 0x43, "CALL_LOCAL_FUNC_THREAD" },
{ 0x44, "SET_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x45, "SET_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x46, "PLUS" },
{ 0x47, "BOOL_COMPLEMENT" },
{ 0x48, "CALL_METHOD_POINTER" },
{ 0x49, "INC" },
{ 0x4A, "REMOVE_LOCAL_VARIABLES" },
{ 0x4B, "JMP_EXPR_FALSE" },
{ 0x4C, "SWITCH" },
{ 0x4D, "CLEAR_PARAMS" },
{ 0x4E, "EVAL_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x4F, "EVAL_LOCAL_VARIABLE_REF_CACHED" },
{ 0x50, "CALL_LOCAL_METHOD" },
{ 0x51, "EVAL_FIELD_VARIABLE" },
{ 0x52, "EVAL_FIELD_VARIABLE_REF" },
{ 0x53, "GET_STRING" },
{ 0x54, "CALL_FUNC_POINTER" },
{ 0x55, "EVAL_LEVEL_FIELD_VARIABLE" },
{ 0x56, "GET_VECTOR" },
{ 0x57, "ENDON" },
{ 0x58, "GREATEREQUAL" },
{ 0x59, "GET_SELF_OBJ" },
{ 0x5A, "SET_ANIM_FIELD_VARIABLE_FIELD" },
{ 0x5B, "SET_VARIABLE_FIELD" },
{ 0x5C, "CALL_LOCAL_FUNC2" },
{ 0x5D, "CALL_LOCAL_FUNC" },
{ 0x5E, "EVAL_LOCAL_ARRAY_REF_CACHED0" },
{ 0x5F, "EVAL_LOCAL_ARRAY_REF_CACHED" },
{ 0x60, "GET_FAR_FUNC" },
{ 0x61, "LESS" },
{ 0x62, "GET_GAME_REF" },
{ 0x63, "WAITFRAME" },
{ 0x64, "WAITTILLFRAMEEND" },
{ 0x65, "SAFE_SET_VARIABLE_FIELD_CACHED0" },
{ 0x66, "SAFE_SET_VARIABLE_FIELD_CACHED" },
{ 0x67, "CALL_METHOD_CHILD_THREAD_POINTER" },
{ 0x68, "GET_LEVEL" },
{ 0x69, "NOTIFY" },
{ 0x6A, "DEC_TOP" },
{ 0x6B, "SHIFT_LEFT" },
{ 0x6C, "CALL_LOCAL_METHOD_THREAD" },
{ 0x6D, "CALL_LOCAL_METHOD_CHILD_THREAD" },
{ 0x6E, "GREATER" },
{ 0x6F, "EVAL_LOCAL_VARIABLE_CACHED0" },
{ 0x70, "EVAL_LOCAL_VARIABLE_CACHED1" },
{ 0x71, "EVAL_LOCAL_VARIABLE_CACHED2" },
{ 0x72, "EVAL_LOCAL_VARIABLE_CACHED3" },
{ 0x73, "EVAL_LOCAL_VARIABLE_CACHED4" },
{ 0x74, "EVAL_LOCAL_VARIABLE_CACHED5" },
{ 0x75, "EVAL_LOCAL_VARIABLE_CACHED" },
{ 0x76, "SAFE_SET_WAITTILL_VARIABLE_FIELD_CACHED" },
{ 0x77, "JMP" },
{ 0x78, "CALL_FUNC_THREAD_POINTER" },
{ 0x79, "GET_ZERO" },
{ 0x7A, "WAIT" },
{ 0x7B, "MINUS" },
{ 0x7C, "SET_SELF_FIELD_VARIABLE_FIELD" },
{ 0x7D, "EVAL_NEW_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x7E, "MULT" },
{ 0x7F, "CREATE_LOCAL_VARIABLE" },
{ 0x80, "CALL_LOCAL_FUNC_CHILD_THREAD" },
{ 0x81, "GET_INT" },
{ 0x82, "MOD" },
{ 0x83, "EVAL_ANIM_FIELD_VARIABLE_REF" },
{ 0x84, "GET_BUILTIN_FUNC" },
{ 0x85, "GET_GAME" },
{ 0x86, "WAITTILL" },
{ 0x87, "DEC" },
{ 0x88, "EVAL_LOCAL_VARIABLE_OBJECT_CACHED" },
{ 0x89, "PRE_CALL" },
{ 0x8A, "GET_ANIM" },
{ 0x8B, "GET_UNDEFINED" },
{ 0x8C, "EVAL_LEVEL_FIELD_VARIABLE_REF" },
{ 0x8D, "GET_ANIM_OBJ" },
{ 0x8E, "GET_LEVEL_OBJ" },
{ 0x8F, "BIT_EXOR" },
{ 0x90, "EQUALITY" },
{ 0x91, "CLEAR_ARRAY" },
{ 0x92, "JMP_BACK" },
{ 0x93, "GET_ANIMATION" },
{ 0x94, "EVAL_ANIM_FIELD_VARIABLE" },
{ 0x95, "GET_ANIMTREE" },
{ 0x96, "GET_ISTRING" },
{ 0x97, "EVAL_ARRAY_REF" },
{ 0x98, "EVAL_SELF_FIELD_VARIABLE_REF" },
{ 0x99, "GET_NBYTE" },
{ 0x9A, "GET_BUILTIN_METHOD" },
{ 0x9B, "CALL_BUILTIN_METHOD_POINTER" },
{ 0x9C, "EVAL_ARRAY" },
{ 0x9D, "VECTOR" },
{ 0x9E, "CALL_FAR_METHOD" },
{ 0x9F, "EVAL_LOCAL_ARRAY_CACHED" },
{ 0xA0, "GET_BYTE" },
{ 0xA1, "CALL_FUNC_CHILD_THREAD_POINTER" },
{ 0xA2, "BIT_OR" },
{ 0xA3, "ADD_ARRAY" },
{ 0xA4, "WAITTILLMATCH2" },
{ 0xA5, "WAITTILLMATCH" },
{ 0xA6, "GET_LOCAL_FUNC" },
{ 0xA7, "GET_NUSHORT" },
{ 0xA8, "SHIFT_RIGHT" },
{ 0xA9, "CALL_BUILTIN_METHOD_0" },
{ 0xAA, "CALL_BUILTIN_METHOD_1" },
{ 0xAB, "CALL_BUILTIN_METHOD_2" },
{ 0xAC, "CALL_BUILTIN_METHOD_3" },
{ 0xAD, "CALL_BUILTIN_METHOD_4" },
{ 0xAE, "CALL_BUILTIN_METHOD_5" },
{ 0xAF, "CALL_BUILTIN_METHOD" },
{ 0xB0, "JMP_FALSE" },
{ 0x17, "OP_SetNewLocalVariableFieldCached0" },
{ 0x18, "OP_EvalSelfFieldVariable" },
{ 0x19, "OP_Return" },
{ 0x1A, "OP_CallBuiltin0" },
{ 0x1B, "OP_CallBuiltin1" },
{ 0x1C, "OP_CallBuiltin2" },
{ 0x1D, "OP_CallBuiltin3" },
{ 0x1E, "OP_CallBuiltin4" },
{ 0x1F, "OP_CallBuiltin5" },
{ 0x20, "OP_CallBuiltin" },
{ 0x21, "OP_BoolNot" },
{ 0x22, "OP_ScriptFarMethodThreadCall" },
{ 0x23, "OP_JumpOnTrueExpr" },
{ 0x24, "OP_SetLevelFieldVariableField" },
{ 0x25, "OP_CastBool" },
{ 0x26, "OP_EvalNewLocalArrayRefCached0" },
{ 0x27, "OP_CallBuiltinPointer" },
{ 0x28, "OP_inequality" },
{ 0x29, "OP_GetThisthread" },
{ 0x2A, "OP_ClearFieldVariable" },
{ 0x2B, "OP_GetFloat" },
{ 0x2C, "OP_SafeCreateVariableFieldCached" },
{ 0x2D, "OP_ScriptFarFunctionCall2" },
{ 0x2E, "OP_ScriptFarFunctionCall" },
{ 0x2F, "OP_ScriptFarChildThreadCall" },
{ 0x30, "OP_ClearLocalVariableFieldCached0" },
{ 0x31, "OP_ClearLocalVariableFieldCached" },
{ 0x32, "OP_checkclearparams" },
{ 0x33, "OP_CastFieldObject" },
{ 0x34, "OP_End" },
{ 0x35, "OP_size" },
{ 0x36, "OP_EmptyArray" },
{ 0x37, "OP_bit_and" },
{ 0x38, "OP_less_equal" },
{ 0x39, "OP_voidCodepos" },
{ 0x3A, "OP_ScriptMethodThreadCallPointer" },
{ 0x3B, "OP_endswitch" },
{ 0x3C, "OP_ClearVariableField" },
{ 0x3D, "OP_divide" },
{ 0x3E, "OP_ScriptFarMethodChildThreadCall" },
{ 0x3F, "OP_GetUnsignedShort" },
{ 0x40, "OP_JumpOnTrue" },
{ 0x41, "OP_GetSelf" },
{ 0x42, "OP_ScriptFarThreadCall" },
{ 0x43, "OP_ScriptLocalThreadCall" },
{ 0x44, "OP_SetLocalVariableFieldCached0" },
{ 0x45, "OP_SetLocalVariableFieldCached" },
{ 0x46, "OP_plus" },
{ 0x47, "OP_BoolComplement" },
{ 0x48, "OP_ScriptMethodCallPointer" },
{ 0x49, "OP_inc" },
{ 0x4A, "OP_RemoveLocalVariables" },
{ 0x4B, "OP_JumpOnFalseExpr" },
{ 0x4C, "OP_switch" },
{ 0x4D, "OP_clearparams" },
{ 0x4E, "OP_EvalLocalVariableRefCached0" },
{ 0x4F, "OP_EvalLocalVariableRefCached" },
{ 0x50, "OP_ScriptLocalMethodCall" },
{ 0x51, "OP_EvalFieldVariable" },
{ 0x52, "OP_EvalFieldVariableRef" },
{ 0x53, "OP_GetString" },
{ 0x54, "OP_ScriptFunctionCallPointer" },
{ 0x55, "OP_EvalLevelFieldVariable" },
{ 0x56, "OP_GetVector" },
{ 0x57, "OP_endon" },
{ 0x58, "OP_greater_equal" },
{ 0x59, "OP_GetSelfObject" },
{ 0x5A, "OP_SetAnimFieldVariableField" },
{ 0x5B, "OP_SetVariableField" },
{ 0x5C, "OP_ScriptLocalFunctionCall2" },
{ 0x5D, "OP_ScriptLocalFunctionCall" },
{ 0x5E, "OP_EvalLocalArrayRefCached0" },
{ 0x5F, "OP_EvalLocalArrayRefCached" },
{ 0x60, "OP_GetFarFunction" },
{ 0x61, "OP_less" },
{ 0x62, "OP_GetGameRef" },
{ 0x63, "OP_waittillFrameEnd" },
{ 0x64, "OP_waitFrame" },
{ 0x65, "OP_SafeSetVariableFieldCached0" },
{ 0x66, "OP_SafeSetVariableFieldCached" },
{ 0x67, "OP_ScriptMethodChildThreadCallPointer" },
{ 0x68, "OP_GetLevel" },
{ 0x69, "OP_notify" },
{ 0x6A, "OP_DecTop" },
{ 0x6B, "OP_shift_left" },
{ 0x6C, "OP_ScriptLocalMethodThreadCall" },
{ 0x6D, "OP_ScriptLocalMethodChildThreadCall" },
{ 0x6E, "OP_greater" },
{ 0x6F, "OP_EvalLocalVariableCached0" },
{ 0x70, "OP_EvalLocalVariableCached1" },
{ 0x71, "OP_EvalLocalVariableCached2" },
{ 0x72, "OP_EvalLocalVariableCached3" },
{ 0x73, "OP_EvalLocalVariableCached4" },
{ 0x74, "OP_EvalLocalVariableCached5" },
{ 0x75, "OP_EvalLocalVariableCached" },
{ 0x76, "OP_SafeSetWaittillVariableFieldCached" },
{ 0x77, "OP_jump" },
{ 0x78, "OP_ScriptThreadCallPointer" },
{ 0x79, "OP_GetZero" },
{ 0x7A, "OP_wait" },
{ 0x7B, "OP_minus" },
{ 0x7C, "OP_SetSelfFieldVariableField" },
{ 0x7D, "OP_EvalNewLocalVariableRefCached0" },
{ 0x7E, "OP_multiply" },
{ 0x7F, "OP_CreateLocalVariable" },
{ 0x80, "OP_ScriptLocalChildThreadCall" },
{ 0x81, "OP_GetInteger" },
{ 0x82, "OP_mod" },
{ 0x83, "OP_EvalAnimFieldVariableRef" },
{ 0x84, "OP_GetBuiltinFunction" },
{ 0x85, "OP_GetGame" },
{ 0x86, "OP_waittill" },
{ 0x87, "OP_dec" },
{ 0x88, "OP_EvalLocalVariableObjectCached" },
{ 0x89, "OP_PreScriptCall" },
{ 0x8A, "OP_GetAnim" },
{ 0x8B, "OP_GetUndefined" },
{ 0x8C, "OP_EvalLevelFieldVariableRef" },
{ 0x8D, "OP_GetAnimObject" },
{ 0x8E, "OP_GetLevelObject" },
{ 0x8F, "OP_bit_ex_or" },
{ 0x90, "OP_equality" },
{ 0x91, "OP_ClearArray" },
{ 0x92, "OP_jumpback" },
{ 0x93, "OP_GetAnimation" },
{ 0x94, "OP_EvalAnimFieldVariable" },
{ 0x95, "OP_GetAnimTree" },
{ 0x96, "OP_GetIString" },
{ 0x97, "OP_EvalArrayRef" },
{ 0x98, "OP_EvalSelfFieldVariableRef" },
{ 0x99, "OP_GetNegByte" },
{ 0x9A, "OP_GetBuiltinMethod" },
{ 0x9B, "OP_CallBuiltinMethodPointer" },
{ 0x9C, "OP_EvalArray" },
{ 0x9D, "OP_vector" },
{ 0x9E, "OP_ScriptFarMethodCall" },
{ 0x9F, "OP_EvalLocalArrayCached" },
{ 0xA0, "OP_GetByte" },
{ 0xA1, "OP_ScriptChildThreadCallPointer" },
{ 0xA2, "OP_bit_or" },
{ 0xA3, "OP_AddArray" },
{ 0xA4, "OP_waittillmatch2" },
{ 0xA5, "OP_waittillmatch" },
{ 0xA6, "OP_GetLocalFunction" },
{ 0xA7, "OP_GetNegUnsignedShort" },
{ 0xA8, "OP_shift_right" },
{ 0xA9, "OP_CallBuiltinMethod0" },
{ 0xAA, "OP_CallBuiltinMethod1" },
{ 0xAB, "OP_CallBuiltinMethod2" },
{ 0xAC, "OP_CallBuiltinMethod3" },
{ 0xAD, "OP_CallBuiltinMethod4" },
{ 0xAE, "OP_CallBuiltinMethod5" },
{ 0xAF, "OP_CallBuiltinMethod" },
{ 0xB0, "OP_JumpOnFalse" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 800> function_list

View File

@ -323,159 +323,159 @@ auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesy
const std::array<std::pair<std::uint8_t, const char*>, 153> opcode_list
{{
{ 0x00, "END" },
{ 0x01, "RETN" },
{ 0x02, "GET_BYTE" },
{ 0x03, "GET_NBYTE" },
{ 0x04, "GET_USHORT" },
{ 0x05, "GET_NUSHORT" },
{ 0x06, "GET_INT" },
{ 0x07, "GET_BUILTIN_FUNC" },
{ 0x08, "GET_BUILTIN_METHOD" },
{ 0x09, "GET_FLOAT" },
{ 0x0A, "GET_STRING" },
{ 0x0B, "GET_UNDEFINED" },
{ 0x0C, "GET_ZERO" },
{ 0x0D, "WAITTILLFRAMEEND" },
{ 0x0E, "CREATE_LOCAL_VARIABLE" },
{ 0x0F, "REMOVE_LOCAL_VARIABLES" },
{ 0x10, "EVAL_LOCAL_VARIABLE_CACHED0" },
{ 0x11, "EVAL_LOCAL_VARIABLE_CACHED1" },
{ 0x12, "EVAL_LOCAL_VARIABLE_CACHED2" },
{ 0x13, "EVAL_LOCAL_VARIABLE_CACHED3" },
{ 0x14, "EVAL_LOCAL_VARIABLE_CACHED4" },
{ 0x15, "EVAL_LOCAL_VARIABLE_CACHED5" },
{ 0x16, "EVAL_LOCAL_VARIABLE_CACHED" },
{ 0x17, "EVAL_LOCAL_ARRAY_CACHED" },
{ 0x18, "EVAL_ARRAY" },
{ 0x1A, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED0" },
{ 0x19, "EVAL_LOCAL_ARRAY_REF_CACHED0" },
{ 0x1B, "EVAL_LOCAL_ARRAY_REF_CACHED" },
{ 0x1C, "EVAL_ARRAY_REF" },
{ 0x1D, "CLEAR_ARRAY" },
{ 0x1E, "EMPTY_ARRAY" },
{ 0x1F, "ADD_ARRAY" },
{ 0x20, "PRE_CALL" },
{ 0x21, "CALL_LOCAL_FUNC2" },
{ 0x22, "CALL_LOCAL_FUNC" },
{ 0x23, "CALL_LOCAL_METHOD" },
{ 0x24, "CALL_LOCAL_FUNC_THREAD" },
{ 0x25, "CALL_LOCAL_FUNC_CHILD_THREAD" },
{ 0x26, "CALL_LOCAL_METHOD_THREAD" },
{ 0x27, "CALL_LOCAL_METHOD_CHILD_THREAD" },
{ 0x28, "CALL_FAR_FUNC2" },
{ 0x29, "CALL_FAR_FUNC" },
{ 0x2A, "CALL_FAR_METHOD" },
{ 0x2B, "CALL_FAR_FUNC_THREAD" },
{ 0x2C, "CALL_FAR_FUNC_CHILD_THREAD" },
{ 0x2D, "CALL_FAR_METHOD_THEAD" },
{ 0x2E, "CALL_FAR_METHOD_CHILD_THEAD" },
{ 0x2F, "CALL_FUNC_POINTER" },
{ 0x30, "CALL_METHOD_POINTER" },
{ 0x31, "CALL_FUNC_THREAD_POINTER" },
{ 0x32, "CALL_FUNC_CHILD_THREAD_POINTER" },
{ 0x33, "CALL_METHOD_THREAD_POINTER" },
{ 0x34, "CALL_METHOD_CHILD_THREAD_POINTER" },
{ 0x35, "CALL_BUILTIN_FUNC_POINTER" },
{ 0x36, "CALL_BUILTIN_METHOD_POINTER" },
{ 0x37, "GET_ISTRING" },
{ 0x38, "GET_VECTOR" },
{ 0x39, "GET_LEVEL_OBJ" },
{ 0x3A, "GET_ANIM_OBJ" },
{ 0x3B, "GET_SELF" },
{ 0x3C, "GET_THISTHREAD" },
{ 0x3D, "GET_LEVEL" },
{ 0x3E, "GET_GAME" },
{ 0x3F, "GET_ANIM" },
{ 0x40, "GET_ANIMATION" },
{ 0x41, "GET_GAME_REF" },
{ 0x42, "INC" },
{ 0x43, "DEC" },
{ 0x44, "BIT_OR" },
{ 0x45, "JMP_EXPR_FALSE" },
{ 0x46, "BIT_EXOR" },
{ 0x47, "BIT_AND" },
{ 0x48, "EQUALITY" },
{ 0x49, "INEQUALITY" },
{ 0x4A, "LESS" },
{ 0x4B, "GREATER" },
{ 0x4C, "JMP_EXPR_TRUE" },
{ 0x4D, "LESSEQUAL" },
{ 0x4E, "JMP_BACK" },
{ 0x4F, "WAITTILLMATCH2" },
{ 0x50, "WAITTILL" },
{ 0x51, "NOTIFY" },
{ 0x52, "ENDON" },
{ 0x53, "VOIDCODEPOS" },
{ 0x54, "SWITCH" },
{ 0x55, "ENDSWITCH" },
{ 0x56, "VECTOR" },
{ 0x57, "JMP_FALSE" },
{ 0x58, "GREATEREQUAL" },
{ 0x59, "SHIFT_LEFT" },
{ 0x5A, "SHIFT_RIGHT" },
{ 0x5B, "PLUS" },
{ 0x5C, "JMP" },
{ 0x5D, "MINUS" },
{ 0x5E, "MULT" },
{ 0x5F, "DIV" },
{ 0x60, "MOD" },
{ 0x61, "JMP_TRUE" },
{ 0x62, "SIZE" },
{ 0x63, "WAITTILLMATCH" },
{ 0x64, "GET_LOCAL_FUNC" },
{ 0x65, "GET_FAR_FUNC" },
{ 0x66, "GET_SELF_OBJ" },
{ 0x67, "EVAL_LEVEL_FIELD_VARIABLE" },
{ 0x68, "EVAL_ANIM_FIELD_VARIABLE" },
{ 0x69, "EVAL_SELF_FIELD_VARIABLE" },
{ 0x6A, "EVAL_FIELD_VARIABLE" },
{ 0x6B, "EVAL_LEVEL_FIELD_VARIABLE_REF" },
{ 0x6C, "EVAL_ANIM_FIELD_VARIABLE_REF" },
{ 0x6D, "EVAL_SELF_FIELD_VARIABLE_REF" },
{ 0x6E, "EVAL_FIELD_VARIABLE_REF" },
{ 0x6F, "CLEAR_FIELD_VARIABLE" },
{ 0x70, "SAFE_CREATE_VARIABLE_FIELD_CACHED" },
{ 0x71, "SAFE_SET_VARIABLE_FIELD_CACHED0" },
{ 0x72, "SAFE_SET_VARIABLE_FIELD_CACHED" },
{ 0x73, "SAFE_SET_WAITTILL_VARIABLE_FIELD_CACHED" },
{ 0x74, "GET_ANIMTREE" },
{ 0x75, "CLEAR_PARAMS" },
{ 0x76, "CHECK_CLEAR_PARAMS" },
{ 0x77, "EVAL_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x78, "EVAL_NEW_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x79, "EVAL_LOCAL_VARIABLE_REF_CACHED" },
{ 0x7A, "SET_LEVEL_FIELD_VARIABLE_FIELD" },
{ 0x7B, "SET_VARIABLE_FIELD" },
{ 0x7C, "CLEAR_VARIABLE_FIELD" },
{ 0x7D, "SET_ANIM_FIELD_VARIABLE_FIELD" },
{ 0x7E, "SET_SELF_FIELD_VARIABLE_FIELD" },
{ 0x7F, "SET_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x80, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x81, "SET_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x82, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x83, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x84, "CALL_BUILTIN_FUNC_0" },
{ 0x85, "CALL_BUILTIN_FUNC_1" },
{ 0x86, "CALL_BUILTIN_FUNC_2" },
{ 0x87, "CALL_BUILTIN_FUNC_3" },
{ 0x88, "CALL_BUILTIN_FUNC_4" },
{ 0x89, "CALL_BUILTIN_FUNC_5" },
{ 0x8A, "CALL_BUILTIN_FUNC" },
{ 0x8B, "CALL_BUILTIN_METHOD_0" },
{ 0x8C, "CALL_BUILTIN_METHOD_1" },
{ 0x8D, "CALL_BUILTIN_METHOD_2" },
{ 0x8E, "CALL_BUILTIN_METHOD_3" },
{ 0x8F, "CALL_BUILTIN_METHOD_4" },
{ 0x90, "CALL_BUILTIN_METHOD_5" },
{ 0x91, "CALL_BUILTIN_METHOD" },
{ 0x92, "WAIT" },
{ 0x93, "DEC_TOP" },
{ 0x94, "CAST_FIELD_OBJ" },
{ 0x95, "EVAL_LOCAL_VARIABLE_OBJECT_CACHED" },
{ 0x96, "CAST_BOOL" },
{ 0x97, "BOOL_NOT" },
{ 0x98, "BOOL_COMPLEMENT" },
{ 0x00, "OP_End" },
{ 0x01, "OP_Return" },
{ 0x02, "OP_GetByte" },
{ 0x03, "OP_GetNegByte" },
{ 0x04, "OP_GetUnsignedShort" },
{ 0x05, "OP_GetNegUnsignedShort" },
{ 0x06, "OP_GetInteger" },
{ 0x07, "OP_GetBuiltinFunction" },
{ 0x08, "OP_GetBuiltinMethod" },
{ 0x09, "OP_GetFloat" },
{ 0x0A, "OP_GetString" },
{ 0x0B, "OP_GetUndefined" },
{ 0x0C, "OP_GetZero" },
{ 0x0D, "OP_waittillFrameEnd" },
{ 0x0E, "OP_CreateLocalVariable" },
{ 0x0F, "OP_RemoveLocalVariables" },
{ 0x10, "OP_EvalLocalVariableCached0" },
{ 0x11, "OP_EvalLocalVariableCached1" },
{ 0x12, "OP_EvalLocalVariableCached2" },
{ 0x13, "OP_EvalLocalVariableCached3" },
{ 0x14, "OP_EvalLocalVariableCached4" },
{ 0x15, "OP_EvalLocalVariableCached5" },
{ 0x16, "OP_EvalLocalVariableCached" },
{ 0x17, "OP_EvalLocalArrayCached" },
{ 0x18, "OP_EvalArray" },
{ 0x19, "OP_EvalLocalArrayRefCached0" },
{ 0x1A, "OP_EvalNewLocalArrayRefCached0" },
{ 0x1B, "OP_EvalLocalArrayRefCached" },
{ 0x1C, "OP_EvalArrayRef" },
{ 0x1D, "OP_ClearArray" },
{ 0x1E, "OP_EmptyArray" },
{ 0x1F, "OP_AddArray" },
{ 0x20, "OP_PreScriptCall" },
{ 0x21, "OP_ScriptLocalFunctionCall2" },
{ 0x22, "OP_ScriptLocalFunctionCall" },
{ 0x23, "OP_ScriptLocalMethodCall" },
{ 0x24, "OP_ScriptLocalThreadCall" },
{ 0x25, "OP_ScriptLocalChildThreadCall" },
{ 0x26, "OP_ScriptLocalMethodThreadCall" },
{ 0x27, "OP_ScriptLocalMethodChildThreadCall" },
{ 0x28, "OP_ScriptFarFunctionCall2" },
{ 0x29, "OP_ScriptFarFunctionCall" },
{ 0x2A, "OP_ScriptFarMethodCall" },
{ 0x2B, "OP_ScriptFarThreadCall" },
{ 0x2C, "OP_ScriptFarChildThreadCall" },
{ 0x2D, "OP_ScriptFarMethodThreadCall" },
{ 0x2E, "OP_ScriptFarMethodChildThreadCall" },
{ 0x2F, "OP_ScriptFunctionCallPointer" },
{ 0x30, "OP_ScriptMethodCallPointer" },
{ 0x31, "OP_ScriptThreadCallPointer" },
{ 0x32, "OP_ScriptChildThreadCallPointer" },
{ 0x33, "OP_ScriptMethodThreadCallPointer" },
{ 0x34, "OP_ScriptMethodChildThreadCallPointer" },
{ 0x35, "OP_CallBuiltinPointer" },
{ 0x36, "OP_CallBuiltinMethodPointer" },
{ 0x37, "OP_GetIString" },
{ 0x38, "OP_GetVector" },
{ 0x39, "OP_GetLevelObject" },
{ 0x3A, "OP_GetAnimObject" },
{ 0x3B, "OP_GetSelf" },
{ 0x3C, "OP_GetThisthread" },
{ 0x3D, "OP_GetLevel" },
{ 0x3E, "OP_GetGame" },
{ 0x3F, "OP_GetAnim" },
{ 0x40, "OP_GetAnimation" },
{ 0x41, "OP_GetGameRef" },
{ 0x42, "OP_inc" },
{ 0x43, "OP_dec" },
{ 0x44, "OP_bit_or" },
{ 0x45, "OP_JumpOnFalseExpr" },
{ 0x46, "OP_bit_ex_or" },
{ 0x47, "OP_bit_and" },
{ 0x48, "OP_equality" },
{ 0x49, "OP_inequality" },
{ 0x4A, "OP_less" },
{ 0x4B, "OP_greater" },
{ 0x4C, "OP_JumpOnTrueExpr" },
{ 0x4D, "OP_less_equal" },
{ 0x4E, "OP_jumpback" },
{ 0x4F, "OP_waittillmatch2" },
{ 0x50, "OP_waittill" },
{ 0x51, "OP_notify" },
{ 0x52, "OP_endon" },
{ 0x53, "OP_voidCodepos" },
{ 0x54, "OP_switch" },
{ 0x55, "OP_endswitch" },
{ 0x56, "OP_vector" },
{ 0x57, "OP_JumpOnFalse" },
{ 0x58, "OP_greater_equal" },
{ 0x59, "OP_shift_left" },
{ 0x5A, "OP_shift_right" },
{ 0x5B, "OP_plus" },
{ 0x5C, "OP_jump" },
{ 0x5D, "OP_minus" },
{ 0x5E, "OP_multiply" },
{ 0x5F, "OP_divide" },
{ 0x60, "OP_mod" },
{ 0x61, "OP_JumpOnTrue" },
{ 0x62, "OP_size" },
{ 0x63, "OP_waittillmatch" },
{ 0x64, "OP_GetLocalFunction" },
{ 0x65, "OP_GetFarFunction" },
{ 0x66, "OP_GetSelfObject" },
{ 0x67, "OP_EvalLevelFieldVariable" },
{ 0x68, "OP_EvalAnimFieldVariable" },
{ 0x69, "OP_EvalSelfFieldVariable" },
{ 0x6A, "OP_EvalFieldVariable" },
{ 0x6B, "OP_EvalLevelFieldVariableRef" },
{ 0x6C, "OP_EvalAnimFieldVariableRef" },
{ 0x6D, "OP_EvalSelfFieldVariableRef" },
{ 0x6E, "OP_EvalFieldVariableRef" },
{ 0x6F, "OP_ClearFieldVariable" },
{ 0x70, "OP_SafeCreateVariableFieldCached" },
{ 0x71, "OP_SafeSetVariableFieldCached0" },
{ 0x72, "OP_SafeSetVariableFieldCached" },
{ 0x73, "OP_SafeSetWaittillVariableFieldCached" },
{ 0x74, "OP_GetAnimTree" },
{ 0x75, "OP_clearparams" },
{ 0x76, "OP_checkclearparams" },
{ 0x77, "OP_EvalLocalVariableRefCached0" },
{ 0x78, "OP_EvalNewLocalVariableRefCached0" },
{ 0x79, "OP_EvalLocalVariableRefCached" },
{ 0x7A, "OP_SetLevelFieldVariableField" },
{ 0x7B, "OP_SetVariableField" },
{ 0x7C, "OP_ClearVariableField" },
{ 0x7D, "OP_SetAnimFieldVariableField" },
{ 0x7E, "OP_SetSelfFieldVariableField" },
{ 0x7F, "OP_SetLocalVariableFieldCached0" },
{ 0x80, "OP_SetNewLocalVariableFieldCached0" },
{ 0x81, "OP_SetLocalVariableFieldCached" },
{ 0x82, "OP_ClearLocalVariableFieldCached" },
{ 0x83, "OP_ClearLocalVariableFieldCached0" },
{ 0x84, "OP_CallBuiltin0" },
{ 0x85, "OP_CallBuiltin1" },
{ 0x86, "OP_CallBuiltin2" },
{ 0x87, "OP_CallBuiltin3" },
{ 0x88, "OP_CallBuiltin4" },
{ 0x89, "OP_CallBuiltin5" },
{ 0x8A, "OP_CallBuiltin" },
{ 0x8B, "OP_CallBuiltinMethod0" },
{ 0x8C, "OP_CallBuiltinMethod1" },
{ 0x8D, "OP_CallBuiltinMethod2" },
{ 0x8E, "OP_CallBuiltinMethod3" },
{ 0x8F, "OP_CallBuiltinMethod4" },
{ 0x90, "OP_CallBuiltinMethod5" },
{ 0x91, "OP_CallBuiltinMethod" },
{ 0x92, "OP_wait" },
{ 0x93, "OP_DecTop" },
{ 0x94, "OP_CastFieldObject" },
{ 0x95, "OP_EvalLocalVariableObjectCached" },
{ 0x96, "OP_CastBool" },
{ 0x97, "OP_BoolNot" },
{ 0x98, "OP_BoolComplement" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 455> function_list

View File

@ -428,7 +428,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint16_t>(file_id);

View File

@ -334,7 +334,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint16_t>();
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint16_t>();
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint16_t;
static auto file_name(std::uint16_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint16_t;
static auto token_name(std::uint16_t id) -> std::string;

View File

@ -428,7 +428,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint32_t>(file_id);

View File

@ -334,7 +334,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint32_t>();
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint32_t>();
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);

View File

@ -17,12 +17,10 @@ namespace xsk::gsc::iw7
std::unordered_map<std::uint8_t, std::string_view> opcode_map;
std::unordered_map<std::uint16_t, std::string_view> function_map;
std::unordered_map<std::uint16_t, std::string_view> method_map;
std::unordered_map<std::uint32_t, std::string_view> file_map;
std::unordered_map<std::uint32_t, std::string_view> token_map;
std::unordered_map<std::string_view, std::uint8_t> opcode_map_rev;
std::unordered_map<std::string_view, std::uint16_t> function_map_rev;
std::unordered_map<std::string_view, std::uint16_t> method_map_rev;
std::unordered_map<std::string_view, std::uint32_t> file_map_rev;
std::unordered_map<std::string_view, std::uint32_t> token_map_rev;
std::unordered_map<std::string, std::vector<std::uint8_t>> files;
read_cb_type read_callback = nullptr;
@ -120,35 +118,6 @@ auto resolver::method_name(std::uint16_t id) -> std::string
return utils::string::va("_meth_%04X", id);
}
auto resolver::file_id(const std::string& name) -> std::uint32_t
{
if (name.starts_with("_id_"))
{
return static_cast<std::uint32_t>(std::stoul(name.substr(4), nullptr, 16));
}
const auto itr = file_map_rev.find(name);
if (itr != file_map_rev.end())
{
return itr->second;
}
return 0;
}
auto resolver::file_name(std::uint32_t id) -> std::string
{
const auto itr = file_map.find(id);
if (itr != file_map.end())
{
return std::string(itr->second);
}
return utils::string::va("_id_%04X", id);
}
auto resolver::token_id(const std::string& name) -> std::uint32_t
{
if (name.starts_with("_id_"))
@ -328,159 +297,159 @@ auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesy
const std::array<std::pair<std::uint8_t, const char*>, 153> opcode_list
{{
{ 0x17, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x18, "EVAL_SELF_FIELD_VARIABLE" },
{ 0x19, "RETN" },
{ 0x1A, "CALL_BUILTIN_FUNC_0" },
{ 0x1B, "CALL_BUILTIN_FUNC_1" },
{ 0x1C, "CALL_BUILTIN_FUNC_2" },
{ 0x1D, "CALL_BUILTIN_FUNC_3" },
{ 0x1E, "CALL_BUILTIN_FUNC_4" },
{ 0x1F, "CALL_BUILTIN_FUNC_5" },
{ 0x20, "CALL_BUILTIN_FUNC" },
{ 0x21, "BOOL_NOT" },
{ 0x22, "CALL_FAR_METHOD_THEAD" },
{ 0x23, "JMP_EXPR_TRUE" },
{ 0x24, "SET_LEVEL_FIELD_VARIABLE_FIELD" },
{ 0x25, "CAST_BOOL" },
{ 0x26, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED0" },
{ 0x27, "CALL_BUILTIN_FUNC_POINTER" },
{ 0x28, "INEQUALITY" },
{ 0x29, "GET_THISTHREAD" },
{ 0x2A, "CLEAR_FIELD_VARIABLE" },
{ 0x2B, "GET_FLOAT" },
{ 0x2C, "SAFE_CREATE_VARIABLE_FIELD_CACHED" },
{ 0x2D, "CALL_FAR_FUNC2" },
{ 0x2E, "CALL_FAR_FUNC" },
{ 0x2F, "CALL_FAR_FUNC_CHILD_THREAD" },
{ 0x30, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x31, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x32, "CHECK_CLEAR_PARAMS" },
{ 0x33, "CAST_FIELD_OBJ" },
{ 0x34, "END" },
{ 0x35, "SIZE" },
{ 0x36, "EMPTY_ARRAY" },
{ 0x37, "BIT_AND" },
{ 0x38, "LESSEQUAL" },
{ 0x39, "VOIDCODEPOS" },
{ 0x3A, "CALL_METHOD_THREAD_POINTER" },
{ 0x3B, "ENDSWITCH" },
{ 0x3C, "CLEAR_VARIABLE_FIELD" },
{ 0x3D, "DIV" },
{ 0x3E, "CALL_FAR_METHOD_CHILD_THEAD" },
{ 0x3F, "GET_USHORT" },
{ 0x40, "JMP_TRUE" },
{ 0x41, "GET_SELF" },
{ 0x42, "CALL_FAR_FUNC_THREAD" },
{ 0x43, "CALL_LOCAL_FUNC_THREAD" },
{ 0x44, "SET_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x45, "SET_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x46, "PLUS" },
{ 0x47, "BOOL_COMPLEMENT" },
{ 0x48, "CALL_METHOD_POINTER" },
{ 0x49, "INC" },
{ 0x4A, "REMOVE_LOCAL_VARIABLES" },
{ 0x4B, "JMP_EXPR_FALSE" },
{ 0x4C, "SWITCH" },
{ 0x4D, "CLEAR_PARAMS" },
{ 0x4E, "EVAL_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x4F, "EVAL_LOCAL_VARIABLE_REF_CACHED" },
{ 0x50, "CALL_LOCAL_METHOD" },
{ 0x51, "EVAL_FIELD_VARIABLE" },
{ 0x52, "EVAL_FIELD_VARIABLE_REF" },
{ 0x53, "GET_STRING" },
{ 0x54, "CALL_FUNC_POINTER" },
{ 0x55, "EVAL_LEVEL_FIELD_VARIABLE" },
{ 0x56, "GET_VECTOR" },
{ 0x57, "ENDON" },
{ 0x58, "GREATEREQUAL" },
{ 0x59, "GET_SELF_OBJ" },
{ 0x5A, "SET_ANIM_FIELD_VARIABLE_FIELD" },
{ 0x5B, "SET_VARIABLE_FIELD" },
{ 0x5C, "CALL_LOCAL_FUNC2" },
{ 0x5D, "CALL_LOCAL_FUNC" },
{ 0x5E, "EVAL_LOCAL_ARRAY_REF_CACHED0" },
{ 0x5F, "EVAL_LOCAL_ARRAY_REF_CACHED" },
{ 0x60, "GET_FAR_FUNC" },
{ 0x61, "LESS" },
{ 0x62, "GET_GAME_REF" },
{ 0x63, "WAITTILLFRAMEEND" },
{ 0x64, "SAFE_SET_VARIABLE_FIELD_CACHED0" },
{ 0x65, "SAFE_SET_VARIABLE_FIELD_CACHED" },
{ 0x66, "CALL_METHOD_CHILD_THREAD_POINTER" },
{ 0x67, "GET_LEVEL" },
{ 0x68, "NOTIFY" },
{ 0x69, "DEC_TOP" },
{ 0x6A, "SHIFT_LEFT" },
{ 0x6B, "CALL_LOCAL_METHOD_THREAD" },
{ 0x6C, "CALL_LOCAL_METHOD_CHILD_THREAD" },
{ 0x6D, "GREATER" },
{ 0x6E, "EVAL_LOCAL_VARIABLE_CACHED0" },
{ 0x6F, "EVAL_LOCAL_VARIABLE_CACHED1" },
{ 0x70, "EVAL_LOCAL_VARIABLE_CACHED2" },
{ 0x71, "EVAL_LOCAL_VARIABLE_CACHED3" },
{ 0x72, "EVAL_LOCAL_VARIABLE_CACHED4" },
{ 0x73, "EVAL_LOCAL_VARIABLE_CACHED5" },
{ 0x74, "EVAL_LOCAL_VARIABLE_CACHED" },
{ 0x75, "SAFE_SET_WAITTILL_VARIABLE_FIELD_CACHED" },
{ 0x76, "JMP" },
{ 0x77, "CALL_FUNC_THREAD_POINTER" },
{ 0x78, "GET_ZERO" },
{ 0x79, "WAIT" },
{ 0x7A, "MINUS" },
{ 0x7B, "SET_SELF_FIELD_VARIABLE_FIELD" },
{ 0x7C, "EVAL_NEW_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x7D, "MULT" },
{ 0x7E, "CREATE_LOCAL_VARIABLE" },
{ 0x7F, "CALL_LOCAL_FUNC_CHILD_THREAD" },
{ 0x80, "GET_INT" },
{ 0x81, "MOD" },
{ 0x82, "EVAL_ANIM_FIELD_VARIABLE_REF" },
{ 0x83, "GET_BUILTIN_FUNC" },
{ 0x84, "GET_GAME" },
{ 0x85, "WAITTILL" },
{ 0x86, "DEC" },
{ 0x87, "EVAL_LOCAL_VARIABLE_OBJECT_CACHED" },
{ 0x88, "PRE_CALL" },
{ 0x89, "GET_ANIM" },
{ 0x8A, "GET_UNDEFINED" },
{ 0x8B, "EVAL_LEVEL_FIELD_VARIABLE_REF" },
{ 0x8C, "GET_ANIM_OBJ" },
{ 0x8D, "GET_LEVEL_OBJ" },
{ 0x8E, "BIT_EXOR" },
{ 0x8F, "EQUALITY" },
{ 0x90, "CLEAR_ARRAY" },
{ 0x91, "JMP_BACK" },
{ 0x92, "GET_ANIMATION" },
{ 0x93, "EVAL_ANIM_FIELD_VARIABLE" },
{ 0x94, "GET_ANIMTREE" },
{ 0x95, "GET_ISTRING" },
{ 0x96, "EVAL_ARRAY_REF" },
{ 0x97, "EVAL_SELF_FIELD_VARIABLE_REF" },
{ 0x98, "GET_NBYTE" },
{ 0x99, "GET_BUILTIN_METHOD" },
{ 0x9A, "CALL_BUILTIN_METHOD_POINTER" },
{ 0x9B, "EVAL_ARRAY" },
{ 0x9C, "VECTOR" },
{ 0x9D, "CALL_FAR_METHOD" },
{ 0x9E, "EVAL_LOCAL_ARRAY_CACHED" },
{ 0x9F, "GET_BYTE" },
{ 0xA0, "CALL_FUNC_CHILD_THREAD_POINTER" },
{ 0xA1, "BIT_OR" },
{ 0xA2, "ADD_ARRAY" },
{ 0xA3, "WAITTILLMATCH2" },
{ 0xA4, "WAITTILLMATCH" },
{ 0xA5, "GET_LOCAL_FUNC" },
{ 0xA6, "GET_NUSHORT" },
{ 0xA7, "SHIFT_RIGHT" },
{ 0xA8, "CALL_BUILTIN_METHOD_0" },
{ 0xA9, "CALL_BUILTIN_METHOD_1" },
{ 0xAA, "CALL_BUILTIN_METHOD_2" },
{ 0xAB, "CALL_BUILTIN_METHOD_3" },
{ 0xAC, "CALL_BUILTIN_METHOD_4" },
{ 0xAD, "CALL_BUILTIN_METHOD_5" },
{ 0xAE, "CALL_BUILTIN_METHOD" },
{ 0xAF, "JMP_FALSE" },
{ 0x17, "OP_SetNewLocalVariableFieldCached0" },
{ 0x18, "OP_EvalSelfFieldVariable" },
{ 0x19, "OP_Return" },
{ 0x1A, "OP_CallBuiltin0" },
{ 0x1B, "OP_CallBuiltin1" },
{ 0x1C, "OP_CallBuiltin2" },
{ 0x1D, "OP_CallBuiltin3" },
{ 0x1E, "OP_CallBuiltin4" },
{ 0x1F, "OP_CallBuiltin5" },
{ 0x20, "OP_CallBuiltin" },
{ 0x21, "OP_BoolNot" },
{ 0x22, "OP_ScriptFarMethodThreadCall" },
{ 0x23, "OP_JumpOnTrueExpr" },
{ 0x24, "OP_SetLevelFieldVariableField" },
{ 0x25, "OP_CastBool" },
{ 0x26, "OP_EvalNewLocalArrayRefCached0" },
{ 0x27, "OP_CallBuiltinPointer" },
{ 0x28, "OP_inequality" },
{ 0x29, "OP_GetThisthread" },
{ 0x2A, "OP_ClearFieldVariable" },
{ 0x2B, "OP_GetFloat" },
{ 0x2C, "OP_SafeCreateVariableFieldCached" },
{ 0x2D, "OP_ScriptFarFunctionCall2" },
{ 0x2E, "OP_ScriptFarFunctionCall" },
{ 0x2F, "OP_ScriptFarChildThreadCall" },
{ 0x30, "OP_ClearLocalVariableFieldCached0" },
{ 0x31, "OP_ClearLocalVariableFieldCached" },
{ 0x32, "OP_checkclearparams" },
{ 0x33, "OP_CastFieldObject" },
{ 0x34, "OP_End" },
{ 0x35, "OP_size" },
{ 0x36, "OP_EmptyArray" },
{ 0x37, "OP_bit_and" },
{ 0x38, "OP_less_equal" },
{ 0x39, "OP_voidCodepos" },
{ 0x3A, "OP_ScriptMethodThreadCallPointer" },
{ 0x3B, "OP_endswitch" },
{ 0x3C, "OP_ClearVariableField" },
{ 0x3D, "OP_divide" },
{ 0x3E, "OP_ScriptFarMethodChildThreadCall" },
{ 0x3F, "OP_GetUnsignedShort" },
{ 0x40, "OP_JumpOnTrue" },
{ 0x41, "OP_GetSelf" },
{ 0x42, "OP_ScriptFarThreadCall" },
{ 0x43, "OP_ScriptLocalThreadCall" },
{ 0x44, "OP_SetLocalVariableFieldCached0" },
{ 0x45, "OP_SetLocalVariableFieldCached" },
{ 0x46, "OP_plus" },
{ 0x47, "OP_BoolComplement" },
{ 0x48, "OP_ScriptMethodCallPointer" },
{ 0x49, "OP_inc" },
{ 0x4A, "OP_RemoveLocalVariables" },
{ 0x4B, "OP_JumpOnFalseExpr" },
{ 0x4C, "OP_switch" },
{ 0x4D, "OP_clearparams" },
{ 0x4E, "OP_EvalLocalVariableRefCached0" },
{ 0x4F, "OP_EvalLocalVariableRefCached" },
{ 0x50, "OP_ScriptLocalMethodCall" },
{ 0x51, "OP_EvalFieldVariable" },
{ 0x52, "OP_EvalFieldVariableRef" },
{ 0x53, "OP_GetString" },
{ 0x54, "OP_ScriptFunctionCallPointer" },
{ 0x55, "OP_EvalLevelFieldVariable" },
{ 0x56, "OP_GetVector" },
{ 0x57, "OP_endon" },
{ 0x58, "OP_greater_equal" },
{ 0x59, "OP_GetSelfObject" },
{ 0x5A, "OP_SetAnimFieldVariableField" },
{ 0x5B, "OP_SetVariableField" },
{ 0x5C, "OP_ScriptLocalFunctionCall2" },
{ 0x5D, "OP_ScriptLocalFunctionCall" },
{ 0x5E, "OP_EvalLocalArrayRefCached0" },
{ 0x5F, "OP_EvalLocalArrayRefCached" },
{ 0x60, "OP_GetFarFunction" },
{ 0x61, "OP_less" },
{ 0x62, "OP_GetGameRef" },
{ 0x63, "OP_waittillFrameEnd" },
{ 0x64, "OP_SafeSetVariableFieldCached0" },
{ 0x65, "OP_SafeSetVariableFieldCached" },
{ 0x66, "OP_ScriptMethodChildThreadCallPointer" },
{ 0x67, "OP_GetLevel" },
{ 0x68, "OP_notify" },
{ 0x69, "OP_DecTop" },
{ 0x6A, "OP_shift_left" },
{ 0x6B, "OP_ScriptLocalMethodThreadCall" },
{ 0x6C, "OP_ScriptLocalMethodChildThreadCall" },
{ 0x6D, "OP_greater" },
{ 0x6E, "OP_EvalLocalVariableCached0" },
{ 0x6F, "OP_EvalLocalVariableCached1" },
{ 0x70, "OP_EvalLocalVariableCached2" },
{ 0x71, "OP_EvalLocalVariableCached3" },
{ 0x72, "OP_EvalLocalVariableCached4" },
{ 0x73, "OP_EvalLocalVariableCached5" },
{ 0x74, "OP_EvalLocalVariableCached" },
{ 0x75, "OP_SafeSetWaittillVariableFieldCached" },
{ 0x76, "OP_jump" },
{ 0x77, "OP_ScriptThreadCallPointer" },
{ 0x78, "OP_GetZero" },
{ 0x79, "OP_wait" },
{ 0x7A, "OP_minus" },
{ 0x7B, "OP_SetSelfFieldVariableField" },
{ 0x7C, "OP_EvalNewLocalVariableRefCached0" },
{ 0x7D, "OP_multiply" },
{ 0x7E, "OP_CreateLocalVariable" },
{ 0x7F, "OP_ScriptLocalChildThreadCall" },
{ 0x80, "OP_GetInteger" },
{ 0x81, "OP_mod" },
{ 0x82, "OP_EvalAnimFieldVariableRef" },
{ 0x83, "OP_GetBuiltinFunction" },
{ 0x84, "OP_GetGame" },
{ 0x85, "OP_waittill" },
{ 0x86, "OP_dec" },
{ 0x87, "OP_EvalLocalVariableObjectCached" },
{ 0x88, "OP_PreScriptCall" },
{ 0x89, "OP_GetAnim" },
{ 0x8A, "OP_GetUndefined" },
{ 0x8B, "OP_EvalLevelFieldVariableRef" },
{ 0x8C, "OP_GetAnimObject" },
{ 0x8D, "OP_GetLevelObject" },
{ 0x8E, "OP_bit_ex_or" },
{ 0x8F, "OP_equality" },
{ 0x90, "OP_ClearArray" },
{ 0x91, "OP_jumpback" },
{ 0x92, "OP_GetAnimation" },
{ 0x93, "OP_EvalAnimFieldVariable" },
{ 0x94, "OP_GetAnimTree" },
{ 0x95, "OP_GetIString" },
{ 0x96, "OP_EvalArrayRef" },
{ 0x97, "OP_EvalSelfFieldVariableRef" },
{ 0x98, "OP_GetNegByte" },
{ 0x99, "OP_GetBuiltinMethod" },
{ 0x9A, "OP_CallBuiltinMethodPointer" },
{ 0x9B, "OP_EvalArray" },
{ 0x9C, "OP_vector" },
{ 0x9D, "OP_ScriptFarMethodCall" },
{ 0x9E, "OP_EvalLocalArrayCached" },
{ 0x9F, "OP_GetByte" },
{ 0xA0, "OP_ScriptChildThreadCallPointer" },
{ 0xA1, "OP_bit_or" },
{ 0xA2, "OP_AddArray" },
{ 0xA3, "OP_waittillmatch2" },
{ 0xA4, "OP_waittillmatch" },
{ 0xA5, "OP_GetLocalFunction" },
{ 0xA6, "OP_GetNegUnsignedShort" },
{ 0xA7, "OP_shift_right" },
{ 0xA8, "OP_CallBuiltinMethod0" },
{ 0xA9, "OP_CallBuiltinMethod1" },
{ 0xAA, "OP_CallBuiltinMethod2" },
{ 0xAB, "OP_CallBuiltinMethod3" },
{ 0xAC, "OP_CallBuiltinMethod4" },
{ 0xAD, "OP_CallBuiltinMethod5" },
{ 0xAE, "OP_CallBuiltinMethod" },
{ 0xAF, "OP_JumpOnFalse" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 807> function_list
@ -2798,11 +2767,6 @@ const std::array<std::pair<std::uint16_t, const char*>, 1500> method_list
{ 0x85DB, "_meth_85DB" },
}};
const std::array<std::pair<std::uint32_t, const char*>, 1> file_list
{{
{ 0, "null" },
}};
const std::array<std::pair<std::uint32_t, const char*>, 5> token_list
{{
{ 0x0000, "" },
@ -2826,8 +2790,6 @@ struct __init__
function_map_rev.reserve(function_list.size());
method_map.reserve(method_list.size());
method_map_rev.reserve(method_list.size());
file_map.reserve(file_list.size());
file_map_rev.reserve(file_list.size());
token_map.reserve(token_list.size());
token_map_rev.reserve(token_list.size());
@ -2849,12 +2811,6 @@ struct __init__
method_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : file_list)
{
file_map.insert({ entry.first, entry.second });
file_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : token_list)
{
token_map.insert({ entry.first, entry.second });

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint32_t;
static auto file_name(std::uint32_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint32_t;
static auto token_name(std::uint32_t id) -> std::string;

View File

@ -483,7 +483,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint32_t>(file_id);

View File

@ -387,7 +387,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint32_t>();
const auto file_name = file_id == 0 ? decrypt_string(stack_->read_c_string()) : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? decrypt_string(stack_->read_c_string()) : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint32_t>();
const auto func_name = func_id == 0 ? decrypt_string(stack_->read_c_string()) : resolver::token_name(func_id);

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint32_t;
static auto file_name(std::uint32_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint32_t;
static auto token_name(std::uint32_t id) -> std::string;

View File

@ -429,7 +429,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint16_t>(file_id);

View File

@ -335,7 +335,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint16_t>();
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint16_t>();
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);

File diff suppressed because it is too large Load Diff

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint16_t;
static auto file_name(std::uint16_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint16_t;
static auto token_name(std::uint16_t id) -> std::string;

View File

@ -430,7 +430,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint16_t>(file_id);

View File

@ -336,7 +336,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint16_t>();
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint16_t>();
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);

View File

@ -17,12 +17,10 @@ namespace xsk::gsc::s2
std::unordered_map<std::uint8_t, std::string_view> opcode_map;
std::unordered_map<std::uint16_t, std::string_view> function_map;
std::unordered_map<std::uint16_t, std::string_view> method_map;
std::unordered_map<std::uint16_t, std::string_view> file_map;
std::unordered_map<std::uint16_t, std::string_view> token_map;
std::unordered_map<std::string_view, std::uint8_t> opcode_map_rev;
std::unordered_map<std::string_view, std::uint16_t> function_map_rev;
std::unordered_map<std::string_view, std::uint16_t> method_map_rev;
std::unordered_map<std::string_view, std::uint16_t> file_map_rev;
std::unordered_map<std::string_view, std::uint16_t> token_map_rev;
std::unordered_map<std::string, std::vector<std::uint8_t>> files;
read_cb_type read_callback = nullptr;
@ -120,35 +118,6 @@ auto resolver::method_name(std::uint16_t id) -> std::string
return utils::string::va("_meth_%04X", id);
}
auto resolver::file_id(const std::string& name) -> std::uint16_t
{
if (name.starts_with("_id_"))
{
return static_cast<std::uint16_t>(std::stoul(name.substr(4), nullptr, 16));
}
const auto itr = file_map_rev.find(name);
if (itr != file_map_rev.end())
{
return itr->second;
}
return 0;
}
auto resolver::file_name(std::uint16_t id) -> std::string
{
const auto itr = file_map.find(id);
if (itr != file_map.end())
{
return std::string(itr->second);
}
return utils::string::va("_id_%04X", id);
}
auto resolver::token_id(const std::string& name) -> std::uint16_t
{
if (name.starts_with("_id_"))
@ -328,161 +297,161 @@ auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesy
const std::array<std::pair<std::uint8_t, const char*>, 155> opcode_list
{{
{ 0x17, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x18, "EVAL_SELF_FIELD_VARIABLE" },
{ 0x19, "RETN" },
{ 0x1A, "CALL_BUILTIN_FUNC_0" },
{ 0x1B, "CALL_BUILTIN_FUNC_1" },
{ 0x1C, "CALL_BUILTIN_FUNC_2" },
{ 0x1D, "CALL_BUILTIN_FUNC_3" },
{ 0x1E, "CALL_BUILTIN_FUNC_4" },
{ 0x1F, "CALL_BUILTIN_FUNC_5" },
{ 0x20, "CALL_BUILTIN_FUNC" },
{ 0x21, "BOOL_NOT" },
{ 0x22, "CALL_FAR_METHOD_THEAD" },
{ 0x23, "JMP_EXPR_TRUE" },
{ 0x24, "SET_LEVEL_FIELD_VARIABLE_FIELD" },
{ 0x25, "CAST_BOOL" },
{ 0x26, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED0" },
{ 0x27, "CALL_BUILTIN_FUNC_POINTER" },
{ 0x28, "INEQUALITY" },
{ 0x29, "GET_THISTHREAD" },
{ 0x2A, "CLEAR_FIELD_VARIABLE" },
{ 0x2B, "GET_FLOAT" },
{ 0x2C, "SAFE_CREATE_VARIABLE_FIELD_CACHED" },
{ 0x2D, "CALL_FAR_FUNC2" },
{ 0x2E, "CALL_FAR_FUNC" },
{ 0x2F, "CALL_FAR_FUNC_CHILD_THREAD" },
{ 0x30, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x31, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x32, "CHECK_CLEAR_PARAMS" },
{ 0x33, "CAST_FIELD_OBJ" },
{ 0x34, "END" },
{ 0x35, "SIZE" },
{ 0x36, "EMPTY_ARRAY" },
{ 0x37, "BIT_AND" },
{ 0x38, "LESSEQUAL" },
{ 0x39, "VOIDCODEPOS" },
{ 0x3A, "CALL_METHOD_THREAD_POINTER" },
{ 0x3B, "ENDSWITCH" },
{ 0x3C, "CLEAR_VARIABLE_FIELD" },
{ 0x3D, "DIV" },
{ 0x3E, "CALL_FAR_METHOD_CHILD_THEAD" },
{ 0x3F, "GET_USHORT" },
{ 0x40, "JMP_TRUE" },
{ 0x41, "GET_SELF" },
{ 0x42, "CALL_FAR_FUNC_THREAD" },
{ 0x43, "CALL_LOCAL_FUNC_THREAD" },
{ 0x44, "SET_LOCAL_VARIABLE_FIELD_CACHED0" },
{ 0x45, "SET_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x46, "PLUS" },
{ 0x47, "BOOL_COMPLEMENT" },
{ 0x48, "CALL_METHOD_POINTER" },
{ 0x49, "INC" },
{ 0x4A, "REMOVE_LOCAL_VARIABLES" },
{ 0x4B, "JMP_EXPR_FALSE" },
{ 0x4C, "SWITCH" },
{ 0x4D, "CLEAR_PARAMS" },
{ 0x4E, "EVAL_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x4F, "EVAL_LOCAL_VARIABLE_REF_CACHED" },
{ 0x50, "CALL_LOCAL_METHOD" },
{ 0x51, "EVAL_FIELD_VARIABLE" },
{ 0x52, "EVAL_FIELD_VARIABLE_REF" },
{ 0x53, "GET_STRING" },
{ 0x54, "CALL_FUNC_POINTER" },
{ 0x55, "EVAL_LEVEL_FIELD_VARIABLE" },
{ 0x56, "GET_VECTOR" },
{ 0x57, "ENDON" },
{ 0x58, "GREATEREQUAL" },
{ 0x59, "GET_SELF_OBJ" },
{ 0x5A, "SET_ANIM_FIELD_VARIABLE_FIELD" },
{ 0x5B, "SET_VARIABLE_FIELD" },
{ 0x5C, "CALL_LOCAL_FUNC2" },
{ 0x5D, "CALL_LOCAL_FUNC" },
{ 0x5E, "EVAL_LOCAL_ARRAY_REF_CACHED0" },
{ 0x5F, "EVAL_LOCAL_ARRAY_REF_CACHED" },
{ 0x60, "GET_FAR_FUNC" },
{ 0x61, "LESS" },
{ 0x62, "GET_GAME_REF" },
{ 0x63, "WAITFRAME" },
{ 0x64, "WAITTILLFRAMEEND" },
{ 0x65, "SAFE_SET_VARIABLE_FIELD_CACHED0" },
{ 0x66, "SAFE_SET_VARIABLE_FIELD_CACHED" },
{ 0x67, "CALL_METHOD_CHILD_THREAD_POINTER" },
{ 0x68, "GET_LEVEL" },
{ 0x69, "NOTIFY" },
{ 0x6A, "DEC_TOP" },
{ 0x6B, "SHIFT_LEFT" },
{ 0x6C, "CALL_LOCAL_METHOD_THREAD" },
{ 0x6D, "CALL_LOCAL_METHOD_CHILD_THREAD" },
{ 0x6E, "GREATER" },
{ 0x6F, "EVAL_LOCAL_VARIABLE_CACHED0" },
{ 0x70, "EVAL_LOCAL_VARIABLE_CACHED1" },
{ 0x71, "EVAL_LOCAL_VARIABLE_CACHED2" },
{ 0x72, "EVAL_LOCAL_VARIABLE_CACHED3" },
{ 0x73, "EVAL_LOCAL_VARIABLE_CACHED4" },
{ 0x74, "EVAL_LOCAL_VARIABLE_CACHED5" },
{ 0x75, "EVAL_LOCAL_VARIABLE_CACHED" },
{ 0x76, "SAFE_SET_WAITTILL_VARIABLE_FIELD_CACHED" },
{ 0x77, "JMP" },
{ 0x78, "CALL_FUNC_THREAD_POINTER" },
{ 0x79, "GET_ZERO" },
{ 0x7A, "WAIT" },
{ 0x7B, "MINUS" },
{ 0x7C, "SET_SELF_FIELD_VARIABLE_FIELD" },
{ 0x7D, "EVAL_NEW_LOCAL_VARIABLE_REF_CACHED0" },
{ 0x7E, "MULT" },
{ 0x7F, "CREATE_LOCAL_VARIABLE" },
{ 0x80, "CALL_LOCAL_FUNC_CHILD_THREAD" },
{ 0x81, "GET_INT" },
{ 0x82, "MOD" },
{ 0x83, "EVAL_ANIM_FIELD_VARIABLE_REF" },
{ 0x84, "GET_BUILTIN_FUNC" },
{ 0x85, "GET_GAME" },
{ 0x86, "WAITTILL" },
{ 0x87, "DEC" },
{ 0x88, "EVAL_LOCAL_VARIABLE_OBJECT_CACHED" },
{ 0x89, "PRE_CALL" },
{ 0x8A, "GET_ANIM" },
{ 0x8B, "GET_UNDEFINED" },
{ 0x8C, "EVAL_LEVEL_FIELD_VARIABLE_REF" },
{ 0x8D, "GET_ANIM_OBJ" },
{ 0x8E, "GET_LEVEL_OBJ" },
{ 0x8F, "BIT_EXOR" },
{ 0x90, "EQUALITY" },
{ 0x91, "CLEAR_ARRAY" },
{ 0x92, "JMP_BACK" },
{ 0x93, "GET_ANIMATION" },
{ 0x94, "EVAL_ANIM_FIELD_VARIABLE" },
{ 0x95, "GET_ANIMTREE" },
{ 0x96, "GET_ISTRING" },
{ 0x97, "EVAL_ARRAY_REF" },
{ 0x98, "EVAL_SELF_FIELD_VARIABLE_REF" },
{ 0x99, "GET_NBYTE" },
{ 0x9A, "GET_BUILTIN_METHOD" },
{ 0x9B, "CALL_BUILTIN_METHOD_POINTER" },
{ 0x9C, "EVAL_ARRAY" },
{ 0x9D, "VECTOR" },
{ 0x9E, "CALL_FAR_METHOD" },
{ 0x9F, "EVAL_LOCAL_ARRAY_CACHED" },
{ 0xA0, "GET_BYTE" },
{ 0xA1, "CALL_FUNC_CHILD_THREAD_POINTER" },
{ 0xA2, "BIT_OR" },
{ 0xA3, "ADD_ARRAY" },
{ 0xA4, "WAITTILLMATCH2" },
{ 0xA5, "WAITTILLMATCH" },
{ 0xA6, "GET_LOCAL_FUNC" },
{ 0xA7, "GET_NUSHORT" },
{ 0xA8, "SHIFT_RIGHT" },
{ 0xA9, "CALL_BUILTIN_METHOD_0" },
{ 0xAA, "CALL_BUILTIN_METHOD_1" },
{ 0xAB, "CALL_BUILTIN_METHOD_2" },
{ 0xAC, "CALL_BUILTIN_METHOD_3" },
{ 0xAD, "CALL_BUILTIN_METHOD_4" },
{ 0xAE, "CALL_BUILTIN_METHOD_5" },
{ 0xAF, "CALL_BUILTIN_METHOD" },
{ 0xB0, "JMP_FALSE" },
{ 0xB1, "BOOL_NOT_AFTER_AND" },
{ 0x17, "OP_SetNewLocalVariableFieldCached0" },
{ 0x18, "OP_EvalSelfFieldVariable" },
{ 0x19, "OP_Return" },
{ 0x1A, "OP_CallBuiltin0" },
{ 0x1B, "OP_CallBuiltin1" },
{ 0x1C, "OP_CallBuiltin2" },
{ 0x1D, "OP_CallBuiltin3" },
{ 0x1E, "OP_CallBuiltin4" },
{ 0x1F, "OP_CallBuiltin5" },
{ 0x20, "OP_CallBuiltin" },
{ 0x21, "OP_BoolNot" },
{ 0x22, "OP_ScriptFarMethodThreadCall" },
{ 0x23, "OP_JumpOnTrueExpr" },
{ 0x24, "OP_SetLevelFieldVariableField" },
{ 0x25, "OP_CastBool" },
{ 0x26, "OP_EvalNewLocalArrayRefCached0" },
{ 0x27, "OP_CallBuiltinPointer" },
{ 0x28, "OP_inequality" },
{ 0x29, "OP_GetThisthread" },
{ 0x2A, "OP_ClearFieldVariable" },
{ 0x2B, "OP_GetFloat" },
{ 0x2C, "OP_SafeCreateVariableFieldCached" },
{ 0x2D, "OP_ScriptFarFunctionCall2" },
{ 0x2E, "OP_ScriptFarFunctionCall" },
{ 0x2F, "OP_ScriptFarChildThreadCall" },
{ 0x30, "OP_ClearLocalVariableFieldCached0" },
{ 0x31, "OP_ClearLocalVariableFieldCached" },
{ 0x32, "OP_checkclearparams" },
{ 0x33, "OP_CastFieldObject" },
{ 0x34, "OP_End" },
{ 0x35, "OP_size" },
{ 0x36, "OP_EmptyArray" },
{ 0x37, "OP_bit_and" },
{ 0x38, "OP_less_equal" },
{ 0x39, "OP_voidCodepos" },
{ 0x3A, "OP_ScriptMethodThreadCallPointer" },
{ 0x3B, "OP_endswitch" },
{ 0x3C, "OP_ClearVariableField" },
{ 0x3D, "OP_divide" },
{ 0x3E, "OP_ScriptFarMethodChildThreadCall" },
{ 0x3F, "OP_GetUnsignedShort" },
{ 0x40, "OP_JumpOnTrue" },
{ 0x41, "OP_GetSelf" },
{ 0x42, "OP_ScriptFarThreadCall" },
{ 0x43, "OP_ScriptLocalThreadCall" },
{ 0x44, "OP_SetLocalVariableFieldCached0" },
{ 0x45, "OP_SetLocalVariableFieldCached" },
{ 0x46, "OP_plus" },
{ 0x47, "OP_BoolComplement" },
{ 0x48, "OP_ScriptMethodCallPointer" },
{ 0x49, "OP_inc" },
{ 0x4A, "OP_RemoveLocalVariables" },
{ 0x4B, "OP_JumpOnFalseExpr" },
{ 0x4C, "OP_switch" },
{ 0x4D, "OP_clearparams" },
{ 0x4E, "OP_EvalLocalVariableRefCached0" },
{ 0x4F, "OP_EvalLocalVariableRefCached" },
{ 0x50, "OP_ScriptLocalMethodCall" },
{ 0x51, "OP_EvalFieldVariable" },
{ 0x52, "OP_EvalFieldVariableRef" },
{ 0x53, "OP_GetString" },
{ 0x54, "OP_ScriptFunctionCallPointer" },
{ 0x55, "OP_EvalLevelFieldVariable" },
{ 0x56, "OP_GetVector" },
{ 0x57, "OP_endon" },
{ 0x58, "OP_greater_equal" },
{ 0x59, "OP_GetSelfObject" },
{ 0x5A, "OP_SetAnimFieldVariableField" },
{ 0x5B, "OP_SetVariableField" },
{ 0x5C, "OP_ScriptLocalFunctionCall2" },
{ 0x5D, "OP_ScriptLocalFunctionCall" },
{ 0x5E, "OP_EvalLocalArrayRefCached0" },
{ 0x5F, "OP_EvalLocalArrayRefCached" },
{ 0x60, "OP_GetFarFunction" },
{ 0x61, "OP_less" },
{ 0x62, "OP_GetGameRef" },
{ 0x63, "OP_waittillFrameEnd" },
{ 0x64, "OP_waitFrame" },
{ 0x65, "OP_SafeSetVariableFieldCached0" },
{ 0x66, "OP_SafeSetVariableFieldCached" },
{ 0x67, "OP_ScriptMethodChildThreadCallPointer" },
{ 0x68, "OP_GetLevel" },
{ 0x69, "OP_notify" },
{ 0x6A, "OP_DecTop" },
{ 0x6B, "OP_shift_left" },
{ 0x6C, "OP_ScriptLocalMethodThreadCall" },
{ 0x6D, "OP_ScriptLocalMethodChildThreadCall" },
{ 0x6E, "OP_greater" },
{ 0x6F, "OP_EvalLocalVariableCached0" },
{ 0x70, "OP_EvalLocalVariableCached1" },
{ 0x71, "OP_EvalLocalVariableCached2" },
{ 0x72, "OP_EvalLocalVariableCached3" },
{ 0x73, "OP_EvalLocalVariableCached4" },
{ 0x74, "OP_EvalLocalVariableCached5" },
{ 0x75, "OP_EvalLocalVariableCached" },
{ 0x76, "OP_SafeSetWaittillVariableFieldCached" },
{ 0x77, "OP_jump" },
{ 0x78, "OP_ScriptThreadCallPointer" },
{ 0x79, "OP_GetZero" },
{ 0x7A, "OP_wait" },
{ 0x7B, "OP_minus" },
{ 0x7C, "OP_SetSelfFieldVariableField" },
{ 0x7D, "OP_EvalNewLocalVariableRefCached0" },
{ 0x7E, "OP_multiply" },
{ 0x7F, "OP_CreateLocalVariable" },
{ 0x80, "OP_ScriptLocalChildThreadCall" },
{ 0x81, "OP_GetInteger" },
{ 0x82, "OP_mod" },
{ 0x83, "OP_EvalAnimFieldVariableRef" },
{ 0x84, "OP_GetBuiltinFunction" },
{ 0x85, "OP_GetGame" },
{ 0x86, "OP_waittill" },
{ 0x87, "OP_dec" },
{ 0x88, "OP_EvalLocalVariableObjectCached" },
{ 0x89, "OP_PreScriptCall" },
{ 0x8A, "OP_GetAnim" },
{ 0x8B, "OP_GetUndefined" },
{ 0x8C, "OP_EvalLevelFieldVariableRef" },
{ 0x8D, "OP_GetAnimObject" },
{ 0x8E, "OP_GetLevelObject" },
{ 0x8F, "OP_bit_ex_or" },
{ 0x90, "OP_equality" },
{ 0x91, "OP_ClearArray" },
{ 0x92, "OP_jumpback" },
{ 0x93, "OP_GetAnimation" },
{ 0x94, "OP_EvalAnimFieldVariable" },
{ 0x95, "OP_GetAnimTree" },
{ 0x96, "OP_GetIString" },
{ 0x97, "OP_EvalArrayRef" },
{ 0x98, "OP_EvalSelfFieldVariableRef" },
{ 0x99, "OP_GetNegByte" },
{ 0x9A, "OP_GetBuiltinMethod" },
{ 0x9B, "OP_CallBuiltinMethodPointer" },
{ 0x9C, "OP_EvalArray" },
{ 0x9D, "OP_vector" },
{ 0x9E, "OP_ScriptFarMethodCall" },
{ 0x9F, "OP_EvalLocalArrayCached" },
{ 0xA0, "OP_GetByte" },
{ 0xA1, "OP_ScriptChildThreadCallPointer" },
{ 0xA2, "OP_bit_or" },
{ 0xA3, "OP_AddArray" },
{ 0xA4, "OP_waittillmatch2" },
{ 0xA5, "OP_waittillmatch" },
{ 0xA6, "OP_GetLocalFunction" },
{ 0xA7, "OP_GetNegUnsignedShort" },
{ 0xA8, "OP_shift_right" },
{ 0xA9, "OP_CallBuiltinMethod0" },
{ 0xAA, "OP_CallBuiltinMethod1" },
{ 0xAB, "OP_CallBuiltinMethod2" },
{ 0xAC, "OP_CallBuiltinMethod3" },
{ 0xAD, "OP_CallBuiltinMethod4" },
{ 0xAE, "OP_CallBuiltinMethod5" },
{ 0xAF, "OP_CallBuiltinMethod" },
{ 0xB0, "OP_JumpOnFalse" },
{ 0xB1, "OP_BoolNotAfterAnd" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 1000> function_list
@ -3193,11 +3162,6 @@ const std::array<std::pair<std::uint16_t, const char*>, 1700> method_list
{ 0x86A3, "_meth_86A3" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 1> file_list
{{
{ 0, "null" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 5> token_list
{{
{ 0x00, "" },
@ -3221,8 +3185,6 @@ struct __init__
function_map_rev.reserve(function_list.size());
method_map.reserve(method_list.size());
method_map_rev.reserve(method_list.size());
file_map.reserve(file_list.size());
file_map_rev.reserve(file_list.size());
token_map.reserve(token_list.size());
token_map_rev.reserve(token_list.size());
@ -3244,12 +3206,6 @@ struct __init__
method_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : file_list)
{
file_map.insert({ entry.first, entry.second });
file_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : token_list)
{
token_map.insert({ entry.first, entry.second });

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint16_t;
static auto file_name(std::uint16_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint16_t;
static auto token_name(std::uint16_t id) -> std::string;

View File

@ -483,7 +483,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
}
const auto file_id = resolver::file_id(inst->data[0]);
const auto file_id = resolver::token_id(inst->data[0]);
const auto func_id = resolver::token_id(inst->data[1]);
stack_->write<std::uint32_t>(file_id);

View File

@ -387,7 +387,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
}
const auto file_id = stack_->read<std::uint32_t>();
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
const auto func_id = stack_->read<std::uint32_t>();
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);

View File

@ -17,12 +17,10 @@ namespace xsk::gsc::s4
std::unordered_map<std::uint8_t, std::string_view> opcode_map;
std::unordered_map<std::uint16_t, std::string_view> function_map;
std::unordered_map<std::uint16_t, std::string_view> method_map;
std::unordered_map<std::uint32_t, std::string_view> file_map;
std::unordered_map<std::uint32_t, std::string_view> token_map;
std::unordered_map<std::string_view, std::uint8_t> opcode_map_rev;
std::unordered_map<std::string_view, std::uint16_t> function_map_rev;
std::unordered_map<std::string_view, std::uint16_t> method_map_rev;
std::unordered_map<std::string_view, std::uint32_t> file_map_rev;
std::unordered_map<std::string_view, std::uint32_t> token_map_rev;
std::unordered_map<std::string, std::vector<std::uint8_t>> files;
read_cb_type read_callback = nullptr;
@ -120,35 +118,6 @@ auto resolver::method_name(std::uint16_t id) -> std::string
return utils::string::va("_meth_%04X", id);
}
auto resolver::file_id(const std::string& name) -> std::uint32_t
{
if (name.starts_with("_id_"))
{
return static_cast<std::uint32_t>(std::stoul(name.substr(4), nullptr, 16));
}
const auto itr = file_map_rev.find(name);
if (itr != file_map_rev.end())
{
return itr->second;
}
return 0;
}
auto resolver::file_name(std::uint32_t id) -> std::string
{
const auto itr = file_map.find(id);
if (itr != file_map.end())
{
return std::string(itr->second);
}
return utils::string::va("_id_%04X", id);
}
auto resolver::token_id(const std::string& name) -> std::uint32_t
{
if (name.starts_with("_id_"))
@ -328,196 +297,196 @@ auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesy
const std::array<std::pair<std::uint8_t, const char*>, 190> opcode_list
{{
{ 0x00, "CAST_FIELD_OBJECT" },
{ 0x01, "SET_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x02, "PLUS" },
{ 0x03, "REMOVE_LOCAL_VARIABLES" },
{ 0x04, "EVAL_SELF_FIELD_VARIABLE_REF" },
{ 0x05, "SCRIPT_FAR_METHOD_CHILD_THREAD_CALL" },
{ 0x06, "GET_GAME_REF" },
{ 0x07, "EVAL_ANIM_FIELD_VARIABLE" },
{ 0x08, "EVAL_LEVEL_FIELD_VARIABLE_REF" },
{ 0x09, "GET_THISTHREAD" },
{ 0x0A, "GREATER" },
{ 0x0B, "WAITTILLMATCH" },
{ 0x0C, "SHIFT_RIGHT" },
{ 0x0D, "DECREMENT" },
{ 0x0E, "JUMP_ON_TRUE" },
{ 0x0F, "BIT_OR" },
{ 0x10, "EQUALITY" },
{ 0x11, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED_0" },
{ 0x12, "NOTIFY" },
{ 0x13, "GET_VECTOR" },
{ 0x14, "SCRIPT_METHOD_CHILD_THREAD_CALL_POINTER" },
{ 0x15, "PRE_SCRIPT_CALL" },
{ 0x16, "GET_BYTE" },
{ 0x17, "SCRIPT_FAR_THREAD_CALL" },
{ 0x18, "SET_SELF_FIELD_VARIABLE_FIELD" },
{ 0x19, "JUMP_ON_FALSE_EXPR" },
{ 0x1A, "GET_UNDEFINED" },
{ 0x1B, "JUMP_BACK" },
{ 0x1C, "JUMP_ON_TRUE_EXPR" },
{ 0x1D, "CALL_BUILTIN_FUNC_0" },
{ 0x1E, "CALL_BUILTIN_FUNC_1" },
{ 0x1F, "CALL_BUILTIN_FUNC_2" },
{ 0x20, "CALL_BUILTIN_FUNC_3" },
{ 0x21, "CALL_BUILTIN_FUNC_4" },
{ 0x22, "CALL_BUILTIN_FUNC_5" },
{ 0x23, "CALL_BUILTIN_FUNC" },
{ 0x24, "SET_LOCAL_VARIABLE_FIELD_CACHED_0" },
{ 0x25, "CLEAR_FIELD_VARIABLE" },
{ 0x26, "GET_LEVEL" },
{ 0x27, "SIZE" },
{ 0x28, "SAFE_SET_WAITTILL_VARIABLE_FIELD_CACHED" },
{ 0x29, "SCRIPT_LOCAL_METHOD_THREAD_CALL" },
{ 0x2A, "ADD_ARRAY" },
{ 0x2B, "ENDON" },
{ 0x2C, "EVAL_FIELD_VARIABLE" },
{ 0x2D, "SHIFT_LEFT" },
{ 0x2E, "EVAL_LOCAL_ARRAY_REF_CACHED_0" },
{ 0x2F, "RETURN" },
{ 0x30, "CREATE_LOCAL_VARIABLE" },
{ 0x31, "SAFE_SET_VARIABLE_FIELD_CACHED_0" },
{ 0x32, "GET_BUILTIN_FUNCTION" },
{ 0x33, "SCRIPT_LOCAL_METHOD_CALL" },
{ 0x34, "CALL_BUILTIN_METHOD_POINTER" },
{ 0x35, "SCRIPT_LOCAL_CHILD_THREAD_CALL" },
{ 0x36, "GET_SELF_OBJECT" },
{ 0x37, "GET_GAME" },
{ 0x38, "SET_LEVEL_FIELD_VARIABLE_FIELD" },
{ 0x39, "EVAL_ARRAY" },
{ 0x3A, "GET_SELF" },
{ 0x3B, "END" },
{ 0x3C, "EVAL_SELF_FIELD_VARIABLE" },
{ 0x3D, "LESS_EQUAL" },
{ 0x3E, "EVAL_LOCAL_VARIABLE_CACHED_0" },
{ 0x3F, "EVAL_LOCAL_VARIABLE_CACHED_1" },
{ 0x40, "EVAL_LOCAL_VARIABLE_CACHED_2" },
{ 0x41, "EVAL_LOCAL_VARIABLE_CACHED_3" },
{ 0x42, "EVAL_LOCAL_VARIABLE_CACHED_4" },
{ 0x43, "EVAL_LOCAL_VARIABLE_CACHED_5" },
{ 0x44, "EVAL_LOCAL_VARIABLE_CACHED" },
{ 0x45, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED_0" },
{ 0x46, "SCRIPT_CHILD_THREAD_CALL_POINTER" },
{ 0x47, "EVAL_LOCAL_VARIABLE_OBJECT_CACHED" },
{ 0x48, "SCRIPT_LOCAL_THREAD_CALL" },
{ 0x49, "GET_INTEGER" },
{ 0x4A, "SCRIPT_METHOD_CALL_POINTER" },
{ 0x4B, "CHECK_CLEAR_PARAMS" },
{ 0x4C, "SET_ANIM_FIELD_VARIABLE_FIELD" },
{ 0x4D, "WAITTILLMATCH2" },
{ 0x4E, "MINUS" },
{ 0x4F, "SCRIPT_LOCAL_FUNCTION_CALL2" },
{ 0x50, "GET_NEG_USHORT" },
{ 0x51, "GET_NEG_BYTE" },
{ 0x52, "SAFE_CREATE_VARIABLE_FIELD_CACHED" },
{ 0x53, "GREATER_EQUAL" },
{ 0x54, "VECTOR" },
{ 0x55, "GET_BUILTIN_METHOD" },
{ 0x56, "END_SWITCH" },
{ 0x57, "CLEAR_ARRAY" },
{ 0x58, "DECREMENT_TOP" },
{ 0x59, "CAST_BOOL" },
{ 0x5A, "EVAL_ARRAY_REF" },
{ 0x5B, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED_0" },
{ 0x5C, "GET_ZERO" },
{ 0x5D, "WAIT" },
{ 0x5E, "WAITTILL" },
{ 0x5F, "GET_ISTRING" },
{ 0x60, "SCRIPT_FAR_FUNCTION_CALL" },
{ 0x61, "GET_ANIM_OBJECT" },
{ 0x62, "GET_ANIMTREE" },
{ 0x63, "EVAL_LOCAL_ARRAY_CACHED" },
{ 0x64, "MOD" },
{ 0x65, "SCRIPT_FAR_METHOD_THREAD_CALL" },
{ 0x66, "GET_USHORT" },
{ 0x67, "CLEAR_PARAMS" },
{ 0x68, "SCRIPT_METHOD_THREAD_CALL_POINTER" },
{ 0x69, "SCRIPT_FUNCTION_CALL_POINTER" },
{ 0x6A, "EMPTY_ARRAY" },
{ 0x6B, "SAFE_SET_VARIABLE_FIELD_CACHED" },
{ 0x6C, "CLEAR_VARIABLE_FIELD" },
{ 0x6D, "EVAL_FIELD_VARIABLE_REF" },
{ 0x6E, "SCRIPT_LOCAL_METHOD_CHILD_THREAD_CALL" },
{ 0x6F, "EVAL_NEW_LOCAL_VARIABLE_REF_CACHED_0" },
{ 0x70, "GET_FLOAT" },
{ 0x71, "EVAL_LOCAL_VARIABLE_REF_CACHED" },
{ 0x72, "JUMP_ON_FALSE" },
{ 0x73, "BOOL_COMPLEMENT" },
{ 0x74, "SCRIPT_THREAD_CALL_POINTER" },
{ 0x75, "SCRIPT_FAR_FUNCTION_CALL2" },
{ 0x76, "LESS" },
{ 0x77, "BOOL_NOT" },
{ 0x78, "WAITTILLFRAMEEND" },
{ 0x79, "WAITFRAME" },
{ 0x7A, "GET_STRING" },
{ 0x7B, "EVAL_LEVEL_FIELD_VARIABLE" },
{ 0x7C, "GET_LEVEL_OBJECT" },
{ 0x7D, "INCREMENT" },
{ 0x7E, "CALL_BUILTIN_METHOD_0" },
{ 0x7F, "CALL_BUILTIN_METHOD_1" },
{ 0x80, "CALL_BUILTIN_METHOD_2" },
{ 0x81, "CALL_BUILTIN_METHOD_3" },
{ 0x82, "CALL_BUILTIN_METHOD_4" },
{ 0x83, "CALL_BUILTIN_METHOD_5" },
{ 0x84, "CALL_BUILTIN_METHOD" },
{ 0x85, "GET_ANIM" },
{ 0x86, "SWITCH" },
{ 0x87, "SET_VARIABLE_FIELD" },
{ 0x88, "DIV" },
{ 0x89, "GET_LOCAL_FUNCTION" },
{ 0x8A, "SCRIPT_FAR_CHILD_THREAD_CALL" },
{ 0x8B, "MUL" },
{ 0x8C, "CLEAR_LOCAL_VARIABLE_FIELD_CACHED" },
{ 0x8D, "EVAL_ANIM_FIELD_VARIABLE_REF" },
{ 0x8E, "EVAL_LOCAL_ARRAY_REF_CACHED" },
{ 0x8F, "EVAL_LOCAL_VARIABLE_REF_CACHED_0" },
{ 0x90, "BIT_AND" },
{ 0x91, "GET_ANIMATION" },
{ 0x92, "GET_FAR_FUNCTION" },
{ 0x93, "CALL_BUILTIN_POINTER" },
{ 0x94, "JUMP" },
{ 0x95, "VOIDCODEPOS" },
{ 0x96, "SCRIPT_FAR_METHOD_CALL" },
{ 0x97, "INEQUALITY" },
{ 0x98, "SCRIPT_LOCAL_FUNCTION_CALL" },
{ 0x99, "BIT_EXOR" },
{ 0x9A, "NOP" },
{ 0x9B, "ABORT" },
{ 0x9C, "OBJECT" },
{ 0x9D, "THREAD_OBJECT" },
{ 0x9E, "EVAL_LOCAL_VARIABLE" },
{ 0x9F, "EVAL_LOCAL_VARIABLE_REF" },
{ 0xA0, "PROF_BEGIN" },
{ 0xA1, "PROF_END" },
{ 0xA2, "BREAKPOINT" },
{ 0xA3, "ASSIGN_BREAKPOINT" },
{ 0xA4, "MANUAL_AND_ASSIGN_BREAKPOINT" },
{ 0xA5, "BOOL_NOT_AFTER_AND" },
{ 0xA6, "FORMAL_PARAMS" },
{ 0xA7, "IS_DEFINED" },
{ 0xA8, "IS_TRUE" },
{ 0xA9, "NATIVE_GET_LOCAL_FUNCTION" },
{ 0xAA, "NATIVE_LOCAL_FUNCTION_CALL" },
{ 0xAB, "NATIVE_LOCAL_FUNCTION_CALL2" },
{ 0xAC, "NATIVE_LOCAL_METHOD_CALL" },
{ 0xAD, "NATIVE_LOCAL_FUNCTION_THREAD_CALL" },
{ 0xAE, "NATIVE_LOCAL_METHOD_THREAD_CALL" },
{ 0xAF, "NATIVE_LOCAL_FUNCTION_CHILD_THREAD_CALL" },
{ 0xB0, "NATIVE_LOCAL_METHOD_CHILD_THREAD_CALL" },
{ 0xB1, "NATIVE_GET_FAR_FUNCTION" },
{ 0xB2, "NATIVE_FAR_FUNCTION_CALL" },
{ 0xB3, "NATIVE_FAR_FUNCTION_CALL2" },
{ 0xB4, "NATIVE_FAR_METHOD_CALL" },
{ 0xB5, "NATIVE_FAR_FUNCTION_THREAD_CALL" },
{ 0xB6, "NATIVE_FAR_METHOD_THREAD_CALL" },
{ 0xB7, "NATIVE_FAR_FUNCTION_CHILD_THREAD_CALL" },
{ 0xB8, "NATIVE_FAR_METHOD_CHILD_THREAD_CALL" },
{ 0xB9, "EVAL_NEW_LOCAL_ARRAY_REF_CACHED_0_PRECOMPILED" },
{ 0xBA, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED_0_PRECOMPILED" },
{ 0xBB, "CREATE_LOCAL_VARIABLE_PRECOMPILED" },
{ 0xBC, "SAFE_CREATE_VARIABLE_FIELD_CACHED_PRECOMPILED" },
{ 0xBD, "FORMAL_PARAMS_PRECOMPILED" },
{ 0x0, "OP_CastFieldObject" },
{ 0x1, "OP_SetLocalVariableFieldCached" },
{ 0x2, "OP_plus" },
{ 0x3, "OP_RemoveLocalVariables" },
{ 0x4, "OP_EvalSelfFieldVariableRef" },
{ 0x5, "OP_ScriptFarMethodChildThreadCall" },
{ 0x6, "OP_GetGameRef" },
{ 0x7, "OP_EvalAnimFieldVariable" },
{ 0x8, "OP_EvalLevelFieldVariableRef" },
{ 0x9, "OP_GetThisthread" },
{ 0xA, "OP_greater" },
{ 0xB, "OP_waittillmatch" },
{ 0xC, "OP_shift_right" },
{ 0xD, "OP_dec" },
{ 0xE, "OP_JumpOnTrue" },
{ 0xF, "OP_bit_or" },
{ 0x10, "OP_equality" },
{ 0x11, "OP_ClearLocalVariableFieldCached0" },
{ 0x12, "OP_notify" },
{ 0x13, "OP_GetVector" },
{ 0x14, "OP_ScriptMethodChildThreadCallPointer" },
{ 0x15, "OP_PreScriptCall" },
{ 0x16, "OP_GetByte" },
{ 0x17, "OP_ScriptFarThreadCall" },
{ 0x18, "OP_SetSelfFieldVariableField" },
{ 0x19, "OP_JumpOnFalseExpr" },
{ 0x1A, "OP_GetUndefined" },
{ 0x1B, "OP_jumpback" },
{ 0x1C, "OP_JumpOnTrueExpr" },
{ 0x1D, "OP_CallBuiltin0" },
{ 0x1E, "OP_CallBuiltin1" },
{ 0x1F, "OP_CallBuiltin2" },
{ 0x20, "OP_CallBuiltin3" },
{ 0x21, "OP_CallBuiltin4" },
{ 0x22, "OP_CallBuiltin5" },
{ 0x23, "OP_CallBuiltin" },
{ 0x24, "OP_SetLocalVariableFieldCached0" },
{ 0x25, "OP_ClearFieldVariable" },
{ 0x26, "OP_GetLevel" },
{ 0x27, "OP_size" },
{ 0x28, "OP_SafeSetWaittillVariableFieldCached" },
{ 0x29, "OP_ScriptLocalMethodThreadCall" },
{ 0x2A, "OP_AddArray" },
{ 0x2B, "OP_endon" },
{ 0x2C, "OP_EvalFieldVariable" },
{ 0x2D, "OP_shift_left" },
{ 0x2E, "OP_EvalLocalArrayRefCached0" },
{ 0x2F, "OP_Return" },
{ 0x30, "OP_CreateLocalVariable" },
{ 0x31, "OP_SafeSetVariableFieldCached0" },
{ 0x32, "OP_GetBuiltinFunction" },
{ 0x33, "OP_ScriptLocalMethodCall" },
{ 0x34, "OP_CallBuiltinMethodPointer" },
{ 0x35, "OP_ScriptLocalChildThreadCall" },
{ 0x36, "OP_GetSelfObject" },
{ 0x37, "OP_GetGame" },
{ 0x38, "OP_SetLevelFieldVariableField" },
{ 0x39, "OP_EvalArray" },
{ 0x3A, "OP_GetSelf" },
{ 0x3B, "OP_End" },
{ 0x3C, "OP_EvalSelfFieldVariable" },
{ 0x3D, "OP_less_equal" },
{ 0x3E, "OP_EvalLocalVariableCached0" },
{ 0x3F, "OP_EvalLocalVariableCached1" },
{ 0x40, "OP_EvalLocalVariableCached2" },
{ 0x41, "OP_EvalLocalVariableCached3" },
{ 0x42, "OP_EvalLocalVariableCached4" },
{ 0x43, "OP_EvalLocalVariableCached5" },
{ 0x44, "OP_EvalLocalVariableCached" },
{ 0x45, "OP_EvalNewLocalArrayRefCached0" },
{ 0x46, "OP_ScriptChildThreadCallPointer" },
{ 0x47, "OP_EvalLocalVariableObjectCached" },
{ 0x48, "OP_ScriptLocalThreadCall" },
{ 0x49, "OP_GetInteger" },
{ 0x4A, "OP_ScriptMethodCallPointer" },
{ 0x4B, "OP_checkclearparams" },
{ 0x4C, "OP_SetAnimFieldVariableField" },
{ 0x4D, "OP_waittillmatch2" },
{ 0x4E, "OP_minus" },
{ 0x4F, "OP_ScriptLocalFunctionCall2" },
{ 0x50, "OP_GetNegUnsignedShort" },
{ 0x51, "OP_GetNegByte" },
{ 0x52, "OP_SafeCreateVariableFieldCached" },
{ 0x53, "OP_greater_equal" },
{ 0x54, "OP_vector" },
{ 0x55, "OP_GetBuiltinMethod" },
{ 0x56, "OP_endswitch" },
{ 0x57, "OP_ClearArray" },
{ 0x58, "OP_DecTop" },
{ 0x59, "OP_CastBool" },
{ 0x5A, "OP_EvalArrayRef" },
{ 0x5B, "OP_SetNewLocalVariableFieldCached0" },
{ 0x5C, "OP_GetZero" },
{ 0x5D, "OP_wait" },
{ 0x5E, "OP_waittill" },
{ 0x5F, "OP_GetIString" },
{ 0x60, "OP_ScriptFarFunctionCall" },
{ 0x61, "OP_GetAnimObject" },
{ 0x62, "OP_GetAnimTree" },
{ 0x63, "OP_EvalLocalArrayCached" },
{ 0x64, "OP_mod" },
{ 0x65, "OP_ScriptFarMethodThreadCall" },
{ 0x66, "OP_GetUnsignedShort" },
{ 0x67, "OP_clearparams" },
{ 0x68, "OP_ScriptMethodThreadCallPointer" },
{ 0x69, "OP_ScriptFunctionCallPointer" },
{ 0x6A, "OP_EmptyArray" },
{ 0x6B, "OP_SafeSetVariableFieldCached" },
{ 0x6C, "OP_ClearVariableField" },
{ 0x6D, "OP_EvalFieldVariableRef" },
{ 0x6E, "OP_ScriptLocalMethodChildThreadCall" },
{ 0x6F, "OP_EvalNewLocalVariableRefCached0" },
{ 0x70, "OP_GetFloat" },
{ 0x71, "OP_EvalLocalVariableRefCached" },
{ 0x72, "OP_JumpOnFalse" },
{ 0x73, "OP_BoolComplement" },
{ 0x74, "OP_ScriptThreadCallPointer" },
{ 0x75, "OP_ScriptFarFunctionCall2" },
{ 0x76, "OP_less" },
{ 0x77, "OP_BoolNot" },
{ 0x78, "OP_waittillFrameEnd" },
{ 0x79, "OP_waitframe" },
{ 0x7A, "OP_GetString" },
{ 0x7B, "OP_EvalLevelFieldVariable" },
{ 0x7C, "OP_GetLevelObject" },
{ 0x7D, "OP_inc" },
{ 0x7E, "OP_CallBuiltinMethod0" },
{ 0x7F, "OP_CallBuiltinMethod1" },
{ 0x80, "OP_CallBuiltinMethod2" },
{ 0x81, "OP_CallBuiltinMethod3" },
{ 0x82, "OP_CallBuiltinMethod4" },
{ 0x83, "OP_CallBuiltinMethod5" },
{ 0x84, "OP_CallBuiltinMethod" },
{ 0x85, "OP_GetAnim" },
{ 0x86, "OP_switch" },
{ 0x87, "OP_SetVariableField" },
{ 0x88, "OP_divide" },
{ 0x89, "OP_GetLocalFunction" },
{ 0x8A, "OP_ScriptFarChildThreadCall" },
{ 0x8B, "OP_multiply" },
{ 0x8C, "OP_ClearLocalVariableFieldCached" },
{ 0x8D, "OP_EvalAnimFieldVariableRef" },
{ 0x8E, "OP_EvalLocalArrayRefCached" },
{ 0x8F, "OP_EvalLocalVariableRefCached0" },
{ 0x90, "OP_bit_and" },
{ 0x91, "OP_GetAnimation" },
{ 0x92, "OP_GetFarFunction" },
{ 0x93, "OP_CallBuiltinPointer" },
{ 0x94, "OP_jump" },
{ 0x95, "OP_voidCodepos" },
{ 0x96, "OP_ScriptFarMethodCall" },
{ 0x97, "OP_inequality" },
{ 0x98, "OP_ScriptLocalFunctionCall" },
{ 0x99, "OP_bit_ex_or" },
{ 0x9A, "OP_NOP" },
{ 0x9B, "OP_abort" },
{ 0x9C, "OP_object" },
{ 0x9D, "OP_thread_object" },
{ 0x9E, "OP_EvalLocalVariable" },
{ 0x9F, "OP_EvalLocalVariableRef" },
{ 0xA0, "OP_prof_begin" },
{ 0xA1, "OP_prof_end" },
{ 0xA2, "OP_breakpoint" },
{ 0xA3, "OP_assignmentBreakpoint" },
{ 0xA4, "OP_manualAndAssignmentBreakpoint" },
{ 0xA5, "OP_BoolNotAfterAnd" },
{ 0xA6, "OP_FormalParams" },
{ 0xA7, "OP_IsDefined" },
{ 0xA8, "OP_IsTrue" },
{ 0xA9, "OP_NativeGetLocalFunction" },
{ 0xAA, "OP_NativeLocalFunctionCall" },
{ 0xAB, "OP_NativeLocalFunctionCall2" },
{ 0xAC, "OP_NativeLocalMethodCall" },
{ 0xAD, "OP_NativeLocalFunctionThreadCall" },
{ 0xAE, "OP_NativeLocalMethodThreadCall" },
{ 0xAF, "OP_NativeLocalFunctionChildThreadCall" },
{ 0xB0, "OP_NativeLocalMethodChildThreadCall" },
{ 0xB1, "OP_NativeGetFarFunction" },
{ 0xB2, "OP_NativeFarFunctionCall" },
{ 0xB3, "OP_NativeFarFunctionCall2" },
{ 0xB4, "OP_NativeFarMethodCall" },
{ 0xB5, "OP_NativeFarFunctionThreadCall" },
{ 0xB6, "OP_NativeFarMethodThreadCall" },
{ 0xB7, "OP_NativeFarFunctionChildThreadCall" },
{ 0xB8, "OP_NativeFarMethodChildThreadCall" },
{ 0xB9, "OP_EvalNewLocalArrayRefCached0_Precompiled" },
{ 0xBA, "OP_SetNewLocalVariableFieldCached0_Precompiled" },
{ 0xBB, "OP_CreateLocalVariable_Precompiled" },
{ 0xBC, "OP_SafeCreateVariableFieldCached_Precompiled" },
{ 0xBD, "OP_FormalParams_Precompiled" },
}};
const std::array<std::pair<std::uint16_t, const char*>, 4> function_list
@ -532,11 +501,6 @@ const std::array<std::pair<std::uint16_t, const char*>, 1> method_list
{ 0x0, "null" },
}};
const std::array<std::pair<std::uint32_t, const char*>, 1> file_list
{{
{ 0x0, "null" },
}};
const std::array<std::pair<std::uint32_t, const char*>, 5> token_list
{{
{ 0x00, "" },
@ -560,8 +524,6 @@ struct __init__
function_map_rev.reserve(function_list.size());
method_map.reserve(method_list.size());
method_map_rev.reserve(method_list.size());
file_map.reserve(file_list.size());
file_map_rev.reserve(file_list.size());
token_map.reserve(token_list.size());
token_map_rev.reserve(token_list.size());
@ -583,12 +545,6 @@ struct __init__
method_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : file_list)
{
file_map.insert({ entry.first, entry.second });
file_map_rev.insert({ entry.second, entry.first });
}
for (const auto& entry : token_list)
{
token_map.insert({ entry.first, entry.second });

View File

@ -23,9 +23,6 @@ public:
static auto method_id(const std::string& name) -> std::uint16_t;
static auto method_name(std::uint16_t id) -> std::string;
static auto file_id(const std::string& name) -> std::uint32_t;
static auto file_name(std::uint32_t id) -> std::string;
static auto token_id(const std::string& name) -> std::uint32_t;
static auto token_name(std::uint32_t id) -> std::string;

View File

@ -105,17 +105,17 @@ auto choose_resolver_file_name(uint32_t id, game& game) -> std::string
case game::iw5:
return iw5::resolver::token_name(static_cast<std::uint16_t>(id));
case game::iw6:
return iw6::resolver::file_name(static_cast<std::uint16_t>(id));
return iw6::resolver::token_name(static_cast<std::uint16_t>(id));
case game::iw7:
return iw7::resolver::file_name(id);
return iw7::resolver::token_name(id);
case game::iw8:
return iw8::resolver::file_name(id);
return iw8::resolver::token_name(id);
case game::s1:
return s1::resolver::file_name(static_cast<std::uint16_t>(id));
return s1::resolver::token_name(static_cast<std::uint16_t>(id));
case game::s2:
return s2::resolver::file_name(static_cast<std::uint16_t>(id));
return s2::resolver::token_name(static_cast<std::uint16_t>(id));
case game::s4:
return s4::resolver::file_name(id);
return s4::resolver::token_name(id);
case game::h1:
return h1::resolver::token_name(static_cast<std::uint16_t>(id));
case game::h2: