mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-13 11:11:22 +00:00
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;
|
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());
|
athena::io::FileWriter w(outPath.getAbsolutePath());
|
||||||
if (w.hasError())
|
if (w.hasError())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Header head;
|
Header head;
|
||||||
head.audioDir = "Audio/"sv;
|
head.audioDir = "Audio/"sv;
|
||||||
head.groupName = dir.getLastComponentUTF8();
|
head.groupName = path.getLastComponentUTF8();
|
||||||
head.write(w);
|
head.write(w);
|
||||||
|
|
||||||
amuse::ProjectDatabase projDb;
|
amuse::AudioGroupDatabase group(path.getAbsolutePath());
|
||||||
projDb.setIdDatabases();
|
|
||||||
amuse::AudioGroupDatabase group(dir.getAbsolutePath());
|
|
||||||
|
|
||||||
auto proj = group.getProj().toGCNData(group.getPool(), group.getSdir());
|
auto proj = group.getProj().toGCNData(group.getPool(), group.getSdir());
|
||||||
auto pool = group.getPool().toData<athena::Big>();
|
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.writeUint32Big(sdirSamp.first.size());
|
||||||
w.writeUBytes(sdirSamp.first.data(), sdirSamp.first.size());
|
w.writeUBytes(sdirSamp.first.data(), sdirSamp.first.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressP
|
|||||||
extractFromDisc(*m_disc, info.force, progress);
|
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 &&
|
return (path.getPathType() == hecl::ProjectPath::Type::Directory &&
|
||||||
hecl::ProjectPath(path, _SYS_STR("!project.yaml")).isFile() &&
|
hecl::ProjectPath(path, _SYS_STR("!project.yaml")).isFile() &&
|
||||||
hecl::ProjectPath(path, _SYS_STR("!pool.yaml")).isFile());
|
hecl::ProjectPath(path, _SYS_STR("!pool.yaml")).isFile());
|
||||||
|
@ -199,4 +199,6 @@ protected:
|
|||||||
bool m_standalone;
|
bool m_standalone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool IsPathAudioGroup(const hecl::ProjectPath& path);
|
||||||
|
|
||||||
} // namespace DataSpec
|
} // namespace DataSpec
|
||||||
|
2
amuse
2
amuse
@ -1 +1 @@
|
|||||||
Subproject commit 9f2bb1b371f2bd652d6d130f789da0a263e5678a
|
Subproject commit a4b8946ee2a395477683e40088aaa5d1d2245194
|
Loading…
x
Reference in New Issue
Block a user