Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/javafx' into logs
Browse files Browse the repository at this point in the history
  • Loading branch information
zkitefly committed Dec 22, 2023
2 parents 79df0ec + d584c10 commit ba58861
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gitee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
if: ${{ github.repository_owner == 'huanghongxun' }}
runs-on: ubuntu-latest
steps:
- name: Mirror Github to Gitee
- name: Mirror GitHub to Gitee
uses: Yikun/hub-mirror-action@v1.3
with:
src: github/huanghongxun
Expand Down
8 changes: 5 additions & 3 deletions HMCL/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ val buildNumber = System.getenv("BUILD_NUMBER")?.toInt().let { number ->
if (number != null) {
(number - offset).toString()
} else {
val shortCommit = System.getenv("GITHUB_SHA")?.toLowerCase()?.substring(0, 7)
val shortCommit = System.getenv("GITHUB_SHA")?.lowercase()?.substring(0, 7)
val prefix = if (isOfficial) "dev" else "unofficial"
if (!shortCommit.isNullOrEmpty()) "$prefix-$shortCommit" else "SNAPSHOT"
}
Expand All @@ -38,7 +38,7 @@ dependencies {
implementation("libs:JFoenix")
}

fun digest(algorithm: String, bytes: ByteArray) = MessageDigest.getInstance(algorithm).digest(bytes)
fun digest(algorithm: String, bytes: ByteArray): ByteArray = MessageDigest.getInstance(algorithm).digest(bytes)

fun createChecksum(file: File) {
val algorithms = linkedMapOf(
Expand Down Expand Up @@ -107,6 +107,8 @@ val jarPath = tasks.jar.get().archiveFile.get().asFile
tasks.getByName<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
archiveClassifier.set(null as String?)

exclude("**/package-info.class")

minimize {
exclude(dependency("com.google.code.gson:.*:.*"))
exclude(dependency("com.github.steveice10:.*:.*"))
Expand Down Expand Up @@ -187,7 +189,7 @@ tasks.processResources {
dependsOn(tasks["java11Classes"])

into("assets") {
from(project.buildDir.resolve("openjfx-dependencies.json"))
from(project.layout.buildDirectory.file("openjfx-dependencies.json"))
}
dependsOn(rootProject.tasks["generateOpenJFXDependencies"])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public CrashReport(Thread thread, Throwable throwable) {
nonFatal = false;
}

public Throwable getThrowable() {
return this.throwable;
}

public CrashReport setNonFatal() {
nonFatal = true;
return this;
Expand All @@ -38,6 +42,9 @@ public boolean shouldBeReport() {
if (!stackTrace.contains("org.jackhuang"))
return false;

if (throwable instanceof VirtualMachineError)
return false;

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void generateOptionsTxt() {

if (lang != null) {
try {
FileUtils.writeText(optionsFile, String.format("lang:%s\nforceUnicodeFont:true\n", lang));
FileUtils.writeText(optionsFile, String.format("lang:%s\n", lang));
} catch (IOException e) {
Logging.LOG.log(Level.WARNING, "Unable to generate options.txt", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private static void processLogs(Path directory, String fileExtension, String log
if (Files.isRegularFile(file)) {
FileTime time = Files.readAttributes(file, BasicFileAttributes.class).lastModifiedTime();
if (time.toMillis() >= processStartTime) {
String crashLog = Logging.filterForbiddenToken(FileUtils.readText(file));
String crashLog = Logging.filterForbiddenToken(FileUtils.readText(file, OperatingSystem.NATIVE_CHARSET));
zipper.putTextFile(crashLog, file.getFileName().toString());
}
}
Expand Down
11 changes: 7 additions & 4 deletions HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.jackhuang.hmcl.Metadata;
import org.jackhuang.hmcl.countly.CrashReport;
import org.jackhuang.hmcl.upgrade.UpdateChecker;

import static org.jackhuang.hmcl.ui.FXUtils.newImage;
Expand All @@ -37,16 +38,18 @@
*/
public class CrashWindow extends Stage {

public CrashWindow(String text) {
public CrashWindow(CrashReport report) {
Label lblCrash = new Label();
if (UpdateChecker.isOutdated())
lblCrash.setText(i18n("launcher.crash_out_dated"));
if (report.getThrowable() instanceof InternalError)
lblCrash.setText(i18n("launcher.crash.java_internal_error"));
else if (UpdateChecker.isOutdated())
lblCrash.setText(i18n("launcher.crash.hmcl_out_dated"));
else
lblCrash.setText(i18n("launcher.crash"));
lblCrash.setWrapText(true);

TextArea textArea = new TextArea();
textArea.setText(text);
textArea.setText(report.getDisplayText());
textArea.setEditable(false);

Button btnContact = new Button();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.collections.ListChangeListener;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
Expand Down Expand Up @@ -174,6 +175,11 @@ class ModListPageSkin extends SkinBase<ModListPage> {
listView.setCellFactory(x -> new ModInfoListCell(listView, lastCell));
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
Bindings.bindContent(listView.getItems(), skinnable.getItems());
skinnable.getItems().addListener((ListChangeListener<? super ModInfoObject>) c -> {
if (isSearching) {
search();
}
});

center.setContent(listView);
root.getContent().add(center);
Expand Down Expand Up @@ -219,7 +225,7 @@ private void search() {
}
} else {
String lowerQueryString = queryString.toLowerCase(Locale.ROOT);
predicate = s -> s.toLowerCase(Locale.ROOT).contains(lowerQueryString);
predicate = s -> s.contains(lowerQueryString);
}

// Do we need to search in the background thread?
Expand Down
6 changes: 2 additions & 4 deletions HMCL/src/main/java/org/jackhuang/hmcl/util/CrashReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ public void uncaughtException(Thread t, Throwable e) {
if (!report.shouldBeReport())
return;

String text = report.getDisplayText();

LOG.log(Level.SEVERE, text);
LOG.log(Level.SEVERE, report.getDisplayText());
Platform.runLater(() -> {
if (checkThrowable(e)) {
if (showCrashWindow) {
new CrashWindow(text).show();
new CrashWindow(report).show();
}
if (!UpdateChecker.isOutdated() && IntegrityChecker.isSelfVerified()) {
reportToServer(report);
Expand Down
9 changes: 5 additions & 4 deletions HMCL/src/main/resources/assets/lang/I18N.properties
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ game.crash.reason.optifine_is_not_compatible_with_forge=The current game crashes
game.crash.reason.mod_files_are_decompressed=The current game cannot continue to run because the Mod file has been decompressed.\nPlease put the entire Mod file directly into the Mod folder!\nIf unzipping will cause errors in the game, please delete the unzipped Mod in the Mod folder, and then start the game.
game.crash.reason.shaders_mod=The current game cannot continue to run because both Optifine and Shaders Mod are installed.\nBecause OptiFine has built-in support for shaders.
game.crash.reason.too_many_mods_lead_to_exceeding_the_id_limit=The current game cannot continue to run because you have installed too many Mods, which exceeds the ID limit of the game.\nPlease try installing<a href="https://www.curseforge.com/minecraft/mc-mods/jeid">JEID</a>, or delete some large Mods.
game.crash.reason.night_config_fixes=The current game cannot continue to run due to some problems with Night Config.\nYou can try to install the <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a> mod, which may help you this problem.\nFor more information, visit the mod's <a href="https://www.github.com/Fuzss/nightconfigfixes">Github repository</a>.
game.crash.reason.night_config_fixes=The current game cannot continue to run due to some problems with Night Config. \nYou can try to install the <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a> mod, which may help you this problem. \nFor more information, visit the mod's <a href="https://www.github.com/Fuzss/nightconfigfixes">GitHub repository</a>.
game.crash.reason.optifine_causes_the_world_to_fail_to_load=The current game may not continue to run because of OptiFine.\nThis problem only occurs in a specific version of OptiFine. You can try changing the version of OptiFine in version setting - automatic installation.
game.crash.reason.jdk_9=The game cannot run because the Java version is too new for this instance.\n\
\n\
Expand All @@ -502,8 +502,8 @@ You can try deleting or updating it.
game.crash.reason.mac_jdk_8u261=The game crashed because your current Forge or OptiFine version is not compatible with your Java installation.\n\
\n\
Please try updating Forge and OptiFine, or try using Java 8u251 or earlier versions.
game.crash.reason.forge_repeat_installation=The current game cannot continue to run due to a duplicate installation of Forge. <a href="https://github.com/huanghongxun/HMCL/issues/1880">This is a known issue</a>\nIt is recommended to upload the log feedback to Github so that we can find more clues and fix this question.\nCurrently you can go to the automatic installation to uninstall Forge and reinstall it.
game.crash.reason.optifine_repeat_installation=The current game cannot continue to run due to repeated installation of Optifine.\nPlease delete Optifine under the Mod folder or go to Game Management-Automatic Installation to uninstall Optifine that is automatically installed.
game.crash.reason.forge_repeat_installation=The current game cannot continue to run due to a duplicate installation of Forge. <a href="https://github.com/huanghongxun/HMCL/issues/1880">This is a known issue</a>\nIt is recommended to upload the log feedback to GitHub so that we can find more clues and fix this question. \nCurrently you can go to the automatic installation to uninstall Forge and reinstall it.
game.crash.reason.optifine_repeat_installation=The current game cannot continue to run due to repeated installation of Optifine. \nPlease delete Optifine under the Mod folder or go to Game Management-Automatic Installation to uninstall Optifine that is automatically installed.
game.crash.reason.memory_exceeded=The game crashed due to too much memory allocated for a small page file.\n\
\n\
You can try turning off the automatically allocate memory option in settings, and adjust the value till the game launches.\n\
Expand Down Expand Up @@ -713,7 +713,8 @@ launcher.cache_directory.disabled=Disabled
launcher.cache_directory.invalid=Unable to create cache directory, falling back to default.
launcher.contact=Contact Us
launcher.crash=Hello Minecraft! Launcher has encountered a fatal error\! Please copy the following log and ask for help on our Discord community, GitHub or Minecraft Forum.
launcher.crash_out_dated=Hello Minecraft! Launcher has encountered a fatal error\! Your launcher is outdated. Please update your launcher\!
launcher.crash.java_internal_error=Hello Minecraft! Launcher has encountered a fatal error because your Java is broken. Please uninstall your Java, and download a suitable Java <a href="https://bell-sw.com/pages/downloads/#downloads">here</a>.
launcher.crash.hmcl_out_dated=Hello Minecraft! Launcher has encountered a fatal error\! Your launcher is outdated. Please update your launcher\!
launcher.update_java=Please update your Java version.

login.empty_username=You have not set your username yet\!
Expand Down
12 changes: 6 additions & 6 deletions HMCL/src/main/resources/assets/lang/I18N_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ game.crash.reason.forgemod_resolution=El juego se ha bloqueado debido a un fallo
\n\
Forge proporcionó los siguientes detalles\:\n\
%1$s
game.crash.reason.night_config_fixes=El juego actual no puede seguir ejecutándose debido a algunos problemas con Night Config.\nPuedes intentar instalar el mod <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a>, que puede ayudarte con este problema.\nPara obtener más información, visite el <a href="https://www.github.com/Fuzss/nightconfigfixes">repositorio de Github</a> del mod.
game.crash.reason.night_config_fixes=El juego actual no puede seguir ejecutándose debido a algunos problemas con Night Config. \nPuedes intentar instalar el mod <a href="https://www.curseforge.com/minecraft/mc-mods/night-config-fixes">Night Config Fixes</a>, que puede ayudarte con este problema. \nPara obtener más información, visite el <a href="https://www.github.com/Fuzss/nightconfigfixes">repositorio de GitHub</a> del mod.
game.crash.reason.mod_resolution_collection=El juego se ha bloqueado porque la versión del mod no es compatible.\n\
\n\
%1$s requiere %2$s.\n\
Expand All @@ -469,10 +469,10 @@ Si quieres jugar con esta versión del mod instalada, debes cambiar la versión
En caso contrario, debes instalar una versión compatible con esta versión de Minecraft.
game.crash.reason.mod_resolution_mod_version=%1$s (Versión: %2$s)
game.crash.reason.mod_resolution_mod_version.any=%1$s (Cualquier versión)
game.crash.reason.forge_repeat_installation=El juego actual no puede continuar ejecutándose debido a una instalación duplicada de Forge. <a href="https://github.com/huanghongxun/HMCL/issues/1880">Este es un problema conocido</a>\nSe recomienda cargar los comentarios del registro en Github para que podamos encontrar más pistas y arreglar esta pregunta.\nActualmente puede ir a la instalación automática para desinstalar Forge y volver a instalarlo.
game.crash.reason.optifine_repeat_installation=El juego actual no puede seguir ejecutándose debido a la instalación repetida de Optifine.\nElimine Optifine de la carpeta Mod o vaya a Gestión de juegos-Instalación automática para desinstalar Optifine que se instala automáticamente.
game.crash.reason.modmixin_failure=El juego actual no puede continuar ejecutándose debido a algunas fallas en la inyección de mods.\nEsto generalmente significa que el mod tiene un error o no es compatible con el entorno actual.\nPuede consultar el registro para ver si hay un mod incorrecto.
game.crash.reason.file_or_content_verification_failed=El juego actual tiene un problema porque fallaron algunos archivos o la verificación de contenido.\nIntente eliminar esta versión (incluidas las modificaciones) y vuelva a descargarla, o intente usar un proxy cuando vuelva a descargar, etc.
game.crash.reason.forge_repeat_installation=El juego actual no puede continuar ejecutándose debido a una instalación duplicada de Forge. <a href="https://github.com/huanghongxun/HMCL/issues/1880">Este es un problema conocido</a>\nSe recomienda cargar los comentarios del registro en GitHub para que podamos encontrar más pistas y arreglar esta pregunta. \nActualmente puede ir a la instalación automática para desinstalar Forge y volver a instalarlo.
game.crash.reason.optifine_repeat_installation=El juego actual no puede seguir ejecutándose debido a la instalación repetida de Optifine. \nElimine Optifine de la carpeta Mod o vaya a Gestión de juegos-Instalación automática para desinstalar Optifine que se instala automáticamente.
game.crash.reason.modmixin_failure=El juego actual no puede continuar ejecutándose debido a algunas fallas en la inyección de mods. \nEsto generalmente significa que el mod tiene un error o no es compatible con el entorno actual. \nPuede consultar el registro para ver si hay un mod incorrecto.
game.crash.reason.file_or_content_verification_failed=El juego actual tiene un problema porque fallaron algunos archivos o la verificación de contenido. \nIntente eliminar esta versión (incluidas las modificaciones) y vuelva a descargarla, o intente usar un proxy cuando vuelva a descargar, etc.
game.crash.reason.mod_repeat_installation=El juego actual tiene múltiples Mods idénticos instalados repetidamente, y cada Mod solo puede aparecer una vez. Elimina los Mods repetidos y luego inicia el juego.
game.crash.reason.forge_error=Forge puede haber proporcionado un mensaje de error.\nPuede ver el registro y realizar las acciones correspondientes de acuerdo con la información de registro en el informe de errores.\nSi no ve un mensaje de error, puede consultar el informe de errores para saber cómo ocurrió el error.\n%1$s
game.crash.reason.mod_solution0=El juego actual no puede seguir ejecutándose debido a algunos problemas de modificación.\nPuede consultar el registro para ver si hay un mod incorrecto.
Expand Down Expand Up @@ -662,7 +662,7 @@ launcher.cache_directory.disabled=Desactivado
launcher.cache_directory.invalid=No se ha podido crear el directorio de la caché, volviendo a los valores por defecto.
launcher.contact=Contacta con nosotros
launcher.crash=¡Hello Minecraft! Launcher ha encontrado un error fatal. Por favor, copie el siguiente registro y pida ayuda en nuestra comunidad en Discord, GitHub o Minecraft Forums.
launcher.crash_out_dated=¡Hello Minecraft! Launcher ha encontrado un error fatal. Su launcher está desactualizado. Por favor, ¡actualícelo!.
launcher.crash.hmcl_out_dated=¡Hello Minecraft! Launcher ha encontrado un error fatal. Su launcher está desactualizado. Por favor, ¡actualícelo!.
launcher.update_java=Por favor, actualice su versión de Java.

login.empty_username=¡Todavía no has puesto tu nombre de usuario!
Expand Down
Loading

0 comments on commit ba58861

Please sign in to comment.