diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ee3a895 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,66 @@ +name: build +on: [push, pull_request] + +jobs: + build: + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-20.04, windows-latest] + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Install dependencies for tauri build (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + version: 1.0 + + - name: Create necessary distDir for tauri to compile + run: mkdir client/dist + + - name: Run rust tests + run: cargo test --all-features + + - name: Install frontend dependencies + working-directory: client + run: pnpm install + + - name: Build tauri app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + projectPath: client + distPath: client/dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aec7870 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: "publish" +on: + push: + tags: + - "**" + +jobs: + publish-tauri: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-20.04, windows-latest] + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Install dependencies for tauri build (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + version: 1.0 + + - name: Create necessary distDir for tauri to compile + run: mkdir client/dist + + - name: Run rust tests + run: cargo test --all-features + + - name: Install frontend dependencies + working-directory: client + run: pnpm install + + - name: Release tauri app + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: "" + with: + projectPath: client + distPath: client/dist + tagName: xi-tinkerer-v__VERSION__ + releaseName: "XI Tinkerer v__VERSION__" + releaseBody: "See the assets to download this version and install." + releaseDraft: true + prerelease: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a727c0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/data diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..24d7cc6 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] +} diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..6d0fcb9 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4450 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" + +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" + +[[package]] +name = "atk" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58aeb089fb698e06db8089971c7ee317ab9644bade33383f63631437b03aafb6" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "3.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "bytemuck" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "glib", + "libc", + "thiserror", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8" +dependencies = [ + "glib-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "cargo_toml" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" +dependencies = [ + "serde", + "toml 0.7.6", +] + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3431df59f28accaf4cb4eed4a9acc66bea3f3c3753aa6cdc2f024174ef232af7" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-expr" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b40ccee03b5175c18cde8f37e7d2a33bcef6f8ec8f7cc0d81090d1bb380949c9" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "winapi", +] + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "common" +version = "0.1.0" +dependencies = [ + "anyhow", + "thiserror", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa 0.4.8", + "matches", + "phf 0.8.0", + "proc-macro2", + "quote", + "smallvec", + "syn 1.0.109", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.28", +] + +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.28", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "dats" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64 0.21.3", + "bitflags 2.4.0", + "common", + "encoding", + "num_enum 0.7.0", + "regex", + "serde", + "serde_derive", + "serde_yaml", + "thiserror", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "document-features" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e493c573fce17f00dcab13b6ac057994f3ce17d1af4dc39bfd482b83c6eb6157" +dependencies = [ + "litrs", +] + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "embed-resource" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7f1e82a60222fc67bfd50d752a9c89da5cce4c39ed39decc84a443b07bbd69a" +dependencies = [ + "cc", + "rustc_version", + "toml 0.7.6", + "vswhom", + "winreg 0.11.0", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "encoding" +version = "0.1.0" +dependencies = [ + "anyhow", + "pretty_assertions", +] + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "fdeflate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.2.16", + "windows-sys 0.48.0", +] + +[[package]] +name = "flate2" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gdk" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" +dependencies = [ + "bitflags 1.3.2", + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140b2f5378256527150350a8346dbdb08fadc13453a7a2d73aecd5fab3c402a7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "gdk-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e7a08c1e8f06f4177fb7e51a777b8c1689f743a7bc11ea91d44d2226073a88" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps 6.1.1", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cca49a59ad8cfdf36ef7330fe7bdfbe1d34323220cc16a0de2679ee773aee2c2" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps 6.1.1", +] + +[[package]] +name = "gdkx11-sys" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b7f8c7a84b407aa9b143877e267e848ff34106578b64d1e0a24bf550716178" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps 6.1.1", + "x11", +] + +[[package]] +name = "generator" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "windows 0.48.0", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + +[[package]] +name = "gio" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" +dependencies = [ + "bitflags 1.3.2", + "futures-channel", + "futures-core", + "futures-io", + "gio-sys", + "glib", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32157a475271e2c4a023382e9cab31c4584ee30a97da41d3c4e9fdd605abcf8d" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.1.1", + "winapi", +] + +[[package]] +name = "glib" +version = "0.15.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" +dependencies = [ + "bitflags 1.3.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "once_cell", + "smallvec", + "thiserror", +] + +[[package]] +name = "glib-macros" +version = "0.15.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "glib-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" +dependencies = [ + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "globset" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aca8bbd8e0707c1887a8bbb7e6b40e228f251ff5d62c8220a4a7a53c73aff006" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "gobject-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a" +dependencies = [ + "glib-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "gtk" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" +dependencies = [ + "atk", + "bitflags 1.3.2", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "once_cell", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5bc2f0587cba247f60246a0ca11fe25fb733eabc3de12d1965fc07efab87c84" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps 6.1.1", +] + +[[package]] +name = "gtk3-macros" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684c0456c086e8e7e9af73ec5b84e35938df394712054550e81558d21c44ab0d" +dependencies = [ + "anyhow", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa 1.0.9", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.9", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows 0.48.0", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3804960be0bb5e4edb1e1ad67afd321a9ecfd875c3e65c099468fd2717d7cae" +dependencies = [ + "byteorder", + "png", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" +dependencies = [ + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + +[[package]] +name = "image" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "num-rational", + "num-traits", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "indoc" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" + +[[package]] +name = "indoc" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4" + +[[package]] +name = "infer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a898e4b7951673fce96614ce5751d13c40fc5674bc2d759288e46c3ab62598b3" +dependencies = [ + "cfb", +] + +[[package]] +name = "inotify" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "javascriptcore-rs" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf053e7843f2812ff03ef5afe34bb9c06ffee120385caad4f6b9967fcd37d41c" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "905fbb87419c5cde6e3269537e4ea7d46431f3008c5d057e915ef3f115e7793c" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 5.0.0", +] + +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f54898088ccb91df1b492cc80029a6fdf1c48ca0db7c6822a8babad69c94658" +dependencies = [ + "serde", + "serde_json", + "thiserror", + "treediff", +] + +[[package]] +name = "kqueue" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + +[[package]] +name = "kuchiki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" +dependencies = [ + "cssparser", + "html5ever", + "matches", + "selectors", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "line-wrap" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" +dependencies = [ + "safemem", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + +[[package]] +name = "litrs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9275e0933cf8bb20f008924c0cb07a0692fe54d8064996520bf998de9eb79aa" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" + +[[package]] +name = "loom" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "markup5ever" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +dependencies = [ + "log", + "phf 0.8.0", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minisign-verify" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ndk" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys", + "num_enum 0.5.11", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "notify" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51" +dependencies = [ + "bitflags 1.3.2", + "crossbeam-channel", + "filetime", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "mio", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +dependencies = [ + "num_enum_derive 0.7.0", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "open" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +dependencies = [ + "pathdiff", + "windows-sys 0.42.0", +] + +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.4.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db7e971c2c2bba161b2d2fdf37080177eff520b3bc044787c7f1f5f9e78d869b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pango" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" +dependencies = [ + "bitflags 1.3.2", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "smallvec", + "windows-targets 0.48.1", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "plist" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" +dependencies = [ + "base64 0.21.3", + "indexmap 1.9.3", + "line-wrap", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "processor" +version = "0.1.0" +dependencies = [ + "anyhow", + "dats", + "serde", + "serde_yaml", + "specta", + "thiserror", + "threadpool", + "tokio", +] + +[[package]] +name = "quick-xml" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.10", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.10", + "redox_syscall 0.2.16", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.3.4", + "regex-syntax 0.7.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "reqwest" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +dependencies = [ + "base64 0.21.3", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.50.0", +] + +[[package]] +name = "rfd" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea" +dependencies = [ + "block", + "dispatch", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "lazy_static", + "log", + "objc", + "objc-foundation", + "objc_id", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.37.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" +dependencies = [ + "bitflags 1.3.2", + "cssparser", + "derive_more", + "fxhash", + "log", + "matches", + "phf 0.8.0", + "phf_codegen", + "precomputed-hash", + "servo_arc", + "smallvec", + "thin-slice", +] + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "serde_json" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +dependencies = [ + "itoa 1.0.9", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa 1.0.9", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e47d95bc83ed33b2ecf84f4187ad1ab9685d18ff28db000c99deac8ce180e3" +dependencies = [ + "base64 0.21.3", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea3cee93715c2e266b9338b7544da68a9f24e227722ba482bd1c024367c77c65" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "serde_yaml" +version = "0.9.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +dependencies = [ + "indexmap 2.0.0", + "itoa 1.0.9", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9823f2d3b6a81d98228151fdeaf848206a7855a7a042bbf9bf870449a66cafb" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "soup2" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b4d76501d8ba387cf0fefbe055c3e0a59891d09f0f995ae4e4b16f6b60f3c0" +dependencies = [ + "bitflags 1.3.2", + "gio", + "glib", + "libc", + "once_cell", + "soup2-sys", +] + +[[package]] +name = "soup2-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "009ef427103fcb17f802871647a7fa6c60cbb654b4c4e4c0ac60a31c5f6dc9cf" +dependencies = [ + "bitflags 1.3.2", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps 5.0.0", +] + +[[package]] +name = "specta" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2240c3aa020aa61d2c569087d213baafbb212f4ceb9de9dd162376ea6aa0fe3" +dependencies = [ + "document-features", + "indoc 1.0.9", + "once_cell", + "paste", + "serde", + "serde_json", + "specta-macros", + "tauri", + "thiserror", +] + +[[package]] +name = "specta-macros" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4605306321c356e03873b8ee71d7592a5e7c508add325c3ed0677c16fdf1bcfb" +dependencies = [ + "Inflector", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", + "termcolor", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "state" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" +dependencies = [ + "loom", +] + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-deps" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e" +dependencies = [ + "cfg-expr 0.9.1", + "heck 0.3.3", + "pkg-config", + "toml 0.5.11", + "version-compare 0.0.11", +] + +[[package]] +name = "system-deps" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3" +dependencies = [ + "cfg-expr 0.15.4", + "heck 0.4.1", + "pkg-config", + "toml 0.7.6", + "version-compare 0.1.1", +] + +[[package]] +name = "tao" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6d198e01085564cea63e976ad1566c1ba2c2e4cc79578e35d9f05521505e31" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "cc", + "cocoa", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dispatch", + "gdk", + "gdk-pixbuf", + "gdk-sys", + "gdkwayland-sys", + "gdkx11-sys", + "gio", + "glib", + "glib-sys", + "gtk", + "image", + "instant", + "jni", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc", + "once_cell", + "parking_lot", + "png", + "raw-window-handle", + "scopeguard", + "serde", + "tao-macros", + "unicode-segmentation", + "uuid", + "windows 0.39.0", + "windows-implement", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b27a4bcc5eb524658234589bdffc7e7bfb996dbae6ce9393bfd39cb4159b445" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tar" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "target-lexicon" +version = "0.12.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2faeef5759ab89935255b1a4cd98e0baf99d1085e37d36599c625dac49ae8e" + +[[package]] +name = "tauri" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbe522898e35407a8e60dc3870f7579fea2fc262a6a6072eccdd37ae1e1d91e" +dependencies = [ + "anyhow", + "base64 0.21.3", + "bytes", + "cocoa", + "dirs-next", + "embed_plist", + "encoding_rs", + "flate2", + "futures-util", + "glib", + "glob", + "gtk", + "heck 0.4.1", + "http", + "ignore", + "minisign-verify", + "objc", + "once_cell", + "open", + "percent-encoding", + "rand 0.8.5", + "raw-window-handle", + "regex", + "reqwest", + "rfd", + "semver", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "state", + "tar", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "tempfile", + "thiserror", + "time", + "tokio", + "url", + "uuid", + "webkit2gtk", + "webview2-com", + "windows 0.39.0", + "zip", +] + +[[package]] +name = "tauri-build" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d2edd6a259b5591c8efdeb9d5702cb53515b82a6affebd55c7fd6d3a27b7d1b" +dependencies = [ + "anyhow", + "cargo_toml", + "heck 0.4.1", + "json-patch", + "semver", + "serde", + "serde_json", + "tauri-utils", + "tauri-winres", +] + +[[package]] +name = "tauri-codegen" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ad2d49fdeab4a08717f5b49a163bdc72efc3b1950b6758245fcde79b645e1a" +dependencies = [ + "base64 0.21.3", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "regex", + "semver", + "serde", + "serde_json", + "sha2", + "tauri-utils", + "thiserror", + "time", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eb12a2454e747896929338d93b0642144bb51e0dddbb36e579035731f0d76b7" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin-window-state" +version = "0.1.0" +source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#cdb77c4b650a81a9c44c4b5db5a46c31954dd7f9" +dependencies = [ + "bincode", + "bitflags 2.4.0", + "log", + "serde", + "serde_json", + "tauri", + "thiserror", +] + +[[package]] +name = "tauri-runtime" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "108683199cb18f96d2d4134187bb789964143c845d2d154848dda209191fd769" +dependencies = [ + "gtk", + "http", + "http-range", + "rand 0.8.5", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror", + "url", + "uuid", + "webview2-com", + "windows 0.39.0", +] + +[[package]] +name = "tauri-runtime-wry" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7aa256a1407a3a091b5d843eccc1a5042289baf0a43d1179d9f0fcfea37c1b" +dependencies = [ + "cocoa", + "gtk", + "percent-encoding", + "rand 0.8.5", + "raw-window-handle", + "tauri-runtime", + "tauri-utils", + "uuid", + "webkit2gtk", + "webview2-com", + "windows 0.39.0", + "wry", +] + +[[package]] +name = "tauri-specta" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa034c38b7bdfeccc606eca0b030a1e67a20b78e7642edef09816b7e1ff9a9de" +dependencies = [ + "heck 0.4.1", + "indoc 2.0.3", + "serde", + "serde_json", + "specta", + "tauri", + "thiserror", +] + +[[package]] +name = "tauri-utils" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03fc02bb6072bb397e1d473c6f76c953cda48b4a2d0cce605df284aa74a12e84" +dependencies = [ + "brotli", + "ctor", + "dunce", + "glob", + "heck 0.4.1", + "html5ever", + "infer", + "json-patch", + "kuchiki", + "memchr", + "phf 0.10.1", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "serde_with", + "thiserror", + "url", + "walkdir", + "windows 0.39.0", +] + +[[package]] +name = "tauri-winres" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5993dc129e544393574288923d1ec447c857f3f644187f4fbf7d9a875fbfc4fb" +dependencies = [ + "embed-resource", + "toml 0.7.6", +] + +[[package]] +name = "tempfile" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" + +[[package]] +name = "thiserror" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +dependencies = [ + "itoa 1.0.9", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +dependencies = [ + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3ce25f50619af8b0aec2eb23deebe84249e19e2ddd393a6e16e3300a6dadfd" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.3", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "treediff" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52984d277bdf2a751072b5df30ec0377febdb02f7696d64c2d7d54630bac4303" +dependencies = [ + "serde_json", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +dependencies = [ + "getrandom 0.2.10", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version-compare" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" + +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b17ae1f6c8a2b28506cd96d412eebf83b4a0ff2cbefeeb952f2f9dfa44ba18" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.28", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "wasm-streams" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webkit2gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f859735e4a452aeb28c6c56a852967a8a76c8eb1cc32dbf931ad28a13d6370" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup2", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d76ca6ecc47aeba01ec61e480139dda143796abcae6f83bcddf50d6b5b1dcf3" +dependencies = [ + "atk-sys", + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pango-sys", + "pkg-config", + "soup2-sys", + "system-deps 6.1.1", +] + +[[package]] +name = "webview2-com" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows 0.39.0", + "windows-implement", +] + +[[package]] +name = "webview2-com-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "webview2-com-sys" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac48ef20ddf657755fdcda8dfed2a7b4fc7e4581acce6fe9b88c3d64f29dee7" +dependencies = [ + "regex", + "serde", + "serde_json", + "thiserror", + "windows 0.39.0", + "windows-bindgen", + "windows-metadata", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + +[[package]] +name = "windows" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" +dependencies = [ + "windows-implement", + "windows_aarch64_msvc 0.39.0", + "windows_i686_gnu 0.39.0", + "windows_i686_msvc 0.39.0", + "windows_x86_64_gnu 0.39.0", + "windows_x86_64_msvc 0.39.0", +] + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.1", +] + +[[package]] +name = "windows-bindgen" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68003dbd0e38abc0fb85b939240f4bce37c43a5981d3df37ccbaaa981b47cb41" +dependencies = [ + "windows-metadata", + "windows-tokens", +] + +[[package]] +name = "windows-implement" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba01f98f509cb5dc05f4e5fc95e535f78260f15fea8fe1a8abdd08f774f1cee7" +dependencies = [ + "syn 1.0.109", + "windows-tokens", +] + +[[package]] +name = "windows-metadata" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows-tokens" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" + +[[package]] +name = "windows_i686_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" + +[[package]] +name = "windows_i686_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b5872fa2e10bd067ae946f927e726d7d603eaeb6e02fa6a350e0722d2b8c11" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a1a57ff50e9b408431e8f97d5456f2807f8eb2a2cd79b06068fc87f8ecf189" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wry" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33748f35413c8a98d45f7a08832d848c0c5915501803d1faade5a4ebcd258cea" +dependencies = [ + "base64 0.13.1", + "block", + "cocoa", + "core-graphics", + "crossbeam-channel", + "dunce", + "gdk", + "gio", + "glib", + "gtk", + "html5ever", + "http", + "kuchiki", + "libc", + "log", + "objc", + "objc_id", + "once_cell", + "serde", + "serde_json", + "sha2", + "soup2", + "tao", + "thiserror", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows 0.39.0", + "windows-implement", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "xattr" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +dependencies = [ + "libc", +] + +[[package]] +name = "xi_tinkerer" +version = "0.1.0" +dependencies = [ + "anyhow", + "dats", + "futures", + "glob", + "notify", + "parking_lot", + "processor", + "serde", + "serde_json", + "serde_yaml", + "specta", + "tauri", + "tauri-build", + "tauri-plugin-window-state", + "tauri-specta", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", + "walkdir", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..daa115b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["crates/*", "client/src-tauri"] +resolver = "2" \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..162676c --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + +The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..73ff99b --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +# XI Tinkerer + +Tool for decoding and encoding FFXI DAT files. + +It can export DATs into human-readable files (YAML), which can then be edited and re-encoded into DAT files. +One DAT file is converted 1:1 with exactly one editable file. + +Currently, it only supports conversion of the English DATs, but the plan is to eventually support the other languages as well, once the conversion tables and unique control-structures for those are figured out. See plans for future work below. + +## Planned Work + +It is planned to eventually support handling of most DAT-related things, like: + +- [ ] All languages: + - [x] English text in DATs + - [ ] Japanese text in DATs + - [ ] French text in DATs + - [ ] German text in DATs +- [ ] All DAT formats (non-exhaustive list): + - [x] Dialog + - [x] Entity names + - [x] Status info + - [ ] Item info (most are supported) + - [ ] d_msg (most are supported) + - [ ] XISTRING (partially done) + - [ ] Spell info + - [ ] Ability info + - [ ] Quest info + - [ ] Events/cutscenes (likely based on info from [XiEvents](https://github.com/atom0s/XiEvents)) +- [ ] GUI editor for complex DATs, i.e.: + - [ ] Items + - [ ] DATs with images + - [ ] Events/cutscenes joined with the used dialog text strings and entities + +### Breaking changes + +There will most likely be breaking changes as new versions of this tool gets updated, since various fields can be added/removed/renamed. + +For example, there are currently still unknown fields included in the human-readable files. These fields are necessary data for it to properly generate usable DAT files again, so they have to be included. As understanding of the DAT files progresses, and the meaning of these fields are determined, the field names/content will be changed/renamed. This will currently cause the tool to not be backwards-compatible with the previous versions of human-readable files (since their fields/formats have changed), in which case they will have to re-exported from DATs to be able to generate DATs again. + +## Credits + +The starting point for the binary structure of some of the DAT formats, which are used in this project, +were partially derived from the [POLUtils project](https://github.com/Windower/POLUtils) code, +so credit goes to them for their work in reversing these. Their work is licensed under the +[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) with the following copyright: + + Copyright © 2004-2014 Tim Van Holder, Nevin Stepan, Windower Team + +This project also uses encoding conversion table files, which were originally from the POLUtils project, +but some have been modified to allow them being used in reverse to allow encoding back to the original symbols. +The full license file and copyright text have been included in the folder that these reside in. diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..a11eba1 --- /dev/null +++ b/client/index.html @@ -0,0 +1,17 @@ + + + + + + + + XI Tinkerer + + + + +
+ + + + diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..af59226 --- /dev/null +++ b/client/package.json @@ -0,0 +1,29 @@ +{ + "name": "xi_tinkerer", + "version": "0.1.0", + "description": "XI Tinkerer", + "scripts": { + "start": "vite", + "dev": "vite", + "build": "vite build", + "serve": "vite preview", + "tauri": "tauri" + }, + "license": "AGPL-3.0", + "dependencies": { + "@solidjs/router": "^0.8.2", + "@tauri-apps/api": "^1.4.0", + "fuse.js": "^6.6.2", + "solid-icons": "^1.0.11", + "solid-js": "^1.7.8" + }, + "devDependencies": { + "@tauri-apps/cli": "^1.4.0", + "autoprefixer": "^10.4.14", + "postcss": "^8.4.27", + "tailwindcss": "^3.3.3", + "typescript": "^5.0.2", + "vite": "^4.4.4", + "vite-plugin-solid": "^2.7.0" + } +} diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml new file mode 100644 index 0000000..1a86c7f --- /dev/null +++ b/client/pnpm-lock.yaml @@ -0,0 +1,1632 @@ +lockfileVersion: '6.0' + +dependencies: + '@solidjs/router': + specifier: ^0.8.2 + version: 0.8.2(solid-js@1.7.8) + '@tauri-apps/api': + specifier: ^1.4.0 + version: 1.4.0 + fuse.js: + specifier: ^6.6.2 + version: 6.6.2 + solid-icons: + specifier: ^1.0.11 + version: 1.0.11(solid-js@1.7.8) + solid-js: + specifier: ^1.7.8 + version: 1.7.8 + +devDependencies: + '@tauri-apps/cli': + specifier: ^1.4.0 + version: 1.4.0 + autoprefixer: + specifier: ^10.4.14 + version: 10.4.14(postcss@8.4.27) + postcss: + specifier: ^8.4.27 + version: 8.4.27 + tailwindcss: + specifier: ^3.3.3 + version: 3.3.3 + typescript: + specifier: ^5.0.2 + version: 5.1.6 + vite: + specifier: ^4.4.4 + version: 4.4.7 + vite-plugin-solid: + specifier: ^2.7.0 + version: 2.7.0(solid-js@1.7.8)(vite@4.4.7) + +packages: + + /@alloc/quick-lru@5.2.0: + resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} + engines: {node: '>=10'} + dev: true + + /@ampproject/remapping@2.2.1: + resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.18 + dev: true + + /@babel/code-frame@7.22.5: + resolution: {integrity: sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.22.5 + dev: true + + /@babel/compat-data@7.22.9: + resolution: {integrity: sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/core@7.22.9: + resolution: {integrity: sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w==} + engines: {node: '>=6.9.0'} + dependencies: + '@ampproject/remapping': 2.2.1 + '@babel/code-frame': 7.22.5 + '@babel/generator': 7.22.9 + '@babel/helper-compilation-targets': 7.22.9(@babel/core@7.22.9) + '@babel/helper-module-transforms': 7.22.9(@babel/core@7.22.9) + '@babel/helpers': 7.22.6 + '@babel/parser': 7.22.7 + '@babel/template': 7.22.5 + '@babel/traverse': 7.22.8 + '@babel/types': 7.22.5 + convert-source-map: 1.9.0 + debug: 4.3.4 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/generator@7.22.9: + resolution: {integrity: sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.18 + jsesc: 2.5.2 + dev: true + + /@babel/helper-annotate-as-pure@7.22.5: + resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-compilation-targets@7.22.9(@babel/core@7.22.9): + resolution: {integrity: sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/compat-data': 7.22.9 + '@babel/core': 7.22.9 + '@babel/helper-validator-option': 7.22.5 + browserslist: 4.21.9 + lru-cache: 5.1.1 + semver: 6.3.1 + dev: true + + /@babel/helper-create-class-features-plugin@7.22.9(@babel/core@7.22.9): + resolution: {integrity: sha512-Pwyi89uO4YrGKxL/eNJ8lfEH55DnRloGPOseaA8NFNL6jAUnn+KccaISiFazCj5IolPPDjGSdzQzXVzODVRqUQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-annotate-as-pure': 7.22.5 + '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-function-name': 7.22.5 + '@babel/helper-member-expression-to-functions': 7.22.5 + '@babel/helper-optimise-call-expression': 7.22.5 + '@babel/helper-replace-supers': 7.22.9(@babel/core@7.22.9) + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + semver: 6.3.1 + dev: true + + /@babel/helper-environment-visitor@7.22.5: + resolution: {integrity: sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-function-name@7.22.5: + resolution: {integrity: sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.5 + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-hoist-variables@7.22.5: + resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-member-expression-to-functions@7.22.5: + resolution: {integrity: sha512-aBiH1NKMG0H2cGZqspNvsaBe6wNGjbJjuLy29aU+eDZjSbbN53BaxlpB02xm9v34pLTZ1nIQPFYn2qMZoa5BQQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-module-imports@7.18.6: + resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-module-imports@7.22.5: + resolution: {integrity: sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-module-transforms@7.22.9(@babel/core@7.22.9): + resolution: {integrity: sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-module-imports': 7.22.5 + '@babel/helper-simple-access': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/helper-validator-identifier': 7.22.5 + dev: true + + /@babel/helper-optimise-call-expression@7.22.5: + resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-plugin-utils@7.22.5: + resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-replace-supers@7.22.9(@babel/core@7.22.9): + resolution: {integrity: sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-member-expression-to-functions': 7.22.5 + '@babel/helper-optimise-call-expression': 7.22.5 + dev: true + + /@babel/helper-simple-access@7.22.5: + resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-skip-transparent-expression-wrappers@7.22.5: + resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/helper-string-parser@7.22.5: + resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-identifier@7.22.5: + resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-validator-option@7.22.5: + resolution: {integrity: sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helpers@7.22.6: + resolution: {integrity: sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.22.5 + '@babel/traverse': 7.22.8 + '@babel/types': 7.22.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/highlight@7.22.5: + resolution: {integrity: sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.22.5 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + + /@babel/parser@7.22.7: + resolution: {integrity: sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@babel/plugin-syntax-jsx@7.22.5(@babel/core@7.22.9): + resolution: {integrity: sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/plugin-syntax-typescript@7.22.5(@babel/core@7.22.9): + resolution: {integrity: sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-plugin-utils': 7.22.5 + dev: true + + /@babel/plugin-transform-modules-commonjs@7.22.5(@babel/core@7.22.9): + resolution: {integrity: sha512-B4pzOXj+ONRmuaQTg05b3y/4DuFz3WcCNAXPLb2Q0GT0TrGKGxNKV4jwsXts+StaM0LQczZbOpj8o1DLPDJIiA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-module-transforms': 7.22.9(@babel/core@7.22.9) + '@babel/helper-plugin-utils': 7.22.5 + '@babel/helper-simple-access': 7.22.5 + dev: true + + /@babel/plugin-transform-typescript@7.22.9(@babel/core@7.22.9): + resolution: {integrity: sha512-BnVR1CpKiuD0iobHPaM1iLvcwPYN2uVFAqoLVSpEDKWuOikoCv5HbKLxclhKYUXlWkX86DoZGtqI4XhbOsyrMg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-annotate-as-pure': 7.22.5 + '@babel/helper-create-class-features-plugin': 7.22.9(@babel/core@7.22.9) + '@babel/helper-plugin-utils': 7.22.5 + '@babel/plugin-syntax-typescript': 7.22.5(@babel/core@7.22.9) + dev: true + + /@babel/preset-typescript@7.22.5(@babel/core@7.22.9): + resolution: {integrity: sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-plugin-utils': 7.22.5 + '@babel/helper-validator-option': 7.22.5 + '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.22.9) + '@babel/plugin-transform-modules-commonjs': 7.22.5(@babel/core@7.22.9) + '@babel/plugin-transform-typescript': 7.22.9(@babel/core@7.22.9) + dev: true + + /@babel/template@7.22.5: + resolution: {integrity: sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.22.5 + '@babel/parser': 7.22.7 + '@babel/types': 7.22.5 + dev: true + + /@babel/traverse@7.22.8: + resolution: {integrity: sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.22.5 + '@babel/generator': 7.22.9 + '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-function-name': 7.22.5 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.22.7 + '@babel/types': 7.22.5 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/types@7.22.5: + resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.22.5 + '@babel/helper-validator-identifier': 7.22.5 + to-fast-properties: 2.0.0 + dev: true + + /@esbuild/android-arm64@0.18.16: + resolution: {integrity: sha512-wsCqSPqLz+6Ov+OM4EthU43DyYVVyfn15S4j1bJzylDpc1r1jZFFfJQNfDuT8SlgwuqpmpJXK4uPlHGw6ve7eA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.18.16: + resolution: {integrity: sha512-gCHjjQmA8L0soklKbLKA6pgsLk1byULuHe94lkZDzcO3/Ta+bbeewJioEn1Fr7kgy9NWNFy/C+MrBwC6I/WCug==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.18.16: + resolution: {integrity: sha512-ldsTXolyA3eTQ1//4DS+E15xl0H/3DTRJaRL0/0PgkqDsI0fV/FlOtD+h0u/AUJr+eOTlZv4aC9gvfppo3C4sw==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.18.16: + resolution: {integrity: sha512-aBxruWCII+OtluORR/KvisEw0ALuw/qDQWvkoosA+c/ngC/Kwk0lLaZ+B++LLS481/VdydB2u6tYpWxUfnLAIw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.18.16: + resolution: {integrity: sha512-6w4Dbue280+rp3LnkgmriS1icOUZDyPuZo/9VsuMUTns7SYEiOaJ7Ca1cbhu9KVObAWfmdjUl4gwy9TIgiO5eA==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.18.16: + resolution: {integrity: sha512-x35fCebhe9s979DGKbVAwXUOcTmCIE32AIqB9CB1GralMIvxdnMLAw5CnID17ipEw9/3MvDsusj/cspYt2ZLNQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.18.16: + resolution: {integrity: sha512-YM98f+PeNXF3GbxIJlUsj+McUWG1irguBHkszCIwfr3BXtXZsXo0vqybjUDFfu9a8Wr7uUD/YSmHib+EeGAFlg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.18.16: + resolution: {integrity: sha512-XIqhNUxJiuy+zsR77+H5Z2f7s4YRlriSJKtvx99nJuG5ATuJPjmZ9n0ANgnGlPCpXGSReFpgcJ7O3SMtzIFeiQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.18.16: + resolution: {integrity: sha512-b5ABb+5Ha2C9JkeZXV+b+OruR1tJ33ePmv9ZwMeETSEKlmu/WJ45XTTG+l6a2KDsQtJJ66qo/hbSGBtk0XVLHw==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.18.16: + resolution: {integrity: sha512-no+pfEpwnRvIyH+txbBAWtjxPU9grslmTBfsmDndj7bnBmr55rOo/PfQmRfz7Qg9isswt1FP5hBbWb23fRWnow==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.18.16: + resolution: {integrity: sha512-Zbnczs9ZXjmo0oZSS0zbNlJbcwKXa/fcNhYQjahDs4Xg18UumpXG/lwM2lcSvHS3mTrRyCYZvJbmzYc4laRI1g==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.18.16: + resolution: {integrity: sha512-YMF7hih1HVR/hQVa/ot4UVffc5ZlrzEb3k2ip0nZr1w6fnYypll9td2qcoMLvd3o8j3y6EbJM3MyIcXIVzXvQQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.18.16: + resolution: {integrity: sha512-Wkz++LZ29lDwUyTSEnzDaaP5OveOgTU69q9IyIw9WqLRxM4BjTBjz9un4G6TOvehWpf/J3gYVFN96TjGHrbcNQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.18.16: + resolution: {integrity: sha512-LFMKZ30tk78/mUv1ygvIP+568bwf4oN6reG/uczXnz6SvFn4e2QUFpUpZY9iSJT6Qpgstrhef/nMykIXZtZWGQ==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.18.16: + resolution: {integrity: sha512-3ZC0BgyYHYKfZo3AV2/66TD/I9tlSBaW7eWTEIkrQQKfJIifKMMttXl9FrAg+UT0SGYsCRLI35Gwdmm96vlOjg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.18.16: + resolution: {integrity: sha512-xu86B3647DihHJHv/wx3NCz2Dg1gjQ8bbf9cVYZzWKY+gsvxYmn/lnVlqDRazObc3UMwoHpUhNYaZset4X8IPA==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.18.16: + resolution: {integrity: sha512-uVAgpimx9Ffw3xowtg/7qQPwHFx94yCje+DoBx+LNm2ePDpQXHrzE+Sb0Si2VBObYz+LcRps15cq+95YM7gkUw==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.18.16: + resolution: {integrity: sha512-6OjCQM9wf7z8/MBi6BOWaTL2AS/SZudsZtBziXMtNI8r/U41AxS9x7jn0ATOwVy08OotwkPqGRMkpPR2wcTJXA==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.18.16: + resolution: {integrity: sha512-ZoNkruFYJp9d1LbUYCh8awgQDvB9uOMZqlQ+gGEZR7v6C+N6u7vPr86c+Chih8niBR81Q/bHOSKGBK3brJyvkQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.18.16: + resolution: {integrity: sha512-+j4anzQ9hrs+iqO+/wa8UE6TVkKua1pXUb0XWFOx0FiAj6R9INJ+WE//1/Xo6FG1vB5EpH3ko+XcgwiDXTxcdw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.18.16: + resolution: {integrity: sha512-5PFPmq3sSKTp9cT9dzvI67WNfRZGvEVctcZa1KGjDDu4n3H8k59Inbk0du1fz0KrAbKKNpJbdFXQMDUz7BG4rQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.18.16: + resolution: {integrity: sha512-sCIVrrtcWN5Ua7jYXNG1xD199IalrbfV2+0k/2Zf2OyV2FtnQnMgdzgpRAbi4AWlKJj1jkX+M+fEGPQj6BQB4w==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@jridgewell/gen-mapping@0.3.3: + resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.18 + dev: true + + /@jridgewell/resolve-uri@3.1.0: + resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.1.2: + resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/sourcemap-codec@1.4.14: + resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@jridgewell/trace-mapping@0.3.18: + resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} + dependencies: + '@jridgewell/resolve-uri': 3.1.0 + '@jridgewell/sourcemap-codec': 1.4.14 + dev: true + + /@nodelib/fs.scandir@2.1.5: + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + dev: true + + /@nodelib/fs.stat@2.0.5: + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + dev: true + + /@nodelib/fs.walk@1.2.8: + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.15.0 + dev: true + + /@solidjs/router@0.8.2(solid-js@1.7.8): + resolution: {integrity: sha512-gUKW+LZqxtX6y/Aw6JKyy4gQ9E7dLqp513oB9pSYJR1HM5c56Pf7eijzyXX+b3WuXig18Cxqah4tMtF0YGu80w==} + peerDependencies: + solid-js: ^1.5.3 + dependencies: + solid-js: 1.7.8 + dev: false + + /@tauri-apps/api@1.4.0: + resolution: {integrity: sha512-Jd6HPoTM1PZSFIzq7FB8VmMu3qSSyo/3lSwLpoapW+lQ41CL5Dow2KryLg+gyazA/58DRWI9vu/XpEeHK4uMdw==} + engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'} + dev: false + + /@tauri-apps/cli-darwin-arm64@1.4.0: + resolution: {integrity: sha512-nA/ml0SfUt6/CYLVbHmT500Y+ijqsuv5+s9EBnVXYSLVg9kbPUZJJHluEYK+xKuOj6xzyuT/+rZFMRapmJD3jQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-darwin-x64@1.4.0: + resolution: {integrity: sha512-ov/F6Zr+dg9B0PtRu65stFo2G0ow2TUlneqYYrkj+vA3n+moWDHfVty0raDjMLQbQt3rv3uayFMXGPMgble9OA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-linux-arm-gnueabihf@1.4.0: + resolution: {integrity: sha512-zwjbiMncycXDV7doovymyKD7sCg53ouAmfgpUqEBOTY3vgBi9TwijyPhJOqoG5vUVWhouNBC08akGmE4dja15g==} + engines: {node: '>= 10'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-linux-arm64-gnu@1.4.0: + resolution: {integrity: sha512-5MCBcziqXC72mMXnkZU68mutXIR6zavDxopArE2gQtK841IlE06bIgtLi0kUUhlFJk2nhPRgiDgdLbrPlyt7fw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-linux-arm64-musl@1.4.0: + resolution: {integrity: sha512-7J3pRB6n6uNYgIfCeKt2Oz8J7oSaz2s8GGFRRH2HPxuTHrBNCinzVYm68UhVpJrL3bnGkU0ziVZLsW/iaOGfUg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-linux-x64-gnu@1.4.0: + resolution: {integrity: sha512-Zh5gfAJxOv5AVWxcwuueaQ2vIAhlg0d6nZui6nMyfIJ8dbf3aZQ5ZzP38sYow5h/fbvgL+3GSQxZRBIa3c2E1w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-linux-x64-musl@1.4.0: + resolution: {integrity: sha512-OLAYoICU3FaYiTdBsI+lQTKnDHeMmFMXIApN0M+xGiOkoIOQcV9CConMPjgmJQ867+NHRNgUGlvBEAh9CiJodQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-win32-arm64-msvc@1.4.0: + resolution: {integrity: sha512-gZ05GENFbI6CB5MlOUsLlU0kZ9UtHn9riYtSXKT6MYs8HSPRffPHaHSL0WxsJweWh9nR5Hgh/TUU8uW3sYCzCg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-win32-ia32-msvc@1.4.0: + resolution: {integrity: sha512-JsetT/lTx/Zq98eo8T5CiRyF1nKeX04RO8JlJrI3ZOYsZpp/A5RJvMd/szQ17iOzwiHdge+tx7k2jHysR6oBlQ==} + engines: {node: '>= 10'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli-win32-x64-msvc@1.4.0: + resolution: {integrity: sha512-z8Olcnwp5aYhzqUAarFjqF+oELCjuYWnB2HAJHlfsYNfDCAORY5kct3Fklz8PSsubC3U2EugWn8n42DwnThurg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@tauri-apps/cli@1.4.0: + resolution: {integrity: sha512-VXYr2i2iVFl98etQSQsqLzXgX96bnWiNZd1YADgatqwy/qecbd6Kl5ZAPB5R4ynsgE8A1gU7Fbzh7dCEQYFfmA==} + engines: {node: '>= 10'} + hasBin: true + optionalDependencies: + '@tauri-apps/cli-darwin-arm64': 1.4.0 + '@tauri-apps/cli-darwin-x64': 1.4.0 + '@tauri-apps/cli-linux-arm-gnueabihf': 1.4.0 + '@tauri-apps/cli-linux-arm64-gnu': 1.4.0 + '@tauri-apps/cli-linux-arm64-musl': 1.4.0 + '@tauri-apps/cli-linux-x64-gnu': 1.4.0 + '@tauri-apps/cli-linux-x64-musl': 1.4.0 + '@tauri-apps/cli-win32-arm64-msvc': 1.4.0 + '@tauri-apps/cli-win32-ia32-msvc': 1.4.0 + '@tauri-apps/cli-win32-x64-msvc': 1.4.0 + dev: true + + /@types/babel__core@7.20.1: + resolution: {integrity: sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==} + dependencies: + '@babel/parser': 7.22.7 + '@babel/types': 7.22.5 + '@types/babel__generator': 7.6.4 + '@types/babel__template': 7.4.1 + '@types/babel__traverse': 7.20.1 + dev: true + + /@types/babel__generator@7.6.4: + resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /@types/babel__template@7.4.1: + resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} + dependencies: + '@babel/parser': 7.22.7 + '@babel/types': 7.22.5 + dev: true + + /@types/babel__traverse@7.20.1: + resolution: {integrity: sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==} + dependencies: + '@babel/types': 7.22.5 + dev: true + + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + dependencies: + color-convert: 1.9.3 + dev: true + + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: true + + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + + /arg@5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + dev: true + + /autoprefixer@10.4.14(postcss@8.4.27): + resolution: {integrity: sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==} + engines: {node: ^10 || ^12 || >=14} + hasBin: true + peerDependencies: + postcss: ^8.1.0 + dependencies: + browserslist: 4.21.9 + caniuse-lite: 1.0.30001517 + fraction.js: 4.2.0 + normalize-range: 0.1.2 + picocolors: 1.0.0 + postcss: 8.4.27 + postcss-value-parser: 4.2.0 + dev: true + + /babel-plugin-jsx-dom-expressions@0.36.10(@babel/core@7.22.9): + resolution: {integrity: sha512-QA2k/14WGw+RgcGGnEuLWwnu4em6CGhjeXtjvgOYyFHYS2a+CzPeaVQHDOlfuiBcjq/3hWMspHMIMnPEOIzdBg==} + peerDependencies: + '@babel/core': ^7.20.12 + dependencies: + '@babel/core': 7.22.9 + '@babel/helper-module-imports': 7.18.6 + '@babel/plugin-syntax-jsx': 7.22.5(@babel/core@7.22.9) + '@babel/types': 7.22.5 + html-entities: 2.3.3 + validate-html-nesting: 1.2.2 + dev: true + + /babel-preset-solid@1.7.7(@babel/core@7.22.9): + resolution: {integrity: sha512-tdxVzx3kgcIjNXAOmGRbzIhFBPeJjSakiN9yM+IYdL/+LtXNnbGqb0Va5tJb8Sjbk+QVEriovCyuzB5T7jeTvg==} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.22.9 + babel-plugin-jsx-dom-expressions: 0.36.10(@babel/core@7.22.9) + dev: true + + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true + + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + dev: true + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + + /browserslist@4.21.9: + resolution: {integrity: sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001517 + electron-to-chromium: 1.4.470 + node-releases: 2.0.13 + update-browserslist-db: 1.0.11(browserslist@4.21.9) + dev: true + + /camelcase-css@2.0.1: + resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} + engines: {node: '>= 6'} + dev: true + + /caniuse-lite@1.0.30001517: + resolution: {integrity: sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==} + dev: true + + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + dependencies: + color-name: 1.1.3 + dev: true + + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true + + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + + /concat-map@0.0.1: + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + dev: true + + /convert-source-map@1.9.0: + resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} + dev: true + + /cssesc@3.0.0: + resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /csstype@3.1.2: + resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + + /didyoumean@1.2.2: + resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} + dev: true + + /dlv@1.1.3: + resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} + dev: true + + /electron-to-chromium@1.4.470: + resolution: {integrity: sha512-zZM48Lmy2FKWgqyvsX9XK+J6FfP7aCDUFLmgooLJzA7v1agCs/sxSoBpTIwDLhmbhpx9yJIxj2INig/ncjJRqg==} + dev: true + + /esbuild@0.18.16: + resolution: {integrity: sha512-1xLsOXrDqwdHxyXb/x/SOyg59jpf/SH7YMvU5RNSU7z3TInaASNJWNFJ6iRvLvLETZMasF3d1DdZLg7sgRimRQ==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.16 + '@esbuild/android-arm64': 0.18.16 + '@esbuild/android-x64': 0.18.16 + '@esbuild/darwin-arm64': 0.18.16 + '@esbuild/darwin-x64': 0.18.16 + '@esbuild/freebsd-arm64': 0.18.16 + '@esbuild/freebsd-x64': 0.18.16 + '@esbuild/linux-arm': 0.18.16 + '@esbuild/linux-arm64': 0.18.16 + '@esbuild/linux-ia32': 0.18.16 + '@esbuild/linux-loong64': 0.18.16 + '@esbuild/linux-mips64el': 0.18.16 + '@esbuild/linux-ppc64': 0.18.16 + '@esbuild/linux-riscv64': 0.18.16 + '@esbuild/linux-s390x': 0.18.16 + '@esbuild/linux-x64': 0.18.16 + '@esbuild/netbsd-x64': 0.18.16 + '@esbuild/openbsd-x64': 0.18.16 + '@esbuild/sunos-x64': 0.18.16 + '@esbuild/win32-arm64': 0.18.16 + '@esbuild/win32-ia32': 0.18.16 + '@esbuild/win32-x64': 0.18.16 + dev: true + + /escalade@3.1.1: + resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} + engines: {node: '>=6'} + dev: true + + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true + + /fast-glob@3.3.1: + resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.5 + dev: true + + /fastq@1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} + dependencies: + reusify: 1.0.4 + dev: true + + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + + /fraction.js@4.2.0: + resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} + dev: true + + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true + + /fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /function-bind@1.1.1: + resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + dev: true + + /fuse.js@6.6.2: + resolution: {integrity: sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA==} + engines: {node: '>=10'} + dev: false + + /gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + dev: true + + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + dependencies: + is-glob: 4.0.3 + dev: true + + /glob@7.1.6: + resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + + /globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + dev: true + + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true + + /has@1.0.3: + resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} + engines: {node: '>= 0.4.0'} + dependencies: + function-bind: 1.1.1 + dev: true + + /html-entities@2.3.3: + resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} + dev: true + + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true + + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true + + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + + /is-core-module@2.12.1: + resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} + dependencies: + has: 1.0.3 + dev: true + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + + /is-what@4.1.15: + resolution: {integrity: sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==} + engines: {node: '>=12.13'} + dev: true + + /jiti@1.19.1: + resolution: {integrity: sha512-oVhqoRDaBXf7sjkll95LHVS6Myyyb1zaunVwk4Z0+WPSW4gjS0pl01zYKHScTuyEhQsFxV5L4DR5r+YqSyqyyg==} + hasBin: true + dev: true + + /js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + dev: true + + /jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + dev: true + + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true + + /lilconfig@2.1.0: + resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} + engines: {node: '>=10'} + dev: true + + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true + + /lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + dependencies: + yallist: 3.1.1 + dev: true + + /merge-anything@5.1.7: + resolution: {integrity: sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ==} + engines: {node: '>=12.13'} + dependencies: + is-what: 4.1.15 + dev: true + + /merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true + + /micromatch@4.0.5: + resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} + engines: {node: '>=8.6'} + dependencies: + braces: 3.0.2 + picomatch: 2.3.1 + dev: true + + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + dependencies: + brace-expansion: 1.1.11 + dev: true + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true + + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: true + + /nanoid@3.3.6: + resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /node-releases@2.0.13: + resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + dev: true + + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + + /normalize-range@0.1.2: + resolution: {integrity: sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==} + engines: {node: '>=0.10.0'} + dev: true + + /object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + dev: true + + /object-hash@3.0.0: + resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} + engines: {node: '>= 6'} + dev: true + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + dependencies: + wrappy: 1.0.2 + dev: true + + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: true + + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true + + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + + /pify@2.3.0: + resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} + engines: {node: '>=0.10.0'} + dev: true + + /pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + dev: true + + /postcss-import@15.1.0(postcss@8.4.27): + resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} + engines: {node: '>=14.0.0'} + peerDependencies: + postcss: ^8.0.0 + dependencies: + postcss: 8.4.27 + postcss-value-parser: 4.2.0 + read-cache: 1.0.0 + resolve: 1.22.2 + dev: true + + /postcss-js@4.0.1(postcss@8.4.27): + resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} + engines: {node: ^12 || ^14 || >= 16} + peerDependencies: + postcss: ^8.4.21 + dependencies: + camelcase-css: 2.0.1 + postcss: 8.4.27 + dev: true + + /postcss-load-config@4.0.1(postcss@8.4.27): + resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} + engines: {node: '>= 14'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 2.1.0 + postcss: 8.4.27 + yaml: 2.3.1 + dev: true + + /postcss-nested@6.0.1(postcss@8.4.27): + resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==} + engines: {node: '>=12.0'} + peerDependencies: + postcss: ^8.2.14 + dependencies: + postcss: 8.4.27 + postcss-selector-parser: 6.0.13 + dev: true + + /postcss-selector-parser@6.0.13: + resolution: {integrity: sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==} + engines: {node: '>=4'} + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + dev: true + + /postcss-value-parser@4.2.0: + resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} + dev: true + + /postcss@8.4.27: + resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.6 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + + /queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true + + /read-cache@1.0.0: + resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==} + dependencies: + pify: 2.3.0 + dev: true + + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + + /resolve@1.22.2: + resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==} + hasBin: true + dependencies: + is-core-module: 2.12.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true + + /reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true + + /rollup@3.26.3: + resolution: {integrity: sha512-7Tin0C8l86TkpcMtXvQu6saWH93nhG3dGQ1/+l5V2TDMceTxO7kDiK6GzbfLWNNxqJXm591PcEZUozZm51ogwQ==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + dependencies: + queue-microtask: 1.2.3 + dev: true + + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + dev: true + + /seroval@0.5.1: + resolution: {integrity: sha512-ZfhQVB59hmIauJG5Ydynupy8KHyr5imGNtdDhbZG68Ufh1Ynkv9KOYOAABf71oVbQxJ8VkWnMHAjEHE7fWkH5g==} + engines: {node: '>=10'} + + /solid-icons@1.0.11(solid-js@1.7.8): + resolution: {integrity: sha512-shEL5Otrl73LPZukpanJKi6ISnQhpIvhqqAb8haKyCGrixHOYC6yGfNkSE7jpkKSikZ0rGtSMRiFETRrec2Uzw==} + engines: {node: '>= 16'} + peerDependencies: + solid-js: '*' + dependencies: + solid-js: 1.7.8 + dev: false + + /solid-js@1.7.8: + resolution: {integrity: sha512-XHBWk1FvFd0JMKljko7FfhefJMTSgYEuVKcQ2a8hzRXfiuSJAGsrPPafqEo+f6l+e8Oe3cROSpIL6kbzjC1fjQ==} + dependencies: + csstype: 3.1.2 + seroval: 0.5.1 + + /solid-refresh@0.5.3(solid-js@1.7.8): + resolution: {integrity: sha512-Otg5it5sjOdZbQZJnvo99TEBAr6J7PQ5AubZLNU6szZzg3RQQ5MX04oteBIIGDs0y2Qv8aXKm9e44V8z+UnFdw==} + peerDependencies: + solid-js: ^1.3 + dependencies: + '@babel/generator': 7.22.9 + '@babel/helper-module-imports': 7.22.5 + '@babel/types': 7.22.5 + solid-js: 1.7.8 + dev: true + + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + dev: true + + /sucrase@3.34.0: + resolution: {integrity: sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==} + engines: {node: '>=8'} + hasBin: true + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + commander: 4.1.1 + glob: 7.1.6 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.6 + ts-interface-checker: 0.1.13 + dev: true + + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true + + /tailwindcss@3.3.3: + resolution: {integrity: sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==} + engines: {node: '>=14.0.0'} + hasBin: true + dependencies: + '@alloc/quick-lru': 5.2.0 + arg: 5.0.2 + chokidar: 3.5.3 + didyoumean: 1.2.2 + dlv: 1.1.3 + fast-glob: 3.3.1 + glob-parent: 6.0.2 + is-glob: 4.0.3 + jiti: 1.19.1 + lilconfig: 2.1.0 + micromatch: 4.0.5 + normalize-path: 3.0.0 + object-hash: 3.0.0 + picocolors: 1.0.0 + postcss: 8.4.27 + postcss-import: 15.1.0(postcss@8.4.27) + postcss-js: 4.0.1(postcss@8.4.27) + postcss-load-config: 4.0.1(postcss@8.4.27) + postcss-nested: 6.0.1(postcss@8.4.27) + postcss-selector-parser: 6.0.13 + resolve: 1.22.2 + sucrase: 3.34.0 + transitivePeerDependencies: + - ts-node + dev: true + + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: true + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true + + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + dev: true + + /typescript@5.1.6: + resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /update-browserslist-db@1.0.11(browserslist@4.21.9): + resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.21.9 + escalade: 3.1.1 + picocolors: 1.0.0 + dev: true + + /util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + dev: true + + /validate-html-nesting@1.2.2: + resolution: {integrity: sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg==} + dev: true + + /vite-plugin-solid@2.7.0(solid-js@1.7.8)(vite@4.4.7): + resolution: {integrity: sha512-avp/Jl5zOp/Itfo67xtDB2O61U7idviaIp4mLsjhCa13PjKNasz+IID0jYTyqUp9SFx6/PmBr6v4KgDppqompg==} + peerDependencies: + solid-js: ^1.7.2 + vite: ^3.0.0 || ^4.0.0 + dependencies: + '@babel/core': 7.22.9 + '@babel/preset-typescript': 7.22.5(@babel/core@7.22.9) + '@types/babel__core': 7.20.1 + babel-preset-solid: 1.7.7(@babel/core@7.22.9) + merge-anything: 5.1.7 + solid-js: 1.7.8 + solid-refresh: 0.5.3(solid-js@1.7.8) + vite: 4.4.7 + vitefu: 0.2.4(vite@4.4.7) + transitivePeerDependencies: + - supports-color + dev: true + + /vite@4.4.7: + resolution: {integrity: sha512-6pYf9QJ1mHylfVh39HpuSfMPojPSKVxZvnclX1K1FyZ1PXDOcLBibdq5t1qxJSnL63ca8Wf4zts6mD8u8oc9Fw==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + esbuild: 0.18.16 + postcss: 8.4.27 + rollup: 3.26.3 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /vitefu@0.2.4(vite@4.4.7): + resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==} + peerDependencies: + vite: ^3.0.0 || ^4.0.0 + peerDependenciesMeta: + vite: + optional: true + dependencies: + vite: 4.4.7 + dev: true + + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true + + /yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true + + /yaml@2.3.1: + resolution: {integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==} + engines: {node: '>= 14'} + dev: true diff --git a/client/postcss.config.js b/client/postcss.config.js new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/client/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/client/src-tauri/.gitignore b/client/src-tauri/.gitignore new file mode 100644 index 0000000..f4dfb82 --- /dev/null +++ b/client/src-tauri/.gitignore @@ -0,0 +1,4 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ + diff --git a/client/src-tauri/Cargo.toml b/client/src-tauri/Cargo.toml new file mode 100644 index 0000000..5c66bb1 --- /dev/null +++ b/client/src-tauri/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "xi_tinkerer" +version = "0.1.0" +description = "XI Tinkerer" +authors = ["InoUno"] +license = "AGPL-3.0" +repository = "" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[build-dependencies] +tauri-build = { version = "1.4", features = [] } + +[dependencies] +tauri = { version = "1.4", features = [ + "updater", + "dialog-message", + "fs-all", + "path-all", + "dialog-open", + "shell-open", +] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +serde_yaml = "0.9.25" +glob = "0.3.1" +dats = { path = "../../crates/dats" } +processor = { path = "../../crates/processor" } +anyhow = "1.0.72" +thiserror = "1.0.44" +specta = "1.0.5" +tauri-specta = { version = "1.0.2", features = ["typescript"] } +tracing = "0.1.37" +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } +parking_lot = "0.12.1" +tokio = { version = "1.29.1", features = ["full"] } +futures = "0.3.28" +notify = "6.0.1" +tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" } +walkdir = "2.3.3" + +[features] +# this feature is used for production builds or when `devPath` points to the filesystem +# DO NOT REMOVE!! +custom-protocol = ["tauri/custom-protocol"] diff --git a/client/src-tauri/build.rs b/client/src-tauri/build.rs new file mode 100644 index 0000000..261851f --- /dev/null +++ b/client/src-tauri/build.rs @@ -0,0 +1,3 @@ +fn main() { + tauri_build::build(); +} diff --git a/client/src-tauri/icons/128x128.png b/client/src-tauri/icons/128x128.png new file mode 100644 index 0000000..4779267 Binary files /dev/null and b/client/src-tauri/icons/128x128.png differ diff --git a/client/src-tauri/icons/128x128@2x.png b/client/src-tauri/icons/128x128@2x.png new file mode 100644 index 0000000..f6b4a6d Binary files /dev/null and b/client/src-tauri/icons/128x128@2x.png differ diff --git a/client/src-tauri/icons/32x32.png b/client/src-tauri/icons/32x32.png new file mode 100644 index 0000000..db76ef3 Binary files /dev/null and b/client/src-tauri/icons/32x32.png differ diff --git a/client/src-tauri/icons/Square107x107Logo.png b/client/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 0000000..d29fe0a Binary files /dev/null and b/client/src-tauri/icons/Square107x107Logo.png differ diff --git a/client/src-tauri/icons/Square142x142Logo.png b/client/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 0000000..0c8f675 Binary files /dev/null and b/client/src-tauri/icons/Square142x142Logo.png differ diff --git a/client/src-tauri/icons/Square150x150Logo.png b/client/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 0000000..dd431f1 Binary files /dev/null and b/client/src-tauri/icons/Square150x150Logo.png differ diff --git a/client/src-tauri/icons/Square284x284Logo.png b/client/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 0000000..66498e2 Binary files /dev/null and b/client/src-tauri/icons/Square284x284Logo.png differ diff --git a/client/src-tauri/icons/Square30x30Logo.png b/client/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 0000000..c35b0e1 Binary files /dev/null and b/client/src-tauri/icons/Square30x30Logo.png differ diff --git a/client/src-tauri/icons/Square310x310Logo.png b/client/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 0000000..7d74b05 Binary files /dev/null and b/client/src-tauri/icons/Square310x310Logo.png differ diff --git a/client/src-tauri/icons/Square44x44Logo.png b/client/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 0000000..e48bf7e Binary files /dev/null and b/client/src-tauri/icons/Square44x44Logo.png differ diff --git a/client/src-tauri/icons/Square71x71Logo.png b/client/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 0000000..533bd45 Binary files /dev/null and b/client/src-tauri/icons/Square71x71Logo.png differ diff --git a/client/src-tauri/icons/Square89x89Logo.png b/client/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 0000000..472f169 Binary files /dev/null and b/client/src-tauri/icons/Square89x89Logo.png differ diff --git a/client/src-tauri/icons/StoreLogo.png b/client/src-tauri/icons/StoreLogo.png new file mode 100644 index 0000000..d2a22c9 Binary files /dev/null and b/client/src-tauri/icons/StoreLogo.png differ diff --git a/client/src-tauri/icons/icon.icns b/client/src-tauri/icons/icon.icns new file mode 100644 index 0000000..2e9b8aa Binary files /dev/null and b/client/src-tauri/icons/icon.icns differ diff --git a/client/src-tauri/icons/icon.ico b/client/src-tauri/icons/icon.ico new file mode 100644 index 0000000..6352782 Binary files /dev/null and b/client/src-tauri/icons/icon.ico differ diff --git a/client/src-tauri/icons/icon.png b/client/src-tauri/icons/icon.png new file mode 100644 index 0000000..25baccb Binary files /dev/null and b/client/src-tauri/icons/icon.png differ diff --git a/client/src-tauri/icons/xi_tinkerer_icon.png b/client/src-tauri/icons/xi_tinkerer_icon.png new file mode 100644 index 0000000..1a1b42d Binary files /dev/null and b/client/src-tauri/icons/xi_tinkerer_icon.png differ diff --git a/client/src-tauri/icons/xi_tinkerer_icon.xcf b/client/src-tauri/icons/xi_tinkerer_icon.xcf new file mode 100644 index 0000000..29445d5 Binary files /dev/null and b/client/src-tauri/icons/xi_tinkerer_icon.xcf differ diff --git a/client/src-tauri/src/app_persistence.rs b/client/src-tauri/src/app_persistence.rs new file mode 100644 index 0000000..cb012b0 --- /dev/null +++ b/client/src-tauri/src/app_persistence.rs @@ -0,0 +1,44 @@ +use std::{fs, path::PathBuf}; + +use serde::{Deserialize, Serialize}; +use specta::Type; +use tauri::api; + +#[derive(Debug, Clone, Serialize, Deserialize, Type)] +pub struct PersistenceData { + pub ffxi_path: Option, + pub recent_projects: Vec, +} + +impl PersistenceData { + const FILENAME: &'static str = "persistence.yml"; + + fn load_existing_data() -> Option { + let data: PersistenceData = serde_yaml::from_str( + &fs::read_to_string(api::path::local_data_dir()?.join(Self::FILENAME)).ok()?, + ) + .ok()?; + + Some(data) + } + + pub fn load() -> Self { + Self::load_existing_data().unwrap_or_default() + } + + pub fn save(&self) -> Option<()> { + let str = serde_yaml::to_string(self).ok()?; + fs::write(api::path::local_data_dir()?.join(Self::FILENAME), str).ok()?; + + Some(()) + } +} + +impl Default for PersistenceData { + fn default() -> Self { + Self { + ffxi_path: None, + recent_projects: vec![], + } + } +} diff --git a/client/src-tauri/src/commands.rs b/client/src-tauri/src/commands.rs new file mode 100644 index 0000000..753c2ce --- /dev/null +++ b/client/src-tauri/src/commands.rs @@ -0,0 +1,189 @@ +use std::path::PathBuf; + +use anyhow::{anyhow, Result}; +use processor::{dat_descriptor::DatDescriptor, processor::DatProcessorMessage}; + +use crate::{ + app_persistence::PersistenceData, + dat_query, + dat_query::ZoneInfo, + errors::AppError, + state::{AppState, FileNotification}, + {DAT_GENERATION_DIR, RAW_DATA_DIR}, +}; + +#[tauri::command] +#[specta::specta] +pub async fn select_ffxi_folder<'a>( + path: Option, + state: AppState<'a>, +) -> Result, AppError> { + state.write().set_ffxi_path(path) +} + +#[tauri::command] +#[specta::specta] +pub async fn select_project_folder<'a>( + path: Option, + state: AppState<'a>, +) -> Result, AppError> { + state.write().set_project_path(path) +} + +#[tauri::command] +#[specta::specta] +pub async fn load_persistence_data<'a>(state: AppState<'a>) -> Result { + Ok(state.read().persistence.clone()) +} + +#[tauri::command] +#[specta::specta] +pub async fn get_zones_for_type( + dat_descriptor: DatDescriptor, + state: AppState<'_>, +) -> Result, AppError> { + let dat_context = state + .read() + .dat_context + .clone() + .ok_or(anyhow!("No DAT context."))?; + + Ok(dat_query::get_zone_ids_for_type(dat_descriptor, dat_context).await) +} + +#[tauri::command] +#[specta::specta] +pub async fn get_standalone_string_dats() -> Result, AppError> { + Ok(dat_query::get_standalone_string_dats()) +} + +#[tauri::command] +#[specta::specta] +pub async fn get_item_dats() -> Result, AppError> { + Ok(dat_query::get_item_dats()) +} + +#[tauri::command] +#[specta::specta] +pub async fn get_working_files(state: AppState<'_>) -> Result, AppError> { + let dat_context = state + .read() + .dat_context + .clone() + .ok_or(anyhow!("No DAT context."))?; + + let project_path = state + .read() + .project_path + .as_ref() + .ok_or(anyhow!("No project path specified."))? + .clone(); + + let raw_data_dir = project_path.join(RAW_DATA_DIR); + Ok(walkdir::WalkDir::new(&raw_data_dir) + .into_iter() + .filter_map(|entry| { + let entry = entry.ok()?; + DatDescriptor::from_path(&entry.into_path(), &raw_data_dir, &dat_context) + }) + .collect()) +} + +#[tauri::command] +#[specta::specta] +pub async fn make_all_dats(state: AppState<'_>) -> Result<(), AppError> { + let dat_context = state + .read() + .dat_context + .clone() + .ok_or(anyhow!("No DAT context."))?; + + let project_path = state + .read() + .project_path + .as_ref() + .ok_or(anyhow!("No project path specified."))? + .clone(); + + let processor = state.read().processor.clone(); + + let raw_data_dir = project_path.join(RAW_DATA_DIR); + let dat_root_path = project_path.join(DAT_GENERATION_DIR); + + Ok(walkdir::WalkDir::new(&raw_data_dir) + .into_iter() + .filter_map(|entry| { + let entry = entry.ok()?; + DatDescriptor::from_path(&entry.into_path(), &raw_data_dir, &dat_context) + }) + .for_each(|dat_descriptor| { + let dat_context = dat_context.clone(); + let raw_data_root_path = raw_data_dir.clone(); + let dat_root_path = dat_root_path.clone(); + processor.yaml_to_dat( + dat_descriptor, + dat_context, + raw_data_root_path, + dat_root_path, + ); + })) +} + +#[tauri::command] +#[specta::specta] +pub async fn make_dat(dat_descriptor: DatDescriptor, state: AppState<'_>) -> Result<(), AppError> { + let dat_context = state + .read() + .dat_context + .clone() + .ok_or(anyhow!("No DAT context."))?; + + let project_path = state + .read() + .project_path + .as_ref() + .ok_or(anyhow!("No project path specified."))? + .clone(); + + let processor = state.read().processor.clone(); + + processor.yaml_to_dat( + dat_descriptor, + dat_context, + project_path.join(RAW_DATA_DIR), + project_path.join(DAT_GENERATION_DIR), + ); + + Ok(()) +} + +#[tauri::command] +#[specta::specta] +pub async fn make_yaml(dat_descriptor: DatDescriptor, state: AppState<'_>) -> Result<(), AppError> { + let dat_context = state + .read() + .dat_context + .clone() + .ok_or(anyhow!("No DAT context."))?; + + let project_path = state + .read() + .project_path + .as_ref() + .ok_or(anyhow!("No project path specified."))? + .clone(); + + let processor = state.read().processor.clone(); + + processor.dat_to_yaml(dat_descriptor, dat_context, project_path.join(RAW_DATA_DIR)); + + Ok(()) +} + +// Dummy command just to create types for events +#[tauri::command] +#[specta::specta] +#[allow(unused)] +pub async fn dummy_event_type_gen() -> Result<(FileNotification, DatProcessorMessage), AppError> { + Err(anyhow!("N/A"))? +} diff --git a/client/src-tauri/src/dat_query.rs b/client/src-tauri/src/dat_query.rs new file mode 100644 index 0000000..39f2a08 --- /dev/null +++ b/client/src-tauri/src/dat_query.rs @@ -0,0 +1,128 @@ +use std::sync::Arc; + +use anyhow::anyhow; +use dats::{ + base::{DatByZone, ZoneId}, + context::DatContext, + dat_format::DatFormat, + id_mapping::DatIdMapping, +}; +use processor::dat_descriptor::DatDescriptor; +use serde::Serialize; +use tauri::async_runtime; + +use crate::errors::AppError; + +pub fn get_standalone_string_dats() -> Vec { + vec![ + DatDescriptor::AbilityNames, + DatDescriptor::AbilityDescriptions, + DatDescriptor::AreaNames, + DatDescriptor::AreaNamesAlt, + DatDescriptor::CharacterSelect, + DatDescriptor::ChatFilterTypes, + DatDescriptor::DayNames, + DatDescriptor::Directions, + DatDescriptor::EquipmentLocations, + DatDescriptor::ErrorMessages, + DatDescriptor::IngameMessages1, + // DatDescriptor::IngameMessages2, // TODO: XiStringTable parsing isn't fully supported yet + DatDescriptor::JobNames, + DatDescriptor::KeyItems, + DatDescriptor::MenuItemsDescription, + DatDescriptor::MenuItemsText, + DatDescriptor::MoonPhases, + // DatDescriptor::PolMessages, // TODO: XiStringTable parsing isn't fully supported yet + DatDescriptor::RaceNames, + DatDescriptor::RegionNames, + DatDescriptor::SpellNames, + DatDescriptor::SpellDescriptions, + DatDescriptor::StatusInfo, + DatDescriptor::StatusNames, + // DatDescriptor::TimeAndPronouns, // TODO: XiStringTable parsing isn't fully supported yet + DatDescriptor::Titles, + DatDescriptor::Misc1, + DatDescriptor::Misc2, + DatDescriptor::WeatherTypes, + ] +} + +pub fn get_item_dats() -> Vec { + vec![ + DatDescriptor::Armor, + DatDescriptor::Armor2, + // DatDescriptor::Currency, // TODO: can't currently parse this + DatDescriptor::GeneralItems, + DatDescriptor::GeneralItems2, + DatDescriptor::PuppetItems, + DatDescriptor::UsableItems, + DatDescriptor::Weapons, + DatDescriptor::VouchersAndSlips, + // DatDescriptor::Monipulator, // TODO: fields seems to be very different compared to other items + DatDescriptor::Instincts, + ] +} + +#[derive(Serialize, specta::Type)] +pub struct ZoneInfo { + id: ZoneId, + name: String, +} + +async fn get_zone_ids_from_dats( + dat_by_zone: &DatByZone, + dat_context: Arc, +) -> Vec { + let handles = dat_by_zone + .map + .iter() + .filter_map(|(zone_id, dat_id)| { + let zone_id = zone_id.clone(); + let dat_id = dat_id.clone(); + let dat_context = dat_context.clone(); + + Some(async_runtime::spawn(async move { + let zone_name = dat_context + .zone_id_to_name + .get(&zone_id) + .ok_or(anyhow!("No zone name for ID."))?; + + if dat_context.check_dat(&dat_id).is_ok() { + Ok::<_, AppError>(ZoneInfo { + id: zone_id.clone(), + name: zone_name.display_name.clone(), + }) + } else { + Err(anyhow!("DAT did not match type."))? + } + })) + }) + .collect::>(); + + futures::future::join_all(handles) + .await + .into_iter() + .flatten() + .filter_map(|res| res.ok()) + .collect() +} + +pub async fn get_zone_ids_for_type( + dat_descriptor: DatDescriptor, + dat_context: Arc, +) -> Vec { + match dat_descriptor { + DatDescriptor::EntityNames(_) => { + get_zone_ids_from_dats(&DatIdMapping::get().entities, dat_context).await + } + DatDescriptor::Dialog(_) => { + get_zone_ids_from_dats(&DatIdMapping::get().dialog, dat_context).await + } + DatDescriptor::Dialog2(_) => { + get_zone_ids_from_dats(&DatIdMapping::get().dialog2, dat_context).await + } + _ => { + vec![] + } + } +} diff --git a/client/src-tauri/src/errors.rs b/client/src-tauri/src/errors.rs new file mode 100644 index 0000000..fa8d2ec --- /dev/null +++ b/client/src-tauri/src/errors.rs @@ -0,0 +1,20 @@ +use dats::base::DatError; + +#[derive(Debug, thiserror::Error)] +pub enum AppError { + #[error(transparent)] + DatError(#[from] DatError), + + #[error(transparent)] + Anyhow(#[from] anyhow::Error), +} + +// we must manually implement serde::Serialize +impl serde::Serialize for AppError { + fn serialize(&self, serializer: S) -> Result + where + S: serde::ser::Serializer, + { + serializer.serialize_str(self.to_string().as_ref()) + } +} diff --git a/client/src-tauri/src/main.rs b/client/src-tauri/src/main.rs new file mode 100644 index 0000000..51fe00f --- /dev/null +++ b/client/src-tauri/src/main.rs @@ -0,0 +1,65 @@ +// Prevents additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +mod app_persistence; +mod commands; +mod dat_query; +mod errors; +mod state; + +use parking_lot::RwLock; +use specta::collect_types; +use state::AppStateData; +use tauri::Manager; +use tauri_specta::ts; +use tracing_subscriber::EnvFilter; + +pub const RAW_DATA_DIR: &'static str = "raw_data"; +pub const DAT_GENERATION_DIR: &'static str = "generated_dats"; + +fn main() { + #[cfg(debug_assertions)] + ts::export( + collect_types![ + commands::dummy_event_type_gen, + commands::select_ffxi_folder, + commands::select_project_folder, + commands::load_persistence_data, + commands::get_standalone_string_dats, + commands::get_item_dats, + commands::get_zones_for_type, + commands::get_working_files, + commands::make_all_dats, + commands::make_dat, + commands::make_yaml, + ], + "../src/bindings.ts", + ) + .unwrap(); + + tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .init(); + + tauri::Builder::default() + .plugin(tauri_plugin_window_state::Builder::default().build()) + .invoke_handler(tauri::generate_handler![ + commands::select_ffxi_folder, + commands::select_project_folder, + commands::load_persistence_data, + commands::get_zones_for_type, + commands::get_standalone_string_dats, + commands::get_item_dats, + commands::get_working_files, + commands::make_all_dats, + commands::make_dat, + commands::make_yaml, + ]) + .setup(|app| { + let app_state = RwLock::new(AppStateData::new(app)); + app.manage(app_state); + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); +} diff --git a/client/src-tauri/src/state.rs b/client/src-tauri/src/state.rs new file mode 100644 index 0000000..00cd304 --- /dev/null +++ b/client/src-tauri/src/state.rs @@ -0,0 +1,188 @@ +use std::{ + ffi::OsStr, + path::PathBuf, + sync::{mpsc, Arc}, + thread, +}; + +use anyhow::Result; +use dats::context::DatContext; +use notify::{Event, EventKind, RecommendedWatcher, RecursiveMode, Watcher}; +use parking_lot::RwLock; +use processor::{dat_descriptor::DatDescriptor, processor::DatProcessor}; +use serde::Serialize; +use tauri::{async_runtime, App, AppHandle, Manager}; + +use crate::{app_persistence::PersistenceData, errors::AppError, RAW_DATA_DIR}; + +#[derive(Debug)] +pub struct AppStateData { + pub project_path: Option, + pub dat_context: Option>, + pub processor: Arc, + pub persistence: PersistenceData, + watcher: RecommendedWatcher, +} + +#[derive(Debug, Clone, Serialize, specta::Type)] +pub struct FileNotification { + dat_descriptor: DatDescriptor, + is_delete: bool, +} + +impl AppStateData { + pub fn new(app: &App) -> Self { + let persistence = PersistenceData::load(); + + let dat_context = persistence + .ffxi_path + .as_ref() + .and_then(|ffxi_path| DatContext::from_path(ffxi_path.clone()).ok()) + .map(|context| Arc::new(context)); + + let (tx, rx) = std::sync::mpsc::channel(); + let mut watcher = notify::recommended_watcher(tx).unwrap(); + + let handle = app.handle(); + thread::spawn(move || Self::watch_handler(rx, handle)); + + let project_path = persistence.recent_projects.get(0).cloned(); + + if let Some(project_path) = &project_path { + let _ = watcher.watch(&project_path, RecursiveMode::Recursive); + } + + let (tx, rx) = mpsc::sync_channel(256); + let processor = Arc::new(DatProcessor::new(tx)); + + let app_handle = app.handle(); + async_runtime::spawn(async move { + while let Ok(msg) = rx.recv() { + if let Err(err) = app_handle.emit_all("processing", msg) { + eprintln!("Failed to emit message to all: {err}"); + } + } + }); + + Self { + dat_context, + project_path, + persistence, + watcher, + processor, + } + } + + pub fn set_ffxi_path( + &mut self, + ffxi_path: Option, + ) -> Result, AppError> { + let context = if let Some(ffxi_path) = ffxi_path { + Some(Arc::new(DatContext::from_path(ffxi_path)?)) + } else { + None + }; + + let new_ffxi_path = context.as_ref().map(|context| context.ffxi_path.clone()); + + self.dat_context = context; + self.persistence.ffxi_path = new_ffxi_path.clone(); + self.persistence.save(); + + Ok(new_ffxi_path) + } + + pub fn set_project_path( + &mut self, + project_path: Option, + ) -> Result, AppError> { + // Remove previous path from being watched + if let Some(previous_path) = &self.project_path { + let _ = self.watcher.unwatch(previous_path); + } + + self.project_path = project_path.clone(); + + if let Some(project_path) = project_path { + // Remove project from list if it's already there, and then insert it at the front + let filtered_recent_project = self + .persistence + .recent_projects + .iter() + .filter(|project| *project != &project_path); + + self.persistence.recent_projects = std::iter::once(&project_path) + .chain(filtered_recent_project) + .take(5) + .cloned() + .collect(); + + self.persistence.save(); + + // Start watching new project data directory + let _ = self.watcher.watch(&project_path, RecursiveMode::Recursive); + } + + Ok(self.persistence.recent_projects.clone()) + } + + fn watch_handler(rx: std::sync::mpsc::Receiver>, app_handle: AppHandle) { + while let Ok(event) = rx.recv() { + match event { + Ok(event) => { + let _ = Self::handle_file_event(event, app_handle.clone()); + } + Err(err) => { + eprintln!("Error: {err}"); + } + } + } + } + + fn handle_file_event(event: Event, app_handle: AppHandle) -> Option<()> { + // Only send event on creation and removal of files. + let is_delete = match event.kind { + EventKind::Create(_) => false, + EventKind::Remove(_) => true, + _ => return None, + }; + + let app_state: AppState = app_handle.state(); + let project_path = app_state.read().project_path.clone().unwrap(); + + let raw_data_paths = event + .paths + .into_iter() + .filter_map(|path| { + path.strip_prefix(&project_path.join(RAW_DATA_DIR)) + .map(|p| p.to_path_buf()) + .ok() + }) + .collect::>(); + + for path in raw_data_paths { + if let Some(dat_descriptor) = Self::get_file_dat_descriptor(&path, &app_state) { + let notification = FileNotification { + dat_descriptor, + is_delete, + }; + let _ = app_handle.emit_all("file-change", notification); + } + } + + Some(()) + } + + fn get_file_dat_descriptor(path: &PathBuf, app_state: &AppState) -> Option { + if path.is_dir() || path.extension() != Some(OsStr::new("yml")) { + return None; + } + + let dat_context = app_state.read().dat_context.clone()?; + let raw_data_dir = app_state.read().project_path.clone()?.join(RAW_DATA_DIR); + + DatDescriptor::from_path(path, &raw_data_dir, &dat_context) + } +} + +pub type AppState<'a> = tauri::State<'a, RwLock>; diff --git a/client/src-tauri/tauri.conf.json b/client/src-tauri/tauri.conf.json new file mode 100644 index 0000000..8092be1 --- /dev/null +++ b/client/src-tauri/tauri.conf.json @@ -0,0 +1,71 @@ +{ + "build": { + "beforeDevCommand": "pnpm dev", + "beforeBuildCommand": "pnpm build", + "devPath": "http://localhost:1420", + "distDir": "../dist", + "withGlobalTauri": false + }, + "package": { + "productName": "XI Tinkerer", + "version": "0.1.0" + }, + "tauri": { + "allowlist": { + "all": false, + "dialog": { + "open": true, + "message": true + }, + "fs": { + "all": true, + "scope": [ + "$APPLOCALDATA/*" + ] + }, + "path": { + "all": true + }, + "shell": { + "all": false, + "open": true + } + }, + "bundle": { + "active": true, + "targets": "all", + "identifier": "inouno.xi-tinkerer", + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ] + }, + "security": { + "csp": null + }, + "windows": [ + { + "fullscreen": false, + "resizable": true, + "title": "XI Tinkerer", + "width": 1024, + "height": 768 + } + ], + "updater": { + "active": true, + "dialog": true, + "windows": { + "installMode": "passive", + "installerArgs": [] + }, + "endpoints": [ + "https://github.com/InoUno/xi-tinkerer/releases/latest/download/latest.json" + ], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEY0RUQ2MzREQjEzNDdBOTYKUldTV2VqU3hUV1B0OUV3KytyUDN0aHl4MjNGQmQ5TkhFV0JqV2VJVW9mL290dmRyYmZML1RCTGcK" + } + } +} \ No newline at end of file diff --git a/client/src/App.tsx b/client/src/App.tsx new file mode 100644 index 0000000..d94fd14 --- /dev/null +++ b/client/src/App.tsx @@ -0,0 +1,130 @@ +import Sidebar, { NavItem } from "./components/Sidebar"; +import Statusbar from "./components/Statusbar"; +import Home from "./components/Home"; +import { Routes, Route } from "@solidjs/router"; +import { HiSolidCog8Tooth } from "solid-icons/hi"; +import DatTable from "./components/DatTable"; +import * as commands from "./bindings"; +import Logs from "./components/Logs"; + +const navItems: NavItem[] = [ + { + name: "Home", + path: "/", + icon: , + }, + {}, + { + name: "String tables", + path: "/strings", + }, + {}, + { + name: "Items", + path: "/items", + }, + {}, + { + name: "Entity names", + path: "/entities", + }, + { + name: "Dialog", + path: "/dialog", + }, + { + name: "Dialog (2)", + path: "/dialog2", + }, +]; + +function App() { + return ( +
+
+ + +
+
+ + + + ( + commands.getStandaloneStringDats()} + columns={[{ name: "Name", key: "type" }]} + defaultSortColumn="type" + toDatDescriptor={(datDescriptor) => datDescriptor} + /> + )} + > + + ( + commands.getItemDats()} + columns={[{ name: "Name", key: "type" }]} + defaultSortColumn="type" + toDatDescriptor={(datDescriptor) => datDescriptor} + /> + )} + > + + ( + commands.getZonesForType({ type: "EntityNames", index: 0 })} + columns={[{ name: "Name", key: "name" }, { name: "ID", key: "id" }]} + defaultSortColumn="name" + toDatDescriptor={(zone) => ({ type: "EntityNames", index: zone.id })} + /> + )} + > + + ( + commands.getZonesForType({ type: "Dialog", index: 0 })} + columns={[{ name: "Name", key: "name" }, { name: "ID", key: "id" }]} + defaultSortColumn="name" + toDatDescriptor={(zone) => ({ type: "Dialog", index: zone.id })} + /> + )} + > + + ( + commands.getZonesForType({ type: "Dialog2", index: 0 })} + columns={[{ name: "Name", key: "name" }, { name: "ID", key: "id" }]} + defaultSortColumn="name" + toDatDescriptor={(zone) => ({ type: "Dialog2", index: zone.id })} + /> + )} + > + + + +
+ +
+
+
+ ); +} + +export default App; diff --git a/client/src/assets/logo.svg b/client/src/assets/logo.svg new file mode 100644 index 0000000..025aa30 --- /dev/null +++ b/client/src/assets/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/bindings.ts b/client/src/bindings.ts new file mode 100644 index 0000000..e55d5de --- /dev/null +++ b/client/src/bindings.ts @@ -0,0 +1,63 @@ +/* eslint-disable */ +// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. + +declare global { + interface Window { + __TAURI_INVOKE__(cmd: string, args?: Record): Promise; + } +} + +// Function avoids 'window not defined' in SSR +const invoke = () => window.__TAURI_INVOKE__; + +export function dummyEventTypeGen() { + return invoke()<[FileNotification, DatProcessorMessage]>("dummy_event_type_gen") +} + +export function selectFfxiFolder(path: string | null) { + return invoke()("select_ffxi_folder", { path }) +} + +export function selectProjectFolder(path: string | null) { + return invoke()("select_project_folder", { path }) +} + +export function loadPersistenceData() { + return invoke()("load_persistence_data") +} + +export function getStandaloneStringDats() { + return invoke()("get_standalone_string_dats") +} + +export function getItemDats() { + return invoke()("get_item_dats") +} + +export function getZonesForType(datDescriptor: DatDescriptor) { + return invoke()("get_zones_for_type", { datDescriptor }) +} + +export function getWorkingFiles() { + return invoke()("get_working_files") +} + +export function makeAllDats() { + return invoke()("make_all_dats") +} + +export function makeDat(datDescriptor: DatDescriptor) { + return invoke()("make_dat", { datDescriptor }) +} + +export function makeYaml(datDescriptor: DatDescriptor) { + return invoke()("make_yaml", { datDescriptor }) +} + +export type DatProcessorOutputKind = "Dat" | "Yaml" +export type DatDescriptor = { type: "AbilityNames" } | { type: "AbilityDescriptions" } | { type: "AreaNames" } | { type: "AreaNamesAlt" } | { type: "CharacterSelect" } | { type: "ChatFilterTypes" } | { type: "DayNames" } | { type: "Directions" } | { type: "EquipmentLocations" } | { type: "ErrorMessages" } | { type: "IngameMessages1" } | { type: "IngameMessages2" } | { type: "JobNames" } | { type: "KeyItems" } | { type: "MenuItemsDescription" } | { type: "MenuItemsText" } | { type: "MoonPhases" } | { type: "PolMessages" } | { type: "RaceNames" } | { type: "RegionNames" } | { type: "SpellNames" } | { type: "SpellDescriptions" } | { type: "StatusInfo" } | { type: "StatusNames" } | { type: "TimeAndPronouns" } | { type: "Titles" } | { type: "Misc1" } | { type: "Misc2" } | { type: "WeatherTypes" } | { type: "Armor" } | { type: "Armor2" } | { type: "Currency" } | { type: "GeneralItems" } | { type: "GeneralItems2" } | { type: "PuppetItems" } | { type: "UsableItems" } | { type: "Weapons" } | { type: "VouchersAndSlips" } | { type: "Monipulator" } | { type: "Instincts" } | { type: "EntityNames"; index: number } | { type: "Dialog"; index: number } | { type: "Dialog2"; index: number } +export type FileNotification = { dat_descriptor: DatDescriptor; is_delete: boolean } +export type DatProcessingState = "Working" | "Finished" | { Error: string } +export type PersistenceData = { ffxi_path: string | null; recent_projects: string[] } +export type DatProcessorMessage = { dat_descriptor: DatDescriptor; output_kind: DatProcessorOutputKind; state: DatProcessingState } +export type ZoneInfo = { id: number; name: string } diff --git a/client/src/components/DatTable.tsx b/client/src/components/DatTable.tsx new file mode 100644 index 0000000..b8dd833 --- /dev/null +++ b/client/src/components/DatTable.tsx @@ -0,0 +1,232 @@ +import { + For, + Match, + Show, + Switch, + createMemo, + createResource, + createSignal, + onMount, +} from "solid-js"; +import fusejs from "fuse.js"; +import * as commands from "../bindings"; +import { useData } from "../store"; + +interface DatTableProps { + title: string; + rowsResourceFetcher: () => Promise, + columns: { name: string, key: Column }[], + defaultSortColumn: Column, + toDatDescriptor: (t: T) => commands.DatDescriptor, +} + +function DatTable + ({ title, rowsResourceFetcher, columns, defaultSortColumn, toDatDescriptor }: DatTableProps) { + const { + processing: { canProcess, isProcessing, processing }, + workingFiles: { hasWorkingFile } + } = useData(); + + const [rowsResource] = createResource(rowsResourceFetcher, { initialValue: [] }); + + const [sortBy, setSortBy] = createSignal(defaultSortColumn); + const [sortAsc, setSortAsc] = createSignal(true); + const [filterBy, setFilterBy] = createSignal(""); + + const updateSort = (column: Column) => { + if (column == sortBy()) { + setSortAsc(!sortAsc()); + } else { + setSortBy(column as any); + setSortAsc(true); + } + }; + + const fuseIndex = createMemo(() => { + return new fusejs(rowsResource(), { + keys: columns.map((col) => col.key), + threshold: 0.3, + }); + }); + + const rows = () => { + let sortedRows; + if (filterBy()) { + sortedRows = fuseIndex() + .search(filterBy()) + .map((e) => e.item); + } else { + sortedRows = [...rowsResource()]; + } + + sortedRows.sort((a, b) => { + const aValue = a[sortBy()]; + const bValue = b[sortBy()]; + const dir = sortAsc() ? 1 : -1; + if (aValue < bValue) { + return -1 * dir; + } else if (aValue > bValue) { + return 1 * dir; + } + return 0; + }); + + return sortedRows; + }; + + // Make YAML + const makeAllYaml = () => { + if (!canProcess()) { + return; + } + + rows().forEach((row) => { + commands.makeYaml(toDatDescriptor(row)); + }); + }; + + const makingYamlCount = createMemo(() => { + return rows() + .filter((row) => { + const descriptor = toDatDescriptor(row); + const key = "index" in descriptor ? descriptor.index : 0; + return processing.Yaml?.[descriptor.type]?.[key] == true; + }) + .length; + }); + + // Making DAT files from YAML + const makeAllDats = () => { + if (!canProcess()) { + return; + } + + rows().forEach((row) => { + commands.makeDat(toDatDescriptor(row)); + }); + }; + + const makingDatCount = createMemo(() => { + return rows() + .filter((row) => { + const descriptor = toDatDescriptor(row); + const key = "index" in descriptor ? descriptor.index : 0; + return processing.Dat?.[descriptor.type]?.[key] == true; + }) + .length; + }); + + let inputRef: HTMLInputElement; + onMount(() => { + inputRef.focus(); + }); + + return ( +
+

{title}

+
+ +
+
+ setFilterBy(e.target.value ?? "")} + /> + + + + +
+ + Loading...
}> + + + + {columns.map((col) => )} + + + + + + + + + {(row) => { + const descriptor = toDatDescriptor(row); + return ( + + {columns.map((col) => )} + + + + Select a project and FFXI folder. + + + } + > + + + + + ) + }} + + +
updateSort(col.key)} + > + {col.name} + Export from DATGenerate DAT
{row[col.key]} + + + Exporting... + + + + commands.makeYaml(descriptor)} + > + Export from DAT + + + + + + + Making... + + + + commands.makeDat(descriptor)} + > + Make DAT + + + +
+ +
+ + ); +} + +export default DatTable; diff --git a/client/src/components/FFXISelect.tsx b/client/src/components/FFXISelect.tsx new file mode 100644 index 0000000..0a0861a --- /dev/null +++ b/client/src/components/FFXISelect.tsx @@ -0,0 +1,31 @@ +import { useData } from "../store"; + +function FFXISelect() { + const { + folders: { getDatFolder, promptDatFolder }, + } = useData(); + + return ( +
+

FFXI Folder

+ + This should point your FFXI installation. It will be used to read DATs from, + that can be exported into human-readable files. + + +
+ +
+ Current FFXI folder: + {getDatFolder() ? ( + {getDatFolder()} + ) : ( + None + )} +
+
+
+ ); +} + +export default FFXISelect; diff --git a/client/src/components/Home.tsx b/client/src/components/Home.tsx new file mode 100644 index 0000000..622824b --- /dev/null +++ b/client/src/components/Home.tsx @@ -0,0 +1,24 @@ +import ProjectSelect from "./ProjectSelect"; +import FFXISelect from "./FFXISelect"; +import * as commands from '../bindings'; +import { useData } from "../store"; + +function Home() { + const { processing: { totalProcessingCount } } = useData(); + + return ( +
+

Home

+
+ +
+ +
+ +
+ ); +} + +export default Home; diff --git a/client/src/components/Logs.tsx b/client/src/components/Logs.tsx new file mode 100644 index 0000000..07fe0be --- /dev/null +++ b/client/src/components/Logs.tsx @@ -0,0 +1,48 @@ +import { createSignal } from "solid-js"; +import { useData } from "../store"; + + +function Logs() { + const { logs } = useData(); + + const [onlyErrors, setOnlyErrors] = createSignal(true); + + const logsToShow = () => { + if (onlyErrors()) { + return logs.filter((log) => log.isError).reverse() + } else { + return logs.slice(0).reverse(); + } + }; + + return ( +
+

Logs

+
+
+ +
+ + + + + + + + + + {logsToShow().map((log) => + + + + + )} + +
DATMessage
{log.descriptor}{log.message}
+
+ ); +} + +export default Logs; diff --git a/client/src/components/ProjectSelect.tsx b/client/src/components/ProjectSelect.tsx new file mode 100644 index 0000000..b8a8eae --- /dev/null +++ b/client/src/components/ProjectSelect.tsx @@ -0,0 +1,65 @@ +import { For, Show, createSignal } from "solid-js"; +import { useData } from "../store"; + +function ProjectSelect() { + const { + folders: { + getRecentProjectFolders, + getProjectFolder, + setProjectFolder, + promptProjectFolder, + }, + } = useData(); + + const [isLoading, setLoading] = createSignal(false); + + const updateFolder = async (folder: string | null) => { + setLoading(true); + await setProjectFolder(folder); + setLoading(false); + }; + + return ( +
+
+

Project Folder

+ + This should point to a folder where the human-readable data files should be exported to and live in.
+ This is also where DAT files will be generated from the human-readable data files when requested. +
+ +
+ +
Current project folder: + {getProjectFolder() ? ( + {getProjectFolder()} + ) : ( + None + )} + + (Loading...) + +
+ +
+
+ +
+ Recently opened projects: +
    + + {(recentProject) => ( +
  • updateFolder(recentProject)}> + {recentProject} +
  • + )} +
    +
+
+
+ ); +} + +export default ProjectSelect; diff --git a/client/src/components/Select.tsx b/client/src/components/Select.tsx new file mode 100644 index 0000000..8eb256f --- /dev/null +++ b/client/src/components/Select.tsx @@ -0,0 +1,102 @@ +import { + Component, + For, + JSX, + Setter, + Show, + createEffect, + createMemo, + createSignal, + on, +} from "solid-js"; + +const Select: Component<{ + setSelection: Setter; + options: Array; + autofocus?: boolean; +}> = (props) => { + const [text, setText] = createSignal(""); + const [show, setShow] = createSignal(false); + const [selected, setSelected] = createSignal(0); + + let inputRef: HTMLInputElement | undefined = undefined; + + const filteredOptions = () => + props.options.filter((el) => el.includes(text())); + + const areOptionsVisible = createMemo(() => { + return ( + show() && + (filteredOptions().length > 1 || filteredOptions()[0] !== text()) + ); + }); + + createEffect( + on(text, () => { + setSelected(0); + }) + ); + + createEffect(() => { + inputRef?.focus(); + }); + + const handleInput: JSX.EventHandlerUnion = ( + event + ) => { + setText(event.currentTarget.value); + }; + + const handleKeydown: JSX.EventHandler = ( + event + ) => { + if (event.code === "ArrowUp") { + setSelected((prev) => + prev === 0 ? filteredOptions().length - 1 : prev - 1 + ); + } else if (event.code === "ArrowDown") { + setSelected((prev) => + prev + 1 === filteredOptions().length ? 0 : prev + 1 + ); + } else if (event.code === "Enter") { + setText(filteredOptions()[selected()]); + props.setSelection(text()); + } + }; + + return ( +
+ setShow(true)} + onBlur={() => setShow(false)} + /> + +
+
    + + {(item, i) => ( +
  • + {item} +
  • + )} +
    +
+
+
+
+ ); +}; + +export default Select; diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx new file mode 100644 index 0000000..9c68f51 --- /dev/null +++ b/client/src/components/Sidebar.tsx @@ -0,0 +1,68 @@ +import { JSXElement } from "solid-js"; +import { HiOutlineDocumentText, HiSolidCube } from "solid-icons/hi"; +import { A } from "@solidjs/router"; +import { useData } from "../store"; + +export interface NavItemLink { + name: string; + path: string; + icon?: JSXElement; +} + +export type NavItem = NavItemLink | {}; + +function SidebarButton(props: { navItem: NavItem, classExt?: string }) { + if (!("path" in props.navItem)) { + return
; + } + + return ( + + {props.navItem.icon ?? } + {props.navItem.name} + + ); +} + +function Sidebar(props: { navItems: NavItem[] }) { + const { + processing: { totalProcessingCount }, + } = useData(); + + return ( + + ); +} + +export default Sidebar; diff --git a/client/src/components/Statusbar.tsx b/client/src/components/Statusbar.tsx new file mode 100644 index 0000000..791e365 --- /dev/null +++ b/client/src/components/Statusbar.tsx @@ -0,0 +1,67 @@ +import { useData } from "../store"; + +function Statusbar() { + const { + folders: { + getDatFolder, + setDatFolder, + getProjectFolder, + setProjectFolder, + promptDatFolder, + promptProjectFolder, + }, + } = useData(); + + return ( +
+
+
+
Project:
+ +
{ + if (e.ctrlKey) { + setProjectFolder(null); + } else { + promptProjectFolder(); + } + }} + > + {getProjectFolder() ? ( +
{getProjectFolder()}
+ ) : ( +
+ None. Click to select one. +
+ )} +
+
FFXI:
+
{ + if (e.ctrlKey) { + setDatFolder(null); + } else { + promptDatFolder(); + } + }} + > + {getDatFolder() ? ( +
{getDatFolder()}
+ ) : ( +
+ None. Click here to select. +
+ )} +
+
+
+
+ ); +} + +export default Statusbar; diff --git a/client/src/index.css b/client/src/index.css new file mode 100644 index 0000000..e27b3ac --- /dev/null +++ b/client/src/index.css @@ -0,0 +1,75 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + body { + @apply overflow-y-hidden; + } + + .clickable { + @apply hover:cursor-pointer text-blue-200 hover:text-blue-400; + } + + .content { + @apply bg-slate-900 text-slate-200 p-5; + } + + button { + @apply my-2 py-1.5 px-3 rounded-lg font-medium + text-center + shadow-lg + border-2 hover:border-blue-100 border-slate-400 + bg-slate-800 + text-slate-100 + disabled:hover:cursor-not-allowed + disabled:text-slate-600 + disabled:border-slate-600 + disabled:hover:border-slate-600; + } + + input { + @apply block m-1 py-1 px-2 rounded-md + bg-slate-700 border border-slate-400 + placeholder:text-slate-400 + focus:border-slate-200 + focus:outline-none; + } + + table { + @apply text-left w-full my-4; + } + + thead { + @apply bg-slate-700 border-b; + } + + tbody { + @apply bg-slate-800; + } + + tbody > tr { + @apply border-b border-slate-600; + } + + td, + th { + @apply px-3 py-1; + } + + h1 { + font-size: 2rem; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-variant: small-caps; + font-weight: 600; + } + + h2 { + font-size: 1.5rem; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-variant: small-caps; + font-weight: 600; + text-decoration: underline 1px dashed; + text-underline-offset: 5px; + } +} diff --git a/client/src/index.tsx b/client/src/index.tsx new file mode 100644 index 0000000..4357676 --- /dev/null +++ b/client/src/index.tsx @@ -0,0 +1,18 @@ +/* @refresh reload */ +import { render } from "solid-js/web"; + +import "./index.css"; +import App from "./App"; +import { Router } from "@solidjs/router"; +import { DataProvider } from "./store"; + +render( + () => ( + + + + + + ), + document.getElementById("root") as HTMLElement +); diff --git a/client/src/store/folders.ts b/client/src/store/folders.ts new file mode 100644 index 0000000..de1ae62 --- /dev/null +++ b/client/src/store/folders.ts @@ -0,0 +1,77 @@ +import { message } from "@tauri-apps/api/dialog"; +import { + loadPersistenceData, + selectFfxiFolder, + selectProjectFolder, +} from "../bindings"; +import { createEffect, createResource, createSignal } from "solid-js"; +import { promptFolder } from "../util"; + +export function createFoldersStore() { + const [getDatFolder, setDatFolderLocal] = createSignal(); + + // FFXI DAT folder + const setDatFolder = (path: string | null) => { + selectFfxiFolder(path) + .then((new_path) => { + setDatFolderLocal(new_path); + }) + .catch((err) => { + message(err); + setDatFolderLocal(null); + console.error(err); + }); + }; + + // Project folder + const [getProjectFolder, setProjectFolderLocal] = createSignal< + string | null + >(); + + const setProjectFolder = async (path: string | null) => { + setProjectFolderLocal(path); + + return selectProjectFolder(path) + .then((recentFolders) => { + setRecentProjectFolders(recentFolders); + }) + .catch((err) => { + message(err); + setProjectFolderLocal(null); + console.error(err); + }); + }; + + const [getRecentProjectFolders, setRecentProjectFolders] = createSignal< + string[] + >([]); + + // Load data + const [appPersistence] = createResource(loadPersistenceData); + + createEffect(() => { + setProjectFolderLocal(appPersistence()?.recent_projects[0]); + setRecentProjectFolders(appPersistence()?.recent_projects ?? []); + setDatFolderLocal(appPersistence()?.ffxi_path); + }); + + const promptDatFolder = () => { + promptFolder(setDatFolder, getDatFolder()); + }; + + const promptProjectFolder = () => { + promptFolder(setProjectFolder, getProjectFolder()); + }; + + return { + getDatFolder, + setDatFolder, + promptDatFolder, + + getProjectFolder, + setProjectFolder, + promptProjectFolder, + + getRecentProjectFolders, + }; +} diff --git a/client/src/store/index.tsx b/client/src/store/index.tsx new file mode 100644 index 0000000..f6f9a83 --- /dev/null +++ b/client/src/store/index.tsx @@ -0,0 +1,30 @@ +import { createContext, useContext, FlowProps } from "solid-js"; +import { createFoldersStore } from "./folders"; +import { createProcessingStore } from "./processing"; +import { createWorkingFilesStore } from "./workingFiles"; +import { createLogsStore } from "./logs"; + +function makeDataContext() { + const folders = createFoldersStore(); + return { + folders, + processing: createProcessingStore(folders), + workingFiles: createWorkingFilesStore(folders), + logs: createLogsStore(), + }; +} + +export type DataContextType = ReturnType; +const DataContext = createContext(); + +export function DataProvider(props: FlowProps) { + return ( + + {props.children} + + ); +} + +export function useData() { + return useContext(DataContext)!; +} diff --git a/client/src/store/logs.ts b/client/src/store/logs.ts new file mode 100644 index 0000000..15475d0 --- /dev/null +++ b/client/src/store/logs.ts @@ -0,0 +1,43 @@ +import * as commands from '../bindings'; +import { listen } from "@tauri-apps/api/event"; +import { createStore } from "solid-js/store"; + +export interface Log { + descriptor: string, + message: string, + isError?: boolean, +} + + +export function createLogsStore() { + const [logs, setLogs] = createStore([]); + + listen("processing", (event) => { + const payload = event.payload; + + if (payload.state != "Working") { + let descriptor = payload.dat_descriptor.type; + if ("index" in payload.dat_descriptor) { + descriptor += ` (${payload.dat_descriptor.index})`; + } + + let message; + let isError; + if (payload.state == "Finished") { + message = "Success"; + } else if ("Error" in payload.state) { + message = payload.state.Error; + isError = true; + } + + let log: Log = { + descriptor, + message: message!, + isError + }; + setLogs(logs.length, log); + } + }) + + return logs; +} \ No newline at end of file diff --git a/client/src/store/processing.ts b/client/src/store/processing.ts new file mode 100644 index 0000000..1067547 --- /dev/null +++ b/client/src/store/processing.ts @@ -0,0 +1,76 @@ +import { createStore } from "solid-js/store"; +import { DatDescriptor } from "../bindings"; +import * as commands from "../bindings"; +import { listen } from "@tauri-apps/api/event"; +import { createEffect, createSignal } from "solid-js"; +import { createFoldersStore } from "./folders"; + + +type DatDescriptorNames = commands.DatDescriptor["type"]; +type ProcessingState = { + [kind in commands.DatProcessorOutputKind]: { + [name in DatDescriptorNames]?: { [key: number]: boolean } + } +} + +const defaultProcessingState: ProcessingState = { + Dat: {}, + Yaml: {} +} + +export function createProcessingStore( + folders: ReturnType +) { + const [processing, setProcessing] = createStore(defaultProcessingState); + const [totalProcessingCount, setTotalProcessingCount] = createSignal(0); + const [projectPath, setProjectPath] = createSignal(); + + createEffect(() => { + if (folders.getProjectFolder() != projectPath()) { + setProjectPath(folders.getProjectFolder()); + setProcessing(defaultProcessingState); + } + }); + + // Listen for changes to the YAML data files + listen("processing", (event) => { + const payload = event.payload; + if (event.payload.state == "Working") { + setTotalProcessingCount(totalProcessingCount() + 1); + setProcessing( + payload.output_kind, + payload.dat_descriptor.type, + (_typeObj) => ({ + ["index" in payload.dat_descriptor ? payload.dat_descriptor.index : 0]: + true + }) + ); + } else { + setTotalProcessingCount(totalProcessingCount() - 1); + setProcessing( + payload.output_kind, + payload.dat_descriptor.type, + (_typeObj) => ({ + ["index" in payload.dat_descriptor ? payload.dat_descriptor.index : 0]: + undefined + }) + ); + } + }); + + const canProcess = () => { + return !!folders.getProjectFolder() && !!folders.getDatFolder(); + }; + + return { + processing, + totalProcessingCount, + canProcess, + + isProcessing: (outputKind: commands.DatProcessorOutputKind, descriptor: DatDescriptor): boolean | undefined => { + const key = "index" in descriptor ? descriptor.index : 0; + return processing[outputKind]?.[descriptor.type]?.[key]; + }, + + }; +} diff --git a/client/src/store/workingFiles.ts b/client/src/store/workingFiles.ts new file mode 100644 index 0000000..fbc0820 --- /dev/null +++ b/client/src/store/workingFiles.ts @@ -0,0 +1,59 @@ +import { createStore } from "solid-js/store"; +import { DatDescriptor } from "../bindings"; +import * as commands from "../bindings"; +import { listen } from "@tauri-apps/api/event"; +import { createEffect, createSignal } from "solid-js"; +import { createFoldersStore } from "./folders"; + +type DatDescriptorNames = DatDescriptor["type"]; +type WorkingFilesState = { + [name in DatDescriptorNames]?: { [key: number]: boolean } +} + +export function createWorkingFilesStore( + folders: ReturnType +) { + const [workingFiles, setWorkingFiles] = createStore({}); + const [projectPath, setProjectPath] = createSignal(); + + const setWorkingFileFromDescriptor = (descriptor: DatDescriptor, is_delete: boolean) => { + if (is_delete) { + console.log("Got delete for", descriptor); + } + + setWorkingFiles( + descriptor.type, + (_type) => ({ + ["index" in descriptor ? descriptor.index : 0]: !is_delete + }) + ); + }; + + createEffect(() => { + if (folders.getProjectFolder() != projectPath()) { + setProjectPath(folders.getProjectFolder()); + setWorkingFiles({}); + + commands.getWorkingFiles().then((loadedWorkingFiles) => { + setWorkingFiles({}); + for (const datDescriptor of loadedWorkingFiles) { + setWorkingFileFromDescriptor(datDescriptor, false); + } + }); + } + }); + + // Listen for changes to the YAML data files + listen("file-change", (event) => { + const payload = event.payload; + setWorkingFileFromDescriptor(payload.dat_descriptor, payload.is_delete); + }); + + return { + hasWorkingFile: (descriptor: DatDescriptor): boolean => { + const kind = workingFiles[descriptor.type]; + const key = "index" in descriptor ? descriptor.index : 0; + return kind?.[key] ?? false; + } + }; +} diff --git a/client/src/util.ts b/client/src/util.ts new file mode 100644 index 0000000..27e6f2c --- /dev/null +++ b/client/src/util.ts @@ -0,0 +1,16 @@ +import { open } from "@tauri-apps/api/dialog"; + +export async function promptFolder( + setFolder: (path: string | null) => any, + defaultPath?: string | null +) { + const selected = (await open({ + multiple: false, + directory: true, + defaultPath: defaultPath ?? undefined, + })) as string | null; + + if (selected) { + setFolder(selected); + } +} diff --git a/client/tailwind.config.js b/client/tailwind.config.js new file mode 100644 index 0000000..b399ef5 --- /dev/null +++ b/client/tailwind.config.js @@ -0,0 +1,14 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + mode: 'jit', + + content: [ + "./index.html", + "./src/**/*.{js,ts,jsx,tsx}", + ], + theme: { + extend: {}, + }, + plugins: [], +} + diff --git a/client/tsconfig.json b/client/tsconfig.json new file mode 100644 index 0000000..3999958 --- /dev/null +++ b/client/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "preserve", + "jsxImportSource": "solid-js", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/client/tsconfig.node.json b/client/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/client/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/client/vite.config.ts b/client/vite.config.ts new file mode 100644 index 0000000..c8d4569 --- /dev/null +++ b/client/vite.config.ts @@ -0,0 +1,20 @@ +import { defineConfig } from "vite"; +import solidPlugin from "vite-plugin-solid"; + +// https://vitejs.dev/config/ +export default defineConfig(async () => ({ + plugins: [solidPlugin()], + + // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // + // 1. prevent vite from obscuring rust errors + clearScreen: false, + // 2. tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true, + }, + // 3. to make use of `TAURI_DEBUG` and other env variables + // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand + envPrefix: ["VITE_", "TAURI_"], +})); diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml new file mode 100644 index 0000000..bdf0d6b --- /dev/null +++ b/crates/common/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "common" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.71" +thiserror = "1.0.35" diff --git a/crates/common/src/byte_functions.rs b/crates/common/src/byte_functions.rs new file mode 100644 index 0000000..027d360 --- /dev/null +++ b/crates/common/src/byte_functions.rs @@ -0,0 +1,56 @@ +use anyhow::Result; + +pub trait HasByteFunctions: Sized + Eq + std::fmt::Debug { + fn from_be_bytes(bytes: &[u8]) -> Result; + fn from_le_bytes(bytes: &[u8]) -> Result; + fn insert_into_be(self, bytes: &mut [u8]); + fn insert_into_le(self, bytes: &mut [u8]); +} + +macro_rules! make_byte_functions { + ($byte_type:ty) => { + impl HasByteFunctions for $byte_type { + fn from_be_bytes(bytes: &[u8]) -> Result { + Ok(<$byte_type>::from_be_bytes(bytes.try_into()?)) + } + + fn from_le_bytes(bytes: &[u8]) -> Result { + Ok(<$byte_type>::from_le_bytes(bytes.try_into()?)) + } + + fn insert_into_be(self, bytes: &mut [u8]) { + bytes[..].copy_from_slice(&<$byte_type>::to_be_bytes(self)); + } + + fn insert_into_le(self, bytes: &mut [u8]) { + bytes[..].copy_from_slice(&<$byte_type>::to_le_bytes(self)); + } + } + }; +} + +make_byte_functions!(u16); +make_byte_functions!(u32); +make_byte_functions!(u64); + +make_byte_functions!(i16); +make_byte_functions!(i32); +make_byte_functions!(i64); + +impl HasByteFunctions for u8 { + fn from_be_bytes(bytes: &[u8]) -> Result { + Ok(bytes[0]) + } + + fn from_le_bytes(bytes: &[u8]) -> Result { + Ok(bytes[0]) + } + + fn insert_into_be(self, bytes: &mut [u8]) { + bytes[0] = self; + } + + fn insert_into_le(self, bytes: &mut [u8]) { + bytes[0] = self + } +} diff --git a/crates/common/src/byte_walker.rs b/crates/common/src/byte_walker.rs new file mode 100644 index 0000000..83a29b5 --- /dev/null +++ b/crates/common/src/byte_walker.rs @@ -0,0 +1,350 @@ +use std::{fmt::Display, str::from_utf8}; + +use anyhow::{anyhow, Result}; +use thiserror::Error; + +use crate::{byte_functions::HasByteFunctions, expect}; + +#[derive(Error, Debug)] +pub enum ByteWalkerError { + #[error("Trying to read buffer at index {requested_index:?}, but buffer is only {buffer_length:?} long.")] + OutOfRange { + buffer_length: usize, + requested_index: usize, + }, +} + +pub trait ByteWalker { + fn goto(&mut self, offset: u32) { + self.goto_usize(offset as usize); + } + + fn goto_usize(&mut self, offset: usize); + + #[inline] + fn goto_start(&mut self) { + self.goto(0) + } + + fn skip(&mut self, count: usize); + + fn offset(&self) -> usize; + + fn len(&self) -> usize; + + #[inline] + fn remaining(&self) -> usize { + self.len().saturating_sub(self.offset()) + } + + fn read_bytes_at(&mut self, offset: usize, amount: usize) -> Result<&[u8]>; + + fn read_bytes(&mut self, amount: usize) -> Result<&[u8]> { + self.read_bytes_at(self.offset(), amount) + } + + fn take_bytes(&mut self, amount: usize) -> Result<&[u8]>; + + #[inline] + fn step_while(&mut self, condition: impl Fn(u8) -> bool) -> Result<&[u8]> { + let start_offset = self.offset(); + let mut current_offset = start_offset; + while let Ok(byte) = self.read_at::(current_offset) { + if !condition(byte) { + break; + } + current_offset += 1; + } + self.take_bytes(current_offset - start_offset) + } + + #[inline] + fn step_until(&mut self, end_char: u8) -> Result<&[u8]> { + let start_offset = self.offset(); + let mut current_offset = start_offset; + while let Ok(byte) = self.read_at::(current_offset) { + if byte == end_char { + break; + } + current_offset += 1; + } + self.take_bytes(current_offset - start_offset) + } + + #[inline] + fn step_until_chars(&mut self, end_chars: [u8; N]) -> Result<&[u8]> { + let start_offset = self.offset(); + let mut current_offset = start_offset; + while let Ok(bytes) = self.read_bytes_at(current_offset, N) { + if bytes == end_chars { + break; + } + current_offset += 1; + } + self.take_bytes(current_offset - start_offset) + } + + #[inline] + fn step_until_escaped(&mut self, end_char: u8, escape_char: u8) -> Result<&[u8]> { + let start_offset = self.offset(); + let mut current_offset = start_offset; + while let Ok(byte) = self.read_at::(current_offset) { + if byte == escape_char { + current_offset += 1; + } else if byte == end_char { + break; + } + current_offset += 1; + } + self.take_bytes(current_offset - start_offset) + } + + // Read functions + fn read_be(&mut self) -> Result { + let bytes = self.read_bytes(std::mem::size_of::())?; + T::from_be_bytes(bytes) + } + + fn read_le(&mut self) -> Result { + let bytes = self.read_bytes(std::mem::size_of::())?; + T::from_le_bytes(bytes) + } + + fn read(&mut self) -> Result { + self.read_le::() + } + + fn read_be_at(&mut self, offset: usize) -> Result { + let bytes = self.read_bytes_at(offset, std::mem::size_of::())?; + T::from_be_bytes(bytes) + } + + fn read_le_at(&mut self, offset: usize) -> Result { + let bytes = self.read_bytes_at(offset, std::mem::size_of::())?; + T::from_le_bytes(bytes) + } + + fn read_at(&mut self, offset: usize) -> Result { + self.read_le_at::(offset) + } + + // Take functions + fn step_be(&mut self) -> Result { + let bytes = self.take_bytes(std::mem::size_of::())?; + T::from_be_bytes(bytes) + } + + fn step_le(&mut self) -> Result { + let bytes = self.take_bytes(std::mem::size_of::())?; + T::from_le_bytes(bytes) + } + + fn step(&mut self) -> Result { + self.step_le::() + } + + fn expect(&mut self, val: T) -> Result<()> { + let read_val = self.step_le::()?; + + let res = expect(val, read_val); + if let Err(err) = res { + return Err(anyhow!("At offset {}: {}", self.offset(), err)); + } + res + } + + fn expect_msg( + &mut self, + val: T, + message: impl AsRef, + ) -> Result<()> { + let read_val = self.step_le::()?; + + let res = expect(val, read_val); + if let Err(err) = res { + return Err(anyhow!("{}: {}", message.as_ref(), err)); + } + res + } + + fn expect_n_msg( + &mut self, + val: T, + amount: usize, + message: impl AsRef, + ) -> Result<()> { + for idx in 0..amount { + let read_val = self.step_le::()?; + + let res = expect(val, read_val); + if let Err(err) = res { + return Err(anyhow!("{} [index {}]: {}", message.as_ref(), idx, err)); + } + } + Ok(()) + } + + fn expect_utf8_str(&mut self, val: &str) -> Result<()> { + let read_val = from_utf8(self.take_bytes(val.len())?)?; + expect(val, read_val) + } +} + +pub struct BufferedByteWalker { + pub(crate) data: T, + pub(crate) offset: usize, +} + +impl BufferedByteWalker { + pub fn on(buffer: T) -> Self { + Self { + data: buffer, + offset: 0, + } + } + + pub fn goto(&mut self, offset: u32) { + self.offset = offset as usize; + } + + pub fn rewind(&mut self) { + self.offset = 0; + } +} + +impl ByteWalker for BufferedByteWalker +where + S: AsRef<[u8]>, +{ + fn goto_usize(&mut self, offset: usize) { + self.offset = offset; + } + + fn skip(&mut self, count: usize) { + self.offset += count; + } + + fn offset(&self) -> usize { + self.offset + } + + fn len(&self) -> usize { + self.data.as_ref().len() + } + + fn read_bytes_at(&mut self, offset: usize, amount: usize) -> Result<&[u8]> { + let end_offset = offset + amount; + if end_offset > self.data.as_ref().len() { + return Err(ByteWalkerError::OutOfRange { + buffer_length: self.data.as_ref().len(), + requested_index: end_offset, + } + .into()); + } + + Ok(&self.data.as_ref()[offset..end_offset]) + } + + fn take_bytes(&mut self, amount: usize) -> Result<&[u8]> { + self.skip(amount); + self.read_bytes_at(self.offset() - amount, amount) + } +} + +impl BufferedByteWalker +where + S: AsRef<[u8]>, +{ + pub fn as_slice(&self) -> &[u8] { + self.data.as_ref() + } +} + +impl BufferedByteWalker +where + S: AsMut<[u8]>, +{ + pub fn as_mut_slice(&mut self) -> &mut [u8] { + self.data.as_mut() + } +} + +#[cfg(test)] +mod tests { + use crate::writing_byte_walker::WritingByteWalker; + + use super::{BufferedByteWalker, ByteWalker}; + + #[test] + fn simple_walk() { + let data = vec![127, 0, 0, 1]; + let mut bytes = BufferedByteWalker::on(&data[..]); + + assert_eq!(bytes.step::().unwrap(), 127); + assert_eq!(bytes.step::().unwrap(), 0); + assert_eq!(bytes.step::().unwrap(), 0); + assert_eq!(bytes.step::().unwrap(), 1); + assert!(bytes.step::().is_err()); + + bytes.rewind(); + assert_eq!(bytes.step::().unwrap(), 16777343); + } + + #[test] + fn writing() { + let mut bytes = BufferedByteWalker::with_size(4); + + bytes.write(127u8); + bytes.write(0u8); + bytes.write(0u8); + bytes.write(1u8); + + assert_eq!(bytes.data.len(), 4); + assert_eq!(bytes.data[0], 127); + assert_eq!(bytes.data[1], 0); + assert_eq!(bytes.data[2], 0); + assert_eq!(bytes.data[3], 1); + } + + #[test] + fn expanding() { + let mut bytes = BufferedByteWalker::new(); + + bytes.write(127u8); + bytes.write(0u8); + bytes.write(0u8); + bytes.write(1u8); + + assert_eq!(bytes.data.len(), 4); + assert_eq!(bytes.data[0], 127); + assert_eq!(bytes.data[1], 0); + assert_eq!(bytes.data[2], 0); + assert_eq!(bytes.data[3], 1); + } + + #[test] + fn expanding_u32() { + let mut bytes = BufferedByteWalker::new(); + + bytes.write(16777343u32); + + assert_eq!(bytes.data.len(), 4); + assert_eq!(bytes.data[0], 127); + assert_eq!(bytes.data[1], 0); + assert_eq!(bytes.data[2], 0); + assert_eq!(bytes.data[3], 1); + } + + #[test] + fn expanding_bytes() { + let mut bytes = BufferedByteWalker::new(); + + bytes.write_bytes(&[127, 0, 0, 1]); + + assert_eq!(bytes.data.len(), 4); + assert_eq!(bytes.data[0], 127); + assert_eq!(bytes.data[1], 0); + assert_eq!(bytes.data[2], 0); + assert_eq!(bytes.data[3], 1); + } +} diff --git a/crates/common/src/checking_byte_walker.rs b/crates/common/src/checking_byte_walker.rs new file mode 100644 index 0000000..c75d2af --- /dev/null +++ b/crates/common/src/checking_byte_walker.rs @@ -0,0 +1,114 @@ +use std::cmp::min; + +use crate::{ + byte_functions::HasByteFunctions, byte_walker::ByteWalker, + writing_byte_walker::WritingByteWalker, +}; + +use anyhow::Result; + +pub struct CheckingByteWalker { + original: BW, +} + +impl CheckingByteWalker { + pub fn new(original: BW) -> Self { + Self { original } + } +} + +impl ByteWalker for CheckingByteWalker { + fn goto_usize(&mut self, offset: usize) { + self.original.goto_usize(offset); + } + + fn skip(&mut self, count: usize) { + self.original.skip(count); + } + + fn offset(&self) -> usize { + self.original.offset() + } + + fn len(&self) -> usize { + self.original.len() + } + + fn read_bytes_at(&mut self, offset: usize, amount: usize) -> Result<&[u8]> { + self.original.read_bytes_at(offset, amount) + } + + fn take_bytes(&mut self, amount: usize) -> Result<&[u8]> { + self.original.take_bytes(amount) + } +} + +impl WritingByteWalker for CheckingByteWalker { + fn write_bytes_at(&mut self, offset: usize, bytes: &[u8]) { + assert_eq!( + self.original.read_bytes_at(offset, bytes.len()).unwrap(), + bytes + ); + } + + fn write_bytes(&mut self, bytes: &[u8]) { + let original_bytes = self.original.take_bytes(bytes.len()).unwrap(); + if bytes.len() != original_bytes.len() || bytes != original_bytes { + let first_diff_idx = original_bytes + .iter() + .zip(bytes.iter()) + .enumerate() + .find_map(|(idx, (original_byte, encoded_byte))| { + if original_byte != encoded_byte { + Some(idx) + } else { + None + } + }); + + if first_diff_idx.is_none() { + panic!( + "Mismatched bytes lengths: {} vs {}", + original_bytes.len(), + bytes.len() + ); + } + let first_diff_idx = first_diff_idx.unwrap(); + + let context_start = first_diff_idx.saturating_sub(10); + let context_end = min(bytes.len(), min(original_bytes.len(), first_diff_idx + 10)); + + panic!( + "Mismatched bytes at index {}:\n{:02X?}\n{:02X?}", + first_diff_idx, + &original_bytes[context_start..context_end], + &bytes[context_start..context_end], + ); + } + } + + fn write_be(&mut self, value: T) { + assert_eq!(self.original.step_be::().unwrap(), value); + } + + fn write_le(&mut self, value: T) { + assert_eq!(self.original.step_le::().unwrap(), value); + } + + fn write_be_at(&mut self, offset: usize, value: T) { + assert_eq!(self.original.read_be_at::(offset).unwrap(), value); + } + + fn write_le_at(&mut self, offset: usize, value: T) { + assert_eq!(self.original.read_le_at::(offset).unwrap(), value); + } + + fn set_size(&mut self, _size: usize) {} + + fn into_vec(mut self) -> Vec { + self.original + .read_bytes_at(0, self.original.len()) + .unwrap() + .to_vec() + } +} diff --git a/crates/common/src/file_byte_walker.rs b/crates/common/src/file_byte_walker.rs new file mode 100644 index 0000000..922c312 --- /dev/null +++ b/crates/common/src/file_byte_walker.rs @@ -0,0 +1,94 @@ +use anyhow::Result; +use std::{ + cmp::min, + fs::File, + io::{Read, Seek, SeekFrom}, + path::PathBuf, +}; + +use crate::byte_walker::{ByteWalker, ByteWalkerError}; + +pub struct FileByteWalker { + file: File, + offset: usize, + temp_buffer: Vec, +} + +impl FileByteWalker { + pub fn new(file: File) -> Self { + Self { + file, + offset: 0, + temp_buffer: Vec::with_capacity(4), + } + } + + pub fn from_path(path: &PathBuf) -> Result { + Ok(Self { + file: File::open(path)?, + offset: 0, + temp_buffer: Vec::with_capacity(4), + }) + } +} + +impl ByteWalker for FileByteWalker { + fn goto_usize(&mut self, offset: usize) { + let _ = self.file.seek(SeekFrom::Start(offset as u64)); + self.offset = offset; + } + + fn skip(&mut self, count: usize) { + let _ = self.file.seek(SeekFrom::Current(count as i64)); + self.offset += count; + } + + fn offset(&self) -> usize { + self.offset + } + + fn len(&self) -> usize { + self.file + .metadata() + .map(|metadata| metadata.len()) + .unwrap_or_default() as usize + } + + fn read_bytes_at(&mut self, offset: usize, amount: usize) -> Result<&[u8]> { + let saved_offset = self.offset(); + self.goto_usize(offset); + + let len = self.len(); + if len <= offset { + return Err(ByteWalkerError::OutOfRange { + buffer_length: len, + requested_index: offset, + } + .into()); + } + let amount = min(len - offset, amount); + + if self.temp_buffer.len() < amount { + self.temp_buffer.resize(amount, 0); + } + self.file.read_exact(&mut self.temp_buffer[..amount])?; + + self.goto_usize(saved_offset); + + Ok(&self.temp_buffer[..amount]) + } + + fn take_bytes(&mut self, amount: usize) -> Result<&[u8]> { + let len = self.len(); + let amount = min(len - self.offset, amount); + + if self.temp_buffer.len() < amount { + self.temp_buffer.resize(amount, 0); + } + + self.file.read_exact(&mut self.temp_buffer[..amount])?; + self.offset += amount; + + Ok(&self.temp_buffer[..amount]) + } +} diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs new file mode 100644 index 0000000..34869cf --- /dev/null +++ b/crates/common/src/lib.rs @@ -0,0 +1,39 @@ +pub mod byte_functions; +pub mod byte_walker; +pub mod checking_byte_walker; +pub mod file_byte_walker; +pub mod vec_byte_walker; +pub mod writing_byte_walker; + +use std::{ffi::CStr, fmt::Display}; + +use anyhow::{anyhow, Result}; + +// unsafe: s must contain a null byte, and be valid utf-8 +pub unsafe fn str_from_null_terminated_utf8_unchecked(s: &[u8]) -> &str { + std::str::from_utf8_unchecked(CStr::from_ptr(s.as_ptr() as *const _).to_bytes()) +} + +pub fn expect(expected: T, gotten: T) -> Result<()> { + if expected != gotten { + return Err(anyhow!("Expected {}, found {}", expected, gotten)); + } + Ok(()) +} + +pub fn expect_msg(expected: T, gotten: T, message: impl AsRef) -> Result<()> { + if expected != gotten { + return Err(anyhow!( + "Expected {}, found {}: {}", + expected, + gotten, + message.as_ref() + )); + } + Ok(()) +} + +#[inline] +pub fn get_padding(len: usize) -> usize { + (4 - (len & 3)) & 3 +} diff --git a/crates/common/src/vec_byte_walker.rs b/crates/common/src/vec_byte_walker.rs new file mode 100644 index 0000000..01d107f --- /dev/null +++ b/crates/common/src/vec_byte_walker.rs @@ -0,0 +1,84 @@ +use crate::{ + byte_functions::HasByteFunctions, byte_walker::BufferedByteWalker, + writing_byte_walker::WritingByteWalker, +}; + +pub type VecByteWalker = BufferedByteWalker>; + +impl VecByteWalker { + pub fn new() -> Self { + Self { + data: vec![], + offset: 0, + } + } + + pub fn with_size(size: usize) -> Self { + Self { + data: vec![0; size], + offset: 0, + } + } +} + +impl WritingByteWalker for VecByteWalker { + fn write_bytes_at(&mut self, offset: usize, bytes: &[u8]) { + let end = offset + bytes.len(); + if end > self.data.len() { + self.data.resize(end, 0); + } + + self.data[offset..end].copy_from_slice(bytes); + } + + fn write_bytes(&mut self, bytes: &[u8]) { + self.write_bytes_at(self.offset, bytes); + self.offset += bytes.len(); + } + + fn write_be(&mut self, value: T) { + let end = self.offset + std::mem::size_of::(); + if end > self.data.len() { + self.data.resize(end, 0); + } + + value.insert_into_be(&mut self.data[self.offset..end]); + self.offset = end; + } + + fn write_le(&mut self, value: T) { + let end = self.offset + std::mem::size_of::(); + if end > self.data.len() { + self.data.resize(end, 0); + } + + value.insert_into_le(&mut self.data[self.offset..end]); + self.offset = end; + } + + fn write_be_at(&mut self, offset: usize, value: T) { + let end = offset + std::mem::size_of::(); + if end > self.data.len() { + self.data.resize(end, 0); + } + + value.insert_into_be(&mut self.data[offset..end]); + } + + fn write_le_at(&mut self, offset: usize, value: T) { + let end = offset + std::mem::size_of::(); + if end > self.data.len() { + self.data.resize(end, 0); + } + + value.insert_into_le(&mut self.data[offset..end]); + } + + fn set_size(&mut self, size: usize) { + self.data.resize(size, 0); + } + + fn into_vec(self) -> Vec { + self.data + } +} diff --git a/crates/common/src/writing_byte_walker.rs b/crates/common/src/writing_byte_walker.rs new file mode 100644 index 0000000..4c14ca4 --- /dev/null +++ b/crates/common/src/writing_byte_walker.rs @@ -0,0 +1,26 @@ +use crate::{byte_functions::HasByteFunctions, byte_walker::ByteWalker}; + +pub trait WritingByteWalker: ByteWalker { + fn write_bytes_at(&mut self, offset: usize, bytes: &[u8]); + fn write_bytes(&mut self, bytes: &[u8]); + + fn write_str(&mut self, str: &str) { + self.write_bytes(str.as_bytes()); + } + + fn write_be(&mut self, value: T); + fn write_le(&mut self, value: T); + fn write(&mut self, value: T) { + self.write_le::(value); + } + + fn write_be_at(&mut self, offset: usize, value: T); + fn write_le_at(&mut self, offset: usize, value: T); + fn write_at(&mut self, offset: usize, value: T) { + self.write_le_at::(offset, value); + } + + fn set_size(&mut self, size: usize); + + fn into_vec(self) -> Vec; +} diff --git a/crates/dats/Cargo.toml b/crates/dats/Cargo.toml new file mode 100644 index 0000000..c6e11a1 --- /dev/null +++ b/crates/dats/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "dats" +version = "0.1.0" +edition = "2021" + +[dependencies] +thiserror = "1.0.35" +common = { path = "../common" } +encoding = { path = "../encoding" } +anyhow = "1.0.71" +serde = { version = "1.0.162", features = ["derive"] } +serde_derive = "1.0.162" +regex = "1.9.1" +base64 = "0.21.3" +bitflags = "2.4.0" +num_enum = "0.7.0" + +[dev-dependencies] +serde_yaml = "0.9.25" diff --git a/crates/dats/resources/test/ability_names.DAT b/crates/dats/resources/test/ability_names.DAT new file mode 100644 index 0000000..c602083 Binary files /dev/null and b/crates/dats/resources/test/ability_names.DAT differ diff --git a/crates/dats/resources/test/armor2.DAT b/crates/dats/resources/test/armor2.DAT new file mode 100644 index 0000000..af6e402 Binary files /dev/null and b/crates/dats/resources/test/armor2.DAT differ diff --git a/crates/dats/resources/test/dialog_whitegate.DAT b/crates/dats/resources/test/dialog_whitegate.DAT new file mode 100644 index 0000000..c1de163 Binary files /dev/null and b/crates/dats/resources/test/dialog_whitegate.DAT differ diff --git a/crates/dats/resources/test/key_items.DAT b/crates/dats/resources/test/key_items.DAT new file mode 100644 index 0000000..6690add Binary files /dev/null and b/crates/dats/resources/test/key_items.DAT differ diff --git a/crates/dats/resources/test/pol_messages.DAT b/crates/dats/resources/test/pol_messages.DAT new file mode 100644 index 0000000..55eeff7 Binary files /dev/null and b/crates/dats/resources/test/pol_messages.DAT differ diff --git a/crates/dats/resources/test/status_infos.DAT b/crates/dats/resources/test/status_infos.DAT new file mode 100644 index 0000000..025b6d1 Binary files /dev/null and b/crates/dats/resources/test/status_infos.DAT differ diff --git a/crates/dats/resources/test/weapons.DAT b/crates/dats/resources/test/weapons.DAT new file mode 100644 index 0000000..b29ddf5 Binary files /dev/null and b/crates/dats/resources/test/weapons.DAT differ diff --git a/crates/dats/src/base.rs b/crates/dats/src/base.rs new file mode 100644 index 0000000..b000030 --- /dev/null +++ b/crates/dats/src/base.rs @@ -0,0 +1,172 @@ +use std::{collections::BTreeMap, fmt::Display, marker::PhantomData, ops::Deref, path::PathBuf}; + +use crate::{context::DatContext, dat_format::DatFormat}; +use anyhow::{anyhow, Result}; + +pub type ZoneId = u16; + +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct DatId(u32); + +impl From for DatId { + fn from(value: u32) -> Self { + DatId(value) + } +} + +impl DatId { + pub fn get_ffxi_dat_path(&self, dat_context: &DatContext) -> Result { + let dat_relative_path = self.get_relative_dat_path(dat_context)?; + + Ok(dat_context.ffxi_path.join(dat_relative_path)) + } + + pub fn get_relative_dat_path(&self, dat_context: &DatContext) -> Result { + let dat_path = dat_context + .id_map + .get(&self) + .ok_or(DatError::DatMappingNotFound(self.clone()))?; + + let dat_path_buf: PathBuf = [ + if dat_path.rom_id == 1 { + "ROM".to_string() + } else { + format!("ROM{}", dat_path.rom_id) + }, + dat_path.folder_id.to_string(), + format!("{}.DAT", dat_path.file_id), + ] + .into_iter() + .collect(); + + Ok(dat_path_buf) + } +} + +#[derive(Debug, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct Dat { + raw_id: DatId, + _pd: PhantomData T>, +} + +impl Clone for Dat { + fn clone(&self) -> Self { + Self { + raw_id: self.raw_id.clone(), + _pd: PhantomData, + } + } +} + +impl From for Dat { + fn from(value: DatId) -> Self { + Dat { + raw_id: value, + _pd: PhantomData, + } + } +} + +impl From for Dat { + fn from(value: u32) -> Self { + Dat { + raw_id: DatId(value), + _pd: PhantomData, + } + } +} + +impl From<&Dat> for DatId { + fn from(value: &Dat) -> Self { + value.raw_id + } +} + +impl From> for DatId { + fn from(value: Dat) -> Self { + value.raw_id + } +} + +impl Display for Dat { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.raw_id.0) + } +} + +impl Deref for Dat { + type Target = DatId; + + fn deref(&self) -> &Self::Target { + &self.raw_id + } +} + +#[derive(Debug)] +pub struct DatByZone { + pub map: BTreeMap>, +} + +impl Default for DatByZone { + fn default() -> Self { + Self { + map: Default::default(), + } + } +} + +impl DatByZone { + pub fn insert(&mut self, zone_id: usize, dat_id_value: usize) { + self.map + .insert(zone_id as ZoneId, (dat_id_value as u32).into()); + } + + pub fn get(&self, zone_id: &ZoneId) -> Option<&Dat> { + self.map.get(zone_id) + } + + pub fn get_result(&self, zone_id: &ZoneId) -> Result<&Dat> { + self.map + .get(zone_id) + .ok_or(anyhow!("Did not find DAT for zone with ID {}.", zone_id)) + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct DatPath { + pub rom_id: u8, + pub folder_id: u16, + pub file_id: u16, +} + +impl DatPath { + pub fn from_path(path: &PathBuf) -> Result { + let mut path_iter = path.iter().rev(); + + let file_part = path_iter.next().unwrap().to_str().unwrap(); + let folder_part = path_iter.next().unwrap().to_str().unwrap(); + let rom_part = path_iter.next().unwrap().to_str().unwrap(); + + Ok(Self { + rom_id: if rom_part == "ROM" { + 1 + } else { + rom_part[3..].parse()? + }, + folder_id: folder_part.parse()?, + file_id: file_part[..file_part.len() - 4].parse()?, + }) + } +} + +#[derive(Debug, thiserror::Error)] +pub enum DatError { + #[error("Could not find DAT for {0:?}")] + DatIdNotFound(DatId), + + #[error("Could not DAT location for {0:?}")] + DatMappingNotFound(DatId), + + #[error("Failed to load data for {0:?}: {1}")] + DatLoadFailed(DatId, anyhow::Error), +} diff --git a/crates/dats/src/context.rs b/crates/dats/src/context.rs new file mode 100644 index 0000000..55c8175 --- /dev/null +++ b/crates/dats/src/context.rs @@ -0,0 +1,208 @@ +use std::{ + collections::{HashMap, HashSet}, + fs::File, + io::{Read, Seek, SeekFrom}, + path::PathBuf, +}; + +use crate::{ + base::{Dat, DatError, DatId, DatPath, ZoneId}, + dat_format::DatFormat, + formats::dmsg2_string_table::Dmsg2Content, + id_mapping::DatIdMapping, + sanitize_filename::sanitize_filename, +}; +use anyhow::{anyhow, Result}; + +#[derive(Debug, Clone)] +pub struct DatContext { + pub ffxi_path: PathBuf, + pub id_map: HashMap, + + pub zone_name_to_id_map: HashMap, + pub zone_id_to_name: HashMap, +} + +#[derive(Debug, Clone)] +pub struct ZoneName { + pub display_name: String, + pub file_name: String, +} + +impl DatContext { + fn insert_into_id_map( + id_map: &mut HashMap, + rom_id: u8, + vtable_dat_path: PathBuf, + ftable_dat_path: PathBuf, + ) -> Result<()> { + let mut vtable_data = Vec::new(); + File::open(&vtable_dat_path) + .map_err(|_| { + anyhow!( + "Could not open necessary file: {}", + vtable_dat_path.to_string_lossy() + ) + })? + .read_to_end(&mut vtable_data)?; + + let mut ftable_dat = File::open(&ftable_dat_path).map_err(|_| { + anyhow!( + "Could not open necessary file: {}", + ftable_dat_path.to_string_lossy() + ) + })?; + + let mut dat_path_buf = [0u8; 2]; + + let _ = vtable_data + .into_iter() + .enumerate() + .filter_map(|(byte_idx, byte)| { + if byte == rom_id { + Some(byte_idx as u64) + } else { + None + } + }) + .filter_map(|byte_idx| { + ftable_dat.seek(SeekFrom::Start(byte_idx * 2u64)).ok()?; + ftable_dat.read_exact(&mut dat_path_buf).ok()?; + + let combined_id = u16::from_le_bytes(dat_path_buf); + id_map.insert( + DatId::from(byte_idx as u32), + DatPath { + rom_id, + folder_id: (combined_id >> 7) as u16, + file_id: (combined_id & 0x7F) as u16, + }, + ); + + Some(()) + }) + .collect::>(); + + Ok(()) + } + + pub fn from_path(mut ffxi_path: PathBuf) -> Result { + let mut id_map = HashMap::new(); + + match ffxi_path + .iter() + .last() + .and_then(|part| part.to_str()) + .ok_or(anyhow!("Invalid path"))? + { + "FINAL FANTASY XI" => { + // Correct folder + } + "SquareEnix" => { + ffxi_path.push("FINAL FANTASY XI"); + } + _ => { + ffxi_path.push("SquareEnix"); + ffxi_path.push("FINAL FANTASY XI"); + if !ffxi_path.exists() { + return Err(anyhow!("Could not find a FFXI install at the given path.")); + } + } + } + + // Handle first non-numbered tables + let vtable_dat_path = ffxi_path.join("VTABLE.DAT"); + let ftable_dat_path = ffxi_path.join("FTABLE.DAT"); + + Self::insert_into_id_map(&mut id_map, 1, vtable_dat_path, ftable_dat_path)?; + + for rom_id in 2u8.. { + let vtable_dat_path = ffxi_path.join(format!("ROM{}/VTABLE{}.DAT", rom_id, rom_id)); + let ftable_dat_path = ffxi_path.join(format!("ROM{}/FTABLE{}.DAT", rom_id, rom_id)); + if Self::insert_into_id_map(&mut id_map, rom_id, vtable_dat_path, ftable_dat_path) + .is_err() + { + break; + } + } + + let mut result = Self { + ffxi_path, + id_map, + zone_name_to_id_map: Default::default(), + zone_id_to_name: Default::default(), + }; + + let zone_data = result.get_data_from_dat(&DatIdMapping::get().area_names)?; + + let mut previous_names = HashSet::new(); + for (zone_id, (_, zone_string_list)) in zone_data.lists.into_iter().enumerate() { + let display_content = zone_string_list + .content + .first() + .ok_or_else(|| anyhow!("No string found for zone {}.", zone_id))? + .clone(); + + let mut display_name = match display_content { + Dmsg2Content::String { string } => string, + Dmsg2Content::Flags { .. } => { + return Err(anyhow!("Expected string content for zone name.")) + } + }; + + if display_name.is_empty() { + display_name = format!("_unnamed_ID-{}", zone_id); + } else if previous_names.contains(&display_name) { + display_name = format!("{} ID-{}", display_name, zone_id); + } + previous_names.insert(display_name.clone()); + + let zone_name = ZoneName { + file_name: sanitize_filename(&display_name), + display_name, + }; + + result + .zone_id_to_name + .insert(zone_id as u16, zone_name.clone()); + result + .zone_name_to_id_map + .insert(zone_name.file_name, zone_id as u16); + } + + Ok(result) + } + + pub fn get_data_from_dat_id(&self, id: DatId) -> Result { + T::from_path(&self.get_dat_path(id)?) + .map_err(|err| DatError::DatLoadFailed(id.clone(), err)) + } + + pub fn get_data_from_dat(&self, id: &Dat) -> Result { + T::from_path(&self.get_dat_path(id)?).map_err(|err| DatError::DatLoadFailed(id.into(), err)) + } + + pub fn check_dat(&self, id: &Dat) -> Result<(), DatError> { + T::check_path(&self.get_dat_path(id)?) + .map_err(|err| DatError::DatLoadFailed(id.into(), err)) + } + + pub fn get_data_from_dat_checked(&self, id: &Dat) -> Result { + T::from_path_checked(&self.get_dat_path(id)?) + .map_err(|err| DatError::DatLoadFailed(id.into(), err)) + } + + pub fn get_dat_path(&self, id: impl Into) -> Result { + id.into().get_ffxi_dat_path(self) + } + + pub fn get_dat_id(&self, dat_path: DatPath) -> Option { + self.id_map.iter().find_map(|entry| { + if entry.1 == &dat_path { + Some(entry.0.clone()) + } else { + None + } + }) + } +} diff --git a/crates/dats/src/dat_format.rs b/crates/dats/src/dat_format.rs new file mode 100644 index 0000000..cda9be8 --- /dev/null +++ b/crates/dats/src/dat_format.rs @@ -0,0 +1,107 @@ +use anyhow::{anyhow, Result}; +use common::{ + byte_walker::{BufferedByteWalker, ByteWalker}, + checking_byte_walker::CheckingByteWalker, + file_byte_walker::FileByteWalker, + vec_byte_walker::VecByteWalker, + writing_byte_walker::WritingByteWalker, +}; +use std::{ + cmp::min, + fs::{self}, + path::PathBuf, +}; + +pub trait DatFormat: Sized { + fn from(walker: &mut T) -> Result; + fn check_type(walker: &mut T) -> Result<()>; + fn write(&self, walker: &mut T) -> Result<()>; + fn to_bytes(&self) -> Result> { + let mut walker = VecByteWalker::new(); + self.write(&mut walker)?; + Ok(walker.into_vec()) + } + + fn from_bytes(bytes: &[u8]) -> Result { + let mut walker = BufferedByteWalker::on(bytes); + Self::from(&mut walker) + } + + fn from_path(path: &PathBuf) -> Result { + let mut walker = FileByteWalker::from_path(path)?; + Self::from(&mut walker) + } + + fn check_path(path: &PathBuf) -> Result<()> { + let mut walker = FileByteWalker::from_path(path)?; + Self::check_type(&mut walker) + } + + fn from_bytes_checked(bytes: &[u8]) -> Result { + let res = Self::from_bytes(bytes)?; + if res.to_bytes()? != bytes { + return Err(anyhow!("Failed round-trip test.")); + } + Ok(res) + } + + fn from_path_checked_during(path: &PathBuf) -> Result { + let original_walker = FileByteWalker::from_path(path)?; + let mut checking_walker = CheckingByteWalker::new(original_walker); + + let res = Self::from_path(path)?; + res.write(&mut checking_walker)?; + + if checking_walker.remaining() != 0 { + return Err(anyhow!( + "Missing {} bytes written.", + checking_walker.remaining() + )); + } + + Ok(res) + } + + fn from_path_checked(path: &PathBuf) -> Result { + let original_bytes = fs::read(path)?; + let res = Self::from_path(path)?; + let re_encoded_bytes = res.to_bytes()?; + if re_encoded_bytes.len() != original_bytes.len() || re_encoded_bytes != original_bytes { + let first_diff_idx = original_bytes + .iter() + .zip(re_encoded_bytes.iter()) + .enumerate() + .find_map(|(idx, (original_byte, encoded_byte))| { + if original_byte != encoded_byte { + Some(idx) + } else { + None + } + }); + + if first_diff_idx.is_none() { + return Err(anyhow!( + "Round-trip test failed because of non-matching lengths: {} vs {}", + original_bytes.len(), + re_encoded_bytes.len() + )); + } + let first_diff_idx = first_diff_idx.unwrap(); + + let context_start = first_diff_idx.saturating_sub(10); + let context_end = min( + re_encoded_bytes.len(), + min(original_bytes.len(), first_diff_idx + 10), + ); + + return Err(anyhow!( + "Failed round-trip test for '{}' at index {}:\n{:02X?}\n{:02X?}", + path.display(), + first_diff_idx, + &original_bytes[context_start..context_end], + &re_encoded_bytes[context_start..context_end], + )); + } + Ok(res) + } +} diff --git a/crates/dats/src/enums.rs b/crates/dats/src/enums.rs new file mode 100644 index 0000000..2a6b4a9 --- /dev/null +++ b/crates/dats/src/enums.rs @@ -0,0 +1,140 @@ +// Need this until rust-analyzer has fix for the issue: https://github.com/rust-lang/rust-analyzer/issues/15344 +#![allow(non_upper_case_globals)] + +use num_enum::{FromPrimitive, IntoPrimitive, TryFromPrimitive}; +use serde_derive::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromPrimitive, IntoPrimitive)] +#[repr(u8)] +pub enum SkillType { + #[default] + None = 0x00, + + HandToHand = 0x01, + Dagger = 0x02, + Sword = 0x03, + GreatSword = 0x04, + Axe = 0x05, + GreatAxe = 0x06, + Scythe = 0x07, + PoleArm = 0x08, + Katana = 0x09, + GreatKatana = 0x0a, + Club = 0x0b, + Staff = 0x0c, + AutomatonMelee = 0x16, + AutomatonRange = 0x17, + AutomatonMagic = 0x18, + Ranged = 0x19, + Marksmanship = 0x1a, + Thrown = 0x1b, + DivineMagic = 0x20, + HealingMagic = 0x21, + EnhancingMagic = 0x22, + EnfeeblingMagic = 0x23, + ElementalMagic = 0x24, + DarkMagic = 0x25, + SummoningMagic = 0x26, + Ninjutsu = 0x27, + Singing = 0x28, + StringInstrument = 0x29, + WindInstrument = 0x2a, + BlueMagic = 0x2b, + Geomancy = 0x2c, + Handbell = 0x2d, + Fishing = 0x30, + + Woodworking = 0x31, + Smithing = 0x32, + Goldsmithing = 0x33, + Clothcraft = 0x34, + Leathercraft = 0x35, + Bonecraft = 0x36, + Alchemy = 0x37, + Cooking = 0x38, + + Special = 0xff, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromPrimitive, IntoPrimitive)] +#[repr(u16)] +pub enum ItemType { + None = 0, + + Item = 1, + QuestItem = 2, + Fish = 3, + Weapon = 4, + Armor = 5, + Linkshell = 6, + UsableItem = 7, + Crystal = 8, + Currency = 9, + Furnishing = 10, + Plant = 11, + Flowerpot = 12, + PuppetItem = 13, + Mannequin = 14, + Book = 15, + RacingForm = 16, + BettingSlip = 17, + SoulPlate = 18, + Reflector = 19, + + LotteryTicket = 21, + MazeTabulaM = 22, + MazeTabulaR = 23, + MazeVoucher = 24, + MazeRune = 25, + + StorageSlip = 27, + + Instinct = 30, + + #[num_enum(catch_all)] + #[serde(untagged)] + Unknown(u16), +} + +impl Default for ItemType { + fn default() -> Self { + Self::None + } +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromPrimitive, IntoPrimitive)] +#[repr(u16)] +pub enum PuppetSlot { + #[default] + None = 0, + + Head = 1, + Body = 2, + Attachment = 3, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize, TryFromPrimitive, IntoPrimitive)] +#[repr(u16)] +pub enum Element { + Fire = 0x00, + Ice = 0x01, + Air = 0x02, + Earth = 0x03, + Thunder = 0x04, + Water = 0x05, + Light = 0x06, + Dark = 0x07, + Special = 0x0F, + Undecided = 0xFFFF, +} + +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TryFromPrimitive, IntoPrimitive, +)] +#[repr(u32)] +pub enum EnglishArticle { + A = 0, + An = 1, + PairOf = 2, + SuitsOf = 3, +} diff --git a/crates/dats/src/flags.rs b/crates/dats/src/flags.rs new file mode 100644 index 0000000..4e4297c --- /dev/null +++ b/crates/dats/src/flags.rs @@ -0,0 +1,145 @@ +use crate::serde_bitflags; +use bitflags::bitflags; + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct ValidTargets: u16 { + // Combined flags + const Corpse = 0x9D; // CorpseOnly + NPC + Ally + Partymember + Self + const Object = 0x60; + + // Base flags + const None = 0x00; + const SelfTarget = 0x01; + const Player = 0x02; + const PartyMember = 0x04; + const Ally = 0x08; + const NPC = 0x10; + const Enemy = 0x20; + const Unknown = 0x40; + const CorpseOnly = 0x80; + } +} +serde_bitflags!(ValidTargets); + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct ItemFlag: u16 { + // Combined Flags + const Ex = 0x6040; // NoAuction + NoDelivery + NoTrade + + // Simple Flags - mostly assumed meanings + const WallHanging = 0x0001; // Used by furnishing like paintings. + const Flag01 = 0x0002; + const MysteryBox = 0x0004; // Can be gained from Gobbie Mystery Box + const MogGarden = 0x0008; // Can use in Mog Garden + const CanSendPOL = 0x0010; + const Inscribable = 0x0020; + const NoAuction = 0x0040; + const Scroll = 0x0080; + const Linkshell = 0x0100; + const CanUse = 0x0200; + const CanTradeNPC = 0x0400; + const CanEquip = 0x0800; + const NoSale = 0x1000; + const NoDelivery = 0x2000; + const NoTradePC = 0x4000; + const Rare = 0x8000; + } +} +serde_bitflags!(ItemFlag); + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct EquipmentSlot: u16 { + // Combined + const Ears = 0x1800; + const Rings = 0x6000; + + // Base + const None = 0x0000; + const Main = 0x0001; + const Sub = 0x0002; + const Range = 0x0004; + const Ammo = 0x0008; + const Head = 0x0010; + const Body = 0x0020; + const Hands = 0x0040; + const Legs = 0x0080; + const Feet = 0x0100; + const Neck = 0x0200; + const Waist = 0x0400; + const LEar = 0x0800; + const REar = 0x1000; + const LRing = 0x2000; + const RRing = 0x4000; + const Back = 0x8000; + } +} +serde_bitflags!(EquipmentSlot); + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct Race: u16 { + const All = 0x01FE; + // Gender grouping + const AnyMale = 0x012A; + const AnyFemale = 0x00D4; + // Race grouping + const Hume = 0x0006; + const Elvaan = 0x0018; + const Tarutaru = 0x0060; + + // Base races + const HumeMale = 0x0002; + const HumeFemale = 0x0004; + const ElvaanMale = 0x0008; + const ElvaanFemale = 0x0010; + const TarutaruMale = 0x0020; + const TarutaruFemale = 0x0040; + const Mithra = 0x0080; + const Galka = 0x0100; + } +} +serde_bitflags!(Race); + +bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct Job: u32 { + const All = 0x007FFFFE; + + const WAR = 0x00000002; + const MNK = 0x00000004; + const WHM = 0x00000008; + const BLM = 0x00000010; + const RDM = 0x00000020; + const THF = 0x00000040; + const PLD = 0x00000080; + const DRK = 0x00000100; + const BST = 0x00000200; + const BRD = 0x00000400; + const RNG = 0x00000800; + const SAM = 0x00001000; + const NIN = 0x00002000; + const DRG = 0x00004000; + const SMN = 0x00008000; + const BLU = 0x00010000; + const COR = 0x00020000; + const PUP = 0x00040000; + const DNC = 0x00080000; + const SCH = 0x00100000; + const GEO = 0x00200000; + const RUN = 0x00400000; + const MON = 0x00800000; + + const JOB24 = 0x01000000; + const JOB25 = 0x02000000; + const JOB26 = 0x04000000; + const JOB27 = 0x08000000; + const JOB28 = 0x10000000; + const JOB29 = 0x20000000; + const JOB30 = 0x40000000; + const JOB31 = 0x80000000; + } +} +serde_bitflags!(Job); diff --git a/crates/dats/src/formats/dialog.rs b/crates/dats/src/formats/dialog.rs new file mode 100644 index 0000000..43743cc --- /dev/null +++ b/crates/dats/src/formats/dialog.rs @@ -0,0 +1,165 @@ +use std::collections::BTreeMap; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, get_padding, writing_byte_walker::WritingByteWalker}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)] +pub struct Dialog { + pub entries: BTreeMap, +} + +const DIALOG_MASK: u32 = 0x80808080; +const DIALOG_U8_MASK: u8 = 0x80; + +impl Dialog { + fn parse_dialog_string(walker: &mut T, end: u32) -> Result { + let bytes = walker + .take_bytes(end as usize - walker.offset())? + .into_iter() + .map(|byte| byte ^ DIALOG_U8_MASK) + .collect::>(); + + let string = Decoder::decode_dialog(&bytes)?; + + Ok(string) + } + + fn get_header_values(walker: &mut T) -> Result<(u32, u32)> { + let size_info = walker.step::()?; + + if size_info == 0 { + return Err(anyhow!("Possible empty dialog DAT.")); + } + + let file_size = (size_info ^ 0x10000000) + 4; + + if file_size != walker.len() as u32 { + return Err(anyhow!( + "Invalid file size {} with byte count {}.", + file_size, + walker.len() + )); + } + + let shifted_string_count = walker.step::()? ^ DIALOG_MASK; + if shifted_string_count % 4 != 0 + || shifted_string_count > walker.len() as u32 + || shifted_string_count < 8 + { + return Err(anyhow!( + "Invalid shifted string count {} with byte count {}.", + shifted_string_count, + walker.len() + )); + } + + Ok((file_size, shifted_string_count >> 2)) + } + + fn parse(walker: &mut T) -> Result { + let (file_size, string_count) = Self::get_header_values(walker)?; + + let mut string_ends = (0..string_count - 1) + .into_iter() + .map(|_| walker.step::().map(|end| (end ^ DIALOG_MASK) + 4)) + .collect::>>()?; + + string_ends.push(file_size); + + let result = Dialog { + entries: string_ends + .into_iter() + .enumerate() + .map(|(idx, end)| Ok((idx as u32, Self::parse_dialog_string(walker, end)?))) + .collect::>()?, + }; + + Ok(result) + } + + pub fn write(&self, walker: &mut T) -> Result<()> { + let encoded_strings = self + .entries + .iter() + .map(|(_, string)| Encoder::encode_dialog(string)) + .collect::>>()?; + + // Calculate size of the DAT + let string_lengths_header_end = 4 + encoded_strings.len() * 4; + let mut file_size: usize = string_lengths_header_end + + encoded_strings + .iter() + .map(|bytes| bytes.len()) + .sum::(); + + // Add padding + file_size += get_padding(file_size); + + walker.set_size(file_size); + + // Write header with file size and string endings + walker.write((file_size as u32 ^ 0x10000000) - 4); + walker.write(((encoded_strings.len() as u32) << 2) ^ DIALOG_MASK); + + // Write the ending index for each string except the last one. + let mut encoded_strings_iter = encoded_strings.iter(); + let mut current_ending = + string_lengths_header_end + encoded_strings_iter.next().unwrap().len() - 4; + + for encoded_string in encoded_strings_iter { + walker.write((current_ending as u32) ^ DIALOG_MASK); + current_ending += encoded_string.len(); + } + + // Write the strings + for mut encoded_string in encoded_strings { + encoded_string.iter_mut().for_each(|b| { + *b ^= DIALOG_U8_MASK; + }); + walker.write_bytes(&encoded_string); + } + + for _ in 0..walker.remaining() { + walker.write(DIALOG_U8_MASK); + } + + Ok(()) + } +} + +impl DatFormat for Dialog { + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } + + fn from(walker: &mut T) -> Result { + Dialog::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + Dialog::get_header_values(walker)?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + + use crate::{dat_format::DatFormat, formats::dialog::Dialog}; + + #[test] + pub fn whitegate() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/dialog_whitegate.DAT"); + + Dialog::check_path(&dat_path).unwrap(); + let res = Dialog::from_path_checked(&dat_path).unwrap(); + + assert_eq!(res.entries.get(&129).unwrap(), "You observe no changes."); + } +} diff --git a/crates/dats/src/formats/dmsg.rs b/crates/dats/src/formats/dmsg.rs new file mode 100644 index 0000000..67fa9f3 --- /dev/null +++ b/crates/dats/src/formats/dmsg.rs @@ -0,0 +1,204 @@ +use std::cmp::min; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, get_padding, writing_byte_walker::WritingByteWalker}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +#[derive(Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct DmsgStringList { + pub content: Vec, +} + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DmsgContent { + String { string: String }, + Number { number: u32 }, +} + +#[derive(Debug)] +pub struct DmsgStringListMetadata { + pub list_offset: u32, + pub list_length: u32, +} + +const LIST_STRING_PADDING: u32 = 28; + +impl DmsgStringList { + pub fn parse( + walker: &mut T, + flip_bytes: bool, + list_bytes: u32, + ) -> Result { + let mask_u32 = if flip_bytes { u32::MAX } else { 0 }; + let mask_u8 = if flip_bytes { u8::MAX } else { 0 }; + + let list_start_offset = walker.offset() as u32; + + let list_entry_count = walker.step::()? ^ mask_u32; + + let metas = (0..list_entry_count) + .into_iter() + .map(|_| { + let string_offset = walker.step::()? ^ mask_u32; + let string_flags = walker.step::()? ^ mask_u32; + if string_offset + LIST_STRING_PADDING + 4 > list_bytes { + return Err(anyhow!( + "Invalid offset ({}) or flags ({}) for list length {}.", + string_offset, + string_flags, + list_bytes + )); + } + + Ok((string_offset, string_flags)) + }) + .collect::>>()?; + + let mut list = DmsgStringList { + content: Vec::with_capacity(list_entry_count as usize), + }; + + // Read the actual strings + for (idx, (string_offset, content_flag)) in metas.into_iter().enumerate() { + // Validate we're at the expected string offset based on metadata + let current_string_offset = walker.offset() as u32 - list_start_offset; + + if string_offset != current_string_offset { + let bytes_inbetween = walker + .read_bytes_at( + (list_start_offset + min(string_offset, current_string_offset)) as usize, + (current_string_offset.abs_diff(string_offset)) as usize, + )? + .iter() + .map(|b| b ^ mask_u8) + .collect::>(); + + return Err(anyhow!( + "Invalid string offset for {}: {} vs {}\nBytes in-between: {:02X?}", + idx, + string_offset, + current_string_offset, + bytes_inbetween + )); + } + + if content_flag > 0 { + // Parse as number if flag indicates it. + let number = + u32::from_le_bytes(walker.take_bytes(4)?.try_into().unwrap()) ^ mask_u32; + + list.content.push(DmsgContent::Number { number }); + continue; + } + + // Seemingly just padding with a 1 at the start. + walker.expect_msg::(0x01 ^ mask_u8, "Indication of string start")?; + walker.expect_n_msg::( + mask_u8, + LIST_STRING_PADDING as usize - 1, + "Zero-padding before string", + )?; + + // Read the string ending at a 0x00 (flipped to 0xFF in MASK_U8) + let text_bytes: Vec = walker + .step_until(mask_u8)? + .into_iter() + .map(|byte| byte ^ mask_u8) + .collect(); + + let string = Decoder::decode_simple(&text_bytes)?; + walker.expect_msg::(mask_u8, "End of string")?; + + // Alignment padding + let padding = get_padding(text_bytes.len() + 1); + walker.expect_n_msg::(mask_u8, padding, "Alignment padding")?; + + list.content.push(DmsgContent::String { string }); + } + + let expected_end_offset = (list_start_offset + list_bytes) as usize; + if walker.offset() < expected_end_offset { + walker.goto(expected_end_offset as u32); + } else if walker.offset() > expected_end_offset { + return Err(anyhow!("Parsed past end of string list.")); + } + + Ok(list) + } + + pub fn write( + &self, + walker: &mut T, + flip_bytes: bool, + ) -> Result { + let mask_u32 = if flip_bytes { u32::MAX } else { 0 }; + let mask_u8 = if flip_bytes { u8::MAX } else { 0 }; + + let list_start_offset = walker.offset() as u32; + + // String count + walker.write(self.content.len() as u32 ^ mask_u32); + + let encoded_strings = self + .content + .iter() + .map(|entry| { + match entry { + DmsgContent::String { string } => { + let mut bytes = Encoder::encode_simple(&string)?; + bytes.push(0x00); // End of string + + // Add padding + let padding = get_padding(bytes.len()); + for _ in 0..padding { + bytes.push(0x00); + } + + // Flip the bytes + bytes.iter_mut().for_each(|byte| *byte ^= mask_u8); + + Ok((0u32, bytes)) + } + DmsgContent::Number { number } => { + Ok((1, (number ^ mask_u32).to_le_bytes().to_vec())) + } + } + }) + .collect::>>()?; + + // Write the string offsets and flags + let meta_bytes_len = self.content.len() as u32 * 8 + 4; + + let mut current_string_offset = meta_bytes_len; + for (flag, encoded_string) in &encoded_strings { + walker.write::(current_string_offset ^ mask_u32); + walker.write::(flag ^ mask_u32); + + current_string_offset += encoded_string.len() as u32; + if *flag == 0 { + current_string_offset += LIST_STRING_PADDING; + } + } + + // Write the strings + for (flag, encoded_string) in &encoded_strings { + if *flag == 0 { + // String prefix + walker.write(0x01 ^ mask_u8); + for _ in 0..LIST_STRING_PADDING - 1 { + walker.write(mask_u8); + } + } + + walker.write_bytes(&encoded_string); + } + + Ok(DmsgStringListMetadata { + list_offset: list_start_offset, + list_length: walker.offset() as u32 - list_start_offset, + }) + } +} diff --git a/crates/dats/src/formats/dmsg1_string_table.rs b/crates/dats/src/formats/dmsg1_string_table.rs new file mode 100644 index 0000000..5aec1a2 --- /dev/null +++ b/crates/dats/src/formats/dmsg1_string_table.rs @@ -0,0 +1,197 @@ +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, expect, writing_byte_walker::WritingByteWalker}; +use encoding::decoder::Decoder; + +use crate::dat_format::DatFormat; + +pub struct DmsgStringTable1 { + entries: Vec, +} + +pub struct DmsgStringTable1Entry { + unknown1: u32, + unknown2: u16, + unknown3: u32, + unknown4: u32, + unknown5: u32, + unknown6: u32, + unknown7: u32, + unknown8: u16, + unknown9: u16, + string: String, +} + +const HEADER_SIZE: u32 = 0x38; +const ENTRY_SIZE: u32 = 0x24; + +impl DmsgStringTable1Entry { + pub fn write( + &self, + walker: &mut T, + current_data_offset: &mut u32, + idx: u32, + ) { + walker.goto(HEADER_SIZE + ENTRY_SIZE * idx); + + walker.write(current_data_offset.clone()); + + walker.write(self.unknown1); + + let string_len = self.string.len() as u32; + walker.write(string_len); + + walker.write(self.unknown2); + walker.write(self.unknown3); + walker.write(self.unknown4); + walker.write(self.unknown5); + walker.write(self.unknown6); + walker.write(self.unknown7); + walker.write(self.unknown8); + walker.write(self.unknown9); + + walker.goto(*current_data_offset); + + walker.write_str(&self.string); + + *current_data_offset += string_len; + } +} + +fn parse_dmsg_string_table_entry( + walker: &mut T, + data_start: u32, + data_bytes: u32, + idx: u32, +) -> Result { + walker.goto(HEADER_SIZE + ENTRY_SIZE * idx); + + let data_offset: u32 = walker.step()?; + + let unknown1: u32 = walker.step()?; + + let string_len: i16 = walker.step()?; + + let unknown2: u16 = walker.step()?; + let unknown3: u32 = walker.step()?; + let unknown4: u32 = walker.step()?; + let unknown5: u32 = walker.step()?; + let unknown6: u32 = walker.step()?; + let unknown7: u32 = walker.step()?; + let unknown8: u16 = walker.step()?; + let unknown9: u16 = walker.step()?; + + if string_len < 0 || (data_offset + string_len as u32) > data_bytes { + return Err(anyhow!( + "Invalid offset ({data_offset}) or string length ({string_len}) to fit into {data_bytes} bytes.", + )); + } + + walker.goto(data_start + data_offset); + Ok(DmsgStringTable1Entry { + unknown1, + unknown2, + unknown3, + unknown4, + unknown5, + unknown6, + unknown7, + unknown8, + unknown9, + string: Decoder::decode_simple(walker.take_bytes(string_len as usize)?)?, + }) +} + +fn parse_dmsg_string_table(walker: &mut T) -> Result { + walker.expect_utf8_str("d_msg")?; + walker.expect_utf8_str("\0\0\0")?; + walker.expect(1u16)?; + walker.expect(0u32)?; + walker.expect(2u16)?; + walker.expect(3u32)?; + + let entry_count: u32 = walker.step()?; + walker.expect(1u32)?; + + let bytes_len = walker.len() as u32; + walker.expect(bytes_len)?; + + let header_bytes: u32 = walker.step()?; + expect(HEADER_SIZE, header_bytes)?; + + let entry_bytes: u32 = walker.step()?; + expect(36 * entry_count, entry_bytes)?; + + let data_bytes: u32 = walker.step()?; + expect(bytes_len, HEADER_SIZE + entry_bytes + data_bytes)?; + + walker.expect(0u32)?; + walker.expect(0u32)?; + walker.expect(0u32)?; + + let data_start = HEADER_SIZE + entry_bytes; + + let mut data = vec![]; + for idx in 0..entry_count { + match parse_dmsg_string_table_entry(walker, data_start, data_bytes, idx) { + Ok(block) => data.push(block), + Err(err) => { + return Err(anyhow!("Failed to parse block: {err}")); + } + } + } + + Ok(DmsgStringTable1 { entries: data }) +} + +impl DatFormat for DmsgStringTable1 { + fn write(&self, walker: &mut T) -> Result<()> { + walker.write_str("d_msg"); + walker.skip(3); + walker.write(1u16); + walker.write(0u32); + walker.write(2u16); + walker.write(3u32); + + walker.write(self.entries.len() as u32); + walker.write(1u32); + + let all_bytes_len_offset = walker.offset() as u32; + walker.skip(4); // Reserved for full bytes len + + walker.write(HEADER_SIZE); // Header len + + let entry_bytes_len = ENTRY_SIZE * self.entries.len() as u32; + walker.write(entry_bytes_len); + + let data_bytes_len_offset = walker.offset() as u32; + walker.skip(4); // Reserved for data bytes len + + walker.skip(4 * 3); + + // Write all entries + let data_start = HEADER_SIZE + entry_bytes_len; + let mut current_data_offset = data_start; + for (idx, entry) in self.entries.iter().enumerate() { + entry.write(walker, &mut current_data_offset, idx as u32); + } + + // Go back and write in length of data and full DAT + let data_bytes_len = current_data_offset - data_start; + walker.goto(data_bytes_len_offset); + walker.write(data_bytes_len); + + let bytes_len = HEADER_SIZE + entry_bytes_len + data_bytes_len; + walker.goto(all_bytes_len_offset); + walker.write(bytes_len); + + Ok(()) + } + + fn from(walker: &mut T) -> Result { + parse_dmsg_string_table(walker) + } + + fn check_type(_walker: &mut T) -> Result<()> { + Err(anyhow!("Not yet implemented")) + } +} diff --git a/crates/dats/src/formats/dmsg2_string_table.rs b/crates/dats/src/formats/dmsg2_string_table.rs new file mode 100644 index 0000000..9a1aeb8 --- /dev/null +++ b/crates/dats/src/formats/dmsg2_string_table.rs @@ -0,0 +1,388 @@ +use std::{cmp::min, collections::BTreeMap}; + +use anyhow::{anyhow, Result}; +use common::{ + byte_walker::ByteWalker, expect, get_padding, writing_byte_walker::WritingByteWalker, +}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +#[derive(Debug)] +struct Dmsg2StringTableHeaders { + metadata_bytes: u32, + string_entry_bytes: u32, + list_count: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct Dmsg2StringTable { + pub lists: BTreeMap, +} + +#[derive(Debug)] +struct Dmsg2StringListMetadata { + list_offset: u32, + list_length: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(transparent)] +pub struct Dmsg2StringList { + pub content: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum Dmsg2Content { + String { string: String }, + Flags { flags: Vec }, +} + +const HEADER_SIZE: u32 = 0x40; +const LIST_METADATA_SIZE: u32 = 0x08; +const LIST_STRING_PADDING: u32 = 28; + +const MASK_U32: u32 = u32::MAX; +const MASK_U8: u8 = u8::MAX; + +impl Dmsg2StringList { + fn parse( + walker: &mut T, + list_metadata: Dmsg2StringListMetadata, + ) -> Result { + let list_start_offset = walker.offset() as u32; + + let string_count: u32 = !walker.step()?; + + let string_metas = (0..string_count) + .into_iter() + .map(|_| { + let string_offset = walker.step::()? ^ MASK_U32; + let string_flags = walker.step::()? ^ MASK_U32; + if string_offset + LIST_STRING_PADDING + 4 > list_metadata.list_length { + return Err(anyhow!( + "Invalid offset ({}) or flags ({}) for list length {}.", + string_offset, + string_flags, + list_metadata.list_length + )); + } + + Ok((string_offset, string_flags)) + }) + .collect::>>()?; + + let mut table_entry = Dmsg2StringList { + content: Vec::with_capacity(string_count as usize), + }; + + // Read the actual strings + for (idx, (string_offset, string_flags)) in string_metas.into_iter().enumerate() { + // Validate we're at the expected string offset based on metadata + let current_string_offset = walker.offset() as u32 - list_start_offset; + + if string_flags > 0 { + // Parse as flags instead of string content. + let flags = walker + .take_bytes(string_flags as usize * 4)? + .chunks(4) + .map(|bytes| u32::from_le_bytes(bytes.try_into().unwrap()) ^ MASK_U32) + .collect::>(); + table_entry.content.push(Dmsg2Content::Flags { flags }); + continue; + } + + if string_offset != current_string_offset { + let bytes_inbetween = walker + .read_bytes_at( + (list_start_offset + min(string_offset, current_string_offset)) as usize, + (current_string_offset.abs_diff(string_offset)) as usize, + )? + .iter() + .map(|b| b ^ MASK_U8) + .collect::>(); + + return Err(anyhow!( + "Invalid string offset for {}: {} vs {}\nBytes in-between: {:02X?}", + idx, + string_offset, + current_string_offset, + bytes_inbetween + )); + } + + // Seemingly just padding with a 1 at the start. + walker.expect_msg::(0x01 ^ MASK_U8, "Indication of string start")?; + walker.expect_n_msg::( + MASK_U8, + LIST_STRING_PADDING as usize - 1, + "Zero-padding before string", + )?; + + // Read the string ending at a 0x00 (flipped to 0xFF in MASK_U8) + let text_bytes: Vec = walker + .step_until(MASK_U8)? + .into_iter() + .map(|byte| byte ^ MASK_U8) + .collect(); + + let string = Decoder::decode_simple(&text_bytes)?; + walker.expect_msg::(MASK_U8, "End of string")?; + + // Alignment padding + let padding = get_padding(text_bytes.len() + 1); + walker.expect_n_msg::(MASK_U8, padding, "Alignment padding")?; + + table_entry.content.push(Dmsg2Content::String { string }); + } + + Ok(table_entry) + } + + fn write(&self, walker: &mut T) -> Result { + let list_offset = walker.offset() as u32; + + // String count + walker.write(!self.content.len() as i32); + + let encoded_strings = self + .content + .iter() + .map(|entry| { + match entry { + Dmsg2Content::String { string } => { + let mut bytes = Encoder::encode_simple(&string)?; + bytes.push(0x00); // End of string + + // Add padding + let padding = get_padding(bytes.len()); + for _ in 0..padding { + bytes.push(0x00); + } + + // Flip the bytes + bytes.iter_mut().for_each(|byte| *byte ^= u8::MAX); + + Ok((0u32, bytes)) + } + Dmsg2Content::Flags { flags } => Ok(( + flags.len() as u32, + flags + .iter() + .map(|int| int.to_le_bytes()) + .flatten() + .collect(), + )), + } + }) + .collect::>>()?; + + // Write the string offsets and flags + let metadata_len = self.content.len() as u32 * 8 + 4; + + let mut current_string_offset = metadata_len; + for (flag, encoded_string) in &encoded_strings { + walker.write::(current_string_offset ^ MASK_U32); + walker.write::(flag ^ MASK_U32); + + current_string_offset += encoded_string.len() as u32 + LIST_STRING_PADDING; + } + + // Write the strings + for (_, encoded_string) in &encoded_strings { + // String prefix + walker.write(0x01 ^ MASK_U8); + for _ in 0..LIST_STRING_PADDING - 1 { + walker.write(MASK_U8); + } + + walker.write_bytes(&encoded_string); + } + + Ok(Dmsg2StringListMetadata { + list_offset, + list_length: walker.offset() as u32 - list_offset, + }) + } +} + +impl Dmsg2StringTable { + fn parse_headers(walker: &mut T) -> Result { + walker.expect_utf8_str("d_msg")?; + walker.expect_utf8_str("\0\0\0")?; + walker.expect(1u16)?; + walker.expect(1u16)?; + walker.expect(3u32)?; + walker.expect(3u32)?; + + let file_bytes = walker.len() as u32; + walker.expect(file_bytes)?; + + let header_bytes: u32 = walker.step()?; + expect(HEADER_SIZE, header_bytes)?; + + let metadata_bytes: u32 = walker.step()?; + + walker.expect(0u32)?; + + let string_entry_bytes: u32 = walker.step()?; + expect( + file_bytes, + HEADER_SIZE + metadata_bytes + string_entry_bytes, + )?; + + let list_count: u32 = walker.step()?; + + walker.expect(1u32)?; + walker.expect(0u64)?; + walker.expect(0u64)?; + + Ok(Dmsg2StringTableHeaders { + metadata_bytes, + string_entry_bytes, + list_count, + }) + } + + fn parse_list_metadata( + walker: &mut T, + headers: &Dmsg2StringTableHeaders, + ) -> Result> { + let mut list_metadata = Vec::with_capacity(headers.list_count as usize); + + for idx in 0..headers.list_count { + let list_offset: i32 = !walker.step()?; + let list_length: i32 = !walker.step()?; + if list_length < 0 + || list_offset < 0 + || (list_offset + list_length) as u32 > headers.string_entry_bytes + { + return Err(anyhow!( + "Invalid length ({list_length}) and/or offset ({list_offset}) for block {idx}." + )); + } + let list_offset = list_offset as u32; + let list_length = list_length as u32; + + list_metadata.push(Dmsg2StringListMetadata { + list_offset, + list_length, + }) + } + + Ok(list_metadata) + } + + pub fn parse(walker: &mut T) -> Result { + let headers: Dmsg2StringTableHeaders = Self::parse_headers(walker)?; + let list_metadata = Self::parse_list_metadata(walker, &headers)?; + + let start_of_entries = walker.offset() as u32; + if start_of_entries - HEADER_SIZE != headers.metadata_bytes { + return Err(anyhow!( + "Metadata bytes didn't match: {} vs {}", + start_of_entries - HEADER_SIZE, + headers.metadata_bytes + )); + } + + let entries = list_metadata + .into_iter() + .enumerate() + .map(|(idx, list_metadata)| { + if walker.offset() as u32 - start_of_entries != list_metadata.list_offset { + return Err(anyhow!( + "Current offset for {idx} didn't match offset from list metadata." + )); + } + + match Dmsg2StringList::parse(walker, list_metadata) { + Ok(block) => Ok((idx as u32, block)), + Err(err) => Err(anyhow!("Failed to parse string list {idx}: {err}")), + } + }) + .collect::>>()?; + + if walker.remaining() != 0 { + return Err(anyhow!( + "Remaining bytes not parsed: {:02X?}", + walker.read_bytes(walker.remaining())? + )); + } + + Ok(Dmsg2StringTable { lists: entries }) + } + + fn write(&self, walker: &mut T) -> Result<()> { + let entry_count = self.lists.len() as u32; + let metadata_bytes = entry_count * LIST_METADATA_SIZE; + let start_of_strings = HEADER_SIZE + metadata_bytes; + + // Skip headers and metadata to write strings first, such that the necessary lengths + // can be gathered about the strings first. + walker.goto(start_of_strings); + + let list_metadatas = self + .lists + .iter() + .map(|(_, list)| list.write(walker)) + .collect::>>()?; + + let string_entry_bytes = walker.offset() as u32 - start_of_strings; + + // Go back and write in headers and metadata + walker.goto(0); + + walker.write_str("d_msg"); + walker.skip(3); + walker.write(1u16); + walker.write(1u16); + walker.write(3u32); + walker.write(3u32); + + // File len + walker.write(HEADER_SIZE + metadata_bytes + string_entry_bytes); + + // Header len + walker.write(HEADER_SIZE); + + // Metadata len + walker.write(metadata_bytes); + walker.write(0u32); + + // String entries len + walker.write(string_entry_bytes); + + // Amount of list entries + walker.write(entry_count); + + walker.write(1u32); + walker.write(0u64); + walker.write(0u64); + + // Write list metadata + for list_metadata in list_metadatas { + walker.write::(!(list_metadata.list_offset - metadata_bytes - HEADER_SIZE)); + walker.write::(!list_metadata.list_length); + } + + Ok(()) + } +} + +impl DatFormat for Dmsg2StringTable { + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } + + fn from(walker: &mut T) -> Result { + Dmsg2StringTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + Dmsg2StringTable::parse_headers(walker)?; + Ok(()) + } +} diff --git a/crates/dats/src/formats/dmsg3_string_table.rs b/crates/dats/src/formats/dmsg3_string_table.rs new file mode 100644 index 0000000..df482a9 --- /dev/null +++ b/crates/dats/src/formats/dmsg3_string_table.rs @@ -0,0 +1,238 @@ +use std::collections::BTreeMap; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, expect, writing_byte_walker::WritingByteWalker}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +use super::dmsg::DmsgStringList; + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct Dmsg3StringTable { + pub bytes_per_entry: u32, + pub flip_bytes: bool, + pub lists: BTreeMap, +} + +#[derive(Debug)] +struct Dmsg3StringTableHeaders { + bytes_per_entry: u32, + flip_bytes: bool, + entry_count: u32, +} + +const HEADER_SIZE: u32 = 0x40; + +impl Dmsg3StringTable { + fn parse_headers(walker: &mut T) -> Result { + walker.expect_utf8_str("d_msg")?; + walker.expect_utf8_str("\0\0\0")?; + + let flag1 = walker.step::()?; + if flag1 != 1 { + return Err(anyhow!("Unexpected first flag: {flag1}")); + } + + let flag2 = walker.step::()?; + if flag2 != 0 && flag2 != 1 { + return Err(anyhow!("Unexpected second flag: {flag2}")); + } + let flip_bytes = flag2 == 1; + + walker.expect(3u32)?; + walker.expect(3u32)?; + + let file_bytes = walker.len() as u32; + walker.expect(file_bytes)?; + + let header_bytes: u32 = walker.step()?; + expect(HEADER_SIZE, header_bytes)?; + + walker.expect(0u32)?; + + let bytes_per_entry: u32 = walker.step()?; + + let data_bytes: u32 = walker.step()?; + + let entry_count: u32 = walker.step()?; + expect(file_bytes, HEADER_SIZE + data_bytes)?; + expect(data_bytes, entry_count * bytes_per_entry)?; + + walker.expect(1u32)?; + walker.expect(0u64)?; + walker.expect(0u64)?; + + Ok(Dmsg3StringTableHeaders { + bytes_per_entry, + flip_bytes, + entry_count, + }) + } + + pub fn parse(walker: &mut T) -> Result { + let headers: Dmsg3StringTableHeaders = Self::parse_headers(walker)?; + + let mut lists = BTreeMap::default(); + for idx in 0..headers.entry_count { + lists.insert( + idx, + DmsgStringList::parse(walker, headers.flip_bytes, headers.bytes_per_entry)?, + ); + } + + Ok(Dmsg3StringTable { + bytes_per_entry: headers.bytes_per_entry, + flip_bytes: headers.flip_bytes, + lists, + }) + } + + fn write(&self, walker: &mut T) -> Result<()> { + let entry_count = self.lists.len() as u32; + let data_size = entry_count * self.bytes_per_entry; + + // Go back and write in headers and metadata + walker.goto(0); + + walker.write_str("d_msg"); + walker.skip(3); + + walker.write(1u16); + walker.write(if self.flip_bytes { 1u16 } else { 0u16 }); + + walker.write(3u32); + walker.write(3u32); + + // File len + walker.write::(HEADER_SIZE + data_size); + + // Header len + walker.write::(HEADER_SIZE); + + walker.write::(0x00); + + // Bytes per entry + walker.write::(self.bytes_per_entry); + + // Data entries + walker.write::(data_size); + + // Amount of list entries + walker.write::(entry_count); + + walker.write(1u32); + walker.write(0u64); + walker.write(0u64); + + let mut next_end = walker.offset() + self.bytes_per_entry as usize; + for idx in 0..entry_count { + let Some(list) = self.lists.get(&idx) else { + walker.skip(self.bytes_per_entry as usize); + continue; + }; + + list.write(walker, self.flip_bytes)?; + + if next_end < walker.offset() { + let diff = self.bytes_per_entry as usize + walker.offset() - next_end; + return Err(anyhow!( + "Entry {}, can't fit with given bytes per entry ({} vs {}):\n{:#?}", + idx, + self.bytes_per_entry, + diff, + list + )); + } + let diff = next_end.saturating_sub(walker.offset()); + walker.write_bytes(&vec![if self.flip_bytes { u8::MAX } else { 0u8 }; diff]); + next_end += self.bytes_per_entry as usize; + } + + Ok(()) + } +} + +impl DatFormat for Dmsg3StringTable { + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } + + fn from(walker: &mut T) -> Result { + Dmsg3StringTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + Dmsg3StringTable::parse_headers(walker)?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + + use crate::{dat_format::DatFormat, formats::dmsg::DmsgContent}; + + use super::Dmsg3StringTable; + + #[test] + pub fn ability_names() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/ability_names.DAT"); + + Dmsg3StringTable::check_path(&dat_path).unwrap(); + let res = Dmsg3StringTable::from_path_checked(&dat_path).unwrap(); + + assert_eq!( + res.lists.get(&1).unwrap().content[0], + DmsgContent::String { + string: "Combo".to_string() + } + ); + + assert_eq!( + res.lists.get(&2).unwrap().content[0], + DmsgContent::String { + string: "Shoulder Tackle".to_string() + } + ); + } + + #[test] + pub fn key_items() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/key_items.DAT"); + + Dmsg3StringTable::check_path(&dat_path).unwrap(); + let res = Dmsg3StringTable::from_path_checked_during(&dat_path).unwrap(); + + assert_eq!( + res.lists.get(&1).unwrap().content[0], + DmsgContent::Number { number: 1 } + ); + assert_eq!( + res.lists.get(&1).unwrap().content[4], + DmsgContent::String { + string: "Zeruhn report".to_string() + } + ); + + assert_eq!( + res.lists.get(&1534).unwrap().content[0], + DmsgContent::Number { number: 619 } + ); + assert_eq!( + res.lists.get(&1534).unwrap().content[4], + DmsgContent::String { + string: "All-You-Can-Ride Pass".to_string() + } + ); + assert_eq!( + res.lists.get(&1534).unwrap().content[6], + DmsgContent::String { + string: "\nFor GM use only!".to_string() + } + ); + } +} diff --git a/crates/dats/src/formats/entity_names.rs b/crates/dats/src/formats/entity_names.rs new file mode 100644 index 0000000..ea24225 --- /dev/null +++ b/crates/dats/src/formats/entity_names.rs @@ -0,0 +1,108 @@ +use std::{ + fs::File, + io::{Read, Seek, SeekFrom}, + path::PathBuf, +}; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, writing_byte_walker::WritingByteWalker}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +pub struct EntityNames { + pub names: Vec, +} + +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +pub struct EntityName { + id: u32, + name: String, +} + +pub fn get_entity_names_zone(path: &PathBuf) -> Option { + let mut file = File::open(path).ok()?; + + let mut four_bytes = [0u8; 4]; + file.read_exact(&mut four_bytes).ok()?; + + let starts_with_none = four_bytes == "none".as_bytes(); + if !starts_with_none { + return None; + } + + let mut first_id = 0; + let mut current_id_pos = 0; + while first_id == 0 { + current_id_pos += 1; + file.seek(SeekFrom::Start(0x1C + current_id_pos * 0x20)) + .ok()?; + file.read_exact(&mut four_bytes).ok()?; + + first_id = u32::from_le_bytes(four_bytes); + } + + Some(((first_id >> 12) & 0xFFF) as u16) +} + +impl EntityNames { + pub fn parse(walker: &mut T) -> Result { + walker.expect_utf8_str("none")?; + + Ok(EntityNames { + names: EntityNames::read_names(walker)?, + }) + } + + fn read_names(walker: &mut T) -> Result> { + walker.goto(32); + + let mut names = vec![]; + while walker.remaining() >= 32 { + names.push(parse_next_entity_name(walker)?); + } + + Ok(names) + } +} + +fn parse_next_entity_name(walker: &mut T) -> Result { + let name = Decoder::decode_simple(walker.take_bytes(28)?)?; + let id: u32 = walker.step()?; + + Ok(EntityName { id, name }) +} + +impl DatFormat for EntityNames { + fn write(&self, walker: &mut T) -> Result<()> { + walker.write_bytes("none".as_bytes()); + walker.goto(32); + + for name in self.names.iter() { + let name_bytes = Encoder::encode_simple(&name.name)?; + if name_bytes.len() > 28 { + return Err(anyhow!( + "Name can at most be 28 bytes long: '{}'", + name.name + )); + } + + walker.write_bytes(&name_bytes); + walker.skip(28 - name_bytes.len()); + walker.write(name.id); + } + + Ok(()) + } + + fn from(walker: &mut T) -> Result { + EntityNames::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + walker.expect_utf8_str("none")?; + Ok(()) + } +} diff --git a/crates/dats/src/formats/item_info.rs b/crates/dats/src/formats/item_info.rs new file mode 100644 index 0000000..7cd8de2 --- /dev/null +++ b/crates/dats/src/formats/item_info.rs @@ -0,0 +1,712 @@ +use anyhow::{anyhow, Ok, Result}; +use common::{ + byte_walker::{BufferedByteWalker, ByteWalker}, + get_padding, + vec_byte_walker::VecByteWalker, + writing_byte_walker::WritingByteWalker, +}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::{ + dat_format::DatFormat, + enums::{Element, EnglishArticle, ItemType, PuppetSlot, SkillType}, + flags::{EquipmentSlot, ItemFlag, Job, Race, ValidTargets}, + serde_base64, + utils::{get_nibble, rotate_all}, +}; + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct ItemInfo { + id: u32, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + strings: Option, + + flags: ItemFlag, + stack_size: u16, + item_type: ItemType, + resource_id: u16, + valid_targets: ValidTargets, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + equipment: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + weapon: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + puppet: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + instinct: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + furnishing: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + usable_item: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + currency: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + slip: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + monipulator: Option, + + #[serde(with = "serde_base64")] + icon_bytes: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum ItemStrings { + #[serde(untagged)] + Name { name: String }, + + #[serde(untagged)] + English { + name: String, + article_type: EnglishArticle, + singular_name: String, + plural_name: String, + description: String, + }, +} + +#[derive(Debug, Clone)] +pub enum ItemStringContent { + Number(u32), + StringBytes(Vec), +} + +impl ItemStringContent { + pub fn from_string(str: &String) -> Result { + let mut string_walker = VecByteWalker::with_size(28); + + // Start of string and initial padding + string_walker.write::(1); + for _ in 0..6 { + string_walker.write::(0); + } + + string_walker.write_bytes(&Encoder::encode_simple(str)?); + string_walker.write::(0); // End of string + + // Alignment padding + let padding = get_padding(string_walker.offset()); + for _ in 0..padding { + string_walker.write::(0); + } + Ok(ItemStringContent::StringBytes(string_walker.into_vec())) + } + + pub fn from_article(article: impl Into) -> Self { + ItemStringContent::Number(article.into()) + } +} + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum ItemCategory { + Unknown, + Currency, + Item, + Armor, + Weapon, + PuppetItem, + UsableItem, + Slip, + Instinct, + Monipulator, +} + +impl ItemCategory { + pub fn from_id(id: u32) -> Self { + match id { + 0xFFFF => ItemCategory::Currency, + 0..=0xFFF => ItemCategory::Item, + 0x1000..=0x1FFF => ItemCategory::UsableItem, + 0x2000..=0x21FF => ItemCategory::PuppetItem, + 0x2200..=0x27FF => ItemCategory::Item, + 0x2800..=0x3FFF => ItemCategory::Armor, + 0x4000..=0x59FF => ItemCategory::Weapon, + 0x5A00..=0x6FFF => ItemCategory::Armor, + 0x7000..=0x73FF => ItemCategory::Slip, + 0x7400..=0x77FF => ItemCategory::Instinct, + 0x7800..=0xF1FF => ItemCategory::Monipulator, + 0xF200.. => ItemCategory::Item, + } + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct EquipmentData { + level: u16, + slots: EquipmentSlot, + races: Race, + jobs: Job, + superior_level: u16, + shield_size: u16, + + max_charges: u8, + casting_time: u8, + use_delay: u16, + reuse_delay: u32, + unknown1: u16, + ilevel: u8, + unknown2: u8, + unknown3: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct WeaponData { + damage: u16, + delay: u16, + dps: u16, + skill_type: SkillType, + jug_size: u8, + unknown1: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct PuppetItemData { + slot: PuppetSlot, + element_charge: ElementValues, + unknown1: u32, +} + +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +pub struct ElementValues { + fire: u8, + ice: u8, + wind: u8, + earth: u8, + lightning: u8, + water: u8, + light: u8, + dark: u8, +} + +impl From for ElementValues { + fn from(value: u32) -> Self { + ElementValues { + fire: get_nibble(value, 0), + ice: get_nibble(value, 1), + wind: get_nibble(value, 2), + earth: get_nibble(value, 3), + lightning: get_nibble(value, 4), + water: get_nibble(value, 5), + light: get_nibble(value, 6), + dark: get_nibble(value, 7), + } + } +} + +impl From for u32 { + fn from(value: ElementValues) -> Self { + value.fire as u32 + + ((value.ice as u32) << (4 * 1)) + + ((value.wind as u32) << (4 * 2)) + + ((value.earth as u32) << (4 * 3)) + + ((value.lightning as u32) << (4 * 4)) + + ((value.water as u32) << (4 * 5)) + + ((value.light as u32) << (4 * 6)) + + ((value.dark as u32) << (4 * 7)) + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct InstinctData { + unknown1: u32, + unknown2: u32, + unknown3: u16, + instinct_cost: u16, + unknown4: u16, + unknown5: u32, + unknown6: u32, + unknown7: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct FurnishingData { + element: Element, + storage_slots: u32, + unknown3: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct UsableItemData { + activation_time: u16, + unknown1: u32, + unknown2: u32, + unknown3: u32, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct CurrencyData { + unknown1: u16, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct SlipData { + unknown1: u16, + unknowns: [u32; 17], +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct MonipulatorData { + unknown1: u16, + unknowns: [u32; 24], +} + +impl ItemInfo { + pub fn parse(walker: &mut T) -> Result { + let mut item_bytes = walker.take_bytes(0xC00)?.to_vec(); + rotate_all(&mut item_bytes, 5); + + // Parse the icon + let mut icon_walker = BufferedByteWalker::on(&item_bytes[0x280..]); + let icon_size = icon_walker.step::()?; + let icon_bytes = icon_walker.take_bytes(icon_size as usize)?.to_vec(); + + icon_walker.expect_n_msg::(0, icon_walker.remaining() - 1, "Padding after icon")?; + icon_walker.expect_msg::(0xFF, "End of icon bytes")?; + + // Parse the data + let mut data_walker: BufferedByteWalker<&[u8]> = + BufferedByteWalker::on(&item_bytes[..0x280]); + + let mut item_info = ItemInfo { + icon_bytes, + ..Default::default() + }; + + item_info.id = data_walker.step::()?; + let item_category = ItemCategory::from_id(item_info.id); + + // TODO: Monipulators seems to have a totally different structure than other items, + // since the values it gets for the following are non-sensical. + + item_info.flags = ItemFlag::from_bits(data_walker.step::()?).unwrap_or_default(); + item_info.stack_size = data_walker.step::()?; + item_info.item_type = ItemType::from(data_walker.step::()?); + item_info.resource_id = data_walker.step::()?; + item_info.valid_targets = + ValidTargets::from_bits(data_walker.step::()?).unwrap_or_default(); + + if item_category == ItemCategory::Armor || item_category == ItemCategory::Weapon { + let level = data_walker.step::()?; + let slots = EquipmentSlot::from_bits(data_walker.step::()?).unwrap_or_default(); + let races = Race::from_bits(data_walker.step::()?).unwrap_or_default(); + let jobs = Job::from_bits(data_walker.step::()?).unwrap_or_default(); + let superior_level = data_walker.step::()?; + let shield_size = data_walker.step::()?; + + if item_category == ItemCategory::Weapon { + item_info.weapon = Some(WeaponData { + damage: data_walker.step::()?, + delay: data_walker.step::()?, + dps: data_walker.step::()?, + skill_type: SkillType::try_from(data_walker.step::()?)?, + jug_size: data_walker.step::()?, + unknown1: data_walker.step::()?, + }); + } + + let max_charges = data_walker.step::()?; + let casting_time = data_walker.step::()?; + let use_delay = data_walker.step::()?; + let reuse_delay = data_walker.step::()?; + let unknown1 = data_walker.step::()?; + let ilevel = data_walker.step::()?; + let unknown2 = data_walker.step::()?; + let unknown3 = data_walker.step::()?; + + item_info.equipment = Some(EquipmentData { + level, + slots, + races, + jobs, + superior_level, + shield_size, + max_charges, + casting_time, + use_delay, + reuse_delay, + unknown1, + ilevel, + unknown2, + unknown3, + }); + } else if item_category == ItemCategory::PuppetItem { + item_info.puppet = Some(PuppetItemData { + slot: PuppetSlot::try_from(data_walker.step::()?)?, + element_charge: ElementValues::from(data_walker.step::()?), + unknown1: data_walker.step::()?, + }); + } else if item_category == ItemCategory::Instinct { + item_info.instinct = Some(InstinctData { + unknown1: data_walker.step::()?, + unknown2: data_walker.step::()?, + unknown3: data_walker.step::()?, + instinct_cost: data_walker.step::()?, + unknown4: data_walker.step::()?, + unknown5: data_walker.step::()?, + unknown6: data_walker.step::()?, + unknown7: data_walker.step::()?, + }); + } else if item_category == ItemCategory::Item { + item_info.furnishing = Some(FurnishingData { + element: Element::try_from(data_walker.step::()?)?, + storage_slots: data_walker.step::()?, + unknown3: data_walker.step::()?, + }); + } else if item_category == ItemCategory::UsableItem { + item_info.usable_item = Some(UsableItemData { + activation_time: data_walker.step::()?, + unknown1: data_walker.step::()?, + unknown2: data_walker.step::()?, + unknown3: data_walker.step::()?, + }); + } else if item_category == ItemCategory::Currency { + item_info.currency = Some(CurrencyData { + unknown1: data_walker.step::()?, + }); + } else if item_category == ItemCategory::Slip { + item_info.slip = Some(SlipData { + unknown1: data_walker.step::()?, + unknowns: core::array::from_fn(|_| data_walker.step::().unwrap_or_default()), + }); + } else if item_category == ItemCategory::Monipulator { + item_info.monipulator = Some(MonipulatorData { + unknown1: data_walker.step::()?, + unknowns: core::array::from_fn(|_| data_walker.step::().unwrap_or_default()), + }); + } + + // Parse string data + let content_count = data_walker.step::()?; + if content_count > 9 { + return Err(anyhow!( + "Unsupported strings content of length: {}", + content_count + )); + } + + let mut metas = Vec::with_capacity(content_count as usize); + for _ in 0..content_count { + metas.push((data_walker.step::()?, data_walker.step::()?)); + } + + match content_count { + 1 => { + // Just one string name + item_info.strings = Some(ItemStrings::Name { + name: Self::read_string(&mut data_walker)?, + }); + } + 5 => { + // English + item_info.strings = Some(ItemStrings::English { + name: Self::read_string(&mut data_walker)?, + article_type: EnglishArticle::try_from(data_walker.step::()?)?, + singular_name: Self::read_string(&mut data_walker)?, + plural_name: Self::read_string(&mut data_walker)?, + description: Self::read_string(&mut data_walker)?, + }); + } + count => { + return Err(anyhow!("Unsupported string count: {}", count)); + } + } + + data_walker.expect_n_msg::( + 0, + data_walker.remaining() / 4, + "Zero padding at end of data", + )?; + + Ok(item_info) + } + + fn read_string(walker: &mut T) -> Result { + walker.expect_msg::(1, "Expected 1 at start of string.")?; + walker.expect_n_msg::(0, 6, "Expected 0 padding before string.")?; + + let text_bytes = walker.step_until(0)?; + let string = Decoder::decode_simple(text_bytes); + + let alignment_padding = get_padding(text_bytes.len() + 1); + walker.expect_msg::(0, "End of string")?; + walker.expect_n_msg::(0, alignment_padding, "Expected 0 padding after string.")?; + + string + } + + pub fn write(&self, outer_walker: &mut T) -> Result<()> { + let mut walker = VecByteWalker::with_size(0xC00); + + walker.write(self.id); + walker.write(self.flags.bits()); + + // Write item data + walker.write(self.stack_size); + walker.write::(self.item_type.into()); + walker.write(self.resource_id); + walker.write(self.valid_targets.bits()); + + if let Some(equipment) = &self.equipment { + walker.write(equipment.level); + walker.write(equipment.slots.bits()); + walker.write(equipment.races.bits()); + walker.write(equipment.jobs.bits()); + walker.write(equipment.superior_level); + walker.write(equipment.shield_size); + + if let Some(weapon) = &self.weapon { + walker.write(weapon.damage); + walker.write(weapon.delay); + walker.write(weapon.dps); + walker.write::(weapon.skill_type.into()); + walker.write(weapon.jug_size); + walker.write(weapon.unknown1); + } + + walker.write(equipment.max_charges); + walker.write(equipment.casting_time); + walker.write(equipment.use_delay); + walker.write(equipment.reuse_delay); + walker.write(equipment.unknown1); + walker.write(equipment.ilevel); + walker.write(equipment.unknown2); + walker.write(equipment.unknown3); + } else if let Some(puppet) = &self.puppet { + walker.write::(puppet.slot.into()); + walker.write::(puppet.element_charge.into()); + walker.write(puppet.unknown1); + } else if let Some(instinct) = &self.instinct { + walker.write(instinct.unknown1); + walker.write(instinct.unknown2); + walker.write(instinct.unknown3); + walker.write(instinct.instinct_cost); + walker.write(instinct.unknown4); + walker.write(instinct.unknown5); + walker.write(instinct.unknown6); + walker.write(instinct.unknown7); + } else if let Some(furnishing) = &self.furnishing { + walker.write::(furnishing.element.into()); + walker.write(furnishing.storage_slots); + walker.write(furnishing.unknown3); + } else if let Some(usable_item) = &self.usable_item { + walker.write(usable_item.activation_time); + walker.write(usable_item.unknown1); + walker.write(usable_item.unknown2); + walker.write(usable_item.unknown3); + } else if let Some(currency) = &self.currency { + walker.write(currency.unknown1); + } else if let Some(slip) = &self.slip { + walker.write(slip.unknown1); + for unknown in slip.unknowns { + walker.write(unknown); + } + } else if let Some(monipulator) = &self.monipulator { + walker.write(monipulator.unknown1); + for unknown in monipulator.unknowns { + walker.write(unknown); + } + } + + // Write strings + let mut string_content = vec![]; + + match &self.strings { + Some(ItemStrings::Name { name }) => { + string_content.push(ItemStringContent::from_string(name)?); + } + Some(ItemStrings::English { + name, + article_type, + singular_name, + plural_name, + description, + }) => { + string_content.push(ItemStringContent::from_string(name)?); + string_content.push(ItemStringContent::from_article(*article_type)); + string_content.push(ItemStringContent::from_string(singular_name)?); + string_content.push(ItemStringContent::from_string(plural_name)?); + string_content.push(ItemStringContent::from_string(description)?); + } + None => {} + } + + // Write metas + walker.write::(string_content.len() as u32); + + let mut current_offset: u32 = string_content.len() as u32 * 8 + 4; + for content in &string_content { + match content { + ItemStringContent::Number(_) => { + walker.write::(current_offset); + walker.write::(1); + + current_offset += 4; + } + ItemStringContent::StringBytes(string_bytes) => { + walker.write::(current_offset); + walker.write::(0); + + current_offset += string_bytes.len() as u32; + } + } + } + + // Write string content + for content in &string_content { + match content { + ItemStringContent::Number(number) => { + walker.write(*number); + } + ItemStringContent::StringBytes(string_bytes) => { + walker.write_bytes(string_bytes); + } + } + } + + // Write icon bytes + walker.goto(0x280); + walker.write(self.icon_bytes.len() as u32); + walker.write_bytes(&self.icon_bytes); + walker.write_at::(0xC00 - 1, 0xFF); + + rotate_all(walker.as_mut_slice(), 3); + outer_walker.write_bytes(walker.as_slice()); + + Ok(()) + } +} + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct ItemInfoTable { + items: Vec, +} + +const ENTRY_SIZE: usize = 0xC00; + +impl ItemInfoTable { + pub fn parse(walker: &mut T) -> Result { + if walker.len() % ENTRY_SIZE != 0 { + return Err(anyhow!("Length does not match a item info DAT.")); + } + + let entry_count = walker.len() / ENTRY_SIZE; + let mut items = Vec::with_capacity(entry_count); + for _ in 0..entry_count { + items.push(ItemInfo::parse(walker)?); + } + + Ok(ItemInfoTable { items }) + } + + pub fn write(&self, walker: &mut T) -> Result<()> { + walker.set_size(self.items.len() * ENTRY_SIZE); + + for item in &self.items { + item.write(walker)?; + } + + Ok(()) + } +} + +impl DatFormat for ItemInfoTable { + fn from(walker: &mut T) -> Result { + ItemInfoTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + if walker.len() % ENTRY_SIZE != 0 { + return Err(anyhow!("Length does not match a item info DAT.")); + } + + // Parse one item info to check. + ItemInfo::parse(walker)?; + + Ok(()) + } + + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + + use crate::{dat_format::DatFormat, enums::EnglishArticle}; + + use super::{ItemInfoTable, ItemStrings}; + + #[test] + pub fn weapons() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/weapons.DAT"); + + ItemInfoTable::check_path(&dat_path).unwrap(); + let res = ItemInfoTable::from_path_checked(&dat_path).unwrap(); + + if let ItemStrings::English { + name, + article_type, + singular_name, + plural_name, + description, + } = res.items[4329].strings.as_ref().unwrap() + { + assert_eq!(name, "Excalipoor"); + assert_eq!(article_type, &EnglishArticle::An); + assert_eq!(singular_name, "Excalipoor"); + assert_eq!(plural_name, "Excalipoors"); + assert_eq!(description, "DMG:1 Delay:240"); + } else { + panic!("Expected english strings") + } + } + + #[test] + pub fn armor2() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/armor2.DAT"); + + ItemInfoTable::check_path(&dat_path).unwrap(); + let res = ItemInfoTable::from_path_checked_during(&dat_path).unwrap(); + + if let ItemStrings::English { + name, + article_type, + singular_name, + plural_name, + description, + } = res.items[3827].strings.as_ref().unwrap() + { + assert_eq!(name, "Voodoo Mail"); + assert_eq!(article_type, &EnglishArticle::SuitsOf); + assert_eq!(singular_name, "voodoo mail"); + assert_eq!(plural_name, "suits of voodoo mail"); + assert_eq!(description, "The envious aura that looms over\nthis mail seems to invite utter\nruin to descend upon its bearer."); + } else { + panic!("Expected english strings") + } + } +} diff --git a/crates/dats/src/formats/mod.rs b/crates/dats/src/formats/mod.rs new file mode 100644 index 0000000..cca4985 --- /dev/null +++ b/crates/dats/src/formats/mod.rs @@ -0,0 +1,10 @@ +pub mod dialog; +pub mod dmsg; +pub mod dmsg1_string_table; +pub mod dmsg2_string_table; +pub mod dmsg3_string_table; +pub mod entity_names; +pub mod item_info; +pub mod status_info; +pub mod string_table; +pub mod xistring_table; diff --git a/crates/dats/src/formats/status_info.rs b/crates/dats/src/formats/status_info.rs new file mode 100644 index 0000000..4100848 --- /dev/null +++ b/crates/dats/src/formats/status_info.rs @@ -0,0 +1,199 @@ +use anyhow::{anyhow, Ok, Result}; +use common::{ + byte_walker::{BufferedByteWalker, ByteWalker}, + vec_byte_walker::VecByteWalker, + writing_byte_walker::WritingByteWalker, +}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; +use crate::{serde_base64, utils::rotate_all}; + +#[derive(Debug, Serialize, Deserialize)] +pub struct StatusInfo { + id: u16, + description: String, + + flag: u16, + + #[serde(with = "serde_base64")] + icon_bytes: Vec, +} + +impl StatusInfo { + pub fn parse(walker: &mut T) -> Result { + let mut data_bytes = walker.take_bytes(0x280)?.to_vec(); + decode_data_block(&mut data_bytes); + + let mut data_walker = BufferedByteWalker::on(data_bytes); + + let id = data_walker.step::()?; + + let flag = data_walker.step::()?; + + data_walker.expect::(1)?; + data_walker.expect::(12)?; + data_walker.expect::(0)?; + data_walker.expect::(1)?; + + data_walker.expect_n_msg::(0, 24, "Padding after unknowns")?; + + let description = Decoder::decode_simple(data_walker.step_until(0)?)?; + + let icon_size = walker.step::()?; + let icon_bytes = walker.take_bytes(icon_size as usize)?.to_vec(); + + let icon_padding = walker.remaining() % ENTRY_SIZE - 1; + walker.expect_n_msg::(0, icon_padding, "Padding after icon")?; + walker.expect_msg::(0xFF, "End of status info byte")?; + + Ok(StatusInfo { + id, + flag, + description, + icon_bytes, + }) + } + + pub fn write(&self, walker: &mut T) -> Result<()> { + let mut data_walker = VecByteWalker::with_size(0x280); + + data_walker.write(self.id); + data_walker.write(self.flag); + + data_walker.write::(1); + data_walker.write::(12); + data_walker.write::(0); + data_walker.write::(1); + + data_walker.skip(24); + + let description = Encoder::encode_simple(&self.description)?; + data_walker.write_bytes(&description); + + let mut data_bytes = data_walker.into_vec(); + encode_data_block(&mut data_bytes); + + walker.write_bytes(&data_bytes); + + walker.write(self.icon_bytes.len() as u32); + walker.write_bytes(&self.icon_bytes); + + let icon_padding = ENTRY_SIZE - walker.offset() % ENTRY_SIZE - 1; + walker.skip(icon_padding); + + walker.write::(0xFF); + + Ok(()) + } +} + +fn get_data_shift_size(bytes: &[u8], offset: usize, size: usize) -> usize { + if size < 13 { + return 0; + } + + let bit_count = u8::count_ones(bytes[offset + 2]) as i32 + - u8::count_ones(bytes[offset + 11]) as i32 + + u8::count_ones(bytes[offset + 12]) as i32; + + match bit_count.abs() % 5 { + 0 => 7, + 1 => 1, + 2 => 6, + 3 => 2, + 4 => 5, + _ => 0, + } +} + +fn decode_data_block(bytes: &mut [u8]) { + rotate_all(bytes, get_data_shift_size(bytes, 0, bytes.len())); +} + +fn encode_data_block(bytes: &mut [u8]) { + rotate_all(bytes, 8 - get_data_shift_size(bytes, 0, bytes.len())); +} + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct StatusInfoTable { + status_infos: Vec, +} + +const ENTRY_SIZE: usize = 0x1800; + +impl StatusInfoTable { + pub fn parse(walker: &mut T) -> Result { + if walker.len() % ENTRY_SIZE != 0 { + return Err(anyhow!("Length does not match a status info DAT.")); + } + + let entry_count = walker.len() / ENTRY_SIZE; + let mut status_infos = Vec::with_capacity(entry_count); + for _ in 0..entry_count { + status_infos.push(StatusInfo::parse(walker)?); + } + + Ok(StatusInfoTable { status_infos }) + } + + pub fn write(&self, walker: &mut T) -> Result<()> { + walker.set_size(self.status_infos.len() * ENTRY_SIZE); + + for status_info in &self.status_infos { + status_info.write(walker)?; + } + + Ok(()) + } +} + +impl DatFormat for StatusInfoTable { + fn from(walker: &mut T) -> Result { + StatusInfoTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + if walker.len() % ENTRY_SIZE != 0 { + return Err(anyhow!("Length does not match a status info DAT.")); + } + + // Parse one status info to check. + StatusInfo::parse(walker)?; + + Ok(()) + } + + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + + use crate::dat_format::DatFormat; + + use super::StatusInfoTable; + + #[test] + pub fn status_infos() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/status_infos.DAT"); + + StatusInfoTable::check_path(&dat_path).unwrap(); + let res = StatusInfoTable::from_path_checked_during(&dat_path).unwrap(); + + assert_eq!( + res.status_infos[0].description, + "You have been knocked unconscious.".to_string() + ); + + assert_eq!( + res.status_infos[614].description, + "Ullegore is making you forget the true meaning of \"fun\"!".to_string() + ); + } +} diff --git a/crates/dats/src/formats/string_table.rs b/crates/dats/src/formats/string_table.rs new file mode 100644 index 0000000..aeca221 --- /dev/null +++ b/crates/dats/src/formats/string_table.rs @@ -0,0 +1,62 @@ +use std::collections::BTreeMap; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, writing_byte_walker::WritingByteWalker}; +use encoding::decoder::Decoder; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct StringTableEntry { + id: u32, + string: String, +} + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct StringTable { + entries: BTreeMap, +} + +impl StringTable { + fn parse(walker: &mut T) -> Result { + if walker.len() % 0x40 != 0 { + return Err(anyhow!("Not a string table.")); + } + + let entry_count = walker.len() / 0x40; + + let mut entries = BTreeMap::new(); + for idx in 0..entry_count { + let id: u32 = walker.step()?; + let string = Decoder::decode_simple(walker.take_bytes(59)?)?; + entries.insert(idx as u32, StringTableEntry { id, string }); + + walker.expect_msg::(0xFF, "String entry expected to be ended by 0xFF.")?; + } + + Ok(StringTable { entries }) + } +} + +impl DatFormat for StringTable { + fn write(&self, _walker: &mut T) -> Result<()> { + Err(anyhow!("Not yet implemented")) + } + + fn from(walker: &mut T) -> Result { + StringTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + if walker.len() % 0x40 != 0 { + return Err(anyhow!("Does not have a size that matches a string table.")); + } + + let string_end_byte = walker.read_at::(0x40)?; + if string_end_byte != 0xFF { + return Err(anyhow!("Expected strings to be ended by 0xFF.")); + } + Ok(()) + } +} diff --git a/crates/dats/src/formats/xistring_table.rs b/crates/dats/src/formats/xistring_table.rs new file mode 100644 index 0000000..7cd3508 --- /dev/null +++ b/crates/dats/src/formats/xistring_table.rs @@ -0,0 +1,193 @@ +use std::collections::BTreeMap; + +use anyhow::{anyhow, Result}; +use common::{byte_walker::ByteWalker, expect_msg, writing_byte_walker::WritingByteWalker}; +use encoding::{decoder::Decoder, encoder::Encoder}; +use serde_derive::{Deserialize, Serialize}; + +use crate::dat_format::DatFormat; + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct XiStringTable { + strings: BTreeMap, +} + +#[derive(Debug, Serialize, Deserialize)] +struct XiStringMeta { + offset: u32, + size: u16, +} + +const HEADER_SIZE: u32 = 0x38; + +impl XiStringTable { + fn parse(walker: &mut T) -> Result { + walker.expect_utf8_str("XISTRING\0\0")?; + walker.expect::(2)?; + + walker.expect_n_msg::(0, 20, "Initial padding")?; + + let file_bytes = walker.len() as u32; + walker.expect_msg(file_bytes, "File size")?; + + let entry_count: u32 = walker.step()?; + let meta_bytes: u32 = walker.step()?; + let data_bytes: u32 = walker.step()?; + + if meta_bytes != entry_count * 12 || file_bytes != HEADER_SIZE + meta_bytes + data_bytes { + return Err(anyhow!("Invalid header values.")); + } + + let unknown1: u32 = walker.step()?; + if unknown1 != 0 { + return Err(anyhow!("unknown1 is {}", unknown1)); + } + + let unknown2: u32 = walker.step()?; + // TODO: this value is different in at least IngameMessages2, where it is 304231515 + if unknown2 != 304091210 { + return Err(anyhow!("unknown2 is {}", unknown2)); + } + + // Read metadata + let mut metas = vec![]; + for _ in 0..entry_count { + let offset: u32 = walker.step()?; + let size: u16 = walker.step()?; + + // TODO: TimeAndPronouns has a 1 here instead of 0 + walker.expect_msg(0u16, "Unknown meta 1")?; + + walker.expect_msg(0u16, "Unknown meta 2")?; + walker.expect_msg(0u16, "Unknown meta 3")?; + + metas.push(XiStringMeta { offset, size }); + } + + // Read the strings + let mut strings = BTreeMap::default(); + for (idx, meta) in metas.into_iter().enumerate() { + expect_msg( + HEADER_SIZE + meta_bytes + meta.offset, + walker.offset() as u32, + "Offset of string", + )?; + + let string_bytes = walker.take_bytes(meta.size as usize)?; + let string = Decoder::decode_simple(string_bytes)?; + strings.insert(idx as u32, string); + } + + Ok(XiStringTable { strings }) + } + + pub fn write(&self, walker: &mut T) -> Result<()> { + walker.write_str("XISTRING\0\0"); + walker.write::(2); + + for _ in 0..20 { + walker.write::(0); + } + + let encoded_strings = self + .strings + .iter() + .map(|(idx, string)| { + let encoded = Encoder::encode_simple(&string)?; + + Ok((idx, encoded)) + }) + .collect::>>()?; + + let entry_count = self.strings.keys().max().copied().unwrap_or_default() as u32 + 1; + let data_bytes = encoded_strings + .iter() + .map(|(_, str)| str.len()) + .sum::() as u32 + + entry_count; // A zero-byte to end each entry + + let meta_bytes = entry_count * 12; + let file_bytes = HEADER_SIZE + meta_bytes + data_bytes; + + walker.write(file_bytes); + + walker.write(entry_count); + walker.write(meta_bytes); + walker.write(data_bytes); + + walker.write::(0); // unknown1 + walker.write::(304091210); // unknown2 + + // Write metadata for strings + let mut current_string_offset = 0; + for idx in 0..entry_count { + let string_len = encoded_strings + .get(&idx) + .map(|str| str.len()) + .unwrap_or_default() + + 1; // 1 extra byte for string end + + walker.write(current_string_offset); + walker.write(string_len as u16); + + // Unknowns + walker.write(0u16); + walker.write(0u16); + walker.write(0u16); + + current_string_offset += string_len as u32; + } + + // Write the strings + for idx in 0..entry_count { + if let Some(encoded_string) = encoded_strings.get(&idx) { + walker.write_bytes(&encoded_string); + } + walker.write::(0); // End of string + } + + Ok(()) + } +} + +impl DatFormat for XiStringTable { + fn write(&self, walker: &mut T) -> Result<()> { + self.write(walker) + } + + fn from(walker: &mut T) -> Result { + XiStringTable::parse(walker) + } + + fn check_type(walker: &mut T) -> Result<()> { + walker.expect_utf8_str("XISTRING\0\0")?; + walker.expect::(2)?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use std::path::PathBuf; + + use crate::{dat_format::DatFormat, formats::xistring_table::XiStringTable}; + + #[test] + pub fn pol_messages() { + let mut dat_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + dat_path.push("resources/test/pol_messages.DAT"); + + XiStringTable::check_path(&dat_path).unwrap(); + let res = XiStringTable::from_path_checked(&dat_path).unwrap(); + + assert_eq!( + res.strings.get(&0).unwrap(), + &"Searching for lobby server.".to_string() + ); + + assert_eq!( + res.strings.get(&104).unwrap(), + &"Select a character to play.".to_string() + ); + } +} diff --git a/crates/dats/src/id_mapping.rs b/crates/dats/src/id_mapping.rs new file mode 100644 index 0000000..f76d12f --- /dev/null +++ b/crates/dats/src/id_mapping.rs @@ -0,0 +1,149 @@ +use std::sync::OnceLock; + +use crate::{ + base::{Dat, DatByZone}, + formats::{ + dialog::Dialog, dmsg2_string_table::Dmsg2StringTable, dmsg3_string_table::Dmsg3StringTable, + entity_names::EntityNames, item_info::ItemInfoTable, status_info::StatusInfoTable, + xistring_table::XiStringTable, + }, +}; + +#[derive(Debug)] +pub struct DatIdMapping { + pub entities: DatByZone, + pub dialog: DatByZone, + pub dialog2: DatByZone, + + pub ability_names: Dat, + pub ability_descriptions: Dat, + pub area_names: Dat, + pub area_names_alt: Dat, + pub character_select: Dat, + pub chat_filter_types: Dat, + pub day_names: Dat, + pub directions: Dat, + pub equipment_locations: Dat, + pub error_messages: Dat, + pub ingame_messages_1: Dat, + pub ingame_messages_2: Dat, + pub job_names: Dat, + pub key_items: Dat, + pub menu_items_description: Dat, + pub menu_items_text: Dat, + + pub moon_phases: Dat, + pub pol_messages: Dat, + pub race_names: Dat, + pub region_names: Dat, + pub spell_names: Dat, + pub spell_descriptions: Dat, + pub status_info: Dat, + pub status_names: Dat, + pub time_and_pronouns: Dat, + pub titles: Dat, + pub misc1: Dat, + pub misc2: Dat, + pub weather_types: Dat, + + // Item data + pub armor: Dat, + pub armor2: Dat, + pub currency: Dat, + pub general_items: Dat, + pub general_items2: Dat, + pub puppet_items: Dat, + pub usable_items: Dat, + pub weapons: Dat, + pub vouchers_and_slips: Dat, + pub monipulator: Dat, + pub instincts: Dat, +} + +static DAT_ID_MAPPING: OnceLock = OnceLock::new(); + +impl DatIdMapping { + pub fn get() -> &'static Self { + DAT_ID_MAPPING.get_or_init(|| { + // Entities + let mut entities = DatByZone::default(); + // Zones 1-255 + (0..256).into_iter().for_each(|idx| { + entities.insert(idx, 6720 + idx); + }); + // Zones 256-512 + (0..256).into_iter().for_each(|idx| { + entities.insert(256 + idx, 86491 + idx); + }); + // Zones 1000+ + (0..256).into_iter().for_each(|idx| { + entities.insert(1000 + idx, 67911 + idx); + }); + + // Dialog text + let mut dialog = DatByZone::default(); + // Zones 0-255 + (0..256).into_iter().for_each(|idx| { + dialog.insert(idx, 6420 + idx); + }); + // Zones 256-512 + (0..256).into_iter().for_each(|idx| { + dialog.insert(idx + 256, 85590 + idx); + }); + + // Secondary dialog text + let mut dialog2 = DatByZone::default(); + // Just whitegate? + dialog2.insert(50, 57945); + + Self { + entities, + dialog, + dialog2, + + ability_names: 55701.into(), + ability_descriptions: 55733.into(), + area_names: 55465.into(), + area_names_alt: 55661.into(), + character_select: 55470.into(), + chat_filter_types: 55650.into(), + day_names: 55658.into(), + directions: 55659.into(), + equipment_locations: 55471.into(), + error_messages: 55646.into(), + ingame_messages_1: 55648.into(), + ingame_messages_2: 55649.into(), + job_names: 55467.into(), + key_items: 55695.into(), + menu_items_description: 55651.into(), + menu_items_text: 55652.into(), + moon_phases: 55660.into(), + pol_messages: 55647.into(), + race_names: 55469.into(), + region_names: 55654.into(), + spell_names: 55702.into(), + spell_descriptions: 55734.into(), + status_info: 00087.into(), + status_names: 55725.into(), + time_and_pronouns: 00063.into(), + titles: 55704.into(), + misc1: 55645.into(), + misc2: 55653.into(), + weather_types: 55657.into(), + + // Item data + armor: 00076.into(), + armor2: 55668.into(), + currency: 00091.into(), + general_items: 00073.into(), + general_items2: 55671.into(), + puppet_items: 00077.into(), + usable_items: 00074.into(), + weapons: 00075.into(), + vouchers_and_slips: 55667.into(), + monipulator: 55669.into(), + instincts: 55670.into(), + } + }) + } +} diff --git a/crates/dats/src/image.rs b/crates/dats/src/image.rs new file mode 100644 index 0000000..51553ae --- /dev/null +++ b/crates/dats/src/image.rs @@ -0,0 +1,108 @@ +#![allow(dead_code)] // TODO: remove once images are in use +use anyhow::{anyhow, Result}; +use common::byte_walker::ByteWalker; +use serde_derive::{Deserialize, Serialize}; + +#[derive(Debug, Serialize, Deserialize)] +pub struct XiImage { + id: String, + category: String, + width: u32, + height: u32, + planes: u16, + bit_count: u16, + compression: u32, + image_size: u32, + horizontal_resolution: u32, + vertical_resolution: u32, + used_colors: u32, + important_colors: u32, +} + +pub enum XiImageType { + DirectX, + BitmapA, + BitmapB, +} + +impl XiImageType { + pub(crate) fn from(byte: u8) -> Result { + match byte { + 0x91 => Ok(XiImageType::BitmapA), + 0xA1 => Ok(XiImageType::DirectX), + 0xB1 => Ok(XiImageType::BitmapB), + _ => Err(anyhow!("Unknown image type: {:02X}", byte)), + } + } +} + +impl XiImage { + pub(crate) fn parse(walker: &mut T) -> Result { + let image_type = XiImageType::from(walker.step::()?)?; + + let category = std::str::from_utf8(walker.take_bytes(8)?)?.to_string(); + let id = std::str::from_utf8(walker.take_bytes(8)?)?.to_string(); + + walker.expect_msg(40, "BITMAPINFO structure length")?; + + let width = walker.step::()?; + let height = walker.step::()?; + let planes = walker.step::()?; + let bit_count = walker.step::()?; + let compression = walker.step::()?; + let image_size = walker.step::()?; + let horizontal_resolution = walker.step::()?; + let vertical_resolution = walker.step::()?; + let used_colors = walker.step::()?; + let important_colors = walker.step::()?; + + if width > 16 * 1024 || height > 16 * 1024 || planes != 1 { + return Err(anyhow!("Incompatible width, height, or planes in image.")); + } + + match image_type { + XiImageType::DirectX => Self::parse_directx(walker, width, height)?, + XiImageType::BitmapA => todo!(), + XiImageType::BitmapB => todo!(), + } + + Ok(XiImage { + id, + category, + width, + height, + planes, + bit_count, + compression, + image_size, + horizontal_resolution, + vertical_resolution, + used_colors, + important_colors, + }) + } + + fn parse_directx(walker: &mut T, width: u32, height: u32) -> Result<()> { + let four_cc = std::str::from_utf8(walker.take_bytes(4)?)?; + + if !four_cc.starts_with("DXT") { + return Err(anyhow!( + "Expected first three bytes to be \"DXT\", but got \"{}\"", + &four_cc[..3] + )); + } + + if width % 4 != 0 || height % 4 != 0 { + return Err(anyhow!( + "Expected width and height to be a multiple of 4, but got {} and {}.", + width, + height + )); + } + + let _texel_block_count = height / 4 * width / 4; + let _unknown1 = walker.step::()?; + + todo!(); + } +} diff --git a/crates/dats/src/lib.rs b/crates/dats/src/lib.rs new file mode 100644 index 0000000..2ad4eaf --- /dev/null +++ b/crates/dats/src/lib.rs @@ -0,0 +1,12 @@ +pub mod base; +pub mod context; +pub mod dat_format; +pub mod enums; +pub mod flags; +pub mod formats; +pub mod id_mapping; +pub mod image; +pub mod sanitize_filename; +mod serde_base64; +mod serde_flags; +mod utils; diff --git a/crates/dats/src/sanitize_filename.rs b/crates/dats/src/sanitize_filename.rs new file mode 100644 index 0000000..0b23d9e --- /dev/null +++ b/crates/dats/src/sanitize_filename.rs @@ -0,0 +1,12 @@ +use std::sync::OnceLock; + +use regex::Regex; + +static REMOVAL_REGEX: OnceLock = OnceLock::new(); + +pub fn sanitize_filename(input: &str) -> String { + REMOVAL_REGEX + .get_or_init(|| Regex::new(r#"[<>:"/\|?*']"#).unwrap()) + .replace_all(&input.replace(" - ", "-").replace(" ", "_"), "") + .to_string() +} diff --git a/crates/dats/src/serde_base64.rs b/crates/dats/src/serde_base64.rs new file mode 100644 index 0000000..4a14792 --- /dev/null +++ b/crates/dats/src/serde_base64.rs @@ -0,0 +1,15 @@ +use base64::{engine::general_purpose, Engine as _}; +use serde::{Deserialize, Serialize}; +use serde::{Deserializer, Serializer}; + +pub fn serialize(v: &Vec, s: S) -> Result { + let base64 = general_purpose::STANDARD_NO_PAD.encode(v); + String::serialize(&base64, s) +} + +pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result, D::Error> { + let base64 = String::deserialize(d)?; + general_purpose::STANDARD_NO_PAD + .decode(base64.as_bytes()) + .map_err(|e| serde::de::Error::custom(e)) +} diff --git a/crates/dats/src/serde_flags.rs b/crates/dats/src/serde_flags.rs new file mode 100644 index 0000000..aa5e6e6 --- /dev/null +++ b/crates/dats/src/serde_flags.rs @@ -0,0 +1,152 @@ +use std::{borrow::Cow, fmt}; + +use anyhow::anyhow; +use bitflags::{ + parser::{ParseHex, WriteHex}, + Flags, +}; +use serde::{ + de::{Error, Visitor}, + ser::SerializeSeq, + Deserialize, Deserializer, Serialize, Serializer, +}; + +pub fn serialize( + flags: &B, + serializer: S, +) -> Result +where + B::Bits: WriteHex + Serialize, +{ + // Serialize human-readable flags as a sequence like `"[A, B]"` + if serializer.is_human_readable() { + let mut seq = serializer.serialize_seq(None)?; + for flag in flags.iter_names() { + seq.serialize_element(flag.0)?; + } + seq.end() + } + // Serialize non-human-readable flags directly as the underlying bits + else { + flags.bits().serialize(serializer) + } +} + +/** +Deserialize a set of flags from a human-readable string or their underlying bits. + +Any unknown bits will be retained. +*/ +pub fn deserialize<'de, B: Flags + Default, D: Deserializer<'de>>( + deserializer: D, +) -> Result +where + B::Bits: ParseHex + Deserialize<'de>, +{ + if deserializer.is_human_readable() { + // Deserialize human-readable flags by parsing them from sequences like `"[A, B]"` + struct FlagsVisitor(core::marker::PhantomData); + + impl<'de, B: Flags + Default> Visitor<'de> for FlagsVisitor + where + B::Bits: ParseHex, + { + type Value = B; + + fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str("a sequence of flags") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: serde::de::SeqAccess<'de>, + { + let mut result = Self::Value::default(); + while let Some(element) = seq.next_element::>()? { + result.insert( + B::from_name(&element) + .ok_or_else(|| anyhow!("Unknown element: {}", element)) + .map_err(|e| A::Error::custom(e))?, + ); + } + Ok(result) + } + } + + deserializer.deserialize_seq(FlagsVisitor(Default::default())) + } else { + // Deserialize non-human-readable flags directly from the underlying bits + let bits = B::Bits::deserialize(deserializer)?; + + Ok(B::from_bits_retain(bits)) + } +} + +#[macro_export] +macro_rules! serde_bitflags { + ($($name:ident),*$(,)?) => { + $( + impl serde::Serialize for $name { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + crate::serde_flags::serialize(self, serializer) + } + } + + impl<'de> serde::Deserialize<'de> for $name { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + crate::serde_flags::deserialize(deserializer) + } + })* + }; +} + +#[cfg(test)] +mod tests { + + use serde_yaml; + + bitflags::bitflags! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Default)] + pub struct SomeFlags: u16 { + // Combined flags + const SecondAndThird = 0x06; + + // Base flags + const None = 0x00; + const First = 0x01; + const Second = 0x02; + const Third = 0x04; + } + } + serde_bitflags!(SomeFlags); + + #[test] + pub fn base_flags() { + assert_eq!( + "- First\n- Second\n", + serde_yaml::to_string(&(SomeFlags::First | SomeFlags::Second)).unwrap(), + ); + assert_eq!( + SomeFlags::First | SomeFlags::Second, + serde_yaml::from_str(&"- First\n- Second\n").unwrap(), + ); + } + + #[test] + pub fn combined_flags() { + assert_eq!( + "- SecondAndThird\n", + serde_yaml::to_string(&(SomeFlags::Second | SomeFlags::Third)).unwrap(), + ); + assert_eq!( + SomeFlags::SecondAndThird, + serde_yaml::from_str(&"- Second\n- Third\n").unwrap(), + ); + } +} diff --git a/crates/dats/src/utils.rs b/crates/dats/src/utils.rs new file mode 100644 index 0000000..14636ad --- /dev/null +++ b/crates/dats/src/utils.rs @@ -0,0 +1,27 @@ +pub fn rotate_byte(byte: u8, shift_size: usize) -> u8 { + (byte >> shift_size) | (byte << (8 - shift_size)) +} + +#[allow(unused)] +pub fn rotate(bytes: &mut [u8], offset: usize, size: usize, shift_size: usize) { + if shift_size < 1 || shift_size > 8 { + return; + } + for i in 0..size { + bytes[offset + i] = rotate_byte(bytes[offset + i], shift_size); + } +} + +pub fn rotate_all(bytes: &mut [u8], shift_size: usize) { + if shift_size < 1 || shift_size > 8 { + return; + } + bytes + .iter_mut() + .for_each(|b| *b = rotate_byte(*b, shift_size)); +} + +#[inline] +pub fn get_nibble(value: u32, pos: u32) -> u8 { + ((value & (0xF << (pos * 4))) >> (pos * 4)) as u8 +} diff --git a/crates/encoding/Cargo.toml b/crates/encoding/Cargo.toml new file mode 100644 index 0000000..d6afc55 --- /dev/null +++ b/crates/encoding/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "encoding" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.71" + +[dev-dependencies] +pretty_assertions = "1.4.0" diff --git a/crates/encoding/conversion_tables/00xx.dat b/crates/encoding/conversion_tables/00xx.dat new file mode 100644 index 0000000..ebd5bfa Binary files /dev/null and b/crates/encoding/conversion_tables/00xx.dat differ diff --git a/crates/encoding/conversion_tables/81xx.dat b/crates/encoding/conversion_tables/81xx.dat new file mode 100644 index 0000000..a798acc Binary files /dev/null and b/crates/encoding/conversion_tables/81xx.dat differ diff --git a/crates/encoding/conversion_tables/82xx.dat b/crates/encoding/conversion_tables/82xx.dat new file mode 100644 index 0000000..642978a --- /dev/null +++ b/crates/encoding/conversion_tables/82xx.dat @@ -0,0 +1 @@ +!"#$%&'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZA0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0{0|0}0~0000000000000000000000 \ No newline at end of file diff --git a/crates/encoding/conversion_tables/83xx.dat b/crates/encoding/conversion_tables/83xx.dat new file mode 100644 index 0000000..1ea7f7b --- /dev/null +++ b/crates/encoding/conversion_tables/83xx.dat @@ -0,0 +1 @@ +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \ No newline at end of file diff --git a/crates/encoding/conversion_tables/84xx.dat b/crates/encoding/conversion_tables/84xx.dat new file mode 100644 index 0000000..f5f781d Binary files /dev/null and b/crates/encoding/conversion_tables/84xx.dat differ diff --git a/crates/encoding/conversion_tables/85xx.dat b/crates/encoding/conversion_tables/85xx.dat new file mode 100644 index 0000000..7d2110e Binary files /dev/null and b/crates/encoding/conversion_tables/85xx.dat differ diff --git a/crates/encoding/conversion_tables/86xx.dat b/crates/encoding/conversion_tables/86xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/86xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/87xx.dat b/crates/encoding/conversion_tables/87xx.dat new file mode 100644 index 0000000..a2e9e53 --- /dev/null +++ b/crates/encoding/conversion_tables/87xx.dat @@ -0,0 +1 @@ +`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$`!a!b!c!d!e!f!g!h!i!I33"3M33'3363Q3W3 3&3#3+3J3;33333333{300!3!!22222122292~3}3|3R"a"+"."""" """5")"*"   "   "!a: S~x \ No newline at end of file diff --git a/crates/encoding/conversion_tables/88xx.dat b/crates/encoding/conversion_tables/88xx.dat new file mode 100644 index 0000000..c56374a Binary files /dev/null and b/crates/encoding/conversion_tables/88xx.dat differ diff --git a/crates/encoding/conversion_tables/89xx.dat b/crates/encoding/conversion_tables/89xx.dat new file mode 100644 index 0000000..84f0681 --- /dev/null +++ b/crates/encoding/conversion_tables/89xx.dat @@ -0,0 +1 @@ +bp TS[poS\zNx&nVUk;YSfmtBVNKO SU0[q_ ffh8ll)m[tvNz4[`풲muvř`iSQW0XDY[^(`cclopqYqq?s~vт`[iXeZl%uQ.YeY__be*j'kksV,Ğ\l{QK\aƁvharYNOxSi`)nOz NSNUO=OOsORS VYZ[[yfggLklkpsyykSkWl"ooEotuv wz{!|}6f̊Qeӗ(8N+T\]sLv~ +d_xRbcBdb-z{v} INHQCS`S[\\]&bGbdh4hlEmmg\oNq}qez{} \ No newline at end of file diff --git a/crates/encoding/conversion_tables/91xx.dat b/crates/encoding/conversion_tables/91xx.dat new file mode 100644 index 0000000..b534a8a Binary files /dev/null and b/crates/encoding/conversion_tables/91xx.dat differ diff --git a/crates/encoding/conversion_tables/92xx.dat b/crates/encoding/conversion_tables/92xx.dat new file mode 100644 index 0000000..022da2a --- /dev/null +++ b/crates/encoding/conversion_tables/92xx.dat @@ -0,0 +1,2 @@ +SFOTjY1]zh7rH=j9NXSVfWbceNkm[npwz{}=ƀˆ[VX>_efjk7uNJ$Pw0W_e`zf`luznE{\uzQ{Ąyz6Z@w-NN[_bm6t4xFZuO^bcWeogvLr̀)M PWZhsidqrXjyw)/OeRZSbgl}v{|6f or~Q{rx{H{ja^Qu`ukQbnzvOpbO{zVYX䆼4O$RJSSS^,deg>lNlHrrsTuA~,酩{Ƒiq=cifjuvxC*SQS&TY^|_`Ibybbekluvxy}w^ۘ j8|P>\_gk5t w \ No newline at end of file diff --git a/crates/encoding/conversion_tables/95xx.dat b/crates/encoding/conversion_tables/95xx.dat new file mode 100644 index 0000000..c5db00d --- /dev/null +++ b/crates/encoding/conversion_tables/95xx.dat @@ -0,0 +1,3 @@ +;gz9Suf_񃘀<__buF{ee g \ No newline at end of file diff --git a/crates/encoding/conversion_tables/96xx.dat b/crates/encoding/conversion_tables/96xx.dat new file mode 100644 index 0000000..7c7b6d7 Binary files /dev/null and b/crates/encoding/conversion_tables/96xx.dat differ diff --git a/crates/encoding/conversion_tables/97xx.dat b/crates/encoding/conversion_tables/97xx.dat new file mode 100644 index 0000000..744fa25 Binary files /dev/null and b/crates/encoding/conversion_tables/97xx.dat differ diff --git a/crates/encoding/conversion_tables/98xx.dat b/crates/encoding/conversion_tables/98xx.dat new file mode 100644 index 0000000..4bec03b Binary files /dev/null and b/crates/encoding/conversion_tables/98xx.dat differ diff --git a/crates/encoding/conversion_tables/99xx.dat b/crates/encoding/conversion_tables/99xx.dat new file mode 100644 index 0000000..0d16352 --- /dev/null +++ b/crates/encoding/conversion_tables/99xx.dat @@ -0,0 +1 @@ +PPPPPPPPPPPP QQQQQQQ!Q:Q7Q[C[E[@[Q[U[Z[[[e[i[p[s[u[x[ez[[[[[[[[[[[[[[[[[[[\\\ \\ \"\(\8\9\A\F\N\S\P\O\q[l\n\bNv\y\\\\Y\\\\\\\\\\\\\]\ ]]]\]]]]]"]]]]L]R]N]K]l]s]v]]]]]]]]]]]]]]]]]]]]] ^^^^^6^7^D^C^@^N^W^T^_^b^d^G^u^v^z^^^^^^^^ \ No newline at end of file diff --git a/crates/encoding/conversion_tables/9Cxx.dat b/crates/encoding/conversion_tables/9Cxx.dat new file mode 100644 index 0000000..0a24045 Binary files /dev/null and b/crates/encoding/conversion_tables/9Cxx.dat differ diff --git a/crates/encoding/conversion_tables/9Dxx.dat b/crates/encoding/conversion_tables/9Dxx.dat new file mode 100644 index 0000000..2db59c7 Binary files /dev/null and b/crates/encoding/conversion_tables/9Dxx.dat differ diff --git a/crates/encoding/conversion_tables/9Exx.dat b/crates/encoding/conversion_tables/9Exx.dat new file mode 100644 index 0000000..e0b40c3 --- /dev/null +++ b/crates/encoding/conversion_tables/9Exx.dat @@ -0,0 +1,3 @@ +fffff?ffffffggg&g'g8.g?g6gAg8g7gFg^g`gYgcgdggpgg|gjggggggggggggggggggggggjhFh)h@hMh2hNhh+hYhchwhhhhhhhhhjhthhhhih~hihih"i&ih ihhhh6iiihh%ihhh(i*ii#i!ihyiwi\ixikiTi~ini9iti=iYi0iai^i]iijiiiiiiiii[iiiii.jiiiiiiijji +kiiijijiji +jjj#jjDj jrj6jxjGjbjYjfjHj8j"jjjjjjj \ No newline at end of file diff --git a/crates/encoding/conversion_tables/9Fxx.dat b/crates/encoding/conversion_tables/9Fxx.dat new file mode 100644 index 0000000..227b782 --- /dev/null +++ b/crates/encoding/conversion_tables/9Fxx.dat @@ -0,0 +1,2 @@ +jjjjjjjjjjjjjjkjkk1k8k7kv9kGkCkIkPkYkTk[k_kakxkykkkkkkkkkkkkkkkkkkkkkkkkkkllll$l#l^lUlbljllllll~lhlsllllllllllllllllllmM6m+m=m8mm5m3mm mcmmdmZmymYmmmommn +nmmmmmmmmmmmmmmmmm-nnn.nnrn_n>n#nkn+nvnMnnCn:nNn$nnn8nnnnnnnnnnnnnnnnnAooLpnnn?on1on2on \ No newline at end of file diff --git a/crates/encoding/conversion_tables/E0xx.dat b/crates/encoding/conversion_tables/E0xx.dat new file mode 100644 index 0000000..67f51c7 --- /dev/null +++ b/crates/encoding/conversion_tables/E0xx.dat @@ -0,0 +1,2 @@ +>oonozoxooooo[oomoo|oXoooofoooooooooooooooo p popppopptoppp0p>p2pQpcppppppppppppp qpqqeqUqqfqbqLqVqlqqqqqqqqqqqqqqqqqqqqq rrr(r-r,r0r2r;rsNsOs؞Wsjshspsxsus{szsssssssssttot%ts2t:tUt?t_tYtAt\titptctjtvt~ttttttts \ No newline at end of file diff --git a/crates/encoding/conversion_tables/E1xx.dat b/crates/encoding/conversion_tables/E1xx.dat new file mode 100644 index 0000000..73cfeb8 --- /dev/null +++ b/crates/encoding/conversion_tables/E1xx.dat @@ -0,0 +1 @@ +ttttttttttuuu uu uuuu&u,uSQqneft_Ɂ́сف؁ȁځ߁ + )+83@YX]Z_dbhjk.qwx~߂҂ނ܂ ق5421@9PE/+#|su΃؃  " 8m*(ALONIV[Zk_lot}:A?HLNPUblxz|bȌڌ + N͌gmqsύڍ֍̍ۍˍߍ B504J \ No newline at end of file diff --git a/crates/encoding/conversion_tables/E7xx.dat b/crates/encoding/conversion_tables/E7xx.dat new file mode 100644 index 0000000..1502556 --- /dev/null +++ b/crates/encoding/conversion_tables/E7xx.dat @@ -0,0 +1,2 @@ +GILPHYd`*cUvr|ƎŎȎˎێ + &3;9EB>LIFNW\bcdڏ!  '659OPQRI>VX^hovr}Hbې20JVXceisrɑˑБ֑ߑۑ,^WEIdH?KPZϒD. \ No newline at end of file diff --git a/crates/encoding/conversion_tables/E8xx.dat b/crates/encoding/conversion_tables/E8xx.dat new file mode 100644 index 0000000..e6901ed --- /dev/null +++ b/crates/encoding/conversion_tables/E8xx.dat @@ -0,0 +1 @@ +"#:5;\`|nV֓דؓÓݓГȓ6+5!:ARD[`b^j)puw}Z|~ʕoÕ͕̕Օԕ֕ܕ!(./BLOKw\^]_frlΖ˖ɖ͖Mܖ Ֆ$*09=>DFHBI\`dfhRkqy|z×Ɨȗ˗ܗOz 8$!7=FOKkop \ No newline at end of file diff --git a/crates/encoding/conversion_tables/E9xx.dat b/crates/encoding/conversion_tables/E9xx.dat new file mode 100644 index 0000000..ad169e3 --- /dev/null +++ b/crates/encoding/conversion_tables/E9xx.dat @@ -0,0 +1,2 @@ +qtsĘØƘ !$ ,.=>BIEPKQRLUߙۙݙؙљ+7EB@C>UM[W_bedikjϚњӚԚޚߚ"#%'()*./2DCOMNQXtʛƛϛћқԛ:   +.%$!0G2F>Z`gvx *&#DA?>FH \ No newline at end of file diff --git a/crates/encoding/conversion_tables/EAxx.dat b/crates/encoding/conversion_tables/EAxx.dat new file mode 100644 index 0000000..772abe8 --- /dev/null +++ b/crates/encoding/conversion_tables/EAxx.dat @@ -0,0 +1 @@ +]^dQPYrozĝƝϝٝӝuy}a̞ΞϞОԞܞޞݞv!,>JRTc_`afgljwrv/XiYdtQq \ No newline at end of file diff --git a/crates/encoding/conversion_tables/EBxx.dat b/crates/encoding/conversion_tables/EBxx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/EBxx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/ECxx.dat b/crates/encoding/conversion_tables/ECxx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/ECxx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/EDxx.dat b/crates/encoding/conversion_tables/EDxx.dat new file mode 100644 index 0000000..402fe75 Binary files /dev/null and b/crates/encoding/conversion_tables/EDxx.dat differ diff --git a/crates/encoding/conversion_tables/EExx.dat b/crates/encoding/conversion_tables/EExx.dat new file mode 100644 index 0000000..1a74b3b Binary files /dev/null and b/crates/encoding/conversion_tables/EExx.dat differ diff --git a/crates/encoding/conversion_tables/EFxx.dat b/crates/encoding/conversion_tables/EFxx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/EFxx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F0xx.dat b/crates/encoding/conversion_tables/F0xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F0xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F1xx.dat b/crates/encoding/conversion_tables/F1xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F1xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F2xx.dat b/crates/encoding/conversion_tables/F2xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F2xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F3xx.dat b/crates/encoding/conversion_tables/F3xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F3xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F4xx.dat b/crates/encoding/conversion_tables/F4xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F4xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F5xx.dat b/crates/encoding/conversion_tables/F5xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F5xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F6xx.dat b/crates/encoding/conversion_tables/F6xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F6xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F7xx.dat b/crates/encoding/conversion_tables/F7xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F7xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F8xx.dat b/crates/encoding/conversion_tables/F8xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F8xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/F9xx.dat b/crates/encoding/conversion_tables/F9xx.dat new file mode 100644 index 0000000..3b5a3d9 --- /dev/null +++ b/crates/encoding/conversion_tables/F9xx.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/encoding/conversion_tables/FAxx.dat b/crates/encoding/conversion_tables/FAxx.dat new file mode 100644 index 0000000..8905dac Binary files /dev/null and b/crates/encoding/conversion_tables/FAxx.dat differ diff --git a/crates/encoding/conversion_tables/FBxx.dat b/crates/encoding/conversion_tables/FBxx.dat new file mode 100644 index 0000000..d13c1a6 --- /dev/null +++ b/crates/encoding/conversion_tables/FBxx.dat @@ -0,0 +1,2 @@ +mmmmmm9n\n'n> = OnceLock::new(); + +const EMPTY_TABLE: [u8; 512] = [0xFF; 512]; + +impl ConversionTable { + pub fn lookup(table: u8, idx: u8) -> u16 { + let lookup_idx = idx as usize * 2; + + u16::from_le_bytes( + Self::get_table(table)[lookup_idx..lookup_idx + 2] + .try_into() + .unwrap(), + ) + } + + pub fn rev_lookup(input: u16) -> u16 { + REVERSE_TABLE + .get_or_init(|| { + let mut map = HashMap::new(); + + let index_table = Self::get_table(0x00); + + for first_byte in 0x00u8..=0xFF { + let first_idx = first_byte as usize * 2; + let first_short = u16::from_le_bytes( + index_table[first_idx..first_idx + 2].try_into().unwrap(), + ); + + // Check if it needs a seondary lookup + if first_short == 0xFFFE { + let second_table = Self::get_table(first_byte); + + if second_table as *const [u8] == &EMPTY_TABLE as *const [u8] { + // It's the empty table. + continue; + } + + for second_byte in 0x00u8..=0xFF { + let second_idx = second_byte as usize * 2; + let second_short = u16::from_le_bytes( + second_table[second_idx..second_idx + 2].try_into().unwrap(), + ); + + if second_short == 0xFFFF { + // No conversion + continue; + } + + let value = u16::from_le_bytes([first_byte, second_byte]); + match map.entry(second_short) { + Entry::Occupied(mut occupied) => { + // Duplicate character conversion + occupied.insert(value); + } + Entry::Vacant(vacant) => { + vacant.insert(value); + } + } + } + } else if first_short == 0xFFFF { + // No conversion + continue; + } else { + let value = u16::from_le_bytes([0, first_byte]); + match map.entry(first_short) { + Entry::Occupied(mut occupied) => { + // Duplicate character conversion + occupied.insert(value); + } + Entry::Vacant(vacant) => { + vacant.insert(value); + } + } + } + } + map + }) + .get(&input) + .copied() + .unwrap_or_default() + } + + #[inline] + pub fn get_table(table: u8) -> &'static [u8] { + match table { + 0x00 => include_bytes!("../conversion_tables/00xx.dat"), + + 0x81 => include_bytes!("../conversion_tables/81xx.dat"), + 0x82 => include_bytes!("../conversion_tables/82xx.dat"), + 0x83 => include_bytes!("../conversion_tables/83xx.dat"), + 0x84 => include_bytes!("../conversion_tables/84xx.dat"), + 0x85 => include_bytes!("../conversion_tables/85xx.dat"), + 0x86 => include_bytes!("../conversion_tables/86xx.dat"), + 0x87 => include_bytes!("../conversion_tables/87xx.dat"), + 0x88 => include_bytes!("../conversion_tables/88xx.dat"), + 0x89 => include_bytes!("../conversion_tables/89xx.dat"), + 0x8A => include_bytes!("../conversion_tables/8Axx.dat"), + 0x8B => include_bytes!("../conversion_tables/8Bxx.dat"), + 0x8C => include_bytes!("../conversion_tables/8Cxx.dat"), + 0x8D => include_bytes!("../conversion_tables/8Dxx.dat"), + 0x8E => include_bytes!("../conversion_tables/8Exx.dat"), + 0x8F => include_bytes!("../conversion_tables/8Fxx.dat"), + + 0x90 => include_bytes!("../conversion_tables/90xx.dat"), + 0x91 => include_bytes!("../conversion_tables/91xx.dat"), + 0x92 => include_bytes!("../conversion_tables/92xx.dat"), + 0x93 => include_bytes!("../conversion_tables/93xx.dat"), + 0x94 => include_bytes!("../conversion_tables/94xx.dat"), + 0x95 => include_bytes!("../conversion_tables/95xx.dat"), + 0x96 => include_bytes!("../conversion_tables/96xx.dat"), + 0x97 => include_bytes!("../conversion_tables/97xx.dat"), + 0x98 => include_bytes!("../conversion_tables/98xx.dat"), + 0x99 => include_bytes!("../conversion_tables/99xx.dat"), + 0x9A => include_bytes!("../conversion_tables/9Axx.dat"), + 0x9B => include_bytes!("../conversion_tables/9Bxx.dat"), + 0x9C => include_bytes!("../conversion_tables/9Cxx.dat"), + 0x9D => include_bytes!("../conversion_tables/9Dxx.dat"), + 0x9E => include_bytes!("../conversion_tables/9Exx.dat"), + 0x9F => include_bytes!("../conversion_tables/9Fxx.dat"), + + 0xE0 => include_bytes!("../conversion_tables/E0xx.dat"), + 0xE1 => include_bytes!("../conversion_tables/E1xx.dat"), + 0xE2 => include_bytes!("../conversion_tables/E2xx.dat"), + 0xE3 => include_bytes!("../conversion_tables/E3xx.dat"), + 0xE4 => include_bytes!("../conversion_tables/E4xx.dat"), + 0xE5 => include_bytes!("../conversion_tables/E5xx.dat"), + 0xE6 => include_bytes!("../conversion_tables/E6xx.dat"), + 0xE7 => include_bytes!("../conversion_tables/E7xx.dat"), + 0xE8 => include_bytes!("../conversion_tables/E8xx.dat"), + 0xE9 => include_bytes!("../conversion_tables/E9xx.dat"), + 0xEA => include_bytes!("../conversion_tables/EAxx.dat"), + 0xEB => include_bytes!("../conversion_tables/EBxx.dat"), + 0xEC => include_bytes!("../conversion_tables/ECxx.dat"), + 0xED => include_bytes!("../conversion_tables/EDxx.dat"), + 0xEE => include_bytes!("../conversion_tables/EExx.dat"), + 0xEF => include_bytes!("../conversion_tables/EFxx.dat"), + + 0xF0 => include_bytes!("../conversion_tables/F0xx.dat"), + 0xF1 => include_bytes!("../conversion_tables/F1xx.dat"), + 0xF2 => include_bytes!("../conversion_tables/F2xx.dat"), + 0xF3 => include_bytes!("../conversion_tables/F3xx.dat"), + 0xF4 => include_bytes!("../conversion_tables/F4xx.dat"), + 0xF5 => include_bytes!("../conversion_tables/F5xx.dat"), + 0xF6 => include_bytes!("../conversion_tables/F6xx.dat"), + 0xF7 => include_bytes!("../conversion_tables/F7xx.dat"), + 0xF8 => include_bytes!("../conversion_tables/F8xx.dat"), + 0xF9 => include_bytes!("../conversion_tables/F9xx.dat"), + 0xFA => include_bytes!("../conversion_tables/FAxx.dat"), + 0xFB => include_bytes!("../conversion_tables/FBxx.dat"), + 0xFC => include_bytes!("../conversion_tables/FCxx.dat"), + _ => &EMPTY_TABLE, + } + } +} + +#[cfg(test)] +mod tests { + use crate::conversion_tables::ConversionTable; + + fn get_misc_conversions() -> Vec<((u8, u8), u16)> { + let mut u16_buffer = [0u16; 2]; + + vec![((0x8D, 0x92 / 2), '巧'.encode_utf16(&mut u16_buffer)[0])] + } + + #[test] + fn misc_conversions() { + get_misc_conversions() + .into_iter() + .for_each(|((first_byte, second_byte), short)| { + eprintln!("{:02X}", first_byte); + eprintln!("{:02X}", second_byte); + eprintln!("{:04X} {}", short, short); + + eprintln!("{:04X}", u16::from_le_bytes([second_byte, first_byte])); + eprintln!("{:04X}", u16::from_le_bytes([first_byte, second_byte])); + + assert_eq!( + ConversionTable::lookup(first_byte, second_byte), + short, + "failed lookup" + ); + assert_eq!( + ConversionTable::rev_lookup(short), + u16::from_le_bytes([first_byte, second_byte]), + "failed reverse lookup" + ); + }); + } +} diff --git a/crates/encoding/src/decoder.rs b/crates/encoding/src/decoder.rs new file mode 100644 index 0000000..d0f04ab --- /dev/null +++ b/crates/encoding/src/decoder.rs @@ -0,0 +1,484 @@ +use std::char::decode_utf16; + +use crate::{ + conversion_tables::ConversionTable, + encoder::Encoder, + named_bytes::{base_len_1, icon, prefix_01, prefix_7f_len_1}, + SPACE_U16, TAG_END_U16, TAG_PARAM_START_U16, TAG_PREFIX_U16, TAG_START_U16, +}; +use anyhow::Result; + +pub struct Decoder<'a> { + decoded_bytes: Vec, + source_bytes: &'a [u8], + idx: usize, + end_idx: usize, +} + +impl<'a> Decoder<'a> { + pub fn new(bytes: &'a [u8], _is_simple: bool) -> Self { + Self { + decoded_bytes: vec![], + source_bytes: bytes, + idx: 0, + end_idx: bytes.len(), + } + } +} + +impl<'a> Decoder<'a> { + pub fn decode_simple(bytes: &[u8]) -> Result { + Self::decode(bytes, true) + } + + pub fn decode_dialog(bytes: &[u8]) -> Result { + Self::decode(bytes, false) + } + + pub(crate) fn decode(bytes: &[u8], is_simple: bool) -> Result { + if bytes.is_empty() { + return Ok("".to_string()); + } + + let mut decoder = Decoder::new(bytes, is_simple); + if is_simple { + decoder.decode_all::(); + } else { + decoder.decode_all::(); + } + + // Convert the decoded bytes to a string via UTF-16 + let len = decoder.decoded_bytes.len() / 2; + let iter = (0..len).map(|i| { + u16::from_be_bytes([ + decoder.decoded_bytes[2 * i], + decoder.decoded_bytes[2 * i + 1], + ]) + }); + + let mut string = decode_utf16(iter).collect::>()?; + if !is_simple { + string = string.trim_end_matches(&['\n', '\0']).to_string(); + } + + // Verify re-encoding in debug mode + if false && cfg!(debug_assertions) { + // Figure out last index of the bytes, based on what it's expected to end with. + let last_idx: usize = if is_simple { + bytes + .iter() + .enumerate() + .rev() + .find_map(|(idx, byte)| if *byte != 0x00 { Some(idx + 1) } else { None }) + .unwrap_or(0) + } else { + bytes + .iter() + .enumerate() + .rev() + .find_map(|(idx, byte)| if *byte == 0x07 { Some(idx) } else { None }) + .unwrap_or(bytes.len() - 1) + + 1 + }; + + let bytes = &bytes[..last_idx]; + + let encoded_bytes = Encoder::encode(&string, is_simple)?; + + if encoded_bytes != bytes { + eprintln!( + "\n=====\nMismatch:\n{:?}\n\nOriginal: {:02X?}\nEncoded: {:02X?}", + string, bytes, encoded_bytes + ); + } + } + + Ok(string) + } + + fn decode_all(&mut self) { + while self.idx < self.end_idx { + let byte = self.get_at_offset(0); + + // Cases that extend by exactly 1 byte + if !IS_SIMPLE && self.can_extend(1) { + let tag = base_len_1::decode(byte); + if tag != "" { + self.make_byte_tag(tag, self.get_at_offset(1)); + self.idx += 2; + continue; + } + } + + if IS_SIMPLE && byte == 0x0A { + self.push_str("\n"); + self.idx += 1; + continue; + } + + if byte == 0xFD && self.can_extend(5) && self.get_at_offset(5) == 0xFD { + // TODO: Resource bytes? + self.make_hex_bytes_tag("resource", &self.source_bytes[self.idx..self.idx + 5]); + self.idx += 6; + continue; + } + + match byte { + 0x00 => { + // Check for ending sequence + if IS_SIMPLE || self.can_extend(1) && self.get_at_offset(1) == 0x07 { + break; + } + self.decoded_bytes.push(byte); + self.decoded_bytes.push(byte); + self.idx += 1; + } + + 0x01 if !IS_SIMPLE => { + self.idx += 1; + self.decode_01(); + } + + 0x02 => { + // Is usually at the start of a string. It removes the UI when used as a raw message in-game. + self.make_hex_bytes_tag("unknown", &self.source_bytes[self.idx..self.idx + 5]); + self.idx += 5; + } + + 0x07 => { + self.push_str("\n"); + self.idx += 1; + } + + 0x08 => { + self.tag_no_params("name-player"); + self.idx += 1; + } + + 0x09 => { + self.tag_no_params("name-npc"); + self.idx += 1; + } + + 0x0B => { + self.tag_no_params("selection-lines"); + self.push_str("\n"); + self.idx += 1; + } + + 0xEF => { + self.idx += 1; + self.decode_ef(); + } + + 0x7F if !IS_SIMPLE => { + self.idx += 1; + self.decode_7f(); + } + + 0..=0x19 => { + // This range seems to always extend one byte, + // so include it if possible. + self.tag_open_params("unknown"); + if self.can_extend(1) { + self.push_hex(&self.source_bytes[self.idx..self.idx + 2]); + self.idx += 2; + } else { + self.push_hex_byte(byte); + self.idx += 1; + } + self.tag_close(); + } + + _ => { + // Default to conversion table lookup + self.table_decode(); + } + } + } + } + + fn decode_7f(&mut self) { + let byte = self.get_at_offset(0); + + if self.can_extend(1) { + let tag = prefix_7f_len_1::decode(byte); + if tag != "" { + self.make_byte_tag(tag, self.get_at_offset(1)); + self.idx += 2; + return; + } + } + + match byte { + 0x31 => { + self.tag_no_params("prompt"); + + // Prompts are seemingly always followed by a 0x00 byte. + if !self.can_extend(1) || self.get_at_offset(1) != 0x00 { + eprintln!("Expected zero-byte after prompt (0x7F31)."); + } + self.idx += 2; + + // End immediately if prompt is followed by a newline + if self.can_extend(0) && self.get_at_offset(0) == 0x07 { + self.idx = self.end_idx; + } + } + + 0x38 if self.can_extend(2) => { + self.make_hex_bytes_tag("unknown", &self.source_bytes[self.idx - 1..self.idx + 3]); + self.idx += 3; + } + + 0x85 => { + self.tag_no_params("choice-player-gender"); + self.idx += 1; + } + + 0x93 => { + // Example uses: + // 0x7F93 has entered the hostel.0 + // Hi there! I'm 0x7F93, your friendly neighborhood smile sergeant! + self.tag_no_params("related-entity"); + self.idx += 1; + } + + _ if self.can_extend(1) => { + self.make_hex_bytes_tag("unknown", &self.source_bytes[self.idx - 1..self.idx + 2]); + self.idx += 2; + } + + _ => { + self.make_hex_bytes_tag("unknown", &self.source_bytes[self.idx - 1..self.idx + 1]); + self.idx += 1; + } + } + } + + // 0x01 blocks start with a length of the block, and then sub-blocks with endings inside it. + // After the length, the following bytes are XOR'd with 0x80. + // Example: [0x01, 0x08, 0x83, 0x81, 0x85, 0x80, 0x82, 0x93, 0x80, 0x80] + // ^id ^len ^type ^ ^ ^end ^2nd sub-block start + // | 1st value + // len of sub-block + fn decode_01(&mut self) { + let len = self.get_at_offset(0); + self.idx += 1; + + if self.can_extend(len as usize) { + let tag = prefix_01::decode(self.get_at_offset(0)); + + if tag != "" { + let block_bytes = &self.source_bytes[self.idx + 1..self.idx + len as usize]; + let mut values: Vec = vec![]; + let mut idx = 0; + + // Parse sub blocks + while idx < block_bytes.len() { + let sub_len = block_bytes[idx] ^ 0x80; + idx += 1; + let sub_block_bytes = match sub_len { + 1 => [block_bytes[idx] ^ 0x80, 0, 0, 0], + 2 => [block_bytes[idx] ^ 0x80, block_bytes[idx + 1] ^ 0x80, 0, 0], + 4 => [ + block_bytes[idx] ^ 0x80, + block_bytes[idx + 1] ^ 0x80, + block_bytes[idx + 2] ^ 0x80, + block_bytes[idx + 3] ^ 0x80, + ], + _ => { + eprintln!("Invalid sub block length {}", sub_len); + [0, 0, 0, 0] + } + }; + let value = u32::from_le_bytes(sub_block_bytes); + idx += sub_len as usize + 1; // Skip closing bytes as well. + values.push(format!("{}[{}]", value, sub_len)); + } + + if values.is_empty() { + self.tag_no_params(tag); + } else { + self.make_str_tag(tag, &values.join(", ")); + } + } else { + self.make_hex_bytes_tag( + "unknown", + &self.source_bytes[self.idx - 2..self.idx + len as usize], + ); + } + + self.idx += len as usize; + } else { + self.make_hex_bytes_tag("unknown", &self.source_bytes[self.idx - 2..self.idx + 1]); + self.idx += 1; + } + } + + // Icons + fn decode_ef(&mut self) { + let icon_name = icon::decode(self.get_at_offset(0)); + if icon_name != "" { + self.make_str_tag("icon", icon_name); + self.idx += 1; + } else { + self.make_hex_bytes_tag("icon", &self.source_bytes[self.idx - 1..self.idx + 1]); + self.idx += 1; + } + } + + #[inline] + fn can_extend(&self, amount: usize) -> bool { + self.idx + amount < self.end_idx + } + + #[inline] + fn get_at_offset(&self, offset: usize) -> u8 { + self.source_bytes[self.idx + offset] + } + + #[inline] + fn tag_open_params(&mut self, tag_name: &str) { + self.tag_open(tag_name); + self.decoded_bytes.extend(TAG_PARAM_START_U16); + self.decoded_bytes.extend(SPACE_U16); + } + + #[inline] + fn tag_open(&mut self, tag_name: &str) { + self.decoded_bytes.extend(TAG_PREFIX_U16); + self.decoded_bytes.extend(TAG_START_U16); + self.push_str(tag_name); + } + + #[inline] + fn tag_close(&mut self) { + self.decoded_bytes.extend(TAG_END_U16); + } + + #[inline] + fn tag_no_params(&mut self, tag_name: &str) { + self.tag_open(tag_name); + self.tag_close(); + } + + #[inline] + fn make_byte_tag(&mut self, tag: &str, byte: u8) { + self.tag_open_params(tag); + self.push_byte(byte); + self.tag_close(); + } + + #[inline] + fn make_hex_byte_tag(&mut self, tag: &str, byte: u8) { + self.tag_open_params(tag); + self.push_hex_byte(byte); + self.tag_close(); + } + + #[inline] + fn make_hex_bytes_tag(&mut self, tag: &str, bytes: &[u8]) { + self.tag_open_params(tag); + self.push_hex(bytes); + self.tag_close(); + } + + #[inline] + fn make_str_tag(&mut self, tag: &str, str: &str) { + self.tag_open_params(tag); + self.push_str(str); + self.tag_close(); + } + + #[inline] + fn push_str(&mut self, str: &str) { + self.decoded_bytes.extend( + str.encode_utf16() + .map(|codepoint| codepoint.to_be_bytes()) + .flatten(), + ); + } + + #[inline] + fn push_hex(&mut self, bytes: &[u8]) { + self.push_str("0x"); + for byte in bytes { + self.push_str(&format!("{:02X}", byte.clone())); + } + } + + #[inline] + fn push_hex_byte(&mut self, byte: u8) { + self.push_str(&format!("0x{:02X}", byte)); + } + + #[inline] + fn push_byte(&mut self, byte: u8) { + self.push_str(&format!("{}", byte)); + } + + fn table_decode(&mut self) { + debug_assert!(self.idx < self.end_idx); + + let first_byte = self.source_bytes[self.idx]; + self.idx += 1; + + let primary_table_value = ConversionTable::lookup(0, first_byte); + + if primary_table_value == 0xFFFE { + if self.idx >= self.end_idx { + self.make_hex_byte_tag("unknown-table-index", first_byte); + eprintln!("Missing index table: 0x{:02X}", first_byte); + return; + } + + // Look up second byte in the conversion table of the first byte + let second_byte = self.source_bytes[self.idx]; + self.idx += 1; + + let secondary_table_value = ConversionTable::lookup(first_byte, second_byte); + + if secondary_table_value == 0xFFFF { + eprintln!( + "Missing table lookup: 0x{:02X} 0x{:02X}", + first_byte, second_byte + ); + self.make_hex_bytes_tag("unknown-table-value", &[first_byte, second_byte]); + } else { + // Secondary table decoded character bytes + self.decoded_bytes + .extend(secondary_table_value.to_be_bytes()); + } + } else if primary_table_value == 0xFFFF { + // Unknown table lookup + self.make_hex_byte_tag("unknown-table", first_byte); + } else { + // Regular decoded character bytes + self.decoded_bytes.extend(primary_table_value.to_be_bytes()); + } + } +} + +#[cfg(test)] +mod tests { + use crate::tests::example_strings_for_encoding; + + use super::Decoder; + + #[test] + fn example_translations() { + for (bytes, string) in example_strings_for_encoding() { + assert_eq!(Decoder::decode_dialog(&bytes).unwrap(), string); + } + } + + #[test] + fn smoke() { + let x = ' ' as u32; + let y = unsafe { + char::from_u32_unchecked(u32::from_le_bytes([0, 0x30, 0, 0])).is_whitespace() + }; + eprintln!("{:08X} {}", x, y); + } +} diff --git a/crates/encoding/src/encoder.rs b/crates/encoding/src/encoder.rs new file mode 100644 index 0000000..e9a4912 --- /dev/null +++ b/crates/encoding/src/encoder.rs @@ -0,0 +1,420 @@ +use std::{iter::Peekable, str::CharIndices}; + +use crate::{ + conversion_tables::ConversionTable, + named_bytes::{base_len_1, icon, prefix_01, prefix_7f_len_1}, + TAG_END, TAG_PARAM_START, TAG_PREFIX, TAG_START, +}; +use anyhow::{anyhow, Result}; + +pub struct Encoder<'a> { + decoded_bytes: Vec, + source_str: &'a str, + source_chars: Peekable>, + had_prompt: bool, +} + +impl<'a> Encoder<'a> { + pub fn new(str: &'a str) -> Self { + Self { + decoded_bytes: vec![], + source_str: str, + source_chars: str.char_indices().peekable(), + had_prompt: false, + } + } +} + +impl<'a> Encoder<'a> { + pub fn encode_simple(string: &'a str) -> Result> { + Self::encode(string, true) + } + + pub fn encode_dialog(string: &'a str) -> Result> { + Self::encode(string, false) + } + + pub(crate) fn encode(string: &'a str, is_simple: bool) -> Result> { + let mut encoder = Encoder::new(string); + if is_simple { + encoder.encode_all::()?; + } else { + encoder.encode_all::()?; + } + + // Add end marker if needed + if !is_simple { + // Insert 0x00 if there's not been a prompt, and it doesn't + // already have one at the end (past any whitespaces). + if !encoder.had_prompt { + let ending_ws_idx = string.len() + - string + .chars() + .rev() + .take_while(|ch| ch.is_whitespace()) + .map(|ch| ch.len_utf8()) + .sum::(); + + if ending_ws_idx == 0 || string[..ending_ws_idx].chars().rev().next() != Some('\0') + { + encoder.decoded_bytes.push(0x00); + } + } + + encoder.decoded_bytes.push(0x07); + } + + Ok(encoder.decoded_bytes) + } + + fn encode_all(&mut self) -> Result<()> { + let mut u16_buffer = [0u16; 2]; + + while let Some((_, char)) = self.source_chars.next() { + match char { + TAG_PREFIX => { + // Check if it's a tag + if self + .source_chars + .peek() + .map(|(_, ch)| *ch == TAG_START) + .unwrap_or_default() + { + // Skip past the TAG_START and handle the tag + self.source_chars.next(); + self.handle_tag()?; + continue; + } + } + '\n' => { + self.decoded_bytes.push(if IS_SIMPLE { 0x0A } else { 0x07 }); + continue; + } + '\0' => { + self.decoded_bytes.push(0x00); + continue; + } + _ => {} + } + + // Lookup UTF-16 character in the reverse conversion table + let original_utf16_shorts = char.encode_utf16(&mut u16_buffer); + let converted_utf16_shorts = original_utf16_shorts + .iter() + .map(|short| ConversionTable::rev_lookup(*short)) + .collect::>(); + + let final_utf16_shorts = if converted_utf16_shorts.iter().all(|short| *short > 0) { + converted_utf16_shorts.as_ref() + } else { + original_utf16_shorts.as_ref() + }; + + // Convert UTF-16 characters to bytes + let u8_bytes = final_utf16_shorts + .iter() + .map(|u16| u16.to_le_bytes()) + .flatten() + .filter(|byte| *byte != 0); + self.decoded_bytes.extend(u8_bytes); + } + + Ok(()) + } + + #[inline] + fn parse_tag(&mut self) -> Result<(&'a str, &'a str)> { + let tag_start = self + .source_chars + .peek() + .map(|(idx, _)| *idx) + .unwrap_or_default(); + + // Parse tag name + let mut tag_end = tag_start; + while let Some((idx, char)) = self.source_chars.next() { + tag_end = idx; + + if char == TAG_END { + // Tag closed without params + return Ok((&self.source_str[tag_start..tag_end], &"")); + } else if char == TAG_PARAM_START { + // Tag indicates it has params + break; + } + } + + // Parse the params of the tag + let mut params_start = tag_end + 1; + + // Skip past any starting spaces + while let Some((_, ' ')) = self.source_chars.peek() { + params_start += 1; + self.source_chars.next(); + } + + // Parse content extent and tag closing character + let mut params_end = params_start; + while let Some((idx, char)) = self.source_chars.next() { + params_end = idx; + if char == TAG_END { + break; + } + } + + let res = Ok(( + &self.source_str[tag_start..tag_end], + &self.source_str[params_start..params_end], + )); + + res + } + + fn handle_tag(&mut self) -> Result<()> { + // Just got a TAG_START char + let (tag, content) = self.parse_tag()?; + + match tag { + "prompt" => { + self.decoded_bytes.extend([0x7F, 0x31, 0x00]); + self.had_prompt = true; + return Ok(()); + } + + "selection-lines" => { + self.decoded_bytes.push(0x0B); + // Skip one following newline if there is one, since it's inserted + // for increased readability during decoding. + if let Some((_, '\n')) = self.source_chars.peek() { + self.source_chars.next(); + } + return Ok(()); + } + + "name-player" => { + self.decoded_bytes.push(0x08); + return Ok(()); + } + + "name-npc" => { + self.decoded_bytes.push(0x09); + return Ok(()); + } + + "icon" => { + self.decoded_bytes.push(0xEF); + + if let Some(icon_byte) = icon::encode(content) { + self.decoded_bytes.push(icon_byte); + } else { + let bytes = (2..content.len()) + .step_by(2) + .map(|idx| u8::from_str_radix(&content[idx..idx + 2], 16).unwrap()); + + self.decoded_bytes.extend(bytes); + } + + return Ok(()); + } + + "choice-player-gender" => { + self.decoded_bytes.extend([0x7F, 0x85]); + return Ok(()); + } + + "related-entity" => { + self.decoded_bytes.extend([0x7F, 0x93]); + return Ok(()); + } + + "unknown" | "unknown-table" | "unknown-table-index" | "unknown-table-value" => { + let bytes = (2..content.len()) + .step_by(2) + .map(|idx| u8::from_str_radix(&content[idx..idx + 2], 16).unwrap()); + + self.decoded_bytes.extend(bytes); + return Ok(()); + } + + _ => {} + } + + if let Some(byte) = base_len_1::encode(tag) { + self.decoded_bytes.extend(&[byte, content.parse()?]); + + // + } else if let Some(byte) = prefix_7f_len_1::encode(tag) { + let Ok(param) = content.parse::() else { + return Err(anyhow!( + "Failed to parse parameter '{}' at '{}'", + content, + tag + )); + }; + + self.decoded_bytes.extend(&[0x7F, byte, param]); + + // + } else if let Some(byte) = prefix_01::encode(tag) { + if content.len() == 0 { + self.decoded_bytes.extend(&[0x01, 0x01, byte]); + } else { + let parameters = content + .split(',') + .filter_map(|param| { + let parsed_param = Self::parse_param_with_length(param); + if parsed_param.is_none() { + eprintln!("Could not parse param of tag '{}': {}", tag, param); + } + parsed_param + }) + .collect::>(); + + let parameters_len: u32 = parameters.iter().map(|(_, size)| size + 2).sum(); + + let param_bytes = parameters + .into_iter() + .map(|(value, len)| { + std::iter::once(len as u8) + .chain(value.to_le_bytes()[..len as usize].iter().copied()) + .chain(std::iter::once(0)) + .map(|byte| byte ^ 0x80) + .collect::>() + }) + .flatten() + .collect::>(); + + self.decoded_bytes + .extend(&[0x01, 1 + parameters_len as u8, byte]); + self.decoded_bytes.extend(param_bytes); + } + } else { + // Unhandled tag + eprintln!("Unhandled tag and content: {} {}", tag, content); + } + + Ok(()) + } + + fn parse_param_with_length(param: &str) -> Option<(u32, u32)> { + let mut param_iter = param.char_indices().peekable(); + + // Skip whitespaces + while let Some((_, ch)) = param_iter.peek() { + if !ch.is_whitespace() { + break; + } + param_iter.next(); + } + + // Extract first value + let value_start_idx = param_iter.next()?.0; + while let Some((_, ch)) = param_iter.peek() { + if !ch.is_numeric() { + break; + } + param_iter.next(); + } + let value_end_idx = param_iter + .peek() + .map(|(idx, _)| *idx) + .unwrap_or_else(|| param.len()); + + let value = param[value_start_idx..value_end_idx].parse::().ok()?; + + // Skip more whitespaces + while let Some((_, ch)) = param_iter.peek() { + if !ch.is_whitespace() { + break; + } + param_iter.next(); + } + + // Expect opening bracket + if let Some((_, ch)) = param_iter.next() { + if ch != '[' { + return None; + } + } + + // Extract value byte length + let len_start_idx = param_iter.next()?.0; + while let Some((_, ch)) = param_iter.peek() { + if !ch.is_numeric() { + break; + } + param_iter.next(); + } + let len_end_idx = param_iter + .peek() + .map(|(idx, _)| *idx) + .unwrap_or_else(|| param.len()); + + let len = param[len_start_idx..len_end_idx].parse::().ok()?; + + // Expect closing bracket + if let Some((_, ch)) = param_iter.next() { + if ch != ']' { + return None; + } + } + + Some((value, len)) + } +} + +#[cfg(test)] +mod tests { + + use crate::{decoder::Decoder, encoder::Encoder, tests::example_strings_for_encoding}; + use pretty_assertions::assert_eq; + + #[test] + fn example_translations() { + for (bytes, string) in example_strings_for_encoding() { + assert_eq!(Encoder::encode_dialog(string).unwrap(), bytes); + } + } + + fn check_encoding_and_roundtrip(bytes: &[u8], string: &str, message: &str) { + assert_eq!( + Encoder::encode_dialog(string).unwrap(), + bytes, + "{}", + message + ); + assert_eq!( + Encoder::encode_dialog(&Decoder::decode_dialog(&bytes).unwrap()).unwrap(), + bytes, + "{} (round-trip)", + message + ); + } + + #[test] + fn ending_characters() { + check_encoding_and_roundtrip(&[0x00, 0x07], "", "empty string"); + + check_encoding_and_roundtrip( + &[0x21, 0x07, 0x20, 0x00, 0x07], + "!\n ", + "newlines and spaces", + ); + + check_encoding_and_roundtrip( + &[0x81, 0x40, 0x00, 0x07], + "\u{3000}", + "just invisible space", + ); + + check_encoding_and_roundtrip(&[0x20, 0x20, 0x20, 0x00, 0x07], " ", "triple space"); + + check_encoding_and_roundtrip( + &[0x7F, 0x31, 0x00, 0x20, 0x07], + "${prompt} ", + "prompt and space", + ); + + check_encoding_and_roundtrip(&[0x7F, 0x31, 0x00, 0x07], "${prompt}", "prompt"); + } +} diff --git a/crates/encoding/src/lib.rs b/crates/encoding/src/lib.rs new file mode 100644 index 0000000..5725acf --- /dev/null +++ b/crates/encoding/src/lib.rs @@ -0,0 +1,48 @@ +mod conversion_tables; +pub mod decoder; +pub mod encoder; +mod named_bytes; + +const TAG_PREFIX: char = '$'; +const TAG_START: char = '{'; +const TAG_END: char = '}'; +const TAG_PARAM_START: char = ':'; + +const TAG_PREFIX_U16: [u8; 2] = (TAG_PREFIX as u16).to_be_bytes(); +const TAG_START_U16: [u8; 2] = (TAG_START as u16).to_be_bytes(); +const TAG_END_U16: [u8; 2] = (TAG_END as u16).to_be_bytes(); +const TAG_PARAM_START_U16: [u8; 2] = (TAG_PARAM_START as u16).to_be_bytes(); +const SPACE_U16: [u8; 2] = (' ' as u16).to_be_bytes(); + +#[cfg(test)] +mod tests { + + pub(crate) fn example_strings_for_encoding() -> Vec<(&'static [u8], &'static str)> { + vec![ + (&[ + 67, 97, 110, 32, 121, 97, 32, 105, 109, 97, 103, 105, 110, 101, 32, 105, 116, 44, 32, + 8, 63, 7, 10, 1, 1, 5, 37, 130, 128, 128, 128, 46, 46, 46, 127, 49, 0, 7, + ], + "Can ya imagine it, ${name-player}?\n${number: 1}${item-plural: 0[2]}...${prompt}" + ), + + (&[ + 87, 104, 97, 116, 32, 100, 111, 32, 121, 111, 117, 32, 115, 112, 101, 97, 107, 32, 111, + 102, 63, 7, 11, 82, 97, 122, 102, 97, 104, 100, 39, 115, 32, 109, 101, 115, 115, 97, + 103, 101, 46, 7, 82, 101, 99, 101, 110, 116, 32, 101, 118, 101, 110, 116, 115, 46, 127, 49, 0, 7 + ], + "What do you speak of?\n${selection-lines}\nRazfahd's message.\nRecent events.${prompt}" + ), + + (&[ + 83, 112, 101, 97, 107, 32, 121, 111, 117, 114, 32, 100, 101, 115, 105, 114, 101, 46, 46, 46, 7, 11, 127, 128, 1, 1, 1, 1, 32, 1, 5, 36, 130, 128, 128, 128, 46, 7, 127, 128, 1, 1, 1, 1, 32, 1, 5, 36, 130, 129, 128, 128, 46, 7, 127, 128, 1, 1, 1, 1, 32, 1, 5, 36, 130, 130, 128, 128, 46, 7, 67, 111, 108, 100, 44, 32, 104, 97, 114, 100, 32, 103, 105, 108, 46, 7, 65, 32, 112, 97, 99, 116, 32, 119, 105, 116, 104, 32, 65, 108, 101, 120, 97, 110, 100, 101, 114, 46, 127, 49, 0, 7 + ], + "Speak your desire...\n${selection-lines}\n${lettercase: 1}${article} ${item-article: 0[2]}.\n${lettercase: 1}${article} ${item-article: 1[2]}.\n${lettercase: 1}${article} ${item-article: 2[2]}.\nCold, hard gil.\nA pact with Alexander.${prompt}" + ), + + (&[131, 84, 129, 91, 131, 111, 129, 91, 145, 164, 130, 197, 130, 183, 129, 66, 7, 142, 99, 130, 232, 131, 76, 131, 109, 131, 82, 143, 138, 142, 157, 144, 148, 130, 205, 10, 1, 150, 123, 129, 65, 7, 150, 129, 130, 162, 130, 189, 137, 241, 144, 148, 130, 205, 10, 0, 137, 241, 130, 201, 130, 200, 130, 193, 130, 196, 130, 162, 130, 220, 130, 183, 129, 66, 127, 49, 0, 7], + "サーバー側です。\n残りキノコ所持数は${number: 1}本、\n磨いた回数は${number: 0}回になっています。${prompt}" + ) + ] + } +} diff --git a/crates/encoding/src/named_bytes.rs b/crates/encoding/src/named_bytes.rs new file mode 100644 index 0000000..0acc3cc --- /dev/null +++ b/crates/encoding/src/named_bytes.rs @@ -0,0 +1,98 @@ +#[macro_export] +macro_rules! name_bytes { + ($modname:ident, + $( $byte:expr => $tag:expr, )* + ) => { + pub(crate) mod $modname { + #[inline] + pub(crate) fn decode<'a>(input: u8) -> &'static str { + match input { + $( $byte => $tag, )* + _ => "" + } + } + + #[inline] + pub(crate) fn encode(input: &str) -> Option { + match input { + $( $tag => Some($byte), )* + _ => None + } + } + } + }; +} + +name_bytes!(base_len_1, + 0x0A => "number", + 0x0C => "choice", + 0x0E => "sound", + 0x11 => "spell", + 0x18 => "player", + 0x19 => "item", + 0x1A => "skill", + 0x1C => "entity", + 0x1E => "color", + 0x1F => "color-alt", +); + +name_bytes!(prefix_7f_len_1, + 0x34 => "wait-animation", + 0x35 => "wait-35", + 0x36 => "wait-36", + 0x80 => "lettercase", + 0x8D => "weather-event", + 0x8E => "weather-type", + 0x92 => "choice-plurality", + 0x94 => "number-alt", + 0xB1 => "title-alt", + 0xA0 => "ts-year", + 0xA1 => "ts-month", + 0xA2 => "ts-day", + 0xA3 => "ts-hour", + 0xA9 => "ts-minute", + 0xAA => "ts-second", + 0xAB => "earthtime", + 0xAC => "vanatime", +); + +name_bytes!(prefix_01, + 0x01 => "article", + 0x03 => "item-count", + 0x12 => "title", + 0x17 => "weather-adjective", + 0x18 => "weather-noun", + 0x23 => "item-singular", + 0x24 => "item-article", + 0x25 => "item-plural", + 0x29 => "item-given-plurality", + 0x33 => "keyitem-singular", + 0x35 => "keyitem-plural", + 0x36 => "keyitem-article", + 0x38 => "zone", + 0x83 => "mission", +); + +name_bytes!(icon, + // Elements + 0x1F => "fire", + 0x20 => "ice", + 0x21 => "wind", + 0x22 => "earth", + 0x23 => "lightning", + 0x24 => "water", + 0x25 => "light", + 0x26 => "dark", + + // Auto-translate braces + 0x27 => "at-open", + 0x28 => "at-close", + + // On/off + 0x29 => "on", + 0x2A => "off", + 0x2B => "oui", + 0x2C => "non", + 0x2D => "ein", + 0x2E => "aus", +); diff --git a/crates/processor/Cargo.toml b/crates/processor/Cargo.toml new file mode 100644 index 0000000..ce3a2ac --- /dev/null +++ b/crates/processor/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "processor" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.71" +thiserror = "1.0.35" +dats = { path = "../dats" } +threadpool = "1.8.1" +serde = "1.0.180" +serde_yaml = "0.9.25" +specta = "1.0.5" +tokio = { version = "1.29.1", features = ["full"] } diff --git a/crates/processor/src/converters.rs b/crates/processor/src/converters.rs new file mode 100644 index 0000000..705b4f4 --- /dev/null +++ b/crates/processor/src/converters.rs @@ -0,0 +1,72 @@ +use std::{ + fs::{self, File}, + io::{BufReader, BufWriter, Write}, + path::PathBuf, + sync::Arc, +}; + +use anyhow::{anyhow, Result}; +use dats::{base::Dat, context::DatContext, dat_format::DatFormat}; +use serde::Serialize; + +use crate::dat_descriptor::DatUsage; + +pub(crate) struct DatToYamlConverter { + pub dat_context: Arc, + pub raw_data_path: PathBuf, +} + +impl DatUsage for DatToYamlConverter { + fn use_dat serde::Deserialize<'b>>( + self, + dat: Dat, + ) -> Result<()> { + let data = self.dat_context.get_data_from_dat(&dat)?; + + fs::create_dir_all(&self.raw_data_path.parent().unwrap())?; + let file = File::create(&self.raw_data_path).map_err(|err| { + anyhow!( + "Could not create at file {}: {}", + self.raw_data_path.display(), + err + ) + })?; + + serde_yaml::to_writer(BufWriter::new(file), &data)?; + + Ok(()) + } +} + +pub(crate) struct YamlToDatConverter { + pub dat_context: Arc, + pub raw_data_path: PathBuf, + pub dat_root_path: PathBuf, +} + +impl DatUsage for YamlToDatConverter { + fn use_dat serde::Deserialize<'a>>( + self, + dat: Dat, + ) -> Result<()> { + let relative_dat_path = dat.get_relative_dat_path(&self.dat_context)?; + let dat_path = self.dat_root_path.join(relative_dat_path); + + fs::create_dir_all(&dat_path.parent().unwrap())?; + let mut dat_file = File::create(&dat_path) + .map_err(|err| anyhow!("Could not create file at {}: {}", dat_path.display(), err))?; + + let raw_data_file = File::open(&self.raw_data_path).map_err(|err| { + anyhow!( + "Could open file at {}: {}", + self.raw_data_path.display(), + err + ) + })?; + let data: T = serde_yaml::from_reader(BufReader::new(raw_data_file))?; + + dat_file.write_all(&data.to_bytes()?)?; + + Ok(()) + } +} diff --git a/crates/processor/src/dat_descriptor.rs b/crates/processor/src/dat_descriptor.rs new file mode 100644 index 0000000..5f75986 --- /dev/null +++ b/crates/processor/src/dat_descriptor.rs @@ -0,0 +1,361 @@ +use anyhow::{anyhow, Result}; +use std::{path::PathBuf, sync::Arc}; + +use dats::{ + base::{Dat, ZoneId}, + context::DatContext, + dat_format::DatFormat, + id_mapping::DatIdMapping, +}; +use serde::{Deserialize, Serialize}; + +use crate::converters::{DatToYamlConverter, YamlToDatConverter}; + +#[derive( + Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, specta::Type, Serialize, Deserialize, +)] +#[serde(tag = "type", content = "index")] +pub enum DatDescriptor { + AbilityNames, + AbilityDescriptions, + AreaNames, + AreaNamesAlt, + CharacterSelect, + ChatFilterTypes, + DayNames, + Directions, + EquipmentLocations, + ErrorMessages, + IngameMessages1, + IngameMessages2, + JobNames, + KeyItems, + MenuItemsDescription, + MenuItemsText, + MoonPhases, + PolMessages, + RaceNames, + RegionNames, + SpellNames, + SpellDescriptions, + StatusInfo, + StatusNames, + TimeAndPronouns, + Titles, + Misc1, + Misc2, + WeatherTypes, + + // Item data + Armor, + Armor2, + Currency, + GeneralItems, + GeneralItems2, + PuppetItems, + UsableItems, + Weapons, + VouchersAndSlips, + Monipulator, + Instincts, + + // Dats by zone + EntityNames(ZoneId), + Dialog(ZoneId), + Dialog2(ZoneId), +} + +pub trait DatUsage { + fn use_dat serde::Deserialize<'a>>( + self, + dat: Dat, + ) -> Result<()>; +} + +impl DatDescriptor { + pub fn dat_to_yaml( + &self, + dat_context: Arc, + raw_data_root_path: PathBuf, + ) -> Result<()> { + let data_path = raw_data_root_path.join(self.get_relative_path(&dat_context)? + ".yml"); + self.convert_with(DatToYamlConverter { + dat_context, + raw_data_path: data_path, + }) + } + + pub fn yaml_to_dat( + &self, + dat_context: Arc, + raw_data_root_path: PathBuf, + dat_root_path: PathBuf, + ) -> Result<()> { + let raw_data_path = raw_data_root_path.join(self.get_relative_path(&dat_context)? + ".yml"); + self.convert_with(YamlToDatConverter { + dat_context, + raw_data_path, + dat_root_path, + }) + } + + fn get_zoned_file_name( + dat_context: &DatContext, + dir_name: &'static str, + zone_id: &u16, + ) -> Result { + Ok(format!( + "{}/{}", + dir_name, + dat_context + .zone_id_to_name + .get(&zone_id) + .ok_or(anyhow!("No zone name found for zone ID."))? + .file_name + )) + } + + fn get_relative_path(&self, dat_context: &DatContext) -> Result { + match self { + DatDescriptor::AbilityNames => Ok("ability_names".to_string()), + DatDescriptor::AbilityDescriptions => Ok("ability_descriptions".to_string()), + DatDescriptor::AreaNames => Ok("area_names".to_string()), + DatDescriptor::AreaNamesAlt => Ok("area_names_alt".to_string()), + DatDescriptor::CharacterSelect => Ok("character_select".to_string()), + DatDescriptor::ChatFilterTypes => Ok("chat_filter_types".to_string()), + DatDescriptor::DayNames => Ok("day_names".to_string()), + DatDescriptor::Directions => Ok("directions".to_string()), + DatDescriptor::EquipmentLocations => Ok("equipment_locations".to_string()), + DatDescriptor::ErrorMessages => Ok("error_messages".to_string()), + DatDescriptor::IngameMessages1 => Ok("ingame_messages1".to_string()), + DatDescriptor::IngameMessages2 => Ok("ingame_messages2".to_string()), + DatDescriptor::JobNames => Ok("job_names".to_string()), + DatDescriptor::KeyItems => Ok("key_items".to_string()), + DatDescriptor::MenuItemsDescription => Ok("menu_items_description".to_string()), + DatDescriptor::MenuItemsText => Ok("menu_items_text".to_string()), + DatDescriptor::MoonPhases => Ok("moon_phases".to_string()), + DatDescriptor::PolMessages => Ok("pol_messages".to_string()), + DatDescriptor::RaceNames => Ok("race_names".to_string()), + DatDescriptor::RegionNames => Ok("region_names".to_string()), + DatDescriptor::SpellNames => Ok("spell_names".to_string()), + DatDescriptor::SpellDescriptions => Ok("spell_descriptions".to_string()), + DatDescriptor::StatusInfo => Ok("status_info".to_string()), + DatDescriptor::StatusNames => Ok("status_names".to_string()), + DatDescriptor::TimeAndPronouns => Ok("time_and_pronouns".to_string()), + DatDescriptor::Titles => Ok("titles".to_string()), + DatDescriptor::Misc1 => Ok("misc1".to_string()), + DatDescriptor::Misc2 => Ok("misc2".to_string()), + DatDescriptor::WeatherTypes => Ok("weather_types".to_string()), + + DatDescriptor::Armor => Ok("items/armor".to_string()), + DatDescriptor::Armor2 => Ok("items/armor2".to_string()), + DatDescriptor::Currency => Ok("items/currency".to_string()), + DatDescriptor::GeneralItems => Ok("items/general_items".to_string()), + DatDescriptor::GeneralItems2 => Ok("items/general_items2".to_string()), + DatDescriptor::PuppetItems => Ok("items/puppet_items".to_string()), + DatDescriptor::UsableItems => Ok("items/usable_items".to_string()), + DatDescriptor::Weapons => Ok("items/weapons".to_string()), + DatDescriptor::VouchersAndSlips => Ok("items/vouchers_and_slips".to_string()), + DatDescriptor::Monipulator => Ok("items/monipulator".to_string()), + DatDescriptor::Instincts => Ok("items/instincts".to_string()), + + DatDescriptor::EntityNames(zone_id) => { + Self::get_zoned_file_name(dat_context, "entity_names", zone_id) + } + DatDescriptor::Dialog(zone_id) => { + Self::get_zoned_file_name(dat_context, "dialog", zone_id) + } + DatDescriptor::Dialog2(zone_id) => { + Self::get_zoned_file_name(dat_context, "dialog2", zone_id) + } + } + } + + fn get_zone_id(zone_dir_name: &str, dat_context: &DatContext) -> Option { + dat_context.zone_name_to_id_map.get(zone_dir_name).copied() + } + + pub fn from_path( + path: &PathBuf, + raw_data_dir: &PathBuf, + dat_context: &DatContext, + ) -> Option { + let path = path.strip_prefix(raw_data_dir).unwrap_or(path); + + let file_name = path + .file_name() + .and_then(|osstr| osstr.to_str()) + .map(|s| s.trim_end_matches(".yml"))?; + + if let Some(parent) = path + .parent() + .and_then(|p| p.file_name()) + .and_then(|osstr| osstr.to_str()) + { + // Files in sub-directories + return match parent { + "entity_names" => { + Self::get_zone_id(file_name, dat_context).map(DatDescriptor::EntityNames) + } + "dialog" => Self::get_zone_id(file_name, dat_context).map(DatDescriptor::Dialog), + "dialog2" => Self::get_zone_id(file_name, dat_context).map(DatDescriptor::Dialog2), + + "items" => match file_name { + "armor" => Some(DatDescriptor::Armor), + "armor2" => Some(DatDescriptor::Armor2), + "currency" => Some(DatDescriptor::Currency), + "general_items" => Some(DatDescriptor::GeneralItems), + "general_items2" => Some(DatDescriptor::GeneralItems2), + "puppet_items" => Some(DatDescriptor::PuppetItems), + "usable_items" => Some(DatDescriptor::UsableItems), + "weapons" => Some(DatDescriptor::Weapons), + "vouchers_and_slips" => Some(DatDescriptor::VouchersAndSlips), + "monipulator" => Some(DatDescriptor::Monipulator), + "instincts" => Some(DatDescriptor::Instincts), + _ => None, + }, + _ => { + println!("Parent is: {}", parent); + None + } + }; + } + + // Files in root directory + match file_name { + "ability_names" => Some(DatDescriptor::AbilityNames), + "ability_descriptions" => Some(DatDescriptor::AbilityDescriptions), + "area_names" => Some(DatDescriptor::AreaNames), + "area_names_alt" => Some(DatDescriptor::AreaNamesAlt), + "character_select" => Some(DatDescriptor::CharacterSelect), + "chat_filter_types" => Some(DatDescriptor::ChatFilterTypes), + "day_names" => Some(DatDescriptor::DayNames), + "directions" => Some(DatDescriptor::Directions), + "equipment_locations" => Some(DatDescriptor::EquipmentLocations), + "error_messages" => Some(DatDescriptor::ErrorMessages), + "ingame_messages1" => Some(DatDescriptor::IngameMessages1), + "ingame_messages2" => Some(DatDescriptor::IngameMessages2), + "job_names" => Some(DatDescriptor::JobNames), + "key_items" => Some(DatDescriptor::KeyItems), + "menu_items_description" => Some(DatDescriptor::MenuItemsDescription), + "menu_items_text" => Some(DatDescriptor::MenuItemsText), + "moon_phases" => Some(DatDescriptor::MoonPhases), + "pol_messages" => Some(DatDescriptor::PolMessages), + "race_names" => Some(DatDescriptor::RaceNames), + "region_names" => Some(DatDescriptor::RegionNames), + "spell_names" => Some(DatDescriptor::SpellNames), + "spell_descriptions" => Some(DatDescriptor::SpellDescriptions), + "status_info" => Some(DatDescriptor::StatusInfo), + "status_names" => Some(DatDescriptor::StatusNames), + "time_and_pronouns" => Some(DatDescriptor::TimeAndPronouns), + "titles" => Some(DatDescriptor::Titles), + "misc1" => Some(DatDescriptor::Misc1), + "misc2" => Some(DatDescriptor::Misc2), + "weather_types" => Some(DatDescriptor::WeatherTypes), + + _ => None, + } + } + + fn convert_with(self, converter: T) -> Result<()> { + match self { + DatDescriptor::AbilityNames => { + converter.use_dat(DatIdMapping::get().ability_names.clone()) + } + DatDescriptor::AbilityDescriptions => { + converter.use_dat(DatIdMapping::get().ability_descriptions.clone()) + } + DatDescriptor::AreaNames => converter.use_dat(DatIdMapping::get().area_names.clone()), + DatDescriptor::AreaNamesAlt => { + converter.use_dat(DatIdMapping::get().area_names_alt.clone()) + } + DatDescriptor::CharacterSelect => { + converter.use_dat(DatIdMapping::get().character_select.clone()) + } + DatDescriptor::ChatFilterTypes => { + converter.use_dat(DatIdMapping::get().chat_filter_types.clone()) + } + DatDescriptor::DayNames => converter.use_dat(DatIdMapping::get().day_names.clone()), + DatDescriptor::Directions => converter.use_dat(DatIdMapping::get().directions.clone()), + DatDescriptor::EquipmentLocations => { + converter.use_dat(DatIdMapping::get().equipment_locations.clone()) + } + DatDescriptor::ErrorMessages => { + converter.use_dat(DatIdMapping::get().error_messages.clone()) + } + DatDescriptor::IngameMessages1 => { + converter.use_dat(DatIdMapping::get().ingame_messages_1.clone()) + } + DatDescriptor::IngameMessages2 => { + converter.use_dat(DatIdMapping::get().ingame_messages_2.clone()) + } + DatDescriptor::JobNames => converter.use_dat(DatIdMapping::get().job_names.clone()), + DatDescriptor::KeyItems => converter.use_dat(DatIdMapping::get().key_items.clone()), + DatDescriptor::MenuItemsDescription => { + converter.use_dat(DatIdMapping::get().menu_items_description.clone()) + } + DatDescriptor::MenuItemsText => { + converter.use_dat(DatIdMapping::get().menu_items_text.clone()) + } + DatDescriptor::MoonPhases => converter.use_dat(DatIdMapping::get().moon_phases.clone()), + DatDescriptor::PolMessages => { + converter.use_dat(DatIdMapping::get().pol_messages.clone()) + } + DatDescriptor::RaceNames => converter.use_dat(DatIdMapping::get().race_names.clone()), + DatDescriptor::RegionNames => { + converter.use_dat(DatIdMapping::get().region_names.clone()) + } + DatDescriptor::SpellNames => converter.use_dat(DatIdMapping::get().spell_names.clone()), + DatDescriptor::SpellDescriptions => { + converter.use_dat(DatIdMapping::get().spell_descriptions.clone()) + } + DatDescriptor::StatusInfo => converter.use_dat(DatIdMapping::get().status_info.clone()), + DatDescriptor::StatusNames => { + converter.use_dat(DatIdMapping::get().status_names.clone()) + } + DatDescriptor::TimeAndPronouns => { + converter.use_dat(DatIdMapping::get().time_and_pronouns.clone()) + } + DatDescriptor::Titles => converter.use_dat(DatIdMapping::get().titles.clone()), + DatDescriptor::Misc1 => converter.use_dat(DatIdMapping::get().misc1.clone()), + DatDescriptor::Misc2 => converter.use_dat(DatIdMapping::get().misc2.clone()), + DatDescriptor::WeatherTypes => { + converter.use_dat(DatIdMapping::get().weather_types.clone()) + } + + DatDescriptor::Armor => converter.use_dat(DatIdMapping::get().armor.clone()), + DatDescriptor::Armor2 => converter.use_dat(DatIdMapping::get().armor2.clone()), + DatDescriptor::Currency => converter.use_dat(DatIdMapping::get().currency.clone()), + DatDescriptor::GeneralItems => { + converter.use_dat(DatIdMapping::get().general_items.clone()) + } + DatDescriptor::GeneralItems2 => { + converter.use_dat(DatIdMapping::get().general_items2.clone()) + } + DatDescriptor::PuppetItems => { + converter.use_dat(DatIdMapping::get().puppet_items.clone()) + } + DatDescriptor::UsableItems => { + converter.use_dat(DatIdMapping::get().usable_items.clone()) + } + DatDescriptor::Weapons => converter.use_dat(DatIdMapping::get().weapons.clone()), + DatDescriptor::VouchersAndSlips => { + converter.use_dat(DatIdMapping::get().vouchers_and_slips.clone()) + } + DatDescriptor::Monipulator => { + converter.use_dat(DatIdMapping::get().monipulator.clone()) + } + DatDescriptor::Instincts => converter.use_dat(DatIdMapping::get().instincts.clone()), + + DatDescriptor::EntityNames(zone_id) => { + converter.use_dat(DatIdMapping::get().entities.get_result(&zone_id)?.clone()) + } + DatDescriptor::Dialog(zone_id) => { + converter.use_dat(DatIdMapping::get().dialog.get_result(&zone_id)?.clone()) + } + DatDescriptor::Dialog2(zone_id) => { + converter.use_dat(DatIdMapping::get().dialog.get_result(&zone_id)?.clone()) + } + } + } +} diff --git a/crates/processor/src/lib.rs b/crates/processor/src/lib.rs new file mode 100644 index 0000000..8fa6b6d --- /dev/null +++ b/crates/processor/src/lib.rs @@ -0,0 +1,3 @@ +mod converters; +pub mod dat_descriptor; +pub mod processor; diff --git a/crates/processor/src/processor.rs b/crates/processor/src/processor.rs new file mode 100644 index 0000000..9c65c03 --- /dev/null +++ b/crates/processor/src/processor.rs @@ -0,0 +1,121 @@ +use std::{ + path::PathBuf, + sync::{mpsc::SyncSender, Arc, Mutex}, +}; + +use crate::dat_descriptor::DatDescriptor; +use dats::context::DatContext; +use serde::{Deserialize, Serialize}; +use threadpool::ThreadPool; + +#[derive(Debug)] +pub struct DatProcessor { + tx: SyncSender, + pool: Mutex, +} + +#[derive(Debug, Clone, specta::Type, Serialize, Deserialize)] +pub struct DatProcessorMessage { + pub dat_descriptor: DatDescriptor, + pub output_kind: DatProcessorOutputKind, + pub state: DatProcessingState, +} + +#[derive(Debug, Clone, specta::Type, Serialize, Deserialize)] +pub enum DatProcessorOutputKind { + Dat, + Yaml, +} + +#[derive(Debug, Clone, specta::Type, Serialize, Deserialize)] +pub enum DatProcessingState { + Working, + Finished, + Error(String), +} + +impl DatProcessor { + pub fn new(tx: SyncSender) -> Self { + Self { + tx, + pool: Mutex::new( + threadpool::Builder::new() + .thread_name("dat-processor".to_string()) + .build(), + ), + } + } + + pub fn dat_to_yaml( + &self, + dat_descriptor: DatDescriptor, + dat_context: Arc, + raw_data_root_path: PathBuf, + ) { + let tx = self.tx.clone(); + let start_message = DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Yaml, + state: DatProcessingState::Working, + }; + if let Err(err) = tx.send(start_message) { + eprintln!("Failed to notify about DAT to YAML start: {err}"); + } + + self.pool.lock().unwrap().execute(move || { + let res = dat_descriptor + .dat_to_yaml(dat_context, raw_data_root_path) + .map(|_| DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Yaml, + state: DatProcessingState::Finished, + }) + .unwrap_or_else(|err| DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Yaml, + state: DatProcessingState::Error(err.to_string()), + }); + + if let Err(err) = tx.send(res) { + eprintln!("Failed to notify about DAT to YAML result: {err}"); + } + }); + } + + pub fn yaml_to_dat( + &self, + dat_descriptor: DatDescriptor, + dat_context: Arc, + raw_data_root_path: PathBuf, + dat_root_path: PathBuf, + ) { + let tx = self.tx.clone(); + let start_message = DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Dat, + state: DatProcessingState::Working, + }; + if let Err(err) = tx.send(start_message) { + eprintln!("Failed to notify about YAML to DAT start: {err}"); + } + + self.pool.lock().unwrap().execute(move || { + let res = dat_descriptor + .yaml_to_dat(dat_context, raw_data_root_path, dat_root_path) + .map(|_| DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Dat, + state: DatProcessingState::Finished, + }) + .unwrap_or_else(|err| DatProcessorMessage { + dat_descriptor, + output_kind: DatProcessorOutputKind::Dat, + state: DatProcessingState::Error(err.to_string()), + }); + + if let Err(err) = tx.send(res) { + eprintln!("Failed to notify about YAML to DAT result: {err}"); + } + }); + } +}