更新配置文件 Json Schema (#7012)

This commit is contained in:
Glavo
2026-10-19 20:34:27 +08:00
committed by GitHub
parent 8b147bf20a
commit 63207affc6
4 changed files with 481 additions and 2 deletions
@@ -82,7 +82,7 @@ public sealed abstract class GameSettings extends ObservableSetting {
public static final class Instance extends GameSettings implements JsonSchemaSetting {
/// The JSON schema supported by instance-specific game settings.
public static final JsonSchema CURRENT_SCHEMA =
new JsonSchema("instance-game-settings", new JsonSchema.Version(1, 0, 0));
new JsonSchema("instance-game-settings", new JsonSchema.Version(1, 0, 1));
/// Creates an empty instance setting.
public Instance() {
@@ -44,7 +44,7 @@ import java.util.Objects;
public final class GameSettingsPresets extends ObservableSetting implements JsonSchemaSetting {
/// The JSON schema supported by this game settings preset store.
public static final JsonSchema CURRENT_SCHEMA =
new JsonSchema("game-settings", new JsonSchema.Version(1, 0, 0));
new JsonSchema("game-settings", new JsonSchema.Version(1, 0, 1));
/// Creates an empty game settings preset store.
public GameSettingsPresets() {
+248
View File
@@ -0,0 +1,248 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.glavo.site/hmcl/game-settings/1.0.1",
"title": "HMCL Game Settings Presets",
"type": "object",
"additionalProperties": true,
"required": [
"$schema"
],
"patternProperties": {
"^\\$schema$": {
"enum": [
"https://schemas.glavo.site/hmcl/game-settings/1.0.1"
]
}
},
"properties": {
"presets": {
"type": "array",
"items": {
"$ref": "#/$defs/preset"
}
}
},
"$defs": {
"preset": {
"allOf": [
{
"$ref": "#/$defs/gameSettings"
},
{
"type": "object",
"additionalProperties": true,
"required": [
"id"
],
"properties": {
"id": {
"$ref": "#/$defs/gameSettingsPresetID"
},
"name": {
"$ref": "#/$defs/localizedText"
},
"autoNameNumber": {
"type": "integer",
"minimum": 1
},
"defaultIsolationType": {
"enum": [
"NEVER",
"ALWAYS",
"MODDED"
]
}
}
}
]
},
"gameSettings": {
"type": "object",
"additionalProperties": true,
"properties": {
"javaType": {
"enum": [
"AUTO",
"VERSION",
"DETECTED",
"CUSTOM"
]
},
"customJavaVersion": {
"type": "string"
},
"customJavaPath": {
"type": "string"
},
"detectedJava": {
"type": "object",
"additionalProperties": true,
"properties": {
"version": {
"type": "string"
},
"pathHash": {
"type": "string"
}
}
},
"notUseJavaw": {
"type": "boolean"
},
"jvmOptions": {
"type": "string"
},
"noJVMOptions": {
"type": "boolean"
},
"noOptimizingJVMOptions": {
"type": "boolean"
},
"notCheckJVM": {
"type": "boolean"
},
"notCheckGame": {
"type": "boolean"
},
"autoMemory": {
"type": "boolean"
},
"minMemory": {
"type": "integer"
},
"maxMemory": {
"type": "integer"
},
"permSize": {
"type": "string"
},
"windowType": {
"enum": [
"WINDOWED",
"FULLSCREEN",
"MAXIMIZED"
]
},
"width": {
"type": "number"
},
"height": {
"type": "number"
},
"runningDirectory": {
"type": "string"
},
"processPriority": {
"enum": [
"LOW",
"BELOW_NORMAL",
"NORMAL",
"ABOVE_NORMAL",
"HIGH"
]
},
"launcherVisibility": {
"enum": [
"CLOSE",
"HIDE",
"KEEP",
"HIDE_AND_REOPEN"
]
},
"allowAutoAgent": {
"type": "boolean"
},
"disableAutoGameOptions": {
"type": "boolean"
},
"gameArguments": {
"type": "string"
},
"graphicsBackend": {
"enum": [
"DEFAULT",
"OPENGL",
"VULKAN"
]
},
"openGLRenderer": {
"type": "string"
},
"vulkanRenderer": {
"type": "string"
},
"highPerformance": {
"type": "boolean"
},
"environmentVariables": {
"type": "string"
},
"commandWrapper": {
"type": "string"
},
"preLaunchCommand": {
"type": "string"
},
"postExitCommand": {
"type": "string"
},
"quickPlay": {
"enum": [
"NONE",
"MULTIPLAYER",
"SINGLEPLAYER",
"REALMS"
]
},
"quickPlayMultiplayer": {
"type": "string"
},
"quickPlaySingleplayer": {
"type": "string"
},
"quickPlayRealms": {
"type": "string"
},
"showLogs": {
"type": "boolean"
},
"enableDebugLogOutput": {
"type": "boolean"
},
"notPatchNatives": {
"type": "boolean"
},
"useCustomNatives": {
"type": "boolean"
},
"nativesDirectory": {
"type": "string"
},
"useNativeGLFW": {
"type": "boolean"
},
"useNativeOpenAL": {
"type": "boolean"
}
}
},
"gameSettingsPresetID": {
"type": "string",
"pattern": "^game-settings-preset:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
},
"localizedText": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"minProperties": 1,
"additionalProperties": {
"type": "string"
}
}
]
}
}
}
@@ -0,0 +1,231 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.glavo.site/hmcl/instance-game-settings/1.0.1",
"title": "HMCL Instance Game Settings",
"allOf": [
{
"$ref": "#/$defs/gameSettings"
},
{
"type": "object",
"additionalProperties": true,
"required": [
"$schema"
],
"patternProperties": {
"^\\$schema$": {
"enum": [
"https://schemas.glavo.site/hmcl/instance-game-settings/1.0.1"
]
}
},
"properties": {
"parent": {
"$ref": "#/$defs/gameSettingsPresetID"
},
"icon": {
"enum": [
"DEFAULT",
"GRASS",
"CHEST",
"CHICKEN",
"COMMAND",
"OPTIFINE",
"CRAFT_TABLE",
"FABRIC",
"FORGE",
"NEO_FORGE",
"FURNACE",
"QUILT",
"APRIL_FOOLS",
"CLEANROOM",
"LEGACY_FABRIC"
]
},
"overrideProperties": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
}
}
],
"$defs": {
"gameSettings": {
"type": "object",
"additionalProperties": true,
"properties": {
"javaType": {
"enum": [
"AUTO",
"VERSION",
"DETECTED",
"CUSTOM"
]
},
"customJavaVersion": {
"type": "string"
},
"customJavaPath": {
"type": "string"
},
"detectedJava": {
"type": "object",
"additionalProperties": true,
"properties": {
"version": {
"type": "string"
},
"pathHash": {
"type": "string"
}
}
},
"notUseJavaw": {
"type": "boolean"
},
"jvmOptions": {
"type": "string"
},
"noJVMOptions": {
"type": "boolean"
},
"noOptimizingJVMOptions": {
"type": "boolean"
},
"notCheckJVM": {
"type": "boolean"
},
"notCheckGame": {
"type": "boolean"
},
"autoMemory": {
"type": "boolean"
},
"minMemory": {
"type": "integer"
},
"maxMemory": {
"type": "integer"
},
"permSize": {
"type": "string"
},
"windowType": {
"enum": [
"WINDOWED",
"FULLSCREEN",
"MAXIMIZED"
]
},
"width": {
"type": "number"
},
"height": {
"type": "number"
},
"runningDirectory": {
"type": "string"
},
"processPriority": {
"enum": [
"LOW",
"BELOW_NORMAL",
"NORMAL",
"ABOVE_NORMAL",
"HIGH"
]
},
"launcherVisibility": {
"enum": [
"CLOSE",
"HIDE",
"KEEP",
"HIDE_AND_REOPEN"
]
},
"allowAutoAgent": {
"type": "boolean"
},
"disableAutoGameOptions": {
"type": "boolean"
},
"gameArguments": {
"type": "string"
},
"graphicsBackend": {
"enum": [
"DEFAULT",
"OPENGL",
"VULKAN"
]
},
"openGLRenderer": {
"type": "string"
},
"vulkanRenderer": {
"type": "string"
},
"highPerformance": {
"type": "boolean"
},
"environmentVariables": {
"type": "string"
},
"commandWrapper": {
"type": "string"
},
"preLaunchCommand": {
"type": "string"
},
"postExitCommand": {
"type": "string"
},
"quickPlay": {
"enum": [
"NONE",
"MULTIPLAYER",
"SINGLEPLAYER",
"REALMS"
]
},
"quickPlayMultiplayer": {
"type": "string"
},
"quickPlaySingleplayer": {
"type": "string"
},
"quickPlayRealms": {
"type": "string"
},
"showLogs": {
"type": "boolean"
},
"enableDebugLogOutput": {
"type": "boolean"
},
"notPatchNatives": {
"type": "boolean"
},
"useCustomNatives": {
"type": "boolean"
},
"nativesDirectory": {
"type": "string"
},
"useNativeGLFW": {
"type": "boolean"
},
"useNativeOpenAL": {
"type": "boolean"
}
}
},
"gameSettingsPresetID": {
"type": "string",
"pattern": "^game-settings-preset:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
}
}
}