mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Fix bug with expanding IMC files.
This commit is contained in:
parent
a798eabf67
commit
48a443921e
4 changed files with 15 additions and 10 deletions
|
|
@ -253,16 +253,15 @@ public partial class ModCollection
|
|||
if( addMetaChanges )
|
||||
{
|
||||
++ChangeCounter;
|
||||
if( mod.TotalManipulations > 0 )
|
||||
{
|
||||
AddMetaFiles();
|
||||
}
|
||||
if( _collection == Penumbra.CollectionManager.Default )
|
||||
{
|
||||
Penumbra.ResidentResources.Reload();
|
||||
MetaManipulations.SetFiles();
|
||||
}
|
||||
|
||||
if( mod.TotalManipulations > 0 )
|
||||
{
|
||||
AddMetaFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public unsafe class ImcFile : MetaBaseFile
|
|||
var defaultPtr = ( ImcEntry* )( Data + PreambleSize );
|
||||
for( var i = oldCount + 1; i < numVariants + 1; ++i )
|
||||
{
|
||||
Functions.MemCpyUnchecked( defaultPtr + i, defaultPtr, NumParts * sizeof( ImcEntry ) );
|
||||
Functions.MemCpyUnchecked( defaultPtr + i * NumParts, defaultPtr, NumParts * sizeof( ImcEntry ) );
|
||||
}
|
||||
|
||||
PluginLog.Verbose( "Expanded IMC {Path} from {Count} to {NewCount} variants.", Path, oldCount, numVariants );
|
||||
|
|
@ -197,9 +197,10 @@ public unsafe class ImcFile : MetaBaseFile
|
|||
}
|
||||
}
|
||||
|
||||
public static ImcEntry GetDefault( Utf8GamePath path, EquipSlot slot, int variantIdx )
|
||||
public static ImcEntry GetDefault( Utf8GamePath path, EquipSlot slot, int variantIdx, out bool exists )
|
||||
{
|
||||
var file = Dalamud.GameData.GetFile( path.ToString() );
|
||||
exists = false;
|
||||
if( file == null )
|
||||
{
|
||||
throw new Exception();
|
||||
|
|
@ -208,7 +209,12 @@ public unsafe class ImcFile : MetaBaseFile
|
|||
fixed( byte* ptr = file.Data )
|
||||
{
|
||||
var entry = VariantPtr( ptr, PartIndex( slot ), variantIdx );
|
||||
return entry == null ? new ImcEntry() : *entry;
|
||||
if( entry != null )
|
||||
{
|
||||
exists = true;
|
||||
return *entry;
|
||||
}
|
||||
return new ImcEntry();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public partial class MetaManager
|
|||
return false;
|
||||
}
|
||||
|
||||
var def = ImcFile.GetDefault( path, m.EquipSlot, m.Variant );
|
||||
var def = ImcFile.GetDefault( path, m.EquipSlot, m.Variant, out _ );
|
||||
var manip = m with { Entry = def };
|
||||
if( !manip.Apply( file ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ public partial class ModEditWindow
|
|||
{
|
||||
try
|
||||
{
|
||||
return ImcFile.GetDefault( imc.GamePath(), imc.EquipSlot, imc.Variant );
|
||||
return ImcFile.GetDefault( imc.GamePath(), imc.EquipSlot, imc.Variant, out _ );
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue