rework endswitch disassemble

This commit is contained in:
xensik 2022-08-06 15:53:03 +02:00
parent 32d4ec28d7
commit 06a30ddd99
8 changed files with 80 additions and 64 deletions

View File

@ -365,15 +365,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -365,15 +365,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -364,15 +364,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -364,15 +364,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -364,15 +364,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -365,15 +365,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -366,15 +366,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x40000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {

View File

@ -417,15 +417,17 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
{ {
const auto value = script_->read<std::uint32_t>(); const auto value = script_->read<std::uint32_t>();
if (value < 0x40000 && value > 0) if (value < 0x80000)
{ {
inst->data.push_back("case"); const auto data = stack_->read_c_string();
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
} if (data.data()[0] != 0x01)
else if (value == 0) {
{ inst->data.push_back("case");
inst->data.push_back("default"); inst->data.push_back(utils::string::quote(data, false));
stack_->read_c_string(); }
else
inst->data.push_back("default");
} }
else else
{ {