fix(iw9): default case & gen hash map

This commit is contained in:
xensik 2022-11-17 16:17:22 +01:00
parent 79759d91ab
commit 8bc4bec600
2 changed files with 74979 additions and 15 deletions

View File

@ -339,6 +339,11 @@ void disassembler::disassemble_builtin_call(const instruction::ptr& inst, bool m
if (str.starts_with("#xS")) if (str.starts_with("#xS"))
{ {
str = resolver::hash_name(std::stoull(str.substr(3), 0 ,16)); str = resolver::hash_name(std::stoull(str.substr(3), 0 ,16));
if (str.starts_with("id_"))
{
str = "builtin_" + str;
}
} }
script_->seek(2); script_->seek(2);
@ -421,23 +426,19 @@ void disassembler::disassemble_end_switch(const instruction::ptr& inst)
if (byte == 2) if (byte == 2)
{ {
auto str = stack_->read_c_string(); inst->data.push_back("case");
inst->data.push_back(utils::string::quote(stack_->read_c_string(), false));
if (str[0] == 1)
{
inst->data.push_back("default");
}
else
{
inst->data.push_back("case");
inst->data.push_back(utils::string::quote(str, false));
}
} }
else else if (byte == 1)
{ {
inst->data.push_back("case"); inst->data.push_back("case");
inst->data.push_back(utils::string::va("%i", value)); inst->data.push_back(utils::string::va("%i", value));
} }
else // byte == 0
{
//default = value 0 and byte 0 and i = 1
inst->data.push_back("default");
}
const auto addr = index + 4 + offs; const auto addr = index + 4 + offs;
const auto label = utils::string::va("loc_%X", addr); const auto label = utils::string::va("loc_%X", addr);

File diff suppressed because it is too large Load Diff