mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-10-25 20:12:39 +00:00
[+] Load jacket with higher resolution
This commit is contained in:
parent
0f701ad2d3
commit
8b72214780
@ -15,10 +15,10 @@ namespace AquaMai.UX
|
|||||||
public static IEnumerable<MethodBase> TargetMethods()
|
public static IEnumerable<MethodBase> TargetMethods()
|
||||||
{
|
{
|
||||||
var AM = typeof(AssetManager);
|
var AM = typeof(AssetManager);
|
||||||
return new[] { AM.GetMethod("GetJacketThumbTexture2D", new []{typeof(string)}), AM.GetMethod("GetJacketTexture2D", new []{typeof(string)}) };
|
return new[] { AM.GetMethod("GetJacketThumbTexture2D", new[] { typeof(string) }), AM.GetMethod("GetJacketTexture2D", new[] { typeof(string) }) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Prefix(string filename, ref Texture2D __result)
|
public static bool Prefix(string filename, ref Texture2D __result, AssetManager __instance)
|
||||||
{
|
{
|
||||||
var matches = Regex.Matches(filename, @"UI_Jacket_(\d+)(_s)?\.png");
|
var matches = Regex.Matches(filename, @"UI_Jacket_(\d+)(_s)?\.png");
|
||||||
if (matches.Count < 1)
|
if (matches.Count < 1)
|
||||||
@ -27,21 +27,26 @@ namespace AquaMai.UX
|
|||||||
}
|
}
|
||||||
|
|
||||||
var id = matches[0].Groups[1].Value;
|
var id = matches[0].Groups[1].Value;
|
||||||
foreach (var ext in new []{".jpg",".png",".webp",".bmp",".gif"})
|
foreach (var ext in new[] { ".jpg", ".png", ".webp", ".bmp", ".gif" })
|
||||||
{
|
{
|
||||||
if (File.Exists(Path.Combine(Environment.CurrentDirectory, "LocalAssets", id + ext)))
|
if (File.Exists(Path.Combine(Environment.CurrentDirectory, "LocalAssets", id + ext)))
|
||||||
{
|
{
|
||||||
filename = id + ext;
|
filename = id + ext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var localPath = Path.Combine(Environment.CurrentDirectory, "LocalAssets", filename);
|
var localPath = Path.Combine(Environment.CurrentDirectory, "LocalAssets", filename);
|
||||||
if (!File.Exists(localPath)) return true;
|
if (File.Exists(localPath))
|
||||||
|
{
|
||||||
__result = new Texture2D(1, 1);
|
__result = new Texture2D(1, 1);
|
||||||
ImageConversion.LoadImage(__result, File.ReadAllBytes(localPath));
|
ImageConversion.LoadImage(__result, File.ReadAllBytes(localPath));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__result = __instance.LoadAsset<Texture2D>($"Jacket/UI_Jacket_{id}.png");
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user