update h2 symbols
This commit is contained in:
parent
6048902ec7
commit
900ce1db26
@ -429,7 +429,7 @@ void assembler::assemble_far_call(const instruction::ptr& inst, bool thread)
|
||||
script_->write<std::uint8_t>(static_cast<std::uint8_t>(std::stoi(inst->data[2])));
|
||||
}
|
||||
|
||||
const auto file_id = resolver::file_id(inst->data[0]);
|
||||
const auto file_id = resolver::token_id(inst->data[0]);
|
||||
const auto func_id = resolver::token_id(inst->data[1]);
|
||||
|
||||
stack_->write<std::uint16_t>(file_id);
|
||||
|
@ -338,7 +338,7 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa
|
||||
}
|
||||
|
||||
const auto file_id = stack_->read<std::uint16_t>();
|
||||
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::file_name(file_id);
|
||||
const auto file_name = file_id == 0 ? stack_->read_c_string() : resolver::token_name(file_id);
|
||||
const auto func_id = stack_->read<std::uint16_t>();
|
||||
const auto func_name = func_id == 0 ? stack_->read_c_string() : resolver::token_name(func_id);
|
||||
|
||||
|
@ -17,12 +17,10 @@ namespace xsk::gsc::h2
|
||||
std::unordered_map<std::uint8_t, std::string_view> opcode_map;
|
||||
std::unordered_map<std::uint16_t, std::string_view> function_map;
|
||||
std::unordered_map<std::uint16_t, std::string_view> method_map;
|
||||
std::unordered_map<std::uint16_t, std::string_view> file_map;
|
||||
std::unordered_map<std::uint16_t, std::string_view> token_map;
|
||||
std::unordered_map<std::string_view, std::uint8_t> opcode_map_rev;
|
||||
std::unordered_map<std::string_view, std::uint16_t> function_map_rev;
|
||||
std::unordered_map<std::string_view, std::uint16_t> method_map_rev;
|
||||
std::unordered_map<std::string_view, std::uint16_t> file_map_rev;
|
||||
std::unordered_map<std::string_view, std::uint16_t> token_map_rev;
|
||||
std::unordered_map<std::string, std::vector<std::uint8_t>> files;
|
||||
read_cb_type read_callback = nullptr;
|
||||
@ -120,35 +118,6 @@ auto resolver::method_name(std::uint16_t id) -> std::string
|
||||
return utils::string::va("_meth_%04X", id);
|
||||
}
|
||||
|
||||
auto resolver::file_id(const std::string& name) -> std::uint16_t
|
||||
{
|
||||
if (name.starts_with("_id_"))
|
||||
{
|
||||
return static_cast<std::uint16_t>(std::stoul(name.substr(4), nullptr, 16));
|
||||
}
|
||||
|
||||
const auto itr = file_map_rev.find(name);
|
||||
|
||||
if (itr != file_map_rev.end())
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto resolver::file_name(std::uint16_t id) -> std::string
|
||||
{
|
||||
const auto itr = file_map.find(id);
|
||||
|
||||
if (itr != file_map.end())
|
||||
{
|
||||
return std::string(itr->second);
|
||||
}
|
||||
|
||||
return utils::string::va("_id_%04X", id);
|
||||
}
|
||||
|
||||
auto resolver::token_id(const std::string& name) -> std::uint16_t
|
||||
{
|
||||
if (name.starts_with("_id_"))
|
||||
@ -2727,11 +2696,6 @@ const std::array<std::pair<std::uint16_t, const char*>, 1491> method_list
|
||||
{ 0x85D2, "_meth_85D2" },
|
||||
}};
|
||||
|
||||
const std::array<std::pair<std::uint16_t, const char*>, 1> file_list
|
||||
{{
|
||||
{ 0, "null" },
|
||||
}};
|
||||
|
||||
const std::array<std::pair<std::uint16_t, const char*>, 5> token_list
|
||||
{{
|
||||
{ 0x0000, "" },
|
||||
@ -2755,8 +2719,6 @@ struct __init__
|
||||
function_map_rev.reserve(function_list.size());
|
||||
method_map.reserve(method_list.size());
|
||||
method_map_rev.reserve(method_list.size());
|
||||
file_map.reserve(file_list.size());
|
||||
file_map_rev.reserve(file_list.size());
|
||||
token_map.reserve(token_list.size());
|
||||
token_map_rev.reserve(token_list.size());
|
||||
|
||||
@ -2778,12 +2740,6 @@ struct __init__
|
||||
method_map_rev.insert({ entry.second, entry.first });
|
||||
}
|
||||
|
||||
for (const auto& entry : file_list)
|
||||
{
|
||||
file_map.insert({ entry.first, entry.second });
|
||||
file_map_rev.insert({ entry.second, entry.first });
|
||||
}
|
||||
|
||||
for (const auto& entry : token_list)
|
||||
{
|
||||
token_map.insert({ entry.first, entry.second });
|
||||
|
@ -115,7 +115,7 @@ auto choose_resolver_file_name(uint32_t id, game& game) -> std::string
|
||||
case game::H1:
|
||||
return h1::resolver::token_name(static_cast<std::uint16_t>(id));
|
||||
case game::H2:
|
||||
return h2::resolver::file_name(static_cast<std::uint16_t>(id));
|
||||
return h2::resolver::token_name(static_cast<std::uint16_t>(id));
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user