Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions PCL.Core/App/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Complete the DisableRw rename

This rename removes the generated DisableRw members, but PageSetupLaunch.xaml.cs and PageInstanceSetup.xaml.cs still reference Config.Launch.DisableRw / Config.Instance.DisableRw and CheckAdvanceDisableRW. 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 new DisableLF/CheckAdvanceDisableLF names.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve existing wrapper opt-outs

When upgrading a profile where LaunchAdvanceDisableRW is already true, this renamed ConfigItem reads the new LaunchAdvanceDisableLF key with the default false instead, and the old key is no longer referenced anywhere. That silently re-enables legacy-wrapper injection for users who explicitly disabled it for old-version launches; please migrate or alias the old global/per-instance keys before defaulting the new LegacyFix setting to enabled.

Useful? React with 👍 / 👎.


/// <summary>
/// 强制使用高性能显卡。
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Expand Down Expand Up @@ -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; }
Expand Down
6 changes: 3 additions & 3 deletions PCL.Core/App/Localization/Languages/en-US.xaml
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

View workflow job for this annotation

GitHub Actions / build (CI, ARM64) / Build

'Data at the root level is invalid. Line 1, position 1.' XML is not valid.

Check failure on line 1 in PCL.Core/App/Localization/Languages/en-US.xaml

View workflow job for this annotation

GitHub Actions / build (CI, x64) / Build

'Data at the root level is invalid. Line 1, position 1.' XML is not valid.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the extra BOM from en-US.xaml

The file now starts with two UTF-8 BOMs (EF BB BF EF BB BF), so XML readers treat the second marker as content before the root element. When the English ResourceDictionary is parsed or LocalizationTest.LoadKeyList calls XDocument.Load, the file is not well-formed and English localization loading fails before any keys can be read.

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"
Expand Down Expand Up @@ -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.&#x0a;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.&#x0a;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.&#x0a;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>
Expand Down
4 changes: 2 additions & 2 deletions PCL.Core/App/Localization/Languages/zh-CN.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,8 @@
<sys:String x:Key="Setup.Launch.Advanced.DisableJlw">禁用 Java Launch Wrapper</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableJlw.ToolTip">PCL 会使用 Java Launch Wrapper 来修复老版本 Java 在中文路径下无法启动的问题。&#x0a;如果这被反作弊拦截,或遇到其他问题,也可以将其关闭。</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableJlw.Arm64Notice">在启动游戏时不使用 Java Wrapper 进行包装。&#x0a;由于系统为 ARM64 架构,Java Wrapper 已被强制禁用。</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableRw">禁用 RetroWrapper</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableRw.ToolTip">PCL 会在启动 1.5.x 及以下版本时使用 RetroWrapper 来改善老版本游戏体验和修复兼容性问题。</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableLF">禁用 LegacyFix</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.DisableLF.ToolTip">PCL 会在启动 1.5.x 及以下版本时使用 LegacyFix 来改善老版本游戏体验和修复兼容性问题。</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.GpuPreference">要求 Java 使用高性能显卡</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.GpuPreference.ToolTip">自动在 Windows 设置 → 系统 → 屏幕 → 显示卡 中将 Java 改为使用高性能显卡。&#x0a;如果电脑同时有集显和独显,这能确保 MC 使用独显进行渲染,以大幅提高性能。</sys:String>
<sys:String x:Key="Setup.Launch.Advanced.UseJavaExe">使用 java.exe 而不是 javaw.exe</sys:String>
Expand Down
48 changes: 29 additions & 19 deletions Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate LegacyFix on known old versions

For custom/unknown instances that omit releaseTime, McInstance sets releaseTime to 1970-01-01 (McInstance.cs lines 162-163), so this date-only check now returns true even though the version was not identified as <=1.5.x. That makes PCL copy/inject LegacyFix for arbitrary modern/custom JSONs, and in the new-JVM-args path adds a -javaagent, which can break launch or alter the classpath unexpectedly; keep the existing known-date/Drop guard before treating the instance as legacy.

Useful? React with 👍 / 👎.

ModBase.Log($"[Launch] 启用 LegacyFix");
return needs;
}

/// <summary>
Expand Down Expand Up @@ -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 + "\"");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the LegacyFix agent to the old JVM path

