mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 21:24:18 +01:00
Added a whole lot of rudimentary comments, also importing selects the last imported mod if possible.
This commit is contained in:
parent
a19ec226c5
commit
d29049ca21
24 changed files with 83 additions and 23 deletions
|
|
@ -14,6 +14,8 @@ namespace Penumbra.Meta.Files
|
|||
{ }
|
||||
}
|
||||
|
||||
// Imc files are already supported in Lumina, but changing the provided data is not supported.
|
||||
// We use reflection and extension methods to support changing the data of a given Imc file.
|
||||
public static class ImcExtensions
|
||||
{
|
||||
public static ulong ToInteger( this ImcFile.ImageChangeData imc )
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ using Penumbra.Util;
|
|||
|
||||
namespace Penumbra.Meta.Files
|
||||
{
|
||||
// This class manages the default meta files obtained via lumina from the game files themselves.
|
||||
// On first call, the default version of any supported file will be cached and can be returned without reparsing.
|
||||
public class MetaDefaults
|
||||
{
|
||||
private readonly DalamudPluginInterface _pi;
|
||||
|
|
@ -107,6 +109,7 @@ namespace Penumbra.Meta.Files
|
|||
private FileResource FetchFile( string name )
|
||||
=> _pi.Data.GetFile( name );
|
||||
|
||||
// Check that a given meta manipulation is an actual change to the default value. We don't need to keep changes to default.
|
||||
public bool CheckAgainstDefault( MetaManipulation m )
|
||||
{
|
||||
return m.Type switch
|
||||
|
|
@ -129,6 +132,7 @@ namespace Penumbra.Meta.Files
|
|||
};
|
||||
}
|
||||
|
||||
// Create a deep copy of a default file as a new file.
|
||||
public object? CreateNewFile( MetaManipulation m )
|
||||
{
|
||||
return m.Type switch
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Penumbra.Util;
|
|||
|
||||
namespace Penumbra.Meta.Files
|
||||
{
|
||||
// Contains all filenames for meta changes depending on their parameters.
|
||||
public static class MetaFileNames
|
||||
{
|
||||
public static GamePath Eqp()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using Penumbra.Game.Enums;
|
||||
|
||||
|
||||
// A struct for each type of meta change that contains all relevant information,
|
||||
// to uniquely identify the corresponding file and location for the change.
|
||||
// The first byte is guaranteed to be the MetaType enum for each case.
|
||||
namespace Penumbra.Meta
|
||||
{
|
||||
public enum MetaType : byte
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using ImcFile = Lumina.Data.Files.ImcFile;
|
|||
|
||||
namespace Penumbra.Meta
|
||||
{
|
||||
// Write a single meta manipulation as a Base64string of the 16 bytes defining it.
|
||||
public class MetaManipulationConverter : JsonConverter< MetaManipulation >
|
||||
{
|
||||
public override void WriteJson( JsonWriter writer, MetaManipulation manip, JsonSerializer serializer )
|
||||
|
|
@ -38,6 +39,10 @@ namespace Penumbra.Meta
|
|||
}
|
||||
}
|
||||
|
||||
// A MetaManipulation is a union of a type of Identifier (first 8 bytes, cf. Identifier.cs)
|
||||
// and the appropriate Value to change the meta entry to (the other 8 bytes).
|
||||
// Its comparison for sorting and hashes depends only on the identifier.
|
||||
// The first byte is guaranteed to be a MetaType enum value in any case, so Type can always be read.
|
||||
[StructLayout( LayoutKind.Explicit )]
|
||||
[JsonConverter( typeof( MetaManipulationConverter ) )]
|
||||
public struct MetaManipulation : IComparable
|
||||
|
|
@ -219,11 +224,11 @@ namespace Penumbra.Meta
|
|||
{
|
||||
return Type switch
|
||||
{
|
||||
MetaType.Eqp => $"EQP - {EqpIdentifier}",
|
||||
MetaType.Eqdp => $"EQDP - {EqdpIdentifier}",
|
||||
MetaType.Est => $"EST - {EstIdentifier}",
|
||||
MetaType.Gmp => $"GMP - {GmpIdentifier}",
|
||||
MetaType.Imc => $"IMC - {ImcIdentifier}",
|
||||
MetaType.Eqp => EqpIdentifier.ToString(),
|
||||
MetaType.Eqdp => EqdpIdentifier.ToString(),
|
||||
MetaType.Est => EstIdentifier.ToString(),
|
||||
MetaType.Gmp => GmpIdentifier.ToString(),
|
||||
MetaType.Imc => ImcIdentifier.ToString(),
|
||||
_ => throw new InvalidEnumArgumentException(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue