diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index 452e1630..b5684bb3 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -270,6 +270,7 @@
+
diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml
index 4e3816fe..287f97fd 100644
--- a/AquaMai/AquaMai.toml
+++ b/AquaMai/AquaMai.toml
@@ -16,6 +16,8 @@ SinglePlayer=true
SkipToMusicSelection=false
# Set the version string displayed at the top-right corner of the screen
CustomVersionString=""
+# Load Jacket image from folder "LocalAssets" and filename "{MusicID}.png" for self-made charts
+LoadJacketPng=true
[Performance]
# Disable some useless checks and delays to speed up the game boot process
diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs
index 3a4d39fc..d49bd727 100644
--- a/AquaMai/Config.cs
+++ b/AquaMai/Config.cs
@@ -19,6 +19,7 @@ namespace AquaMai
public bool SkipWarningScreen { get; set; }
public bool SinglePlayer { get; set; }
public bool SkipToMusicSelection { get; set; }
+ public bool LoadJacketPng { get; set; }
public string CustomVersionString { get; set; }
}
diff --git a/AquaMai/UX/LoadJacketPng.cs b/AquaMai/UX/LoadJacketPng.cs
new file mode 100644
index 00000000..cc9603d4
--- /dev/null
+++ b/AquaMai/UX/LoadJacketPng.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using HarmonyLib;
+using UnityEngine;
+using System.Text.RegularExpressions;
+using MelonLoader;
+
+namespace AquaMai.UX
+{
+ [HarmonyPatch]
+ public class LoadJacketPng
+ {
+ public static IEnumerable TargetMethods()
+ {
+ var AM = typeof(AssetManager);
+ return new[] { AM.GetMethod("GetJacketThumbTexture2D", new []{typeof(string)}), AM.GetMethod("GetJacketTexture2D", new []{typeof(string)}) };
+ }
+
+ public static bool Prefix(string filename, ref Texture2D __result)
+ {
+ var matches = Regex.Matches(filename, @"UI_Jacket_(\d+)(_s)?\.png");
+ if (matches.Count < 1)
+ {
+ return true;
+ }
+
+ var id = matches[0].Groups[1].Value;
+ foreach (var ext in new []{".jpg",".png",".webp",".bmp",".gif"})
+ {
+ if (File.Exists(Path.Combine(Environment.CurrentDirectory, "LocalAssets", id + ext)))
+ {
+ filename = id + ext;
+ }
+ }
+
+ var localPath = Path.Combine(Environment.CurrentDirectory, "LocalAssets", filename);
+ if (!File.Exists(localPath)) return true;
+
+ __result = new Texture2D(1, 1);
+ ImageConversion.LoadImage(__result, File.ReadAllBytes(localPath));
+ return false;
+ }
+
+ }
+}
\ No newline at end of file