Workaround
This commit is contained in:
parent
2f8a4dd149
commit
f637670e52
@ -132,7 +132,7 @@ workspace "iw4x"
|
||||
-- Pre-compiled header
|
||||
pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives
|
||||
pchsource "src/STDInclude.cpp" -- real path
|
||||
buildoptions { "/Zm96 -Zm96" }
|
||||
buildoptions { "/Zm91 -Zm91" }
|
||||
filter "files:**.pb.*"
|
||||
flags {
|
||||
"NoPCH",
|
||||
|
@ -22,6 +22,7 @@ namespace Components
|
||||
|
||||
if (AssetHandler::AssetInterfaces.find(iAsset->GetType()) != AssetHandler::AssetInterfaces.end())
|
||||
{
|
||||
Logger::Print("Duplicate interface handler: %s\n", Game::DB_GetXAssetTypeName(iAsset->GetType()));
|
||||
delete AssetHandler::AssetInterfaces[iAsset->GetType()];
|
||||
}
|
||||
|
||||
|
@ -62,13 +62,14 @@ namespace Assets
|
||||
{
|
||||
if (builder->HasPointer(technique))
|
||||
{
|
||||
OutputDebugStringA(asset->name);
|
||||
dest->techniques[i] = builder->GetPointer(technique);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Size-check is obsolete, as the structure is dynamic
|
||||
buffer->Align(Utils::Stream::ALIGN_4);
|
||||
builder->StorePointer(technique);
|
||||
//builder->StorePointer(technique);
|
||||
|
||||
Game::MaterialTechnique* destTechnique = buffer->Dest<Game::MaterialTechnique>();
|
||||
buffer->Save(technique, 8);
|
||||
|
@ -91,7 +91,7 @@ namespace Assets
|
||||
Assert_Size(Game::XModelAngle, 8);
|
||||
|
||||
buffer->Align(Utils::Stream::ALIGN_2);
|
||||
buffer->Save(asset->tagAngles, sizeof(Game::XModelAngle), asset->numBones - asset->numRootBones);
|
||||
buffer->SaveArray(asset->tagAngles, asset->numBones - asset->numRootBones);
|
||||
dest->tagAngles = reinterpret_cast<Game::XModelAngle*>(-1);
|
||||
}
|
||||
|
||||
@ -100,13 +100,13 @@ namespace Assets
|
||||
Assert_Size(Game::XModelTagPos, 12);
|
||||
|
||||
buffer->Align(Utils::Stream::ALIGN_4);
|
||||
buffer->Save(asset->tagPositions, sizeof(Game::XModelTagPos), asset->numBones - asset->numRootBones);
|
||||
buffer->SaveArray(asset->tagPositions, asset->numBones - asset->numRootBones);
|
||||
dest->tagPositions = reinterpret_cast<Game::XModelTagPos*>(-1);
|
||||
}
|
||||
|
||||
if (asset->partClassification)
|
||||
{
|
||||
buffer->Save(asset->partClassification,asset->numBones);
|
||||
buffer->Save(asset->partClassification, asset->numBones);
|
||||
dest->partClassification = reinterpret_cast<char*>(-1);
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ namespace Assets
|
||||
Assert_Size(Game::DObjAnimMat, 32);
|
||||
|
||||
buffer->Align(Utils::Stream::ALIGN_4);
|
||||
buffer->Save(asset->animMatrix, sizeof(Game::DObjAnimMat), asset->numBones);
|
||||
buffer->SaveArray(asset->animMatrix, asset->numBones);
|
||||
dest->animMatrix = reinterpret_cast<Game::DObjAnimMat*>(-1);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ namespace Assets
|
||||
buffer->Align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::Material** destMaterials = buffer->Dest<Game::Material*>();
|
||||
buffer->Save(asset->materials, sizeof(Game::Material*), asset->numSurfaces);
|
||||
buffer->SaveArray(asset->materials, asset->numSurfaces);
|
||||
|
||||
for (char i = 0; i < asset->numSurfaces; ++i)
|
||||
{
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::string ZoneBuilder::TraceZone;
|
||||
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::TraceAssets;
|
||||
|
||||
ZoneBuilder::Zone::Zone(std::string name) : DataMap("zone_source/" + name + ".csv"), ZoneName(name), IndexStart(0), Branding { 0 },
|
||||
|
||||
@ -370,7 +372,7 @@ namespace Components
|
||||
}
|
||||
|
||||
std::string str = Game::SL_ConvertToString(gameIndex);
|
||||
int prev = FindScriptString(str);
|
||||
int prev = ZoneBuilder::Zone::FindScriptString(str);
|
||||
|
||||
if (prev > 0)
|
||||
{
|
||||
@ -441,12 +443,31 @@ namespace Components
|
||||
return (Flags::HasFlag("zonebuilder") && !Dedicated::IsDedicated());
|
||||
}
|
||||
|
||||
void ZoneBuilder::BeginAssetTrace(std::string zone)
|
||||
{
|
||||
ZoneBuilder::TraceZone = zone;
|
||||
}
|
||||
|
||||
std::vector<std::pair<Game::XAssetType, std::string>> ZoneBuilder::EndAssetTrace()
|
||||
{
|
||||
ZoneBuilder::TraceZone.clear();
|
||||
|
||||
std::vector<std::pair<Game::XAssetType, std::string>> AssetTrace;
|
||||
Utils::Merge(&AssetTrace, ZoneBuilder::TraceAssets);
|
||||
|
||||
ZoneBuilder::TraceAssets.clear();
|
||||
|
||||
return AssetTrace;
|
||||
}
|
||||
|
||||
ZoneBuilder::ZoneBuilder()
|
||||
{
|
||||
static_assert(sizeof(Game::XFileHeader) == 21, "Invalid XFileHeader structure!");
|
||||
static_assert(sizeof(Game::XFile) == 40, "Invalid XFile structure!");
|
||||
static_assert(Game::MAX_XFILE_COUNT == 8, "XFile block enum is invalid!");
|
||||
|
||||
ZoneBuilder::EndAssetTrace();
|
||||
|
||||
AssetHandler::OnLoad([] (Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
|
||||
{
|
||||
// static void* blocTable = 0;
|
||||
@ -504,6 +525,45 @@ namespace Components
|
||||
Utils::Hook::Set<DWORD>(0x64A029, 0x38400000); // 900 MiB
|
||||
Utils::Hook::Set<DWORD>(0x64A057, 0x38400000);
|
||||
|
||||
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict)
|
||||
{
|
||||
if (!ZoneBuilder::TraceZone.empty() && ZoneBuilder::TraceZone == FastFiles::Current())
|
||||
{
|
||||
ZoneBuilder::TraceAssets.push_back({ type, name });
|
||||
}
|
||||
});
|
||||
|
||||
Command::Add("verifyzone", [] (Command::Params params)
|
||||
{
|
||||
if (params.Length() < 2) return;
|
||||
|
||||
static std::string zone = params[1];
|
||||
|
||||
ZoneBuilder::BeginAssetTrace(zone);
|
||||
|
||||
Game::XZoneInfo info;
|
||||
info.name = zone.data();
|
||||
info.allocFlags = 0x01000000;
|
||||
info.freeFlags = 0;
|
||||
|
||||
Logger::Print("Loading zone '%s'...\n", zone.data());
|
||||
|
||||
Game::DB_LoadXAssets(&info, 1, true);
|
||||
AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_RAWFILE, zone.data()); // Lock until zone is loaded
|
||||
|
||||
auto assets = ZoneBuilder::EndAssetTrace();
|
||||
|
||||
Logger::Print("Zone '%s' loaded with %d assets:\n", zone.data(), assets.size());
|
||||
|
||||
int count = 0;
|
||||
for (auto i = assets.begin(); i != assets.end(); ++i, ++count)
|
||||
{
|
||||
Logger::Print(" %d: %s: %s\n", count, Game::DB_GetXAssetTypeName(i->first), i->second.data());
|
||||
}
|
||||
|
||||
Logger::Print("\n");
|
||||
});
|
||||
|
||||
Command::Add("buildzone", [] (Command::Params params)
|
||||
{
|
||||
if (params.Length() < 2) return;
|
||||
|
@ -74,5 +74,11 @@ namespace Components
|
||||
const char* GetName() { return "ZoneBuilder"; };
|
||||
|
||||
static bool IsEnabled();
|
||||
|
||||
static std::string TraceZone;
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> TraceAssets;
|
||||
|
||||
static void BeginAssetTrace(std::string zone);
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> EndAssetTrace();
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user