-
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 1 commit
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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| <ResourceDictionary | ||
| <ResourceDictionary | ||
|
Check failure on line 1 in PCL.Core/App/Localization/Languages/en-US.xaml
|
||
|
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.
The file now starts with two UTF-8 BOMs ( Useful? React with 👍 / 👎. |
||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:sys="clr-namespace:System;assembly=mscorlib" | ||
|
|
@@ -1655,8 +1655,8 @@ | |
| <sys:String x:Key="Setup.Launch.Advanced.DisableJlw">Disable Java Launch Wrapper</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableJlw.ToolTip">PCL uses Java Launch Wrapper to fix issues where older Java versions cannot launch from paths containing Chinese characters.
If it is blocked by anti-cheat or causes other issues, you can disable it.</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableJlw.Arm64Notice">Do not wrap with Java Wrapper when launching the game.
Java Wrapper has been forcibly disabled because the system is ARM64 architecture.</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableRw">Disable RetroWrapper</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableRw.ToolTip">PCL uses RetroWrapper when launching version 1.5.x and below to improve legacy version gameplay experience and fix compatibility issues.</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableLF">Disable LegacyFix</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.DisableLF.ToolTip">PCL uses LegacyFix when launching version 1.5.x and below to improve legacy version gameplay experience and fix compatibility issues.</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.GpuPreference">Require Java to use the high-performance GPU</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.GpuPreference.ToolTip">Automatically set Java to use the high-performance GPU in Windows Settings → System → Display → Graphics.
If the computer has both integrated and dedicated graphics, this ensures that Minecraft uses the dedicated GPU for rendering, greatly improving performance.</sys:String> | ||
| <sys:String x:Key="Setup.Launch.Advanced.UseJavaExe">Use java.exe instead of javaw.exe</sys:String> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2239,15 +2239,19 @@ private static void WriteLinkD(string path) | |
| } | ||
|
|
||
| /// <summary> | ||
| /// 判断是否使用 RetroWrapper。 | ||
| /// 判断是否使用 LegacyFix。 | ||
| /// TODO: 在更换为 Drop 比较版本号后可能不准确,需要测试确认。 | ||
| /// </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; | ||
| } | ||
| var needs = mc.releaseTime < new DateTime(2013, 6, 25); | ||
|
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 custom/unknown instances that omit Useful? React with 👍 / 👎. |
||
| ModBase.Log($"[Launch] 启用 LegacyFix"); | ||
| return needs; | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -2616,10 +2620,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 +2681,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 +2897,18 @@ 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")); | ||
| cpStrings.Add(legacyFixPath); | ||
| } | ||
| 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 👍 / 👎.