Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_WIN32_EXECUTABLE ON)

set(HMCL_EXPECTED_JAVA_MAJOR_VERSION 17)

add_compile_definitions(UNICODE _UNICODE)
add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601) # Windows 7

Expand Down
3 changes: 3 additions & 0 deletions HMCL/config.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#pragma once

#define HMCL_LAUNCHER_VERSION L"@PROJECT_VERSION@"
#define HMCL_EXPECTED_JAVA_MAJOR_VERSION @HMCL_EXPECTED_JAVA_MAJOR_VERSION@
#define HMCL_EXPECTED_JAVA_MAJOR_VERSION_STR "@HMCL_EXPECTED_JAVA_MAJOR_VERSION@"

6 changes: 4 additions & 2 deletions HMCL/i18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

#include "i18n.h"

#include "config.h"

HLI18N HLI18N::Instance() {
HLI18N i18n = {.errorSelfPath = L"Failed to get the exe path.",
.errorInvalidHMCLJavaHome =
L"The Java path specified by HMCL_JAVA_HOME is invalid. Please update it to a valid Java "
"installation path or remove this environment variable.",
.errorJavaNotFound =
L"HMCL requires Java 11 or later to run,\n"
L"HMCL requires Java " HMCL_EXPECTED_JAVA_MAJOR_VERSION_STR " or later to run,\n"
L"Click 'OK' to start downloading java.\n"
L"Please restart HMCL after installing Java."};

Expand All @@ -17,7 +19,7 @@ HLI18N HLI18N::Instance() {
i18n.errorSelfPath = L"获取程序路径失败。";
i18n.errorInvalidHMCLJavaHome = L"HMCL_JAVA_HOME 所指向的 Java 路径无效,请更新或删除该变量。\n";
i18n.errorJavaNotFound =
L"HMCL 需要 Java 11 或更高版本才能运行,点击“确定”开始下载 Java。\n"
L"HMCL 需要 Java " HMCL_EXPECTED_JAVA_MAJOR_VERSION_STR " 或更高版本才能运行,点击“确定”开始下载 Java。\n"
L"请在安装 Java 完成后重新启动 HMCL。";
}
return i18n;
Expand Down
5 changes: 2 additions & 3 deletions HMCL/java.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#include <unordered_set>
#include <vector>

#include "config.h"
#include "path.h"

constexpr std::uint16_t HL_EXPECTED_JAVA_MAJOR_VERSION = 11;

struct HLJavaVersion {
static HLJavaVersion INVALID;

Expand All @@ -26,7 +25,7 @@ struct HLJavaVersion {
std::strong_ordering operator<=>(const HLJavaVersion &other) const = default;

[[nodiscard]] bool IsAcceptable() const {
return major >= HL_EXPECTED_JAVA_MAJOR_VERSION;
return major >= HMCL_EXPECTED_JAVA_MAJOR_VERSION;
}

[[nodiscard]] std::wstring ToWString() const {
Expand Down