This commit is contained in:
Ciilu 2025-09-05 22:19:59 +08:00
parent 2b3179fe98
commit 194a39c667
No known key found for this signature in database
9 changed files with 28 additions and 27 deletions

View File

@ -411,7 +411,7 @@ public class HMCLGameRepository extends DefaultGameRepository {
.setNativesDir(vs.getNativesDir())
.setProcessPriority(vs.getProcessPriority())
.setRenderer(vs.getRenderer())
.setUseDebugLog4j2Config(vs.isUseDebugLog4j2Config())
.setUseDebugLogOutput(vs.isUseDebugDebugLogOutput())
.setUseNativeGLFW(vs.isUseNativeGLFW())
.setUseNativeOpenAL(vs.isUseNativeOpenAL())
.setDaemon(!makeLaunchScript && vs.getLauncherVisibility().isDaemon())

View File

@ -589,18 +589,18 @@ public final class VersionSetting implements Cloneable, Observable {
this.rendererProperty.set(renderer);
}
private final BooleanProperty useDebugLog4j2ConfigProperty = new SimpleBooleanProperty(this, "useDebugLog4j2Config", false);
private final BooleanProperty useDebugLogOutputProperty = new SimpleBooleanProperty(this, "useDebugLogOutput", false);
public boolean isUseDebugLog4j2Config() {
return useDebugLog4j2ConfigProperty.get();
public boolean isUseDebugDebugLogOutput() {
return useDebugLogOutputProperty.get();
}
public BooleanProperty useDebugLog4j2ConfigProperty() {
return useDebugLog4j2ConfigProperty;
public BooleanProperty useDebugLogOutputProperty() {
return useDebugLogOutputProperty;
}
public void setUseDebugLog4j2Config(boolean u) {
this.useDebugLog4j2ConfigProperty.set(u);
public void setUseDebugLogOutput(boolean u) {
this.useDebugLogOutputProperty.set(u);
}
private final BooleanProperty useNativeGLFW = new SimpleBooleanProperty(this, "nativeGLFW", false);
@ -778,7 +778,7 @@ public final class VersionSetting implements Cloneable, Observable {
obj.addProperty("gameDir", src.getGameDir());
obj.addProperty("launcherVisibility", src.getLauncherVisibility().ordinal());
obj.addProperty("processPriority", src.getProcessPriority().ordinal());
obj.addProperty("useDebugLog4j2Config", src.isUseDebugLog4j2Config());
obj.addProperty("useDebugLogOutput", src.isUseDebugDebugLogOutput());
obj.addProperty("useNativeGLFW", src.isUseNativeGLFW());
obj.addProperty("useNativeOpenAL", src.isUseNativeOpenAL());
obj.addProperty("gameDirType", src.getGameDirType().ordinal());
@ -846,7 +846,7 @@ public final class VersionSetting implements Cloneable, Observable {
vs.setNotCheckJVM(Optional.ofNullable(obj.get("notCheckJVM")).map(JsonElement::getAsBoolean).orElse(false));
vs.setNotPatchNatives(Optional.ofNullable(obj.get("notPatchNatives")).map(JsonElement::getAsBoolean).orElse(false));
vs.setShowLogs(Optional.ofNullable(obj.get("showLogs")).map(JsonElement::getAsBoolean).orElse(false));
vs.setUseDebugLog4j2Config(Optional.ofNullable(obj.get("useDebugLog4j2Config")).map(JsonElement::getAsBoolean).orElse(false));
vs.setUseDebugLogOutput(Optional.ofNullable(obj.get("useDebugLogOutput")).map(JsonElement::getAsBoolean).orElse(false));
vs.setLauncherVisibility(parseJsonPrimitive(obj.getAsJsonPrimitive("launcherVisibility"), LauncherVisibility.class, LauncherVisibility.HIDE));
vs.setProcessPriority(parseJsonPrimitive(obj.getAsJsonPrimitive("processPriority"), ProcessPriority.class, ProcessPriority.NORMAL));
vs.setUseNativeGLFW(Optional.ofNullable(obj.get("useNativeGLFW")).map(JsonElement::getAsBoolean).orElse(false));

View File

@ -47,7 +47,6 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
private final OptionToggleButton noJVMCheckPane;
private final OptionToggleButton noNativesPatchPane;
private final OptionToggleButton useNativeGLFWPane;
private final OptionToggleButton useDebugLog4j2CongigPane;
private final OptionToggleButton useNativeOpenALPane;
private final ComponentSublist nativesDirSublist;
private final MultiFileItem<NativesDirectoryType> nativesDirItem;
@ -193,9 +192,6 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
noNativesPatchPane = new OptionToggleButton();
noNativesPatchPane.setTitle(i18n("settings.advanced.dont_patch_natives"));
useDebugLog4j2CongigPane = new OptionToggleButton();
useDebugLog4j2CongigPane.setTitle(i18n("settings.advanced.use_debug_log42j_config"));
useNativeGLFWPane = new OptionToggleButton();
useNativeGLFWPane.setTitle(i18n("settings.advanced.use_native_glfw"));
@ -204,7 +200,7 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
workaroundPane.getContent().setAll(
nativesDirSublist, rendererPane, noJVMArgsPane, noGameCheckPane,
noJVMCheckPane, noNativesPatchPane, useDebugLog4j2CongigPane
noJVMCheckPane, noNativesPatchPane
);
if (OperatingSystem.CURRENT_OS.isLinuxOrBSD()) {
@ -241,7 +237,6 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
noJVMArgsPane.selectedProperty().bindBidirectional(versionSetting.noJVMArgsProperty());
noNativesPatchPane.selectedProperty().bindBidirectional(versionSetting.notPatchNativesProperty());
useNativeGLFWPane.selectedProperty().bindBidirectional(versionSetting.useNativeGLFWProperty());
useDebugLog4j2CongigPane.selectedProperty().bindBidirectional(versionSetting.useDebugLog4j2ConfigProperty());
useNativeOpenALPane.selectedProperty().bindBidirectional(versionSetting.useNativeOpenALProperty());
nativesDirItem.selectedDataProperty().bindBidirectional(versionSetting.nativesDirTypeProperty());
@ -282,7 +277,6 @@ public final class AdvancedVersionSettingPage extends StackPane implements Decor
noJVMCheckPane.selectedProperty().unbindBidirectional(versionSetting.notCheckJVMProperty());
noJVMArgsPane.selectedProperty().unbindBidirectional(versionSetting.noJVMArgsProperty());
noNativesPatchPane.selectedProperty().unbindBidirectional(versionSetting.notPatchNativesProperty());
useDebugLog4j2CongigPane.selectedProperty().unbindBidirectional(versionSetting.useDebugLog4j2ConfigProperty());
useNativeGLFWPane.selectedProperty().unbindBidirectional(versionSetting.useNativeGLFWProperty());
useNativeOpenALPane.selectedProperty().unbindBidirectional(versionSetting.useNativeOpenALProperty());

View File

@ -112,6 +112,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
private final MultiFileItem.FileOption<GameDirectoryType> gameDirCustomOption;
private final JFXComboBox<ProcessPriority> cboProcessPriority;
private final OptionToggleButton showLogsPane;
private final OptionToggleButton useDebugLogOutputPane;
private final ImagePickerItem iconPickerItem;
private final ChangeListener<Collection<JavaRuntime>> javaListChangeListener;
@ -412,6 +413,9 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
showLogsPane = new OptionToggleButton();
showLogsPane.setTitle(i18n("settings.show_log"));
useDebugLogOutputPane = new OptionToggleButton();
useDebugLogOutputPane.setTitle(i18n("settings.advanced.use_debug_log_output"));
BorderPane processPriorityPane = new BorderPane();
{
Label label = new Label(i18n("settings.advanced.process_priority"));
@ -477,6 +481,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
launcherVisibilityPane,
dimensionPane,
showLogsPane,
useDebugLogOutputPane,
processPriorityPane,
serverPane,
showAdvancedSettingPane
@ -553,6 +558,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
FXUtils.unbind(txtServerIP, lastVersionSetting.serverIpProperty());
chkAutoAllocate.selectedProperty().unbindBidirectional(lastVersionSetting.autoMemoryProperty());
chkFullscreen.selectedProperty().unbindBidirectional(lastVersionSetting.fullscreenProperty());
useDebugLogOutputPane.selectedProperty().unbindBidirectional(versionSetting.useDebugLogOutputProperty());
showLogsPane.selectedProperty().unbindBidirectional(lastVersionSetting.showLogsProperty());
FXUtils.unbindEnum(cboLauncherVisibility, lastVersionSetting.launcherVisibilityProperty());
FXUtils.unbindEnum(cboProcessPriority, lastVersionSetting.processPriorityProperty());
@ -588,6 +594,7 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag
chkAutoAllocate.selectedProperty().bindBidirectional(versionSetting.autoMemoryProperty());
chkFullscreen.selectedProperty().bindBidirectional(versionSetting.fullscreenProperty());
showLogsPane.selectedProperty().bindBidirectional(versionSetting.showLogsProperty());
useDebugLogOutputPane.selectedProperty().bindBidirectional(versionSetting.useDebugLogOutputProperty());
FXUtils.bindEnum(cboLauncherVisibility, versionSetting.launcherVisibilityProperty());
FXUtils.bindEnum(cboProcessPriority, versionSetting.processPriorityProperty());

View File

@ -1308,7 +1308,7 @@ settings.advanced.workaround=Workaround
settings.advanced.workaround.warning=Workaround options are intended only for advanced users. Tweaking with these options may crash the game. Unless you know what you are doing, please do not edit these options.
settings.advanced.wrapper_launcher=Wrapper Command
settings.advanced.wrapper_launcher.prompt=Allows launching using an extra wrapper program like "optirun" on Linux
settings.advanced.use_debug_log42j_config=Use debug level Log4j2 configuration file
settings.advanced.use_debug_log_output=Output debug log
settings.custom=Custom

View File

@ -1100,7 +1100,7 @@ settings.advanced.workaround=除錯選項
settings.advanced.workaround.warning=除錯選項僅提供給專業玩家使用。修改除錯選項可能會導致遊戲無法啟動。除非你知道你在做什麼,否則請不要修改這些選項。
settings.advanced.wrapper_launcher=前置指令
settings.advanced.wrapper_launcher.prompt=如填寫「optirun」後啟動指令將從「java ...」變為「optirun java ...」
settings.advanced.use_debug_log42j_config=使用除錯級別 Log4j2 設定檔
settings.advanced.use_debug_log_output=输出除錯日誌
settings.custom=自訂

View File

@ -1111,7 +1111,7 @@ settings.advanced.workaround=调试选项
settings.advanced.workaround.warning=调试选项仅提供给专业玩家使用。调试选项可能会导致游戏无法启动。除非你知道你在做什么,否则请不要修改这些选项!
settings.advanced.wrapper_launcher=包装命令
settings.advanced.wrapper_launcher.prompt=如填写“optirun”后启动命令将从“java ...”变为“optirun java ...”
settings.advanced.use_debug_log42j_config=使用调试级别 Log4j2 配置文件
settings.advanced.use_debug_log_output=输出调试日志
settings.custom=自定义

View File

@ -63,7 +63,7 @@ public class LaunchOptions implements Serializable {
private Renderer renderer = Renderer.DEFAULT;
private boolean useNativeGLFW;
private boolean useNativeOpenAL;
private boolean useDebugLog4j2Config;
private boolean useDebugLogOutput;
private boolean daemon;
/**
@ -275,8 +275,8 @@ public class LaunchOptions implements Serializable {
return useNativeOpenAL;
}
public boolean isUseDebugLog4j2Config() {
return useDebugLog4j2Config;
public boolean isUseDebugLogOutput() {
return useDebugLogOutput;
}
/**
@ -489,8 +489,8 @@ public class LaunchOptions implements Serializable {
return this;
}
public Builder setUseDebugLog4j2Config(boolean u) {
options.useDebugLog4j2Config = u;
public Builder setUseDebugLogOutput(boolean u) {
options.useDebugLogOutput = u;
return this;
}
}

View File

@ -147,7 +147,7 @@ public class DefaultLauncher extends Launcher {
res.addDefault("-Dcom.sun.jndi.rmi.object.trustURLCodebase=", "false");
res.addDefault("-Dcom.sun.jndi.cosnaming.object.trustURLCodebase=", "false");
if (options.isUseDebugLog4j2Config()) {
if (options.isUseDebugLogOutput()) {
res.addDefault("-Dlog4j2.formatMsgNoLookups=", "false");
res.addDefault("-Dlog4j.configurationFile=", getLog4jConfigurationFile().getAbsolutePath());
} else {
@ -421,7 +421,7 @@ public class DefaultLauncher extends Launcher {
public void extractLog4jConfigurationFile() throws IOException {
File targetFile = getLog4jConfigurationFile();
InputStream source;
if (options.isUseDebugLog4j2Config()) {
if (options.isUseDebugLogOutput()) {
source = DefaultLauncher.class.getResourceAsStream("/assets/game/log4j2-debug.xml");
} else if (GameVersionNumber.asGameVersion(repository.getGameVersion(version)).compareTo("1.12") < 0) {
source = DefaultLauncher.class.getResourceAsStream("/assets/game/log4j2-1.7.xml");