Merge branch 'v1-dev' of https://github.com/hykilpikonna/AquaDX into v1-dev

pull/88/head
Azalea 2024-11-21 12:12:09 -05:00
commit bbb4185fac
2 changed files with 76 additions and 80 deletions

View File

@ -68,7 +68,7 @@ public class BasicFix
ServicePointManager.ServerCertificateValidationCallback = null; ServicePointManager.ServerCertificateValidationCallback = null;
} }
[HarmonyPostfix] [HarmonyPrefix]
[HarmonyPatch(typeof(MAI2System.Config), "IsTarget", MethodType.Getter)] [HarmonyPatch(typeof(MAI2System.Config), "IsTarget", MethodType.Getter)]
private static bool ForceNonTarget(ref bool __result) private static bool ForceNonTarget(ref bool __result)
{ {
@ -77,7 +77,7 @@ public class BasicFix
return false; return false;
} }
[HarmonyPostfix] [HarmonyPrefix]
[HarmonyPatch(typeof(MAI2System.Config), "IsIgnoreError", MethodType.Getter)] [HarmonyPatch(typeof(MAI2System.Config), "IsIgnoreError", MethodType.Getter)]
private static bool ForceIgnoreError(ref bool __result) private static bool ForceIgnoreError(ref bool __result)
{ {

View File

@ -24,7 +24,9 @@ public class LoadAssetsPng
private static Dictionary<string, string> framepatternPaths = new(); private static Dictionary<string, string> framepatternPaths = new();
private static Dictionary<string, string> iconPaths = new(); private static Dictionary<string, string> iconPaths = new();
private static Dictionary<string, string> charaPaths = new(); private static Dictionary<string, string> charaPaths = new();
private static Dictionary<string, string> partnerPaths = new(); private static Dictionary<string, string> partnerPaths = new();
//private static Dictionary<string, string> navicharaPaths = new(); //private static Dictionary<string, string> navicharaPaths = new();
private static Dictionary<string, string> tabTitlePaths = new(); private static Dictionary<string, string> tabTitlePaths = new();
private static Dictionary<string, string> localAssetsContents = new(); private static Dictionary<string, string> localAssetsContents = new();
@ -166,6 +168,7 @@ public class LoadAssetsPng
texture.LoadImage(File.ReadAllBytes(path)); texture.LoadImage(File.ReadAllBytes(path));
return texture; return texture;
} }
private static string GetPlatePath(string id) private static string GetPlatePath(string id)
{ {
return platePaths.GetValueOrDefault(id); return platePaths.GetValueOrDefault(id);
@ -219,6 +222,7 @@ public class LoadAssetsPng
texture.LoadImage(File.ReadAllBytes(path)); texture.LoadImage(File.ReadAllBytes(path));
return texture; return texture;
} }
private static string GetIconPath(string id) private static string GetIconPath(string id)
{ {
return iconPaths.GetValueOrDefault(id); return iconPaths.GetValueOrDefault(id);
@ -236,6 +240,7 @@ public class LoadAssetsPng
texture.LoadImage(File.ReadAllBytes(path)); texture.LoadImage(File.ReadAllBytes(path));
return texture; return texture;
} }
private static string GetCharaPath(string id) private static string GetCharaPath(string id)
{ {
return charaPaths.GetValueOrDefault(id); return charaPaths.GetValueOrDefault(id);
@ -253,6 +258,7 @@ public class LoadAssetsPng
texture.LoadImage(File.ReadAllBytes(path)); texture.LoadImage(File.ReadAllBytes(path));
return texture; return texture;
} }
private static string GetPartnerPath(string id) private static string GetPartnerPath(string id)
{ {
return partnerPaths.GetValueOrDefault(id); return partnerPaths.GetValueOrDefault(id);
@ -466,34 +472,24 @@ public class LoadAssetsPng
} }
} }
[HarmonyPatch] // Private | Instance
public static class IconLoader [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); return true;
var method = AM.GetMethod("GetIconTexture2D", new[] { typeof(string) });
if (method != null)
{
yield return method;
}
} }
public static bool Prefix(string filename, ref Texture2D __result, AssetManager __instance) MelonLogger.Msg(filename);
{ var id = matches[0].Groups[1].Value;
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;
var texture = GetIconTexture2D(id); var texture = GetIconTexture2D(id);
__result = texture ?? __instance.LoadAsset<Texture2D>($"Icon/UI_Icon_{id}.png"); __result = texture ?? __instance.LoadAsset<Texture2D>($"Icon/UI_Icon_{id}.png");
return false; return false;
}
} }
[HarmonyPatch] [HarmonyPatch]