mirror of https://github.com/hykilpikonna/AquaDX
Merge branch 'v1-dev' of https://github.com/hykilpikonna/AquaDX into v1-dev
commit
bbb4185fac
|
@ -68,7 +68,7 @@ public class BasicFix
|
|||
ServicePointManager.ServerCertificateValidationCallback = null;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MAI2System.Config), "IsTarget", MethodType.Getter)]
|
||||
private static bool ForceNonTarget(ref bool __result)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public class BasicFix
|
|||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MAI2System.Config), "IsIgnoreError", MethodType.Getter)]
|
||||
private static bool ForceIgnoreError(ref bool __result)
|
||||
{
|
||||
|
|
|
@ -17,14 +17,16 @@ namespace AquaMai.UX;
|
|||
public class LoadAssetsPng
|
||||
{
|
||||
private static string[] imageExts = [".jpg", ".png", ".jpeg"];
|
||||
private static Dictionary<string, string> jacketPaths = new();
|
||||
private static Dictionary<string, string> framePaths = new();
|
||||
private static Dictionary<string, string> platePaths = new();
|
||||
private static Dictionary<string, string> framemaskPaths = new();
|
||||
private static Dictionary<string, string> framepatternPaths = new();
|
||||
private static Dictionary<string, string> iconPaths = new();
|
||||
private static Dictionary<string, string> charaPaths = new();
|
||||
private static Dictionary<string, string> partnerPaths = new();
|
||||
private static Dictionary<string, string> jacketPaths = new();
|
||||
private static Dictionary<string, string> framePaths = new();
|
||||
private static Dictionary<string, string> platePaths = new();
|
||||
private static Dictionary<string, string> framemaskPaths = new();
|
||||
private static Dictionary<string, string> framepatternPaths = new();
|
||||
private static Dictionary<string, string> iconPaths = new();
|
||||
private static Dictionary<string, string> charaPaths = new();
|
||||
|
||||
private static Dictionary<string, string> partnerPaths = new();
|
||||
|
||||
//private static Dictionary<string, string> navicharaPaths = new();
|
||||
private static Dictionary<string, string> tabTitlePaths = new();
|
||||
private static Dictionary<string, string> localAssetsContents = new();
|
||||
|
@ -41,24 +43,24 @@ public class LoadAssetsPng
|
|||
if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
var idStr = Path.GetFileName(file).Substring("ui_jacket_".Length, 6);
|
||||
jacketPaths[idStr] = file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\frame")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\frame")))
|
||||
{
|
||||
if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
var idStr = Path.GetFileName(file).Substring("ui_frame_".Length, 6);
|
||||
framePaths[idStr] = file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\nameplate")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\nameplate")))
|
||||
{
|
||||
if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
var idStr = Path.GetFileName(file).Substring("ui_plate_".Length, 6);
|
||||
platePaths[idStr] = file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\framemask")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\framemask")))
|
||||
{
|
||||
|
@ -66,7 +68,7 @@ public class LoadAssetsPng
|
|||
var idStr = Path.GetFileName(file).Substring("ui_framemask_".Length, 6);
|
||||
framemaskPaths[idStr] = file;
|
||||
}
|
||||
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\framepattern")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\framepattern")))
|
||||
{
|
||||
|
@ -74,7 +76,7 @@ public class LoadAssetsPng
|
|||
var idStr = Path.GetFileName(file).Substring("ui_framepattern_".Length, 6);
|
||||
framepatternPaths[idStr] = file;
|
||||
}
|
||||
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\icon")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\icon")))
|
||||
{
|
||||
|
@ -82,30 +84,30 @@ public class LoadAssetsPng
|
|||
var idStr = Path.GetFileName(file).Substring("ui_icon_".Length, 6);
|
||||
iconPaths[idStr] = file;
|
||||
}
|
||||
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\chara")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\chara")))
|
||||
{
|
||||
if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
var idStr = Path.GetFileName(file).Substring("ui_chara_".Length, 6);
|
||||
charaPaths[idStr] = file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\partner")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\partner")))
|
||||
{
|
||||
if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
var idStr = Path.GetFileName(file).Substring("ui_Partner_".Length, 6);
|
||||
partnerPaths[idStr] = file;
|
||||
}
|
||||
//if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\navichara\sprite\parts\ui_navichara_21")))
|
||||
// foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\navichara\sprite\parts\ui_navichara_", charaid)))
|
||||
//{
|
||||
// if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
//var idStr = Path.GetFileName(file).Substring("ui_navichara_".Length, 6);
|
||||
// navicharaPaths[idStr] = file;
|
||||
// }
|
||||
|
||||
}
|
||||
//if (Directory.Exists(Path.Combine(aDir, @"AssetBundleImages\navichara\sprite\parts\ui_navichara_21")))
|
||||
// foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"AssetBundleImages\navichara\sprite\parts\ui_navichara_", charaid)))
|
||||
//{
|
||||
// if (!imageExts.Contains(Path.GetExtension(file).ToLowerInvariant())) continue;
|
||||
//var idStr = Path.GetFileName(file).Substring("ui_navichara_".Length, 6);
|
||||
// navicharaPaths[idStr] = file;
|
||||
// }
|
||||
|
||||
if (Directory.Exists(Path.Combine(aDir, @"Common\Sprites\Tab\Title")))
|
||||
foreach (var file in Directory.GetFiles(Path.Combine(aDir, @"Common\Sprites\Tab\Title")))
|
||||
{
|
||||
|
@ -147,8 +149,8 @@ public class LoadAssetsPng
|
|||
public static Texture2D GetJacketTexture2D(int id)
|
||||
{
|
||||
return GetJacketTexture2D($"{id:000000}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static string GetFramePath(string id)
|
||||
{
|
||||
return framePaths.GetValueOrDefault(id);
|
||||
|
@ -165,7 +167,8 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetPlatePath(string id)
|
||||
{
|
||||
return platePaths.GetValueOrDefault(id);
|
||||
|
@ -182,8 +185,8 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static string GetFrameMaskPath(string id)
|
||||
{
|
||||
return framemaskPaths.GetValueOrDefault(id);
|
||||
|
@ -200,8 +203,8 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static string GetFramePatternPath(string id)
|
||||
{
|
||||
return framepatternPaths.GetValueOrDefault(id);
|
||||
|
@ -218,7 +221,8 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetIconPath(string id)
|
||||
{
|
||||
return iconPaths.GetValueOrDefault(id);
|
||||
|
@ -235,7 +239,8 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetCharaPath(string id)
|
||||
{
|
||||
return charaPaths.GetValueOrDefault(id);
|
||||
|
@ -252,12 +257,13 @@ public class LoadAssetsPng
|
|||
var texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
|
||||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetPartnerPath(string id)
|
||||
{
|
||||
return partnerPaths.GetValueOrDefault(id);
|
||||
}
|
||||
|
||||
|
||||
public static Texture2D GetPartnerTexture2D(string id)
|
||||
{
|
||||
var path = GetPartnerPath(id);
|
||||
|
@ -360,8 +366,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class FrameLoader
|
||||
{
|
||||
|
@ -386,8 +392,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class PlateLoader
|
||||
{
|
||||
|
@ -412,8 +418,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class FrameMaskLoader
|
||||
{
|
||||
|
@ -438,8 +444,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class FramePatternLoader
|
||||
{
|
||||
|
@ -464,38 +470,28 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class IconLoader
|
||||
}
|
||||
|
||||
// Private | Instance
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AssetManager), "GetIconTexture2D", typeof(string))]
|
||||
public static bool IconLoader(string filename, ref Texture2D __result, AssetManager __instance)
|
||||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
var matches = Regex.Matches(filename, @"UI_Icon_(\d+)\.png");
|
||||
if (matches.Count < 1)
|
||||
{
|
||||
var AM = typeof(AssetManager);
|
||||
var method = AM.GetMethod("GetIconTexture2D", new[] { typeof(string) });
|
||||
if (method != null)
|
||||
{
|
||||
yield return method;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Prefix(string filename, ref Texture2D __result, AssetManager __instance)
|
||||
{
|
||||
var matches = Regex.Matches(filename, @"UI_Icon_(\d+)\.png");
|
||||
if (matches.Count < 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
MelonLogger.Msg(filename);
|
||||
var id = matches[0].Groups[1].Value;
|
||||
MelonLogger.Msg(filename);
|
||||
var id = matches[0].Groups[1].Value;
|
||||
|
||||
var texture = GetIconTexture2D(id);
|
||||
__result = texture ?? __instance.LoadAsset<Texture2D>($"Icon/UI_Icon_{id}.png");
|
||||
var texture = GetIconTexture2D(id);
|
||||
__result = texture ?? __instance.LoadAsset<Texture2D>($"Icon/UI_Icon_{id}.png");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class CharaLoader
|
||||
{
|
||||
|
@ -520,8 +516,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class PartnerLoader
|
||||
{
|
||||
|
@ -546,8 +542,8 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
}
|
||||
/*
|
||||
[HarmonyPatch]
|
||||
public static class FrameLoader
|
||||
{
|
||||
|
@ -574,4 +570,4 @@ public class LoadAssetsPng
|
|||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue