From b26152b4d3e1817413982961bcc0f77ad4932972 Mon Sep 17 00:00:00 2001 From: quaK Date: Wed, 3 Jul 2024 13:10:36 +0300 Subject: [PATCH] use this instead ig, no clue --- src/client/component/gsc/script_error.cpp | 33 +++++++---------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/client/component/gsc/script_error.cpp b/src/client/component/gsc/script_error.cpp index 86715329..b2e7234d 100644 --- a/src/client/component/gsc/script_error.cpp +++ b/src/client/component/gsc/script_error.cpp @@ -306,19 +306,6 @@ namespace gsc } } - std::uint32_t get_opcode_size(const std::uint8_t opcode) - { - try - { - const auto index = gsc_ctx->opcode_enum(opcode); - return gsc_ctx->opcode_size(index); - } - catch (...) - { - return 0; - } - } - void builtin_call_error(const std::string& error) { const auto function_id = get_function_id(); @@ -353,17 +340,17 @@ namespace gsc assert(script); const auto& pos_map = gsc::source_pos_map[file_name]; - std::uint32_t opcode_size = 0; - if (first) - { - opcode_size = get_opcode_size(opcode_id); - } - if (!opcode_size) - { - opcode_size = 3; // function call - } + auto position = static_cast(pos - script->bytecode); - position = position + opcode_size; + for (auto i = 0; i < 8; ++i) + { + auto position_fixup = position + i; + if (pos_map.contains(position_fixup)) + { + position = position_fixup; + break; + } + } if (pos_map.contains(position)) {