fix some minor stuff
This commit is contained in:
@@ -67,8 +67,9 @@ namespace MareSynchronos.Factories
|
|||||||
|
|
||||||
FileReplacement cachedMdlResource = CreateBaseFileReplacement();
|
FileReplacement cachedMdlResource = CreateBaseFileReplacement();
|
||||||
cachedMdlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mdlPath, _dalamudUtil.PlayerName);
|
cachedMdlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mdlPath, _dalamudUtil.PlayerName);
|
||||||
|
//Logger.Debug("Model " + string.Join(", ", cachedMdlResource.GamePaths));
|
||||||
cachedMdlResource.SetResolvedPath(mdlPath);
|
cachedMdlResource.SetResolvedPath(mdlPath);
|
||||||
//PluginLog.Verbose("Resolving for model " + mdlPath);
|
//Logger.Debug("\t\t=> " + cachedMdlResource.ResolvedPath);
|
||||||
|
|
||||||
cache.AddAssociatedResource(cachedMdlResource, null!, null!);
|
cache.AddAssociatedResource(cachedMdlResource, null!, null!);
|
||||||
|
|
||||||
@@ -79,11 +80,12 @@ namespace MareSynchronos.Factories
|
|||||||
|
|
||||||
//var mtrlFileResource = factory.CreateBaseFileReplacement();
|
//var mtrlFileResource = factory.CreateBaseFileReplacement();
|
||||||
var mtrlPath = new Utf8String(mtrl->ResourceHandle->FileName()).ToString().Split("|")[2];
|
var mtrlPath = new Utf8String(mtrl->ResourceHandle->FileName()).ToString().Split("|")[2];
|
||||||
//PluginLog.Verbose("Resolving for material " + mtrlPath);
|
|
||||||
var cachedMtrlResource = CreateBaseFileReplacement();
|
var cachedMtrlResource = CreateBaseFileReplacement();
|
||||||
cachedMtrlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mtrlPath, _dalamudUtil.PlayerName);
|
cachedMtrlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mtrlPath, _dalamudUtil.PlayerName);
|
||||||
|
//Logger.Debug("\tMaterial " + string.Join(", ", cachedMtrlResource.GamePaths));
|
||||||
cachedMtrlResource.SetResolvedPath(mtrlPath);
|
cachedMtrlResource.SetResolvedPath(mtrlPath);
|
||||||
cache.AddAssociatedResource(cachedMtrlResource, cachedMdlResource, null!);
|
cache.AddAssociatedResource(cachedMtrlResource, cachedMdlResource, null!);
|
||||||
|
//Logger.Debug("\t\t\t=> " + cachedMtrlResource.ResolvedPath);
|
||||||
|
|
||||||
var mtrlResource = (MtrlResource*)mtrl->ResourceHandle;
|
var mtrlResource = (MtrlResource*)mtrl->ResourceHandle;
|
||||||
for (int resIdx = 0; resIdx < mtrlResource->NumTex; resIdx++)
|
for (int resIdx = 0; resIdx < mtrlResource->NumTex; resIdx++)
|
||||||
@@ -106,6 +108,8 @@ namespace MareSynchronos.Factories
|
|||||||
cachedTexResource.SetResolvedPath(reResolvedPath);
|
cachedTexResource.SetResolvedPath(reResolvedPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Logger.Debug("\t\tTexture " + string.Join(", ", cachedTexResource.GamePaths));
|
||||||
|
//Logger.Debug("\t\t\t\t=> " + cachedTexResource.ResolvedPath);
|
||||||
cache.AddAssociatedResource(cachedTexResource, cachedMdlResource, cachedMtrlResource);
|
cache.AddAssociatedResource(cachedTexResource, cachedMdlResource, cachedMtrlResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace MareSynchronos.Managers
|
|||||||
FileInfo fileInfo = new(file);
|
FileInfo fileInfo = new(file);
|
||||||
while (IsFileLocked(fileInfo))
|
while (IsFileLocked(fileInfo))
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(1000);
|
||||||
Logger.Debug("Waiting for file release " + fileInfo.FullName);
|
Logger.Debug("Waiting for file release " + fileInfo.FullName);
|
||||||
}
|
}
|
||||||
var sha1Hash = Crypto.GetFileHash(fileInfo.FullName);
|
var sha1Hash = Crypto.GetFileHash(fileInfo.FullName);
|
||||||
@@ -110,7 +110,7 @@ namespace MareSynchronos.Managers
|
|||||||
_penumbraDirWatcher = new FileSystemWatcher(_ipcManager.PenumbraModDirectory()!)
|
_penumbraDirWatcher = new FileSystemWatcher(_ipcManager.PenumbraModDirectory()!)
|
||||||
{
|
{
|
||||||
IncludeSubdirectories = true,
|
IncludeSubdirectories = true,
|
||||||
InternalBufferSize = 65536
|
InternalBufferSize = 1048576
|
||||||
};
|
};
|
||||||
_penumbraDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
|
_penumbraDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
|
||||||
_penumbraDirWatcher.Deleted += OnDeleted;
|
_penumbraDirWatcher.Deleted += OnDeleted;
|
||||||
@@ -123,9 +123,8 @@ namespace MareSynchronos.Managers
|
|||||||
|
|
||||||
_cacheDirWatcher = new FileSystemWatcher(_pluginConfiguration.CacheFolder)
|
_cacheDirWatcher = new FileSystemWatcher(_pluginConfiguration.CacheFolder)
|
||||||
{
|
{
|
||||||
EnableRaisingEvents = true,
|
|
||||||
IncludeSubdirectories = true,
|
IncludeSubdirectories = true,
|
||||||
InternalBufferSize = 65536
|
InternalBufferSize = 1048576
|
||||||
};
|
};
|
||||||
_cacheDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
|
_cacheDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
|
||||||
_cacheDirWatcher.Deleted += OnDeleted;
|
_cacheDirWatcher.Deleted += OnDeleted;
|
||||||
@@ -217,7 +216,14 @@ namespace MareSynchronos.Managers
|
|||||||
FileCacheSize = 0;
|
FileCacheSize = 0;
|
||||||
foreach (var file in Directory.EnumerateFiles(_pluginConfiguration.CacheFolder))
|
foreach (var file in Directory.EnumerateFiles(_pluginConfiguration.CacheFolder))
|
||||||
{
|
{
|
||||||
FileCacheSize += new FileInfo(file).Length;
|
try
|
||||||
|
{
|
||||||
|
FileCacheSize += new FileInfo(file).Length;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// whatever
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Dalamud.Plugin;
|
|||||||
using Dalamud.Plugin.Ipc;
|
using Dalamud.Plugin.Ipc;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using MareSynchronos.Utils;
|
using MareSynchronos.Utils;
|
||||||
|
|
||||||
namespace MareSynchronos.Managers
|
namespace MareSynchronos.Managers
|
||||||
@@ -198,6 +199,12 @@ namespace MareSynchronos.Managers
|
|||||||
|
|
||||||
Logger.Debug("Assigning temp mods for " + collectionName);
|
Logger.Debug("Assigning temp mods for " + collectionName);
|
||||||
Logger.Debug("ManipulationString: " + manipulationData);
|
Logger.Debug("ManipulationString: " + manipulationData);
|
||||||
|
var orderedModPaths = modPaths.OrderBy(p => p.Key.EndsWith(".mdl") ? 0 : p.Key.EndsWith(".mtrl") ? 1 : 2)
|
||||||
|
.ToDictionary(k => k.Key, k => k.Value);
|
||||||
|
foreach (var item in orderedModPaths)
|
||||||
|
{
|
||||||
|
//Logger.Debug(item.Key + " => " + item.Value);
|
||||||
|
}
|
||||||
var ret = _penumbraSetTemporaryMod.InvokeFunc("MareSynchronos", collectionName, modPaths, manipulationData, 0);
|
var ret = _penumbraSetTemporaryMod.InvokeFunc("MareSynchronos", collectionName, modPaths, manipulationData, 0);
|
||||||
Logger.Debug("Penumbra Ret: " + ret.ToString());
|
Logger.Debug("Penumbra Ret: " + ret.ToString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,11 +95,10 @@ public class CachedPlayer
|
|||||||
{
|
{
|
||||||
Logger.Debug("Downloading missing files for player " + PlayerName);
|
Logger.Debug("Downloading missing files for player " + PlayerName);
|
||||||
await _apiController.DownloadFiles(toDownloadReplacements, downloadToken);
|
await _apiController.DownloadFiles(toDownloadReplacements, downloadToken);
|
||||||
}
|
if (downloadToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
if (downloadToken.IsCancellationRequested)
|
return;
|
||||||
{
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyCharacterData(_cache[_lastAppliedEquipmentHash], moddedPaths);
|
ApplyCharacterData(_cache[_lastAppliedEquipmentHash], moddedPaths);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -251,8 +252,10 @@ namespace MareSynchronos.WebAPI
|
|||||||
await using var fs = File.OpenWrite(fileName);
|
await using var fs = File.OpenWrite(fileName);
|
||||||
await foreach (var data in reader.WithCancellation(ct))
|
await foreach (var data in reader.WithCancellation(ct))
|
||||||
{
|
{
|
||||||
|
//Logger.Debug("Getting chunk of " + hash);
|
||||||
CurrentDownloads[hash] = (CurrentDownloads[hash].Item1 + data.Length, CurrentDownloads[hash].Item2);
|
CurrentDownloads[hash] = (CurrentDownloads[hash].Item1 + data.Length, CurrentDownloads[hash].Item2);
|
||||||
await fs.WriteAsync(data, ct);
|
await fs.WriteAsync(data, ct);
|
||||||
|
Debug.WriteLine("Wrote chunk " + data.Length + " into " + fileName);
|
||||||
}
|
}
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user