Skip to content

Commit 68f731f

Browse files
committed
fixed lag and crash bug from using wrong texture in config
1 parent b4ff6fb commit 68f731f

4 files changed

Lines changed: 27 additions & 5 deletions

File tree

MiniMapLibrary/Sprites/SpriteManager.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ public sealed class SpriteManager : IDisposable, ISpriteManager
1212
{
1313
private readonly Dictionary<string, Sprite> SpriteCache = new Dictionary<string, Sprite>();
1414

15+
private readonly ILogger logger;
16+
17+
public SpriteManager(ILogger logger)
18+
{
19+
this.logger = logger;
20+
}
21+
1522
public void Dispose()
1623
{
1724
SpriteCache.Clear();
@@ -49,7 +56,15 @@ public void Dispose()
4956
}
5057
else
5158
{
52-
throw new MissingComponentException($"MissingTextureException: {Path} does not exist within the streaming assets");
59+
loaded = Resources.Load<Sprite>(Settings.Icons.Default);
60+
61+
if (loaded is null)
62+
{
63+
logger.LogError($"Attempted to use default icon for non-existen texture at {Path} but default icon path of {Settings.Icons.Default} also failed to load from the streaming assets path.");
64+
return null;
65+
}
66+
67+
SpriteCache.Add(Path, loaded);
5368
}
5469

5570
return loaded;

MiniMapMod/MiniMapPlugin.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
namespace MiniMapMod
1414
{
15-
[BepInPlugin("MiniMap", "Mini Map Mod", "3.2.0")]
15+
[BepInPlugin("MiniMap", "Mini Map Mod", "3.2.1")]
1616
public class MiniMapPlugin : BaseUnityPlugin
1717
{
18-
private readonly ISpriteManager SpriteManager = new SpriteManager();
18+
private ISpriteManager SpriteManager;
1919

2020
private readonly List<ITrackedObject> TrackedObjects = new();
2121

@@ -40,6 +40,8 @@ public void Awake()
4040
// we can pass it to the business layer
4141
logger = new Log(base.Logger);
4242

43+
SpriteManager = new SpriteManager(logger);
44+
4345
// create the minimap controller
4446
Minimap = new(logger);
4547

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,19 @@ Huge thanks to these awesome people who assisted in creating awesome features fo
7676
[Arcafanetiz](https://github.com/Arcafanetiz)
7777

7878
### Change Log
79+
Minor 3.2.1
80+
- fixed bug where chosing wrong icon path in config would lag and crash game with MissingTextureExceptions thrown by `SpriteManager.GetOrCache`
81+
7982
Major 3.2
80-
- Re-implemented scanning framework for performance
83+
- Re-implemented entire scanning framework for performance to allow more dynamic types at runtime
8184
- Added Equipment Barrels
8285
- Added Shops
8386
- Added Void Enemies
87+
- Added Lunar Enemies
8488
- Added Players (non-client)
8589
- Added Allies (drones that have been bought)
8690
- Added Dropped Items / Lunar Coins
91+
- Fixed bug where the no meaningful stacktrace was being outputted to the log for user debugging
8792

8893
Hotfix 3.1.6
8994
- fixed typo causing all objects on map being selected to be placed on minimap regardless if they were filtered out

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MiniMapMod",
3-
"version_number": "3.2.0",
3+
"version_number": "3.2.1",
44
"website_url": "https://github.com/DekuDesu",
55
"description": "Adds a MiniMap to your game v3.2",
66
"dependencies": [

0 commit comments

Comments
 (0)