This -javaagent is only added in McLaunchArgumentsJvmNew(), but the 1.5.x-and-below versions this feature targets are routed through McLaunchArgumentsJvmOld() when their JSON only has minecraftArguments. The later classpath copy only places legacyfix.jar on -cp; it does not invoke the JAR's Premain-Class, so those legacy versions launch without any LegacyFix patches.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route LegacyFix through a recognized launcher

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 LegacyFixAgent is not one of the launchers its required launcher patch accepts (LegacyFixLauncher, Prism/MultiMC, or LaunchWrapper). The agent exits on unknown launchers during premain, so adding it as a bare -javaagent can abort these launches before Minecraft starts; this path needs to invoke/identify LegacyFix’s launcher instead of only attaching the agent.

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])
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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 释放失败");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@
ToolTipService.Placement="Right"
ToolTip="{DynamicResource Setup.Launch.Advanced.DisableJlw.ToolTip}" />
<local:MyCheckBox Height="28"
Text="{DynamicResource Setup.Launch.Advanced.DisableRw}"
x:Name="CheckAdvanceDisableRW"
Tag="VersionAdvanceDisableRW"
Text="{DynamicResource Setup.Launch.Advanced.DisableLF}"
x:Name="CheckAdvanceDisableLF"
Tag="VersionAdvanceDisableLF"
ToolTipService.Placement="Right"
ToolTip="{DynamicResource Setup.Launch.Advanced.DisableRw.ToolTip}" />
ToolTip="{DynamicResource Setup.Launch.Advanced.DisableLF.ToolTip}" />
<local:MyCheckBox Height="28" Text="{DynamicResource Instance.Setup.Advanced.UseDebugLog4j}"
x:Name="CheckUseDebugLog4j2Config"
Tag="VersionUseDebugLog4j2Config"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private void CheckBoxChange(object sender, bool user)
"VersionAdvanceAssetsV2" => Config.Instance.DisableAssetVerifyV2,
"VersionAdvanceUseProxyV2" => Config.Instance.UseProxy,
"VersionAdvanceDisableJLW" => Config.Instance.DisableJlw,
"VersionAdvanceDisableRW" => Config.Instance.DisableRw,
"VersionAdvanceDisableLF" => Config.Instance.DisableLF,
"VersionUseDebugLog4j2Config" => Config.Instance.UseDebugLof4j2Config,
"VersionAdvanceDisableLwjglUnsafeAgent" => Config.Instance.DisableLwjglUnsafeAgent,
_ => throw new ArgumentOutOfRangeException()
Expand Down
4 changes: 2 additions & 2 deletions Plain Craft Launcher 2/Pages/PageSetup/PageSetupLaunch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@
<StackPanel Margin="0,12,0,4" Grid.Row="8" Grid.ColumnSpan="2" HorizontalAlignment="Left">
<local:MyCheckBox Height="28" Text="{DynamicResource Setup.Launch.Advanced.DisableJlw}" x:Name="CheckAdvanceDisableJLW" Tag="LaunchAdvanceDisableJLW" Change="CheckBoxChange"
ToolTipService.Placement="Right" ToolTip="{DynamicResource Setup.Launch.Advanced.DisableJlw.ToolTip}" />
<local:MyCheckBox Height="28" Text="{DynamicResource Setup.Launch.Advanced.DisableRw}" x:Name="CheckAdvanceDisableRW" Tag="LaunchAdvanceDisableRW" Change="CheckBoxChange"
ToolTipService.Placement="Right" ToolTip="{DynamicResource Setup.Launch.Advanced.DisableRw.ToolTip}" />
<local:MyCheckBox Height="28" Text="{DynamicResource Setup.Launch.Advanced.DisableLF}" x:Name="CheckAdvanceDisableLF" Tag="LaunchAdvanceDisableLF" Change="CheckBoxChange"
ToolTipService.Placement="Right" ToolTip="{DynamicResource Setup.Launch.Advanced.DisableLF.ToolTip}" />
<local:MyCheckBox Height="28" Text="{DynamicResource Setup.Launch.Advanced.GpuPreference}" x:Name="CheckAdvanceGraphicCard" Tag="LaunchAdvanceGraphicCard" Change="CheckBoxChange"
ToolTipService.Placement="Right" ToolTip="{DynamicResource Setup.Launch.Advanced.GpuPreference.ToolTip}" />
<local:MyCheckBox Height="28" Text="{DynamicResource Setup.Launch.Advanced.UseJavaExe}" x:Name="CheckAdvanceNoJavaw" Tag="LaunchAdvanceNoJavaw" Change="CheckBoxChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private static void SetLaunchByTag(string tag, object value)
case "LaunchAdvanceRun": Config.Launch.PreLaunchCommand = (string)value; break;
case "LaunchAdvanceRunWait": Config.Launch.PreLaunchCommandWait = (bool)value; break;
case "LaunchAdvanceDisableJLW": Config.Launch.DisableJlw = (bool)value; break;
case "LaunchAdvanceDisableRW": Config.Launch.DisableRw = (bool)value; break;
case "LaunchAdvanceDisableLF": Config.Launch.DisableLF = (bool)value; break;
case "LaunchAdvanceGraphicCard": Config.Launch.SetGpuPreference = (bool)value; break;
case "LaunchAdvanceNoJavaw": Config.Launch.NoJavaw = (bool)value; break;
case "LaunchAdvanceDisableLwjglUnsafeAgent": Config.Launch.DisableLwjglUnsafeAgent = (bool)value; break;
Expand Down
Binary file added Plain Craft Launcher 2/Resources/legacyfix.jar
Binary file not shown.
Binary file removed Plain Craft Launcher 2/Resources/retro-wrapper.jar
Binary file not shown.
Loading