mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 04:27:42 +00:00
Refactorings to support .upak generation
This commit is contained in:
@@ -1130,7 +1130,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
if (sub.overlayMeshes.size())
|
||||
{
|
||||
ch.cmdlOverlay = sub.overlayMeshes[0].second;
|
||||
ch.cskrOverlay = inPath.ensureAuxInfo(chSysName.sys_str() + _S(".over.CSKR"));
|
||||
ch.cskrOverlay = inPath.ensureAuxInfo(chSysName.sys_str() + _S('.') +
|
||||
sub.overlayMeshes[0].first + _S(".CSKR"));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1206,7 +1207,15 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
{
|
||||
hecl::SystemString subName(inPath.getAuxInfo().begin(),
|
||||
inPath.getAuxInfo().end() - 5);
|
||||
hecl::SystemString overName;
|
||||
auto dotPos = subName.rfind(_S('.'));
|
||||
if (dotPos != hecl::SystemString::npos)
|
||||
{
|
||||
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
|
||||
subName = hecl::SystemString(subName.begin(), subName.begin() + dotPos);
|
||||
}
|
||||
hecl::SystemUTF8View subNameView(subName);
|
||||
hecl::SystemUTF8View overNameView(overName);
|
||||
|
||||
/* Build bone ID map */
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
@@ -1227,15 +1236,30 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
if (!subtype)
|
||||
Log.report(logvisor::Fatal, _S("unable to find subtype '%s'"), subName.c_str());
|
||||
|
||||
const hecl::ProjectPath& modelPath = subtype->mesh;
|
||||
const hecl::ProjectPath* modelPath = nullptr;
|
||||
if (overName.empty())
|
||||
{
|
||||
modelPath = &subtype->mesh;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& overlay : subtype->overlayMeshes)
|
||||
if (!overlay.first.compare(overNameView.str()))
|
||||
{
|
||||
modelPath = &overlay.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!modelPath)
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
|
||||
|
||||
if (!modelPath.isFile())
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath.getRelativePath().c_str());
|
||||
if (!modelPath->isFile())
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().c_str());
|
||||
|
||||
hecl::ProjectPath skinIntPath = modelPath.getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
|
||||
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath.getModtime())
|
||||
if (!modelCookFunc(modelPath))
|
||||
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath.getRelativePath().c_str());
|
||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
|
||||
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
|
||||
if (!modelCookFunc(*modelPath))
|
||||
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().c_str());
|
||||
|
||||
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
|
||||
if (skinIO.hasError())
|
||||
|
||||
@@ -244,7 +244,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||
if (ci.cmdlOverlay && ci.cskrOverlay)
|
||||
{
|
||||
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
|
||||
cskrCinfToAncs[ci.cskrOverlay] = std::make_pair(entry.second.id, hecl::Format("%s.over.CSKR", ci.name.c_str()));
|
||||
cskrCinfToAncs[ci.cskrOverlay] = std::make_pair(entry.second.id, hecl::Format("%s.OVER.CSKR", ci.name.c_str()));
|
||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay);
|
||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrOverlay);
|
||||
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str());
|
||||
|
||||
@@ -73,9 +73,10 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
hecl::ProjectPath namePath(inPath.getParentPath(), _S("!name.yaml"));
|
||||
if (namePath.isFile())
|
||||
mlvl.worldNameId = namePath;
|
||||
hecl::ProjectPath savwPath = inPath.ensureAuxInfo(_S("SAVW"));
|
||||
hecl::ProjectPath globPath = inPath.getWithExtension(_S(".*"), true);
|
||||
hecl::ProjectPath savwPath = globPath.ensureAuxInfo(_S("SAVW"));
|
||||
mlvl.saveWorldId = savwPath;
|
||||
hecl::ProjectPath mapwPath = inPath.ensureAuxInfo(_S("MAPW"));
|
||||
hecl::ProjectPath mapwPath = globPath.ensureAuxInfo(_S("MAPW"));
|
||||
mlvl.worldMap = mapwPath;
|
||||
|
||||
size_t areaIdx = 0;
|
||||
@@ -269,7 +270,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
if (addedPaths.find(path.hash()) == addedPaths.cend())
|
||||
{
|
||||
addedPaths.insert(path.hash());
|
||||
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(path, btok);
|
||||
urde::SObjectTag tag = g_curSpec->buildTagFromPath(path, btok);
|
||||
if (tag.id.IsValid())
|
||||
areaOut.deps.emplace_back(tag.id.Value(), tag.type);
|
||||
}
|
||||
@@ -308,13 +309,13 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
if (addedPaths.find(path.hash()) == addedPaths.cend())
|
||||
{
|
||||
addedPaths.insert(path.hash());
|
||||
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(path, btok);
|
||||
urde::SObjectTag tag = g_curSpec->buildTagFromPath(path, btok);
|
||||
if (tag.id.IsValid())
|
||||
areaOut.deps.emplace_back(tag.id.Value(), tag.type);
|
||||
}
|
||||
}
|
||||
|
||||
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(areaPath, btok);
|
||||
urde::SObjectTag tag = g_curSpec->buildTagFromPath(areaPath, btok);
|
||||
if (tag.id.IsValid())
|
||||
areaOut.deps.emplace_back(tag.id.Value(), tag.type);
|
||||
}
|
||||
@@ -359,7 +360,7 @@ bool MLVL::CookMAPW(const hecl::ProjectPath& outPath,
|
||||
/* Area map */
|
||||
hecl::ProjectPath mapPath(area.path, _S("/!map.blend"));
|
||||
if (mapPath.isFile())
|
||||
mapaTags.push_back(g_curSpec->BuildTagFromPath(mapPath, btok));
|
||||
mapaTags.push_back(g_curSpec->buildTagFromPath(mapPath, btok));
|
||||
}
|
||||
|
||||
/* Write out MAPW */
|
||||
|
||||
@@ -562,9 +562,9 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
||||
hecl::SNPrintf(thrIdx, 16, _S("%d"), hecl::ClientProcess::GetThreadWorkerIdx());
|
||||
hecl::SystemChar parPid[32];
|
||||
#if _WIN32
|
||||
hecl::SNPrintf(parPid, 32, _S("%ullX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
||||
hecl::SNPrintf(parPid, 32, _S("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
||||
#else
|
||||
hecl::SNPrintf(parPid, 32, _S("%ullX"), reinterpret_cast<unsigned long long>(getpid()));
|
||||
hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid());
|
||||
#endif
|
||||
const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
|
||||
visiIntOut.getAbsolutePath().c_str(),
|
||||
|
||||
Reference in New Issue
Block a user