fix more bullshit

This commit is contained in:
rootdarkarchon
2024-03-30 00:57:23 +01:00
parent f25f2cb861
commit 04e705b261
2 changed files with 7 additions and 6 deletions

View File

@@ -133,13 +133,16 @@ public class PlayerDataFactory
// wait until chara is not drawing and present so nothing spontaneously explodes // wait until chara is not drawing and present so nothing spontaneously explodes
await _dalamudUtil.WaitWhileCharacterIsDrawing(_logger, playerRelatedObject, Guid.NewGuid(), 30000, ct: token).ConfigureAwait(false); await _dalamudUtil.WaitWhileCharacterIsDrawing(_logger, playerRelatedObject, Guid.NewGuid(), 30000, ct: token).ConfigureAwait(false);
int totalWaitTime = 10000; int totalWaitTime = 10000;
while (!await _dalamudUtil.IsObjectPresentAsync(await _dalamudUtil.CreateGameObjectAsync(charaPointer).ConfigureAwait(false)).ConfigureAwait(false) && totalWaitTime > 0) while (!await _dalamudUtil.IsObjectPresentAsync(await _dalamudUtil.CreateGameObjectAsync(playerRelatedObject.Address).ConfigureAwait(false)).ConfigureAwait(false) && totalWaitTime > 0)
{ {
_logger.LogTrace("Character is null but it shouldn't be, waiting"); _logger.LogTrace("Character is null but it shouldn't be, waiting");
await Task.Delay(50, token).ConfigureAwait(false); await Task.Delay(50, token).ConfigureAwait(false);
totalWaitTime -= 50; totalWaitTime -= 50;
} }
var boneIndices = await _dalamudUtil.RunOnFrameworkThread(() => _modelAnalyzer.GetSkeletonBoneIndices(charaPointer)).ConfigureAwait(false); Dictionary<string, List<ushort>>? boneIndices =
objectKind != ObjectKind.Player
? null
: await _dalamudUtil.RunOnFrameworkThread(() => _modelAnalyzer.GetSkeletonBoneIndices(playerRelatedObject.Address)).ConfigureAwait(false);
DateTime start = DateTime.UtcNow; DateTime start = DateTime.UtcNow;
@@ -243,7 +246,7 @@ public class PlayerDataFactory
} }
catch (Exception e) catch (Exception e)
{ {
_logger.LogWarning(e, "Failed to verify player animations, continuing"); _logger.LogWarning(e, "Failed to verify player animations, continuing without further verification");
} }
} }

View File

@@ -46,11 +46,9 @@ public sealed class XivDataAnalyzer
outputIndices[skeletonName] = new(); outputIndices[skeletonName] = new();
for (ushort boneIdx = 0; boneIdx < curBones; boneIdx++) for (ushort boneIdx = 0; boneIdx < curBones; boneIdx++)
{ {
var boneName = handle->HavokSkeleton->Bones[boneIdx].Name.String; var boneName = handle->HavokSkeleton->Bones[boneIdx].Name.String;
if (boneName == null) continue; if (boneName == null) continue;
outputIndices[skeletonName].Add(boneIdx); outputIndices[skeletonName].Add((ushort)(boneIdx + 1));
} }
i++; i++;
} }