mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-24 01:19:22 +01:00
Add errors when loading from elsewhere than installedPlugins or devPlugins/Penumbra existing and containing dlls in Release mode
This commit is contained in:
parent
27650708f0
commit
58e46accae
3 changed files with 88 additions and 28 deletions
|
|
@ -29,10 +29,14 @@ public class MainClass : IDalamudPlugin
|
||||||
{
|
{
|
||||||
private Penumbra? _penumbra;
|
private Penumbra? _penumbra;
|
||||||
private readonly CharacterUtility _characterUtility;
|
private readonly CharacterUtility _characterUtility;
|
||||||
|
public static bool DevPenumbraExists;
|
||||||
|
public static bool IsNotInstalledPenumbra;
|
||||||
|
|
||||||
public MainClass( DalamudPluginInterface pluginInterface )
|
public MainClass( DalamudPluginInterface pluginInterface )
|
||||||
{
|
{
|
||||||
Dalamud.Initialize( pluginInterface );
|
Dalamud.Initialize( pluginInterface );
|
||||||
|
DevPenumbraExists = CheckDevPluginPenumbra();
|
||||||
|
IsNotInstalledPenumbra = CheckIsNotInstalled();
|
||||||
GameData.GameData.GetIdentifier( Dalamud.GameData, Dalamud.ClientState.ClientLanguage );
|
GameData.GameData.GetIdentifier( Dalamud.GameData, Dalamud.ClientState.ClientLanguage );
|
||||||
_characterUtility = new CharacterUtility();
|
_characterUtility = new CharacterUtility();
|
||||||
_characterUtility.LoadingFinished += ()
|
_characterUtility.LoadingFinished += ()
|
||||||
|
|
@ -47,6 +51,38 @@ public class MainClass : IDalamudPlugin
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
=> Penumbra.Name;
|
=> Penumbra.Name;
|
||||||
|
|
||||||
|
// Because remnants of penumbra in devPlugins cause issues, we check for them to warn users to remove them.
|
||||||
|
private static bool CheckDevPluginPenumbra()
|
||||||
|
{
|
||||||
|
#if !DEBUG
|
||||||
|
var path = Path.Combine( Dalamud.PluginInterface.DalamudAssetDirectory.Parent?.FullName ?? "INVALIDPATH", "devPlugins", "Penumbra" );
|
||||||
|
var dir = new DirectoryInfo( path );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return dir.Exists && dir.EnumerateFiles( "*.dll", SearchOption.AllDirectories ).Any();
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
PluginLog.Error( $"Could not check for dev plugin Penumbra:\n{e}" );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the loaded version of penumbra itself is in devPlugins.
|
||||||
|
private static bool CheckIsNotInstalled()
|
||||||
|
{
|
||||||
|
#if !DEBUG
|
||||||
|
return !Dalamud.PluginInterface.AssemblyLocation.Directory?.Parent?.Name.Equals( "installedPlugins",
|
||||||
|
StringComparison.InvariantCultureIgnoreCase ) ?? true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Penumbra : IDisposable
|
public class Penumbra : IDisposable
|
||||||
|
|
@ -71,7 +107,6 @@ public class Penumbra : IDisposable
|
||||||
public static FrameworkManager Framework { get; private set; } = null!;
|
public static FrameworkManager Framework { get; private set; } = null!;
|
||||||
public static int ImcExceptions = 0;
|
public static int ImcExceptions = 0;
|
||||||
|
|
||||||
|
|
||||||
public readonly ResourceLogger ResourceLogger;
|
public readonly ResourceLogger ResourceLogger;
|
||||||
public readonly PathResolver PathResolver;
|
public readonly PathResolver PathResolver;
|
||||||
public readonly MusicManager MusicManager;
|
public readonly MusicManager MusicManager;
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,9 @@ public partial class ConfigWindow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add Penumbra Root. This is not updated if the root changes right now.
|
||||||
|
fileManager.CustomSideBarItems.Add( ("Root Directory", Penumbra.Config.ModDirectory, FontAwesomeIcon.Gamepad, 0) );
|
||||||
|
|
||||||
// Remove Videos and Music.
|
// Remove Videos and Music.
|
||||||
fileManager.CustomSideBarItems.Add( ( "Videos", string.Empty, 0, -1 ) );
|
fileManager.CustomSideBarItems.Add( ( "Videos", string.Empty, 0, -1 ) );
|
||||||
fileManager.CustomSideBarItems.Add( ( "Music", string.Empty, 0, -1 ) );
|
fileManager.CustomSideBarItems.Add( ( "Music", string.Empty, 0, -1 ) );
|
||||||
|
|
|
||||||
|
|
@ -55,23 +55,29 @@ public sealed partial class ConfigWindow : Window, IDisposable
|
||||||
{
|
{
|
||||||
if( Penumbra.ImcExceptions > 0 )
|
if( Penumbra.ImcExceptions > 0 )
|
||||||
{
|
{
|
||||||
using var color = ImRaii.PushColor( ImGuiCol.Text, Colors.RegexWarningBorder );
|
DrawProblemWindow( $"There were {Penumbra.ImcExceptions} errors while trying to load IMC files from the game data.\n"
|
||||||
ImGui.NewLine();
|
|
||||||
ImGui.NewLine();
|
|
||||||
ImGui.TextWrapped( $"There were {Penumbra.ImcExceptions} errors while trying to load IMC files from the game data.\n"
|
|
||||||
+ "This usually means that your game installation was corrupted by updating the game while having TexTools mods still active.\n"
|
+ "This usually means that your game installation was corrupted by updating the game while having TexTools mods still active.\n"
|
||||||
+ "It is recommended to not use TexTools and Penumbra (or other Lumina-based tools) at the same time.\n\n"
|
+ "It is recommended to not use TexTools and Penumbra (or other Lumina-based tools) at the same time.\n\n"
|
||||||
+ "Please use the Launcher's Repair Game Files function to repair your client installation." );
|
+ "Please use the Launcher's Repair Game Files function to repair your client installation." );
|
||||||
color.Pop();
|
|
||||||
|
|
||||||
ImGui.NewLine();
|
|
||||||
ImGui.NewLine();
|
|
||||||
SettingsTab.DrawDiscordButton( 0 );
|
|
||||||
ImGui.SameLine();
|
|
||||||
SettingsTab.DrawSupportButton();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if( MainClass.IsNotInstalledPenumbra )
|
||||||
|
{
|
||||||
|
DrawProblemWindow(
|
||||||
|
$"You are loading a release version of Penumbra from \"{Dalamud.PluginInterface.AssemblyLocation.Directory?.FullName ?? "Unknown"}\" instead of the installedPlugins directory.\n\n"
|
||||||
|
+ "You should not install Penumbra manually, but rather add the plugin repository under settings and then install it via the plugin installer.\n\n"
|
||||||
|
+ "If you do not know how to do this, please take a look at the readme in Penumbras github repository or join us in discord.\n"
|
||||||
|
+ "If you are developing for Penumbra and see this, you should compile your version in debug mode to avoid it." );
|
||||||
|
}
|
||||||
|
else if( MainClass.DevPenumbraExists )
|
||||||
|
{
|
||||||
|
DrawProblemWindow(
|
||||||
|
$"You are loading a installed version of Penumbra from \"{Dalamud.PluginInterface.AssemblyLocation.Directory?.FullName ?? "Unknown"}\", "
|
||||||
|
+ "but also still have some remnants of a custom install of Penumbra in your devPlugins folder.\n\n"
|
||||||
|
+ "This can cause some issues, so please go to your \"%%appdata%%\\XIVLauncher\\devPlugins\" folder and delete the Penumbra folder from there.\n\n"
|
||||||
|
+ "If you are developing for Penumbra, try to avoid mixing versions. This warning will not appear if compiled in Debug mode." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
using var bar = ImRaii.TabBar( string.Empty, ImGuiTabBarFlags.NoTooltip );
|
using var bar = ImRaii.TabBar( string.Empty, ImGuiTabBarFlags.NoTooltip );
|
||||||
SetupSizes();
|
SetupSizes();
|
||||||
_settingsTab.Draw();
|
_settingsTab.Draw();
|
||||||
|
|
@ -82,12 +88,28 @@ public sealed partial class ConfigWindow : Window, IDisposable
|
||||||
_debugTab.Draw();
|
_debugTab.Draw();
|
||||||
_resourceTab.Draw();
|
_resourceTab.Draw();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
{
|
{
|
||||||
PluginLog.Error( $"Exception thrown during UI Render:\n{e}" );
|
PluginLog.Error( $"Exception thrown during UI Render:\n{e}" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void DrawProblemWindow( string text )
|
||||||
|
{
|
||||||
|
using var color = ImRaii.PushColor( ImGuiCol.Text, Colors.RegexWarningBorder );
|
||||||
|
ImGui.NewLine();
|
||||||
|
ImGui.NewLine();
|
||||||
|
ImGui.TextWrapped( text );
|
||||||
|
color.Pop();
|
||||||
|
|
||||||
|
ImGui.NewLine();
|
||||||
|
ImGui.NewLine();
|
||||||
|
SettingsTab.DrawDiscordButton( 0 );
|
||||||
|
ImGui.SameLine();
|
||||||
|
SettingsTab.DrawSupportButton();
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_selector.Dispose();
|
_selector.Dispose();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue