From 32748c28da5055c73f39ae508bd2045dbc7f1bb4 Mon Sep 17 00:00:00 2001 From: JC Snider Date: Sun, 30 Nov 2025 11:02:13 -0500 Subject: [PATCH 1/4] Normalizes Windows file paths to use forward slashes when loading graphic assets. --- .../MonoGame/File Management/MonoContentManager.cs | 5 +++-- Intersect.Client.Framework/Graphics/AtlasReference.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs b/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs index bcd691f329..30d807d907 100644 --- a/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs +++ b/Intersect.Client.Core/MonoGame/File Management/MonoContentManager.cs @@ -54,15 +54,16 @@ public override void LoadTilesets(string[] tilesetnames) foreach (var t in tilesetnames) { var realFilename = tilesetFiles.FirstOrDefault(file => t.Equals(file, StringComparison.InvariantCultureIgnoreCase)) ?? t; + var assetName = Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()).Replace('\\', '/'); if (!string.IsNullOrWhiteSpace(t) && (!string.IsNullOrWhiteSpace(realFilename) || - AtlasReference.TryGet(Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()), out _) != null) && + AtlasReference.TryGet(assetName, out _)) && !mTilesetDict.ContainsKey(t.ToLower())) { mTilesetDict.Add( t.ToLower(), Core.Graphics.Renderer.LoadTexture( - Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t), + assetName, Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", realFilename) ) ); diff --git a/Intersect.Client.Framework/Graphics/AtlasReference.cs b/Intersect.Client.Framework/Graphics/AtlasReference.cs index 31e5563bdd..8a704aa639 100644 --- a/Intersect.Client.Framework/Graphics/AtlasReference.cs +++ b/Intersect.Client.Framework/Graphics/AtlasReference.cs @@ -61,7 +61,8 @@ public static AtlasReference[] GetAllFor(string folderName) public static bool TryGet(string assetName, [NotNullWhen(true)] out AtlasReference? atlasReference) { - return _atlasReferences.TryGetValue(assetName, out atlasReference) || - _atlasReferences.TryGetValue(assetName.ToLowerInvariant(), out atlasReference); + var normalizedAssetName = assetName.Replace('\\', '/'); + return _atlasReferences.TryGetValue(normalizedAssetName, out atlasReference) || + _atlasReferences.TryGetValue(normalizedAssetName.ToLowerInvariant(), out atlasReference); } } \ No newline at end of file From 4e222d46977d7a44b4a10e1c811e6706c53dd701 Mon Sep 17 00:00:00 2001 From: JC Snider Date: Sun, 30 Nov 2025 11:02:42 -0500 Subject: [PATCH 2/4] Fixes width/height calculation for packed graphics by accounting for the source graphic width/height and if the graphic is rotated in the pack --- .../MonoGame/Graphics/MonoRenderer.Texture.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs b/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs index c36bf3d4c4..f76f5b72ff 100644 --- a/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs +++ b/Intersect.Client.Core/MonoGame/Graphics/MonoRenderer.Texture.cs @@ -148,9 +148,13 @@ AtlasReference atlasReference { } - public override int Width => PlatformTexture?.Width ?? 0; + public override int Width => AtlasReference?.IsRotated == true + ? AtlasReference.Bounds.Height + : AtlasReference?.Bounds.Width ?? PlatformTexture?.Width ?? 0; - public override int Height => PlatformTexture?.Height ?? 0; + public override int Height => AtlasReference?.IsRotated == true + ? AtlasReference.Bounds.Width + : AtlasReference?.Bounds.Height ?? PlatformTexture?.Height ?? 0; protected override Texture2D? CreatePlatformTextureFromStream(Stream stream) { From 9c5a29add1f0f7c6162bf0aea8880cb459999682 Mon Sep 17 00:00:00 2001 From: JC Snider Date: Sun, 30 Nov 2025 11:03:11 -0500 Subject: [PATCH 3/4] Triggers loaded event when packed textures are loaded which is needed for UI rendering --- Intersect.Client.Framework/Graphics/GameTexture.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Intersect.Client.Framework/Graphics/GameTexture.cs b/Intersect.Client.Framework/Graphics/GameTexture.cs index 2fd9cd8551..c16e5f7ffd 100644 --- a/Intersect.Client.Framework/Graphics/GameTexture.cs +++ b/Intersect.Client.Framework/Graphics/GameTexture.cs @@ -257,6 +257,12 @@ private void LoadPlatformTexture(bool force = false) } atlasTexture.LoadPlatformTexture(force); + IsMissingOrCorrupt = atlasTexture.IsMissingOrCorrupt; + if (!IsMissingOrCorrupt) + { + UpdateAccessTime(); + EmitLoaded(); + } return; } From 8080bca8b688ee5fc0fa2a3257e79dea6b1e5f5a Mon Sep 17 00:00:00 2001 From: JC Snider Date: Sun, 30 Nov 2025 11:03:29 -0500 Subject: [PATCH 4/4] Fix a NRE in the UI if textures do not load --- Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs b/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs index 29f7184e94..d7b1d1180c 100644 --- a/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs +++ b/Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs @@ -1,4 +1,4 @@ -using Intersect.Client.Framework.GenericClasses; +using Intersect.Client.Framework.GenericClasses; using Intersect.Client.Framework.Graphics; namespace Intersect.Client.Framework.Gwen.Skin.Texturing; @@ -185,7 +185,7 @@ public void Draw(Renderer.Base render, Rectangle r, Color col) public bool Equals(Bordered other) { - return _texture.Equals(other._texture) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height); + return (_texture?.Equals(other._texture) ?? false) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height); } public override bool Equals(object? obj)