From 9c781f8563fb0bc85247fb83aab79980943cb2d5 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 16 Jul 2024 22:04:36 +0200 Subject: [PATCH] Disable material migration for now --- Penumbra.GameData | 2 +- Penumbra/Services/MigrationManager.cs | 22 ++++++++++----- Penumbra/UI/Classes/MigrationSectionDrawer.cs | 28 ++++++++++--------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Penumbra.GameData b/Penumbra.GameData index 2c067b4f..c2a4c4ee 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit 2c067b4f3c1d84888c2b961a93fe2de01fffe5f1 +Subproject commit c2a4c4ee7470c5afbd3dd7731697ab49c055d1e3 diff --git a/Penumbra/Services/MigrationManager.cs b/Penumbra/Services/MigrationManager.cs index 5b353912..7115fe4d 100644 --- a/Penumbra/Services/MigrationManager.cs +++ b/Penumbra/Services/MigrationManager.cs @@ -233,6 +233,8 @@ public class MigrationManager(Configuration config) : IService /// Writes or migrates a .mdl file during extraction from a regular archive. public void MigrateMdlDuringExtraction(IReader reader, string directory, ExtractionOptions options) { + // TODO reactivate when this works. + return; if (!config.MigrateImportedModelsToV6) { reader.WriteEntryToDirectory(directory, options); @@ -265,6 +267,8 @@ public class MigrationManager(Configuration config) : IService public void MigrateMtrlDuringExtraction(IReader reader, string directory, ExtractionOptions options) { + // TODO reactivate when this works. + return; if (!config.MigrateImportedMaterialsToLegacy) { reader.WriteEntryToDirectory(directory, options); @@ -276,16 +280,20 @@ public class MigrationManager(Configuration config) : IService using var e = reader.OpenEntryStream(); e.CopyTo(s); var file = new MtrlFile(s.GetBuffer()); - if (!file.IsDawnTrail) - { - file.MigrateToDawntrail(); - Penumbra.Log.Debug($"Migrated material {reader.Entry.Key} to Dawntrail during import."); - } Directory.CreateDirectory(Path.GetDirectoryName(path)!); using var f = File.Open(path, FileMode.Create, FileAccess.Write); - s.Seek(0, SeekOrigin.Begin); - s.WriteTo(f); + if (file.IsDawnTrail) + { + file.MigrateToDawntrail(); + Penumbra.Log.Debug($"Migrated material {reader.Entry.Key} to Dawntrail during import."); + f.Write(file.Write()); + } + else + { + s.Seek(0, SeekOrigin.Begin); + s.WriteTo(f); + } } /// Update the data of a .mdl file during TTMP extraction. Returns either the existing array or a new one. diff --git a/Penumbra/UI/Classes/MigrationSectionDrawer.cs b/Penumbra/UI/Classes/MigrationSectionDrawer.cs index d588eaa0..a4a2010f 100644 --- a/Penumbra/UI/Classes/MigrationSectionDrawer.cs +++ b/Penumbra/UI/Classes/MigrationSectionDrawer.cs @@ -22,10 +22,11 @@ public class MigrationSectionDrawer(MigrationManager migrationManager, Configura DrawMdlMigration(); DrawMdlRestore(); DrawMdlCleanup(); - ImGui.Separator(); - DrawMtrlMigration(); - DrawMtrlRestore(); - DrawMtrlCleanup(); + // TODO enable when this works + //ImGui.Separator(); + //DrawMtrlMigration(); + //DrawMtrlRestore(); + //DrawMtrlCleanup(); } private void DrawSettings() @@ -39,15 +40,16 @@ public class MigrationSectionDrawer(MigrationManager migrationManager, Configura ImUtf8.HoverTooltip("This increments the version marker and restructures the bone table to the new version."u8); - value = config.MigrateImportedMaterialsToLegacy; - if (ImUtf8.Checkbox("Automatically Migrate Materials to Dawntrail on Import"u8, ref value)) - { - config.MigrateImportedMaterialsToLegacy = value; - config.Save(); - } - - ImUtf8.HoverTooltip( - "This currently only increases the color-table size and switches the shader from 'character.shpk' to 'characterlegacy.shpk', if the former is used."u8); + // TODO enable when this works + //value = config.MigrateImportedMaterialsToLegacy; + //if (ImUtf8.Checkbox("Automatically Migrate Materials to Dawntrail on Import"u8, ref value)) + //{ + // config.MigrateImportedMaterialsToLegacy = value; + // config.Save(); + //} + // + //ImUtf8.HoverTooltip( + // "This currently only increases the color-table size and switches the shader from 'character.shpk' to 'characterlegacy.shpk', if the former is used."u8); ImUtf8.Checkbox("Create Backups During Manual Migration", ref _createBackups); }