@@ -13,25 +13,37 @@ namespace CATHODE
1313 /* DATA/ENV/PRODUCTION/x/WORLD/SOUNDDIALOGUELOOKUPS.DAT */
1414 public class SoundDialogueLookups : CathodeFile
1515 {
16- public List < Sound > Entries = new List < Sound > ( ) ;
17- public static new Implementation Implementation = Implementation . LOAD ;
16+ //This stores the associated sound and animation hashes for soundbank entries
17+
18+ public List < Soundbank > Entries = new List < Soundbank > ( ) ;
19+ public static new Implementation Implementation = Implementation . LOAD | Implementation . SAVE | Implementation . CREATE ;
1820 public SoundDialogueLookups ( string path ) : base ( path ) { }
1921
2022 #region FILE_IO
2123 override protected bool LoadInternal ( )
2224 {
2325 using ( BinaryReader reader = new BinaryReader ( File . OpenRead ( _filepath ) ) )
2426 {
25- reader . BaseStream . Position += 16 ; //All unknowns
26- int entryCount = ( ( int ) reader . BaseStream . Length / 8 ) - 2 ; //We can probably work this out from the previous unknowns
27- for ( int i = 0 ; i < entryCount ; i ++ )
27+ reader . BaseStream . Position += 4 ; //version
28+ int soundbankCount = reader . ReadInt32 ( ) ;
29+ for ( int i = 0 ; i < soundbankCount ; i ++ )
2830 {
29- Sound s = new Sound ( ) ;
30- s . id = reader . ReadUInt32 ( ) ;
31- s . unk = Utilities . Consume < ShortGuid > ( reader ) ;
32- Entries . Add ( s ) ;
31+ Soundbank bank = new Soundbank ( )
32+ {
33+ id = reader . ReadUInt32 ( )
34+ } ;
35+ int hashCount = reader . ReadInt32 ( ) ;
36+ for ( int x = 0 ; x < hashCount ; x ++ )
37+ {
38+ Soundbank . ResourceHashes hashes = new Soundbank . ResourceHashes ( )
39+ {
40+ SoundHash = reader . ReadUInt32 ( ) ,
41+ AnimationHash = reader . ReadUInt32 ( ) ,
42+ } ;
43+ bank . hashes . Add ( hashes ) ;
44+ }
45+ Entries . Add ( bank ) ;
3346 }
34-
3547 }
3648 return true ;
3749 }
@@ -41,26 +53,32 @@ override protected bool SaveInternal()
4153 using ( BinaryWriter writer = new BinaryWriter ( File . OpenWrite ( _filepath ) ) )
4254 {
4355 writer . BaseStream . SetLength ( 0 ) ;
44- writer . Write ( new byte [ 16 ] ) ;
45- for ( int i = 0 ; i < Entries . Count ; i ++ )
56+ writer . Write ( 1 ) ;
57+ writer . Write ( Entries . Count ) ;
58+ foreach ( Soundbank soundbank in Entries )
4659 {
47- writer . Write ( Entries [ i ] . id ) ;
48- Utilities . Write < ShortGuid > ( writer , Entries [ i ] . unk ) ;
60+ writer . Write ( soundbank . id ) ;
61+ writer . Write ( soundbank . hashes . Count ) ;
62+ foreach ( Soundbank . ResourceHashes hashes in soundbank . hashes )
63+ {
64+ writer . Write ( hashes . SoundHash ) ;
65+ writer . Write ( hashes . AnimationHash ) ;
66+ }
4967 }
5068 }
5169 return true ;
5270 }
5371 #endregion
5472
5573 #region STRUCTURES
56- public class Sound
74+ public class Soundbank
5775 {
58- public uint id ;
59- public ShortGuid unk ;
60-
61- override public string ToString ( )
76+ public uint id ; //This is the hashed soundbank string name (hashed via Utilities.SoundHashedString)
77+ public List < ResourceHashes > hashes = new List < ResourceHashes > ( ) ;
78+ public class ResourceHashes
6279 {
63- return SoundUtils . GetSoundName ( id ) ;
80+ public uint SoundHash ; //Generated from the wav filename
81+ public uint AnimationHash ; //Can be looked up using animation string table
6482 }
6583 } ;
6684 #endregion
0 commit comments