More Evp stuff, update libs, fix archive extraction part 1.

This commit is contained in:
Ottermandias 2022-09-03 15:23:44 +02:00
parent 37ad1f68b0
commit ae842720ee
6 changed files with 38 additions and 21 deletions

View file

@ -24,7 +24,7 @@ public enum EqpEntry : ulong
BodyShowBracelet = 0x10_00ul, BodyShowBracelet = 0x10_00ul,
BodyShowTail = 0x20_00ul, BodyShowTail = 0x20_00ul,
BodyDisableBreastPhysics = 0x40_00ul, BodyDisableBreastPhysics = 0x40_00ul,
BodyHasVfxObject = 0x80_00ul, BodyUsesEvpTable = 0x80_00ul,
BodyMask = 0xFF_FFul, BodyMask = 0xFF_FFul,
LegsEnabled = 0x01ul << 16, LegsEnabled = 0x01ul << 16,
@ -75,7 +75,7 @@ public enum EqpEntry : ulong
_55 = 0x00_80_00ul << 40, _55 = 0x00_80_00ul << 40,
HeadShowHrothgarHat = 0x01_00_00ul << 40, HeadShowHrothgarHat = 0x01_00_00ul << 40,
HeadShowVieraHat = 0x02_00_00ul << 40, HeadShowVieraHat = 0x02_00_00ul << 40,
HeadHasVfxObject = 0x04_00_00ul << 40, HeadUsesEvpTable = 0x04_00_00ul << 40,
_59 = 0x08_00_00ul << 40, _59 = 0x08_00_00ul << 40,
_60 = 0x10_00_00ul << 40, _60 = 0x10_00_00ul << 40,
_61 = 0x20_00_00ul << 40, _61 = 0x20_00_00ul << 40,
@ -151,7 +151,7 @@ public static class Eqp
EqpEntry.BodyShowBracelet => EquipSlot.Body, EqpEntry.BodyShowBracelet => EquipSlot.Body,
EqpEntry.BodyShowTail => EquipSlot.Body, EqpEntry.BodyShowTail => EquipSlot.Body,
EqpEntry.BodyDisableBreastPhysics => EquipSlot.Body, EqpEntry.BodyDisableBreastPhysics => EquipSlot.Body,
EqpEntry.BodyHasVfxObject => EquipSlot.Body, EqpEntry.BodyUsesEvpTable => EquipSlot.Body,
EqpEntry.LegsEnabled => EquipSlot.Legs, EqpEntry.LegsEnabled => EquipSlot.Legs,
EqpEntry.LegsHideKneePads => EquipSlot.Legs, EqpEntry.LegsHideKneePads => EquipSlot.Legs,
@ -198,7 +198,7 @@ public static class Eqp
EqpEntry._55 => EquipSlot.Head, EqpEntry._55 => EquipSlot.Head,
EqpEntry.HeadShowHrothgarHat => EquipSlot.Head, EqpEntry.HeadShowHrothgarHat => EquipSlot.Head,
EqpEntry.HeadShowVieraHat => EquipSlot.Head, EqpEntry.HeadShowVieraHat => EquipSlot.Head,
EqpEntry.HeadHasVfxObject => EquipSlot.Head, EqpEntry.HeadUsesEvpTable => EquipSlot.Head,
// currently unused // currently unused
EqpEntry._59 => EquipSlot.Unknown, EqpEntry._59 => EquipSlot.Unknown,
@ -230,7 +230,7 @@ public static class Eqp
EqpEntry.BodyShowBracelet => "Show Bracelet", EqpEntry.BodyShowBracelet => "Show Bracelet",
EqpEntry.BodyShowTail => "Show Tail", EqpEntry.BodyShowTail => "Show Tail",
EqpEntry.BodyDisableBreastPhysics => "Disable Breast Physics", EqpEntry.BodyDisableBreastPhysics => "Disable Breast Physics",
EqpEntry.BodyHasVfxObject => "Has Special Effects", EqpEntry.BodyUsesEvpTable => "Uses EVP Table",
EqpEntry.LegsEnabled => "Enabled", EqpEntry.LegsEnabled => "Enabled",
EqpEntry.LegsHideKneePads => "Hide Knee Pads", EqpEntry.LegsHideKneePads => "Hide Knee Pads",
@ -277,7 +277,7 @@ public static class Eqp
EqpEntry._55 => "Unknown 55", EqpEntry._55 => "Unknown 55",
EqpEntry.HeadShowHrothgarHat => "Show on Hrothgar", EqpEntry.HeadShowHrothgarHat => "Show on Hrothgar",
EqpEntry.HeadShowVieraHat => "Show on Viera", EqpEntry.HeadShowVieraHat => "Show on Viera",
EqpEntry.HeadHasVfxObject => "Has Special Effects", EqpEntry.HeadUsesEvpTable => "Uses EVP Table",
EqpEntry._59 => "Unknown 59", EqpEntry._59 => "Unknown 59",
EqpEntry._60 => "Unknown 60", EqpEntry._60 => "Unknown 60",

