@@ -45,7 +45,7 @@ public IG1Dat LoadG1(string filename)
45
45
return new G1Dat ( g1Header , imageTable ) ;
46
46
}
47
47
48
- public void LoadFullExperimental ( string filename )
48
+ public static LocoMemoryObject LoadFullExperimental ( string filename )
49
49
{
50
50
var fullData = LoadBytesFromFile ( filename ) ;
51
51
var locoMemoryObject = new LocoMemoryObject ( ) ;
@@ -58,8 +58,9 @@ public void LoadFullExperimental(string filename)
58
58
fullData [ ( S5Header . StructLength + ObjectHeader . StructLength ) ..] ) ;
59
59
60
60
var fixedDataLength = ObjectTypeFixedSize . GetSize ( locoMemoryObject . SHeader . ObjectType ) ;
61
+ locoMemoryObject . BytesFixedData = new byte [ fixedDataLength ] ;
61
62
remainingData [ 0 ..fixedDataLength ] . CopyTo ( locoMemoryObject . BytesFixedData , 0 ) ;
62
-
63
+
63
64
remainingData = remainingData [ fixedDataLength ..] ;
64
65
65
66
var locoStruct = locoMemoryObject . FixedData ;
@@ -78,19 +79,20 @@ public void LoadFullExperimental(string filename)
78
79
{
79
80
remainingData = locoStructExtra . Load ( remainingData ) . ToArray ( ) ;
80
81
}
81
-
82
+
82
83
// some objects have graphics data
83
84
var ( g1Header , imageTable , imageTableBytesRead ) = LoadImageTable ( remainingData ) ;
84
- Verify . AreEqual ( imageTableBytesRead , remainingData . Length ) ;
85
85
86
86
// no more data
87
+ //Verify.AreEqual(imageTableBytesRead, remainingData.Length);
87
88
89
+ return locoMemoryObject ;
88
90
}
89
91
90
92
// load file
91
93
public ILocoObject LoadFull ( string filename , bool loadExtra = true )
92
94
{
93
- LoadFullExperimental ( filename ) ;
95
+ // LoadFullExperimental(filename);
94
96
95
97
ReadOnlySpan < byte > fullData = LoadBytesFromFile ( filename ) ;
96
98
@@ -151,7 +153,7 @@ public ILocoObject LoadFull(string filename, bool loadExtra = true)
151
153
return newObj ;
152
154
}
153
155
154
- ( StringTable table , int bytesRead ) LoadStringTable ( ReadOnlySpan < byte > data , ILocoStruct locoStruct )
156
+ static ( StringTable table , int bytesRead ) LoadStringTable ( ReadOnlySpan < byte > data , ILocoStruct locoStruct )
155
157
{
156
158
var stringAttr = locoStruct . GetType ( ) . GetCustomAttribute ( typeof ( LocoStringCountAttribute ) , inherit : false ) as LocoStringCountAttribute ;
157
159
var stringsInTable = stringAttr ? . Count ?? 1 ;
@@ -177,7 +179,7 @@ public ILocoObject LoadFull(string filename, bool loadExtra = true)
177
179
178
180
if ( strings . ContainsKey ( ( i , lang ) ) )
179
181
{
180
- Logger . Error ( $ "Key { ( i , lang ) } already exists (this shouldn't happen)") ;
182
+ // Logger.Error($"Key {(i, lang)} already exists (this shouldn't happen)");
181
183
break ;
182
184
}
183
185
else
0 commit comments