|
| 1 | +# Contributing Guide |
| 2 | + |
| 3 | +<!-- #BEGIN LANGUAGE_SWITCHER --> |
| 4 | +**English** | [中文](Contributing_zh.md) |
| 5 | +<!-- #END LANGUAGE_SWITCHER --> |
| 6 | + |
| 7 | +## Build HMCL |
| 8 | + |
| 9 | +### Requirements |
| 10 | + |
| 11 | +To build the HMCL launcher, you need to install JDK 17 (or higher). You can download it here: [Download Liberica JDK](https://bell-sw.com/pages/downloads/#jdk-25-lts). |
| 12 | + |
| 13 | +After installing the JDK, make sure the `JAVA_HOME` environment variable points to the required JDK directory. |
| 14 | +You can check the JDK version that `JAVA_HOME` points to like this: |
| 15 | + |
| 16 | +<details> |
| 17 | +<summary>Windows</summary> |
| 18 | + |
| 19 | +PowerShell: |
| 20 | + |
| 21 | +``` |
| 22 | +PS > & "$env:JAVA_HOME/bin/java.exe" -version |
| 23 | +openjdk version "25" 2025-09-16 LTS |
| 24 | +OpenJDK Runtime Environment (build 25+37-LTS) |
| 25 | +OpenJDK 64-Bit Server VM (build 25+37-LTS, mixed mode, sharing) |
| 26 | +``` |
| 27 | + |
| 28 | +</details> |
| 29 | + |
| 30 | +<details> |
| 31 | +<summary>Linux/macOS/FreeBSD</summary> |
| 32 | + |
| 33 | +``` |
| 34 | +> $JAVA_HOME/bin/java -version |
| 35 | +openjdk version "25" 2025-09-16 LTS |
| 36 | +OpenJDK Runtime Environment (build 25+37-LTS) |
| 37 | +OpenJDK 64-Bit Server VM (build 25+37-LTS, mixed mode, sharing) |
| 38 | +``` |
| 39 | + |
| 40 | +</details> |
| 41 | + |
| 42 | +### Get HMCL Source Code |
| 43 | + |
| 44 | +- You can get the latest source code via [Git](https://git-scm.com/downloads): |
| 45 | + ```shell |
| 46 | + git clone https://github.com/HMCL-dev/HMCL.git |
| 47 | + cd HMCL |
| 48 | + ``` |
| 49 | +- You can manually download a specific version of the source code from the [GitHub Release page](https://github.com/HMCL-dev/HMCL/releases). |
| 50 | + |
| 51 | +### Build HMCL |
| 52 | + |
| 53 | +To build HMCL, switch to the root directory of the HMCL project and run the following command: |
| 54 | + |
| 55 | +```shell |
| 56 | +./gradlew clean makeExecutables |
| 57 | +``` |
| 58 | + |
| 59 | +The built HMCL program files are located in the `HMCL/build/libs` subdirectory under the project root. |
| 60 | + |
| 61 | +## Debug Options |
| 62 | + |
| 63 | +> [!WARNING] |
| 64 | +> This document describes HMCL's internal features, which we do not guarantee to be stable and may be modified or removed at any time. |
| 65 | +> |
| 66 | +> Please use these features with caution, as improper use may cause HMCL to behave abnormally or even crash. |
| 67 | +
|
| 68 | +HMCL provides a series of debug options to control the behavior of the launcher. |
| 69 | + |
| 70 | +These options can be specified via environment variables or JVM parameters. If both are present, JVM parameters will override the environment variable settings. |
| 71 | + |
| 72 | +| Environment Variable | JVM Parameter | Function | Default Value | Additional Notes | |
| 73 | +|-----------------------------|----------------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|---------------------------| |
| 74 | +| `HMCL_JAVA_HOME` | | Specifies the Java used to launch HMCL | | Only effective for exe/sh | |
| 75 | +| `HMCL_JAVA_OPTS` | | Specifies the default JVM parameters when launching HMCL | | Only effective for exe/sh | |
| 76 | +| `HMCL_FORCE_GPU` | | Specifies whether to force GPU-accelerated rendering | `false` | | |
| 77 | +| `HMCL_ANIMATION_FRAME_RATE` | | Specifies the animation frame rate of HMCL | `60` | | |
| 78 | +| `HMCL_LANGUAGE` | | Specifies the default language of HMCL | Uses the system default language | | |
| 79 | +| | `-Dhmcl.dir=<path>` | Specifies the current data folder of HMCL | `./.hmcl` | | |
| 80 | +| | `-Dhmcl.home=<path>` | Specifies the user data folder of HMCL | Windows: `%APPDATA\.hmcl`<br>Linux/BSD: `$XDG_DATA_HOME/hmcl`<br>macOS: `~Library/Application Support/hmcl` | | |
| 81 | +| | `-Dhmcl.self_integrity_check.disable=true` | Disables self-integrity checks during updates | | | |
| 82 | +| | `-Dhmcl.bmclapi.override=<url>` | Specifies the API Root for BMCLAPI | `https://bmclapi2.bangbang93.com` | | |
| 83 | +| | `-Dhmcl.discoapi.override=<url>` | Specifies the API Root for foojay Disco API | `https://api.foojay.io/disco/v3.0` | | |
| 84 | +| `HMCL_FONT` | `-Dhmcl.font.override=<font family>` | Specifies the default font for HMCL | Uses the system default font | | |
| 85 | +| | `-Dhmcl.update_source.override=<url>` | Specifies the update source for HMCL | `https://hmcl.huangyuhui.net/api/update_link` | | |
| 86 | +| | `-Dhmcl.authlibinjector.location=<path>` | Specifies the location of the authlib-injector JAR file | Uses the built-in authlib-injector | | |
| 87 | +| | `-Dhmcl.openjfx.repo=<maven repository url>` | Adds a custom Maven repository for downloading OpenJFX | | | |
| 88 | +| | `-Dhmcl.native.encoding=<encoding>` | Specifies the native encoding | Uses the system's native encoding | | |
| 89 | +| | `-Dhmcl.microsoft.auth.id=<App ID>` | Specifies the Microsoft OAuth App ID | Uses the built-in Microsoft OAuth App ID | | |
| 90 | +| | `-Dhmcl.microsoft.auth.secret=<App Secret>` | Specifies the Microsoft OAuth App Secret | Uses the built-in Microsoft OAuth App Secret | | |
| 91 | +| | `-Dhmcl.curseforge.apikey=<Api Key>` | Specifies the CurseForge API key | Uses the built-in CurseForge API key | | |
| 92 | +| | `-Dhmcl.native.backend=<auto/jna/none>` | Specifies the native backend used by HMCL | `auto` | | |
| 93 | +| | `-Dhmcl.hardware.fastfetch=<true/false>` | Specifies whether to use fastfetch for hardware detection | `true` | | |
0 commit comments