From 4396d5ca902bfccd7d1559005f3dd6a71a982df2 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 4 Oct 2023 23:55:29 -0400 Subject: [PATCH 01/15] add SndDriverGlobals dumping --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 40 ++- .../AssetDumperSndDriverGlobals.cpp | 327 ++++++++++++++++++ .../AssetDumperSndDriverGlobals.h | 15 + src/ObjWriting/Game/T6/ZoneDumperT6.cpp | 3 +- 4 files changed, 382 insertions(+), 3 deletions(-) create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index af3a41707..5de88428e 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -185,17 +185,53 @@ class AssetDumperSndBank::Internal // loadspec stream.WriteColumn(""); - - // "# secondary", + + // secondary + stream.WriteColumn(alias->secondaryname); + // "# group", + stream.WriteColumn(""); + // "# vol_min", + stream.WriteColumn(""); + // "# vol_max", + stream.WriteColumn(""); + // "# team_vol_mod", + stream.WriteColumn(""); + // "# dist_min", + stream.WriteColumn(""); + // "# dist_max", + stream.WriteColumn(""); + // "# dist_reverb_max", + stream.WriteColumn(""); + // "# volume_falloff_curve", + stream.WriteColumn(""); + // "# reverb_falloff_curve", + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + + + + + + + + + + // "# volume_min_falloff_curve", // "# reverb_min_falloff_curve", // "# limit_count", diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp new file mode 100644 index 000000000..948538e28 --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -0,0 +1,327 @@ +#include "AssetDumperSndDriverGlobals.h" + +#include +#include +#include + +#include "Utils/ClassUtils.h" +#include "Csv/CsvStream.h" +#include "ObjContainer/SoundBank/SoundBank.h" + +using namespace T6; +namespace fs = std::filesystem; + +class AssetDumperSndDriverGlobals::Internal +{ + AssetDumpingContext& m_context; + + inline static const std::string GROUPS_HEADERS[] + { + "name","attenuationSp","attenuationMp","category","parent" + }; + + inline static const std::string GROUPS_CATEGORIES[] + { + "sfx","music","void","ui","cinematic" + }; + + inline static const std::string CURVE_HEADERS[] + { + "name","x0","y0","x1","y1","x2","y2","x3","y3","x4","y4","x5","y5","x6","y6","x7","y7" + }; + + inline static const std::string PAN_HEADERS[] + { + "name","front","back","center","lfe","left","right", + }; + + inline static const std::string MASTER_HEADERS[] + { + "name","lowE","lowG","lowF","lowQ","peak1E","peak1G","peak1F","peak1Q","peak2E","peak2G","peak2F","peak2Q","hiE","hiG","hiF","hiQ","eqG","compE","compPG","compMG","compT","compR","compTA","compTR","limitE","limitPG","limitMG","limitT","limitR","limitTA","limitTR","busReverbG","busFxG","busVoiceG","busPfutzG","busHdrfxG","busUiG","busMusicG","busMovieG","busVcsG","busReverbE","busFxE","busVoiceE","busPfutzE","busHdrfxE","busUiE","busMusicE","busMovieE","hdrfxCompE","voiceEqE","voiceCompE" + }; + + inline static const std::string SIDECHAIN_HEADERS[] + { + "name","g","f","q","ta","tr","tf" + }; + + inline static const std::string FUTZ_HEADERS[] + { + "name","bpfF","bpfQ","lsG","lsF","lsQ","dist","preG","postG","th","tg","clippre","clippost","blend","startAliasId","stopAliasId","loopAliasId" + }; + + std::unique_ptr OpenAssetFile(const std::string& filename) + { + auto outputFile = this->m_context.OpenAssetFile(filename); + if (outputFile == nullptr) + { + std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"" << std::endl; + } + + return outputFile; + } + + static void WriteFileHeader(CsvOutputStream& stream, const std::string* headers, size_t count) + { + for (auto i = 0u; i < count; i++) + { + stream.WriteColumn(headers[i]); + } + + stream.NextRow(); + } + + void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\group.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, GROUPS_HEADERS, 5); + + for (auto i = 0u; i < count; i++) + { + const auto& group = groups[i]; + csvStream.WriteColumn(group.name); + csvStream.WriteColumn(std::to_string(group.attenuationSp)); + csvStream.WriteColumn(std::to_string(group.attenuationMp)); + csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]); + csvStream.WriteColumn(group.parentName); + csvStream.NextRow(); + } + } + } + + void DumpSndCurves(const SndCurve* curves, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\curves.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, CURVE_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& curve = curves[i]; + csvStream.WriteColumn(curve.name); + + for (auto j = 0u; j < 8; j++) + { + csvStream.WriteColumn(std::to_string(curve.points[j].x)); + csvStream.WriteColumn(std::to_string(curve.points[j].y)); + } + + csvStream.NextRow(); + } + } + } + + void DumpSndPans(const SndPan* pans, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\pan.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, PAN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& pan = pans[i]; + csvStream.WriteColumn(pan.name); + csvStream.WriteColumn(std::to_string(pan.front)); + csvStream.WriteColumn(std::to_string(pan.back)); + csvStream.WriteColumn(std::to_string(pan.center)); + csvStream.WriteColumn(std::to_string(pan.lfe)); + csvStream.WriteColumn(std::to_string(pan.left)); + csvStream.WriteColumn(std::to_string(pan.right)); + csvStream.NextRow(); + } + } + } + + void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\duck_groups.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + csvStream.WriteColumn("name"); + csvStream.NextRow(); + + for (auto i = 0u; i < count; i++) + { + const auto& duckGroup = duckGroups[i]; + csvStream.WriteColumn(duckGroup.name); + csvStream.NextRow(); + } + } + } + + void DumpSndMasters(const SndMaster* masters, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\master.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, MASTER_HEADERS, 52); + + for (auto i = 0u; i < count; i++) + { + const auto& master = masters[i]; + csvStream.WriteColumn(master.name); + csvStream.WriteColumn(std::to_string(master.lowE)); + csvStream.WriteColumn(std::to_string(master.lowG)); + csvStream.WriteColumn(std::to_string(master.lowF)); + csvStream.WriteColumn(std::to_string(master.lowQ)); + csvStream.WriteColumn(std::to_string(master.peak1E)); + csvStream.WriteColumn(std::to_string(master.peak1G)); + csvStream.WriteColumn(std::to_string(master.peak1F)); + csvStream.WriteColumn(std::to_string(master.peak1Q)); + csvStream.WriteColumn(std::to_string(master.peak2E)); + csvStream.WriteColumn(std::to_string(master.peak2G)); + csvStream.WriteColumn(std::to_string(master.peak2F)); + csvStream.WriteColumn(std::to_string(master.peak2Q)); + csvStream.WriteColumn(std::to_string(master.hiE)); + csvStream.WriteColumn(std::to_string(master.hiG)); + csvStream.WriteColumn(std::to_string(master.hiF)); + csvStream.WriteColumn(std::to_string(master.hiQ)); + csvStream.WriteColumn(std::to_string(master.eqG)); + csvStream.WriteColumn(std::to_string(master.compE)); + csvStream.WriteColumn(std::to_string(master.compPG)); + csvStream.WriteColumn(std::to_string(master.compMG)); + csvStream.WriteColumn(std::to_string(master.compT)); + csvStream.WriteColumn(std::to_string(master.compR)); + csvStream.WriteColumn(std::to_string(master.compTA)); + csvStream.WriteColumn(std::to_string(master.compTR)); + csvStream.WriteColumn(std::to_string(master.limitE)); + csvStream.WriteColumn(std::to_string(master.limitPG)); + csvStream.WriteColumn(std::to_string(master.limitMG)); + csvStream.WriteColumn(std::to_string(master.limitT)); + csvStream.WriteColumn(std::to_string(master.limitR)); + csvStream.WriteColumn(std::to_string(master.limitTA)); + csvStream.WriteColumn(std::to_string(master.limitTR)); + csvStream.WriteColumn(std::to_string(master.busReverbG)); + csvStream.WriteColumn(std::to_string(master.busFxG)); + csvStream.WriteColumn(std::to_string(master.busVoiceG)); + csvStream.WriteColumn(std::to_string(master.busPfutzG)); + csvStream.WriteColumn(std::to_string(master.busHdrfxG)); + csvStream.WriteColumn(std::to_string(master.busUiG)); + csvStream.WriteColumn(std::to_string(master.busMusicG)); + csvStream.WriteColumn(std::to_string(master.busMovieG)); + csvStream.WriteColumn(std::to_string(master.busVcsG)); + csvStream.WriteColumn(std::to_string(master.busReverbE)); + csvStream.WriteColumn(std::to_string(master.busFxE)); + csvStream.WriteColumn(std::to_string(master.busVoiceE)); + csvStream.WriteColumn(std::to_string(master.busPfutzE)); + csvStream.WriteColumn(std::to_string(master.busHdrfxE)); + csvStream.WriteColumn(std::to_string(master.busUiE)); + csvStream.WriteColumn(std::to_string(master.busMusicE)); + csvStream.WriteColumn(std::to_string(master.busMovieE)); + csvStream.WriteColumn(std::to_string(master.hdrfxCompE)); + csvStream.WriteColumn(std::to_string(master.voiceEqE)); + csvStream.WriteColumn(std::to_string(master.voiceCompE)); + csvStream.NextRow(); + } + } + } + + void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\sidechain_duck.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& sidechain = sidechains[i]; + csvStream.WriteColumn(sidechain.name); + csvStream.WriteColumn(std::to_string(sidechain.g)); + csvStream.WriteColumn(std::to_string(sidechain.f)); + csvStream.WriteColumn(std::to_string(sidechain.q)); + csvStream.WriteColumn(std::to_string(sidechain.ta)); + csvStream.WriteColumn(std::to_string(sidechain.tr)); + csvStream.WriteColumn(std::to_string(sidechain.tf)); + csvStream.NextRow(); + } + } + } + + void DumpSndFutz(const SndFutz* futzes, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\futz.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, FUTZ_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& futz = futzes[i]; + csvStream.WriteColumn(futz.name); + csvStream.WriteColumn(std::to_string(futz.bpfF)); + csvStream.WriteColumn(std::to_string(futz.bpfQ)); + csvStream.WriteColumn(std::to_string(futz.lsG)); + csvStream.WriteColumn(std::to_string(futz.lsF)); + csvStream.WriteColumn(std::to_string(futz.lsQ)); + csvStream.WriteColumn(std::to_string(futz.dist)); + csvStream.WriteColumn(std::to_string(futz.preG)); + csvStream.WriteColumn(std::to_string(futz.postG)); + csvStream.WriteColumn(std::to_string(futz.th)); + csvStream.WriteColumn(std::to_string(futz.tg)); + csvStream.WriteColumn(std::to_string(futz.clippre)); + csvStream.WriteColumn(std::to_string(futz.clippost)); + csvStream.WriteColumn(std::to_string(futz.blend)); + csvStream.WriteColumn(std::to_string(futz.startAliasId)); + csvStream.WriteColumn(std::to_string(futz.stopAliasId)); + csvStream.WriteColumn(std::to_string(futz.loopAliasId)); + csvStream.NextRow(); + } + } + } + + void DumpSndDriverGlobals(const XAssetInfo* sndDriverGlobalsInfo) + { + const auto* sndDriverGlobals = sndDriverGlobalsInfo->Asset(); + + DumpSndVolumesGroups(sndDriverGlobals->groups, sndDriverGlobals->groupCount); + DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount); + DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount); + DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount); + //DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount); + DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount); + DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount); + DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount); + } + +public: + explicit Internal(AssetDumpingContext& context) + : m_context(context) + { + } + + void DumpPool(AssetPool* pool) + { + for (const auto* assetInfo : *pool) + { + if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',') + continue; + + DumpSndDriverGlobals(assetInfo); + } + } +}; + +void AssetDumperSndDriverGlobals::DumpPool(AssetDumpingContext& context, AssetPool* pool) +{ + Internal internal(context); + internal.DumpPool(pool); +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h new file mode 100644 index 000000000..dd6b18abc --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/T6/T6.h" + +namespace T6 +{ + class AssetDumperSndDriverGlobals final : public IAssetDumper + { + class Internal; + + public: + void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; + }; +} diff --git a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp index 4a7349b51..247c1685b 100644 --- a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp +++ b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp @@ -15,6 +15,7 @@ #include "AssetDumpers/AssetDumperPhysConstraints.h" #include "AssetDumpers/AssetDumperPhysPreset.h" #include "AssetDumpers/AssetDumperSndBank.h" +#include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperTracer.h" #include "AssetDumpers/AssetDumperVehicle.h" #include "AssetDumpers/AssetDumperWeapon.h" @@ -67,7 +68,7 @@ bool ZoneDumper::DumpZone(AssetDumpingContext& context) const DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT) DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE) // DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo, ASSET_TYPE_WEAPON_CAMO) - // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) + DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE) From 292f66f80cd19f859c9d839a45cf100c5155aa7c Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 4 Oct 2023 23:55:29 -0400 Subject: [PATCH 02/15] add SndDriverGlobals dumping --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 38 +- .../AssetDumperSndDriverGlobals.cpp | 327 ++++++++++++++++++ .../AssetDumperSndDriverGlobals.h | 15 + src/ObjWriting/Game/T6/ZoneDumperT6.cpp | 3 +- 4 files changed, 381 insertions(+), 2 deletions(-) create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 351c51cb7..ab968caa2 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -175,16 +175,52 @@ class AssetDumperSndBank::Internal // loadspec stream.WriteColumn(""); - // "# secondary", + // secondary + stream.WriteColumn(alias->secondaryname); + // "# group", + stream.WriteColumn(""); + // "# vol_min", + stream.WriteColumn(""); + // "# vol_max", + stream.WriteColumn(""); + // "# team_vol_mod", + stream.WriteColumn(""); + // "# dist_min", + stream.WriteColumn(""); + // "# dist_max", + stream.WriteColumn(""); + // "# dist_reverb_max", + stream.WriteColumn(""); + // "# volume_falloff_curve", + stream.WriteColumn(""); + // "# reverb_falloff_curve", + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + + + + + + + + + + // "# volume_min_falloff_curve", // "# reverb_min_falloff_curve", // "# limit_count", diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp new file mode 100644 index 000000000..948538e28 --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -0,0 +1,327 @@ +#include "AssetDumperSndDriverGlobals.h" + +#include +#include +#include + +#include "Utils/ClassUtils.h" +#include "Csv/CsvStream.h" +#include "ObjContainer/SoundBank/SoundBank.h" + +using namespace T6; +namespace fs = std::filesystem; + +class AssetDumperSndDriverGlobals::Internal +{ + AssetDumpingContext& m_context; + + inline static const std::string GROUPS_HEADERS[] + { + "name","attenuationSp","attenuationMp","category","parent" + }; + + inline static const std::string GROUPS_CATEGORIES[] + { + "sfx","music","void","ui","cinematic" + }; + + inline static const std::string CURVE_HEADERS[] + { + "name","x0","y0","x1","y1","x2","y2","x3","y3","x4","y4","x5","y5","x6","y6","x7","y7" + }; + + inline static const std::string PAN_HEADERS[] + { + "name","front","back","center","lfe","left","right", + }; + + inline static const std::string MASTER_HEADERS[] + { + "name","lowE","lowG","lowF","lowQ","peak1E","peak1G","peak1F","peak1Q","peak2E","peak2G","peak2F","peak2Q","hiE","hiG","hiF","hiQ","eqG","compE","compPG","compMG","compT","compR","compTA","compTR","limitE","limitPG","limitMG","limitT","limitR","limitTA","limitTR","busReverbG","busFxG","busVoiceG","busPfutzG","busHdrfxG","busUiG","busMusicG","busMovieG","busVcsG","busReverbE","busFxE","busVoiceE","busPfutzE","busHdrfxE","busUiE","busMusicE","busMovieE","hdrfxCompE","voiceEqE","voiceCompE" + }; + + inline static const std::string SIDECHAIN_HEADERS[] + { + "name","g","f","q","ta","tr","tf" + }; + + inline static const std::string FUTZ_HEADERS[] + { + "name","bpfF","bpfQ","lsG","lsF","lsQ","dist","preG","postG","th","tg","clippre","clippost","blend","startAliasId","stopAliasId","loopAliasId" + }; + + std::unique_ptr OpenAssetFile(const std::string& filename) + { + auto outputFile = this->m_context.OpenAssetFile(filename); + if (outputFile == nullptr) + { + std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"" << std::endl; + } + + return outputFile; + } + + static void WriteFileHeader(CsvOutputStream& stream, const std::string* headers, size_t count) + { + for (auto i = 0u; i < count; i++) + { + stream.WriteColumn(headers[i]); + } + + stream.NextRow(); + } + + void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\group.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, GROUPS_HEADERS, 5); + + for (auto i = 0u; i < count; i++) + { + const auto& group = groups[i]; + csvStream.WriteColumn(group.name); + csvStream.WriteColumn(std::to_string(group.attenuationSp)); + csvStream.WriteColumn(std::to_string(group.attenuationMp)); + csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]); + csvStream.WriteColumn(group.parentName); + csvStream.NextRow(); + } + } + } + + void DumpSndCurves(const SndCurve* curves, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\curves.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, CURVE_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& curve = curves[i]; + csvStream.WriteColumn(curve.name); + + for (auto j = 0u; j < 8; j++) + { + csvStream.WriteColumn(std::to_string(curve.points[j].x)); + csvStream.WriteColumn(std::to_string(curve.points[j].y)); + } + + csvStream.NextRow(); + } + } + } + + void DumpSndPans(const SndPan* pans, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\pan.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, PAN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& pan = pans[i]; + csvStream.WriteColumn(pan.name); + csvStream.WriteColumn(std::to_string(pan.front)); + csvStream.WriteColumn(std::to_string(pan.back)); + csvStream.WriteColumn(std::to_string(pan.center)); + csvStream.WriteColumn(std::to_string(pan.lfe)); + csvStream.WriteColumn(std::to_string(pan.left)); + csvStream.WriteColumn(std::to_string(pan.right)); + csvStream.NextRow(); + } + } + } + + void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\duck_groups.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + csvStream.WriteColumn("name"); + csvStream.NextRow(); + + for (auto i = 0u; i < count; i++) + { + const auto& duckGroup = duckGroups[i]; + csvStream.WriteColumn(duckGroup.name); + csvStream.NextRow(); + } + } + } + + void DumpSndMasters(const SndMaster* masters, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\master.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, MASTER_HEADERS, 52); + + for (auto i = 0u; i < count; i++) + { + const auto& master = masters[i]; + csvStream.WriteColumn(master.name); + csvStream.WriteColumn(std::to_string(master.lowE)); + csvStream.WriteColumn(std::to_string(master.lowG)); + csvStream.WriteColumn(std::to_string(master.lowF)); + csvStream.WriteColumn(std::to_string(master.lowQ)); + csvStream.WriteColumn(std::to_string(master.peak1E)); + csvStream.WriteColumn(std::to_string(master.peak1G)); + csvStream.WriteColumn(std::to_string(master.peak1F)); + csvStream.WriteColumn(std::to_string(master.peak1Q)); + csvStream.WriteColumn(std::to_string(master.peak2E)); + csvStream.WriteColumn(std::to_string(master.peak2G)); + csvStream.WriteColumn(std::to_string(master.peak2F)); + csvStream.WriteColumn(std::to_string(master.peak2Q)); + csvStream.WriteColumn(std::to_string(master.hiE)); + csvStream.WriteColumn(std::to_string(master.hiG)); + csvStream.WriteColumn(std::to_string(master.hiF)); + csvStream.WriteColumn(std::to_string(master.hiQ)); + csvStream.WriteColumn(std::to_string(master.eqG)); + csvStream.WriteColumn(std::to_string(master.compE)); + csvStream.WriteColumn(std::to_string(master.compPG)); + csvStream.WriteColumn(std::to_string(master.compMG)); + csvStream.WriteColumn(std::to_string(master.compT)); + csvStream.WriteColumn(std::to_string(master.compR)); + csvStream.WriteColumn(std::to_string(master.compTA)); + csvStream.WriteColumn(std::to_string(master.compTR)); + csvStream.WriteColumn(std::to_string(master.limitE)); + csvStream.WriteColumn(std::to_string(master.limitPG)); + csvStream.WriteColumn(std::to_string(master.limitMG)); + csvStream.WriteColumn(std::to_string(master.limitT)); + csvStream.WriteColumn(std::to_string(master.limitR)); + csvStream.WriteColumn(std::to_string(master.limitTA)); + csvStream.WriteColumn(std::to_string(master.limitTR)); + csvStream.WriteColumn(std::to_string(master.busReverbG)); + csvStream.WriteColumn(std::to_string(master.busFxG)); + csvStream.WriteColumn(std::to_string(master.busVoiceG)); + csvStream.WriteColumn(std::to_string(master.busPfutzG)); + csvStream.WriteColumn(std::to_string(master.busHdrfxG)); + csvStream.WriteColumn(std::to_string(master.busUiG)); + csvStream.WriteColumn(std::to_string(master.busMusicG)); + csvStream.WriteColumn(std::to_string(master.busMovieG)); + csvStream.WriteColumn(std::to_string(master.busVcsG)); + csvStream.WriteColumn(std::to_string(master.busReverbE)); + csvStream.WriteColumn(std::to_string(master.busFxE)); + csvStream.WriteColumn(std::to_string(master.busVoiceE)); + csvStream.WriteColumn(std::to_string(master.busPfutzE)); + csvStream.WriteColumn(std::to_string(master.busHdrfxE)); + csvStream.WriteColumn(std::to_string(master.busUiE)); + csvStream.WriteColumn(std::to_string(master.busMusicE)); + csvStream.WriteColumn(std::to_string(master.busMovieE)); + csvStream.WriteColumn(std::to_string(master.hdrfxCompE)); + csvStream.WriteColumn(std::to_string(master.voiceEqE)); + csvStream.WriteColumn(std::to_string(master.voiceCompE)); + csvStream.NextRow(); + } + } + } + + void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\sidechain_duck.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& sidechain = sidechains[i]; + csvStream.WriteColumn(sidechain.name); + csvStream.WriteColumn(std::to_string(sidechain.g)); + csvStream.WriteColumn(std::to_string(sidechain.f)); + csvStream.WriteColumn(std::to_string(sidechain.q)); + csvStream.WriteColumn(std::to_string(sidechain.ta)); + csvStream.WriteColumn(std::to_string(sidechain.tr)); + csvStream.WriteColumn(std::to_string(sidechain.tf)); + csvStream.NextRow(); + } + } + } + + void DumpSndFutz(const SndFutz* futzes, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\futz.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, FUTZ_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& futz = futzes[i]; + csvStream.WriteColumn(futz.name); + csvStream.WriteColumn(std::to_string(futz.bpfF)); + csvStream.WriteColumn(std::to_string(futz.bpfQ)); + csvStream.WriteColumn(std::to_string(futz.lsG)); + csvStream.WriteColumn(std::to_string(futz.lsF)); + csvStream.WriteColumn(std::to_string(futz.lsQ)); + csvStream.WriteColumn(std::to_string(futz.dist)); + csvStream.WriteColumn(std::to_string(futz.preG)); + csvStream.WriteColumn(std::to_string(futz.postG)); + csvStream.WriteColumn(std::to_string(futz.th)); + csvStream.WriteColumn(std::to_string(futz.tg)); + csvStream.WriteColumn(std::to_string(futz.clippre)); + csvStream.WriteColumn(std::to_string(futz.clippost)); + csvStream.WriteColumn(std::to_string(futz.blend)); + csvStream.WriteColumn(std::to_string(futz.startAliasId)); + csvStream.WriteColumn(std::to_string(futz.stopAliasId)); + csvStream.WriteColumn(std::to_string(futz.loopAliasId)); + csvStream.NextRow(); + } + } + } + + void DumpSndDriverGlobals(const XAssetInfo* sndDriverGlobalsInfo) + { + const auto* sndDriverGlobals = sndDriverGlobalsInfo->Asset(); + + DumpSndVolumesGroups(sndDriverGlobals->groups, sndDriverGlobals->groupCount); + DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount); + DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount); + DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount); + //DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount); + DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount); + DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount); + DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount); + } + +public: + explicit Internal(AssetDumpingContext& context) + : m_context(context) + { + } + + void DumpPool(AssetPool* pool) + { + for (const auto* assetInfo : *pool) + { + if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',') + continue; + + DumpSndDriverGlobals(assetInfo); + } + } +}; + +void AssetDumperSndDriverGlobals::DumpPool(AssetDumpingContext& context, AssetPool* pool) +{ + Internal internal(context); + internal.DumpPool(pool); +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h new file mode 100644 index 000000000..dd6b18abc --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/T6/T6.h" + +namespace T6 +{ + class AssetDumperSndDriverGlobals final : public IAssetDumper + { + class Internal; + + public: + void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; + }; +} diff --git a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp index 4a7349b51..247c1685b 100644 --- a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp +++ b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp @@ -15,6 +15,7 @@ #include "AssetDumpers/AssetDumperPhysConstraints.h" #include "AssetDumpers/AssetDumperPhysPreset.h" #include "AssetDumpers/AssetDumperSndBank.h" +#include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperTracer.h" #include "AssetDumpers/AssetDumperVehicle.h" #include "AssetDumpers/AssetDumperWeapon.h" @@ -67,7 +68,7 @@ bool ZoneDumper::DumpZone(AssetDumpingContext& context) const DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT) DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE) // DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo, ASSET_TYPE_WEAPON_CAMO) - // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) + DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE) From bc208fd7a69ecb237287949d8198973d66dadea3 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 4 Oct 2023 23:55:29 -0400 Subject: [PATCH 03/15] add SndDriverGlobals dumping --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 38 +- .../AssetDumperSndDriverGlobals.cpp | 327 ++++++++++++++++++ .../AssetDumperSndDriverGlobals.h | 15 + src/ObjWriting/Game/T6/ZoneDumperT6.cpp | 3 +- 4 files changed, 381 insertions(+), 2 deletions(-) create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp create mode 100644 src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index b72dabfa8..f06d140d6 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -172,16 +172,52 @@ class AssetDumperSndBank::Internal // loadspec stream.WriteColumn(""); - // "# secondary", + // secondary + stream.WriteColumn(alias->secondaryname); + // "# group", + stream.WriteColumn(""); + // "# vol_min", + stream.WriteColumn(""); + // "# vol_max", + stream.WriteColumn(""); + // "# team_vol_mod", + stream.WriteColumn(""); + // "# dist_min", + stream.WriteColumn(""); + // "# dist_max", + stream.WriteColumn(""); + // "# dist_reverb_max", + stream.WriteColumn(""); + // "# volume_falloff_curve", + stream.WriteColumn(""); + // "# reverb_falloff_curve", + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + stream.WriteColumn(""); + + + + + + + + + + // "# volume_min_falloff_curve", // "# reverb_min_falloff_curve", // "# limit_count", diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp new file mode 100644 index 000000000..948538e28 --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -0,0 +1,327 @@ +#include "AssetDumperSndDriverGlobals.h" + +#include +#include +#include + +#include "Utils/ClassUtils.h" +#include "Csv/CsvStream.h" +#include "ObjContainer/SoundBank/SoundBank.h" + +using namespace T6; +namespace fs = std::filesystem; + +class AssetDumperSndDriverGlobals::Internal +{ + AssetDumpingContext& m_context; + + inline static const std::string GROUPS_HEADERS[] + { + "name","attenuationSp","attenuationMp","category","parent" + }; + + inline static const std::string GROUPS_CATEGORIES[] + { + "sfx","music","void","ui","cinematic" + }; + + inline static const std::string CURVE_HEADERS[] + { + "name","x0","y0","x1","y1","x2","y2","x3","y3","x4","y4","x5","y5","x6","y6","x7","y7" + }; + + inline static const std::string PAN_HEADERS[] + { + "name","front","back","center","lfe","left","right", + }; + + inline static const std::string MASTER_HEADERS[] + { + "name","lowE","lowG","lowF","lowQ","peak1E","peak1G","peak1F","peak1Q","peak2E","peak2G","peak2F","peak2Q","hiE","hiG","hiF","hiQ","eqG","compE","compPG","compMG","compT","compR","compTA","compTR","limitE","limitPG","limitMG","limitT","limitR","limitTA","limitTR","busReverbG","busFxG","busVoiceG","busPfutzG","busHdrfxG","busUiG","busMusicG","busMovieG","busVcsG","busReverbE","busFxE","busVoiceE","busPfutzE","busHdrfxE","busUiE","busMusicE","busMovieE","hdrfxCompE","voiceEqE","voiceCompE" + }; + + inline static const std::string SIDECHAIN_HEADERS[] + { + "name","g","f","q","ta","tr","tf" + }; + + inline static const std::string FUTZ_HEADERS[] + { + "name","bpfF","bpfQ","lsG","lsF","lsQ","dist","preG","postG","th","tg","clippre","clippost","blend","startAliasId","stopAliasId","loopAliasId" + }; + + std::unique_ptr OpenAssetFile(const std::string& filename) + { + auto outputFile = this->m_context.OpenAssetFile(filename); + if (outputFile == nullptr) + { + std::cout << "Failed to open sound driver globals output file for: \"" << filename << "\"" << std::endl; + } + + return outputFile; + } + + static void WriteFileHeader(CsvOutputStream& stream, const std::string* headers, size_t count) + { + for (auto i = 0u; i < count; i++) + { + stream.WriteColumn(headers[i]); + } + + stream.NextRow(); + } + + void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\group.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, GROUPS_HEADERS, 5); + + for (auto i = 0u; i < count; i++) + { + const auto& group = groups[i]; + csvStream.WriteColumn(group.name); + csvStream.WriteColumn(std::to_string(group.attenuationSp)); + csvStream.WriteColumn(std::to_string(group.attenuationMp)); + csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]); + csvStream.WriteColumn(group.parentName); + csvStream.NextRow(); + } + } + } + + void DumpSndCurves(const SndCurve* curves, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\curves.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, CURVE_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& curve = curves[i]; + csvStream.WriteColumn(curve.name); + + for (auto j = 0u; j < 8; j++) + { + csvStream.WriteColumn(std::to_string(curve.points[j].x)); + csvStream.WriteColumn(std::to_string(curve.points[j].y)); + } + + csvStream.NextRow(); + } + } + } + + void DumpSndPans(const SndPan* pans, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\pan.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, PAN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& pan = pans[i]; + csvStream.WriteColumn(pan.name); + csvStream.WriteColumn(std::to_string(pan.front)); + csvStream.WriteColumn(std::to_string(pan.back)); + csvStream.WriteColumn(std::to_string(pan.center)); + csvStream.WriteColumn(std::to_string(pan.lfe)); + csvStream.WriteColumn(std::to_string(pan.left)); + csvStream.WriteColumn(std::to_string(pan.right)); + csvStream.NextRow(); + } + } + } + + void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\duck_groups.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + csvStream.WriteColumn("name"); + csvStream.NextRow(); + + for (auto i = 0u; i < count; i++) + { + const auto& duckGroup = duckGroups[i]; + csvStream.WriteColumn(duckGroup.name); + csvStream.NextRow(); + } + } + } + + void DumpSndMasters(const SndMaster* masters, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\master.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, MASTER_HEADERS, 52); + + for (auto i = 0u; i < count; i++) + { + const auto& master = masters[i]; + csvStream.WriteColumn(master.name); + csvStream.WriteColumn(std::to_string(master.lowE)); + csvStream.WriteColumn(std::to_string(master.lowG)); + csvStream.WriteColumn(std::to_string(master.lowF)); + csvStream.WriteColumn(std::to_string(master.lowQ)); + csvStream.WriteColumn(std::to_string(master.peak1E)); + csvStream.WriteColumn(std::to_string(master.peak1G)); + csvStream.WriteColumn(std::to_string(master.peak1F)); + csvStream.WriteColumn(std::to_string(master.peak1Q)); + csvStream.WriteColumn(std::to_string(master.peak2E)); + csvStream.WriteColumn(std::to_string(master.peak2G)); + csvStream.WriteColumn(std::to_string(master.peak2F)); + csvStream.WriteColumn(std::to_string(master.peak2Q)); + csvStream.WriteColumn(std::to_string(master.hiE)); + csvStream.WriteColumn(std::to_string(master.hiG)); + csvStream.WriteColumn(std::to_string(master.hiF)); + csvStream.WriteColumn(std::to_string(master.hiQ)); + csvStream.WriteColumn(std::to_string(master.eqG)); + csvStream.WriteColumn(std::to_string(master.compE)); + csvStream.WriteColumn(std::to_string(master.compPG)); + csvStream.WriteColumn(std::to_string(master.compMG)); + csvStream.WriteColumn(std::to_string(master.compT)); + csvStream.WriteColumn(std::to_string(master.compR)); + csvStream.WriteColumn(std::to_string(master.compTA)); + csvStream.WriteColumn(std::to_string(master.compTR)); + csvStream.WriteColumn(std::to_string(master.limitE)); + csvStream.WriteColumn(std::to_string(master.limitPG)); + csvStream.WriteColumn(std::to_string(master.limitMG)); + csvStream.WriteColumn(std::to_string(master.limitT)); + csvStream.WriteColumn(std::to_string(master.limitR)); + csvStream.WriteColumn(std::to_string(master.limitTA)); + csvStream.WriteColumn(std::to_string(master.limitTR)); + csvStream.WriteColumn(std::to_string(master.busReverbG)); + csvStream.WriteColumn(std::to_string(master.busFxG)); + csvStream.WriteColumn(std::to_string(master.busVoiceG)); + csvStream.WriteColumn(std::to_string(master.busPfutzG)); + csvStream.WriteColumn(std::to_string(master.busHdrfxG)); + csvStream.WriteColumn(std::to_string(master.busUiG)); + csvStream.WriteColumn(std::to_string(master.busMusicG)); + csvStream.WriteColumn(std::to_string(master.busMovieG)); + csvStream.WriteColumn(std::to_string(master.busVcsG)); + csvStream.WriteColumn(std::to_string(master.busReverbE)); + csvStream.WriteColumn(std::to_string(master.busFxE)); + csvStream.WriteColumn(std::to_string(master.busVoiceE)); + csvStream.WriteColumn(std::to_string(master.busPfutzE)); + csvStream.WriteColumn(std::to_string(master.busHdrfxE)); + csvStream.WriteColumn(std::to_string(master.busUiE)); + csvStream.WriteColumn(std::to_string(master.busMusicE)); + csvStream.WriteColumn(std::to_string(master.busMovieE)); + csvStream.WriteColumn(std::to_string(master.hdrfxCompE)); + csvStream.WriteColumn(std::to_string(master.voiceEqE)); + csvStream.WriteColumn(std::to_string(master.voiceCompE)); + csvStream.NextRow(); + } + } + } + + void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\sidechain_duck.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 7); + + for (auto i = 0u; i < count; i++) + { + const auto& sidechain = sidechains[i]; + csvStream.WriteColumn(sidechain.name); + csvStream.WriteColumn(std::to_string(sidechain.g)); + csvStream.WriteColumn(std::to_string(sidechain.f)); + csvStream.WriteColumn(std::to_string(sidechain.q)); + csvStream.WriteColumn(std::to_string(sidechain.ta)); + csvStream.WriteColumn(std::to_string(sidechain.tr)); + csvStream.WriteColumn(std::to_string(sidechain.tf)); + csvStream.NextRow(); + } + } + } + + void DumpSndFutz(const SndFutz* futzes, const size_t count) + { + const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\futz.csv"); + + if (outputFile != nullptr) + { + CsvOutputStream csvStream(*outputFile); + WriteFileHeader(csvStream, FUTZ_HEADERS, 17); + + for (auto i = 0u; i < count; i++) + { + const auto& futz = futzes[i]; + csvStream.WriteColumn(futz.name); + csvStream.WriteColumn(std::to_string(futz.bpfF)); + csvStream.WriteColumn(std::to_string(futz.bpfQ)); + csvStream.WriteColumn(std::to_string(futz.lsG)); + csvStream.WriteColumn(std::to_string(futz.lsF)); + csvStream.WriteColumn(std::to_string(futz.lsQ)); + csvStream.WriteColumn(std::to_string(futz.dist)); + csvStream.WriteColumn(std::to_string(futz.preG)); + csvStream.WriteColumn(std::to_string(futz.postG)); + csvStream.WriteColumn(std::to_string(futz.th)); + csvStream.WriteColumn(std::to_string(futz.tg)); + csvStream.WriteColumn(std::to_string(futz.clippre)); + csvStream.WriteColumn(std::to_string(futz.clippost)); + csvStream.WriteColumn(std::to_string(futz.blend)); + csvStream.WriteColumn(std::to_string(futz.startAliasId)); + csvStream.WriteColumn(std::to_string(futz.stopAliasId)); + csvStream.WriteColumn(std::to_string(futz.loopAliasId)); + csvStream.NextRow(); + } + } + } + + void DumpSndDriverGlobals(const XAssetInfo* sndDriverGlobalsInfo) + { + const auto* sndDriverGlobals = sndDriverGlobalsInfo->Asset(); + + DumpSndVolumesGroups(sndDriverGlobals->groups, sndDriverGlobals->groupCount); + DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount); + DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount); + DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount); + //DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount); + DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount); + DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount); + DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount); + } + +public: + explicit Internal(AssetDumpingContext& context) + : m_context(context) + { + } + + void DumpPool(AssetPool* pool) + { + for (const auto* assetInfo : *pool) + { + if (!assetInfo->m_name.empty() && assetInfo->m_name[0] == ',') + continue; + + DumpSndDriverGlobals(assetInfo); + } + } +}; + +void AssetDumperSndDriverGlobals::DumpPool(AssetDumpingContext& context, AssetPool* pool) +{ + Internal internal(context); + internal.DumpPool(pool); +} diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h new file mode 100644 index 000000000..dd6b18abc --- /dev/null +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Dumping/AbstractAssetDumper.h" +#include "Game/T6/T6.h" + +namespace T6 +{ + class AssetDumperSndDriverGlobals final : public IAssetDumper + { + class Internal; + + public: + void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; + }; +} diff --git a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp index c01fe85b5..6f96586c9 100644 --- a/src/ObjWriting/Game/T6/ZoneDumperT6.cpp +++ b/src/ObjWriting/Game/T6/ZoneDumperT6.cpp @@ -11,6 +11,7 @@ #include "AssetDumpers/AssetDumperSlug.h" #include "AssetDumpers/AssetDumperSndBank.h" #include "AssetDumpers/AssetDumperStringTable.h" +#include "AssetDumpers/AssetDumperSndDriverGlobals.h" #include "AssetDumpers/AssetDumperTracer.h" #include "AssetDumpers/AssetDumperVehicle.h" #include "AssetDumpers/AssetDumperWeapon.h" @@ -66,7 +67,7 @@ bool ZoneDumper::DumpZone(AssetDumpingContext& context) const DUMP_ASSET_POOL(AssetDumperWeaponAttachment, m_attachment, ASSET_TYPE_ATTACHMENT) DUMP_ASSET_POOL(AssetDumperWeaponAttachmentUnique, m_attachment_unique, ASSET_TYPE_ATTACHMENT_UNIQUE) // DUMP_ASSET_POOL(AssetDumperWeaponCamo, m_camo, ASSET_TYPE_WEAPON_CAMO) - // DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) + DUMP_ASSET_POOL(AssetDumperSndDriverGlobals, m_snd_driver_globals, ASSET_TYPE_SNDDRIVER_GLOBALS) // DUMP_ASSET_POOL(AssetDumperFxEffectDef, m_fx, ASSET_TYPE_FX) // DUMP_ASSET_POOL(AssetDumperFxImpactTable, m_fx_impact_table, ASSET_TYPE_IMPACT_FX) DUMP_ASSET_POOL(AssetDumperRawFile, m_raw_file, ASSET_TYPE_RAWFILE) From 5e951bd1e14f65345c1db208662e97bd2da31b77 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 4 Oct 2023 23:55:29 -0400 Subject: [PATCH 04/15] add SndDriverGlobals dumping --- thirdparty/catch2 | 2 +- thirdparty/json | 2 +- thirdparty/zlib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/thirdparty/catch2 b/thirdparty/catch2 index dacbf4fd6..caffe79a3 160000 --- a/thirdparty/catch2 +++ b/thirdparty/catch2 @@ -1 +1 @@ -Subproject commit dacbf4fd6c80d726b3d87e77c91bcacdd4fc57c0 +Subproject commit caffe79a3172495f6a4b09de88e81e9aa67b8323 diff --git a/thirdparty/json b/thirdparty/json index 3780b41dd..6eab7a2b1 160000 --- a/thirdparty/json +++ b/thirdparty/json @@ -1 +1 @@ -Subproject commit 3780b41dd070436f3f55327b0a88f27a52e2dfa8 +Subproject commit 6eab7a2b187b10b2494e39c1961750bfd1bda500 diff --git a/thirdparty/zlib b/thirdparty/zlib index 643e17b74..ac8f12c97 160000 --- a/thirdparty/zlib +++ b/thirdparty/zlib @@ -1 +1 @@ -Subproject commit 643e17b7498d12ab8d15565662880579692f769d +Subproject commit ac8f12c97d1afd9bafa9c710f827d40a407d3266 From 7d13b3e057b377cc4115389bdd01054466d7b585 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 21:56:35 -0500 Subject: [PATCH 05/15] updates --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 244 +++++++++++++----- 1 file changed, 186 insertions(+), 58 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index f06d140d6..e07e0072a 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -96,7 +96,47 @@ namespace 96000, 192000, }; -} // namespace + + const std::string GROUPS_ENUM[] + { + "grp_reference", "grp_master", "grp_wpn_lfe", "grp_lfe", "grp_hdrfx", "grp_music", "grp_voice", "grp_set_piece", "grp_igc", + "grp_mp_game", "grp_explosion", "grp_player_impacts", "grp_scripted_moment", "grp_menu", "grp_whizby", "grp_weapon", "grp_vehicle", + "grp_impacts", "grp_foley", "grp_destructible", "grp_physics", "grp_ambience", "grp_alerts", "grp_air", "grp_bink", "grp_announcer", + "" + }; + + const std::string CURVES_ENUM[] + { + "default", "defaultmin", "allon", "alloff", "rcurve0", "rcurve1", "rcurve2", "rcurve3", "rcurve4", "rcurve5", "steep", + "sindelay", "cosdelay", "sin", "cos", "rev60", "rev65", + "" + }; + + const std::string LOOP_TYPES_ENUM[] + { + "nonlooping", "looping" + }; + + const std::string LIMIT_TYPES_ENUM[] + { + "none", "oldest", "reject", "priority" + }; + + const std::string MOVE_TYPES_ENUM[] + { + "none", "left_player", "center_player", "right_player", "random", "left_shot", "center_shot", "right_shot" + }; + + const std::string LOAD_TYPES_ENUM[] + { + "unknown", "loaded", "streamed", "primed" + }; + + const std::string BUS_IDS_ENUM[] + { + "bus_reverb", "bus_fx", "bus_voice", "bus_pfutz", "bus_hdrfx", "bus_ui", "bus_reference", "bus_music", "bus_movie", "bus_reference", "" + }; +} class AssetDumperSndBank::Internal { @@ -142,11 +182,6 @@ class AssetDumperSndBank::Internal return nullptr; } - static std::unique_ptr OpenAliasOutputFile(const SndBank* sndBank) - { - return nullptr; - } - static void WriteAliasFileHeader(CsvOutputStream& stream) { for (const auto& headerField : ALIAS_HEADERS) @@ -157,7 +192,20 @@ class AssetDumperSndBank::Internal stream.NextRow(); } - static void WriteAliasToFile(CsvOutputStream& stream, const SndAlias* alias) + static const char* FindNameForDuck(unsigned int id, const SndDuck* ducks, unsigned int duckCount) + { + for (auto i = 0u; i < duckCount; i++) + { + if (id == ducks[i].id) + { + return ducks[i].name; + } + } + + return ""; + } + + static void WriteAliasToFile(CsvOutputStream& stream, const SndAlias* alias, const SndBank* bank) { // name stream.WriteColumn(alias->name); @@ -165,7 +213,6 @@ class AssetDumperSndBank::Internal // file stream.WriteColumn(alias->assetFileName); - // "# template", // template stream.WriteColumn(""); @@ -173,122 +220,203 @@ class AssetDumperSndBank::Internal stream.WriteColumn(""); // secondary - stream.WriteColumn(alias->secondaryname); + //stream.WriteColumn(alias->secondaryname); - // "# group", - stream.WriteColumn(""); + // group + stream.WriteColumn(GROUPS_ENUM[std::min((alias->flags0 >> 17) & 0x1F, 26u)]); - // "# vol_min", - stream.WriteColumn(""); + // vol_min + stream.WriteColumn(std::to_string(alias->volMin)); - // "# vol_max", - stream.WriteColumn(""); + // vol_max + stream.WriteColumn(std::to_string(alias->volMax)); - // "# team_vol_mod", + // team_vol_mod stream.WriteColumn(""); - // "# dist_min", - stream.WriteColumn(""); + // dist_min + stream.WriteColumn(std::to_string(alias->distMin)); - // "# dist_max", - stream.WriteColumn(""); + // dist_max + stream.WriteColumn(std::to_string(alias->distMax)); - // "# dist_reverb_max", - stream.WriteColumn(""); + // dist_reverb_max + stream.WriteColumn(std::to_string(alias->distReverbMax)); - // "# volume_falloff_curve", - stream.WriteColumn(""); + // volume_falloff_curve + stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 14) & 0x1F, 17u)]); - // "# reverb_falloff_curve", - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); - stream.WriteColumn(""); + // reverb_falloff_curve + stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 20) & 0x1F, 17u)]); + + // volume_min_falloff_curve + stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 2) & 0x1F, 17u)]); + + // reverb_min_falloff_curve" + stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 8) & 0x1F, 17u)]); + + // limit_count + stream.WriteColumn(std::to_string(alias->limitCount)); + + // limit_type + stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 25) & 0x3]); + + // entity_limit_count + stream.WriteColumn(std::to_string(alias->entityLimitCount)); + + // entity_limit_type + stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 27) & 0x3]); + + // pitch_min + stream.WriteColumn(std::to_string(alias->pitchMin)); + // pitch_max + stream.WriteColumn(std::to_string(alias->pitchMax)); + // team_pitch_mod + stream.WriteColumn(""); + // min_priority + stream.WriteColumn(std::to_string(alias->minPriority)); + // max_priority + stream.WriteColumn(std::to_string(alias->maxPriority)); + // min_priority_threshold + stream.WriteColumn(std::to_string(alias->minPriorityThreshold)); + // max_priority_threshold + stream.WriteColumn(std::to_string(alias->maxPriorityThreshold)); + // spatialized + stream.WriteColumn(""); + + // type + stream.WriteColumn(std::to_string(alias->contextType)); + // loop + stream.WriteColumn((alias->flags0 & 0x1) == 0 ? "nonlooping" : "looping"); + // randomize_type + stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 15) & 0x3]); - // "# volume_min_falloff_curve", - // "# reverb_min_falloff_curve", - // "# limit_count", - // "# limit_type", - // "# entity_limit_count", - // "# entity_limit_type", - // "# pitch_min", - // "# pitch_max", - // "# team_pitch_mod", - // "# min_priority", - // "# max_priority", - // "# min_priority_threshold", - // "# max_priority_threshold", - // "# spatialized", - // "# type", - // "# loop", - // "# randomize_type", // "# probability", + stream.WriteColumn(std::to_string(alias->probability)); + // "# start_delay", + stream.WriteColumn(std::to_string(alias->startDelay)); + // "# reverb_send", + stream.WriteColumn(std::to_string(alias->reverbSend)); + // "# duck", + stream.WriteColumn(""); // FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); + // "# pan", + stream.WriteColumn(((alias->flags0 >> 6) & 0x1) == 0 ? "2d" : "3d"); + // "# center_send", + stream.WriteColumn(std::to_string(alias->centerSend)); + // "# envelop_min", + stream.WriteColumn(std::to_string(alias->envelopMin)); + // "# envelop_max", + stream.WriteColumn(std::to_string(alias->envelopMax)); + // "# envelop_percentage", + stream.WriteColumn(std::to_string(alias->envelopPercentage)); + // "# occlusion_level", + stream.WriteColumn(std::to_string(alias->occlusionLevel)); + // "# occlusion_wet_dry", + stream.WriteColumn(""); + // "# is_big", - // "# distance_lpf", + stream.WriteColumn(((alias->flags0 >> 4) & 0x1) == 0 ? "no" : "yes"); + + // "# distance_lpf" + stream.WriteColumn(((alias->flags0 >> 2) & 0x1) == 0 ? "no" : "yes"); + // "# move_type", + stream.WriteColumn(MOVE_TYPES_ENUM[(alias->flags0 >> 22) & 0x7]); + // "# move_time", + stream.WriteColumn(std::to_string(alias->fluxTime)); + // "# real_delay", + stream.WriteColumn(""); + // "# subtitle", + //stream.WriteColumn(alias->subtitle); + // "# mature", + stream.WriteColumn(""); + // "# doppler", + stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes"); + // "# futz", + stream.WriteColumn(""); + // "# context_type", + stream.WriteColumn("hash_" + std::to_string(alias->contextType)); + // "# context_value", + stream.WriteColumn("hash_" + std::to_string(alias->contextValue)); + // "# compression", + stream.WriteColumn(""); + // "# timescale", + stream.WriteColumn(((alias->flags0 >> 8) & 0x1) == 0 ? "no" : "yes"); + // "# music", + stream.WriteColumn(((alias->flags0 >> 10) & 0x1) == 0 ? "no" : "yes"); + // "# fade_in", + stream.WriteColumn(std::to_string(alias->fadeIn)); + // "# fade_out", + stream.WriteColumn(std::to_string(alias->fadeOut)); + // "# pc_format", + stream.WriteColumn(""); + // "# pause", + stream.WriteColumn(((alias->flags0 >> 5) & 0x1) == 0 ? "no" : "yes"); + // "# stop_on_death", + stream.WriteColumn(((alias->flags0 >> 7) & 0x1) == 0 ? "no" : "yes"); + // "# bus", + stream.WriteColumn(BUS_IDS_ENUM[std::min((alias->flags0 >> 13) & 0xF, 10u)]); + // "# snapshot", + stream.WriteColumn(""); } - static void DumpSndBankAliases(const SndBank* sndBank) + void DumpSndBankAliases(const SndBank* sndBank) const { - const auto outputFile = OpenAliasOutputFile(sndBank); - - if (outputFile == nullptr) + const auto outFile = OpenAssetOutputFile("soundaliases\\" + std::string(sndBank->name), ".csv"); + if (!outFile) { - std::cout << "Failed to open sound alias output file for: \"" << sndBank->name << "\"" << std::endl; + std::cerr << "Failed to open sound output file: \"" << sndBank->name << "\"\n"; return; } - CsvOutputStream csvStream(*outputFile); + CsvOutputStream csvStream(*outFile); WriteAliasFileHeader(csvStream); for (auto i = 0u; i < sndBank->aliasCount; i++) { const auto& aliasList = sndBank->alias[i]; + for (auto j = 0; j < aliasList.count; j++) { const auto& alias = aliasList.head[j]; - WriteAliasToFile(csvStream, &alias); + WriteAliasToFile(csvStream, &alias, sndBank); } } } From 1842ec30023d1afbc5485154c726bb71741beb6a Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 22:41:14 -0500 Subject: [PATCH 06/15] sound alias dumping --- .../T6/AssetDumpers/AssetDumperFontIcon.cpp | 22 +- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 208 +++++++++--------- 2 files changed, 109 insertions(+), 121 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index 4849d6090..2a15abe92 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -24,21 +24,21 @@ class AssetDumperFontIconInternal inline static const std::string TYPE_ICON = "icon"; inline static const std::string ICON_HEADERS[]{ - "# index", - "# type", - "# name", - "# material", - "# size", - "# xScale", - "# yScale", + index", + type", + name", + material", + size", + xScale", + yScale", }; inline static const std::string TYPE_ALIAS = "alias"; inline static const std::string ALIAS_HEADERS[]{ - "# index", - "# type", - "# alias", - "# button", + index", + type", + alias", + button", }; inline static const KnownAlias KNOWN_ALIASES[]{ diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index e07e0072a..b97e4f796 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -15,69 +15,69 @@ namespace fs = std::filesystem; namespace { const std::string ALIAS_HEADERS[]{ - "# name", - "# file", - "# template", - "# loadspec", - "# secondary", - "# group", - "# vol_min", - "# vol_max", - "# team_vol_mod", - "# dist_min", - "# dist_max", - "# dist_reverb_max", - "# volume_falloff_curve", - "# reverb_falloff_curve", - "# volume_min_falloff_curve", - "# reverb_min_falloff_curve", - "# limit_count", - "# limit_type", - "# entity_limit_count", - "# entity_limit_type", - "# pitch_min", - "# pitch_max", - "# team_pitch_mod", - "# min_priority", - "# max_priority", - "# min_priority_threshold", - "# max_priority_threshold", - "# spatialized", - "# type", - "# loop", - "# randomize_type", - "# probability", - "# start_delay", - "# reverb_send", - "# duck", - "# pan", - "# center_send", - "# envelop_min", - "# envelop_max", - "# envelop_percentage", - "# occlusion_level", - "# occlusion_wet_dry", - "# is_big", - "# distance_lpf", - "# move_type", - "# move_time", - "# real_delay", - "# subtitle", - "# mature", - "# doppler", - "# futz", - "# context_type", - "# context_value", - "# compression", - "# timescale", - "# music", - "# fade_in", - "# fade_out", - "# pc_format", - "# pause", - "# stop_on_death", - "# bus", - "# snapshot", + "name", + "file", + "template", + "loadspec", + "secondary", + "group", + "vol_min", + "vol_max", + "team_vol_mod", + "dist_min", + "dist_max", + "dist_reverb_max", + "volume_falloff_curve", + "reverb_falloff_curve", + "volume_min_falloff_curve", + "reverb_min_falloff_curve", + "limit_count", + "limit_type", + "entity_limit_count", + "entity_limit_type", + "pitch_min", + "pitch_max", + "team_pitch_mod", + "min_priority", + "max_priority", + "min_priority_threshold", + "max_priority_threshold", + "spatialized", + "type", + "loop", + "randomize_type", + "probability", + "start_delay", + "reverb_send", + "duck", + "pan", + "center_send", + "envelop_min", + "envelop_max", + "envelop_percentage", + "occlusion_level", + "occlusion_wet_dry", + "is_big", + "distance_lpf", + "move_type", + "move_time", + "real_delay", + "subtitle", + "mature", + "doppler", + "futz", + "context_type", + "context_value", + "compression", + "timescale", + "music", + "fade_in", + "fade_out", + "pc_format", + "pause", + "stop_on_death", + "bus", + "snapshot", }; const std::string PREFIXES_TO_DROP[]{ @@ -192,19 +192,6 @@ class AssetDumperSndBank::Internal stream.NextRow(); } - static const char* FindNameForDuck(unsigned int id, const SndDuck* ducks, unsigned int duckCount) - { - for (auto i = 0u; i < duckCount; i++) - { - if (id == ducks[i].id) - { - return ducks[i].name; - } - } - - return ""; - } - static void WriteAliasToFile(CsvOutputStream& stream, const SndAlias* alias, const SndBank* bank) { // name @@ -300,100 +287,100 @@ class AssetDumperSndBank::Internal // randomize_type stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 15) & 0x3]); - // "# probability", + // probability", stream.WriteColumn(std::to_string(alias->probability)); - // "# start_delay", + // start_delay", stream.WriteColumn(std::to_string(alias->startDelay)); - // "# reverb_send", + // reverb_send", stream.WriteColumn(std::to_string(alias->reverbSend)); - // "# duck", - stream.WriteColumn(""); // FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); + // duck", + stream.WriteColumn(""); - // "# pan", + // pan", stream.WriteColumn(((alias->flags0 >> 6) & 0x1) == 0 ? "2d" : "3d"); - // "# center_send", + // center_send", stream.WriteColumn(std::to_string(alias->centerSend)); - // "# envelop_min", + // envelop_min", stream.WriteColumn(std::to_string(alias->envelopMin)); - // "# envelop_max", + // envelop_max", stream.WriteColumn(std::to_string(alias->envelopMax)); - // "# envelop_percentage", + // envelop_percentage", stream.WriteColumn(std::to_string(alias->envelopPercentage)); - // "# occlusion_level", + // occlusion_level", stream.WriteColumn(std::to_string(alias->occlusionLevel)); - // "# occlusion_wet_dry", + // occlusion_wet_dry", stream.WriteColumn(""); - // "# is_big", + // is_big", stream.WriteColumn(((alias->flags0 >> 4) & 0x1) == 0 ? "no" : "yes"); - // "# distance_lpf" + // distance_lpf" stream.WriteColumn(((alias->flags0 >> 2) & 0x1) == 0 ? "no" : "yes"); - // "# move_type", - stream.WriteColumn(MOVE_TYPES_ENUM[(alias->flags0 >> 22) & 0x7]); + // move_type", + stream.WriteColumn(MOVE_TYPES_ENUM[std::min((alias->flags0 >> 22) & 0x7, 7u)]); - // "# move_time", + // move_time", stream.WriteColumn(std::to_string(alias->fluxTime)); - // "# real_delay", + // real_delay", stream.WriteColumn(""); - // "# subtitle", + // subtitle", //stream.WriteColumn(alias->subtitle); - // "# mature", + // mature", stream.WriteColumn(""); - // "# doppler", + // doppler", stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes"); - // "# futz", + // futz", stream.WriteColumn(""); - // "# context_type", + // context_type", stream.WriteColumn("hash_" + std::to_string(alias->contextType)); - // "# context_value", + // context_value", stream.WriteColumn("hash_" + std::to_string(alias->contextValue)); - // "# compression", + // compression", stream.WriteColumn(""); - // "# timescale", + // timescale", stream.WriteColumn(((alias->flags0 >> 8) & 0x1) == 0 ? "no" : "yes"); - // "# music", + // music", stream.WriteColumn(((alias->flags0 >> 10) & 0x1) == 0 ? "no" : "yes"); - // "# fade_in", + // fade_in", stream.WriteColumn(std::to_string(alias->fadeIn)); - // "# fade_out", + // fade_out", stream.WriteColumn(std::to_string(alias->fadeOut)); - // "# pc_format", + // pc_format", stream.WriteColumn(""); - // "# pause", + // pause", stream.WriteColumn(((alias->flags0 >> 5) & 0x1) == 0 ? "no" : "yes"); - // "# stop_on_death", + // stop_on_death", stream.WriteColumn(((alias->flags0 >> 7) & 0x1) == 0 ? "no" : "yes"); - // "# bus", + // bus", stream.WriteColumn(BUS_IDS_ENUM[std::min((alias->flags0 >> 13) & 0xF, 10u)]); - // "# snapshot", + // snapshot", stream.WriteColumn(""); } @@ -417,6 +404,7 @@ class AssetDumperSndBank::Internal { const auto& alias = aliasList.head[j]; WriteAliasToFile(csvStream, &alias, sndBank); + csvStream.NextRow(); } } } From bcd35d56dc736e014184f649df65fc14c46c4ef5 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 22:43:21 -0500 Subject: [PATCH 07/15] undo whoopsie --- .../T6/AssetDumpers/AssetDumperFontIcon.cpp | 22 +++++++++---------- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 15 ++++++++++++- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index 2a15abe92..4849d6090 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -24,21 +24,21 @@ class AssetDumperFontIconInternal inline static const std::string TYPE_ICON = "icon"; inline static const std::string ICON_HEADERS[]{ - index", - type", - name", - material", - size", - xScale", - yScale", + "# index", + "# type", + "# name", + "# material", + "# size", + "# xScale", + "# yScale", }; inline static const std::string TYPE_ALIAS = "alias"; inline static const std::string ALIAS_HEADERS[]{ - index", - type", - alias", - button", + "# index", + "# type", + "# alias", + "# button", }; inline static const KnownAlias KNOWN_ALIASES[]{ diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index b97e4f796..55a2e9dfd 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -192,6 +192,19 @@ class AssetDumperSndBank::Internal stream.NextRow(); } + static const char* FindNameForDuck(unsigned int id, const SndDuck* ducks, unsigned int duckCount) + { + for (auto i = 0u; i < duckCount; i++) + { + if (id == ducks[i].id) + { + return ducks[i].name; + } + } + + return ""; + } + static void WriteAliasToFile(CsvOutputStream& stream, const SndAlias* alias, const SndBank* bank) { // name @@ -297,7 +310,7 @@ class AssetDumperSndBank::Internal stream.WriteColumn(std::to_string(alias->reverbSend)); // duck", - stream.WriteColumn(""); + stream.WriteColumn(""); // FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); // pan", stream.WriteColumn(((alias->flags0 >> 6) & 0x1) == 0 ? "2d" : "3d"); From 8989e8a95bc516c126df1d42874e5e5337d559a8 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 23:15:42 -0500 Subject: [PATCH 08/15] only dump valid aliases --- src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 55a2e9dfd..9b2347573 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -416,8 +416,11 @@ class AssetDumperSndBank::Internal for (auto j = 0; j < aliasList.count; j++) { const auto& alias = aliasList.head[j]; - WriteAliasToFile(csvStream, &alias, sndBank); - csvStream.NextRow(); + if (alias.assetId && alias.assetFileName) + { + WriteAliasToFile(csvStream, &alias, sndBank); + csvStream.NextRow(); + } } } } From 2e0bfab0ab69a0192d5e400667bc17bc17d0094f Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 23:48:09 -0500 Subject: [PATCH 09/15] move soundbank data folders to canonical t7 layout --- .../Game/T6/AssetDumpers/AssetDumperSndBank.cpp | 13 ++++++++++++- .../T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp | 12 ++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 9b2347573..687d54ba1 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -399,7 +399,7 @@ class AssetDumperSndBank::Internal void DumpSndBankAliases(const SndBank* sndBank) const { - const auto outFile = OpenAssetOutputFile("soundaliases\\" + std::string(sndBank->name), ".csv"); + const auto outFile = OpenAssetOutputFile("soundbank\\aliases\\" + std::string(sndBank->name), ".csv"); if (!outFile) { std::cerr << "Failed to open sound output file: \"" << sndBank->name << "\"\n"; @@ -521,6 +521,16 @@ class AssetDumperSndBank::Internal } } + void DumpSoundRadverb(const SndBank* sndBank) const + { + std::cout << sndBank->radverbCount << "\n"; + for (auto i = 0u; i < sndBank->radverbCount; i++) + { + const auto& radverb = sndBank->radverbs[i]; + std::cout << radverb.name << "\n"; + } + } + void DumpSoundData(const SndBank* sndBank) const { std::unordered_set dumpedAssets; @@ -546,6 +556,7 @@ class AssetDumperSndBank::Internal const auto* sndBank = sndBankInfo->Asset(); DumpSndBankAliases(sndBank); + DumpSoundRadverb(sndBank); DumpSoundData(sndBank); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp index 948538e28..67b275d76 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -95,7 +95,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndCurves(const SndCurve* curves, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\curves.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\curves.csv"); if (outputFile != nullptr) { @@ -120,7 +120,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndPans(const SndPan* pans, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\pan.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\pan.csv"); if (outputFile != nullptr) { @@ -144,7 +144,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndDuckGroups(const SndDuckGroup* duckGroups, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\duck_groups.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\duck_groups.csv"); if (outputFile != nullptr) { @@ -163,7 +163,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndMasters(const SndMaster* masters, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\master.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\master.csv"); if (outputFile != nullptr) { @@ -232,7 +232,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndSidechainDucks(const SndSidechainDuck* sidechains, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\sidechain_duck.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\sidechain_duck.csv"); if (outputFile != nullptr) { @@ -256,7 +256,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndFutz(const SndFutz* futzes, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\futz.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\futz.csv"); if (outputFile != nullptr) { From fcbf1308ff50cdb8270d069d6540bfddc6adae38 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 10 Dec 2023 23:59:18 -0500 Subject: [PATCH 10/15] add soundbank radverb dumping --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 69 +++++++++++++++++-- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 687d54ba1..4c6584c52 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -80,6 +80,26 @@ namespace "snapshot", }; + const std::string REVERB_HEADERS[]{ + "name", + "smoothing", + "earlyTime", + "lateTime", + "earlyGain", + "lateGain", + "returnGain", + "earlyLpf", + "lateLpf", + "inputLpf", + "dampLpf", + "wallReflect", + "dryGain", + "earlySize", + "lateSize", + "diffusion", + "returnHighpass" + }; + const std::string PREFIXES_TO_DROP[]{ "raw/", "devraw/", @@ -192,6 +212,16 @@ class AssetDumperSndBank::Internal stream.NextRow(); } + static void WriteReverbFileHeader(CsvOutputStream& stream) + { + for (const auto& headerField : REVERB_HEADERS) + { + stream.WriteColumn(headerField); + } + + stream.NextRow(); + } + static const char* FindNameForDuck(unsigned int id, const SndDuck* ducks, unsigned int duckCount) { for (auto i = 0u; i < duckCount; i++) @@ -402,7 +432,7 @@ class AssetDumperSndBank::Internal const auto outFile = OpenAssetOutputFile("soundbank\\aliases\\" + std::string(sndBank->name), ".csv"); if (!outFile) { - std::cerr << "Failed to open sound output file: \"" << sndBank->name << "\"\n"; + std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n"; return; } @@ -523,11 +553,42 @@ class AssetDumperSndBank::Internal void DumpSoundRadverb(const SndBank* sndBank) const { - std::cout << sndBank->radverbCount << "\n"; + if (sndBank->radverbCount <= 0) + { + return; + } + + const auto outFile = OpenAssetOutputFile("soundbank\\reverbs\\" + std::string(sndBank->name), ".csv"); + if (!outFile) + { + std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n"; + return; + } + + CsvOutputStream csvStream(*outFile); + WriteReverbFileHeader(csvStream); + for (auto i = 0u; i < sndBank->radverbCount; i++) { - const auto& radverb = sndBank->radverbs[i]; - std::cout << radverb.name << "\n"; + const auto& reverb = sndBank->radverbs[i]; + csvStream.WriteColumn(reverb.name); + csvStream.WriteColumn(std::to_string(reverb.smoothing)); + csvStream.WriteColumn(std::to_string(reverb.earlyTime)); + csvStream.WriteColumn(std::to_string(reverb.lateTime)); + csvStream.WriteColumn(std::to_string(reverb.earlyGain)); + csvStream.WriteColumn(std::to_string(reverb.lateGain)); + csvStream.WriteColumn(std::to_string(reverb.returnGain)); + csvStream.WriteColumn(std::to_string(reverb.earlyLpf)); + csvStream.WriteColumn(std::to_string(reverb.lateLpf)); + csvStream.WriteColumn(std::to_string(reverb.inputLpf)); + csvStream.WriteColumn(std::to_string(reverb.dampLpf)); + csvStream.WriteColumn(std::to_string(reverb.wallReflect)); + csvStream.WriteColumn(std::to_string(reverb.dryGain)); + csvStream.WriteColumn(std::to_string(reverb.earlySize)); + csvStream.WriteColumn(std::to_string(reverb.lateSize)); + csvStream.WriteColumn(std::to_string(reverb.diffusion)); + csvStream.WriteColumn(std::to_string(reverb.returnHighpass)); + csvStream.NextRow(); } } From b2f44db3e5224fa9320ba515eb3eb87d2666c101 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Dec 2023 01:01:26 -0500 Subject: [PATCH 11/15] add sound ducklist dumping --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 75 ++++++++++++++++++- .../AssetDumperSndDriverGlobals.cpp | 58 ++++++++++---- 2 files changed, 114 insertions(+), 19 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 4c6584c52..1a555096d 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -100,6 +100,10 @@ namespace "returnHighpass" }; + const std::string DUCK_HEADERS[]{ + "name", "fadeIn", "fadeOut", "startDelay", "distance", "length", "fadeInCurve", "fadeOutCurve", "attenuation", "filter", "updateWhilePaused" + }; + const std::string PREFIXES_TO_DROP[]{ "raw/", "devraw/", @@ -132,6 +136,27 @@ namespace "" }; + const std::unordered_map CURVES_MAP + { + { 4135636924, CURVES_ENUM[0]}, // "default" + { 1298231670, CURVES_ENUM[1] }, // "defaultmin" + { 2783299419, CURVES_ENUM[2] }, // "allon" + { 2598309331, CURVES_ENUM[3] }, // "alloff" + { 2462421902, CURVES_ENUM[4] }, // "rcurve0" + { 2462421903, CURVES_ENUM[5] }, // "rcurve1" + { 2462421904, CURVES_ENUM[6] }, // "rcurve2" + { 2462421905, CURVES_ENUM[7] }, // "rcurve3" + { 2462421906, CURVES_ENUM[8] }, // "rcurve4" + { 2462421907, CURVES_ENUM[9] }, // "rcurve5" + { 3711863914, CURVES_ENUM[10]}, // "steep" + { 4107033168, CURVES_ENUM[11]}, // "sindelay" + { 932232097, CURVES_ENUM[12]}, // "cosdelay" + { 818663411, CURVES_ENUM[13]}, // "sin" + { 686872930, CURVES_ENUM[14]}, // "cos" + { 3885755896, CURVES_ENUM[15]}, // "rev60" + { 3885755901, CURVES_ENUM[16]}, // "rev65" + }; + const std::string LOOP_TYPES_ENUM[] { "nonlooping", "looping" @@ -340,7 +365,7 @@ class AssetDumperSndBank::Internal stream.WriteColumn(std::to_string(alias->reverbSend)); // duck", - stream.WriteColumn(""); // FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); + stream.WriteColumn(FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); // pan", stream.WriteColumn(((alias->flags0 >> 6) & 0x1) == 0 ? "2d" : "3d"); @@ -429,7 +454,7 @@ class AssetDumperSndBank::Internal void DumpSndBankAliases(const SndBank* sndBank) const { - const auto outFile = OpenAssetOutputFile("soundbank\\aliases\\" + std::string(sndBank->name), ".csv"); + const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".aliases", ".csv"); if (!outFile) { std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n"; @@ -558,7 +583,7 @@ class AssetDumperSndBank::Internal return; } - const auto outFile = OpenAssetOutputFile("soundbank\\reverbs\\" + std::string(sndBank->name), ".csv"); + const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".reverbs", ".csv"); if (!outFile) { std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n"; @@ -592,6 +617,49 @@ class AssetDumperSndBank::Internal } } + void DumpSoundDucks(const SndBank* sndBank) const + { + if (sndBank->duckCount <= 0) + { + return; + } + + const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".ducklist", ".csv"); + if (!outFile) + { + std::cerr << "Failed to open sound reverb output file: \"" << sndBank->name << "\"\n"; + return; + } + + CsvOutputStream csvStream(*outFile); + csvStream.WriteColumn("name"); + csvStream.NextRow(); + + for (auto i = 0u; i < sndBank->duckCount; i++) + { + const auto& duck = sndBank->ducks[i]; + csvStream.WriteColumn(duck.name); + csvStream.NextRow(); + + // dump duck file + //csvStream.WriteColumn(std::to_string(duck.fadeIn)); + //csvStream.WriteColumn(std::to_string(duck.fadeOut)); + //csvStream.WriteColumn(std::to_string(duck.startDelay)); + //csvStream.WriteColumn(std::to_string(duck.distance)); + //csvStream.WriteColumn(std::to_string(duck.length)); + + //auto fadeInItr = CURVES_MAP.find(duck.fadeInCurve); + //csvStream.WriteColumn(fadeInItr == CURVES_MAP.end() ? std::to_string(duck.fadeInCurve) : fadeInItr->second); + + //auto fadeOutItr = CURVES_MAP.find(duck.fadeOutCurve); + //csvStream.WriteColumn(fadeOutItr == CURVES_MAP.end() ? std::to_string(duck.fadeOutCurve) : fadeOutItr->second); + + //csvStream.WriteColumn(""); // attenuation + //csvStream.WriteColumn(""); // filter + //csvStream.WriteColumn(std::to_string(duck.updateWhilePaused)); + } + } + void DumpSoundData(const SndBank* sndBank) const { std::unordered_set dumpedAssets; @@ -618,6 +686,7 @@ class AssetDumperSndBank::Internal DumpSndBankAliases(sndBank); DumpSoundRadverb(sndBank); + DumpSoundDucks(sndBank); DumpSoundData(sndBank); } diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp index 67b275d76..b330b8345 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -16,38 +16,56 @@ class AssetDumperSndDriverGlobals::Internal AssetDumpingContext& m_context; inline static const std::string GROUPS_HEADERS[] - { - "name","attenuationSp","attenuationMp","category","parent" + {"name", "attenuationSp", "attenuationMp", "category", "parent", "id" }; inline static const std::string GROUPS_CATEGORIES[] - { - "sfx","music","void","ui","cinematic" + {"sfx", "music", "void", "ui", "cinematic", "id" }; inline static const std::string CURVE_HEADERS[] { - "name","x0","y0","x1","y1","x2","y2","x3","y3","x4","y4","x5","y5","x6","y6","x7","y7" + "name", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "x5", "y5", "x6", "y6", "x7", "y7", "id" }; inline static const std::string PAN_HEADERS[] - { - "name","front","back","center","lfe","left","right", + {"name", "front", "back", "center", "lfe", "left", "right","id" }; inline static const std::string MASTER_HEADERS[] { - "name","lowE","lowG","lowF","lowQ","peak1E","peak1G","peak1F","peak1Q","peak2E","peak2G","peak2F","peak2Q","hiE","hiG","hiF","hiQ","eqG","compE","compPG","compMG","compT","compR","compTA","compTR","limitE","limitPG","limitMG","limitT","limitR","limitTA","limitTR","busReverbG","busFxG","busVoiceG","busPfutzG","busHdrfxG","busUiG","busMusicG","busMovieG","busVcsG","busReverbE","busFxE","busVoiceE","busPfutzE","busHdrfxE","busUiE","busMusicE","busMovieE","hdrfxCompE","voiceEqE","voiceCompE" + "name", "lowE", "lowG", "lowF", "lowQ", "peak1E", "peak1G", "peak1F", "peak1Q", "peak2E", "peak2G", + "peak2F", "peak2Q", "hiE", "hiG", "hiF", "hiQ", "eqG", "compE", "compPG", "compMG", "compT", + "compR", "compTA", "compTR", "limitE", "limitPG", "limitMG", "limitT", "limitR", "limitTA", "limitTR", "busReverbG", + "busFxG", "busVoiceG", "busPfutzG", "busHdrfxG", "busUiG", "busMusicG", "busMovieG", "busVcsG", "busReverbE", "busFxE", "busVoiceE", + "busPfutzE", "busHdrfxE", "busUiE", "busMusicE", "busMovieE", "hdrfxCompE", "voiceEqE", "voiceCompE", "id" }; inline static const std::string SIDECHAIN_HEADERS[] { - "name","g","f","q","ta","tr","tf" + "name", "g", "f", "q", "ta", "tr", "tf", "id" }; inline static const std::string FUTZ_HEADERS[] { - "name","bpfF","bpfQ","lsG","lsF","lsQ","dist","preG","postG","th","tg","clippre","clippost","blend","startAliasId","stopAliasId","loopAliasId" + "name", + "bpfF", + "bpfQ", + "lsG", + "lsF", + "lsQ", + "dist", + "preG", + "postG", + "th", + "tg", + "clippre", + "clippost", + "blend", + "startAliasId", + "stopAliasId", + "loopAliasId", + "id" }; std::unique_ptr OpenAssetFile(const std::string& filename) @@ -78,7 +96,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, GROUPS_HEADERS, 5); + WriteFileHeader(csvStream, GROUPS_HEADERS, 6); for (auto i = 0u; i < count; i++) { @@ -88,6 +106,7 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(group.attenuationMp)); csvStream.WriteColumn(GROUPS_CATEGORIES[group.category]); csvStream.WriteColumn(group.parentName); + csvStream.WriteColumn(std::to_string(group.id)); csvStream.NextRow(); } } @@ -100,7 +119,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, CURVE_HEADERS, 17); + WriteFileHeader(csvStream, CURVE_HEADERS, 18); for (auto i = 0u; i < count; i++) { @@ -113,6 +132,8 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(curve.points[j].y)); } + csvStream.WriteColumn(std::to_string(curve.id)); + csvStream.NextRow(); } } @@ -125,7 +146,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, PAN_HEADERS, 7); + WriteFileHeader(csvStream, PAN_HEADERS, 8); for (auto i = 0u; i < count; i++) { @@ -137,6 +158,7 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(pan.lfe)); csvStream.WriteColumn(std::to_string(pan.left)); csvStream.WriteColumn(std::to_string(pan.right)); + csvStream.WriteColumn(std::to_string(pan.id)); csvStream.NextRow(); } } @@ -156,6 +178,7 @@ class AssetDumperSndDriverGlobals::Internal { const auto& duckGroup = duckGroups[i]; csvStream.WriteColumn(duckGroup.name); + csvStream.WriteColumn(std::to_string(duckGroup.id)); csvStream.NextRow(); } } @@ -168,7 +191,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, MASTER_HEADERS, 52); + WriteFileHeader(csvStream, MASTER_HEADERS, 53); for (auto i = 0u; i < count; i++) { @@ -225,6 +248,7 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(master.hdrfxCompE)); csvStream.WriteColumn(std::to_string(master.voiceEqE)); csvStream.WriteColumn(std::to_string(master.voiceCompE)); + csvStream.WriteColumn(std::to_string(master.id)); csvStream.NextRow(); } } @@ -237,7 +261,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 7); + WriteFileHeader(csvStream, SIDECHAIN_HEADERS, 8); for (auto i = 0u; i < count; i++) { @@ -249,6 +273,7 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(sidechain.ta)); csvStream.WriteColumn(std::to_string(sidechain.tr)); csvStream.WriteColumn(std::to_string(sidechain.tf)); + csvStream.WriteColumn(std::to_string(sidechain.id)); csvStream.NextRow(); } } @@ -261,7 +286,7 @@ class AssetDumperSndDriverGlobals::Internal if (outputFile != nullptr) { CsvOutputStream csvStream(*outputFile); - WriteFileHeader(csvStream, FUTZ_HEADERS, 17); + WriteFileHeader(csvStream, FUTZ_HEADERS, 18); for (auto i = 0u; i < count; i++) { @@ -283,6 +308,7 @@ class AssetDumperSndDriverGlobals::Internal csvStream.WriteColumn(std::to_string(futz.startAliasId)); csvStream.WriteColumn(std::to_string(futz.stopAliasId)); csvStream.WriteColumn(std::to_string(futz.loopAliasId)); + csvStream.WriteColumn(std::to_string(futz.id)); csvStream.NextRow(); } } From 2df26888e719b66165aeea6ad2718dbe656218be Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Dec 2023 01:04:09 -0500 Subject: [PATCH 12/15] volum groups globals file directory --- .../Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp index b330b8345..768c84b90 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -91,7 +91,7 @@ class AssetDumperSndDriverGlobals::Internal void DumpSndVolumesGroups(const SndVolumeGroup* groups, const size_t count) { - const auto outputFile = this->OpenAssetFile("soundaliases\\globals\\group.csv"); + const auto outputFile = this->OpenAssetFile("soundbank\\globals\\group.csv"); if (outputFile != nullptr) { From b5ea3eedfefe9f8601f13eb91c1c89df612e2aa3 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Dec 2023 22:30:46 -0500 Subject: [PATCH 13/15] finish SndBank dumping and format --- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 340 ++++++++++-------- .../AssetDumperSndDriverGlobals.cpp | 84 ++--- .../AssetDumperSndDriverGlobals.h | 2 +- 3 files changed, 233 insertions(+), 193 deletions(-) diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 1a555096d..feb83783a 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -4,6 +4,7 @@ #include "ObjContainer/SoundBank/SoundBank.h" #include "Sound/WavWriter.h" #include "Utils/ClassUtils.h" +#include "nlohmann/json.hpp" #include #include @@ -80,29 +81,23 @@ namespace "snapshot", }; - const std::string REVERB_HEADERS[]{ - "name", - "smoothing", - "earlyTime", - "lateTime", - "earlyGain", - "lateGain", - "returnGain", - "earlyLpf", - "lateLpf", - "inputLpf", - "dampLpf", - "wallReflect", - "dryGain", - "earlySize", - "lateSize", - "diffusion", - "returnHighpass" - }; - - const std::string DUCK_HEADERS[]{ - "name", "fadeIn", "fadeOut", "startDelay", "distance", "length", "fadeInCurve", "fadeOutCurve", "attenuation", "filter", "updateWhilePaused" - }; + const std::string REVERB_HEADERS[]{"name", + "smoothing", + "earlyTime", + "lateTime", + "earlyGain", + "lateGain", + "returnGain", + "earlyLpf", + "lateLpf", + "inputLpf", + "dampLpf", + "wallReflect", + "dryGain", + "earlySize", + "lateSize", + "diffusion", + "returnHighpass"}; const std::string PREFIXES_TO_DROP[]{ "raw/", @@ -121,67 +116,119 @@ namespace 192000, }; - const std::string GROUPS_ENUM[] - { - "grp_reference", "grp_master", "grp_wpn_lfe", "grp_lfe", "grp_hdrfx", "grp_music", "grp_voice", "grp_set_piece", "grp_igc", - "grp_mp_game", "grp_explosion", "grp_player_impacts", "grp_scripted_moment", "grp_menu", "grp_whizby", "grp_weapon", "grp_vehicle", - "grp_impacts", "grp_foley", "grp_destructible", "grp_physics", "grp_ambience", "grp_alerts", "grp_air", "grp_bink", "grp_announcer", - "" + const std::string GROUPS_ENUM[]{"grp_reference", + "grp_master", + "grp_wpn_lfe", + "grp_lfe", + "grp_hdrfx", + "grp_music", + "grp_voice", + "grp_set_piece", + "grp_igc", + "grp_mp_game", + "grp_explosion", + "grp_player_impacts", + "grp_scripted_moment", + "grp_menu", + "grp_whizby", + "grp_weapon", + "grp_vehicle", + "grp_impacts", + "grp_foley", + "grp_destructible", + "grp_physics", + "grp_ambience", + "grp_alerts", + "grp_air", + "grp_bink", + "grp_announcer", + ""}; + + const std::string CURVES_ENUM[]{"default", + "defaultmin", + "allon", + "alloff", + "rcurve0", + "rcurve1", + "rcurve2", + "rcurve3", + "rcurve4", + "rcurve5", + "steep", + "sindelay", + "cosdelay", + "sin", + "cos", + "rev60", + "rev65", + ""}; + + const std::unordered_map CURVES_MAP{ + {4135636924, CURVES_ENUM[0] }, // "default" + {1298231670, CURVES_ENUM[1] }, // "defaultmin" + {2783299419, CURVES_ENUM[2] }, // "allon" + {2598309331, CURVES_ENUM[3] }, // "alloff" + {2462421902, CURVES_ENUM[4] }, // "rcurve0" + {2462421903, CURVES_ENUM[5] }, // "rcurve1" + {2462421904, CURVES_ENUM[6] }, // "rcurve2" + {2462421905, CURVES_ENUM[7] }, // "rcurve3" + {2462421906, CURVES_ENUM[8] }, // "rcurve4" + {2462421907, CURVES_ENUM[9] }, // "rcurve5" + {3711863914, CURVES_ENUM[10]}, // "steep" + {4107033168, CURVES_ENUM[11]}, // "sindelay" + {932232097, CURVES_ENUM[12]}, // "cosdelay" + {818663411, CURVES_ENUM[13]}, // "sin" + {686872930, CURVES_ENUM[14]}, // "cos" + {3885755896, CURVES_ENUM[15]}, // "rev60" + {3885755901, CURVES_ENUM[16]}, // "rev65" }; - const std::string CURVES_ENUM[] - { - "default", "defaultmin", "allon", "alloff", "rcurve0", "rcurve1", "rcurve2", "rcurve3", "rcurve4", "rcurve5", "steep", - "sindelay", "cosdelay", "sin", "cos", "rev60", "rev65", - "" + const std::string DUCK_GROUPS_ENUM[]{ + "snp_alerts_gameplay", + "snp_ambience", + "snp_claw", + "snp_destructible", + "snp_dying", + "snp_dying_ice", + "snp_evt_2d", + "snp_explosion", + "snp_foley", + "snp_grenade", + "snp_hdrfx", + "snp_igc", + "snp_impacts", + "snp_menu", + "snp_movie", + "snp_music", + "snp_never_duck", + "snp_player_dead", + "snp_player_impacts", + "snp_scripted_moment", + "snp_set_piece", + "snp_special", + "snp_vehicle", + "snp_vehicle_interior", + "snp_voice", + "snp_weapon_decay_1p", + "snp_whizby", + "snp_wpn_1p", + "snp_wpn_3p", + "snp_wpn_turret", + "snp_x2", + "snp_x3", }; - const std::unordered_map CURVES_MAP - { - { 4135636924, CURVES_ENUM[0]}, // "default" - { 1298231670, CURVES_ENUM[1] }, // "defaultmin" - { 2783299419, CURVES_ENUM[2] }, // "allon" - { 2598309331, CURVES_ENUM[3] }, // "alloff" - { 2462421902, CURVES_ENUM[4] }, // "rcurve0" - { 2462421903, CURVES_ENUM[5] }, // "rcurve1" - { 2462421904, CURVES_ENUM[6] }, // "rcurve2" - { 2462421905, CURVES_ENUM[7] }, // "rcurve3" - { 2462421906, CURVES_ENUM[8] }, // "rcurve4" - { 2462421907, CURVES_ENUM[9] }, // "rcurve5" - { 3711863914, CURVES_ENUM[10]}, // "steep" - { 4107033168, CURVES_ENUM[11]}, // "sindelay" - { 932232097, CURVES_ENUM[12]}, // "cosdelay" - { 818663411, CURVES_ENUM[13]}, // "sin" - { 686872930, CURVES_ENUM[14]}, // "cos" - { 3885755896, CURVES_ENUM[15]}, // "rev60" - { 3885755901, CURVES_ENUM[16]}, // "rev65" - }; + const std::string LOOP_TYPES_ENUM[]{"nonlooping", "looping"}; - const std::string LOOP_TYPES_ENUM[] - { - "nonlooping", "looping" - }; + const std::string LIMIT_TYPES_ENUM[]{"none", "oldest", "reject", "priority"}; - const std::string LIMIT_TYPES_ENUM[] - { - "none", "oldest", "reject", "priority" - }; + const std::string MOVE_TYPES_ENUM[]{"none", "left_player", "center_player", "right_player", "random", "left_shot", "center_shot", "right_shot"}; - const std::string MOVE_TYPES_ENUM[] - { - "none", "left_player", "center_player", "right_player", "random", "left_shot", "center_shot", "right_shot" - }; + const std::string LOAD_TYPES_ENUM[]{"unknown", "loaded", "streamed", "primed"}; - const std::string LOAD_TYPES_ENUM[] - { - "unknown", "loaded", "streamed", "primed" - }; - - const std::string BUS_IDS_ENUM[] - { - "bus_reverb", "bus_fx", "bus_voice", "bus_pfutz", "bus_hdrfx", "bus_ui", "bus_reference", "bus_music", "bus_movie", "bus_reference", "" - }; -} + const std::string BUS_IDS_ENUM[]{ + "bus_reverb", "bus_fx", "bus_voice", "bus_pfutz", "bus_hdrfx", "bus_ui", "bus_reference", "bus_music", "bus_movie", "bus_reference", ""}; +} // namespace class AssetDumperSndBank::Internal { @@ -275,7 +322,7 @@ class AssetDumperSndBank::Internal stream.WriteColumn(""); // secondary - //stream.WriteColumn(alias->secondaryname); + stream.WriteColumn((alias->secondaryname && *alias->secondaryname) ? alias->secondaryname : ""); // group stream.WriteColumn(GROUPS_ENUM[std::min((alias->flags0 >> 17) & 0x1F, 26u)]); @@ -324,7 +371,7 @@ class AssetDumperSndBank::Internal // pitch_min stream.WriteColumn(std::to_string(alias->pitchMin)); - + // pitch_max stream.WriteColumn(std::to_string(alias->pitchMax)); @@ -363,7 +410,7 @@ class AssetDumperSndBank::Internal // reverb_send", stream.WriteColumn(std::to_string(alias->reverbSend)); - + // duck", stream.WriteColumn(FindNameForDuck(alias->duck, bank->ducks, bank->duckCount)); @@ -404,7 +451,7 @@ class AssetDumperSndBank::Internal stream.WriteColumn(""); // subtitle", - //stream.WriteColumn(alias->subtitle); + stream.WriteColumn((alias->subtitle && *alias->subtitle) ? alias->subtitle : ""); // mature", stream.WriteColumn(""); @@ -416,10 +463,10 @@ class AssetDumperSndBank::Internal stream.WriteColumn(""); // context_type", - stream.WriteColumn("hash_" + std::to_string(alias->contextType)); + stream.WriteColumn(std::to_string(alias->contextType)); // context_value", - stream.WriteColumn("hash_" + std::to_string(alias->contextValue)); + stream.WriteColumn(std::to_string(alias->contextValue)); // compression", stream.WriteColumn(""); @@ -452,34 +499,6 @@ class AssetDumperSndBank::Internal stream.WriteColumn(""); } - void DumpSndBankAliases(const SndBank* sndBank) const - { - const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".aliases", ".csv"); - if (!outFile) - { - std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n"; - return; - } - - CsvOutputStream csvStream(*outFile); - WriteAliasFileHeader(csvStream); - - for (auto i = 0u; i < sndBank->aliasCount; i++) - { - const auto& aliasList = sndBank->alias[i]; - - for (auto j = 0; j < aliasList.count; j++) - { - const auto& alias = aliasList.head[j]; - if (alias.assetId && alias.assetFileName) - { - WriteAliasToFile(csvStream, &alias, sndBank); - csvStream.NextRow(); - } - } - } - } - static SoundBankEntryInputStream FindSoundDataInSoundBanks(const unsigned assetId) { for (const auto* soundBank : SoundBank::Repository) @@ -576,6 +595,39 @@ class AssetDumperSndBank::Internal } } + void DumpSndBankAliases(const SndBank* sndBank) const + { + std::unordered_set dumpedAssets; + + const auto outFile = OpenAssetOutputFile("soundbank\\" + std::string(sndBank->name) + ".aliases", ".csv"); + if (!outFile) + { + std::cerr << "Failed to open sound alias output file: \"" << sndBank->name << "\"\n"; + return; + } + + CsvOutputStream csvStream(*outFile); + WriteAliasFileHeader(csvStream); + + for (auto i = 0u; i < sndBank->aliasCount; i++) + { + const auto& aliasList = sndBank->alias[i]; + + for (auto j = 0; j < aliasList.count; j++) + { + const auto& alias = aliasList.head[j]; + if (alias.assetId && alias.assetFileName && dumpedAssets.find(alias.assetId) == dumpedAssets.end()) + { + DumpSndAlias(alias); + dumpedAssets.emplace(alias.assetId); + + WriteAliasToFile(csvStream, &alias, sndBank); + csvStream.NextRow(); + } + } + } + } + void DumpSoundRadverb(const SndBank* sndBank) const { if (sndBank->radverbCount <= 0) @@ -641,42 +693,47 @@ class AssetDumperSndBank::Internal csvStream.WriteColumn(duck.name); csvStream.NextRow(); - // dump duck file - //csvStream.WriteColumn(std::to_string(duck.fadeIn)); - //csvStream.WriteColumn(std::to_string(duck.fadeOut)); - //csvStream.WriteColumn(std::to_string(duck.startDelay)); - //csvStream.WriteColumn(std::to_string(duck.distance)); - //csvStream.WriteColumn(std::to_string(duck.length)); - - //auto fadeInItr = CURVES_MAP.find(duck.fadeInCurve); - //csvStream.WriteColumn(fadeInItr == CURVES_MAP.end() ? std::to_string(duck.fadeInCurve) : fadeInItr->second); - - //auto fadeOutItr = CURVES_MAP.find(duck.fadeOutCurve); - //csvStream.WriteColumn(fadeOutItr == CURVES_MAP.end() ? std::to_string(duck.fadeOutCurve) : fadeOutItr->second); - - //csvStream.WriteColumn(""); // attenuation - //csvStream.WriteColumn(""); // filter - //csvStream.WriteColumn(std::to_string(duck.updateWhilePaused)); - } - } + const auto duckFile = OpenAssetOutputFile("soundbank\\ducks\\" + std::string(duck.name), ".duk"); + if (!outFile) + { + std::cerr << "Failed to open sound duck output file: \"" << duck.name << "\"\n"; + return; + } - void DumpSoundData(const SndBank* sndBank) const - { - std::unordered_set dumpedAssets; + nlohmann::json duckObj{}; + duckObj["fadeIn"] = duck.fadeIn; + duckObj["fadeOut"] = duck.fadeOut; + duckObj["startDelay"] = duck.startDelay; + duckObj["distance"] = duck.distance; + duckObj["length"] = duck.length; + duckObj["fadeInCurveId"] = duck.fadeInCurve; + duckObj["fadeOutCurveId"] = duck.fadeOutCurve; + duckObj["updateWhilePaused"] = duck.updateWhilePaused; + + auto fadeInItr = CURVES_MAP.find(duck.fadeInCurve); + if (fadeInItr != CURVES_MAP.end()) + { + duckObj["fadeInCurve"] = fadeInItr->second; + } - for (auto i = 0u; i < sndBank->aliasCount; i++) - { - const auto& aliasList = sndBank->alias[i]; + auto fadeOutItr = CURVES_MAP.find(duck.fadeOutCurve); + if (fadeOutItr != CURVES_MAP.end()) + { + duckObj["fadeOutCurve"] = fadeOutItr->second; + } - for (auto j = 0; j < aliasList.count; j++) + auto values = std::vector{}; + for (auto i = 0u; i < 32u; i++) { - const auto& alias = aliasList.head[j]; - if (alias.assetId && alias.assetFileName && dumpedAssets.find(alias.assetId) == dumpedAssets.end()) - { - DumpSndAlias(alias); - dumpedAssets.emplace(alias.assetId); - } + values.push_back({ + {"duckGroup", DUCK_GROUPS_ENUM[i]}, + {"attenuation", duck.attenuation[i]}, + {"filter", duck.filter[i] } + }); } + + duckObj["values"] = values; + *duckFile << duckObj.dump(4) << std::endl; } } @@ -687,7 +744,6 @@ class AssetDumperSndBank::Internal DumpSndBankAliases(sndBank); DumpSoundRadverb(sndBank); DumpSoundDucks(sndBank); - DumpSoundData(sndBank); } public: diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp index 768c84b90..fee44dfed 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.cpp @@ -1,12 +1,12 @@ #include "AssetDumperSndDriverGlobals.h" -#include -#include -#include - -#include "Utils/ClassUtils.h" #include "Csv/CsvStream.h" #include "ObjContainer/SoundBank/SoundBank.h" +#include "Utils/ClassUtils.h" + +#include +#include +#include using namespace T6; namespace fs = std::filesystem; @@ -15,58 +15,42 @@ class AssetDumperSndDriverGlobals::Internal { AssetDumpingContext& m_context; - inline static const std::string GROUPS_HEADERS[] - {"name", "attenuationSp", "attenuationMp", "category", "parent", "id" - }; + inline static const std::string GROUPS_HEADERS[]{"name", "attenuationSp", "attenuationMp", "category", "parent", "id"}; - inline static const std::string GROUPS_CATEGORIES[] - {"sfx", "music", "void", "ui", "cinematic", "id" - }; + inline static const std::string GROUPS_CATEGORIES[]{"sfx", "music", "void", "ui", "cinematic", "id"}; - inline static const std::string CURVE_HEADERS[] - { - "name", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "x5", "y5", "x6", "y6", "x7", "y7", "id" - }; + inline static const std::string CURVE_HEADERS[]{ + "name", "x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "x5", "y5", "x6", "y6", "x7", "y7", "id"}; - inline static const std::string PAN_HEADERS[] - {"name", "front", "back", "center", "lfe", "left", "right","id" - }; + inline static const std::string PAN_HEADERS[]{"name", "front", "back", "center", "lfe", "left", "right", "id"}; - inline static const std::string MASTER_HEADERS[] - { + inline static const std::string MASTER_HEADERS[]{ "name", "lowE", "lowG", "lowF", "lowQ", "peak1E", "peak1G", "peak1F", "peak1Q", "peak2E", "peak2G", "peak2F", "peak2Q", "hiE", "hiG", "hiF", "hiQ", "eqG", "compE", "compPG", "compMG", "compT", "compR", "compTA", "compTR", "limitE", "limitPG", "limitMG", "limitT", "limitR", "limitTA", "limitTR", "busReverbG", "busFxG", "busVoiceG", "busPfutzG", "busHdrfxG", "busUiG", "busMusicG", "busMovieG", "busVcsG", "busReverbE", "busFxE", "busVoiceE", - "busPfutzE", "busHdrfxE", "busUiE", "busMusicE", "busMovieE", "hdrfxCompE", "voiceEqE", "voiceCompE", "id" - }; - - inline static const std::string SIDECHAIN_HEADERS[] - { - "name", "g", "f", "q", "ta", "tr", "tf", "id" - }; - - inline static const std::string FUTZ_HEADERS[] - { - "name", - "bpfF", - "bpfQ", - "lsG", - "lsF", - "lsQ", - "dist", - "preG", - "postG", - "th", - "tg", - "clippre", - "clippost", - "blend", - "startAliasId", - "stopAliasId", - "loopAliasId", - "id" - }; + "busPfutzE", "busHdrfxE", "busUiE", "busMusicE", "busMovieE", "hdrfxCompE", "voiceEqE", "voiceCompE", "id"}; + + inline static const std::string SIDECHAIN_HEADERS[]{"name", "g", "f", "q", "ta", "tr", "tf", "id"}; + + inline static const std::string FUTZ_HEADERS[]{"name", + "bpfF", + "bpfQ", + "lsG", + "lsF", + "lsQ", + "dist", + "preG", + "postG", + "th", + "tg", + "clippre", + "clippost", + "blend", + "startAliasId", + "stopAliasId", + "loopAliasId", + "id"}; std::unique_ptr OpenAssetFile(const std::string& filename) { @@ -322,7 +306,7 @@ class AssetDumperSndDriverGlobals::Internal DumpSndCurves(sndDriverGlobals->curves, sndDriverGlobals->curveCount); DumpSndPans(sndDriverGlobals->pans, sndDriverGlobals->panCount); DumpSndDuckGroups(sndDriverGlobals->duckGroups, sndDriverGlobals->duckGroupCount); - //DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount); + // DumpSndContexts(sndDriverGlobals->contexts, sndDriverGlobals->contextCount); DumpSndMasters(sndDriverGlobals->masters, sndDriverGlobals->masterCount); DumpSndSidechainDucks(sndDriverGlobals->voiceDucks, sndDriverGlobals->voiceDuckCount); DumpSndFutz(sndDriverGlobals->futzes, sndDriverGlobals->futzCount); diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h index dd6b18abc..18f0cf896 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndDriverGlobals.h @@ -12,4 +12,4 @@ namespace T6 public: void DumpPool(AssetDumpingContext& context, AssetPool* pool) override; }; -} +} // namespace T6 From 68fa269af22ada5d787ed286abacf39582ac00e5 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Dec 2023 22:36:32 -0500 Subject: [PATCH 14/15] Revert "add SndDriverGlobals dumping" This reverts commit 5e951bd1e14f65345c1db208662e97bd2da31b77. --- thirdparty/catch2 | 2 +- thirdparty/json | 2 +- thirdparty/zlib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/thirdparty/catch2 b/thirdparty/catch2 index caffe79a3..dacbf4fd6 160000 --- a/thirdparty/catch2 +++ b/thirdparty/catch2 @@ -1 +1 @@ -Subproject commit caffe79a3172495f6a4b09de88e81e9aa67b8323 +Subproject commit dacbf4fd6c80d726b3d87e77c91bcacdd4fc57c0 diff --git a/thirdparty/json b/thirdparty/json index 6eab7a2b1..3780b41dd 160000 --- a/thirdparty/json +++ b/thirdparty/json @@ -1 +1 @@ -Subproject commit 6eab7a2b187b10b2494e39c1961750bfd1bda500 +Subproject commit 3780b41dd070436f3f55327b0a88f27a52e2dfa8 diff --git a/thirdparty/zlib b/thirdparty/zlib index ac8f12c97..643e17b74 160000 --- a/thirdparty/zlib +++ b/thirdparty/zlib @@ -1 +1 @@ -Subproject commit ac8f12c97d1afd9bafa9c710f827d40a407d3266 +Subproject commit 643e17b7498d12ab8d15565662880579692f769d From 7a41fd2d1bf32c875e17ac31986d26962b21478c Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 11 Dec 2023 22:36:53 -0500 Subject: [PATCH 15/15] revert submodule changes --- thirdparty/catch2 | 2 +- thirdparty/json | 2 +- thirdparty/zlib | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/thirdparty/catch2 b/thirdparty/catch2 index dacbf4fd6..caffe79a3 160000 --- a/thirdparty/catch2 +++ b/thirdparty/catch2 @@ -1 +1 @@ -Subproject commit dacbf4fd6c80d726b3d87e77c91bcacdd4fc57c0 +Subproject commit caffe79a3172495f6a4b09de88e81e9aa67b8323 diff --git a/thirdparty/json b/thirdparty/json index 3780b41dd..6eab7a2b1 160000 --- a/thirdparty/json +++ b/thirdparty/json @@ -1 +1 @@ -Subproject commit 3780b41dd070436f3f55327b0a88f27a52e2dfa8 +Subproject commit 6eab7a2b187b10b2494e39c1961750bfd1bda500 diff --git a/thirdparty/zlib b/thirdparty/zlib index 643e17b74..ac8f12c97 160000 --- a/thirdparty/zlib +++ b/thirdparty/zlib @@ -1 +1 @@ -Subproject commit 643e17b7498d12ab8d15565662880579692f769d +Subproject commit ac8f12c97d1afd9bafa9c710f827d40a407d3266