mirror of https://github.com/AxioDL/metaforce.git
Cook all AGSCs simultaneously
This commit is contained in:
parent
c45d5db182
commit
ca5cf5c77c
|
@ -207,19 +207,35 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AGSC::Cook(const hecl::ProjectPath& dir, const hecl::ProjectPath& outPath) {
|
||||
static std::atomic_bool DidCook = {false};
|
||||
|
||||
bool AGSC::Cook(const hecl::ProjectPath& dir, const hecl::ProjectPath& refOutPath) {
|
||||
/* This will cook all AGSCs in the local directory, ensuring unique ObjectIDs
|
||||
* across all Amuse subprojects */
|
||||
if (DidCook.exchange(true))
|
||||
return true; /* We've already cooked all AGSCs */
|
||||
|
||||
amuse::ProjectDatabase projDb;
|
||||
projDb.setIdDatabases();
|
||||
|
||||
auto parentDir = dir.getParentPath();
|
||||
auto outParentDir = refOutPath.getParentPath();
|
||||
for (const auto& ent : dir.getParentPath().enumerateDir()) {
|
||||
if (!ent.m_isDir)
|
||||
continue;
|
||||
hecl::ProjectPath path(parentDir, ent.m_name);
|
||||
if (IsPathAudioGroup(path)) {
|
||||
hecl::ProjectPath outPath(outParentDir, ent.m_name);
|
||||
athena::io::FileWriter w(outPath.getAbsolutePath());
|
||||
if (w.hasError())
|
||||
return false;
|
||||
|
||||
Header head;
|
||||
head.audioDir = "Audio/"sv;
|
||||
head.groupName = dir.getLastComponentUTF8();
|
||||
head.groupName = path.getLastComponentUTF8();
|
||||
head.write(w);
|
||||
|
||||
amuse::ProjectDatabase projDb;
|
||||
projDb.setIdDatabases();
|
||||
amuse::AudioGroupDatabase group(dir.getAbsolutePath());
|
||||
amuse::AudioGroupDatabase group(path.getAbsolutePath());
|
||||
|
||||
auto proj = group.getProj().toGCNData(group.getPool(), group.getSdir());
|
||||
auto pool = group.getPool().toData<athena::Big>();
|
||||
|
@ -236,6 +252,8 @@ bool AGSC::Cook(const hecl::ProjectPath& dir, const hecl::ProjectPath& outPath)
|
|||
|
||||
w.writeUint32Big(sdirSamp.first.size());
|
||||
w.writeUBytes(sdirSamp.first.data(), sdirSamp.first.size());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressP
|
|||
extractFromDisc(*m_disc, info.force, progress);
|
||||
}
|
||||
|
||||
static bool IsPathAudioGroup(const hecl::ProjectPath& path) {
|
||||
bool IsPathAudioGroup(const hecl::ProjectPath& path) {
|
||||
return (path.getPathType() == hecl::ProjectPath::Type::Directory &&
|
||||
hecl::ProjectPath(path, _SYS_STR("!project.yaml")).isFile() &&
|
||||
hecl::ProjectPath(path, _SYS_STR("!pool.yaml")).isFile());
|
||||
|
|
|
@ -199,4 +199,6 @@ protected:
|
|||
bool m_standalone;
|
||||
};
|
||||
|
||||
bool IsPathAudioGroup(const hecl::ProjectPath& path);
|
||||
|
||||
} // namespace DataSpec
|
||||
|
|
2
amuse
2
amuse
|
@ -1 +1 @@
|
|||
Subproject commit 9f2bb1b371f2bd652d6d130f789da0a263e5678a
|
||||
Subproject commit a4b8946ee2a395477683e40088aaa5d1d2245194
|
Loading…
Reference in New Issue