Load new fastfiles (if available!)
This commit is contained in:
parent
d3a9580f8f
commit
422147207d
@ -17,12 +17,29 @@ namespace Components
|
|||||||
info.name = "dlc2_ui_mp";
|
info.name = "dlc2_ui_mp";
|
||||||
data.push_back(info);
|
data.push_back(info);
|
||||||
|
|
||||||
// Don't load it for now
|
// Load custom weapons, if present (force that later on)
|
||||||
//data.push_back({ "weapons_mp", 1, 0 });
|
if (FastFiles::Exists("weapons_mp"))
|
||||||
|
{
|
||||||
|
data.push_back({ "weapons_mp", 1, 0 });
|
||||||
|
}
|
||||||
|
|
||||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Name is a bit weird, due to FasFileS and ExistS :P
|
||||||
|
bool FastFiles::Exists(std::string file)
|
||||||
|
{
|
||||||
|
std::string path = FastFiles::GetZoneLocation(file.data());
|
||||||
|
path.append(file);
|
||||||
|
|
||||||
|
if (!Utils::EndsWith(path.data(), ".ff"))
|
||||||
|
{
|
||||||
|
path.append(".ff");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (GetFileAttributes(path.data()) != INVALID_FILE_ATTRIBUTES);
|
||||||
|
}
|
||||||
|
|
||||||
const char* FastFiles::GetZoneLocation(const char* file)
|
const char* FastFiles::GetZoneLocation(const char* file)
|
||||||
{
|
{
|
||||||
const char* dir = Dvar::Var("fs_basepath").Get<const char*>();
|
const char* dir = Dvar::Var("fs_basepath").Get<const char*>();
|
||||||
@ -32,7 +49,7 @@ namespace Components
|
|||||||
std::string absoluteFile = Utils::VA("%s\\%s%s", dir, path.data(), file);
|
std::string absoluteFile = Utils::VA("%s\\%s%s", dir, path.data(), file);
|
||||||
|
|
||||||
// No ".ff" appended, append it manually
|
// No ".ff" appended, append it manually
|
||||||
if (!Utils::EndsWith(file, ".ff"))
|
if (!Utils::EndsWith(absoluteFile.data(), ".ff"))
|
||||||
{
|
{
|
||||||
absoluteFile.append(".ff");
|
absoluteFile.append(".ff");
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ namespace Components
|
|||||||
static void AddZonePath(std::string path);
|
static void AddZonePath(std::string path);
|
||||||
static std::string Current();
|
static std::string Current();
|
||||||
|
|
||||||
|
static bool Exists(std::string file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<std::string> ZonePaths;
|
static std::vector<std::string> ZonePaths;
|
||||||
static const char* GetZoneLocation(const char* file);
|
static const char* GetZoneLocation(const char* file);
|
||||||
|
@ -40,6 +40,13 @@ namespace Components
|
|||||||
data.push_back(info);
|
data.push_back(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load patch files
|
||||||
|
std::string patchZone = Utils::VA("patch_%s", zoneInfo->name);
|
||||||
|
if (FastFiles::Exists(patchZone))
|
||||||
|
{
|
||||||
|
data.push_back({ patchZone.data(), zoneInfo->allocFlags, zoneInfo->freeFlags });
|
||||||
|
}
|
||||||
|
|
||||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user