update resolvers

This commit is contained in:
xensik
2022-03-15 17:00:55 +01:00
parent 096316ea67
commit c7c0211afb
19 changed files with 329 additions and 30 deletions

View File

@ -240,6 +240,31 @@ auto resolver::file_data(const std::string& name) -> std::tuple<const std::strin
throw error("couldn't open gsc file '" + name + "'");
}
std::set<std::string_view> paths
{
};
auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesystem::path
{
auto result = std::filesystem::path();
auto root = false;
for (auto& entry : file)
{
if (!root && paths.contains(entry.string()))
{
result = entry;
root = true;
}
else if (paths.contains(result.string()))
{
result /= entry;
}
}
return result.empty() ? file : result;
}
const std::array<std::pair<std::uint8_t, const char*>, 154> opcode_list
{{
{ 0x17, "SET_NEW_LOCAL_VARIABLE_FIELD_CACHED0" },

View File

@ -34,6 +34,7 @@ public:
static auto make_token(std::string_view str) -> std::string;
static auto file_data(const std::string& name) -> std::tuple<const std::string*, char*, size_t>;
static auto fs_to_game_path(const std::filesystem::path& file) -> std::filesystem::path;
};
} // namespace xsk::gsc::s1