Various fixes and fastfile stuff

This commit is contained in:
momo5502 2016-10-21 22:50:17 +02:00
parent 66e9b868b0
commit 157061b6e8
8 changed files with 68 additions and 28 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit ed874df293f8c0831477a2abbdabfb3a0d0441a8
Subproject commit abbefd71666055daac9e14e78262620f9e845850

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit a17eae4142f3ab5eea8189810189ab1fec67294a
Subproject commit 835af2cae1b731a350ac86003f82183302bd2155

View File

@ -151,7 +151,7 @@ namespace Components
OutputDebugStringA(Utils::String::VA("%s: %s\n", FastFiles::Current().data(), name));
}
/*
if (type <= 9 && type >= 6 && Zones::Version() >= 359)
{
static Game::XAssetType __type;
@ -179,9 +179,11 @@ namespace Components
OutputDebugStringA("");
}
}
*/
if (type == 21 && asset->gfxMap->baseName == "mp_underpass"s)
if (type == 21/* && asset->gfxMap->baseName == "mp_underpass"s*/ && false)
{
//asset->gfxMap->dpvs.smodelCount = 0;
Game::GfxWorld* world = nullptr;
@ -335,26 +337,46 @@ namespace Components
static Game::MaterialTechniqueSet* technique = nullptr;
if (type == 5 && Utils::String::StartsWith(name, "wc/"))
/*if (type == 9)
{
if (technique == (Game::MaterialTechniqueSet*)1)
FILE* fp;
fopen_s(&fp, "test.txt", "a");
fprintf(fp, "%s: %s\n", FastFiles::Current().data(), name);
for (int i = 0; i < 48; i++)
{
technique = asset->material->techniqueSet;
if (asset->materialTechset->techniques[i])
{
fprintf(fp, "\t%d: %s\n", i, asset->materialTechset->techniques[i]->name);
for (int j = 0; j <asset->materialTechset->techniques[i]->numPasses; j++)
{
Game::MaterialPass* pass = &asset->materialTechset->techniques[i]->passes[j];
for (int k = 0; k < (pass->argCount1 + pass->argCount2 + pass->argCount3); k++)
{
fprintf(fp, "\t\t%d.%d.%d:\n", i, j, k);
fprintf(fp, "\t\t\tDest: %d\n", pass->argumentDef[k].dest & 0xFFFF);
fprintf(fp, "\t\t\tMore: %d\n", pass->argumentDef[k].more & 0xFFFF);
fprintf(fp, "\t\t\tType: %d\n", pass->argumentDef[k].type & 0xFFFF);
fprintf(fp, "\t\t\tPara: %d\n", pass->argumentDef[k].paramID & 0xFFFF);
}
}
}
}
if (!technique)
{
technique = (Game::MaterialTechniqueSet*)1;
}
fprintf(fp, "\n");
fclose(fp);
}*/
if (Zones::Version() >= 359)
{
//asset->material->techniqueSet = technique;
}
//asset->material->sortKey = rand() & 0xFF;
//OutputDebugStringA(Utils::String::VA("%s: %X %s", FastFiles::Current().data(), asset->material->sortKey & 0xFF, asset->material->name));
}
// if (type == 5)
// {
// FILE* fp;
// fopen_s(&fp, "test.txt", "a");
// fprintf(fp, "%s: %s %X %X %X\n", FastFiles::Current().data(), name, asset->material->sortKey & 0xFF, asset->material->gameFlags & 0xFF, asset->material->stateFlags & 0xFF);
// fclose(fp);
// }
if (type == 5 && name == "wc/codo_ui_viewer_black_decal3"s)
{
@ -545,7 +567,7 @@ namespace Components
// Log missing empty assets
QuickPatch::OnFrame([] ()
{
if (Game::Sys_IsDatabaseReady() && Game::Sys_IsDatabaseReady2() && !AssetHandler::EmptyAssets.empty())
if (FastFiles::Ready() && !AssetHandler::EmptyAssets.empty())
{
for (auto& asset : AssetHandler::EmptyAssets)
{

View File

@ -197,7 +197,7 @@ namespace Components
{
if (ConnectProtocol::Used())
{
if (!Game::Sys_IsDatabaseReady() && !Game::Sys_IsDatabaseReady2())
if (!FastFiles::Ready())
{
QuickPatch::Once(ConnectProtocol::Invocation);
}

View File

@ -218,6 +218,11 @@ namespace Components
return std::ifstream(path.data()).good();
}
bool FastFiles::Ready()
{
return (Game::Sys_IsDatabaseReady() && Game::Sys_IsDatabaseReady2());
}
const char* FastFiles::GetZoneLocation(const char* file)
{
const char* dir = Dvar::Var("fs_basepath").Get<const char*>();

View File

@ -12,7 +12,7 @@ namespace Components
static void AddZonePath(std::string path);
static std::string Current();
static bool Ready();
static bool Exists(std::string file);
static void LoadLocalizeZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);

View File

@ -314,7 +314,15 @@ namespace Components
Assert_Size(Game::XAssetEntry, 16);
Maps::EntryPool.clear();
if (ZoneBuilder::IsEnabled())
{
Maps::EntryPool.resize(1183968);
}
else
{
Maps::EntryPool.resize(789312);
}
// Apply new size
Utils::Hook::Set<DWORD>(0x5BAEB0, Maps::EntryPool.size());
@ -404,11 +412,13 @@ namespace Components
Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp");
Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp");
//Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
//Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp");
//Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
//Maps::AddDependency("mp_firingrange", "mp_underpass");
//Maps::AddDependency("mp_underpass", "mp_firingrange");
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp");
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
Maps::AddDependency("mp_firingrange", "mp_underpass");
Maps::AddDependency("zm_asylum_sh", "iw4x_dependencies_mp");
Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp");
Maps::AddDependency("mp_rust_long", "mp_rust");
#if defined(DEBUG) && defined(ENABLE_DXSDK)
Command::Add("dumpmap", [] (Command::Params)

View File

@ -493,8 +493,11 @@ namespace Components
Utils::Hook::Nop(0x5BB3F2, 5);
Utils::Hook::Nop(0x5BB422, 5);
Utils::Hook::Nop(0x5BB43A, 5);
// Increase asset pools
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_MAP_ENTS, 10);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_XMODELSURFS, 8192);
Game::ReallocateAssetPool(Game::XAssetType::ASSET_TYPE_IMAGE, 14336);
// hunk size (was 300 MiB)
Utils::Hook::Set<DWORD>(0x64A029, 0x38400000); // 900 MiB