From 5221a98fdb700876fcabe65bc3b480c036f9d4ff Mon Sep 17 00:00:00 2001 From: jracek Date: Tue, 11 Mar 2025 14:28:21 +0100 Subject: [PATCH] The code doesn't try to pack 16bpp cluts anymore --- Editor/VramEditorWindow.cs | 11 +++++++---- Runtime/PSXTexture2D.cs | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Editor/VramEditorWindow.cs b/Editor/VramEditorWindow.cs index 20c375e..641773e 100644 --- a/Editor/VramEditorWindow.cs +++ b/Editor/VramEditorWindow.cs @@ -134,11 +134,14 @@ public class VRAMEditorWindow : EditorWindow Debug.Log($"Packing {texture} at: x:{ta.PositionX + texture.PackingX} y:{ta.PositionY + texture.PackingY}"); PasteTexture(vramImage, texture.GenerateVramPreview(), ta.PositionX + texture.PackingX, ta.PositionY + texture.PackingY); Debug.Log($"Texpage: {texture.TexpageNum} Offset:({texture.PackingX},{texture.PackingY})"); - - for(int i = 0; i < texture.ColorPalette.Count; i++) { - vramImage.SetPixel(texture.ClutPackingX+i, texture.ClutPackingY, texture.ColorPalette[i].GetUnityColor()); + if (texture.BitDepth != PSXBPP.TEX_16BIT) + { + for (int i = 0; i < texture.ColorPalette.Count; i++) + { + vramImage.SetPixel(texture.ClutPackingX + i, texture.ClutPackingY, texture.ColorPalette[i].GetUnityColor()); + } + vramImage.Apply(); } - vramImage.Apply(); } } } diff --git a/Runtime/PSXTexture2D.cs b/Runtime/PSXTexture2D.cs index 9e6cc5d..667cc41 100644 --- a/Runtime/PSXTexture2D.cs +++ b/Runtime/PSXTexture2D.cs @@ -142,6 +142,7 @@ namespace PSXSplash.RuntimeCode psxTex.ImageData[i] = vramPixel.Pack(); i++; } + psxTex.ColorPalette = null; return psxTex; }