feat: add QBIN V3 decoder for particle.9

This commit is contained in:
tei
2026-09-21 08:03:38 +09:00
parent b2eac3e0bf
commit 0e8c87fe49
32 changed files with 6617 additions and 23 deletions

View File

@@ -0,0 +1,72 @@
{
"format": "QBV3",
"version": 3,
"blockWidth": 16,
"blockHeight": 16,
"fixtures": [
{
"layer": "current",
"frame": "T0",
"bytes": 104592,
"sha256": "b1b6d4a1dbb98971c3daca6b781587464e3528dd929da25196409b4b3b2bc052",
"width": 513,
"height": 513
},
{
"layer": "current",
"frame": "T1",
"bytes": 104112,
"sha256": "0588b3b1ed9e2d491adefa308f7d0b0707a38d773cc8d0802cded77a24c2aa24",
"width": 513,
"height": 513
},
{
"layer": "rain",
"frame": "T0",
"bytes": 153904,
"sha256": "567d99c6309d185184193f203f6eb7b2891572730ec9299371e6a0db0a067d20",
"width": 513,
"height": 513
},
{
"layer": "rain",
"frame": "T1",
"bytes": 153904,
"sha256": "8688d0373534d1c67ab4eed836e1314f14eba639594666683e6c22ff091e14fc",
"width": 513,
"height": 513
},
{
"layer": "wave",
"frame": "T0",
"bytes": 520688,
"sha256": "e4409ba0b09003e663dacdce8fc2ef35a1b929b5ccba8dc82e1ad0fc8c2f1202",
"width": 513,
"height": 769
},
{
"layer": "wave",
"frame": "T1",
"bytes": 520016,
"sha256": "4827e4c9a7917da944cdf65212cc6371b0b7276fb9ae3487625f1c539b27f178",
"width": 513,
"height": 769
},
{
"layer": "wind",
"frame": "T0",
"bytes": 621120,
"sha256": "e815d94c18711c70e27c570cfd89acda3a27d64646d04e0b29846404ca325979",
"width": 513,
"height": 769
},
{
"layer": "wind",
"frame": "T1",
"bytes": 622832,
"sha256": "bb2dbde0a8984d2fda4140cb6393744ede14fc9327663091e7afd4d2e37606da",
"width": 513,
"height": 769
}
]
}

View File

@@ -6,7 +6,7 @@ const marker = "// MapLibreParticleRNTestHost NavSea Particle release SDK";
module.exports = function withParticleNativeAndroid(config) {
return withProjectBuildGradle(config, (project) => {
if (project.modResults.contents.includes(marker)) return project;
project.modResults.contents += `\n${marker}\ngradle.projectsEvaluated {\n allprojects { p ->\n p.repositories.maven { repository -> repository.url = p.uri("https://pbf.jpcn.ccwu.cc/maven") }\n p.configurations.configureEach { configuration ->\n configuration.resolutionStrategy.dependencySubstitution {\n substitute module("org.maplibre.gl:android-sdk-opengl") using module("cc.navsea.maplibre:android-sdk-particle-opengl:13.4.1-particle.8")\n }\n }\n }\n}\nrootProject.ext.set("org.maplibre.reactnative.nativeVersion", "13.4.1")\nrootProject.ext.set("org.maplibre.reactnative.nativeVariant", "opengl")\n`;
project.modResults.contents += `\n${marker}\ngradle.projectsEvaluated {\n allprojects { p ->\n p.repositories.maven { repository -> repository.url = p.uri("https://pbf.jpcn.ccwu.cc/maven") }\n p.configurations.configureEach { configuration ->\n configuration.resolutionStrategy.dependencySubstitution {\n substitute module("org.maplibre.gl:android-sdk-opengl") using module("cc.navsea.maplibre:android-sdk-particle-opengl:13.4.1-particle.9")\n }\n }\n }\n}\nrootProject.ext.set("org.maplibre.reactnative.nativeVersion", "13.4.1")\nrootProject.ext.set("org.maplibre.reactnative.nativeVariant", "opengl")\n`;
return project;
});
};

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""校验仓库内冻结的 QBIN V3 Golden Fixtures。"""
import hashlib
import json
import struct
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[4]
ASSETS = ROOT / "integration/react-native/MapLibreParticleRNTestHost/assets/qbin-v3-golden"
MANIFEST = ASSETS / "manifest.json"
def sha256(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def main() -> int:
manifest = json.loads(MANIFEST.read_text(encoding="utf-8"))
if manifest.get("format") != "QBV3" or manifest.get("version") != 3:
raise RuntimeError("manifest 格式或版本不是 QBV3/v3")
if manifest.get("blockWidth") != 16 or manifest.get("blockHeight") != 16:
raise RuntimeError("Block Geometry 必须冻结为 16x16")
fixtures = manifest.get("fixtures", [])
if len(fixtures) != 8:
raise RuntimeError(f"必须存在 8 个 Golden Fixture,当前为 {len(fixtures)} 个")
for item in fixtures:
path = ASSETS / item["layer"] / f'{item["frame"]}.qbin'
data = path.read_bytes()
if data[:4] != b"QBV3" or data[4] != 3:
raise RuntimeError(f"{path}: magic/version 错误")
width, height = struct.unpack_from("<II", data, 16)
if len(data) != item["bytes"] or sha256(path) != item["sha256"]:
raise RuntimeError(f"{path}: bytes/SHA-256 与 manifest 不一致")
if width != item["width"] or height != item["height"]:
raise RuntimeError(f"{path}: grid 与 manifest 不一致")
print("QBIN_V3_GOLDEN_FIXTURES=PASS (8 files, block=16x16)")
return 0
if __name__ == "__main__":
sys.exit(main())