mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
fix snd bank alias flags
This commit is contained in:
parent
53a3c71847
commit
b7355f9870
@ -12,6 +12,26 @@ namespace T6
|
|||||||
static int Com_HashString(const char* str, int len);
|
static int Com_HashString(const char* str, int len);
|
||||||
static uint32_t R_HashString(const char* str, uint32_t hash);
|
static uint32_t R_HashString(const char* str, uint32_t hash);
|
||||||
|
|
||||||
|
static constexpr uint32_t SND_HashName(const char* str)
|
||||||
|
{
|
||||||
|
if (!str || !*str)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto result = 0x1505;
|
||||||
|
auto offset = 0u;
|
||||||
|
|
||||||
|
while (str[offset])
|
||||||
|
{
|
||||||
|
const auto c = tolower(str[offset++]);
|
||||||
|
result = c + 33 * result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
|
static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
|
||||||
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
|
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
|
||||||
static GfxColor Vec4PackGfxColor(const vec4_t* in);
|
static GfxColor Vec4PackGfxColor(const vec4_t* in);
|
||||||
|
@ -5578,13 +5578,57 @@ namespace T6
|
|||||||
MaterialArgumentDef u;
|
MaterialArgumentDef u;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SndAliasType
|
enum SndAliasLoopType
|
||||||
{
|
{
|
||||||
SAT_UNKNOWN = 0x0,
|
SA_NON_LOOPING = 0x0,
|
||||||
SAT_LOADED = 0x1,
|
SA_LOOPING = 0x1,
|
||||||
SAT_STREAMED = 0x2,
|
};
|
||||||
SAT_PRIMED = 0x3,
|
|
||||||
SAT_COUNT = 0x4,
|
enum SndAliasPanType
|
||||||
|
{
|
||||||
|
SA_PAN_2D = 0x0,
|
||||||
|
SA_PAN_3D = 0x1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SndAliasLoadType
|
||||||
|
{
|
||||||
|
SA_UNKNOWN = 0x0,
|
||||||
|
SA_LOADED = 0x1,
|
||||||
|
SA_STREAMED = 0x2,
|
||||||
|
SA_PRIMED = 0x3,
|
||||||
|
SA_COUNT = 0x4,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SndAliasFlags
|
||||||
|
{
|
||||||
|
// flags0
|
||||||
|
SndAliasLoopType looping : 1; // 0
|
||||||
|
SndAliasPanType panType : 1; // 1
|
||||||
|
unsigned int distanceLpf : 1; // 2
|
||||||
|
unsigned int doppler : 1; // 3
|
||||||
|
unsigned int isBig : 1; // 4
|
||||||
|
unsigned int pauseable : 1; // 5
|
||||||
|
unsigned int isMusic : 1; // 6
|
||||||
|
unsigned int stopOnDeath : 1; // 7
|
||||||
|
unsigned int timescale : 1; // 8
|
||||||
|
unsigned int voiceLimit : 1; // 9
|
||||||
|
unsigned int ignoreMaxDist : 1; // 10
|
||||||
|
unsigned int busType : 4; // 11-14
|
||||||
|
SndAliasLoadType loadType : 2; // 15-16
|
||||||
|
unsigned int volumeGroup : 5; // 17-21
|
||||||
|
unsigned int fluxType : 3; // 22-24
|
||||||
|
unsigned int limitType : 2; // 25-26
|
||||||
|
unsigned int entityLimitType : 2; // 27-28
|
||||||
|
unsigned int randomizeType : 3; // 29-31
|
||||||
|
|
||||||
|
// flags1
|
||||||
|
unsigned int neverPlayTwice : 1; // 0
|
||||||
|
unsigned int unknown1_0 : 1; // 1
|
||||||
|
unsigned int volumeFalloffCurve : 6; // 2-7
|
||||||
|
unsigned int reverbFalloffCurve : 6; // 8-13
|
||||||
|
unsigned int volumeMinFalloffCurve : 6; // 14-19
|
||||||
|
unsigned int reverbMinFalloffCurve : 6; // 20-25
|
||||||
|
unsigned int unknown1_1 : 6; // 26-31
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SndAlias
|
struct SndAlias
|
||||||
@ -5595,8 +5639,7 @@ namespace T6
|
|||||||
const char* secondaryname;
|
const char* secondaryname;
|
||||||
unsigned int assetId;
|
unsigned int assetId;
|
||||||
const char* assetFileName;
|
const char* assetFileName;
|
||||||
unsigned int flags0; // Bits 15/16 are SndAliasType
|
SndAliasFlags flags;
|
||||||
unsigned int flags1;
|
|
||||||
unsigned int duck;
|
unsigned int duck;
|
||||||
unsigned int contextType;
|
unsigned int contextType;
|
||||||
unsigned int contextValue;
|
unsigned int contextValue;
|
||||||
@ -5631,6 +5674,10 @@ namespace T6
|
|||||||
char duckGroup;
|
char duckGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __zonecodegenerator
|
||||||
|
static_assert(sizeof(SndAliasFlags) == 8);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct type_align(4) pathlink_s
|
struct type_align(4) pathlink_s
|
||||||
{
|
{
|
||||||
float fDist;
|
float fDist;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "AssetDumperSndBank.h"
|
#include "AssetDumperSndBank.h"
|
||||||
|
#include "Game/T6/CommonT6.h"
|
||||||
|
|
||||||
#include "Csv/CsvStream.h"
|
#include "Csv/CsvStream.h"
|
||||||
#include "ObjContainer/SoundBank/SoundBank.h"
|
#include "ObjContainer/SoundBank/SoundBank.h"
|
||||||
@ -169,23 +170,23 @@ namespace
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::unordered_map<unsigned int, std::string> CURVES_MAP{
|
const std::unordered_map<unsigned int, std::string> CURVES_MAP{
|
||||||
{4135636924, CURVES_ENUM[0] }, // "default"
|
{T6::Common::SND_HashName(CURVES_ENUM[0].data()), CURVES_ENUM[0]},
|
||||||
{1298231670, CURVES_ENUM[1] }, // "defaultmin"
|
{T6::Common::SND_HashName(CURVES_ENUM[1].data()), CURVES_ENUM[1]},
|
||||||
{2783299419, CURVES_ENUM[2] }, // "allon"
|
{T6::Common::SND_HashName(CURVES_ENUM[2].data()), CURVES_ENUM[2]},
|
||||||
{2598309331, CURVES_ENUM[3] }, // "alloff"
|
{T6::Common::SND_HashName(CURVES_ENUM[3].data()), CURVES_ENUM[3]},
|
||||||
{2462421902, CURVES_ENUM[4] }, // "rcurve0"
|
{T6::Common::SND_HashName(CURVES_ENUM[4].data()), CURVES_ENUM[4]},
|
||||||
{2462421903, CURVES_ENUM[5] }, // "rcurve1"
|
{T6::Common::SND_HashName(CURVES_ENUM[5].data()), CURVES_ENUM[5]},
|
||||||
{2462421904, CURVES_ENUM[6] }, // "rcurve2"
|
{T6::Common::SND_HashName(CURVES_ENUM[6].data()), CURVES_ENUM[6]},
|
||||||
{2462421905, CURVES_ENUM[7] }, // "rcurve3"
|
{T6::Common::SND_HashName(CURVES_ENUM[7].data()), CURVES_ENUM[7]},
|
||||||
{2462421906, CURVES_ENUM[8] }, // "rcurve4"
|
{T6::Common::SND_HashName(CURVES_ENUM[8].data()), CURVES_ENUM[8]},
|
||||||
{2462421907, CURVES_ENUM[9] }, // "rcurve5"
|
{T6::Common::SND_HashName(CURVES_ENUM[9].data()), CURVES_ENUM[9]},
|
||||||
{3711863914, CURVES_ENUM[10]}, // "steep"
|
{T6::Common::SND_HashName(CURVES_ENUM[10].data()), CURVES_ENUM[10]},
|
||||||
{4107033168, CURVES_ENUM[11]}, // "sindelay"
|
{T6::Common::SND_HashName(CURVES_ENUM[11].data()), CURVES_ENUM[11]},
|
||||||
{932232097, CURVES_ENUM[12]}, // "cosdelay"
|
{T6::Common::SND_HashName(CURVES_ENUM[12].data()), CURVES_ENUM[12]},
|
||||||
{818663411, CURVES_ENUM[13]}, // "sin"
|
{T6::Common::SND_HashName(CURVES_ENUM[13].data()), CURVES_ENUM[13]},
|
||||||
{686872930, CURVES_ENUM[14]}, // "cos"
|
{T6::Common::SND_HashName(CURVES_ENUM[14].data()), CURVES_ENUM[14]},
|
||||||
{3885755896, CURVES_ENUM[15]}, // "rev60"
|
{T6::Common::SND_HashName(CURVES_ENUM[15].data()), CURVES_ENUM[15]},
|
||||||
{3885755901, CURVES_ENUM[16]}, // "rev65"
|
{T6::Common::SND_HashName(CURVES_ENUM[16].data()), CURVES_ENUM[16]},
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string DUCK_GROUPS_ENUM[]{
|
const std::string DUCK_GROUPS_ENUM[]{
|
||||||
@ -261,6 +262,13 @@ namespace
|
|||||||
"bus_reference",
|
"bus_reference",
|
||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::string RANDOMIZE_TYPES_ENUM[]{
|
||||||
|
"volume",
|
||||||
|
"pitch",
|
||||||
|
"variant",
|
||||||
|
"",
|
||||||
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class AssetDumperSndBank::Internal
|
class AssetDumperSndBank::Internal
|
||||||
@ -327,13 +335,13 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.NextRow();
|
stream.NextRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* FindNameForDuck(unsigned int id, const SndDuck* ducks, unsigned int duckCount)
|
static const char* FindNameForDuck(unsigned int id, const SndBank* bank)
|
||||||
{
|
{
|
||||||
for (auto i = 0u; i < duckCount; i++)
|
for (auto i = 0u; i < bank->duckCount; i++)
|
||||||
{
|
{
|
||||||
if (id == ducks[i].id)
|
if (id == bank->ducks[i].id)
|
||||||
{
|
{
|
||||||
return ducks[i].name;
|
return bank->ducks[i].name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +366,7 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn((alias->secondaryname && *alias->secondaryname) ? alias->secondaryname : "");
|
stream.WriteColumn((alias->secondaryname && *alias->secondaryname) ? alias->secondaryname : "");
|
||||||
|
|
||||||
// group
|
// group
|
||||||
stream.WriteColumn(GROUPS_ENUM[std::min((alias->flags0 >> 17) & 0x1F, 26u)]);
|
stream.WriteColumn(GROUPS_ENUM[alias->flags.volumeGroup]);
|
||||||
|
|
||||||
// vol_min
|
// vol_min
|
||||||
stream.WriteColumn(std::to_string(alias->volMin));
|
stream.WriteColumn(std::to_string(alias->volMin));
|
||||||
@ -379,28 +387,28 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn(std::to_string(alias->distReverbMax));
|
stream.WriteColumn(std::to_string(alias->distReverbMax));
|
||||||
|
|
||||||
// volume_falloff_curve
|
// volume_falloff_curve
|
||||||
stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 14) & 0x1F, 17u)]);
|
stream.WriteColumn(CURVES_ENUM[alias->flags.volumeFalloffCurve]);
|
||||||
|
|
||||||
// reverb_falloff_curve
|
// reverb_falloff_curve
|
||||||
stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 20) & 0x1F, 17u)]);
|
stream.WriteColumn(CURVES_ENUM[alias->flags.reverbFalloffCurve]);
|
||||||
|
|
||||||
// volume_min_falloff_curve
|
// volume_min_falloff_curve
|
||||||
stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 2) & 0x1F, 17u)]);
|
stream.WriteColumn(CURVES_ENUM[alias->flags.volumeMinFalloffCurve]);
|
||||||
|
|
||||||
// reverb_min_falloff_curve"
|
// reverb_min_falloff_curve"
|
||||||
stream.WriteColumn(CURVES_ENUM[std::min((alias->flags1 >> 8) & 0x1F, 17u)]);
|
stream.WriteColumn(CURVES_ENUM[alias->flags.reverbMinFalloffCurve]);
|
||||||
|
|
||||||
// limit_count
|
// limit_count
|
||||||
stream.WriteColumn(std::to_string(alias->limitCount));
|
stream.WriteColumn(std::to_string(alias->limitCount));
|
||||||
|
|
||||||
// limit_type
|
// limit_type
|
||||||
stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 25) & 0x3]);
|
stream.WriteColumn(LIMIT_TYPES_ENUM[alias->flags.limitType]);
|
||||||
|
|
||||||
// entity_limit_count
|
// entity_limit_count
|
||||||
stream.WriteColumn(std::to_string(alias->entityLimitCount));
|
stream.WriteColumn(std::to_string(alias->entityLimitCount));
|
||||||
|
|
||||||
// entity_limit_type
|
// entity_limit_type
|
||||||
stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 27) & 0x3]);
|
stream.WriteColumn(LIMIT_TYPES_ENUM[alias->flags.entityLimitType]);
|
||||||
|
|
||||||
// pitch_min
|
// pitch_min
|
||||||
stream.WriteColumn(std::to_string(alias->pitchMin));
|
stream.WriteColumn(std::to_string(alias->pitchMin));
|
||||||
@ -430,10 +438,10 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn(std::to_string(alias->contextType));
|
stream.WriteColumn(std::to_string(alias->contextType));
|
||||||
|
|
||||||
// loop
|
// loop
|
||||||
stream.WriteColumn((alias->flags0 & 0x1) == 0 ? "nonlooping" : "looping");
|
stream.WriteColumn(alias->flags.looping == T6::SA_NON_LOOPING ? "nonlooping" : "looping");
|
||||||
|
|
||||||
// randomize_type
|
// randomize_type
|
||||||
stream.WriteColumn(LIMIT_TYPES_ENUM[(alias->flags0 >> 15) & 0x3]);
|
stream.WriteColumn(RANDOMIZE_TYPES_ENUM[alias->flags.randomizeType]);
|
||||||
|
|
||||||
// probability",
|
// probability",
|
||||||
stream.WriteColumn(std::to_string(alias->probability));
|
stream.WriteColumn(std::to_string(alias->probability));
|
||||||
@ -445,10 +453,10 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn(std::to_string(alias->reverbSend));
|
stream.WriteColumn(std::to_string(alias->reverbSend));
|
||||||
|
|
||||||
// duck",
|
// duck",
|
||||||
stream.WriteColumn(FindNameForDuck(alias->duck, bank->ducks, bank->duckCount));
|
stream.WriteColumn(FindNameForDuck(alias->duck, bank));
|
||||||
|
|
||||||
// pan",
|
// pan",
|
||||||
stream.WriteColumn(((alias->flags0 >> 6) & 0x1) == 0 ? "2d" : "3d");
|
stream.WriteColumn(alias->flags.panType == SA_PAN_2D ? "2d" : "3d");
|
||||||
|
|
||||||
// center_send",
|
// center_send",
|
||||||
stream.WriteColumn(std::to_string(alias->centerSend));
|
stream.WriteColumn(std::to_string(alias->centerSend));
|
||||||
@ -469,13 +477,13 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn("");
|
stream.WriteColumn("");
|
||||||
|
|
||||||
// is_big",
|
// is_big",
|
||||||
stream.WriteColumn(((alias->flags0 >> 4) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.isBig ? "yes" : "no");
|
||||||
|
|
||||||
// distance_lpf"
|
// distance_lpf"
|
||||||
stream.WriteColumn(((alias->flags0 >> 2) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.distanceLpf ? "yes" : "no");
|
||||||
|
|
||||||
// move_type",
|
// move_type",
|
||||||
stream.WriteColumn(MOVE_TYPES_ENUM[std::min((alias->flags0 >> 22) & 0x7, 7u)]);
|
stream.WriteColumn(MOVE_TYPES_ENUM[alias->flags.fluxType]);
|
||||||
|
|
||||||
// move_time",
|
// move_time",
|
||||||
stream.WriteColumn(std::to_string(alias->fluxTime));
|
stream.WriteColumn(std::to_string(alias->fluxTime));
|
||||||
@ -490,7 +498,7 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn("");
|
stream.WriteColumn("");
|
||||||
|
|
||||||
// doppler",
|
// doppler",
|
||||||
stream.WriteColumn(((alias->flags0 >> 1) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.doppler ? "yes" : "no");
|
||||||
|
|
||||||
// futz",
|
// futz",
|
||||||
stream.WriteColumn(std::to_string(alias->futzPatch));
|
stream.WriteColumn(std::to_string(alias->futzPatch));
|
||||||
@ -505,10 +513,10 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn("");
|
stream.WriteColumn("");
|
||||||
|
|
||||||
// timescale",
|
// timescale",
|
||||||
stream.WriteColumn(((alias->flags0 >> 8) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.timescale ? "yes" : "no");
|
||||||
|
|
||||||
// music",
|
// music",
|
||||||
stream.WriteColumn(((alias->flags0 >> 10) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.isMusic ? "yes" : "no");
|
||||||
|
|
||||||
// fade_in",
|
// fade_in",
|
||||||
stream.WriteColumn(std::to_string(alias->fadeIn));
|
stream.WriteColumn(std::to_string(alias->fadeIn));
|
||||||
@ -520,13 +528,13 @@ class AssetDumperSndBank::Internal
|
|||||||
stream.WriteColumn("");
|
stream.WriteColumn("");
|
||||||
|
|
||||||
// pause",
|
// pause",
|
||||||
stream.WriteColumn(((alias->flags0 >> 5) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.pauseable ? "yes" : "no");
|
||||||
|
|
||||||
// stop_on_death",
|
// stop_on_death",
|
||||||
stream.WriteColumn(((alias->flags0 >> 7) & 0x1) == 0 ? "no" : "yes");
|
stream.WriteColumn(alias->flags.stopOnDeath ? "yes" : "no");
|
||||||
|
|
||||||
// bus",
|
// bus",
|
||||||
stream.WriteColumn(BUS_IDS_ENUM[std::min((alias->flags0 >> 13) & 0xF, 10u)]);
|
stream.WriteColumn(BUS_IDS_ENUM[alias->flags.busType]);
|
||||||
|
|
||||||
// snapshot",
|
// snapshot",
|
||||||
stream.WriteColumn("");
|
stream.WriteColumn("");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user