Possible temporary fix against crashes.

This commit is contained in:
Ottermandias 2021-09-01 20:36:03 +02:00
parent a2947fdaaa
commit 8084f9b8f3
6 changed files with 28 additions and 14 deletions

Binary file not shown.

Binary file not shown.

BIN
FFXIVClientStructs.dll Normal file

Binary file not shown.

View file

@ -3,6 +3,7 @@ using System.Runtime.InteropServices;
using Dalamud.Plugin;
using Penumbra.Structs;
using Reloaded.Hooks.Definitions.X64;
using ResourceHandle = FFXIVClientStructs.FFXIV.Client.System.Resource.Handle.ResourceHandle;
namespace Penumbra.Interop
{
@ -86,9 +87,11 @@ namespace Penumbra.Interop
for( var i = 0; i < NumResources; i++ )
{
var handle = ( ResourceHandle* )oldResources[ i ];
if( oldResources[ i ].ToPointer() == pResources[ i ] )
{
PluginLog.Debug( $"Unchanged resource: {ResourceToPath( ( byte* )oldResources[ i ].ToPointer() )}" );
( ( ResourceHandle* )oldResources[ i ] )->DecRef();
continue;
}
@ -97,6 +100,13 @@ namespace Penumbra.Interop
+ $"{ResourceToPath( ( byte* )pResources[ i ] )}" );
UnloadCharacterResource( oldResources[ i ] );
// Temporary fix against crashes?
if( handle->RefCount <= 0 )
{
handle->RefCount = 1;
handle->IncRef();
handle->RefCount = 1;
}
}
}
}

View file

@ -27,36 +27,31 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ILRepack" Version="2.0.18" GeneratePathProperty="true" />
<Reference Include="Dalamud">
<HintPath>$(DALAMUD_ROOT)\Dalamud.dll</HintPath>
<HintPath>..\libs\Dalamud.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DALAMUD_ROOT)\ImGui.NET.dll</HintPath>
<HintPath>..\libs\ImGui.NET.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DALAMUD_ROOT)\ImGuiScene.dll</HintPath>
<HintPath>..\libs\ImGuiScene.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DALAMUD_ROOT)\Lumina.dll</HintPath>
<HintPath>..\libs\Lumina.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DALAMUD_ROOT)\Lumina.Excel.dll</HintPath>
<HintPath>..\libs\Lumina.Excel.dll</HintPath>
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="FFXIVClientStructs">
<HintPath>..\FFXIVClientStructs.dll</HintPath>
<Private>true</Private>
</Reference>
</ItemGroup>
<ItemGroup>
@ -66,6 +61,14 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<Target Name="ILRepack" AfterTargets="Build">
<ItemGroup>
<InputAssemblies Include="$(TargetPath)"/>
<InputAssemblies Include="$(TargetDir)Penumbra.dll $(TargetDir)FFXIVClientStructs.dll" Exclude="$(TargetPath)"/>
</ItemGroup>
<Exec Command="$(ILRepack) /lib:$(TargetDir) /lib:$(AppData)\XIVLauncher\addon\Hooks\dev /out:$(TargetDir)$(TargetFileName) @(InputAssemblies, ' ')"/>
</Target>
<ItemGroup>
<PackageReference Include="EmbedIO" Version="3.4.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />

View file

@ -48,6 +48,7 @@ namespace Penumbra
public void Initialize( DalamudPluginInterface pluginInterface )
{
FFXIVClientStructs.Resolver.Initialize();
PluginInterface = pluginInterface;
Service< DalamudPluginInterface >.Set( PluginInterface );
GameData.GameData.GetIdentifier( PluginInterface );