Preserve requested graphics backend by marking current option version
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"java_major": 25,
|
||||
"fabric_loader": "0.19.5",
|
||||
"pack_version": "0.7.0",
|
||||
"options_data_version": 5023,
|
||||
"projects": {
|
||||
"sodium": {
|
||||
"slug": "sodium",
|
||||
|
||||
@@ -74,6 +74,10 @@ class PackTests(unittest.TestCase):
|
||||
[f"overrides/mods/horizon-lab-{build_pack.read_lock()['pack_version']}.jar"])
|
||||
index = json.loads(archive.read("modrinth.index.json"))
|
||||
self.assertEqual(index["dependencies"]["minecraft"], "26.3")
|
||||
options = dict(line.split(":", 1) for line in archive.read("overrides/options.txt").decode().splitlines())
|
||||
# A missing/currently wrong version invokes the game's graphics API reset migration.
|
||||
self.assertEqual(options["version"], "5023")
|
||||
self.assertEqual(json.loads(options["preferredGraphicsBackend"]), "opengl")
|
||||
for entry in index["files"]:
|
||||
self.assertEqual(set(entry["hashes"]), {"sha1", "sha512"})
|
||||
self.assertTrue(entry["downloads"][0].startswith("https://cdn.modrinth.com/"))
|
||||
|
||||
@@ -46,6 +46,10 @@ def test_metrics():
|
||||
def build():
|
||||
lock = json.loads((ROOT / "packs/mods.lock.json").read_text())
|
||||
_, jars, _ = runtime.prepare_client(assets=False)
|
||||
with zipfile.ZipFile(jars[0]) as game_archive:
|
||||
game_version = json.loads(game_archive.read("version.json"))
|
||||
if game_version["world_version"] != lock["options_data_version"]:
|
||||
raise ValueError("Pack options data version does not match the verified game JAR")
|
||||
dh = lock["projects"]["distanthorizons"]
|
||||
jars.append(runtime.fetch(dh["url"], ROOT / ".local/pack-cache" / dh["filename"],
|
||||
dh["hashes"]["sha512"], "sha512"))
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ def mod_path(entry):
|
||||
|
||||
def options(profile):
|
||||
# Simulation distance stays at the vanilla default in every profile.
|
||||
values = {"renderDistance": profile["render"], "simulationDistance": 12, "enableVsync": "false",
|
||||
values = {"version": read_lock()["options_data_version"],
|
||||
"renderDistance": profile["render"], "simulationDistance": 12, "enableVsync": "false",
|
||||
"maxFps": 260, "guiScale": 2, "onboardAccessibility": "false",
|
||||
"preferredGraphicsBackend": json.dumps(profile.get("backend", "opengl"))}
|
||||
return "".join(f"{key}:{value}\n" for key, value in values.items())
|
||||
|
||||
Reference in New Issue
Block a user