Skip to content

Latest commit

 

History

History
100 lines (73 loc) · 3.28 KB

File metadata and controls

100 lines (73 loc) · 3.28 KB

WebGAL_k

中文版

Built on WebGAL / Tauri v2 / hexz. Packs game assets into a single .hxz archive, fully compatible with Steamworks delta patching.


Architecture

%%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}}}%%
flowchart LR
    subgraph Disk["💾 Distribution"]
        HXZ["📦 game.hxz<br/>AES-256-GCM encrypted<br/>random-access index"]
        APP_MAC["🖥️ .app (macOS)"]
        APP_WIN["🪟 .exe (Windows)"]
        HXZ -. "independent of executable<br/>Steamworks delta patching" .- APP_MAC
        HXZ -. "independent of executable<br/>Steamworks delta patching" .- APP_WIN
    end

    subgraph Rust["🦀 src-tauri/src/lib.rs"]
        Protocol["hexz:// protocol"]
        IPC["read_hexz_file IPC"]
        Store["Arc&lt;ResourcePack&gt;<br/>lock-free concurrent reads"]
    end

    subgraph JS["📦 hexzFetch.ts"]
        Text["hexzText() / hexzJson()"]
        Asset["assetSetter() → hexz://localhost/xxx"]
    end

    HXZ --> Protocol
    HXZ --> IPC
    Protocol -- "img/audio/video/font" --> Browser_MAC["🌐 WKWebView (macOS)"]
    Protocol -- "img/audio/video/font" --> Browser_WIN["🌐 WebView2 (Windows)"]
    IPC -- "json/txt/scss" --> Text
    Text --> Browser_MAC
    Text --> Browser_WIN
    Asset --> Protocol
    Asset --> Text
Loading

Dual-channel designhexz:// protocol for no-cors media, Tauri IPC for text resources (WKWebView blocks cross-origin XHR).

Resource Type Channel Reason
images / audio / video / fonts hexz:// protocol native browser support, zero overhead
json / txt / scss Tauri IPC WKWebView CORS restriction

Differences from Upstream WebGAL

Asset Loading

Upstream WebGAL WebGAL_k
Assets scattered in public/game/ Packed into single game.hxz encrypted archive
Loaded via relative path ./game/xxx Loaded via hexz://localhost/xxx protocol
All requests use browser fetch/XHR Dual channels: no-cors via protocol, text via IPC
Service Worker for caching/relay No SW (WKWebView incompatible)

Security

Upstream WebGAL WebGAL_k
Assets stored in plaintext on disk AES-256-GCM encryption
No native password support HEXZ_PASSWORD env var for decryption

Distribution & Updates

Upstream WebGAL WebGAL_k
Web deployment, assets load with page Desktop app via Tauri
Full redeploy on update .hxz independent of executable, Steamworks delta patch ready
Client fetches full resource per request O(1) random access, single-file reads on demand

Build

# 1. Pack game assets into .hxz archive (unencrypted)
# You can also use the GUI tool for this step
cargo run --manifest-path hexz_k/Cargo.toml -- pack game/ game.hxz

# 2. Build desktop app
bun tauri build

# 3. Deploy: place game.hxz alongside the executable
cp game.hxz src-tauri/target/release/bundle/macos/webgal-k.app/Contents/MacOS/

find_hexz() searches exe directory, parent directory, and macOS .app bundle root.

License

MIT · Built on WebGAL