fix edit transfer window, more crashfix, add version nag on connect

This commit is contained in:
rootdarkarchon
2023-05-01 20:03:50 +02:00
parent 640adc124e
commit 2b777f94f1
6 changed files with 34 additions and 19 deletions

View File

@@ -359,13 +359,12 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
public async Task PalettePlusSetPalette(IntPtr character, string palette)
{
if (!CheckPalettePlusApi()) return;
string decodedPalette = Encoding.UTF8.GetString(Convert.FromBase64String(palette));
var gameObj = await _dalamudUtil.CreateGameObject(character).ConfigureAwait(false);
if (gameObj is Character c)
{
await _dalamudUtil.RunOnFrameworkThread(() =>
{
string decodedPalette = Encoding.UTF8.GetString(Convert.FromBase64String(palette));
if (string.IsNullOrEmpty(decodedPalette))
{
Logger.LogTrace("PalettePlus removing for {addr}", c.Address.ToString("X"));

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Authors></Authors>
<Company></Company>
<Version>0.8.31</Version>
<Version>0.8.32</Version>
<Description></Description>
<Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -105,25 +105,17 @@ public sealed class GameObjectHandler : DisposableMediatorSubscriberBase
{
return await _dalamudUtil.RunOnFrameworkThread(() =>
{
nint curPtr = IntPtr.Zero;
try
{
curPtr = CurrentAddress().GetAwaiter().GetResult();
var curPtr = _getAddress.Invoke();
if (curPtr == IntPtr.Zero) return true;
if (curPtr == IntPtr.Zero)
{
Address = IntPtr.Zero;
DrawObjectAddress = IntPtr.Zero;
return false;
}
var drawObj = GetDrawObj(curPtr);
return IsBeingDrawn(drawObj, curPtr);
}
catch (Exception)
{
if (curPtr != IntPtr.Zero)
{
return true;
}
return false;
}
}).ConfigureAwait(false);
}

View File

@@ -195,6 +195,10 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
{
throw new InvalidOperationException("Player name not equal to requested name, pointer invalid");
}
if (handler.Address == IntPtr.Zero)
{
throw new InvalidOperationException("Player pointer is zero, pointer invalid");
}
}
private async Task ApplyBaseData(Guid applicationId, Dictionary<string, string> moddedPaths, string manipulationData, CancellationToken token)

View File

@@ -213,6 +213,7 @@ public class DownloadUi : WindowMediatorSubscriberBase
public override bool DrawConditions()
{
if (_uiShared.EditTrackerPosition) return true;
if (!_configService.Current.ShowTransferWindow && !_configService.Current.ShowTransferBars) return false;
if (!_currentDownloads.Any() && !_fileTransferManager.CurrentUploads.Any() && !_uploadingPlayers.Any()) return false;
if (!IsOpen) return false;

View File

@@ -174,11 +174,30 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
ServerState = ServerState.Connected;
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
if (_connectionDto.ServerVersion != IMareHub.ApiVersion)
{
await StopConnection(ServerState.VersionMisMatch).ConfigureAwait(false);
if (_connectionDto.CurrentClientVersion > currentClientVer)
{
Mediator.Publish(new NotificationMessage("Client incompatible",
$"Your client is outdated ({currentClientVer.Major}.{currentClientVer.Minor}.{currentClientVer.Build}), current is: " +
$"{_connectionDto.CurrentClientVersion.Major}.{_connectionDto.CurrentClientVersion.Minor}.{_connectionDto.CurrentClientVersion.Build}. " +
$"This client version is incompatible and will not be able to connect. Please update your Mare Synchronos client.",
Dalamud.Interface.Internal.Notifications.NotificationType.Error));
}
return;
}
if (_connectionDto.CurrentClientVersion > currentClientVer)
{
Mediator.Publish(new NotificationMessage("Client outdated",
$"Your client is oudated ({currentClientVer.Major}.{currentClientVer.Minor}.{currentClientVer.Build}), current is: " +
$"{_connectionDto.CurrentClientVersion.Major}.{_connectionDto.CurrentClientVersion.Minor}.{_connectionDto.CurrentClientVersion.Build}. " +
$"Please keep your Mare Synchronos client up-to-date.",
Dalamud.Interface.Internal.Notifications.NotificationType.Error));
}
}
catch (HttpRequestException ex)
{