This commit is contained in:
Ottermandias 2024-11-27 22:51:14 +01:00
parent 9787e5a852
commit 97d7ea7759
3 changed files with 17 additions and 14 deletions

View file

@ -16,8 +16,6 @@ namespace Penumbra.Api.Api;
public class MetaApi(IFramework framework, CollectionResolver collectionResolver, ApiHelpers helpers)
: IPenumbraApiMeta, IApiService
{
public const int CurrentVersion = 1;
public string GetPlayerMetaManipulations()
{
var collection = collectionResolver.PlayerCollection();
@ -99,7 +97,6 @@ public class MetaApi(IFramework framework, CollectionResolver collectionResolver
WriteCache(zipStream, cache.Est);
WriteCache(zipStream, cache.Rsp);
WriteCache(zipStream, cache.Gmp);
WriteCache(zipStream, cache.Atch);
cache.GlobalEqp.EnterReadLock();
try
@ -112,6 +109,8 @@ public class MetaApi(IFramework framework, CollectionResolver collectionResolver
{
cache.GlobalEqp.ExitReadLock();
}
WriteCache(zipStream, cache.Atch);
}
}
@ -251,15 +250,6 @@ public class MetaApi(IFramework framework, CollectionResolver collectionResolver
return false;
}
var atchCount = r.ReadInt32();
for (var i = 0; i < atchCount; ++i)
{
var identifier = r.Read<AtchIdentifier>();
var value = r.Read<AtchEntry>();
if (!identifier.Validate() || !manips.TryAdd(identifier, value))
return false;
}
var globalEqpCount = r.ReadInt32();
for (var i = 0; i < globalEqpCount; ++i)
{
@ -268,6 +258,19 @@ public class MetaApi(IFramework framework, CollectionResolver collectionResolver
return false;
}
// Atch was added after there were already some V1 around, so check for size here.
if (r.Position < r.Count)
{
var atchCount = r.ReadInt32();
for (var i = 0; i < atchCount; ++i)
{
var identifier = r.Read<AtchIdentifier>();
var value = r.Read<AtchEntry>();
if (!identifier.Validate() || !manips.TryAdd(identifier, value))
return false;
}
}
return true;
}

View file

@ -24,7 +24,7 @@ public class MetaIpcTester(IDalamudPluginInterface pi) : IUiService
ImGui.InputInt("##metaIdx", ref _gameObjectIndex, 0, 0);
if (ImUtf8.InputText("##metaText"u8, ref _metaBase64, "Base64 Metadata..."u8))
if (!MetaApi.ConvertManips(_metaBase64, out _metaDict, out _parsedVersion))
if (!MetaApi.ConvertManips(_metaBase64, out _metaDict!, out _parsedVersion))
_metaDict ??= new MetaDictionary();

View file

@ -20,7 +20,7 @@ public sealed class AtchPathPreProcessor : IPathPreProcessor
if (!TryGetAtchGenderRace(path, out var gr))
return resolved;
Penumbra.Log.Information($"Pre-Processed {path} with {resolveData.ModCollection} for {gr.ToName()}.");
Penumbra.Log.Excessive($"Pre-Processed {path} with {resolveData.ModCollection} for {gr.ToName()}.");
if (resolveData.ModCollection.MetaCache?.Atch.GetFile(gr, out var file) == true)
return PathDataHandler.CreateAtch(path, resolveData.ModCollection);