fix waittillmatch operation
This commit is contained in:
parent
eaaa6fda85
commit
a23e072d90
@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
||||||
break;
|
break;
|
||||||
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -154,7 +154,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
break;
|
break;
|
||||||
case opcode::OP_GetByte:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
return 1;
|
return 1;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
|
@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
||||||
break;
|
break;
|
||||||
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -154,7 +154,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
break;
|
break;
|
||||||
case opcode::OP_GetByte:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
return 1;
|
return 1;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
|
@ -185,7 +185,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_less:
|
case opcode::OP_less:
|
||||||
case opcode::OP_greater:
|
case opcode::OP_greater:
|
||||||
case opcode::OP_less_equal:
|
case opcode::OP_less_equal:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_waittill:
|
case opcode::OP_waittill:
|
||||||
case opcode::OP_notify:
|
case opcode::OP_notify:
|
||||||
case opcode::OP_endon:
|
case opcode::OP_endon:
|
||||||
@ -261,7 +260,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_CreateLocalVariable:
|
case opcode::OP_CreateLocalVariable:
|
||||||
case opcode::OP_RemoveLocalVariables:
|
case opcode::OP_RemoveLocalVariables:
|
||||||
|
@ -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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -122,7 +122,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_less:
|
case opcode::OP_less:
|
||||||
case opcode::OP_greater:
|
case opcode::OP_greater:
|
||||||
case opcode::OP_less_equal:
|
case opcode::OP_less_equal:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_waittill:
|
case opcode::OP_waittill:
|
||||||
case opcode::OP_notify:
|
case opcode::OP_notify:
|
||||||
case opcode::OP_endon:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_CreateLocalVariable:
|
case opcode::OP_CreateLocalVariable:
|
||||||
case opcode::OP_RemoveLocalVariables:
|
case opcode::OP_RemoveLocalVariables:
|
||||||
|
@ -51,7 +51,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_less:
|
case opcode::OP_less:
|
||||||
case opcode::OP_greater:
|
case opcode::OP_greater:
|
||||||
case opcode::OP_less_equal:
|
case opcode::OP_less_equal:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_waittill:
|
case opcode::OP_waittill:
|
||||||
case opcode::OP_notify:
|
case opcode::OP_notify:
|
||||||
case opcode::OP_endon:
|
case opcode::OP_endon:
|
||||||
|
@ -213,7 +213,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
||||||
break;
|
break;
|
||||||
@ -261,7 +260,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -152,7 +152,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
break;
|
break;
|
||||||
case opcode::OP_GetByte:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -80,7 +80,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
return 1;
|
return 1;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
|
@ -213,7 +213,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
||||||
break;
|
break;
|
||||||
@ -266,7 +265,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -152,7 +152,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
break;
|
break;
|
||||||
case opcode::OP_GetByte:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -80,7 +80,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
return 1;
|
return 1;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
|
@ -182,7 +182,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
@ -281,7 +280,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -121,7 +121,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -49,7 +49,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
|
@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
||||||
break;
|
break;
|
||||||
@ -262,7 +261,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -153,7 +153,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
break;
|
break;
|
||||||
case opcode::OP_GetByte:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
return 1;
|
return 1;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
|
@ -214,7 +214,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
case opcode::OP_BoolNotAfterAnd:
|
case opcode::OP_BoolNotAfterAnd:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -153,7 +153,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
case opcode::OP_BoolNotAfterAnd:
|
case opcode::OP_BoolNotAfterAnd:
|
||||||
break;
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -81,7 +81,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
case opcode::OP_bit_or:
|
case opcode::OP_bit_or:
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_shift_right:
|
case opcode::OP_shift_right:
|
||||||
case opcode::OP_BoolNotAfterAnd:
|
case opcode::OP_BoolNotAfterAnd:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -182,7 +182,6 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
@ -281,7 +280,8 @@ void assembler::assemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
case opcode::OP_waittillmatch:
|
||||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -93,10 +93,6 @@ void compiler::compile_program(const gsc::program_ptr& program)
|
|||||||
{
|
{
|
||||||
emit_define(def);
|
emit_define(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GSC_COMPILER
|
|
||||||
print_debug_info();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void compiler::emit_include(const gsc::include_ptr& include)
|
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_arguments(ctx, stmt->args);
|
||||||
emit_expr(ctx, stmt->expr);
|
emit_expr(ctx, stmt->expr);
|
||||||
emit_expr(ctx, stmt->obj);
|
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);
|
emit_opcode(ctx, opcode::OP_clearparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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>();
|
gsc::expr_arguments_ptr args = std::make_unique<gsc::node_expr_arguments>();
|
||||||
args->loc = loc;
|
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());
|
auto node = std::move(stack_.top());
|
||||||
stack_.pop();
|
stack_.pop();
|
||||||
|
@ -121,7 +121,6 @@ void disassembler::dissasemble_instruction(const gsc::instruction_ptr& inst)
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
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));
|
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
|
||||||
break;
|
break;
|
||||||
case opcode::OP_waittillmatch:
|
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;
|
break;
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
case opcode::OP_EvalNewLocalArrayRefCached0:
|
case opcode::OP_EvalNewLocalArrayRefCached0:
|
||||||
|
@ -49,7 +49,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t
|
|||||||
case opcode::OP_EvalLocalVariableCached5:
|
case opcode::OP_EvalLocalVariableCached5:
|
||||||
case opcode::OP_ScriptMethodCallPointer:
|
case opcode::OP_ScriptMethodCallPointer:
|
||||||
case opcode::OP_checkclearparams:
|
case opcode::OP_checkclearparams:
|
||||||
case opcode::OP_waittillmatch2:
|
|
||||||
case opcode::OP_minus:
|
case opcode::OP_minus:
|
||||||
case opcode::OP_greater_equal:
|
case opcode::OP_greater_equal:
|
||||||
case opcode::OP_vector:
|
case opcode::OP_vector:
|
||||||
|
Loading…
Reference in New Issue
Block a user