change float and default case dissasemble

This commit is contained in:
xensik 2022-08-06 14:12:29 +02:00
parent f197fb160d
commit c0580ef14a
9 changed files with 75 additions and 99 deletions

View File

@ -168,15 +168,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -185,12 +182,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -376,7 +373,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -517,7 +514,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -168,15 +168,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -185,12 +182,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -376,7 +373,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -517,7 +514,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -167,15 +167,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -184,12 +181,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(4);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -375,7 +372,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -516,7 +513,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -167,15 +167,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -184,12 +181,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -375,7 +372,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -516,7 +513,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -167,15 +167,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -184,12 +181,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -375,7 +372,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -516,7 +513,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -183,9 +183,9 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:

View File

@ -168,15 +168,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -185,12 +182,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -376,7 +373,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -517,7 +514,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -169,15 +169,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -186,12 +183,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -377,7 +374,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -518,7 +515,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)

View File

@ -180,15 +180,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
inst->data.push_back(utils::string::va("%i", script_->read<std::int32_t>()));
break;
case opcode::OP_GetFloat:
{
const auto val = script_->read<float>();
inst->data.push_back(utils::string::va("%g%s", val, val == int(val) ? ".0" : ""));
}
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetVector:
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::va("%g", script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
inst->data.push_back(utils::string::float_string(script_->read<float>()));
break;
case opcode::OP_GetString:
case opcode::OP_GetIString:
@ -197,12 +194,12 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst)
break;
case opcode::OP_GetAnimation:
script_->seek(8);
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));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_GetAnimTree:
script_->seek(1);
inst->data.push_back(utils::string::quote(stack_->read_c_string().data(), false));
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
break;
case opcode::OP_waittillmatch:
inst->data.push_back(utils::string::va("%i", script_->read<std::uint8_t>()));
@ -428,7 +425,7 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
else if (value == 0)
{
inst->data.push_back("default");
stack_->read<std::uint16_t>();
stack_->read_c_string();
}
else
{
@ -582,7 +579,7 @@ void disassembler::print_function(const function::ptr& func)
print_instruction(inst);
}
output_->write_string(utils::string::va("end_%s\n", func->name.substr(4).data()));
output_->write_string(utils::string::va("end_%s\n", func->name.data()));
}
void disassembler::print_instruction(const instruction::ptr& inst)