mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 18:47:23 +01:00
fix contextmenu etc
This commit is contained in:
parent
b9cf7eb6fa
commit
bfafcad8e8
16 changed files with 101 additions and 78 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
|
|
@ -197,7 +196,13 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||
|
||||
public async Task<string> GetPlayerNameHashedAsync()
|
||||
{
|
||||
return await RunOnFrameworkThread(() => (GetPlayerName(), (ushort)GetHomeWorldId()).GetHash256()).ConfigureAwait(false);
|
||||
return await RunOnFrameworkThread(() => GetHashedAccIdFromPlayerPointer(GetPlayerPointer())).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private unsafe string GetHashedAccIdFromPlayerPointer(nint ptr)
|
||||
{
|
||||
if (ptr == nint.Zero) return string.Empty;
|
||||
return ((BattleChara*)ptr)->Character.AccountId.ToString().GetHash256();
|
||||
}
|
||||
|
||||
public IntPtr GetPlayerPointer()
|
||||
|
|
@ -453,7 +458,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||
continue;
|
||||
|
||||
var charaName = ((GameObject*)chara.Address)->NameString;
|
||||
var hash = (charaName, ((BattleChara*)chara.Address)->Character.HomeWorld).GetHash256();
|
||||
var hash = GetHashedAccIdFromPlayerPointer(chara.Address);
|
||||
if (!IsAnythingDrawing)
|
||||
CheckCharacterForDrawing(chara.Address, charaName);
|
||||
_notUpdatedCharas.Remove(hash);
|
||||
|
|
|
|||
|
|
@ -186,17 +186,25 @@ public sealed class XivDataAnalyzer
|
|||
|
||||
var filePath = path.ResolvedFilepath;
|
||||
|
||||
_logger.LogDebug("Detected Model File {path}, calculating Tris", filePath);
|
||||
var file = _luminaGameData.GetFileFromDisk<MdlFile>(filePath);
|
||||
if (file.FileHeader.LodCount <= 0)
|
||||
return Task.FromResult((long)0);
|
||||
var meshIdx = file.Lods[0].MeshIndex;
|
||||
var meshCnt = file.Lods[0].MeshCount;
|
||||
var tris = file.Meshes.Skip(meshIdx).Take(meshCnt).Sum(p => p.IndexCount) / 3;
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("Detected Model File {path}, calculating Tris", filePath);
|
||||
var file = _luminaGameData.GetFileFromDisk<MdlFile>(filePath);
|
||||
if (file.FileHeader.LodCount <= 0)
|
||||
return Task.FromResult((long)0);
|
||||
var meshIdx = file.Lods[0].MeshIndex;
|
||||
var meshCnt = file.Lods[0].MeshCount;
|
||||
var tris = file.Meshes.Skip(meshIdx).Take(meshCnt).Sum(p => p.IndexCount) / 3;
|
||||
|
||||
_logger.LogDebug("{filePath} => {tris} triangles", filePath, tris);
|
||||
_configService.Current.TriangleDictionary[hash] = tris;
|
||||
_configService.Save();
|
||||
return Task.FromResult(tris);
|
||||
_logger.LogDebug("{filePath} => {tris} triangles", filePath, tris);
|
||||
_configService.Current.TriangleDictionary[hash] = tris;
|
||||
_configService.Save();
|
||||
return Task.FromResult(tris);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogWarning(e, "Could not parse file {file}", filePath);
|
||||
return Task.FromResult((long)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue