@@ -47,21 +47,11 @@ public class Mtrl
47
47
{
48
48
private const string MtrlExtension = ".mtrl" ;
49
49
private readonly DirectoryInfo _gameDirectory ;
50
- private readonly XivLanguage _language ;
51
- private XivDataFile _dataFile ;
52
50
private static SemaphoreSlim _semaphoreSlim = new SemaphoreSlim ( 1 , 1 ) ;
53
51
54
- public Mtrl ( DirectoryInfo gameDirectory , XivDataFile dataFile , XivLanguage lang )
52
+ public Mtrl ( DirectoryInfo gameDirectory )
55
53
{
56
54
_gameDirectory = gameDirectory ;
57
- _language = lang ;
58
- DataFile = dataFile ;
59
- }
60
-
61
- public XivDataFile DataFile
62
- {
63
- get => _dataFile ;
64
- set => _dataFile = value ;
65
55
}
66
56
67
57
@@ -405,13 +395,10 @@ public async Task<XivMtrl> GetMtrlData(long mtrlOffset, string mtrlPath, int dxV
405
395
var index = new Index ( _gameDirectory ) ;
406
396
407
397
// Get uncompressed mtrl data
408
- var mtrlData = await dat . GetType2Data ( mtrlOffset , DataFile ) ;
398
+ var df = IOUtil . GetDataFileFromPath ( mtrlPath ) ;
399
+ var mtrlData = await dat . GetType2Data ( mtrlOffset , df ) ;
409
400
410
401
XivMtrl xivMtrl = null ;
411
-
412
- // Why is there a semaphore here to read an in memory byte block?
413
- await _semaphoreSlim . WaitAsync ( ) ;
414
-
415
402
try
416
403
{
417
404
await Task . Run ( ( Func < Task > ) ( async ( ) =>
@@ -510,7 +497,7 @@ await Task.Run((Func<Task>)(async () =>
510
497
if ( String . IsNullOrEmpty ( texturePath ) ) continue ;
511
498
512
499
if ( await index . FileExists ( Path . GetDirectoryName ( texturePath ) . Replace ( "\\ " , "/" ) + "/" + dx11FileName ,
513
- DataFile ) )
500
+ df ) )
514
501
{
515
502
texturePath = texturePath . Insert ( texturePath . LastIndexOf ( "/" ) + 1 , "--" ) ;
516
503
}
@@ -638,7 +625,6 @@ await Task.Run((Func<Task>)(async () =>
638
625
}
639
626
finally
640
627
{
641
- _semaphoreSlim . Release ( ) ;
642
628
}
643
629
644
630
return xivMtrl ;
@@ -1183,7 +1169,6 @@ public static XivDependencyRootInfo GetHairMaterialRoot(XivDependencyRootInfo ro
1183
1169
}
1184
1170
public void Dipose ( )
1185
1171
{
1186
- _semaphoreSlim ? . Dispose ( ) ;
1187
1172
}
1188
1173
1189
1174
/// <summary>
0 commit comments