View file

@ -8,7 +8,11 @@ using Newtonsoft.Json.Linq;
using OtterGui.Filesystem; using OtterGui.Filesystem;
using Penumbra.Mods; using Penumbra.Mods;
using SharpCompress.Archives; using SharpCompress.Archives;
using SharpCompress.Archives.Rar;
using SharpCompress.Archives.SevenZip;
using SharpCompress.Archives.Zip;
using SharpCompress.Common; using SharpCompress.Common;
using SharpCompress.Readers;
namespace Penumbra.Import; namespace Penumbra.Import;
@ -30,7 +34,14 @@ public partial class TexToolsImporter
_currentModName = modPackFile.Name; _currentModName = modPackFile.Name;
_currentGroupName = string.Empty; _currentGroupName = string.Empty;
_currentOptionName = DefaultTexToolsData.Name; _currentOptionName = DefaultTexToolsData.Name;
_currentNumFiles = archive.Entries.Count( e => !e.IsDirectory ); _currentNumFiles =
archive switch
{
RarArchive r => r.Entries.Count,
ZipArchive z => z.Entries.Count,
SevenZipArchive s => s.Entries.Count,
_ => archive.Entries.Count(),
};
PluginLog.Log( $" -> Importing {archive.Type} Archive." ); PluginLog.Log( $" -> Importing {archive.Type} Archive." );
_currentModDirectory = Mod.CreateModFolder( _baseDirectory, baseName ); _currentModDirectory = Mod.CreateModFolder( _baseDirectory, baseName );
@ -42,18 +53,20 @@ public partial class TexToolsImporter
State = ImporterState.ExtractingModFiles; State = ImporterState.ExtractingModFiles;
_currentFileIdx = 0; _currentFileIdx = 0;
foreach( var entry in archive.Entries ) var reader = archive.ExtractAllEntries();
while(reader.MoveToNextEntry())
{ {
_token.ThrowIfCancellationRequested(); _token.ThrowIfCancellationRequested();
if( entry.IsDirectory ) if( reader.Entry.IsDirectory )
{ {
++_currentFileIdx; ++_currentFileIdx;
continue; continue;
} }
PluginLog.Log( " -> Extracting {0}", entry.Key ); PluginLog.Log( " -> Extracting {0}", reader.Entry.Key );
entry.WriteToDirectory( _currentModDirectory.FullName, options ); reader.WriteEntryToDirectory( _currentModDirectory.FullName, options );
++_currentFileIdx; ++_currentFileIdx;
} }

View file

@ -110,16 +110,19 @@ public unsafe partial class PathResolver
var old = _animationLoadCollection; var old = _animationLoadCollection;
try try
{ {
var getGameObjectIdx = ( ( delegate* unmanaged< IntPtr, int >** )timeline )[ 0 ][ 28 ]; if( timeline != IntPtr.Zero )
var idx = getGameObjectIdx( timeline );
if( idx >= 0 && idx < Dalamud.Objects.Length )
{ {
var obj = Dalamud.Objects[ idx ]; var getGameObjectIdx = ( ( delegate* unmanaged< IntPtr, int >** )timeline )[ 0 ][ 28 ];
_animationLoadCollection = obj != null ? IdentifyCollection( ( GameObject* )obj.Address ) : null; var idx = getGameObjectIdx( timeline );
} if( idx >= 0 && idx < Dalamud.Objects.Length )
else {
{ var obj = Dalamud.Objects[ idx ];
_animationLoadCollection = null; _animationLoadCollection = obj != null ? IdentifyCollection( ( GameObject* )obj.Address ) : null;
}
else
{
_animationLoadCollection = null;
}
} }
} }
finally finally

View file

@ -9,7 +9,8 @@ namespace Penumbra.Meta.Files;
// NumModels x [ModelId:ushort] // NumModels x [ModelId:ushort]
// Containing the relevant model IDs. Seems to be sorted. // Containing the relevant model IDs. Seems to be sorted.
// NumModels x [DataArray]:512 Byte] // NumModels x [DataArray]:512 Byte]
// Containing Flags in each byte, 0x01 set for Body, 0x02 set for Helmet. Unsure where the index into this array comes from. // Containing Flags in each byte, 0x01 set for Body, 0x02 set for Helmet.
// Each flag corresponds to a mount row from the Mounts table and determines whether the mount disables the effect.
public unsafe class EvpFile : MetaBaseFile public unsafe class EvpFile : MetaBaseFile
{ {
public const int FlagArraySize = 512; public const int FlagArraySize = 512;

Binary file not shown.

Binary file not shown.