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,47 @@ 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
{
"character"sv,
"codescripts"sv,
"common_scripts"sv,
"destructible_scripts"sv,
"maps"sv,
"mptype"sv,
"soundscripts"sv,
"vehicle_scripts"sv,
"xmodelalias"sv,
"maps/animated_models"sv,
"maps/createart"sv,
"maps/createfx"sv,
"maps/mp"sv,
"maps/mp/gametypes"sv,
"maps/mp/killstreaks"sv,
"maps/mp/perks"sv,
};
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::h1

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::h2

View File

@ -296,6 +296,57 @@ 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
{
"aitype"sv,
"animscripts"sv,
"character"sv,
"codescripts"sv,
"common_scripts"sv,
"maps"sv,
"mptype"sv,
"vehicle_scripts"sv,
"xmodelalias"sv,
"animscripts/civilian"sv,
"animscripts/dog"sv,
"animscripts/hummer_turret"sv,
"animscripts/riotshield"sv,
"animscripts/saw"sv,
"animscripts/scripted"sv,
"animscripts/technical"sv,
"animscripts/traverse"sv,
"maps/animated_models"sv,
"maps/cinematic_setups"sv,
"maps/createart"sv,
"maps/createfx"sv,
"maps/gametypes"sv,
"maps/mp"sv,
"maps/mp/gametypes"sv,
"maps/mp/killstreaks"sv,
"maps/mp/perks"sv,
};
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*>, 153> opcode_list
{{
{ 0x00, "END" },

View File

@ -37,6 +37,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::iw5

View File

@ -240,6 +240,54 @@ 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
{
"character"sv,
"codescripts"sv,
"common_scripts"sv,
"destructible_scripts"sv,
"maps"sv,
"vehicle_scripts"sv,
"xmodelalias"sv,
"maps/animated_models"sv,
"maps/createart"sv,
"maps/createfx"sv,
"maps/interactive_models"sv,
"maps/mp"sv,
"maps/mp/agents"sv,
"maps/mp/alien"sv,
"maps/mp/bots"sv,
"maps/mp/gametypes"sv,
"maps/mp/killstreaks"sv,
"maps/mp/perks"sv,
"maps/mp/agents/alien"sv,
"maps/mp/agents/dog"sv,
"maps/mp/agents/alien/alien_ancestor"sv,
"maps/mp/agents/alien/alien_kraken"sv,
"maps/mp/agents/alien/alien_spider"sv,
};
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*>, 153> 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::iw6

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*>, 153> 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::iw7

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*>, 190> opcode_list
{{
{ 0x00, "CAST_FIELD_OBJECT" },

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::iw8

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

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*>, 155> 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::s2

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*>, 190> opcode_list
{{
{ 0x00, "CAST_FIELD_OBJECT" },

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::s4

View File

@ -100,37 +100,37 @@ 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> paths
std::set<std::string_view> paths
{
"aitype",
"animscripts",
"character",
"codescripts",
"common_scripts",
"maps",
"mpbody",
"xmodelalias",
"animscripts/ai_subclass",
"animscripts/aitype",
"animscripts/bigdog",
"animscripts/traverse",
"animscripts/turret",
"maps/ai_subclass",
"maps/createart",
"maps/createfx",
"maps/gametypes",
"maps/mp",
"maps/voice",
"maps/mp/animscripts",
"maps/mp/animscripts/traverse",
"maps/mp/bots",
"maps/mp/createart",
"maps/mp/createfx",
"maps/mp/gametypes",
"maps/mp/gametypes_zm",
"maps/mp/killstreaks",
"maps/mp/teams",
"maps/mp/zombies",
"aitype"sv,
"animscripts"sv,
"character"sv,
"codescripts"sv,
"common_scripts"sv,
"maps"sv,
"mpbody"sv,
"xmodelalias"sv,
"animscripts/ai_subclass"sv,
"animscripts/aitype"sv,
"animscripts/bigdog"sv,
"animscripts/traverse"sv,
"animscripts/turret"sv,
"maps/ai_subclass"sv,
"maps/createart"sv,
"maps/createfx"sv,
"maps/gametypes"sv,
"maps/mp"sv,
"maps/voice"sv,
"maps/mp/animscripts"sv,
"maps/mp/animscripts/traverse"sv,
"maps/mp/bots"sv,
"maps/mp/createart"sv,
"maps/mp/createfx"sv,
"maps/mp/gametypes"sv,
"maps/mp/gametypes_zm"sv,
"maps/mp/killstreaks"sv,
"maps/mp/teams"sv,
"maps/mp/zombies"sv,
};
auto resolver::fs_to_game_path(const std::filesystem::path& file) -> std::filesystem::path