shader fix

This commit is contained in:
momo5502 2016-10-23 19:07:34 +02:00
parent b6a5c18662
commit 7748f96b50
3 changed files with 36 additions and 22 deletions

View File

@ -13,6 +13,9 @@ namespace Components
std::map<std::string, Game::XAssetHeader> AssetHandler::TemporaryAssets[Game::XAssetType::ASSET_TYPE_COUNT]; std::map<std::string, Game::XAssetHeader> AssetHandler::TemporaryAssets[Game::XAssetType::ASSET_TYPE_COUNT];
static std::map<std::string, short> techsMain;
static std::map<std::string, short> techsSub;
void AssetHandler::RegisterInterface(IAsset* iAsset) void AssetHandler::RegisterInterface(IAsset* iAsset)
{ {
if (!iAsset) return; if (!iAsset) return;
@ -133,51 +136,43 @@ namespace Components
} }
#if DEBUG #if DEBUG
if (type == 9 && false) if (type == 9)
{ {
static Game::MaterialTechniqueSet* technique = nullptr; static Game::MaterialTechniqueSet* technique = nullptr;
auto printTechset = [] (Game::MaterialTechniqueSet* technique, std::string zone) auto printTechset = [] (Game::MaterialTechniqueSet* technique, std::map<std::string, short>* _map)
{ {
FILE* fp;
fopen_s(&fp, "test.txt", "a");
fprintf(fp, "%s: %s\n", zone.data(), technique->name);
for (int i = 0; i < 48; i++) for (int i = 0; i < 48; i++)
{ {
if (technique->techniques[i]) if (technique->techniques[i])
{ {
fprintf(fp, "\t%d: %s\n", i, technique->techniques[i]->name);
for (int j = 0; j < technique->techniques[i]->numPasses; j++) for (int j = 0; j < technique->techniques[i]->numPasses; j++)
{ {
Game::MaterialPass* pass = &technique->techniques[i]->passes[j]; Game::MaterialPass* pass = &technique->techniques[i]->passes[j];
for (int k = 0; k < (pass->argCount1 + pass->argCount2 + pass->argCount3); k++) for (int k = 0; k < (pass->argCount1 + pass->argCount2 + pass->argCount3); k++)
{ {
fprintf(fp, "\t\t\t%d.%d.%d Para: %d\n", i, j, k, pass->argumentDef[k].paramID & 0xFFFF); std::string name = fmt::sprintf("%s:%d.%d.%d_%d", technique->techniques[i]->name, i, j, k, pass->argumentDef[k].type);
}
} if (_map->find(name) != _map->end())
} {
OutputDebugStringA(name.data());
} }
fprintf(fp, "\n"); (*_map)[name] = pass->argumentDef[k].paramID;
fclose(fp); }
}
}
}
}; };
static std::map<std::string, Game::MaterialTechniqueSet*> techs;
if (FastFiles::Current() == "mp_rust_long") if (FastFiles::Current() == "mp_rust_long")
{ {
techs[name] = asset->materialTechset; printTechset(asset->materialTechset, &techsMain);
printTechset(asset->materialTechset, "mp_rust_long");
} }
else else
{ {
if (techs.find(name) != techs.end()) printTechset(asset->materialTechset, &techsSub);
{
printTechset(asset->materialTechset, FastFiles::Current());
}
} }
} }
#endif #endif
@ -378,6 +373,17 @@ namespace Components
Game::Sys_Error(25, reinterpret_cast<char*>(0x724428), Game::DB_GetXAssetTypeName(asset.first), asset.second.data()); Game::Sys_Error(25, reinterpret_cast<char*>(0x724428), Game::DB_GetXAssetTypeName(asset.first), asset.second.data());
} }
for (auto main : techsMain)
{
if (techsSub.find(main.first) != techsSub.end() && main.second != techsSub[main.first])
{
FILE* fp;
fopen_s(&fp, "stuff.txt", "a");
fprintf(fp, "%s: %d %d\n", main.first.data(), main.second & 0xFFFF, techsSub[main.first] & 0xFFFF);
fclose(fp);
}
}
AssetHandler::EmptyAssets.clear(); AssetHandler::EmptyAssets.clear();
} }
}); });

View File

@ -416,7 +416,6 @@ namespace Components
Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp"); Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp");
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp"); Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp"); Maps::AddDependency("mp_rust_long", "iw4x_dependencies_mp");
Maps::AddDependency("mp_rust_long", "mp_rust");
#if defined(DEBUG) && defined(ENABLE_DXSDK) #if defined(DEBUG) && defined(ENABLE_DXSDK)
Command::Add("dumpmap", [] (Command::Params) Command::Add("dumpmap", [] (Command::Params)

View File

@ -1009,6 +1009,11 @@ namespace Components
if (Zones::Version() >= 359/* && arg->paramID <= 113*/) if (Zones::Version() >= 359/* && arg->paramID <= 113*/)
{ {
arg->paramID -= 7; arg->paramID -= 7;
if (arg->paramID <= 53)
{
arg->paramID += 1;
}
} }
} }
// >= 21 works fine for specular, but breaks trees // >= 21 works fine for specular, but breaks trees
@ -1019,7 +1024,7 @@ namespace Components
if (Zones::Version() >= 359) if (Zones::Version() >= 359)
{ {
if (arg->paramID > 15 && arg->paramID < 34) if (arg->paramID > 15 && arg->paramID < 30)
{ {
arg->paramID -= 1; arg->paramID -= 1;
} }
@ -1029,6 +1034,10 @@ namespace Components
} }
} }
} }
// else if (Zones::Version() >= 359 && arg->paramID == 20592)
// {
// arg->paramID == 25180;
// }
} }
return result; return result;