-
Notifications
You must be signed in to change notification settings - Fork 114
fix(wrapper): 更换老旧的 RetroWrapper 到 LegacyFix #3159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
9960a5a
932c3c0
b8d41d3
636400f
11ecdf3
b677e7e
900725a
dceb6ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -515,9 +515,9 @@ partial class HideConfigGroup | |
| [ConfigItem<bool>("LaunchAdvanceDisableJLW", true, ConfigSource.Local)] public partial bool DisableJlw { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 禁用 Retro Wrapper | ||
| /// 禁用 LegacyFix | ||
| /// </summary> | ||
| [ConfigItem<bool>("LaunchAdvanceDisableRW", false, ConfigSource.Local)] public partial bool DisableRw { get; set; } | ||
| [ConfigItem<bool>("LaunchAdvanceDisableLF", false, ConfigSource.Local)] public partial bool DisableLF { get; set; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When upgrading a profile where Useful? React with 👍 / 👎. |
||
|
|
||
| /// <summary> | ||
| /// 强制使用高性能显卡。 | ||
|
sourcery-ai[bot] marked this conversation as resolved.
|
||
|
|
@@ -614,7 +614,7 @@ partial class HideConfigGroup | |
| [ConfigItem<bool>("VersionAdvanceDisableJLW", false)] public partial ArgConfig<bool> DisableJlw { get; } | ||
| [ConfigItem<bool>("VersionAdvanceDisableLwjglUnsafeAgent", false)] public partial ArgConfig<bool> DisableLwjglUnsafeAgent { get; } | ||
| [ConfigItem<bool>("VersionAdvanceUseProxyV2", false)] public partial ArgConfig<bool> UseProxy { get; } | ||
| [ConfigItem<bool>("VersionAdvanceDisableRW", false)] public partial ArgConfig<bool> DisableRw { get; } | ||
| [ConfigItem<bool>("VersionAdvanceDisableLF", false)] public partial ArgConfig<bool> DisableLF { get; } | ||
| [ConfigItem<bool>("VersionUseDebugLog4j2Config", false)] public partial ArgConfig<bool> UseDebugLof4j2Config { get; } | ||
| [ConfigItem<int>("VersionRamType", 2)] public partial ArgConfig<int> MemorySolution { get; } | ||
| [ConfigItem<int>("VersionRamCustom", 15)] public partial ArgConfig<int> CustomMemorySize { get; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2239,15 +2239,20 @@ private static void WriteLinkD(string path) | |
| } | ||
|
|
||
| /// <summary> | ||
| /// 判断是否使用 RetroWrapper。 | ||
| /// TODO: 在更换为 Drop 比较版本号后可能不准确,需要测试确认。 | ||
| /// 判断是否使用 LegacyFix。 | ||
| /// </summary> | ||
| private static bool McLaunchNeedsRetroWrapper(McInstance mc) | ||
| private static bool McLaunchNeedsLegacyFix(McInstance mc) | ||
| { | ||
| return (mc.releaseTime >= new DateTime(2013, 6, 25) && mc.Info.Drop == 99) || | ||
| (mc.Info.Drop < 60 && mc.Info.Drop != 99 && | ||
| !Config.Launch.DisableRw && | ||
| !Config.Instance.DisableRw[mc.PathInstance]); // <1.6 | ||
| if (Config.Launch.DisableLF || Config.Instance.DisableLF[mc.PathInstance]) | ||
| { | ||
| ModBase.Log("[Launch] LegacyFix 已被禁用"); | ||
| return false; | ||
| } | ||
| if (mc.releaseTime < new DateTime(2013, 6, 25) && mc.releaseTime.Year > 2000) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For inherited/modded old profiles that omit Useful? React with 👍 / 👎. |
||
| { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -2616,10 +2621,19 @@ private static string McLaunchArgumentsJvmNew(McInstance instance) | |
| ModBase.Log(ex, Lang.Text("Minecraft.Launch.Error.Proxy"), ModBase.LogLevel.Hint); | ||
| } | ||
|
|
||
| // 添加 RetroWrapper 相关参数 | ||
| if (McLaunchNeedsRetroWrapper(instance)) | ||
| // https://github.com/NeRdTheNed/RetroWrapper/wiki/RetroWrapper-flags | ||
| dataList.Add("-Dretrowrapper.doUpdateCheck=false"); | ||
| // 添加 LegacyFix 相关参数 | ||
| if (McLaunchNeedsLegacyFix(instance)) | ||
| { | ||
| var legacyFixPath = Path.Combine(ModBase.pathPure, "legacyfix.jar"); | ||
| dataList.Add("-javaagent:\"" + legacyFixPath + "\""); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a legacy instance reaches this new-JVM-args path with Java Wrapper enabled (the block immediately below, on UTF-8 code pages) or with a normal Minecraft main class, the JVM command seen by the bundled Useful? React with 👍 / 👎. |
||
|
|
||
| // Beta 1.6 以前版本需要添加的参数 | ||
| if (instance.releaseTime < new DateTime(2011, 5, 25)) | ||
| { | ||
| dataList.Add("-Djava.util.Arrays.useLegacyMergeSort=true"); | ||
| } | ||
| } | ||
|
|
||
| // 添加 Java Wrapper 作为主 Jar | ||
| if (ModBase.IsUtf8CodePage() && !Config.Launch.DisableJlw && | ||
| !Config.Instance.DisableJlw[ModInstanceList.McMcInstanceSelected?.PathInstance]) | ||
|
|
@@ -2668,9 +2682,6 @@ private static string McLaunchArgumentsGameOld(McInstance version) | |
| { | ||
| var dataList = new List<string>(); | ||
|
|
||
| // 添加 RetroWrapper 相关参数 | ||
| if (McLaunchNeedsRetroWrapper(version)) dataList.Add("--tweakClass com.zero.retrowrapper.RetroTweaker"); | ||
|
|
||
| // 本地化 Minecraft 启动信息 | ||
| var basicString = version.JsonObject["minecraftArguments"].ToString(); | ||
| if (!basicString.Contains("--height")) | ||
|
|
@@ -2887,18 +2898,17 @@ private static Dictionary<string, string> McLaunchArgumentsReplace(McInstance in | |
| var cpStrings = new List<string>(); | ||
| string optiFineCp = null; | ||
|
|
||
| // RetroWrapper 释放 | ||
| if (McLaunchNeedsRetroWrapper(instance)) | ||
| // LegacyFix 释放 | ||
| if (McLaunchNeedsLegacyFix(instance)) | ||
| { | ||
| var wrapperPath = ModFolder.mcFolderSelected + @"libraries\retrowrapper\RetroWrapper.jar"; | ||
| var legacyFixPath = Path.Combine(ModBase.pathPure, "legacyfix.jar"); | ||
| try | ||
| { | ||
| ModBase.WriteFile(wrapperPath, ModBase.GetResourceStream("Resources/retro-wrapper.jar")); | ||
| cpStrings.Add(wrapperPath); | ||
| ModBase.WriteFile(legacyFixPath, ModBase.GetResourceStream("Resources/legacyfix.jar")); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| ModBase.Log(ex, "RetroWrapper 释放失败"); | ||
| ModBase.Log(ex, "LegacyFix 释放失败"); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rename removes the generated
DisableRwmembers, butPageSetupLaunch.xaml.csandPageInstanceSetup.xaml.csstill referenceConfig.Launch.DisableRw/Config.Instance.DisableRwandCheckAdvanceDisableRW. After source generation and XAML name generation, those symbols no longer exist, so the project will not compile until the remaining code-behind references are updated to the newDisableLF/CheckAdvanceDisableLFnames.Useful? React with 👍 / 👎.