1- using CATHODE . Scripting ;
1+ using CATHODE . Scripting ;
22using CathodeLib ;
33using System ;
44using System . Collections . Generic ;
@@ -13,26 +13,30 @@ namespace CATHODE
1313 /* DATA/ENV/PRODUCTION/x/WORLD/SOUNDLOADZONES.DAT */
1414 public class SoundLoadZones : CathodeFile
1515 {
16+ //This seems to specify all the sound banks that are loaded within the level. They can be specified via spatial zones, but this feature is never used.
17+
1618 public List < string > Entries = new List < string > ( ) ;
17- public static new Implementation Implementation = Implementation . NONE ;
19+ public static new Implementation Implementation = Implementation . CREATE | Implementation . LOAD | Implementation . SAVE ;
1820 public SoundLoadZones ( 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 += 4 ;
26- int entryCount = reader . ReadInt32 ( ) ;
27- reader . BaseStream . Position += 8 ;
28- for ( int i = 0 ; i < entryCount ; i ++ )
27+ reader . BaseStream . Position += 4 ; //version - zero
28+ int soundPackCount = reader . ReadInt32 ( ) ;
29+ reader . BaseStream . Position += 4 ; //count of zones - always zero (unused)
30+ for ( int i = 0 ; i < soundPackCount ; i ++ )
2931 {
30- byte [ ] content = reader . ReadBytes ( 68 ) ;
31- using ( BinaryReader contentReader = new BinaryReader ( new MemoryStream ( content ) ) )
32+ reader . BaseStream . Position += 4 ; //ref count - always zero (set at runtime?)
33+ byte [ ] bankName = reader . ReadBytes ( 64 ) ;
34+ using ( BinaryReader contentReader = new BinaryReader ( new MemoryStream ( bankName ) ) )
3235 {
3336 Entries . Add ( Utilities . ReadString ( contentReader ) ) ;
3437 }
3538 }
39+ //zones are here, but they're always unused, so can skip
3640 }
3741 return true ;
3842 }
@@ -44,14 +48,12 @@ override protected bool SaveInternal()
4448 writer . BaseStream . SetLength ( 0 ) ;
4549 writer . Write ( 0 ) ;
4650 writer . Write ( Entries . Count ) ;
47- writer . Write ( new byte [ 8 ] ) ;
51+ writer . Write ( 0 ) ;
4852 for ( int i = 0 ; i < Entries . Count ; i ++ )
4953 {
50- writer . Write ( new byte [ 68 ] ) ;
51- long resetPos = writer . BaseStream . Position ;
52- writer . BaseStream . Position -= 68 ;
54+ writer . Write ( 0 ) ;
5355 Utilities . WriteString ( Entries [ i ] , writer ) ;
54- writer . BaseStream . Position = resetPos ;
56+ writer . Write ( new byte [ 64 - Entries [ i ] . Length ] ) ;
5557 }
5658 }
5759 return true ;
0 commit comments