mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Add signal that a game path can not be added to file redirections, maybe fix some UsedGamePath bugs.
This commit is contained in:
parent
1c97b52179
commit
819264045b
3 changed files with 27 additions and 11 deletions
|
|
@ -37,14 +37,7 @@ public partial class Mod
|
|||
}
|
||||
|
||||
Penumbra.ModManager.OptionSetFiles( _mod, _subMod.GroupIdx, _subMod.OptionIdx, dict );
|
||||
if( num > 0 )
|
||||
{
|
||||
RevertFiles();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileChanges = false;
|
||||
}
|
||||
UpdateFiles();
|
||||
|
||||
return num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public partial class Mod
|
|||
{
|
||||
void HandleSubMod( ISubMod mod, int groupIdx, int optionIdx )
|
||||
{
|
||||
var newDict = mod.Files.Where( kvp => CheckAgainstMissing( kvp.Value, kvp.Key ) )
|
||||
var newDict = mod.Files.Where( kvp => CheckAgainstMissing( kvp.Value, kvp.Key, mod == _subMod ) )
|
||||
.ToDictionary( kvp => kvp.Key, kvp => kvp.Value );
|
||||
if( newDict.Count != mod.Files.Count )
|
||||
{
|
||||
|
|
@ -106,13 +106,18 @@ public partial class Mod
|
|||
_missingFiles.Clear();
|
||||
}
|
||||
|
||||
private bool CheckAgainstMissing( FullPath file, Utf8GamePath key )
|
||||
private bool CheckAgainstMissing( FullPath file, Utf8GamePath key, bool removeUsed )
|
||||
{
|
||||
if( !_missingFiles.Contains( file ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( removeUsed )
|
||||
{
|
||||
_usedPaths.Remove( key );
|
||||
}
|
||||
|
||||
Penumbra.Log.Debug( $"[RemoveMissingPaths] Removing {key} -> {file} from {_mod.Name}." );
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using OtterGui;
|
|||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.GameData.Util;
|
||||
using Penumbra.Mods;
|
||||
|
||||
namespace Penumbra.UI.Classes;
|
||||
|
|
@ -230,7 +231,7 @@ public partial class ModEditWindow
|
|||
using var id = ImRaii.PushId( j );
|
||||
ImGui.TableNextColumn();
|
||||
var tmp = _fileIdx == i && _pathIdx == j ? _gamePathEdit : gamePath.ToString();
|
||||
|
||||
var pos = ImGui.GetCursorPosX() - ImGui.GetFrameHeight();
|
||||
ImGui.SetNextItemWidth( -1 );
|
||||
if( ImGui.InputText( string.Empty, ref tmp, Utf8GamePath.MaxGamePathLength ) )
|
||||
{
|
||||
|
|
@ -251,11 +252,20 @@ public partial class ModEditWindow
|
|||
_fileIdx = -1;
|
||||
_pathIdx = -1;
|
||||
}
|
||||
else if( _fileIdx == i && _pathIdx == j && ( !Utf8GamePath.FromString( _gamePathEdit, out var path, false )
|
||||
|| !path.IsEmpty && !path.Equals( gamePath ) && !_editor!.CanAddGamePath( path )) )
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX( pos );
|
||||
using var font = ImRaii.PushFont( UiBuilder.IconFont );
|
||||
ImGuiUtil.TextColored( 0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString() );
|
||||
}
|
||||
}
|
||||
|
||||
private void PrintNewGamePath( int i, Mod.Editor.FileRegistry registry, ISubMod subMod )
|
||||
{
|
||||
var tmp = _fileIdx == i && _pathIdx == -1 ? _gamePathEdit : string.Empty;
|
||||
var pos = ImGui.GetCursorPosX() - ImGui.GetFrameHeight();
|
||||
ImGui.SetNextItemWidth( -1 );
|
||||
if( ImGui.InputTextWithHint( "##new", "Add New Path...", ref tmp, Utf8GamePath.MaxGamePathLength ) )
|
||||
{
|
||||
|
|
@ -274,6 +284,14 @@ public partial class ModEditWindow
|
|||
_fileIdx = -1;
|
||||
_pathIdx = -1;
|
||||
}
|
||||
else if( _fileIdx == i && _pathIdx == -1 && (!Utf8GamePath.FromString( _gamePathEdit, out var path, false )
|
||||
|| !path.IsEmpty && !_editor!.CanAddGamePath( path )) )
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX( pos );
|
||||
using var font = ImRaii.PushFont( UiBuilder.IconFont );
|
||||
ImGuiUtil.TextColored( 0xFF0000FF, FontAwesomeIcon.TimesCircle.ToIconString() );
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawButtonHeader()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue