fix(cache): ignore modded rpfs. (#1651)
This commit is contained in:
parent
a83bc4f44c
commit
95f1db0894
@ -17,12 +17,33 @@ namespace big
|
|||||||
m_wrapper_call_back.push_back(cb);
|
m_wrapper_call_back.push_back(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool safe_open_pack_file(rage::fiPackfile& packfile, const std::u8string& path)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
success = packfile.OpenPackfile(reinterpret_cast<const char*>(path.c_str()), true, 0, 0);
|
||||||
|
}
|
||||||
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
void yim_fipackfile::traverse_rpf_file(const std::u8string& path, int depth)
|
void yim_fipackfile::traverse_rpf_file(const std::u8string& path, int depth)
|
||||||
{
|
{
|
||||||
std::string mount_path = std::format("temp{}:/", depth);
|
std::string mount_path = std::format("temp{}:/", depth);
|
||||||
|
|
||||||
rage::fiPackfile packfile;
|
rage::fiPackfile packfile;
|
||||||
packfile.OpenPackfile(reinterpret_cast<const char*>(path.c_str()), true, 0, 0);
|
if (!safe_open_pack_file(packfile, path))
|
||||||
|
{
|
||||||
|
LOG(INFO) << "Failed opening " << reinterpret_cast<const char*>(path.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
packfile.Mount(mount_path.c_str());
|
packfile.Mount(mount_path.c_str());
|
||||||
|
|
||||||
yim_fipackfile rpf_wrapper = yim_fipackfile(&packfile, mount_path);
|
yim_fipackfile rpf_wrapper = yim_fipackfile(&packfile, mount_path);
|
||||||
@ -42,6 +63,14 @@ namespace big
|
|||||||
if (encryption_type == 0xFFFFFF9)
|
if (encryption_type == 0xFFFFFF9)
|
||||||
continue; // skip AES encrypted RPFs
|
continue; // skip AES encrypted RPFs
|
||||||
|
|
||||||
|
// OPEN / CFXP
|
||||||
|
if (encryption_type == 0x4E45504F || encryption_type == 0x50584643)
|
||||||
|
{
|
||||||
|
LOG(INFO) << "Modded RPF, skipping " << reinterpret_cast<const char*>(file.u8string().c_str());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
traverse_rpf_file(file.u8string(), depth + 1);
|
traverse_rpf_file(file.u8string(), depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user