Merge pull request #647 from JariKCoding/main
fix: only load the gsc files with the right magic
This commit is contained in:
commit
01ebbd9b3e
@ -12,6 +12,8 @@ namespace script
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
constexpr size_t GSC_MAGIC = 0x1C000A0D43534780;
|
||||||
|
|
||||||
utils::hook::detour db_findxassetheader_hook;
|
utils::hook::detour db_findxassetheader_hook;
|
||||||
utils::hook::detour gscr_get_bgb_remaining_hook;
|
utils::hook::detour gscr_get_bgb_remaining_hook;
|
||||||
|
|
||||||
@ -70,10 +72,13 @@ namespace script
|
|||||||
std::string data;
|
std::string data;
|
||||||
auto script_file = script.generic_string();
|
auto script_file = script.generic_string();
|
||||||
if (!std::filesystem::is_directory(script) && utils::io::read_file(script_file, &data))
|
if (!std::filesystem::is_directory(script) && utils::io::read_file(script_file, &data))
|
||||||
|
{
|
||||||
|
if (data.size() >= sizeof(GSC_MAGIC) && !std::memcmp(data.data(), &GSC_MAGIC, sizeof(GSC_MAGIC)))
|
||||||
{
|
{
|
||||||
print_loading_script(script_file);
|
print_loading_script(script_file);
|
||||||
load_script(script_file, data);
|
load_script(script_file, data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (std::filesystem::is_directory(script))
|
else if (std::filesystem::is_directory(script))
|
||||||
{
|
{
|
||||||
load_scripts_folder(script_file);
|
load_scripts_folder(script_file);
|
||||||
|
Loading…
Reference in New Issue
Block a user