aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2021-12-28 11:40:59 -0800
committerTrumeet <yuuta@yuuta.moe>2021-12-28 11:40:59 -0800
commit08207412b0aa4d95cebf1279d571b96f04bebf78 (patch)
treef6f2053aaf7181e503c6c0683d608492b02d7d1b
parentbc0aaf7fdd30bab555ed2f12bc7c120c93d2e809 (diff)
downloadminecraft-pacman-08207412b0aa4d95cebf1279d571b96f04bebf78.tar
minecraft-pacman-08207412b0aa4d95cebf1279d571b96f04bebf78.tar.gz
minecraft-pacman-08207412b0aa4d95cebf1279d571b96f04bebf78.tar.bz2
minecraft-pacman-08207412b0aa4d95cebf1279d571b96f04bebf78.zip
Fix compatibility
-rw-r--r--README.md14
-rw-r--r--gen.c21
-rwxr-xr-xlauncher2
3 files changed, 25 insertions, 12 deletions
diff --git a/README.md b/README.md
index 4651951..1dc4597 100644
--- a/README.md
+++ b/README.md
@@ -28,10 +28,16 @@ Whenever you need to build a different Minecraft version, do the steps again (ch
1.13
+1.12
+
+rd-132211
+
Basic testing for 1.14, 1.15 and 1.16 (no assets)
1.15 with Fabric
+Note that for versions <= 1.12, you need Java 8 instead.
+
## Fabric
After install the `minecraft-fabric-xxx` package, you will have Fabric jars in the same directory as Minecraft jars, and they will be added to the classpath (but not used). If you want to use Fabric, source the `launcher.fabric.gen` after sourcing `launcher.gen`. It will set necessary environment variables (e.g. `MAIN_CLASS`) for you.
@@ -40,14 +46,18 @@ After install the `minecraft-fabric-xxx` package, you will have Fabric jars in t
Forge support
+Rewrite argument processing
+
+Provide a JSON as well
+
## Known issues
Assets folders cannot be shared across versions (i.e. you must have a dedicated assets folder for each asset version).
-Library compatibility issues with version <= 1.12: Inconsistency detected by ld.so: dl-lookup.c: 105: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!
-
Compatibility with legacy versions that do not include `-cp` in their manifest.
+Some arguments are not supported.
+
## License
Thanks to my friends' help.
diff --git a/gen.c b/gen.c
index 7ea6b74..7449d15 100644
--- a/gen.c
+++ b/gen.c
@@ -188,8 +188,8 @@ static void append(FILE *stream, const char *key, const char *value) {
value);
}
-static void arg(const char jvm, const char *value) {
- if (strchr(value, ' ')) {
+static void arg(const char jvm, const char *value, const char allow_space) {
+ if (!allow_space && strchr(value, ' ')) {
fprintf(stderr, "Warn: Refusing argument with space: %s\n", value);
return;
}
@@ -325,7 +325,7 @@ static void parse_arguments(struct json_object *obj) {
for (unsigned int i = 0; i < args_len; i++) {
json_object *item = json_object_array_get_idx(args, i);
if (json_object_is_type(item, json_type_string)) {
- arg(0, json_object_get_string(item));
+ arg(0, json_object_get_string(item), 0);
continue;
}
if (!json_object_is_type(item, json_type_object)) {
@@ -361,7 +361,7 @@ static void parse_arguments(struct json_object *obj) {
for (unsigned int i = 0; i < args_len; i++) {
json_object *item = json_object_array_get_idx(args, i);
if (json_object_is_type(item, json_type_string)) {
- arg(1, json_object_get_string(item));
+ arg(1, json_object_get_string(item), 0);
continue;
}
if (!json_object_is_type(item, json_type_object)) {
@@ -383,24 +383,25 @@ static void parse_arguments(struct json_object *obj) {
if (!rule) continue;
if (rule == 2) {
if (json_object_is_type(value, json_type_string)) {
- arg(2, json_object_get_string(value));
+ arg(2, json_object_get_string(value), 0);
} else {
for (unsigned int j = 0; j < value_len; j++) {
arg(2,
json_object_get_string(
json_object_array_get_idx(value, j)
- ));
+ ),
+ 0);
}
}
} else {
if (json_object_is_type(value, json_type_string)) {
- arg(1, json_object_get_string(value));
+ arg(1, json_object_get_string(value), 0);
} else {
for (unsigned int j = 0; j < value_len; j++) {
arg(1,
json_object_get_string(
json_object_array_get_idx(value, j)
- ));
+ ), 0);
}
}
}
@@ -591,7 +592,7 @@ static void fetch_version(const char *url, const char is_fabric) {
if (json_object_object_get_ex(json, "arguments", &obj)) {
parse_arguments(obj);
} else if (json_object_object_get_ex(json, "minecraftArguments", &obj)) {
- arg(0, json_object_get_string(obj));
+ arg(0, json_object_get_string(obj), 1 /* Allow */);
} else {
cleanup();
errx(1, "Invalid version.json: No arguments or minecraftArguments object.");
@@ -623,7 +624,7 @@ static void fetch_version(const char *url, const char is_fabric) {
"Unsupported Log4J Configuration: %s",
(char *) json_object_get_string(a));
} else {
- arg(1, "-Dlog4j.configurationFile=LOG4J_XML_PATH");
+ arg(1, "-Dlog4j.configurationFile=LOG4J_XML_PATH", 1 /* Disable check */);
}
}
}
diff --git a/launcher b/launcher
index 1a4b0c7..747ce83 100755
--- a/launcher
+++ b/launcher
@@ -31,6 +31,8 @@ mkdir -p $assets_root/skin
ln -s /usr/share/minecraft/assets/$assets_index_name/objects $assets_root/objects || true
ln -s /usr/share/minecraft/assets/$assets_index_name/indexes $assets_root/indexes || true
+# For 1.12 and below, use this line instead:
+# exec /usr/lib/jvm/java-8-openjdk/jre/bin/java \
exec /usr/lib/jvm/java-17-openjdk/bin/java \
$JVM_ARGS \
$MAIN_CLASS \