mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 20:17:22 +01:00
attempt to fix some crashes
This commit is contained in:
parent
734e73ccfd
commit
22e11cac6a
7 changed files with 39 additions and 23 deletions
|
|
@ -186,12 +186,6 @@ public class DalamudUtilService : IHostedService
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Vector2 WorldToScreen(Dalamud.Game.ClientState.Objects.Types.GameObject? obj)
|
||||
{
|
||||
if (obj == null) return Vector2.Zero;
|
||||
return _gameGui.WorldToScreen(obj.Position, out var screenPos) ? screenPos : Vector2.Zero;
|
||||
}
|
||||
|
||||
public async Task WaitWhileCharacterIsDrawing(ILogger logger, GameObjectHandler handler, Guid redrawId, int timeOut = 5000, CancellationToken? ct = null)
|
||||
{
|
||||
if (!_clientState.IsLoggedIn || handler.Address == IntPtr.Zero) return;
|
||||
|
|
@ -202,7 +196,6 @@ public class DalamudUtilService : IHostedService
|
|||
int curWaitTime = 0;
|
||||
try
|
||||
{
|
||||
// ReSharper disable once LoopVariableIsNeverChangedInsideLoop
|
||||
while ((!ct?.IsCancellationRequested ?? true)
|
||||
&& curWaitTime < timeOut
|
||||
&& await handler.IsBeingDrawnRunOnFramework().ConfigureAwait(true)) // 0b100000000000 is "still rendering" or something
|
||||
|
|
@ -242,6 +235,12 @@ public class DalamudUtilService : IHostedService
|
|||
Thread.Sleep(tick * 2);
|
||||
}
|
||||
|
||||
public Vector2 WorldToScreen(Dalamud.Game.ClientState.Objects.Types.GameObject? obj)
|
||||
{
|
||||
if (obj == null) return Vector2.Zero;
|
||||
return _gameGui.WorldToScreen(obj.Position, out var screenPos) ? screenPos : Vector2.Zero;
|
||||
}
|
||||
|
||||
private void FrameworkOnUpdate(Framework framework)
|
||||
{
|
||||
_performanceCollector.LogPerformance(this, "FrameworkOnUpdate", FrameworkOnUpdateInternal);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue