fix waittillmatch operation

This commit is contained in:
xensik 2021-11-11 20:12:19 +01:00
parent eaaa6fda85
commit a23e072d90
45 changed files with 72 additions and 95 deletions

View File

@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
break;
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -302,7 +298,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -154,7 +154,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
break;
case opcode::OP_GetByte:
@ -194,7 +193,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
return 1;
case opcode::OP_SetNewLocalVariableFieldCached0:

View File

@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
break;
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -302,7 +298,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -154,7 +154,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
break;
case opcode::OP_GetByte:
@ -194,7 +193,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
return 1;
case opcode::OP_SetNewLocalVariableFieldCached0:

View File

@ -185,7 +185,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_less:
case opcode::OP_greater:
case opcode::OP_less_equal:
case opcode::OP_waittillmatch2:
case opcode::OP_waittill:
case opcode::OP_notify:
case opcode::OP_endon:
@ -261,7 +260,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_CreateLocalVariable:
case opcode::OP_RemoveLocalVariables:

View File

@ -305,7 +305,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1446,7 +1446,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -122,7 +122,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_less:
case opcode::OP_greater:
case opcode::OP_less_equal:
case opcode::OP_waittillmatch2:
case opcode::OP_waittill:
case opcode::OP_notify:
case opcode::OP_endon:
@ -191,7 +190,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_CreateLocalVariable:
case opcode::OP_RemoveLocalVariables:

View File

@ -51,7 +51,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_less:
case opcode::OP_greater:
case opcode::OP_less_equal:
case opcode::OP_waittillmatch2:
case opcode::OP_waittill:
case opcode::OP_notify:
case opcode::OP_endon:

View File

@ -213,7 +213,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
break;
@ -261,7 +260,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -301,7 +297,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1446,7 +1446,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -152,7 +152,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
break;
case opcode::OP_GetByte:
@ -192,7 +191,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -80,7 +80,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
return 1;
case opcode::OP_SetNewLocalVariableFieldCached0:

View File

@ -213,7 +213,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
break;
@ -266,7 +265,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -301,7 +297,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1446,7 +1446,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -152,7 +152,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
break;
case opcode::OP_GetByte:
@ -192,7 +191,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -80,7 +80,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
return 1;
case opcode::OP_SetNewLocalVariableFieldCached0:

View File

@ -182,7 +182,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector:
@ -281,7 +280,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -317,7 +313,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -121,7 +121,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector:
@ -205,7 +204,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -49,7 +49,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector:

View File

@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
break;
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -302,7 +298,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -153,7 +153,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
break;
case opcode::OP_GetByte:
@ -193,7 +192,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
return 1;
case opcode::OP_SetNewLocalVariableFieldCached0:

View File

@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
case opcode::OP_BoolNotAfterAnd:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -263,7 +262,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -302,7 +298,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -153,7 +153,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
case opcode::OP_BoolNotAfterAnd:
break;
@ -194,7 +193,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_vector:
case opcode::OP_bit_or:
case opcode::OP_AddArray:
case opcode::OP_waittillmatch2:
case opcode::OP_shift_right:
case opcode::OP_BoolNotAfterAnd:
return 1;

View File

@ -182,7 +182,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector:
@ -281,7 +280,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
break;
case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0);
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[0])));
script_->write<std::uint8_t>(static_cast<std::uint8_t>(opcode::OP_waittillmatch2));
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
{
emit_define(def);
}
#ifdef DEBUG_GSC_COMPILER
print_debug_info();
#endif
}
void compiler::emit_include(const gsc::include_ptr& include)
@ -317,7 +313,7 @@ void compiler::emit_stmt_waittillmatch(const gsc::context_ptr& ctx, const gsc::s
emit_expr_arguments(ctx, stmt->args);
emit_expr(ctx, stmt->expr);
emit_expr(ctx, stmt->obj);
emit_opcode(ctx, opcode::OP_waittillmatch);
emit_opcode(ctx, opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size()));
emit_opcode(ctx, opcode::OP_clearparams);
}

View File

@ -1452,7 +1452,9 @@ void decompiler::decompile_statements(const gsc::function_ptr& func)
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
args->loc = loc;
while(stack_.size() > 0)
auto argnum = std::stoul(inst->data[0]);
for (auto i = 0u; i < argnum; i++)
{
auto node = std::move(stack_.top());
stack_.pop();

View File

@ -121,7 +121,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector:
@ -205,7 +204,8 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint16_t>()));
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
script_->seek(1);
break;
case opcode::OP_SetNewLocalVariableFieldCached0:
case opcode::OP_EvalNewLocalArrayRefCached0:

View File

@ -49,7 +49,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
case opcode::OP_EvalLocalVariableCached5:
case opcode::OP_ScriptMethodCallPointer:
case opcode::OP_checkclearparams:
case opcode::OP_waittillmatch2:
case opcode::OP_minus:
case opcode::OP_greater_equal:
case opcode::OP_vector: