From 25e422b4e89f900e1f1c91df212d8e4c11b35e5a Mon Sep 17 00:00:00 2001 From: "Pasquale \"Pasqui industry\" Pignataro" Date: Sat, 12 Sep 2026 19:20:21 +0200 Subject: [PATCH 1/4] Fixed the "Contributing" link inside README.md https://psxsplash.github.io/docs/reference/contributing/ was an invalid link. It was replaced with https://psxsplash.github.io/docs/latest/reference/contributing/ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8482093..95ac1a0 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ See the [installation guide](https://psxsplash.github.io/docs/getting-started/in ## Contributing -This has been a one-person project and it has grown over my head. Pull requests are very welcome. See the [contributing guide](https://psxsplash.github.io/docs/reference/contributing/) for areas where help is needed. +This has been a one-person project and it has grown over my head. Pull requests are very welcome. See the [contributing guide](https://psxsplash.github.io/docs/latest/reference/contributing/) for areas where help is needed. If you build something with SplashEdit, please share it on [PSX.Dev](https://psx.dev) or the Bandwidth Discord server! From 7aeda842719182cc42dba3aef30ff496001dfaed Mon Sep 17 00:00:00 2001 From: "Pasquale \"Pasqui industry\" Pignataro" Date: Sun, 13 Sep 2026 19:20:16 +0200 Subject: [PATCH 2/4] Replaced the integers used by the deprecated functions GetInstanceID() and InstanceIDToObject() with the new struct EntityId --- Editor/Timeline/PSXTimelineWindow.cs | 4 ++-- Runtime/PSXObjectExporter.cs | 4 ++-- Runtime/TexturePacker.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Editor/Timeline/PSXTimelineWindow.cs b/Editor/Timeline/PSXTimelineWindow.cs index 99119f4..16b4a90 100644 --- a/Editor/Timeline/PSXTimelineWindow.cs +++ b/Editor/Timeline/PSXTimelineWindow.cs @@ -42,9 +42,9 @@ public static void Open(ScriptableObject clip) } [OnOpenAsset] - public static bool OnOpenAsset(int instanceID, int line) + public static bool OnOpenAsset(EntityId instanceID, int line) { - var obj = EditorUtility.InstanceIDToObject(instanceID); + var obj = EditorUtility.EntityIdToObject(instanceID); if (obj is PSXAnimationClip || obj is PSXCutsceneClip) { Open((ScriptableObject)obj); diff --git a/Runtime/PSXObjectExporter.cs b/Runtime/PSXObjectExporter.cs index 0708201..adfb079 100644 --- a/Runtime/PSXObjectExporter.cs +++ b/Runtime/PSXObjectExporter.cs @@ -58,7 +58,7 @@ public class PSXObjectExporter : MonoBehaviour, IPSXExportable public bool IsPlatform => isPlatform; public int UVOffsetMaterial => uvOffsetMaterial; - private readonly Dictionary<(int, PSXBPP), PSXTexture2D> cache = new(); + private readonly Dictionary<(EntityId, PSXBPP), PSXTexture2D> cache = new(); public void CreatePSXTextures2D() { @@ -78,7 +78,7 @@ public void CreatePSXTextures2D() if (tex2D == null) continue; - if (cache.TryGetValue((tex2D.GetInstanceID(), bitDepth), out var cached)) + if (cache.TryGetValue((tex2D.GetEntityId(), bitDepth), out var cached)) { Textures.Add(cached); } diff --git a/Runtime/TexturePacker.cs b/Runtime/TexturePacker.cs index d639342..f2426e3 100644 --- a/Runtime/TexturePacker.cs +++ b/Runtime/TexturePacker.cs @@ -85,7 +85,7 @@ public VRAMPacker(List framebuffers, List reservedAreas) // List to track unique textures and their indices List uniqueTextures = new List(); - Dictionary<(int, PSXBPP), int> textureToIndexMap = new Dictionary<(int, PSXBPP), int>(); + Dictionary<(EntityId, PSXBPP), int> textureToIndexMap = new Dictionary<(EntityId, PSXBPP), int>(); // Track duplicates so we can propagate packing data after placement List<(PSXTexture2D duplicate, int uniqueIndex)> duplicates = new List<(PSXTexture2D, int)>(); @@ -113,7 +113,7 @@ public VRAMPacker(List framebuffers, List reservedAreas) // Process each texture in descending order of area. foreach (var texture in group.OrderByDescending(tex => tex.QuantizedWidth * tex.Height)) { - var textureKey = (texture.OriginalTexture.GetInstanceID(), texture.BitDepth); + var textureKey = (texture.OriginalTexture.GetEntityId(), texture.BitDepth); // Check if we've already processed this texture if (textureToIndexMap.TryGetValue(textureKey, out int existingIndex)) @@ -152,7 +152,7 @@ public VRAMPacker(List framebuffers, List reservedAreas) for (int i = 0; i < obj.Textures.Count; i++) { - var textureKey = (obj.Textures[i].OriginalTexture.GetInstanceID(), obj.Textures[i].BitDepth); + var textureKey = (obj.Textures[i].OriginalTexture.GetEntityId(), obj.Textures[i].BitDepth); if (textureToIndexMap.TryGetValue(textureKey, out int newIndex)) { oldToNewIndexMap[i] = newIndex; From 5c03028da422fad3933f1dec48396afe2da37dae Mon Sep 17 00:00:00 2001 From: "Pasquale \"Pasqui industry\" Pignataro" Date: Sun, 13 Sep 2026 19:26:02 +0200 Subject: [PATCH 3/4] Replaced all the "Installed" status labels with "Ready" to be coherent with the documentation --- Editor/Core/SplashControlPanel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Editor/Core/SplashControlPanel.cs b/Editor/Core/SplashControlPanel.cs index 21f4781..a0f4310 100644 --- a/Editor/Core/SplashControlPanel.cs +++ b/Editor/Core/SplashControlPanel.cs @@ -547,7 +547,7 @@ private void DrawToolchainSection() GUILayout.FlexibleSpace(); if (_hasPsxavenc) { - PSXEditorStyles.DrawStatusBadge("Installed", PSXEditorStyles.Success); + PSXEditorStyles.DrawStatusBadge("Ready", PSXEditorStyles.Success); } else if (!_hasPsxavencDeps && Application.platform == RuntimePlatform.OSXEditor) { @@ -581,7 +581,7 @@ private void DrawToolchainSection() } else { - PSXEditorStyles.DrawStatusBadge("Installed", PSXEditorStyles.Success); + PSXEditorStyles.DrawStatusBadge("Ready", PSXEditorStyles.Success); } EditorGUILayout.EndHorizontal(); @@ -2644,7 +2644,7 @@ private void RefreshToolchainStatus() string reduxBin = SplashSettings.PCSXReduxPath; _hasRedux = !string.IsNullOrEmpty(reduxBin) && File.Exists(reduxBin); - _reduxVersion = _hasRedux ? "Installed" : ""; + _reduxVersion = _hasRedux ? "Ready" : ""; _hasPsxavenc = PSXAudioConverter.IsInstalled(); From 91dfd33773ac4ba047fe6d0490edbcb9d01e7e8c Mon Sep 17 00:00:00 2001 From: "Pasquale \"Pasqui industry\" Pignataro" Date: Fri, 2 Oct 2026 00:07:50 +0200 Subject: [PATCH 4/4] Added better support for Unity 6000.5+ without dropping support for older versions --- Editor/PSXTilemapPreview.cs | 44 +++++++++++++++++++++++++++- Editor/Timeline/PSXTimelineWindow.cs | 14 +++++++++ RFC.md.meta | 7 ----- Runtime/PSXObjectExporter.cs | 14 ++++++++- Runtime/TexturePacker.cs | 14 +++++++-- 5 files changed, 82 insertions(+), 11 deletions(-) delete mode 100644 RFC.md.meta diff --git a/Editor/PSXTilemapPreview.cs b/Editor/PSXTilemapPreview.cs index 440d008..4bf9200 100644 --- a/Editor/PSXTilemapPreview.cs +++ b/Editor/PSXTilemapPreview.cs @@ -50,9 +50,18 @@ private class Entry public Mesh Mesh; public int Hash; public Texture2D Texture; + +#if UNITY_6000_4_OR_NEWER + public EntityId TilesetEntityId; +#endif + } +#if UNITY_6000_4_OR_NEWER + private static readonly Dictionary s_cache = new Dictionary(); +#else private static readonly Dictionary s_cache = new Dictionary(); +#endif private static Material s_material; /// Throw away every cached mesh (the painter calls this). @@ -80,7 +89,40 @@ private static Material PreviewMaterial() s_material = new Material(shader) { hideFlags = HideFlags.HideAndDontSave }; return s_material; } +#if UNITY_6000_4_OR_NEWER + private static int ContentHash(PSXTilemap map) + { + unchecked + { + int h = 17; + h = h * 31 + map.Width; + h = h * 31 + map.Height; + h = h * 31 + (map.Tileset != null ? map.Tileset.CellWidth * 397 + map.Tileset.CellHeight : 0); + foreach (var b in map.Brushes) h = h * 31 + b.tilesetCell * 7 + (b.walkable ? 1 : 0); + for (int y = 0; y < map.Height; y++) + for (int x = 0; x < map.Width; x++) + h = h * 31 + map.GetCell(x, y); + return h; + } + } + + /// The cached world-space mesh for a map, rebuilt when it changes. + public static Mesh MeshFor(PSXTilemap map) + { + if (map == null || map.Tileset == null || map.Tileset.SourceTexture == null) return null; + EntityId key = map.GetEntityId(); + EntityId tilesetEntityId = map.Tileset.GetEntityId(); + int hash = ContentHash(map); + if (s_cache.TryGetValue(key, out Entry e) && e.Mesh != null && e.Hash == hash && e.TilesetEntityId == tilesetEntityId) + return e.Mesh; + + if (e != null && e.Mesh != null) Object.DestroyImmediate(e.Mesh); + e = new Entry { Hash = hash, Texture = map.Tileset.SourceTexture, Mesh = BuildMesh(map), TilesetEntityId = tilesetEntityId }; + s_cache[key] = e; + return e.Mesh; + } +#else private static int ContentHash(PSXTilemap map) { unchecked @@ -113,7 +155,7 @@ public static Mesh MeshFor(PSXTilemap map) s_cache[key] = e; return e.Mesh; } - +#endif private static Mesh BuildMesh(PSXTilemap map) { PSXSpriteSheet set = map.Tileset; diff --git a/Editor/Timeline/PSXTimelineWindow.cs b/Editor/Timeline/PSXTimelineWindow.cs index 384e036..b254ae1 100644 --- a/Editor/Timeline/PSXTimelineWindow.cs +++ b/Editor/Timeline/PSXTimelineWindow.cs @@ -41,6 +41,7 @@ public static void Open(ScriptableObject clip) window.Focus(); } +#if UNITY_6000_4_OR_NEWER [OnOpenAsset] public static bool OnOpenAsset(EntityId instanceID, int line) { @@ -52,6 +53,19 @@ public static bool OnOpenAsset(EntityId instanceID, int line) } return false; } +#else + [OnOpenAsset] + public static bool OnOpenAsset(int instanceID, int line) + { + var obj = EditorUtility.InstanceIDToObject(instanceID); + if (obj is PSXAnimationClip || obj is PSXCutsceneClip) + { + Open((ScriptableObject)obj); + return true; + } + return false; + } +#endif private void OnEnable() { diff --git a/RFC.md.meta b/RFC.md.meta deleted file mode 100644 index 978adf4..0000000 --- a/RFC.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: d4e353987b434e8ab73e3aa6f0c737ab -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/PSXObjectExporter.cs b/Runtime/PSXObjectExporter.cs index adfb079..f29e21d 100644 --- a/Runtime/PSXObjectExporter.cs +++ b/Runtime/PSXObjectExporter.cs @@ -27,7 +27,7 @@ public class PSXObjectExporter : MonoBehaviour, IPSXExportable public LuaFile LuaFile => luaFile; [FormerlySerializedAs("IsActive")] - [SerializeField] private bool isActive = true; + [SerializeField] private bool isActive = true; public bool IsActive => isActive; public List Textures { get; set; } = new List(); @@ -58,7 +58,11 @@ public class PSXObjectExporter : MonoBehaviour, IPSXExportable public bool IsPlatform => isPlatform; public int UVOffsetMaterial => uvOffsetMaterial; +#if UNITY_6000_4_OR_NEWER private readonly Dictionary<(EntityId, PSXBPP), PSXTexture2D> cache = new(); +#else + private readonly Dictionary<(int, PSXBPP), PSXTexture2D> cache = new(); +#endif public void CreatePSXTextures2D() { @@ -78,7 +82,11 @@ public void CreatePSXTextures2D() if (tex2D == null) continue; +#if UNITY_6000_4_OR_NEWER if (cache.TryGetValue((tex2D.GetEntityId(), bitDepth), out var cached)) +#else + if (cache.TryGetValue((tex2D.GetInstanceID(), bitDepth), out var cached)) +#endif { Textures.Add(cached); } @@ -86,7 +94,11 @@ public void CreatePSXTextures2D() { var tex = PSXTexture2D.CreateFromTexture2D(tex2D, bitDepth); tex.OriginalTexture = tex2D; +#if UNITY_6000_4_OR_NEWER + cache.Add((tex2D.GetEntityId(), bitDepth), tex); +#else cache.Add((tex2D.GetInstanceID(), bitDepth), tex); +#endif Textures.Add(tex); } } diff --git a/Runtime/TexturePacker.cs b/Runtime/TexturePacker.cs index 8891e3d..ac690ae 100644 --- a/Runtime/TexturePacker.cs +++ b/Runtime/TexturePacker.cs @@ -87,7 +87,11 @@ public VRAMPacker(List framebuffers, List reservedAreas) List uniqueTextures = new List(); // Cutout is part of the key: the same source quantized with and without it // gives different pixels, so the two must not be merged. +#if UNITY_6000_4_OR_NEWER Dictionary<(EntityId, PSXBPP, bool), int> textureToIndexMap = new Dictionary<(EntityId, PSXBPP, bool), int>(); +#else + Dictionary<(int, PSXBPP, bool), int> textureToIndexMap = new Dictionary<(int, PSXBPP, bool), int>(); +#endif // Track duplicates so we can propagate packing data after placement List<(PSXTexture2D duplicate, int uniqueIndex)> duplicates = new List<(PSXTexture2D, int)>(); @@ -115,8 +119,11 @@ public VRAMPacker(List framebuffers, List reservedAreas) // Process each texture in descending order of area. foreach (var texture in group.OrderByDescending(tex => tex.QuantizedWidth * tex.Height)) { +#if UNITY_6000_4_OR_NEWER var textureKey = (texture.OriginalTexture.GetEntityId(), texture.BitDepth, texture.Cutout); - +#else + var textureKey = (texture.OriginalTexture.GetInstanceID(), texture.BitDepth, texture.Cutout); +#endif // Check if we've already processed this texture if (textureToIndexMap.TryGetValue(textureKey, out int existingIndex)) { @@ -154,8 +161,11 @@ public VRAMPacker(List framebuffers, List reservedAreas) for (int i = 0; i < obj.Textures.Count; i++) { - +#if UNITY_6000_4_OR_NEWER var textureKey = (obj.Textures[i].OriginalTexture.GetEntityId(), obj.Textures[i].BitDepth, obj.Textures[i].Cutout); +#else + var textureKey = (obj.Textures[i].OriginalTexture.GetInstanceID(), obj.Textures[i].BitDepth, obj.Textures[i].Cutout); +#endif if (textureToIndexMap.TryGetValue(textureKey, out int newIndex)) { oldToNewIndexMap[i] = newIndex;