idk, probably some crashfixes or so

This commit is contained in:
rootdarkarchon
2023-04-30 00:46:02 +02:00
parent 3715ca5ce3
commit bbfd6eb3d3
7 changed files with 34 additions and 41 deletions

View File

@@ -316,7 +316,7 @@ public class PlayerDataFactory
// wait until chara is not drawing and present so nothing spontaneously explodes
await _dalamudUtil.WaitWhileCharacterIsDrawing(_logger, playerRelatedObject, Guid.NewGuid(), 30000, ct: token).ConfigureAwait(false);
int totalWaitTime = 10000;
while (!DalamudUtilService.IsObjectPresent(_dalamudUtil.CreateGameObject(charaPointer)) && totalWaitTime > 0)
while (!DalamudUtilService.IsObjectPresent(await _dalamudUtil.RunOnFrameworkThread(() => _dalamudUtil.CreateGameObject(charaPointer).GetAwaiter().GetResult()).ConfigureAwait(false)) && totalWaitTime > 0)
{
_logger.LogTrace("Character is null but it shouldn't be, waiting");
await Task.Delay(50, token).ConfigureAwait(false);

View File

@@ -164,7 +164,7 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase
Address = curPtr;
if (addrDiff)
{
GameObjectLazy = new(() => _dalamudUtil.CreateGameObject(curPtr));
GameObjectLazy = new(() => _dalamudUtil.CreateGameObject(curPtr).GetAwaiter().GetResult());
}
var chara = (Character*)curPtr;
var name = new ByteString(chara->GameObject.Name).ToString();

View File

@@ -204,8 +204,8 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
{
await _ipcManager.PenumbraRemoveTemporaryCollection(Logger, applicationId, PlayerName!).ConfigureAwait(false);
token.ThrowIfCancellationRequested();
await _ipcManager.PenumbraSetTemporaryMods(Logger, applicationId, PlayerName!,
_charaHandler?.GameObjectLazy?.Value.ObjectTableIndex(), moddedPaths, manipulationData).ConfigureAwait(false);
var objTableIndex = await _dalamudUtil.RunOnFrameworkThread(() => _charaHandler!.GameObjectLazy!.Value.ObjectTableIndex()).ConfigureAwait(false);
await _ipcManager.PenumbraSetTemporaryMods(Logger, applicationId, PlayerName!, objTableIndex, moddedPaths, manipulationData).ConfigureAwait(false);
token.ThrowIfCancellationRequested();
}
@@ -485,7 +485,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
if (string.IsNullOrEmpty(PlayerName))
{
var pc = _dalamudUtil.FindPlayerByNameHash(OnlineUser.Ident);
if (pc == null) return;
if (pc == default((string, nint))) return;
Logger.LogDebug("One-Time Initializing {this}", this);
Initialize(pc.Name.ToString());
Logger.LogDebug("One-Time Initialized {this}", this);

View File

@@ -92,6 +92,8 @@ public class Pair
{
try
{
if (CachedPlayer != null) return;
_creationSemaphore.Wait();
if (dto == null && _onlineUserIdentDto == null)