From 0bfc6f835b80c8c6c5428e5208db271a8b4d2e6a Mon Sep 17 00:00:00 2001 From: UlyssesWu Date: Sat, 23 Nov 2024 19:02:39 +0800 Subject: [PATCH] fix revo CI8 image export #139 --- FreeMote.Psb/Types/MapType.cs | 4 ++++ FreeMote/PostProcessing.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/FreeMote.Psb/Types/MapType.cs b/FreeMote.Psb/Types/MapType.cs index 8b0d72b..aa00f3d 100644 --- a/FreeMote.Psb/Types/MapType.cs +++ b/FreeMote.Psb/Types/MapType.cs @@ -39,6 +39,10 @@ private List FindTileResources(PSB psb, bool deDuplication) } var md = PsbResHelper.GenerateImageMetadata(image, null); + if (obj.ContainsKey("label") && (string.IsNullOrEmpty(md.Name) || md.Name == "image")) + { + md.Name = obj["label"].ToString(); + } md.PsbType = PsbType.Map; md.Spec = psb.Platform; resList.Add(md); diff --git a/FreeMote/PostProcessing.cs b/FreeMote/PostProcessing.cs index 74d2357..893d6ae 100644 --- a/FreeMote/PostProcessing.cs +++ b/FreeMote/PostProcessing.cs @@ -205,6 +205,10 @@ public static byte[] UntileTextureRvl(byte[] pixelData, int width, int height, i if (!compactMode) { + if (dataIndex >= pixelData.Length) + { + break; + } Buffer.BlockCopy(pixelData, dataIndex, untiledData, pixelIndex, bpp); dataIndex += bpp; }