diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index 4e7ed14..474c090 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -6,30 +6,24 @@ resource_types: - name: gitea-package type: registry-image source: - repository: registry.sclu1034.dev/gitea-package - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/gitea-package - name: gitea-status type: registry-image source: - repository: registry.sclu1034.dev/gitea-status - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/gitea-status - name: gitea-pr type: registry-image source: - repository: registry.sclu1034.dev/gitea-pr - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/gitea-pr resources: - name: repo type: git source: - uri: https://git.sclu1034.dev/bitsquid_dt/dtmt + uri: http://forgejo:3000/bitsquid_dt/dtmt branch: master - name: repo-pr @@ -44,7 +38,7 @@ resources: type: gitea-package source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt type: generic name: dtmt @@ -54,7 +48,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt repo: dtmt context: build/msvc @@ -64,7 +58,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt repo: dtmt context: build/linux @@ -88,12 +82,9 @@ jobs: values: ((.:prs)) set_pipeline: dtmt-pr file: repo/.ci/pipelines/pr.yml - public: true vars: pr: ((.:pr)) gitea_api_key: ((gitea_api_key)) - registry_user: ((registry_user)) - registry_password: ((registry_password)) instance_vars: number: ((.:pr.number)) @@ -134,8 +125,8 @@ jobs: vars: pr: "" target: msvc - registry_user: ((registry_user)) - registry_password: ((registry_password)) + gitea_url: http://forgejo:3000 + gitea_api_key: ((gitea_api_key)) - load_var: version_number reveal: true @@ -151,21 +142,10 @@ jobs: fail_fast: true override: true globs: + - artifact/dtmt + - artifact/dtmm - artifact/*.exe - - artifact/*.exe.sha256 - - - put: package - resource: gitea-package - no_get: true - inputs: - - artifact - params: - version: master - fail_fast: true - override: true - globs: - - artifact/*.exe - - artifact/*.exe.sha256 + - artifact/*.sha256 - name: build-linux on_success: @@ -203,10 +183,8 @@ jobs: vars: pr: "" target: linux - gitea_url: https://git.sclu1034.dev + gitea_url: http://forgejo:3000 gitea_api_key: ((gitea_api_key)) - registry_user: ((registry_user)) - registry_password: ((registry_password)) - load_var: version_number reveal: true @@ -224,20 +202,5 @@ jobs: globs: - artifact/dtmt - artifact/dtmm - - artifact/dtmm.sha256 - - artifact/dtmt.sha256 - - - put: package - resource: gitea-package - no_get: true - inputs: - - artifact - params: - version: master - fail_fast: true - override: true - globs: - - artifact/dtmt - - artifact/dtmm - - artifact/dtmm.sha256 - - artifact/dtmt.sha256 + - artifact/*.exe + - artifact/*.sha256 diff --git a/.ci/pipelines/check.yml b/.ci/pipelines/check.yml index c8d5d47..4d350ac 100644 --- a/.ci/pipelines/check.yml +++ b/.ci/pipelines/check.yml @@ -18,8 +18,6 @@ jobs: file: repo/.ci/tasks/build.yml vars: target: msvc - registry_user: ((registry_user)) - registry_password: ((registry_password)) - name: build-linux plan: - get: repo @@ -28,5 +26,3 @@ jobs: file: repo/.ci/tasks/build.yml vars: target: linux - registry_user: ((registry_user)) - registry_password: ((registry_password)) diff --git a/.ci/pipelines/pr.yml b/.ci/pipelines/pr.yml index 5c8d7cd..bca0ebb 100644 --- a/.ci/pipelines/pr.yml +++ b/.ci/pipelines/pr.yml @@ -6,30 +6,26 @@ resource_types: - name: gitea-package type: registry-image source: - repository: registry.sclu1034.dev/gitea-package - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/gitea-package - name: gitea-status type: registry-image source: - repository: registry.sclu1034.dev/gitea-status - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/gitea-status resources: - name: repo type: git source: - uri: https://git.sclu1034.dev/bitsquid_dt/dtmt + uri: http://forgejo:3000/bitsquid_dt/dtmt branch: ((pr.head.ref)) - name: gitea-package type: gitea-package source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt type: generic name: dtmt @@ -38,7 +34,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt repo: dtmt context: lint/clippy @@ -48,7 +44,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt repo: dtmt context: build/msvc @@ -58,7 +54,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: https://git.sclu1034.dev + url: http://forgejo:3000 owner: bitsquid_dt repo: dtmt context: build/linux @@ -101,8 +97,6 @@ jobs: file: repo/.ci/tasks/clippy.yml vars: gitea_api_key: ((gitea_api_key)) - registry_user: ((registry_user)) - registry_password: ((registry_password)) - name: build-msvc @@ -141,10 +135,8 @@ jobs: vars: target: msvc pr: ((pr)) - gitea_url: https://git.sclu1034.dev + gitea_url: http://forgejo:3000 gitea_api_key: ((gitea_api_key)) - registry_user: ((registry_user)) - registry_password: ((registry_password)) - load_var: version_number reveal: true @@ -201,10 +193,8 @@ jobs: vars: target: linux pr: ((pr)) - gitea_url: https://git.sclu1034.dev + gitea_url: http://forgejo:3000 gitea_api_key: ((gitea_api_key)) - registry_user: ((registry_user)) - registry_password: ((registry_password)) - load_var: version_number reveal: true diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index b362266..bb96775 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -20,15 +20,12 @@ install_artifact() { cd "repo" PR=${PR:-} -ref=$(cat .git/ref || echo "HEAD") if [ -n "$PR" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" - ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$ref" 2>/dev/null || echo 'manual')" -elif [ -f ".git/branch" ]; then - ref=$(cat .git/branch)-$(git rev-parse --short "$ref") + ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" else - ref=$(git rev-parse --short "$ref") + ref=$(git describe --tags) fi title "Version: '$ref'" diff --git a/.ci/tasks/build.yml b/.ci/tasks/build.yml index 9b9c094..dce44d0 100644 --- a/.ci/tasks/build.yml +++ b/.ci/tasks/build.yml @@ -6,9 +6,7 @@ image_resource: name: ctmt-bi-base-((target)) type: registry-image source: - repository: registry.sclu1034.dev/dtmt-ci-base-((target)) - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/dtmt-ci-base-((target)) tag: latest inputs: @@ -24,6 +22,7 @@ caches: params: CI: "true" TARGET: ((target)) + GITEA_API_KEY: ((gitea_api_key)) PR: ((pr)) OUTPUT: artifact diff --git a/.ci/tasks/clippy.sh b/.ci/tasks/clippy.sh index 7c27b5f..33901a9 100755 --- a/.ci/tasks/clippy.sh +++ b/.ci/tasks/clippy.sh @@ -10,6 +10,6 @@ title "Install clippy" rustup component add clippy title "Run clippy" -cargo clippy --color always --no-deps -- -D warnings +cargo clippy --color always --no-deps title "Done" diff --git a/.ci/tasks/clippy.yml b/.ci/tasks/clippy.yml index 806dfd4..483cb30 100644 --- a/.ci/tasks/clippy.yml +++ b/.ci/tasks/clippy.yml @@ -6,9 +6,7 @@ image_resource: name: dtmt-ci-base-linux type: registry-image source: - repository: registry.sclu1034.dev/dtmt-ci-base-linux - username: ((registry_user)) - password: ((registry_password)) + repository: registry.local:5000/dtmt-ci-base-linux tag: latest inputs: diff --git a/.gitmodules b/.gitmodules index e1964a8..a03eebf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "lib/serde_sjson"] + path = lib/serde_sjson + url = https://git.sclu1034.dev/lucas/serde_sjson.git [submodule "lib/luajit2-sys"] path = lib/luajit2-sys url = https://github.com/sclu1034/luajit2-sys.git diff --git a/.renovaterc b/.renovaterc deleted file mode 100644 index 7ad59cd..0000000 --- a/.renovaterc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended", - ":combinePatchMinorReleases", - ":enableVulnerabilityAlerts" - ], - "prConcurrentLimit": 10, - "branchPrefix": "renovate/", - "baseBranches": [ - "$default", - "/^release\\/.*/" - ] -} diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1bfb0dd..db30865 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -20,8 +20,6 @@ - dtmm: fetch file version for Nexus mods - dtmm: handle `nxm://` URIs via IPC and import the corresponding mod - dtmm: Add button to open mod on nexusmods.com -- dtmt: Implement commands to list bundles and contents -- dtmt: Implement command to search for files === Fixed diff --git a/Cargo.lock b/Cargo.lock index 609555e..3a02b55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -17,12 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aho-corasick" version = "1.1.3" @@ -35,11 +29,10 @@ dependencies = [ [[package]] name = "ansi-parser" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43e7fd8284f025d0bd143c2855618ecdf697db55bde39211e5c9faec7669173" +source = "git+https://gitlab.com/lschwiderski/ansi-parser.git?branch=issue/outdated-heapless#bfcd2689677fa93ce72c55833e891af36c65b2aa" dependencies = [ "heapless", - "nom 7.1.3", + "nom", ] [[package]] @@ -53,9 +46,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", @@ -68,33 +61,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -102,30 +95,30 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "arbitrary" -version = "1.4.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" dependencies = [ "derive_arbitrary", ] [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.6" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "associative-cache" @@ -141,7 +134,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -169,10 +162,15 @@ dependencies = [ ] [[package]] -name = "atomic-waker" -version = "1.1.2" +name = "atty" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] [[package]] name = "autocfg" @@ -182,15 +180,15 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", ] @@ -209,62 +207,34 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" -version = "2.0.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "bincode_derive", "serde", - "unty", -] - -[[package]] -name = "bincode_derive" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" -dependencies = [ - "virtue", ] [[package]] name = "bindgen" -version = "0.70.1" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools", + "itertools 0.12.1", + "lazy_static", + "lazycell", "log", "prettyplease", "proc-macro2", "quote", "regex", - "rustc-hash 1.1.0", + "rustc-hash", "shlex", - "syn 2.0.100", -] - -[[package]] -name = "bindgen" -version = "0.72.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" -dependencies = [ - "bitflags 2.9.1", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash 2.1.0", - "shlex", - "syn 2.0.100", + "syn 2.0.63", + "which", ] [[package]] @@ -275,9 +245,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitmaps" @@ -317,9 +287,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.17.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" [[package]] name = "byteorder" @@ -329,26 +299,28 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2" -version = "0.5.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" dependencies = [ "bzip2-sys", + "libc", ] [[package]] name = "bzip2-sys" -version = "0.1.13+1.0.8" +version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" dependencies = [ "cc", + "libc", "pkg-config", ] @@ -363,7 +335,7 @@ dependencies = [ "glib", "libc", "once_cell", - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -379,13 +351,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.13" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", - "shlex", + "once_cell", ] [[package]] @@ -394,7 +366,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom 7.1.3", + "nom", ] [[package]] @@ -415,9 +387,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.8.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -426,9 +398,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.40" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -436,56 +408,56 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.40" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "unicase", - "unicode-width 0.2.0", + "unicode-width", ] [[package]] name = "clap_derive" -version = "4.5.40" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "cli-table" -version = "0.5.0" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14da8d951cef7cc4f13ccc9b744d736963d57863c7e6fc33c070ea274546082c" +checksum = "adfbb116d9e2c4be7011360d0c0bee565712c11e969c9609b25b619366dc379d" dependencies = [ "cli-table-derive", "termcolor", - "unicode-width 0.2.0", + "unicode-width", ] [[package]] name = "cli-table-derive" -version = "0.5.0" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e" +checksum = "2af3bfb9da627b0a6c467624fb7963921433774ed435493b5c08a3053e829ad4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 1.0.109", ] [[package]] @@ -541,7 +513,7 @@ dependencies = [ "once_cell", "owo-colors", "pretty_assertions", - "thiserror 1.0.63", + "thiserror", "tracing", "tracing-error", "tracing-subscriber", @@ -569,9 +541,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "colors-transform" @@ -581,14 +553,14 @@ checksum = "9226dbc05df4fb986f48d730b001532580883c4c06c5d1c213f4b34c1c157178" [[package]] name = "confy" -version = "1.0.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29222b549d4e3ded127989d523da9e928918d0d0d7f7c1690b439d0d538bae9" +checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0" dependencies = [ "directories", "serde", - "thiserror 2.0.12", - "toml 0.8.19", + "thiserror", + "toml 0.8.13", ] [[package]] @@ -613,9 +585,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.7" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics" @@ -655,9 +627,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -686,6 +658,69 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.1", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + [[package]] name = "crypto-common" version = "0.1.6" @@ -698,9 +733,9 @@ dependencies = [ [[package]] name = "csv-async" -version = "1.3.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888dbb0f640d2c4c04e50f933885c7e9c95995d93cec90aba8735b4c610f26f1" +checksum = "d37fe5b0d07f4a8260ce1e9a81413e88f459af0f2dfc55c15e96868a2f99c0f0" dependencies = [ "cfg-if", "csv-core", @@ -729,9 +764,9 @@ checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" [[package]] name = "deranged" -version = "0.4.0" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -739,13 +774,13 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.4.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -766,9 +801,18 @@ dependencies = [ [[package]] name = "directories" -version = "6.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ "dirs-sys", ] @@ -785,14 +829,14 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.5.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", "option-ext", - "redox_users 0.5.0", - "windows-sys 0.59.0", + "redox_users", + "windows-sys 0.48.0", ] [[package]] @@ -802,27 +846,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.6", + "redox_users", "winapi", ] [[package]] name = "displaydoc" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] -[[package]] -name = "doctest-file" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" - [[package]] name = "druid" version = "0.8.3" @@ -911,7 +949,7 @@ dependencies = [ "ansi-parser", "async-recursion", "bincode", - "bitflags 2.9.1", + "bitflags 2.5.0", "clap", "color-eyre", "colors-transform", @@ -948,17 +986,19 @@ name = "dtmt" version = "0.3.0" dependencies = [ "async-recursion", + "atty", "clap", "cli-table", "color-eyre", "confy", + "crossbeam", "csv-async", "dtmt-shared", "futures", "futures-util", "glob", + "itertools 0.11.0", "luajit2-sys", - "minijinja", "nanorand", "notify", "oodle", @@ -970,6 +1010,7 @@ dependencies = [ "serde", "serde_sjson", "shlex", + "string_template", "tempfile", "tokio", "tokio-stream", @@ -1007,9 +1048,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encoding_rs" @@ -1034,12 +1075,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1064,9 +1105,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fd-lock" @@ -1075,7 +1116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix 0.38.34", + "rustix", "windows-sys 0.48.0", ] @@ -1100,25 +1141,24 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.24" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "libredox", - "windows-sys 0.59.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] name = "flate2" -version = "1.1.1" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", - "libz-rs-sys", - "miniz_oxide 0.8.8", + "miniz_oxide", ] [[package]] @@ -1137,7 +1177,7 @@ dependencies = [ "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rustc-hash 1.1.0", + "rustc-hash", "self_cell 0.10.3", "smallvec", "unic-langid", @@ -1158,7 +1198,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a530c4694a6a8d528794ee9bbd8ba0122e779629ac908d15ad5a7ae7763a33d" dependencies = [ - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -1169,11 +1209,11 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fontconfig-parser" -version = "0.5.7" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fcfcd44ca6e90c921fee9fa665d530b21ef1327a4c1a6c5250ea44b776ada7" +checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" dependencies = [ - "roxmltree 0.20.0", + "roxmltree 0.19.0", ] [[package]] @@ -1229,9 +1269,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1244,9 +1284,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1254,15 +1294,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1271,38 +1311,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1393,19 +1433,7 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasi", ] [[package]] @@ -1420,9 +1448,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "gio" @@ -1441,7 +1469,7 @@ dependencies = [ "once_cell", "pin-project-lite", "smallvec", - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -1476,7 +1504,7 @@ dependencies = [ "libc", "once_cell", "smallvec", - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -1506,9 +1534,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gobject-sys" @@ -1578,15 +1606,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ - "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", + "futures-util", "http", "indexmap", "slab", @@ -1632,6 +1660,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -1640,11 +1677,11 @@ checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "home" -version = "0.5.11" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1660,9 +1697,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", @@ -1670,12 +1707,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -1683,15 +1720,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "hyper" -version = "1.6.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", @@ -1707,23 +1744,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - [[package]] name = "hyper-tls" version = "0.6.0" @@ -1742,167 +1762,32 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.13" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "base64 0.22.1", "bytes", "futures-channel", - "futures-core", "futures-util", "http", "http-body", "hyper", - "ipnet", - "libc", - "percent-encoding", "pin-project-lite", "socket2", - "system-configuration", "tokio", + "tower", "tower-service", "tracing", - "windows-registry", -] - -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", ] [[package]] name = "idna" -version = "1.0.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" -dependencies = [ - "icu_normalizer", - "icu_properties", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -1942,9 +1827,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.4.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -1952,11 +1837,11 @@ dependencies = [ [[package]] name = "inotify" -version = "0.11.0" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ - "bitflags 2.9.1", + "bitflags 1.3.2", "inotify-sys", "libc", ] @@ -1972,9 +1857,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", "js-sys", @@ -1984,11 +1869,10 @@ dependencies = [ [[package]] name = "interprocess" -version = "2.2.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d941b405bd2322993887859a8ee6ac9134945a24ec5ec763a8a962fc64dfec2d" +checksum = "7b4d0250d41da118226e55b3d50ca3f0d9e0a0f6829b92f543ac0054aeea1572" dependencies = [ - "doctest-file", "libc", "recvmsg", "widestring", @@ -2020,16 +1904,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "iri-string" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "is-docker" version = "0.2.0" @@ -2051,15 +1925,24 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itertools" -version = "0.13.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -2072,9 +1955,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -2087,11 +1970,10 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ - "once_cell", "wasm-bindgen", ] @@ -2112,7 +1994,7 @@ checksum = "7e4c8354918309196302015ac9cae43362f1a13d0d5c5539a33b4c2fd2cd6d25" dependencies = [ "pest", "pest_derive", - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -2123,7 +2005,7 @@ checksum = "0447866c47c00f8bd1949618e8f63017cf93e985b4684dc28d784527e2882390" dependencies = [ "keyvalues-parser", "serde", - "thiserror 1.0.63", + "thiserror", ] [[package]] @@ -2167,24 +2049,30 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -2193,37 +2081,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", "libc", - "redox_syscall", -] - -[[package]] -name = "libz-rs-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6489ca9bd760fe9642d7644e827b0c9add07df89857b0416ee15c1cc1a3b8c5a" -dependencies = [ - "zlib-rs", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "linux-raw-sys" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" - -[[package]] -name = "litemap" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lockfree-object-pool" @@ -2233,15 +2099,15 @@ checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] name = "log" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "luajit2-sys" version = "0.0.2" dependencies = [ - "bindgen 0.70.1", + "bindgen", "cc", "fs_extra", "libc", @@ -2273,9 +2139,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" @@ -2310,21 +2176,11 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "minicov" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" -dependencies = [ - "cc", - "walkdir", -] - [[package]] name = "minijinja" -version = "2.10.2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd72e8b4e42274540edabec853f607c015c73436159b06c39c7af85a20433155" +checksum = "7165d0e94806d52ad5295e4b54a95176d831814840bc067298ca647e1c956338" dependencies = [ "serde", ] @@ -2337,48 +2193,39 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", "simd-adler32", ] -[[package]] -name = "miniz_oxide" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" -dependencies = [ - "adler2", -] - [[package]] name = "mio" -version = "1.0.2" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ - "hermit-abi", "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "wasi", + "windows-sys 0.48.0", ] [[package]] name = "nanorand" -version = "0.8.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3d189da485332e96ba8a5ef646a311871abd7915bf06ac848a9117f19cf6e4" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" [[package]] name = "native-tls" -version = "0.2.12" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ + "lazy_static", "libc", "log", "openssl", @@ -2400,7 +2247,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror", "time", "tokio", "tracing", @@ -2439,33 +2286,25 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" -dependencies = [ - "memchr", -] - [[package]] name = "nom_locate" -version = "5.0.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d" +checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3" dependencies = [ "bytecount", "memchr", - "nom 8.0.0", + "nom", ] [[package]] name = "notify" -version = "8.0.0" +version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" +checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", + "crossbeam-channel", "filetime", "fsevent-sys", "inotify", @@ -2473,17 +2312,10 @@ dependencies = [ "libc", "log", "mio", - "notify-types", "walkdir", - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] -[[package]] -name = "notify-types" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2509,6 +2341,16 @@ 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 0.3.9", + "libc", +] + [[package]] name = "num_threads" version = "0.1.7" @@ -2529,9 +2371,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2546,16 +2388,16 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" name = "oodle" version = "0.1.0" dependencies = [ - "bindgen 0.72.0", + "bindgen", "color-eyre", "tracing", ] [[package]] name = "open" -version = "5.3.2" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" +checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32" dependencies = [ "is-wsl", "libc", @@ -2564,11 +2406,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -2585,7 +2427,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -2596,9 +2438,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -2703,20 +2545,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.11" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" dependencies = [ "memchr", - "thiserror 1.0.63", + "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.11" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" dependencies = [ "pest", "pest_generator", @@ -2724,22 +2566,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.11" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "pest_meta" -version = "2.7.11" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" dependencies = [ "once_cell", "pest", @@ -2840,10 +2682,30 @@ dependencies = [ ] [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "pin-project" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.63", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2867,7 +2729,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.4", + "miniz_oxide", ] [[package]] @@ -2893,7 +2755,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -2932,9 +2794,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] @@ -2950,19 +2812,13 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - [[package]] name = "radix_trie" version = "0.2.1" @@ -3002,45 +2858,34 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags 2.9.1", + "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ - "getrandom 0.2.15", + "getrandom", "libredox", - "thiserror 1.0.63", -] - -[[package]] -name = "redox_users" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" -dependencies = [ - "getrandom 0.2.15", - "libredox", - "thiserror 2.0.12", + "thiserror", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -3054,13 +2899,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.3", ] [[package]] @@ -3071,48 +2916,50 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.12.20" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", + "futures-util", "h2", "http", "http-body", "http-body-util", "hyper", - "hyper-rustls", "hyper-tls", "hyper-util", + "ipnet", "js-sys", "log", "mime", "native-tls", + "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pki-types", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", - "tower", - "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "winreg 0.52.0", ] [[package]] @@ -3135,28 +2982,13 @@ dependencies = [ [[package]] name = "rgb" -version = "0.8.48" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71" +checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" dependencies = [ "bytemuck", ] -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom 0.2.15", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - [[package]] name = "roxmltree" version = "0.15.1" @@ -3168,9 +3000,9 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.20.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" +checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" [[package]] name = "rustc-demangle" @@ -3184,12 +3016,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustc_version" version = "0.4.0" @@ -3205,64 +3031,28 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", "errno", "libc", - "linux-raw-sys 0.4.14", + "linux-raw-sys", "windows-sys 0.52.0", ] [[package]] -name = "rustix" -version = "1.0.5" +name = "rustls-pemfile" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "bitflags 2.9.1", - "errno", - "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustls" -version = "0.23.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" -dependencies = [ - "once_cell", + "base64 0.22.1", "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", ] [[package]] name = "rustls-pki-types" -version = "1.12.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" -dependencies = [ - "zeroize", -] - -[[package]] -name = "rustls-webpki" -version = "0.102.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustybuzz" @@ -3299,7 +3089,7 @@ dependencies = [ "scopeguard", "smallvec", "unicode-segmentation", - "unicode-width 0.1.13", + "unicode-width", "utf8parse", "winapi", ] @@ -3345,7 +3135,7 @@ name = "sdk" version = "0.3.0" dependencies = [ "async-recursion", - "bitflags 2.9.1", + "bitflags 2.5.0", "byteorder", "color-eyre", "csv-async", @@ -3368,11 +3158,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -3381,9 +3171,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -3412,52 +3202,49 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", - "memchr", "ryu", "serde", ] [[package]] name = "serde_sjson" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c5b0d7af37492e99b8559436ee76b9ec8935c75449b1c2ef08c205a9e92ae6f" +version = "1.0.0" dependencies = [ - "nom 8.0.0", + "nom", "nom_locate", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -3557,20 +3344,14 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.9" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3579,16 +3360,16 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "steamlocate" -version = "2.0.1" +version = "2.0.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13160bc6ea5cd80cde195ad4a4c629701db2bf397b62c139aa9e739016d2499" +checksum = "c3b6a4810c4e7fecb0123a9a8ba99b335c17d92e636c265ef99108ee4734c812" dependencies = [ "crc", - "home", + "dirs", "keyvalues-parser", "keyvalues-serde", "serde", - "winreg", + "winreg 0.51.0", ] [[package]] @@ -3607,10 +3388,19 @@ dependencies = [ ] [[package]] -name = "strip-ansi-escapes" +name = "string_template" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" +checksum = "dc6f2c6b2c3fa950895c9aeb0c3cb9271d7eb580662af9af2b711b593f446320" +dependencies = [ + "regex", +] + +[[package]] +name = "strip-ansi-escapes" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ff8ef943b384c414f54aefa961dd2bd853add74ec75e7ac74cf91dba62bcfa" dependencies = [ "vte", ] @@ -3621,12 +3411,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - [[package]] name = "svgfilters" version = "0.4.0" @@ -3659,9 +3443,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" dependencies = [ "proc-macro2", "quote", @@ -3670,40 +3454,26 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "system-configuration" -version = "0.6.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 2.9.1", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ "core-foundation-sys", "libc", @@ -3718,27 +3488,26 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.19", + "toml 0.8.13", "version-compare", ] [[package]] name = "target-lexicon" -version = "0.12.16" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tempfile" -version = "3.20.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ + "cfg-if", "fastrand", - "getrandom 0.3.2", - "once_cell", - "rustix 1.0.5", - "windows-sys 0.59.0", + "rustix", + "windows-sys 0.52.0", ] [[package]] @@ -3752,42 +3521,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ - "thiserror-impl 1.0.63", -] - -[[package]] -name = "thiserror" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" -dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -3802,9 +3551,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.41" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -3819,15 +3568,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -3860,41 +3609,56 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece" dependencies = [ "displaydoc", - "zerovec", ] [[package]] -name = "tokio" -version = "1.45.1" +name = "tinyvec" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +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.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", "libc", "mio", + "num_cpus", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] @@ -3907,22 +3671,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -3953,21 +3706,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit 0.22.13", ] [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] @@ -3985,68 +3738,52 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow 0.6.8", ] [[package]] name = "tower" -version = "0.5.2" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", + "pin-project", "pin-project-lite", - "sync_wrapper", "tokio", "tower-layer", "tower-service", -] - -[[package]] -name = "tower-http" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc2d9e086a412a451384326f521c8123a99a466b329941a9403696bff9b0da2" -dependencies = [ - "bitflags 2.9.1", - "bytes", - "futures-util", - "http", - "http-body", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", + "tracing", ] [[package]] name = "tower-layer" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] name = "tower-service" -version = "0.3.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -4054,20 +3791,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -4075,9 +3812,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" dependencies = [ "tracing", "tracing-subscriber", @@ -4096,9 +3833,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -4141,7 +3878,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ - "rustc-hash 1.1.0", + "rustc-hash", ] [[package]] @@ -4264,6 +4001,15 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-script" version = "0.5.6" @@ -4284,33 +4030,15 @@ checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - -[[package]] -name = "unicode-width" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "unty" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "url" -version = "2.5.4" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -4344,29 +4072,17 @@ dependencies = [ "xmlwriter", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - [[package]] name = "utf16_lit" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14706d2a800ee8ff38c1d3edb873cd616971ea59eb7c0d046bb44ef59b06a1ae" -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "valuable" @@ -4388,23 +4104,28 @@ checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.5" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "virtue" -version = "0.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vte" -version = "0.14.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" +checksum = "f5022b5fbf9407086c180e9557be968742d839e68346af7792b8592489732197" dependencies = [ - "memchr", + "utf8parse", + "vte_generate_state_changes", +] + +[[package]] +name = "vte_generate_state_changes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +dependencies = [ + "proc-macro2", + "quote", ] [[package]] @@ -4432,46 +4153,36 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", - "once_cell", - "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.100" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", + "once_cell", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -4481,9 +4192,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4491,35 +4202,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-bindgen-test" -version = "0.3.43" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" dependencies = [ "console_error_panic_hook", "js-sys", - "minicov", "scoped-tls", "wasm-bindgen", "wasm-bindgen-futures", @@ -4528,20 +4235,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.43" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.63", ] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -4553,6 +4260,18 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "widestring" version = "1.1.0" @@ -4577,11 +4296,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4590,41 +4309,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-link" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" - -[[package]] -name = "windows-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" -dependencies = [ - "windows-result", - "windows-strings", - "windows-targets 0.53.0", -] - -[[package]] -name = "windows-result" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" -dependencies = [ - "windows-link", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -4640,16 +4324,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.52.5", ] [[package]] @@ -4669,34 +4344,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -4707,15 +4366,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -4725,15 +4378,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -4743,27 +4390,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -4773,15 +4408,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -4791,15 +4420,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -4809,15 +4432,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -4827,15 +4444,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.6" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" @@ -4848,21 +4459,31 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" dependencies = [ "memchr", ] [[package]] name = "winreg" -version = "0.55.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" dependencies = [ "cfg-if", - "windows-sys 0.59.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -4883,27 +4504,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.1", -] - -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - [[package]] name = "xi-unicode" version = "0.3.0" @@ -4928,102 +4528,26 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", - "synstructure", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - [[package]] name = "zip" -version = "4.1.0" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7dcdb4229c0e79c2531a24de7726a0e980417a74fb4d030a35f535665439a0" +checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" dependencies = [ "arbitrary", "bzip2", "crc32fast", + "crossbeam-utils", + "displaydoc", "flate2", "indexmap", "memchr", + "thiserror", "time", "zopfli", "zstd", ] -[[package]] -name = "zlib-rs" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "868b928d7949e09af2f6086dfc1e01936064cc7a819253bce650d4e2a2d63ba8" - [[package]] name = "zopfli" version = "0.8.1" @@ -5040,27 +4564,27 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.2.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 99ce493..f38ac22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,57 +6,18 @@ members = [ "lib/dtmt-shared", "lib/oodle", "lib/sdk", + "lib/serde_sjson", "lib/luajit2-sys", "lib/color-eyre", ] exclude = ["lib/color-eyre"] [workspace.dependencies] -ansi-parser = "0.9.1" -ansi_term = "0.12.1" -async-recursion = "1.0.5" -bincode = "2.0.0" -bitflags = "2.5.0" -byteorder = "1.4.3" -clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } -cli-table = { version = "0.5.0", default-features = false, features = ["derive"] } +zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } + +[patch.crates-io] color-eyre = { path = "lib/color-eyre" } -colors-transform = "0.2.11" -confy = "1.0.0" -csv-async = { version = "1.2.4", features = ["tokio", "serde"] } -druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "bmp", "webp", "svg"] } -druid-widget-nursery = "0.1" -dtmt-shared = { path = "lib/dtmt-shared" } -fastrand = "2.1.0" -futures = "0.3.25" -futures-util = "0.3.24" -glob = "0.3.0" -interprocess = "2.1.0" -lazy_static = "1.4.0" -luajit2-sys = { path = "lib/luajit2-sys" } -minijinja = { version = "2.0.1", default-features = false, features = ["serde"] } -nanorand = "0.8.0" -nexusmods = { path = "lib/nexusmods" } -notify = "8.0.0" -oodle = { path = "lib/oodle" } -open = "5.0.1" -path-clean = "1.0.1" -path-slash = "0.2.1" -pin-project-lite = "0.2.9" -promptly = "0.3.1" -sdk = { path = "lib/sdk" } -serde = { version = "1.0.152", features = ["derive", "rc"] } -serde_sjson = "1.2.1" -steamlocate = "2.0.0-beta.2" -strip-ansi-escapes = "0.2.0" -time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset", "formatting", "macros"] } -tokio = { version = "1.23.0", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } -tokio-stream = { version = "0.1.12", features = ["fs", "io-util"] } -tracing = { version = "0.1.37", features = ["async-await"] } -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -usvg = "0.25.0" -zip = { version = "4.0.0", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } +ansi-parser = { git = "https://gitlab.com/lschwiderski/ansi-parser.git", branch = "issue/outdated-heapless", version = "0.9.1" } [profile.dev.package.backtrace] opt-level = 3 diff --git a/Justfile b/Justfile index 697bdcc..dbecc22 100644 --- a/Justfile +++ b/Justfile @@ -40,8 +40,6 @@ set-base-pipeline: --pipeline dtmt \ --config .ci/pipelines/base.yml \ -v gitea_api_key=${GITEA_API_KEY} \ - -v registry_user=${REGISTRY_USER} \ - -v registry_password=${REGISTRY_PASSWORD} \ -v owner=bitsquid_dt \ -v repo=dtmt @@ -50,7 +48,7 @@ set-pr-pipeline pr: -H "Authorization: ${GITEA_API_KEY}" \ -H 'Accept: application/json' \ 'https://git.sclu1034.dev/api/v1/repos/bitsquid_dt/dtmt/pulls/{{pr}}' \ - | yq -y '.' - > 'pr-{{pr}}.yaml' + | yq -y '.' - > 'pr-{{pr}}.yaml' fly -t main set-pipeline \ --pipeline dtmt-pr \ --config .ci/pipelines/pr.yml \ diff --git a/crates/dtmm/Cargo.toml b/crates/dtmm/Cargo.toml index 52c0522..f947fc6 100644 --- a/crates/dtmm/Cargo.toml +++ b/crates/dtmm/Cargo.toml @@ -12,37 +12,37 @@ license-file = "LICENSE" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ansi-parser = { workspace = true } -async-recursion = { workspace = true } -bincode = { workspace = true } -bitflags = { workspace = true } -clap = { workspace = true } -color-eyre = { workspace = true } -colors-transform = { workspace = true } -confy = { workspace = true } -druid = { workspace = true } -druid-widget-nursery = { workspace = true } -dtmt-shared = { workspace = true } -futures = { workspace = true } -interprocess = { workspace = true } -lazy_static = { workspace = true } -luajit2-sys = { workspace = true } -minijinja = { workspace = true } -nexusmods = { workspace = true } -oodle = { workspace = true } -open = { workspace = true } -path-slash = { workspace = true } -sdk = { workspace = true } -serde = { workspace = true } -serde_sjson = { workspace = true } -strip-ansi-escapes = { workspace = true } -time = { workspace = true } -tokio = { workspace = true } -tokio-stream = { workspace = true } -tracing = { workspace = true } -tracing-error = { workspace = true } -tracing-subscriber = { workspace = true } -usvg = { workspace = true } +ansi-parser = "0.9.0" +async-recursion = "1.0.5" +bincode = "1.3.3" +bitflags = "2.5.0" +clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } +color-eyre = "0.6.2" +colors-transform = "0.2.11" +confy = "0.6.1" +druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "bmp", "webp", "svg"] } +druid-widget-nursery = "0.1" +dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } +futures = "0.3.25" +interprocess = "2.1.0" +lazy_static = "1.4.0" +luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } +minijinja = { version = "2.0.1", default-features = false } +nexusmods = { path = "../../lib/nexusmods", version = "*" } +oodle = { path = "../../lib/oodle", version = "*" } +open = "5.0.1" +path-slash = "0.2.1" +sdk = { path = "../../lib/sdk", version = "*" } +serde = { version = "1.0.152", features = ["derive", "rc"] } +serde_sjson = { path = "../../lib/serde_sjson", version = "*" } +strip-ansi-escapes = "0.2.0" +time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset"] } +tokio = { version = "1.23.0", features = ["rt", "fs", "tracing", "sync"] } +tokio-stream = { version = "0.1.12", features = ["fs"] } +tracing = "0.1.37" +tracing-error = "0.2.0" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +usvg = "0.25.0" zip = { workspace = true } [build-dependencies] diff --git a/crates/dtmm/src/controller/deploy.rs b/crates/dtmm/src/controller/deploy.rs index 481b07c..e2d9c0e 100644 --- a/crates/dtmm/src/controller/deploy.rs +++ b/crates/dtmm/src/controller/deploy.rs @@ -116,14 +116,14 @@ async fn patch_game_settings(state: Arc) -> Result<()> { eyre::bail!("couldn't find 'boot_script' field"); }; - f.write_all(&settings.as_bytes()[0..i]).await?; + f.write_all(settings[0..i].as_bytes()).await?; f.write_all(b"boot_script = \"scripts/mod_main\"").await?; let Some(j) = settings[i..].find('\n') else { eyre::bail!("couldn't find end of 'boot_script' field"); }; - f.write_all(&settings.as_bytes()[(i + j)..]).await?; + f.write_all(settings[(i + j)..].as_bytes()).await?; Ok(()) } @@ -324,11 +324,11 @@ async fn build_bundles(state: Arc) -> Result> { let mut bundles = Vec::new(); - let mut add_lua_asset = |name: &str, data: &str| { + let mut add_lua_asset = |name, data: &str| { let span = tracing::info_span!("Compiling Lua", name, data_len = data.len()); let _enter = span.enter(); - let file = lua::compile(name.to_string(), data).wrap_err("Failed to compile Lua")?; + let file = lua::compile(name, data).wrap_err("Failed to compile Lua")?; mod_bundle.add_file(file); @@ -453,7 +453,10 @@ async fn build_bundles(state: Arc) -> Result> { } #[tracing::instrument(skip_all)] -async fn patch_boot_bundle(state: Arc, deployment_info: &str) -> Result> { +async fn patch_boot_bundle( + state: Arc, + deployment_info: &String, +) -> Result> { let bundle_dir = Arc::new(state.game_dir.join("bundle")); let bundle_path = bundle_dir.join(format!("{:x}", Murmur64::hash(BOOT_BUNDLE_NAME.as_bytes()))); @@ -514,8 +517,8 @@ async fn patch_boot_bundle(state: Arc, deployment_info: &str) -> Re .wrap_err("Failed to render template `mod_main.lua`")?; tracing::trace!("Main script rendered:\n===========\n{}\n=============", lua); - let file = lua::compile(MOD_BOOT_SCRIPT.to_string(), lua) - .wrap_err("Failed to compile mod main Lua file")?; + let file = + lua::compile(MOD_BOOT_SCRIPT, lua).wrap_err("Failed to compile mod main Lua file")?; boot_bundle.add_file(file); } @@ -587,7 +590,11 @@ fn build_deployment_data( .map(|bundle| format!("{:x}", bundle.name().to_murmur64())) .collect(), // TODO: - mod_folders: mod_folders.as_ref().to_vec(), + mod_folders: mod_folders + .as_ref() + .iter() + .map(|folder| folder.clone()) + .collect(), }; serde_sjson::to_string(&info).wrap_err("Failed to serizalize deployment data") } diff --git a/crates/dtmm/src/controller/game.rs b/crates/dtmm/src/controller/game.rs index b93d985..6b91169 100644 --- a/crates/dtmm/src/controller/game.rs +++ b/crates/dtmm/src/controller/game.rs @@ -91,14 +91,14 @@ async fn patch_game_settings(state: Arc) -> Result<()> { eyre::bail!("couldn't find 'boot_script' field"); }; - f.write_all(&settings.as_bytes()[0..i]).await?; + f.write_all(settings[0..i].as_bytes()).await?; f.write_all(b"boot_script = \"scripts/mod_main\"").await?; let Some(j) = settings[i..].find('\n') else { eyre::bail!("couldn't find end of 'boot_script' field"); }; - f.write_all(&settings.as_bytes()[(i + j)..]).await?; + f.write_all(settings[(i + j)..].as_bytes()).await?; Ok(()) } @@ -208,7 +208,7 @@ pub(crate) async fn reset_mod_deployment(state: ActionState) -> Result<()> { for p in paths { let path = bundle_dir.join(p); - let backup = bundle_dir.join(format!("{}.bak", p)); + let backup = bundle_dir.join(&format!("{}.bak", p)); let res = async { tracing::debug!( diff --git a/crates/dtmm/src/controller/import.rs b/crates/dtmm/src/controller/import.rs index 6fc9693..8e47d23 100644 --- a/crates/dtmm/src/controller/import.rs +++ b/crates/dtmm/src/controller/import.rs @@ -297,7 +297,6 @@ fn extract_mod_config(archive: &mut ZipArchive) -> Result<(Mo packages: Vec::new(), resources, depends: Vec::new(), - name_overrides: Default::default(), }; Ok((cfg, root)) @@ -397,7 +396,7 @@ fn extract_legacy_mod( tracing::trace!("Writing file '{}'", name.display()); let mut out = std::fs::OpenOptions::new() .write(true) - .truncate(true) + .create(true) .open(&name) .wrap_err_with(|| format!("Failed to open file '{}'", name.display()))?; diff --git a/crates/dtmm/src/main.rs b/crates/dtmm/src/main.rs index 54e101a..6c0bb48 100644 --- a/crates/dtmm/src/main.rs +++ b/crates/dtmm/src/main.rs @@ -52,14 +52,10 @@ fn notify_nxm_download( tracing::debug!("Connected to main process at '{}'", IPC_ADDRESS); - let bincode_config = bincode::config::standard(); - - bincode::encode_into_std_write(uri.as_ref(), &mut stream, bincode_config) - .wrap_err("Failed to send URI")?; + bincode::serialize_into(&mut stream, uri.as_ref()).wrap_err("Failed to send URI")?; // We don't really care what the message is, we just need an acknowledgement. - let _: String = bincode::decode_from_std_read(&mut stream, bincode_config) - .wrap_err("Failed to receive reply")?; + let _: String = bincode::deserialize_from(&mut stream).wrap_err("Failed to receive reply")?; tracing::info!( "Notified DTMM with uri '{}'. Check the main window.", @@ -164,33 +160,22 @@ fn main() -> Result<()> { match res { Ok(mut stream) => { - let res = bincode::decode_from_std_read( - &mut stream, - bincode::config::standard(), - ) - .wrap_err("Failed to read message") - .and_then(|uri: String| { - tracing::trace!(uri, "Received NXM uri"); + let res = bincode::deserialize_from(&mut stream) + .wrap_err("Failed to read message") + .and_then(|uri: String| { + tracing::trace!(uri, "Received NXM uri"); - event_sink - .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) - .wrap_err("Failed to start NXM download") - }); + event_sink + .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) + .wrap_err("Failed to start NXM download") + }); match res { Ok(()) => { - let _ = bincode::encode_into_std_write( - "Ok", - &mut stream, - bincode::config::standard(), - ); + let _ = bincode::serialize_into(&mut stream, "Ok"); } Err(err) => { tracing::error!("{:?}", err); - let _ = bincode::encode_into_std_write( - "Error", - &mut stream, - bincode::config::standard(), - ); + let _ = bincode::serialize_into(&mut stream, "Error"); } } } diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index 183d6a5..e80feaa 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -4,37 +4,38 @@ version = "0.3.0" edition = "2021" [dependencies] -async-recursion = { workspace = true } -clap = { workspace = true } -cli-table = { workspace = true } -color-eyre = { workspace = true } -confy = { workspace = true } -csv-async = { workspace = true } -dtmt-shared = { workspace = true } -futures = { workspace = true } -futures-util = { workspace = true } -glob = { workspace = true } -luajit2-sys = { workspace = true } -minijinja = { workspace = true } -nanorand = { workspace = true } -notify = { workspace = true } -oodle = { workspace = true } -path-clean = { workspace = true } -path-slash = { workspace = true } -pin-project-lite = { workspace = true } -promptly = { workspace = true } -sdk = { workspace = true } -serde = { workspace = true } -serde_sjson = { workspace = true } -tokio = { workspace = true } -tokio-stream = { workspace = true } -tracing = { workspace = true } -tracing-error = { workspace = true } -tracing-subscriber = { workspace = true } +clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "unicode"] } +cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } +color-eyre = "0.6.2" +confy = "0.6.1" +csv-async = { version = "1.2.4", features = ["tokio", "serde"] } +dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } +futures = "0.3.25" +futures-util = "0.3.24" +glob = "0.3.0" +nanorand = "0.7.0" +oodle = { path = "../../lib/oodle", version = "*" } +pin-project-lite = "0.2.9" +promptly = "0.3.1" +sdk = { path = "../../lib/sdk", version = "*" } +serde_sjson = { path = "../../lib/serde_sjson", version = "*" } +serde = { version = "1.0.147", features = ["derive"] } +string_template = "0.2.1" +tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } +tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +tracing-error = "0.2.0" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +tracing = { version = "0.1.37", features = ["async-await"] } zip = { workspace = true } - -# Cannot be a workspace dependencies when it's optional +path-clean = "1.0.1" +path-slash = "0.2.1" +async-recursion = "1.0.2" +notify = "6.1.1" +luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } shlex = { version = "1.2.0", optional = true } +atty = "0.2.14" +itertools = "0.11.0" +crossbeam = { version = "0.8.2", features = ["crossbeam-deque"] } [dev-dependencies] tempfile = "3.3.0" diff --git a/crates/dtmt/src/cmd/build.rs b/crates/dtmt/src/cmd/build.rs index 74a627d..77ab629 100644 --- a/crates/dtmt/src/cmd/build.rs +++ b/crates/dtmt/src/cmd/build.rs @@ -55,7 +55,6 @@ pub(crate) fn command_definition() -> Command { ) } -/// Try to find a `dtmt.cfg` in the given directory or traverse up the parents. #[tracing::instrument] async fn find_project_config(dir: Option) -> Result { let (path, mut file) = if let Some(path) = dir { @@ -103,44 +102,39 @@ async fn find_project_config(dir: Option) -> Result { Ok(cfg) } -/// Iterate over the paths in the given `Package` and -/// compile each file by its file type. #[tracing::instrument(skip_all)] -async fn compile_package_files(pkg: &Package, cfg: &ModConfig) -> Result> { - let root = Arc::new(&cfg.dir); - let name_overrides = &cfg.name_overrides; +async fn compile_package_files

(pkg: &Package, root: P) -> Result> +where + P: AsRef + std::fmt::Debug, +{ + let root = Arc::new(root.as_ref()); let tasks = pkg .iter() - .flat_map(|(file_type, names)| { - names.iter().map(|name| { + .flat_map(|(file_type, paths)| { + paths.iter().map(|path| { ( *file_type, - name, + path, // Cloning the `Arc` here solves the issue that in the next `.map`, I need to // `move` the closure parameters, but can't `move` `root` before it was cloned. root.clone(), ) }) }) - .map(|(file_type, name, root)| async move { - let path = PathBuf::from(name); - let sjson = fs::read_to_string(&path) - .await - .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + .map(|(file_type, path, root)| async move { + let sjson = fs::read_to_string(&path).await?; - let name = path.with_extension("").to_slash_lossy().to_string(); - let name = if let Some(new_name) = name_overrides.get(&name) { - let new_name = match u64::from_str_radix(new_name, 16) { - Ok(hash) => IdString64::from(hash), - Err(_) => IdString64::from(new_name.clone()), - }; - tracing::info!("Overriding '{}' -> '{}'", name, new_name.display()); - new_name - } else { - IdString64::from(name.clone()) - }; - BundleFile::from_sjson(name, file_type, sjson, root.as_ref()).await + let mut path = path.clone(); + path.set_extension(""); + + BundleFile::from_sjson( + path.to_slash_lossy().to_string(), + file_type, + sjson, + root.as_ref(), + ) + .await }); let results = futures::stream::iter(tasks) @@ -151,14 +145,13 @@ async fn compile_package_files(pkg: &Package, cfg: &ModConfig) -> Result + std::fmt::Debug, -) -> Result { - let root = &cfg.dir; +async fn build_package(package: P1, root: P2) -> Result +where + P1: AsRef + std::fmt::Debug, + P2: AsRef + std::fmt::Debug, +{ + let root = root.as_ref(); let package = package.as_ref(); let mut path = root.join(package); @@ -172,7 +165,7 @@ async fn build_package( .await .wrap_err_with(|| format!("Invalid package file {}", &pkg_name))?; - let files = compile_package_files(&pkg, cfg).await?; + let files = compile_package_files(&pkg, root).await?; let mut bundle = Bundle::new(pkg_name); for file in files { bundle.add_file(file); @@ -181,8 +174,6 @@ async fn build_package( Ok(bundle) } -/// Cleans the path of internal parent (`../`) or self (`./`) components, -/// and ensures that it is relative. fn normalize_file_path>(path: P) -> Result { let path = path.as_ref(); @@ -263,14 +254,14 @@ pub(crate) async fn read_project_config(dir: Option) -> Result( +pub(crate) async fn build( cfg: &ModConfig, - out_path: impl AsRef + std::fmt::Debug, - game_dir: Arc>, + out_path: P1, + game_dir: Arc>, ) -> Result<()> where - P: AsRef + std::fmt::Debug, + P1: AsRef, + P2: AsRef, { let out_path = out_path.as_ref(); @@ -295,7 +286,7 @@ where ); } - let bundle = build_package(&cfg, path).await.wrap_err_with(|| { + let bundle = build_package(path, &cfg.dir).await.wrap_err_with(|| { format!( "Failed to build package '{}' at '{}'", path.display(), diff --git a/crates/dtmt/src/cmd/bundle/db.rs b/crates/dtmt/src/cmd/bundle/db.rs deleted file mode 100644 index b537991..0000000 --- a/crates/dtmt/src/cmd/bundle/db.rs +++ /dev/null @@ -1,174 +0,0 @@ -use std::{io::Cursor, path::PathBuf}; - -use clap::{value_parser, Arg, ArgMatches, Command}; -use color_eyre::{eyre::Context as _, Result}; -use sdk::murmur::{HashGroup, IdString64, Murmur64}; -use sdk::{BundleDatabase, FromBinary as _}; -use tokio::fs; - -pub(crate) fn command_definition() -> Command { - Command::new("db") - .about("Various operations regarding `bundle_database.data`.") - .subcommand_required(true) - .subcommand( - Command::new("list-files") - .about("List bundle contents") - .arg( - Arg::new("database") - .required(true) - .help("Path to the bundle database") - .value_parser(value_parser!(PathBuf)), - ) - .arg( - Arg::new("bundle") - .help("The bundle name. If omitted, all bundles will be listed.") - .required(false), - ), - ) - .subcommand( - Command::new("list-bundles").about("List bundles").arg( - Arg::new("database") - .required(true) - .help("Path to the bundle database") - .value_parser(value_parser!(PathBuf)), - ), - ) - .subcommand( - Command::new("find-file") - .about("Find the bundle a file belongs to") - .arg( - Arg::new("database") - .required(true) - .help("Path to the bundle database") - .value_parser(value_parser!(PathBuf)), - ) - .arg( - Arg::new("file-name") - .required(true) - .help("Name of the file. May be a hash in hex representation or a string"), - ), - ) -} - -#[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { - let Some((op, sub_matches)) = matches.subcommand() else { - unreachable!("clap is configured to require a subcommand"); - }; - - let database = { - let path = sub_matches - .get_one::("database") - .expect("argument is required"); - - let binary = fs::read(&path) - .await - .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; - - let mut r = Cursor::new(binary); - - BundleDatabase::from_binary(&mut r).wrap_err("Failed to parse bundle database")? - }; - - match op { - "list-files" => { - let index = database.files(); - - if let Some(bundle) = sub_matches.get_one::("bundle") { - let hash = u64::from_str_radix(bundle, 16) - .map(Murmur64::from) - .wrap_err("Invalid hex sequence")?; - - if let Some(files) = index.get(&hash) { - for file in files { - let name = ctx.lookup_hash(file.name, HashGroup::Filename); - let extension = file.extension.ext_name(); - println!("{}.{}", name.display(), extension); - } - } else { - tracing::info!("Bundle {} not found in the database", bundle); - } - } else { - for (bundle_hash, files) in index.iter() { - let bundle_name = ctx.lookup_hash(*bundle_hash, HashGroup::Filename); - - match bundle_name { - IdString64::String(name) => { - println!("{:016x} {}", bundle_hash, name); - } - IdString64::Hash(hash) => { - println!("{:016x}", hash); - } - } - - for file in files { - let name = ctx.lookup_hash(file.name, HashGroup::Filename); - let extension = file.extension.ext_name(); - - match name { - IdString64::String(name) => { - println!("\t{:016x}.{:<12} {}", file.name, extension, name); - } - IdString64::Hash(hash) => { - println!("\t{:016x}.{}", hash, extension); - } - } - } - - println!(); - } - } - - Ok(()) - } - "list-bundles" => { - for bundle_hash in database.bundles().keys() { - let bundle_name = ctx.lookup_hash(*bundle_hash, HashGroup::Filename); - - match bundle_name { - IdString64::String(name) => { - println!("{:016x} {}", bundle_hash, name); - } - IdString64::Hash(hash) => { - println!("{:016x}", hash); - } - } - } - - Ok(()) - } - "find-file" => { - let name = sub_matches - .get_one::("file-name") - .expect("required argument"); - let name = match u64::from_str_radix(name, 16).map(Murmur64::from) { - Ok(hash) => hash, - Err(_) => Murmur64::hash(name), - }; - - let bundles = database.files().iter().filter_map(|(bundle_hash, files)| { - if files.iter().any(|file| file.name == name) { - Some(bundle_hash) - } else { - None - } - }); - - let mut found = false; - - for bundle in bundles { - found = true; - println!("{:016x}", bundle); - } - - if !found { - std::process::exit(1); - } - - Ok(()) - } - _ => unreachable!( - "clap is configured to require a subcommand, and they're all handled above" - ), - } -} diff --git a/crates/dtmt/src/cmd/bundle/extract.rs b/crates/dtmt/src/cmd/bundle/extract.rs index 75f1360..9a0f1dd 100644 --- a/crates/dtmt/src/cmd/bundle/extract.rs +++ b/crates/dtmt/src/cmd/bundle/extract.rs @@ -150,7 +150,7 @@ async fn parse_command_line_template(tmpl: &String) -> Result { String::from_utf8_unchecked(bytes.to_vec()) }); - for arg in parsed.by_ref() { + while let Some(arg) = parsed.next() { // Safety: See above. cmd.arg(unsafe { String::from_utf8_unchecked(arg.to_vec()) }); } diff --git a/crates/dtmt/src/cmd/bundle/inject.rs b/crates/dtmt/src/cmd/bundle/inject.rs index 21f4a91..2b86691 100644 --- a/crates/dtmt/src/cmd/bundle/inject.rs +++ b/crates/dtmt/src/cmd/bundle/inject.rs @@ -1,297 +1,112 @@ -use std::path::{Path, PathBuf}; -use std::str::FromStr as _; +use std::path::PathBuf; -use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; -use color_eyre::eyre::{self, Context, OptionExt, Result}; +use clap::{value_parser, Arg, ArgMatches, Command}; +use color_eyre::eyre::{self, Context, Result}; use color_eyre::Help; -use path_slash::PathBufExt as _; -use sdk::murmur::IdString64; -use sdk::{Bundle, BundleFile, BundleFileType}; -use tokio::fs; +use sdk::Bundle; +use tokio::fs::{self, File}; +use tokio::io::AsyncReadExt; pub(crate) fn command_definition() -> Command { Command::new("inject") - .subcommand_required(true) - .about("Inject a file into a bundle.\n\ - Raw binary data can be used to directly replace the file's variant data blob without affecting the metadata.\n\ - Alternatively, a compiler format may be specified, and a complete bundle file is created.") + .about("Inject a file into a bundle.") + .arg( + Arg::new("replace") + .help("The name of a file in the bundle whos content should be replaced.") + .short('r') + .long("replace"), + ) .arg( Arg::new("output") .help( "The path to write the changed bundle to. \ - If omitted, the input bundle will be overwritten.\n\ - Remember to add a `.patch_` suffix if you also use '--patch'.", + If omitted, the input bundle will be overwritten.", ) .short('o') .long("output") .value_parser(value_parser!(PathBuf)), ) .arg( - Arg::new("patch") - .help("Create a patch bundle. Optionally, a patch NUMBER may be specified as \ - '--patch=123'.\nThe maximum number is 999, the default is 1.\n\ - If `--output` is not specified, the `.patch_` suffix is added to \ - the given bundle name.") - .short('p') - .long("patch") - .num_args(0..=1) - .require_equals(true) - .default_missing_value("1") - .value_name("NUMBER") - .value_parser(value_parser!(u16)) + Arg::new("bundle") + .help("Path to the bundle to inject the file into.") + .required(true) + .value_parser(value_parser!(PathBuf)), ) .arg( - Arg::new("type") - .help("Compile the new file as the given TYPE. If omitted, the file type is \ - is guessed from the file extension.") - .value_name("TYPE") + Arg::new("file") + .help("Path to the file to inject.") + .required(true) + .value_parser(value_parser!(PathBuf)), ) - .subcommand( - Command::new("replace") - .about("Replace an existing file in the bundle") - .arg( - Arg::new("variant") - .help("In combination with '--raw', specify the variant index to replace.") - .long("variant") - .default_value("0") - .value_parser(value_parser!(u8)) - ) - .arg( - Arg::new("raw") - .help("Insert the given file as raw binary data.\n\ - Cannot be used with '--patch'.") - .long("raw") - .action(ArgAction::SetTrue) - ) - .arg( - Arg::new("bundle") - .help("Path to the bundle to inject the file into.") - .required(true) - .value_parser(value_parser!(PathBuf)), - ) - .arg( - Arg::new("bundle-file") - .help("The name of a file in the bundle whose content should be replaced.") - .required(true), - ) - .arg( - Arg::new("new-file") - .help("Path to the file to inject.") - .required(true) - .value_parser(value_parser!(PathBuf)), - ), - ) - // .subcommand( - // Command::new("add") - // .about("Add a new file to the bundle") - // .arg( - // Arg::new("new-file") - // .help("Path to the file to inject.") - // .required(true) - // .value_parser(value_parser!(PathBuf)), - // ) - // .arg( - // Arg::new("bundle") - // .help("Path to the bundle to inject the file into.") - // .required(true) - // .value_parser(value_parser!(PathBuf)), - // ), - // ) } -#[tracing::instrument] -async fn compile_file( - path: impl AsRef + std::fmt::Debug, - name: impl Into + std::fmt::Debug, - file_type: BundleFileType, -) -> Result { - let path = path.as_ref(); - - let file_data = fs::read(&path) - .await - .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; - let _sjson = String::from_utf8(file_data) - .wrap_err_with(|| format!("Invalid UTF8 data in '{}'", path.display()))?; - - let _root = path.parent().ok_or_eyre("File path has no parent")?; - - eyre::bail!( - "Compilation for type '{}' is not implemented, yet", - file_type - ) -} - -#[tracing::instrument( - skip_all, - fields( - bundle_path = tracing::field::Empty, - in_file_path = tracing::field::Empty, - output_path = tracing::field::Empty, - target_name = tracing::field::Empty, - file_type = tracing::field::Empty, - raw = tracing::field::Empty, - ) -)] +#[tracing::instrument(skip_all)] pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { - let Some((op, sub_matches)) = matches.subcommand() else { - unreachable!("clap is configured to require a subcommand, and they're all handled above"); - }; - - let bundle_path = sub_matches + let bundle_path = matches .get_one::("bundle") .expect("required parameter not found"); - let in_file_path = sub_matches - .get_one::("new-file") + let file_path = matches + .get_one::("file") .expect("required parameter not found"); - let patch_number = matches - .get_one::("patch") - .map(|num| format!("{:03}", num)); + tracing::trace!(bundle_path = %bundle_path.display(), file_path = %file_path.display()); - let output_path = matches - .get_one::("output") - .cloned() - .unwrap_or_else(|| { - let mut output_path = bundle_path.clone(); - - if let Some(patch_number) = patch_number.as_ref() { - output_path.set_extension(format!("patch_{:03}", patch_number)); - } - - output_path - }); - - let target_name = if op == "replace" { - sub_matches - .get_one::("bundle-file") - .map(|name| match u64::from_str_radix(name, 16) { - Ok(id) => IdString64::from(id), - Err(_) => IdString64::String(name.clone()), - }) - .expect("argument is required") - } else { - let mut path = PathBuf::from(in_file_path); - path.set_extension(""); - IdString64::from(path.to_slash_lossy().to_string()) - }; - - let file_type = if let Some(forced_type) = matches.get_one::("type") { - BundleFileType::from_str(forced_type.as_str()).wrap_err("Unknown file type")? - } else { - in_file_path - .extension() - .and_then(|s| s.to_str()) - .ok_or_eyre("File extension missing") - .and_then(BundleFileType::from_str) - .wrap_err("Unknown file type") - .with_suggestion(|| "Use '--type TYPE' to specify the file type")? - }; - - { - let span = tracing::Span::current(); - if !span.is_disabled() { - span.record("bundle_path", bundle_path.display().to_string()); - span.record("in_file_path", in_file_path.display().to_string()); - span.record("output_path", output_path.display().to_string()); - span.record("raw", sub_matches.get_flag("raw")); - span.record("target_name", target_name.display().to_string()); - span.record("file_type", format!("{:?}", file_type)); - } - } - - let bundle_name = Bundle::get_name_from_path(&ctx, bundle_path); let mut bundle = { let binary = fs::read(bundle_path).await?; - Bundle::from_binary(&ctx, bundle_name.clone(), binary) - .wrap_err_with(|| format!("Failed to open bundle '{}'", bundle_path.display()))? + let name = Bundle::get_name_from_path(&ctx, bundle_path); + Bundle::from_binary(&ctx, name, binary).wrap_err("Failed to open bundle file")? }; - if op == "copy" { - unimplemented!("Implement copying a file from one bundle to the other."); - } + if let Some(name) = matches.get_one::("replace") { + let mut file = File::open(&file_path) + .await + .wrap_err_with(|| format!("Failed to open '{}'", file_path.display()))?; - let output_bundle = match op { - "replace" => { - let Some(file) = bundle - .files_mut() - .find(|file| *file.base_name() == target_name) - else { - let err = eyre::eyre!( - "No file with name '{}' in bundle '{}'", - target_name.display(), - bundle_path.display() - ); - - return Err(err).with_suggestion(|| { + if let Some(variant) = bundle + .files_mut() + .filter(|file| file.matches_name(name.clone())) + // TODO: Handle file variants + .find_map(|file| file.variants_mut().next()) + { + let mut data = Vec::new(); + file.read_to_end(&mut data) + .await + .wrap_err("Failed to read input file")?; + variant.set_data(data); + } else { + let err = eyre::eyre!("No file '{}' in this bundle.", name) + .with_suggestion(|| { format!( - "Run '{} bundle list \"{}\"' to list the files in this bundle.", + "Run '{} bundle list {}' to list the files in this bundle.", clap::crate_name!(), bundle_path.display() ) + }) + .with_suggestion(|| { + format!( + "Use '{} bundle inject --add {} {} {}' to add it as a new file", + clap::crate_name!(), + name, + bundle_path.display(), + file_path.display() + ) }); - }; - if sub_matches.get_flag("raw") { - let variant_index = sub_matches - .get_one::("variant") - .expect("argument with default missing"); - - let Some(variant) = file.variants_mut().nth(*variant_index as usize) else { - let err = eyre::eyre!( - "Variant index '{}' does not exist in '{}'", - variant_index, - target_name.display() - ); - - return Err(err).with_suggestion(|| { - format!( - "See '{} bundle inject add --help' if you want to add it as a new file", - clap::crate_name!(), - ) - }); - }; - - let data = tokio::fs::read(&in_file_path).await.wrap_err_with(|| { - format!("Failed to read file '{}'", in_file_path.display()) - })?; - variant.set_data(data); - file.set_modded(true); - bundle - } else { - let mut bundle_file = compile_file(in_file_path, target_name.clone(), file_type) - .await - .wrap_err("Failed to compile")?; - - bundle_file.set_modded(true); - - if patch_number.is_some() { - let mut output_bundle = Bundle::new(bundle_name); - output_bundle.add_file(bundle_file); - output_bundle - } else { - *file = bundle_file; - - dbg!(&file); - bundle - } - } + return Err(err); } - "add" => { - unimplemented!("Implement adding a new file to the bundle."); - } - _ => unreachable!("no other operations exist"), - }; - let data = output_bundle - .to_binary() - .wrap_err("Failed to write changed bundle to output")?; + let out_path = matches.get_one::("output").unwrap_or(bundle_path); + let data = bundle + .to_binary() + .wrap_err("Failed to write changed bundle to output")?; - fs::write(&output_path, &data) - .await - .wrap_err_with(|| format!("Failed to write data to '{}'", output_path.display()))?; + fs::write(out_path, &data) + .await + .wrap_err("Failed to write data to output file")?; - tracing::info!("Modified bundle written to '{}'", output_path.display()); - - Ok(()) + Ok(()) + } else { + eyre::bail!("Currently, only the '--replace' operation is supported."); + } } diff --git a/crates/dtmt/src/cmd/bundle/list.rs b/crates/dtmt/src/cmd/bundle/list.rs index 558126b..dd72ad2 100644 --- a/crates/dtmt/src/cmd/bundle/list.rs +++ b/crates/dtmt/src/cmd/bundle/list.rs @@ -36,18 +36,6 @@ enum OutputFormat { Text, } -fn format_byte_size(size: usize) -> String { - if size < 1024 { - format!("{} Bytes", size) - } else if size < 1024 * 1024 { - format!("{} kB", size / 1024) - } else if size < 1024 * 1024 * 1024 { - format!("{} MB", size / (1024 * 1024)) - } else { - format!("{} GB", size / (1024 * 1024 * 1024)) - } -} - #[tracing::instrument(skip(ctx))] async fn print_bundle_contents

(ctx: &sdk::Context, path: P, fmt: OutputFormat) -> Result<()> where @@ -62,11 +50,7 @@ where match fmt { OutputFormat::Text => { - println!( - "Bundle: {} ({:016x})", - bundle.name().display(), - bundle.name() - ); + println!("Bundle: {}", bundle.name().display()); for f in bundle.files().iter() { if f.variants().len() != 1 { @@ -79,10 +63,9 @@ where let v = &f.variants()[0]; println!( - "\t{}.{}: {} ({})", + "\t{}.{}: {} bytes", f.base_name().display(), f.file_type().ext_name(), - format_byte_size(v.size()), v.size() ); } diff --git a/crates/dtmt/src/cmd/bundle/mod.rs b/crates/dtmt/src/cmd/bundle/mod.rs index c5145e4..0e7c9f7 100644 --- a/crates/dtmt/src/cmd/bundle/mod.rs +++ b/crates/dtmt/src/cmd/bundle/mod.rs @@ -1,7 +1,6 @@ use clap::{ArgMatches, Command}; use color_eyre::eyre::Result; -mod db; mod decompress; mod extract; mod inject; @@ -15,7 +14,6 @@ pub(crate) fn command_definition() -> Command { .subcommand(extract::command_definition()) .subcommand(inject::command_definition()) .subcommand(list::command_definition()) - .subcommand(db::command_definition()) } #[tracing::instrument(skip_all)] @@ -25,7 +23,6 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { Some(("extract", sub_matches)) => extract::run(ctx, sub_matches).await, Some(("inject", sub_matches)) => inject::run(ctx, sub_matches).await, Some(("list", sub_matches)) => list::run(ctx, sub_matches).await, - Some(("db", sub_matches)) => db::run(ctx, sub_matches).await, _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" ), diff --git a/crates/dtmt/src/cmd/dictionary.rs b/crates/dtmt/src/cmd/dictionary.rs index 4c54c34..62a5295 100644 --- a/crates/dtmt/src/cmd/dictionary.rs +++ b/crates/dtmt/src/cmd/dictionary.rs @@ -227,12 +227,9 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<( let lookup = &ctx.lookup; let rows: Vec<_> = lookup.entries().iter().map(TableRow::from).collect(); - match print_stdout(rows.with_title()) { - Ok(_) => Ok(()), - // Closing stdout prematurely is normal behavior with things like piping into `head` - Err(err) if err.kind() == std::io::ErrorKind::BrokenPipe => Ok(()), - Err(err) => Err(err.into()), - } + print_stdout(rows.with_title())?; + + Ok(()) } _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs new file mode 100644 index 0000000..26d887f --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -0,0 +1,520 @@ +use std::collections::HashSet; +use std::fs; +use std::io::{BufWriter, Write}; +use std::path::PathBuf; +use std::sync::Arc; +use std::thread::JoinHandle; + +use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; +use color_eyre::eyre::{self, Context}; +use color_eyre::Result; +use crossbeam::channel::{bounded, unbounded, Receiver, Sender}; +use itertools::Itertools; +use sdk::murmur::Murmur64; +use tokio::time::Instant; + +pub(crate) fn command_definition() -> Command { + Command::new("brute-force-words") + .about( + "Given a list of words and a set of delimiters, iteratevily creates permutations \ + of growing length.\n\ + Delimiters are placed between every word in the result.\n\n\ + Example: \ + Given the words ['packages', 'boot'], the delimiters ['/', '_'] and a length of 2, the resulting \ + words will be\n\ + - packages\n\ + - boot\n\ + - packages/packages\n\ + - packages_packages\n\ + - packages/boot\n\ + - packages_boot\n\ + - boot/packages\n\ + - boot_packages\n\ + - boot/boot\n\ + - boot_boot", + ) + .arg( + Arg::new("delimiter") + .help( + "The delimiters to put between the words. \ + All permutations of this list will be tried for every string of words.\n\ + Specify multiple times to set multiple values.\n\ + Defaults to ['/', '_'].", + ) + .short('d') + .long("delimiter") + .action(ArgAction::Append), + ) + .arg( + Arg::new("max-length") + .help("The maximum number of words up to which to build strings.") + .long("max") + .long("max-length") + .short('m') + .default_value("5") + .value_parser(value_parser!(usize)), + ) + .arg( + Arg::new("continue") + .help("Can be used to continue a previous operation where it stopped. Word list and delimiters must match.") + .short('c') + .long("continue") + ) + .arg( + Arg::new("threads") + .help("The number of workers to run in parallel.") + .long("threads") + .short('n') + .default_value("6") + .value_parser(value_parser!(usize)) + ) + .arg( + Arg::new("words") + .help("Path to a file containing words line by line.") + .required(true) + .value_parser(value_parser!(PathBuf)), + ) + .arg( + Arg::new("hashes") + .help( + "Path to a file containing the hashes to attempt to brute force. \ + Hashes are expected in hexadecimal notiation. \ + Only 64-bit hashes are supported." + ) + .required(true) + .value_parser(value_parser!(PathBuf)), + ) +} + +const LINE_FEED: u8 = 0x0A; +const UNDERSCORE: u8 = 0x5F; +const ZERO: u8 = 0x30; + +const PREFIXES: [&str; 36] = [ + "", + "content/characters/", + "content/debug/", + "content/decals/", + "content/environment/", + "content/fx/", + "content/fx/particles/", + "content/gizmos/", + "content/items/", + "content/levels/", + "content/liquid_area/", + "content/localization/", + "content/materials/", + "content/minion_impact_assets/", + "content/pickups/", + "content/shading_environments/", + "content/textures/", + "content/ui/", + "content/videos/", + "content/vo/", + "content/volume_types/", + "content/weapons/", + "content/", + "core/", + "core/units/", + "packages/boot_assets/", + "packages/content/", + "packages/game_scripts/", + "packages/strings/", + "packages/ui/", + "packages/", + "wwise/events/", + "wwise/packages/", + "wwise/world_sound_fx/", + "wwise/events/weapons/", + "wwise/events/minions/", +]; + +fn make_info_printer(rx: Receiver<(usize, usize, String)>, hash_count: usize) -> JoinHandle<()> { + std::thread::spawn(move || { + let mut writer = std::io::stderr(); + let mut total_count = 0; + let mut total_found = 0; + + let mut start = Instant::now(); + + while let Ok((count, found, last)) = rx.recv() { + total_count += count; + total_found += found; + + let now = Instant::now(); + if (now - start).as_millis() > 250 { + let s = &last[0..std::cmp::min(last.len(), 60)]; + let s = format!( + "\r{:12} per second | {total_found:6}/{hash_count} found | {s:<60}", + total_count * 4 + ); + + writer.write_all(s.as_bytes()).unwrap(); + + total_count = 0; + start = now; + } + } + }) +} + +fn make_stdout_printer(rx: Receiver>) -> JoinHandle<()> { + std::thread::spawn(move || { + let mut writer = std::io::stdout(); + + while let Ok(buf) = rx.recv() { + writer.write_all(&buf).unwrap(); + } + }) +} + +struct State { + delimiter_lists: Arc>>, + hashes: Arc>, + words: Arc>, + delimiters_len: usize, + stdout_tx: Sender>, + info_tx: Sender<(usize, usize, String)>, +} + +fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { + std::thread::spawn(move || { + let delimiter_lists = &state.delimiter_lists; + let hashes = &state.hashes; + let words = &state.words; + let delimiters_len = state.delimiters_len; + + let mut count = 0; + let mut found = 0; + let mut buf = Vec::with_capacity(1024); + + while let Ok(indices) = rx.recv() { + let sequence = indices.iter().map(|i| words[*i].as_str()); + + // We only want delimiters between words, so we keep that iterator shorter by + // one. + let delimiter_count = sequence.len() as u32 - 1; + + for prefix in PREFIXES.iter().map(|p| p.as_bytes()) { + buf.clear(); + + // We can keep the prefix at the front of the buffer and only + // replace the parts after that. + let prefix_len = prefix.len(); + buf.extend_from_slice(prefix); + + for delims in delimiter_lists + .iter() + .take(delimiters_len.pow(delimiter_count)) + { + buf.truncate(prefix_len); + + let delims = delims + .iter() + .map(|s| s.as_str()) + .take(delimiter_count as usize); + sequence + .clone() + .interleave(delims.clone()) + .for_each(|word| buf.extend_from_slice(word.as_bytes())); + + count += 1; + + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + + buf.push(LINE_FEED); + if state.stdout_tx.send(buf.clone()).is_err() { + return; + } + } else { + let word_len = buf.len(); + + // If the regular word itself didn't match, we check + // for numbered suffixes. + // For now, we only check up to `09` to avoid more complex logic + // writing into the buffer. + // Packages that contain files with higher numbers than this + // should hopefully become easier to spot once a good number of + // hashes is found. + for i in 1..=9 { + buf.truncate(word_len); + buf.push(UNDERSCORE); + buf.push(ZERO); + buf.push(ZERO + i); + + count += 1; + + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + + buf.push(LINE_FEED); + if state.stdout_tx.send(buf.clone()).is_err() { + return; + } + } else { + break; + } + } + } + } + } + + if count >= 2 * 1024 * 1024 { + // The last prefix in the set is the one that will stay in the buffer + // when we're about to print here. + // So we strip that, to show just the generated part. + // We also restrict the length to stay on a single line. + let prefix_len = PREFIXES[35].len(); + // No need to wait for this + let _ = state.info_tx.try_send(( + count, + found, + String::from_utf8_lossy(&buf[prefix_len..]).to_string(), + )); + + count = 0; + found = 0; + } + } + }) +} + +fn build_delimiter_lists(delimiters: impl AsRef<[String]>, max_length: usize) -> Vec> { + let delimiters = delimiters.as_ref(); + let mut indices = vec![0; max_length]; + let mut list = Vec::new(); + + for _ in 0..delimiters.len().pow(max_length as u32) { + list.push( + indices + .iter() + .map(|i| delimiters[*i].clone()) + .collect::>(), + ); + + for v in indices.iter_mut() { + if *v >= delimiters.len() - 1 { + *v = 0; + break; + } else { + *v += 1; + } + } + } + + list +} + +fn build_initial_indices( + cont: Option<&String>, + delimiters: impl AsRef<[String]>, + words: impl AsRef<[String]>, +) -> Result> { + if let Some(cont) = cont { + let mut splits = vec![cont.clone()]; + + for delim in delimiters.as_ref().iter() { + splits = splits + .iter() + .flat_map(|s| s.split(delim)) + .map(|s| s.to_string()) + .collect(); + } + + let indices = splits + .into_iter() + .map(|s| { + words + .as_ref() + .iter() + .enumerate() + .find(|(_, v)| s == **v) + .map(|(i, _)| i) + .ok_or_else(|| eyre::eyre!("'{}' is not in the word list", s)) + }) + .collect::>()?; + + tracing::info!("Continuing from '{}' -> '{:?}'", cont, &indices); + + Ok(indices) + } else { + Ok(vec![0]) + } +} + +#[tracing::instrument(skip_all)] +#[allow(clippy::mut_range_bound)] +pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + let max_length: usize = matches + .get_one::("max-length") + .copied() + .expect("parameter has default"); + + let num_threads: usize = matches + .get_one::("threads") + .copied() + .expect("parameter has default"); + + let words = { + let path = matches + .get_one::("words") + .expect("missing required parameter"); + + let file = fs::read_to_string(path) + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + + let words: Vec<_> = file.lines().map(str::to_string).collect(); + + if words.is_empty() { + eyre::bail!("Word list must not be empty"); + } + + Arc::new(words) + }; + + let hashes = { + let path = matches + .get_one::("hashes") + .expect("missing required argument"); + let content = fs::read_to_string(path) + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + + let hashes: Result, _> = content + .lines() + .map(|s| u64::from_str_radix(s, 16).map(Murmur64::from)) + .collect(); + + let hashes = hashes?; + + tracing::trace!("{:?}", hashes); + + Arc::new(hashes) + }; + + let mut delimiters: Vec = matches + .get_many::("delimiter") + .unwrap_or_default() + .cloned() + .collect(); + + if delimiters.is_empty() { + delimiters.push(String::from("/")); + delimiters.push(String::from("_")); + } + + let delimiters_len = delimiters.len(); + + let word_count = words.len(); + tracing::info!("{} words to try", word_count); + + // To be able to easily combine the permutations of words and delimiters, + // we turn the latter into a pre-defined list of all permutations of delimiters + // that are possible at the given amount of words. + // Combining `Iterator::cycle` with `Itertools::permutations` works, but + // with a high `max_length`, it runs OOM. + // So we basically have to implement a smaller version of the iterative algorithm we use later on + // to build permutations of the actual words. + let delimiter_lists = { + let lists = build_delimiter_lists(&delimiters, max_length - 1); + Arc::new(lists) + }; + tracing::debug!("{:?}", delimiter_lists); + + let (info_tx, info_rx) = bounded(100); + let (stdout_tx, stdout_rx) = unbounded::>(); + let (task_tx, task_rx) = bounded::>(num_threads * 4); + let mut handles = Vec::new(); + + for _ in 0..num_threads { + let handle = make_worker( + task_rx.clone(), + State { + delimiter_lists: Arc::clone(&delimiter_lists), + hashes: Arc::clone(&hashes), + words: Arc::clone(&words), + delimiters_len, + stdout_tx: stdout_tx.clone(), + info_tx: info_tx.clone(), + }, + ); + handles.push(handle); + } + // These are only used inside the worker threads, but due to the loops above, we had to + // clone them one too many times. + // So we drop that extra reference immediately, to ensure that the channels can + // disconnect properly when the threads finish. + drop(stdout_tx); + drop(info_tx); + + handles.push(make_info_printer(info_rx, hashes.len())); + handles.push(make_stdout_printer(stdout_rx)); + + let mut indices = + build_initial_indices(matches.get_one::("continue"), &delimiters, &*words) + .wrap_err("Failed to build initial indices")?; + let mut indices_len = indices.len(); + let mut sequence = indices + .iter() + .map(|index| words[*index].as_str()) + .collect::>(); + + // Prevent re-allocation by reserving as much as we need upfront + indices.reserve(max_length); + sequence.reserve(max_length); + + 'outer: loop { + task_tx.send(indices.clone())?; + + for i in 0..indices_len { + let index = indices.get_mut(i).unwrap(); + let word = sequence.get_mut(i).unwrap(); + + if *index >= word_count - 1 { + *index = 0; + *word = words[*index].as_str(); + + if indices.get(i + 1).is_none() { + indices_len += 1; + + if indices_len > max_length { + break 'outer; + } + + indices.push(0); + sequence.push(words[0].as_str()); + + break; + } + } else { + *index += 1; + *word = words[*index].as_str(); + break; + } + } + } + + // Dropping the senders will disconnect the channel, + // so that the threads holding the other end will eventually + // complete as well. + drop(task_tx); + + for handle in handles { + match handle.join() { + Ok(_) => {} + Err(value) => { + if let Some(err) = value.downcast_ref::() { + eyre::bail!("Thread failed: {}", err); + } else { + eyre::bail!("Thread failed with unknown error: {:?}", value); + } + } + } + } + + let _ = std::io::stdout().write_all("\r".as_bytes()); + + Ok(()) +} diff --git a/crates/dtmt/src/cmd/experiment/extract_words.rs b/crates/dtmt/src/cmd/experiment/extract_words.rs new file mode 100644 index 0000000..1a8cda5 --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/extract_words.rs @@ -0,0 +1,463 @@ +use std::collections::HashMap; +use std::path::PathBuf; + +use clap::{value_parser, Arg, ArgMatches, Command, ValueEnum}; +use color_eyre::eyre::Context; +use color_eyre::Result; +use tokio::fs; + +pub(crate) fn command_definition() -> Command { + Command::new("extract-words") + .about( + "Extract unique alphanumeric sequences that match common identifier rules from the given file. \ + Only ASCII is supported.", + ) + .arg( + Arg::new("file") + .required(true) + .value_parser(value_parser!(PathBuf)) + .help("Path to the file to extract words from."), + ) + .arg( + Arg::new("min-length") + .help("Minimum length to consider a word.") + .long("min-length") + .short('m') + .default_value("3") + .value_parser(value_parser!(usize)) + ) + .arg( + Arg::new("algorithm") + .help("The algorithm to determine matching words") + .long("algorithm") + .short('a') + .default_value("identifier") + .value_parser(value_parser!(Algorithm)) + ) +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq, ValueEnum)] +#[value(rename_all = "snake_case")] +enum Algorithm { + Alphabetic, + Alphanumeric, + Identifier, + Number, + Hash32, + Hash64, + Paths, +} + +impl Algorithm { + fn is_start(&self, c: char) -> bool { + match self { + Self::Alphabetic => c.is_ascii_alphabetic(), + Self::Alphanumeric => c.is_ascii_alphanumeric(), + Self::Identifier => c.is_ascii_alphabetic(), + Self::Number => c.is_numeric(), + Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + // Supposed to be handled separately + Self::Paths => false, + } + } + + fn is_body(&self, c: char) -> bool { + match self { + Self::Alphabetic => c.is_ascii_alphabetic(), + Self::Alphanumeric => c.is_ascii_alphanumeric(), + Self::Identifier => c.is_ascii_alphanumeric(), + Self::Number => c.is_numeric(), + Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + // Supposed to be handled separately + Self::Paths => false, + } + } + + fn is_length(&self, len: usize) -> bool { + match self { + Self::Alphabetic => true, + Self::Alphanumeric => true, + Self::Identifier => true, + Self::Number => true, + Self::Hash32 => len == 8, + Self::Hash64 => len == 16, + // Supposed to be handled separately + Self::Paths => false, + } + } +} + +impl std::fmt::Display for Algorithm { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Algorithm::Alphabetic => "alphabetic", + Algorithm::Alphanumeric => "alphanumeric", + Algorithm::Identifier => "identifier", + Algorithm::Number => "number", + Algorithm::Hash32 => "hash32", + Algorithm::Hash64 => "hash64", + Algorithm::Paths => "paths", + } + ) + } +} + +#[derive(Copy, Clone, Debug)] +enum PathState { + Begin, + PathComponent, + PathSeparator, + Boundary, + NonWord, + End, +} + +#[tracing::instrument(skip(chars))] +fn extract_paths(chars: impl Iterator) -> Vec> { + let mut chars = chars.peekable(); + + let mut state = PathState::Begin; + let mut list = Vec::new(); + let mut path = Vec::new(); + let mut word = String::new(); + + let is_boundary = |c: char| c == '\n' || c == ' ' || c == ',' || c == '\t' || c == '|'; + + 'machine: loop { + state = match state { + PathState::Begin => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some('/') => PathState::PathSeparator, + Some(_) => PathState::NonWord, + }, + PathState::PathComponent => match chars.next() { + None => { + path.push(word.clone()); + list.push(path.clone()); + + PathState::End + } + Some(c) if c.is_ascii_alphanumeric() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some('/') => { + path.push(word.clone()); + word.clear(); + + PathState::PathSeparator + } + Some(c) if is_boundary(c) => { + path.push(word.clone()); + list.push(path.clone()); + + path.clear(); + word.clear(); + + PathState::Boundary + } + Some(_) => { + list.push(path.clone()); + + path.clear(); + word.clear(); + + PathState::NonWord + } + }, + PathState::PathSeparator => match chars.next() { + None => { + list.push(path.clone()); + PathState::End + } + Some('/') => PathState::PathSeparator, + Some(c) if c.is_ascii_alphabetic() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => { + list.push(path.clone()); + path.clear(); + PathState::Boundary + } + Some(_) => { + list.push(path.clone()); + path.clear(); + PathState::NonWord + } + }, + PathState::Boundary => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::NonWord => match chars.next() { + None => PathState::End, + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::End => { + break 'machine; + } + } + } + + list +} + +#[tracing::instrument(skip(chars))] +fn algorithm_path_components(chars: impl Iterator, min_length: usize) { + let mut chars = chars.peekable(); + + let mut state = PathState::Begin; + let mut word = String::new(); + let mut lists = vec![HashMap::::new()]; + let mut index = 0; + + let is_boundary = |c: char| c == '\n' || c == ' ' || c == ',' || c == '\t'; + + 'machine: loop { + state = match state { + PathState::Begin => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + // Ignore leading path separators to not trigger the logic of advancing + // the component count + Some('/') => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::PathComponent => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphanumeric() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some('/') => PathState::PathSeparator, + Some(c) => { + if index > 0 && word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + word.clear(); + + index = 0; + + if is_boundary(c) { + PathState::Boundary + } else { + PathState::NonWord + } + } + }, + PathState::PathSeparator => { + if word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + word.clear(); + + index += 1; + if lists.get(index).is_none() { + lists.push(HashMap::new()); + } + + // Ignore multiple separators + while chars.next_if(|c| *c == '/').is_some() {} + + match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => { + index = 0; + PathState::Boundary + } + Some(_) => { + index = 0; + PathState::NonWord + } + } + } + PathState::Boundary => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::NonWord => match chars.next() { + None => PathState::End, + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::End => { + if word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + + break 'machine; + } + } + } + + for i in 0..lists.len() { + print!("Word {i}, Count {i},"); + } + println!(); + + let mut lines: Vec>> = Vec::new(); + + for (i, list) in lists.into_iter().enumerate() { + let mut entries = list.into_iter().collect::>(); + entries.sort_by(|(_, a), (_, b)| b.partial_cmp(a).unwrap()); + + for (j, (word, count)) in entries.into_iter().enumerate() { + if let Some(line) = lines.get_mut(j) { + while line.len() < i { + line.push(None); + } + line.push(Some((word, count))); + } else { + let mut line = Vec::new(); + while line.len() < i { + line.push(None); + } + line.push(Some((word, count))); + lines.push(line); + } + } + } + + for line in lines.iter() { + for cell in line.iter() { + if let Some((word, count)) = cell { + print!("{},{},", word, count); + } else { + print!(",,"); + } + } + println!(); + } +} + +#[derive(Copy, Clone, Debug)] +enum State { + Begin, + NonWord, + Word, + End, +} + +#[tracing::instrument(skip_all)] +pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + let path = matches + .get_one::("file") + .expect("missing required parameter"); + + let algorithm = matches + .get_one::("algorithm") + .expect("parameter has default"); + + let min_length = matches + .get_one::("min-length") + .copied() + .expect("paramter has default"); + + let content = fs::read_to_string(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + let mut chars = content.chars(); + + if *algorithm == Algorithm::Paths { + algorithm_path_components(chars, min_length); + return Ok(()); + } + + let mut state = State::Begin; + let mut word = String::new(); + let mut visited = HashMap::new(); + + 'machine: loop { + state = match state { + State::Begin => match chars.next() { + None => State::End, + Some(c) if algorithm.is_start(c) => { + word.push(c); + State::Word + } + Some(_) => State::NonWord, + }, + State::End => break 'machine, + State::NonWord => match chars.next() { + None => State::End, + Some(c) if algorithm.is_body(c) => { + word.push(c); + State::Word + } + Some(_) => State::NonWord, + }, + State::Word => match chars.next() { + None => { + if word.len() >= min_length && algorithm.is_length(word.len()) { + visited + .entry(word.clone()) + .and_modify(|v| *v += 1) + .or_insert(1); + } + State::End + } + Some(c) if algorithm.is_body(c) => { + word.push(c); + State::Word + } + Some(_) => { + if word.len() >= min_length && algorithm.is_length(word.len()) { + visited + .entry(word.clone()) + .and_modify(|v| *v += 1) + .or_insert(1); + } + word.clear(); + State::NonWord + } + }, + } + } + + let mut entries: Vec<(String, usize)> = visited.into_iter().collect(); + // Reverse sides during comparison to get "highest to lowest" + entries.sort_by(|(_, a), (_, b)| b.partial_cmp(a).unwrap()); + + entries + .iter() + .for_each(|(word, count)| println!("{:016} {}", word, count)); + + Ok(()) +} diff --git a/crates/dtmt/src/cmd/experiment/mod.rs b/crates/dtmt/src/cmd/experiment/mod.rs new file mode 100644 index 0000000..c53d9b5 --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/mod.rs @@ -0,0 +1,26 @@ +use clap::{ArgMatches, Command}; +use color_eyre::Result; + +mod brute_force_words; +mod extract_words; + +pub(crate) fn command_definition() -> Command { + Command::new("experiment") + .subcommand_required(true) + .about("A collection of utilities and experiments.") + .subcommand(brute_force_words::command_definition()) + .subcommand(extract_words::command_definition()) +} + +#[tracing::instrument(skip_all)] +pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + match matches.subcommand() { + // It's fine to block here, as this is the only thing that's executing on the runtime. + // The other option with `spawn_blocking` would require setting up values to be Send+Sync. + Some(("brute-force-words", sub_matches)) => brute_force_words::run(ctx, sub_matches), + Some(("extract-words", sub_matches)) => extract_words::run(ctx, sub_matches).await, + _ => unreachable!( + "clap is configured to require a subcommand, and they're all handled above" + ), + } +} diff --git a/crates/dtmt/src/cmd/migrate.rs b/crates/dtmt/src/cmd/migrate.rs index d7bfa19..2eacded 100644 --- a/crates/dtmt/src/cmd/migrate.rs +++ b/crates/dtmt/src/cmd/migrate.rs @@ -351,7 +351,6 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> }, depends: vec![ModDependency::ID(String::from("DMF"))], bundled: true, - name_overrides: HashMap::new(), }; tracing::debug!(?dtmt_cfg); diff --git a/crates/dtmt/src/cmd/new.rs b/crates/dtmt/src/cmd/new.rs index 571b0cb..eb6a4f9 100644 --- a/crates/dtmt/src/cmd/new.rs +++ b/crates/dtmt/src/cmd/new.rs @@ -1,30 +1,18 @@ +use std::collections::HashMap; use std::path::PathBuf; use clap::{Arg, ArgMatches, Command}; use color_eyre::eyre::{self, Context, Result}; use color_eyre::Help; use futures::{StreamExt, TryStreamExt}; -use minijinja::Environment; +use string_template::Template; use tokio::fs::{self, DirBuilder}; const TEMPLATES: [(&str, &str); 5] = [ ( "dtmt.cfg", - r#"// -// This is your mod's main configuration file. It tells DTMT how to build the mod, -// and DTMM what to display to your users. -// Certain files have been pre-filled by the template, the ones commented out (`//`) -// are optional. -// -// A unique identifier (preferably lower case, alphanumeric) -id = "{{id}}" -// The display name that your users will see. -// This doesn't have to be unique, but you still want to avoid being confused with other -// mods. + r#"id = "{{id}}" name = "{{name}}" -// It's good practice to increase this number whenever you publish changes. -// It's up to you if you use SemVer or something simpler like `1970-12-24`. It should sort and -// compare well, though. version = "0.1.0" // author = "" @@ -44,25 +32,16 @@ categories = [ // A list of mod IDs that this mod depends on. You can find // those IDs by downloading the mod and extracting their `dtmt.cfg`. -// To make your fellow modders' lives easier, publish your own mods' IDs -// somewhere visible, such as the Nexusmods page. depends = [ DMF ] -// The primary resources that serve as the entry point to your -// mod's code. Unless for very specific use cases, the generated -// values shouldn't be changed. resources = { init = "scripts/mods/{{id}}/init" data = "scripts/mods/{{id}}/data" localization = "scripts/mods/{{id}}/localization" } -// The list of packages, or bundles, to build. -// Each one corresponds to a package definition in the named folder. -// For mods that contain only code and/or a few small assets, a single -// package will suffice. packages = [ "packages/mods/{{id}}" ] @@ -80,6 +59,7 @@ packages = [ r#"local mod = get_mod("{{id}}") -- Your mod code goes here. +-- https://vmf-docs.verminti.de "#, ), ( @@ -157,45 +137,34 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> tracing::debug!(root = %root.display(), name, id); - let render_ctx = minijinja::context!(name => name.as_str(), id => id.as_str()); - let env = Environment::new(); + let mut data = HashMap::new(); + data.insert("name", name.as_str()); + data.insert("id", id.as_str()); let templates = TEMPLATES .iter() .map(|(path_tmpl, content_tmpl)| { - env.render_str(path_tmpl, &render_ctx) - .wrap_err_with(|| format!("Failed to render template: {}", path_tmpl)) - .and_then(|path| { - env.render_named_str(&path, content_tmpl, &render_ctx) - .wrap_err_with(|| format!("Failed to render template '{}'", &path)) - .map(|content| (root.join(path), content)) - }) + let path = Template::new(path_tmpl).render(&data); + let content = Template::new(content_tmpl).render(&data); + + (root.join(path), content) }) - .map(|res| async move { - match res { - Ok((path, content)) => { - let dir = path - .parent() - .ok_or_else(|| eyre::eyre!("invalid root path"))?; + .map(|(path, content)| async move { + let dir = path + .parent() + .ok_or_else(|| eyre::eyre!("invalid root path"))?; - DirBuilder::new() - .recursive(true) - .create(&dir) - .await - .wrap_err_with(|| { - format!("Failed to create directory {}", dir.display()) - })?; + DirBuilder::new() + .recursive(true) + .create(&dir) + .await + .wrap_err_with(|| format!("Failed to create directory {}", dir.display()))?; - tracing::trace!("Writing file {}", path.display()); + tracing::trace!("Writing file {}", path.display()); - fs::write(&path, content.as_bytes()) - .await - .wrap_err_with(|| { - format!("Failed to write content to path {}", path.display()) - }) - } - Err(e) => Err(e), - } + fs::write(&path, content.as_bytes()) + .await + .wrap_err_with(|| format!("Failed to write content to path {}", path.display())) }); futures::stream::iter(templates) diff --git a/crates/dtmt/src/cmd/watch.rs b/crates/dtmt/src/cmd/watch.rs index 2abd0f7..79fab67 100644 --- a/crates/dtmt/src/cmd/watch.rs +++ b/crates/dtmt/src/cmd/watch.rs @@ -77,14 +77,17 @@ pub(crate) fn command_definition() -> Command { ) } -#[tracing::instrument] -async fn compile( +async fn compile( cfg: &ModConfig, - out_path: impl AsRef + std::fmt::Debug, - archive_path: impl AsRef + std::fmt::Debug, - game_dir: Arc + std::fmt::Debug>>, -) -> Result<()> { - let out_path = out_path.as_ref(); + out_path: P1, + archive_path: P2, + game_dir: Arc>, +) -> Result<()> +where + P1: AsRef + std::marker::Copy, + P2: AsRef, + P3: AsRef, +{ build(cfg, out_path, game_dir) .await .wrap_err("Failed to build bundles")?; diff --git a/crates/dtmt/src/main.rs b/crates/dtmt/src/main.rs index e41e802..b01956a 100644 --- a/crates/dtmt/src/main.rs +++ b/crates/dtmt/src/main.rs @@ -21,6 +21,7 @@ mod cmd { pub mod build; pub mod bundle; pub mod dictionary; + pub mod experiment; pub mod migrate; pub mod murmur; pub mod new; @@ -36,21 +37,10 @@ struct GlobalConfig { } #[tokio::main] -#[tracing::instrument(level = "error", fields(cmd_line = tracing::field::Empty))] +#[tracing::instrument] async fn main() -> Result<()> { color_eyre::install()?; - { - let span = tracing::Span::current(); - if !span.is_disabled() { - let cmdline: String = std::env::args_os().fold(String::new(), |mut s, arg| { - s.push_str(&arg.to_string_lossy()); - s - }); - span.record("cmd_line", cmdline); - } - } - let matches = command!() .subcommand_required(true) .arg( @@ -67,6 +57,7 @@ async fn main() -> Result<()> { .subcommand(cmd::build::command_definition()) .subcommand(cmd::bundle::command_definition()) .subcommand(cmd::dictionary::command_definition()) + .subcommand(cmd::experiment::command_definition()) .subcommand(cmd::migrate::command_definition()) .subcommand(cmd::murmur::command_definition()) .subcommand(cmd::new::command_definition()) @@ -144,6 +135,7 @@ async fn main() -> Result<()> { Some(("build", sub_matches)) => cmd::build::run(ctx, sub_matches).await?, Some(("bundle", sub_matches)) => cmd::bundle::run(ctx, sub_matches).await?, Some(("dictionary", sub_matches)) => cmd::dictionary::run(ctx, sub_matches).await?, + Some(("experiment", sub_matches)) => cmd::experiment::run(ctx, sub_matches).await?, Some(("migrate", sub_matches)) => cmd::migrate::run(ctx, sub_matches).await?, Some(("murmur", sub_matches)) => cmd::murmur::run(ctx, sub_matches).await?, Some(("new", sub_matches)) => cmd::new::run(ctx, sub_matches).await?, diff --git a/crates/dtmt/src/shell_parse.rs b/crates/dtmt/src/shell_parse.rs index 13b3c4d..6f35a5f 100644 --- a/crates/dtmt/src/shell_parse.rs +++ b/crates/dtmt/src/shell_parse.rs @@ -54,11 +54,17 @@ impl<'a> ShellParser<'a> { } _ => {} }, - ParserState::SingleQuote => if c == b'\'' { - return Some(&self.bytes[start..(self.offset - 1)]); + ParserState::SingleQuote => match c { + b'\'' => { + return Some(&self.bytes[start..(self.offset - 1)]); + } + _ => {} }, - ParserState::DoubleQuote => if c == b'"' { - return Some(&self.bytes[start..(self.offset - 1)]); + ParserState::DoubleQuote => match c { + b'"' => { + return Some(&self.bytes[start..(self.offset - 1)]); + } + _ => {} }, } } diff --git a/lib/color-eyre b/lib/color-eyre index 228b8ca..b40962a 160000 --- a/lib/color-eyre +++ b/lib/color-eyre @@ -1 +1 @@ -Subproject commit 228b8ca37ee79ab9afa45c40da415e4dcb029751 +Subproject commit b40962a61c748756d7da293d9fff26aca019603e diff --git a/lib/dtmt-shared/Cargo.toml b/lib/dtmt-shared/Cargo.toml index 26e1b6a..b547dbe 100644 --- a/lib/dtmt-shared/Cargo.toml +++ b/lib/dtmt-shared/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ansi_term = { workspace = true } -color-eyre = { workspace = true } -serde = { workspace = true } -steamlocate = { workspace = true } -time = { workspace = true } -tracing = { workspace = true } -tracing-error = { workspace = true } -tracing-subscriber = { workspace = true } +ansi_term = "0.12.1" +color-eyre = "0.6.2" +serde = "1.0.152" +steamlocate = "2.0.0-beta.2" +time = { version = "0.3.19", features = ["formatting", "local-offset", "macros"] } +tracing = "0.1.37" +tracing-error = "0.2.0" +tracing-subscriber = "0.3.16" diff --git a/lib/dtmt-shared/src/lib.rs b/lib/dtmt-shared/src/lib.rs index db11579..3c9530e 100644 --- a/lib/dtmt-shared/src/lib.rs +++ b/lib/dtmt-shared/src/lib.rs @@ -1,4 +1,3 @@ -use std::collections::HashMap; use std::path::PathBuf; use color_eyre::eyre::{OptionExt as _, WrapErr as _}; @@ -68,8 +67,6 @@ pub struct ModConfig { pub depends: Vec, #[serde(default = "default_true", skip_serializing_if = "is_true")] pub bundled: bool, - #[serde(default)] - pub name_overrides: HashMap, } pub const STEAMAPP_ID: u32 = 1361210; @@ -87,7 +84,7 @@ pub fn collect_game_info() -> Result> { .find_app(STEAMAPP_ID) .wrap_err("Failed to look up game by Steam app ID")?; - let Some((app, library)) = found else { + let Some((app, _)) = found else { return Ok(None); }; @@ -96,7 +93,7 @@ pub fn collect_game_info() -> Result> { .ok_or_eyre("Missing field 'last_updated'")?; Ok(Some(GameInfo { - path: library.path().join(app.install_dir), + path: app.install_dir.into(), last_updated: last_updated.into(), })) } diff --git a/lib/dtmt-shared/src/log.rs b/lib/dtmt-shared/src/log.rs index 9c95c63..ab0b7b5 100644 --- a/lib/dtmt-shared/src/log.rs +++ b/lib/dtmt-shared/src/log.rs @@ -84,7 +84,7 @@ pub fn create_tracing_subscriber() { EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::try_new("info").unwrap()); let (dev_stdout_layer, prod_stdout_layer, filter_layer) = if cfg!(debug_assertions) { - let fmt_layer = fmt::layer().pretty().with_writer(std::io::stderr); + let fmt_layer = fmt::layer().pretty(); (Some(fmt_layer), None, None) } else { // Creates a layer that @@ -93,7 +93,6 @@ pub fn create_tracing_subscriber() { // - does not print spans/targets // - only prints time, not date let fmt_layer = fmt::layer() - .with_writer(std::io::stderr) .event_format(Formatter) .fmt_fields(debug_fn(format_fields)); diff --git a/lib/luajit2-sys b/lib/luajit2-sys index 6d94a4d..5d1a075 160000 --- a/lib/luajit2-sys +++ b/lib/luajit2-sys @@ -1 +1 @@ -Subproject commit 6d94a4dd2c296bf1f044ee4c70fb10dca4c1c241 +Subproject commit 5d1a075742395f767c79d9c0d7466c6fb442f106 diff --git a/lib/nexusmods/Cargo.toml b/lib/nexusmods/Cargo.toml index b9cc879..2f90a46 100644 --- a/lib/nexusmods/Cargo.toml +++ b/lib/nexusmods/Cargo.toml @@ -12,7 +12,7 @@ regex = "1.7.1" reqwest = { version = "0.12.4" } serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.94" -thiserror = "2.0.0" +thiserror = "1.0.39" time = { version = "0.3.20", features = ["serde"] } tracing = "0.1.37" url = { version = "2.3.1", features = ["serde"] } diff --git a/lib/nexusmods/src/lib.rs b/lib/nexusmods/src/lib.rs index cddf6a0..314acb1 100644 --- a/lib/nexusmods/src/lib.rs +++ b/lib/nexusmods/src/lib.rs @@ -28,7 +28,7 @@ pub enum Error { HTTP(#[from] reqwest::Error), #[error("invalid URL: {0:?}")] URLParseError(#[from] url::ParseError), - #[error("failed to deserialize due to {error}: {json}")] + #[error("failed to deserialize '{error}': {json}")] Deserialize { json: String, error: serde_json::Error, @@ -37,7 +37,7 @@ pub enum Error { InvalidHeaderValue(#[from] InvalidHeaderValue), #[error("this error cannot happen")] Infallible(#[from] Infallible), - #[error("invalid NXM URL '{url}': {0}", url = .1.as_str())] + #[error("invalid NXM URL '{}': {0}", .1.as_str())] InvalidNXM(&'static str, Url), #[error("{0}")] Custom(String), diff --git a/lib/oodle/Cargo.toml b/lib/oodle/Cargo.toml index 4a6fe2f..6fc5039 100644 --- a/lib/oodle/Cargo.toml +++ b/lib/oodle/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -color-eyre = { workspace = true } -tracing = { workspace = true } +color-eyre = "0.6.2" +tracing = "0.1.37" [build-dependencies] -bindgen = "0.72.0" +bindgen = "0.69.4" diff --git a/lib/oodle/src/lib.rs b/lib/oodle/src/lib.rs index 871daab..76b1d16 100644 --- a/lib/oodle/src/lib.rs +++ b/lib/oodle/src/lib.rs @@ -7,7 +7,6 @@ use std::ptr; use color_eyre::{eyre, Result}; #[allow(dead_code)] -#[allow(clippy::identity_op)] mod bindings { include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } diff --git a/lib/sdk/Cargo.toml b/lib/sdk/Cargo.toml index 4667a1c..b164d47 100644 --- a/lib/sdk/Cargo.toml +++ b/lib/sdk/Cargo.toml @@ -4,23 +4,23 @@ version = "0.3.0" edition = "2021" [dependencies] -async-recursion = { workspace = true } -bitflags = { workspace = true } -byteorder = { workspace = true } -color-eyre = { workspace = true } -csv-async = { workspace = true } -fastrand = { workspace = true } -futures = { workspace = true } -futures-util = { workspace = true } -glob = { workspace = true } -luajit2-sys = { workspace = true } -nanorand = { workspace = true } -oodle = { workspace = true } -path-slash = { workspace = true } -pin-project-lite = { workspace = true } -serde = { workspace = true } -serde_sjson = { workspace = true } -tokio = { workspace = true } -tokio-stream = { workspace = true } -tracing = { workspace = true } -tracing-error = { workspace = true } +bitflags = "2.5.0" +byteorder = "1.4.3" +color-eyre = "0.6.2" +csv-async = { version = "1.2.4", features = ["tokio", "serde"] } +fastrand = "2.1.0" +futures = "0.3.25" +futures-util = "0.3.24" +glob = "0.3.0" +nanorand = "0.7.0" +pin-project-lite = "0.2.9" +serde = { version = "1.0.147", features = ["derive"] } +serde_sjson = { path = "../../lib/serde_sjson", version = "*" } +oodle = { path = "../../lib/oodle", version = "*" } +tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } +tracing = { version = "0.1.37", features = ["async-await"] } +tracing-error = "0.2.0" +luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } +async-recursion = "1.0.2" +path-slash = "0.2.1" diff --git a/lib/sdk/src/binary.rs b/lib/sdk/src/binary.rs index 9348e1b..1fcc90e 100644 --- a/lib/sdk/src/binary.rs +++ b/lib/sdk/src/binary.rs @@ -43,7 +43,6 @@ impl FromBinary for Vec { } pub mod sync { - use std::ffi::CStr; use std::io::{self, Read, Seek, SeekFrom}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; @@ -166,13 +165,25 @@ pub mod sync { } fn read_string_len(&mut self, len: usize) -> Result { - let pos = self.stream_position(); + let mut buf = vec![0; len]; + let res = self + .read_exact(&mut buf) + .map_err(Report::new) + .and_then(|_| { + String::from_utf8(buf).map_err(|err| { + let ascii = String::from_utf8_lossy(err.as_bytes()).to_string(); + let bytes = format!("{:?}", err.as_bytes()); + Report::new(err) + .with_section(move || bytes.header("Bytes:")) + .with_section(move || ascii.header("ASCII:")) + }) + }); - let res = read_string_len(self, len); if res.is_ok() { return res; } + let pos = self.stream_position(); if pos.is_ok() { res.with_section(|| { format!("{pos:#X} ({pos})", pos = pos.unwrap()).header("Position: ") @@ -232,22 +243,4 @@ pub mod sync { Err(err).with_section(|| format!("{pos:#X} ({pos})").header("Position: ")) } - - fn read_string_len(mut r: impl Read, len: usize) -> Result { - let mut buf = vec![0; len]; - r.read_exact(&mut buf) - .wrap_err_with(|| format!("Failed to read {} bytes", len))?; - - let res = match CStr::from_bytes_until_nul(&buf) { - Ok(s) => { - let s = s.to_str()?; - Ok(s.to_string()) - } - Err(_) => String::from_utf8(buf.clone()).map_err(Report::new), - }; - - res.wrap_err("Invalid binary for UTF8 string") - .with_section(|| format!("{}", String::from_utf8_lossy(&buf)).header("ASCI:")) - .with_section(|| format!("{:x?}", buf).header("Bytes:")) - } } diff --git a/lib/sdk/src/bundle/database.rs b/lib/sdk/src/bundle/database.rs index 185c62f..6152ede 100644 --- a/lib/sdk/src/bundle/database.rs +++ b/lib/sdk/src/bundle/database.rs @@ -13,21 +13,21 @@ use crate::binary::ToBinary; use crate::murmur::Murmur64; use crate::Bundle; -use super::filetype::BundleFileType; +use super::file::BundleFileType; const DATABASE_VERSION: u32 = 0x6; const FILE_VERSION: u32 = 0x4; pub struct BundleFile { - pub name: String, - pub stream: String, - pub platform_specific: bool, - pub file_time: u64, + name: String, + stream: String, + platform_specific: bool, + file_time: u64, } pub struct FileName { - pub extension: BundleFileType, - pub name: Murmur64, + extension: BundleFileType, + name: Murmur64, } pub struct BundleDatabase { @@ -36,34 +36,7 @@ pub struct BundleDatabase { bundle_contents: HashMap>, } -// Implements the partial Murmur that's used by the engine to compute bundle resource hashes, -// but in a way that the loop can be done outside the function. -#[inline(always)] -fn add_to_resource_hash(mut k: u64, name: impl Into) -> u64 { - const M: u64 = 0xc6a4a7935bd1e995; - const R: u64 = 47; - - let mut h: u64 = name.into(); - - k = k.wrapping_mul(M); - k ^= k >> R; - k = k.wrapping_mul(M); - - h ^= k; - k = M.wrapping_mul(h); - - k -} - impl BundleDatabase { - pub fn bundles(&self) -> &HashMap> { - &self.stored_files - } - - pub fn files(&self) -> &HashMap> { - &self.bundle_contents - } - pub fn add_bundle(&mut self, bundle: &Bundle) { let hash = bundle.name().to_murmur64(); let name = hash.to_string(); @@ -96,26 +69,20 @@ impl BundleDatabase { } } - let mut resource_hash = 0; - for f in bundle.files() { - let name = f.base_name().to_murmur64(); let file_name = FileName { extension: f.file_type(), - name, + name: f.base_name().to_murmur64(), }; - resource_hash = add_to_resource_hash(resource_hash, name); + // TODO: Compute actual resource hash + self.resource_hashes.insert(hash, 0); - // TODO: Make sure each file name only exists once. Probably best to turn - // the `Vec` into a sorted `HashSet`. self.bundle_contents .entry(hash) .or_default() .push(file_name); } - - self.resource_hashes.insert(hash, resource_hash); } } @@ -136,7 +103,7 @@ impl FromBinary for BundleDatabase { let mut stored_files = HashMap::with_capacity(num_entries); for _ in 0..num_entries { - let hash = r.read_u64().map(Murmur64::from)?; + let hash = Murmur64::from(r.read_u64()?); let num_files = r.read_u32()? as usize; let mut files = Vec::with_capacity(num_files); @@ -194,7 +161,7 @@ impl FromBinary for BundleDatabase { let mut resource_hashes = HashMap::with_capacity(num_hashes); for _ in 0..num_hashes { - let name = r.read_u64().map(Murmur64::from)?; + let name = Murmur64::from(r.read_u64()?); let hash = r.read_u64()?; resource_hashes.insert(name, hash); @@ -204,14 +171,14 @@ impl FromBinary for BundleDatabase { let mut bundle_contents = HashMap::with_capacity(num_contents); for _ in 0..num_contents { - let hash = r.read_u64().map(Murmur64::from)?; + let hash = Murmur64::from(r.read_u64()?); let num_files = r.read_u32()? as usize; let mut files = Vec::with_capacity(num_files); for _ in 0..num_files { - let extension = r.read_u64().map(BundleFileType::from)?; - let name = r.read_u64().map(Murmur64::from)?; + let extension = BundleFileType::from(r.read_u64()?); + let name = Murmur64::from(r.read_u64()?); files.push(FileName { extension, name }); } diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index 6d49821..4d6c56e 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -5,12 +5,407 @@ use bitflags::bitflags; use color_eyre::eyre::Context; use color_eyre::{eyre, Result}; use futures::future::join_all; +use serde::Serialize; use crate::binary::sync::*; use crate::filetype::*; use crate::murmur::{HashGroup, IdString64, Murmur64}; -use super::filetype::BundleFileType; +#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +pub enum BundleFileType { + Animation, + AnimationCurves, + Apb, + BakedLighting, + Bik, + BlendSet, + Bones, + Chroma, + CommonPackage, + Config, + Crypto, + Data, + Entity, + Flow, + Font, + Ies, + Ini, + Input, + Ivf, + Keys, + Level, + Lua, + Material, + Mod, + MouseCursor, + NavData, + NetworkConfig, + OddleNet, + Package, + Particles, + PhysicsProperties, + RenderConfig, + RtPipeline, + Scene, + Shader, + ShaderLibrary, + ShaderLibraryGroup, + ShadingEnvionmentMapping, + ShadingEnvironment, + Slug, + SlugAlbum, + SoundEnvironment, + SpuJob, + StateMachine, + StaticPVS, + Strings, + SurfaceProperties, + Texture, + TimpaniBank, + TimpaniMaster, + Tome, + Ugg, + Unit, + Upb, + VectorField, + Wav, + WwiseBank, + WwiseDep, + WwiseEvent, + WwiseMetadata, + WwiseStream, + Xml, + + Unknown(Murmur64), +} + +impl BundleFileType { + pub fn ext_name(&self) -> String { + match self { + BundleFileType::AnimationCurves => String::from("animation_curves"), + BundleFileType::Animation => String::from("animation"), + BundleFileType::Apb => String::from("apb"), + BundleFileType::BakedLighting => String::from("baked_lighting"), + BundleFileType::Bik => String::from("bik"), + BundleFileType::BlendSet => String::from("blend_set"), + BundleFileType::Bones => String::from("bones"), + BundleFileType::Chroma => String::from("chroma"), + BundleFileType::CommonPackage => String::from("common_package"), + BundleFileType::Config => String::from("config"), + BundleFileType::Crypto => String::from("crypto"), + BundleFileType::Data => String::from("data"), + BundleFileType::Entity => String::from("entity"), + BundleFileType::Flow => String::from("flow"), + BundleFileType::Font => String::from("font"), + BundleFileType::Ies => String::from("ies"), + BundleFileType::Ini => String::from("ini"), + BundleFileType::Input => String::from("input"), + BundleFileType::Ivf => String::from("ivf"), + BundleFileType::Keys => String::from("keys"), + BundleFileType::Level => String::from("level"), + BundleFileType::Lua => String::from("lua"), + BundleFileType::Material => String::from("material"), + BundleFileType::Mod => String::from("mod"), + BundleFileType::MouseCursor => String::from("mouse_cursor"), + BundleFileType::NavData => String::from("nav_data"), + BundleFileType::NetworkConfig => String::from("network_config"), + BundleFileType::OddleNet => String::from("oodle_net"), + BundleFileType::Package => String::from("package"), + BundleFileType::Particles => String::from("particles"), + BundleFileType::PhysicsProperties => String::from("physics_properties"), + BundleFileType::RenderConfig => String::from("render_config"), + BundleFileType::RtPipeline => String::from("rt_pipeline"), + BundleFileType::Scene => String::from("scene"), + BundleFileType::ShaderLibraryGroup => String::from("shader_library_group"), + BundleFileType::ShaderLibrary => String::from("shader_library"), + BundleFileType::Shader => String::from("shader"), + BundleFileType::ShadingEnvionmentMapping => String::from("shading_environment_mapping"), + BundleFileType::ShadingEnvironment => String::from("shading_environment"), + BundleFileType::SlugAlbum => String::from("slug_album"), + BundleFileType::Slug => String::from("slug"), + BundleFileType::SoundEnvironment => String::from("sound_environment"), + BundleFileType::SpuJob => String::from("spu_job"), + BundleFileType::StateMachine => String::from("state_machine"), + BundleFileType::StaticPVS => String::from("static_pvs"), + BundleFileType::Strings => String::from("strings"), + BundleFileType::SurfaceProperties => String::from("surface_properties"), + BundleFileType::Texture => String::from("texture"), + BundleFileType::TimpaniBank => String::from("timpani_bank"), + BundleFileType::TimpaniMaster => String::from("timpani_master"), + BundleFileType::Tome => String::from("tome"), + BundleFileType::Ugg => String::from("ugg"), + BundleFileType::Unit => String::from("unit"), + BundleFileType::Upb => String::from("upb"), + BundleFileType::VectorField => String::from("vector_field"), + BundleFileType::Wav => String::from("wav"), + BundleFileType::WwiseBank => String::from("wwise_bank"), + BundleFileType::WwiseDep => String::from("wwise_dep"), + BundleFileType::WwiseEvent => String::from("wwise_event"), + BundleFileType::WwiseMetadata => String::from("wwise_metadata"), + BundleFileType::WwiseStream => String::from("wwise_stream"), + BundleFileType::Xml => String::from("xml"), + + BundleFileType::Unknown(s) => format!("{s:016X}"), + } + } + + pub fn decompiled_ext_name(&self) -> String { + match self { + BundleFileType::Texture => String::from("dds"), + BundleFileType::WwiseBank => String::from("bnk"), + BundleFileType::WwiseStream => String::from("ogg"), + _ => self.ext_name(), + } + } + + pub fn hash(&self) -> Murmur64 { + Murmur64::from(*self) + } +} + +impl std::str::FromStr for BundleFileType { + type Err = color_eyre::Report; + + fn from_str(s: &str) -> Result { + let val = match s { + "animation_curves" => BundleFileType::AnimationCurves, + "animation" => BundleFileType::Animation, + "apb" => BundleFileType::Apb, + "baked_lighting" => BundleFileType::BakedLighting, + "bik" => BundleFileType::Bik, + "blend_set" => BundleFileType::BlendSet, + "bones" => BundleFileType::Bones, + "chroma" => BundleFileType::Chroma, + "common_package" => BundleFileType::CommonPackage, + "config" => BundleFileType::Config, + "crypto" => BundleFileType::Crypto, + "data" => BundleFileType::Data, + "entity" => BundleFileType::Entity, + "flow" => BundleFileType::Flow, + "font" => BundleFileType::Font, + "ies" => BundleFileType::Ies, + "ini" => BundleFileType::Ini, + "input" => BundleFileType::Input, + "ivf" => BundleFileType::Ivf, + "keys" => BundleFileType::Keys, + "level" => BundleFileType::Level, + "lua" => BundleFileType::Lua, + "material" => BundleFileType::Material, + "mod" => BundleFileType::Mod, + "mouse_cursor" => BundleFileType::MouseCursor, + "nav_data" => BundleFileType::NavData, + "network_config" => BundleFileType::NetworkConfig, + "oodle_net" => BundleFileType::OddleNet, + "package" => BundleFileType::Package, + "particles" => BundleFileType::Particles, + "physics_properties" => BundleFileType::PhysicsProperties, + "render_config" => BundleFileType::RenderConfig, + "rt_pipeline" => BundleFileType::RtPipeline, + "scene" => BundleFileType::Scene, + "shader_library_group" => BundleFileType::ShaderLibraryGroup, + "shader_library" => BundleFileType::ShaderLibrary, + "shader" => BundleFileType::Shader, + "shading_environment_mapping" => BundleFileType::ShadingEnvionmentMapping, + "shading_environment" => BundleFileType::ShadingEnvironment, + "slug_album" => BundleFileType::SlugAlbum, + "slug" => BundleFileType::Slug, + "sound_environment" => BundleFileType::SoundEnvironment, + "spu_job" => BundleFileType::SpuJob, + "state_machine" => BundleFileType::StateMachine, + "static_pvs" => BundleFileType::StaticPVS, + "strings" => BundleFileType::Strings, + "surface_properties" => BundleFileType::SurfaceProperties, + "texture" => BundleFileType::Texture, + "timpani_bank" => BundleFileType::TimpaniBank, + "timpani_master" => BundleFileType::TimpaniMaster, + "tome" => BundleFileType::Tome, + "ugg" => BundleFileType::Ugg, + "unit" => BundleFileType::Unit, + "upb" => BundleFileType::Upb, + "vector_field" => BundleFileType::VectorField, + "wav" => BundleFileType::Wav, + "wwise_bank" => BundleFileType::WwiseBank, + "wwise_dep" => BundleFileType::WwiseDep, + "wwise_event" => BundleFileType::WwiseEvent, + "wwise_metadata" => BundleFileType::WwiseMetadata, + "wwise_stream" => BundleFileType::WwiseStream, + "xml" => BundleFileType::Xml, + s => eyre::bail!("Unknown type string '{}'", s), + }; + + Ok(val) + } +} + +impl Serialize for BundleFileType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let value = self.ext_name(); + value.serialize(serializer) + } +} + +impl From for BundleFileType { + fn from(value: Murmur64) -> Self { + Self::from(Into::::into(value)) + } +} + +impl From for BundleFileType { + fn from(hash: u64) -> BundleFileType { + match hash { + 0x931e336d7646cc26 => BundleFileType::Animation, + 0xdcfb9e18fff13984 => BundleFileType::AnimationCurves, + 0x3eed05ba83af5090 => BundleFileType::Apb, + 0x7ffdb779b04e4ed1 => BundleFileType::BakedLighting, + 0xaa5965f03029fa18 => BundleFileType::Bik, + 0xe301e8af94e3b5a3 => BundleFileType::BlendSet, + 0x18dead01056b72e9 => BundleFileType::Bones, + 0xb7893adf7567506a => BundleFileType::Chroma, + 0xfe9754bd19814a47 => BundleFileType::CommonPackage, + 0x82645835e6b73232 => BundleFileType::Config, + 0x69108ded1e3e634b => BundleFileType::Crypto, + 0x8fd0d44d20650b68 => BundleFileType::Data, + 0x9831ca893b0d087d => BundleFileType::Entity, + 0x92d3ee038eeb610d => BundleFileType::Flow, + 0x9efe0a916aae7880 => BundleFileType::Font, + 0x8f7d5a2c0f967655 => BundleFileType::Ies, + 0xd526a27da14f1dc5 => BundleFileType::Ini, + 0x2bbcabe5074ade9e => BundleFileType::Input, + 0xfa4a8e091a91201e => BundleFileType::Ivf, + 0xa62f9297dc969e85 => BundleFileType::Keys, + 0x2a690fd348fe9ac5 => BundleFileType::Level, + 0xa14e8dfa2cd117e2 => BundleFileType::Lua, + 0xeac0b497876adedf => BundleFileType::Material, + 0x3fcdd69156a46417 => BundleFileType::Mod, + 0xb277b11fe4a61d37 => BundleFileType::MouseCursor, + 0x169de9566953d264 => BundleFileType::NavData, + 0x3b1fa9e8f6bac374 => BundleFileType::NetworkConfig, + 0xb0f2c12eb107f4d8 => BundleFileType::OddleNet, + 0xad9c6d9ed1e5e77a => BundleFileType::Package, + 0xa8193123526fad64 => BundleFileType::Particles, + 0xbf21403a3ab0bbb1 => BundleFileType::PhysicsProperties, + 0x27862fe24795319c => BundleFileType::RenderConfig, + 0x9ca183c2d0e76dee => BundleFileType::RtPipeline, + 0x9d0a795bfe818d19 => BundleFileType::Scene, + 0xcce8d5b5f5ae333f => BundleFileType::Shader, + 0xe5ee32a477239a93 => BundleFileType::ShaderLibrary, + 0x9e5c3cc74575aeb5 => BundleFileType::ShaderLibraryGroup, + 0x250e0a11ac8e26f8 => BundleFileType::ShadingEnvionmentMapping, + 0xfe73c7dcff8a7ca5 => BundleFileType::ShadingEnvironment, + 0xa27b4d04a9ba6f9e => BundleFileType::Slug, + 0xe9fc9ea7042e5ec0 => BundleFileType::SlugAlbum, + 0xd8b27864a97ffdd7 => BundleFileType::SoundEnvironment, + 0xf97af9983c05b950 => BundleFileType::SpuJob, + 0xa486d4045106165c => BundleFileType::StateMachine, + 0xe3f0baa17d620321 => BundleFileType::StaticPVS, + 0x0d972bab10b40fd3 => BundleFileType::Strings, + 0xad2d3fa30d9ab394 => BundleFileType::SurfaceProperties, + 0xcd4238c6a0c69e32 => BundleFileType::Texture, + 0x99736be1fff739a4 => BundleFileType::TimpaniBank, + 0x00a3e6c59a2b9c6c => BundleFileType::TimpaniMaster, + 0x19c792357c99f49b => BundleFileType::Tome, + 0x712d6e3dd1024c9c => BundleFileType::Ugg, + 0xe0a48d0be9a7453f => BundleFileType::Unit, + 0xa99510c6e86dd3c2 => BundleFileType::Upb, + 0xf7505933166d6755 => BundleFileType::VectorField, + 0x786f65c00a816b19 => BundleFileType::Wav, + 0x535a7bd3e650d799 => BundleFileType::WwiseBank, + 0xaf32095c82f2b070 => BundleFileType::WwiseDep, + 0xaabdd317b58dfc8a => BundleFileType::WwiseEvent, + 0xd50a8b7e1c82b110 => BundleFileType::WwiseMetadata, + 0x504b55235d21440e => BundleFileType::WwiseStream, + 0x76015845a6003765 => BundleFileType::Xml, + + _ => BundleFileType::Unknown(Murmur64::from(hash)), + } + } +} + +impl From for u64 { + fn from(t: BundleFileType) -> u64 { + match t { + BundleFileType::Animation => 0x931e336d7646cc26, + BundleFileType::AnimationCurves => 0xdcfb9e18fff13984, + BundleFileType::Apb => 0x3eed05ba83af5090, + BundleFileType::BakedLighting => 0x7ffdb779b04e4ed1, + BundleFileType::Bik => 0xaa5965f03029fa18, + BundleFileType::BlendSet => 0xe301e8af94e3b5a3, + BundleFileType::Bones => 0x18dead01056b72e9, + BundleFileType::Chroma => 0xb7893adf7567506a, + BundleFileType::CommonPackage => 0xfe9754bd19814a47, + BundleFileType::Config => 0x82645835e6b73232, + BundleFileType::Crypto => 0x69108ded1e3e634b, + BundleFileType::Data => 0x8fd0d44d20650b68, + BundleFileType::Entity => 0x9831ca893b0d087d, + BundleFileType::Flow => 0x92d3ee038eeb610d, + BundleFileType::Font => 0x9efe0a916aae7880, + BundleFileType::Ies => 0x8f7d5a2c0f967655, + BundleFileType::Ini => 0xd526a27da14f1dc5, + BundleFileType::Input => 0x2bbcabe5074ade9e, + BundleFileType::Ivf => 0xfa4a8e091a91201e, + BundleFileType::Keys => 0xa62f9297dc969e85, + BundleFileType::Level => 0x2a690fd348fe9ac5, + BundleFileType::Lua => 0xa14e8dfa2cd117e2, + BundleFileType::Material => 0xeac0b497876adedf, + BundleFileType::Mod => 0x3fcdd69156a46417, + BundleFileType::MouseCursor => 0xb277b11fe4a61d37, + BundleFileType::NavData => 0x169de9566953d264, + BundleFileType::NetworkConfig => 0x3b1fa9e8f6bac374, + BundleFileType::OddleNet => 0xb0f2c12eb107f4d8, + BundleFileType::Package => 0xad9c6d9ed1e5e77a, + BundleFileType::Particles => 0xa8193123526fad64, + BundleFileType::PhysicsProperties => 0xbf21403a3ab0bbb1, + BundleFileType::RenderConfig => 0x27862fe24795319c, + BundleFileType::RtPipeline => 0x9ca183c2d0e76dee, + BundleFileType::Scene => 0x9d0a795bfe818d19, + BundleFileType::Shader => 0xcce8d5b5f5ae333f, + BundleFileType::ShaderLibrary => 0xe5ee32a477239a93, + BundleFileType::ShaderLibraryGroup => 0x9e5c3cc74575aeb5, + BundleFileType::ShadingEnvionmentMapping => 0x250e0a11ac8e26f8, + BundleFileType::ShadingEnvironment => 0xfe73c7dcff8a7ca5, + BundleFileType::Slug => 0xa27b4d04a9ba6f9e, + BundleFileType::SlugAlbum => 0xe9fc9ea7042e5ec0, + BundleFileType::SoundEnvironment => 0xd8b27864a97ffdd7, + BundleFileType::SpuJob => 0xf97af9983c05b950, + BundleFileType::StateMachine => 0xa486d4045106165c, + BundleFileType::StaticPVS => 0xe3f0baa17d620321, + BundleFileType::Strings => 0x0d972bab10b40fd3, + BundleFileType::SurfaceProperties => 0xad2d3fa30d9ab394, + BundleFileType::Texture => 0xcd4238c6a0c69e32, + BundleFileType::TimpaniBank => 0x99736be1fff739a4, + BundleFileType::TimpaniMaster => 0x00a3e6c59a2b9c6c, + BundleFileType::Tome => 0x19c792357c99f49b, + BundleFileType::Ugg => 0x712d6e3dd1024c9c, + BundleFileType::Unit => 0xe0a48d0be9a7453f, + BundleFileType::Upb => 0xa99510c6e86dd3c2, + BundleFileType::VectorField => 0xf7505933166d6755, + BundleFileType::Wav => 0x786f65c00a816b19, + BundleFileType::WwiseBank => 0x535a7bd3e650d799, + BundleFileType::WwiseDep => 0xaf32095c82f2b070, + BundleFileType::WwiseEvent => 0xaabdd317b58dfc8a, + BundleFileType::WwiseMetadata => 0xd50a8b7e1c82b110, + BundleFileType::WwiseStream => 0x504b55235d21440e, + BundleFileType::Xml => 0x76015845a6003765, + + BundleFileType::Unknown(hash) => hash.into(), + } + } +} +impl From for Murmur64 { + fn from(t: BundleFileType) -> Murmur64 { + let hash: u64 = t.into(); + Murmur64::from(hash) + } +} + +impl std::fmt::Display for BundleFileType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.ext_name()) + } +} #[derive(Debug)] struct BundleFileHeader { @@ -20,7 +415,6 @@ struct BundleFileHeader { len_data_file_name: usize, } -#[derive(Clone, Debug)] pub struct BundleFileVariant { property: u32, data: Vec, @@ -110,12 +504,9 @@ bitflags! { #[derive(Default, Clone, Copy, Debug)] pub struct Properties: u32 { const DATA = 0b100; - // A custom flag used by DTMT to signify a file altered by mods. - const MODDED = 1 << 31; } } -#[derive(Clone, Debug)] pub struct BundleFile { file_type: BundleFileType, name: IdString64, @@ -124,7 +515,7 @@ pub struct BundleFile { } impl BundleFile { - pub fn new(name: impl Into, file_type: BundleFileType) -> Self { + pub fn new(name: String, file_type: BundleFileType) -> Self { Self { file_type, name: name.into(), @@ -137,18 +528,6 @@ impl BundleFile { self.variants.push(variant) } - pub fn set_variants(&mut self, variants: Vec) { - self.variants = variants; - } - - pub fn set_props(&mut self, props: Properties) { - self.props = props; - } - - pub fn set_modded(&mut self, is_modded: bool) { - self.props.set(Properties::MODDED, is_modded); - } - #[tracing::instrument(name = "File::read", skip(ctx, r))] pub fn from_reader(ctx: &crate::Context, r: &mut R, props: Properties) -> Result where @@ -268,15 +647,20 @@ impl BundleFile { Ok(w.into_inner()) } - #[tracing::instrument("File::from_sjson", skip(sjson, name), fields(name = %name.display()))] - pub async fn from_sjson( - name: IdString64, + #[tracing::instrument(name = "File::from_sjson", skip(sjson))] + pub async fn from_sjson( + name: String, file_type: BundleFileType, - sjson: impl AsRef, - root: impl AsRef + std::fmt::Debug, - ) -> Result { + sjson: S, + root: P, + ) -> Result + where + P: AsRef + std::fmt::Debug, + S: AsRef, + { match file_type { - BundleFileType::Lua => lua::compile(name, sjson).wrap_err("Failed to compile Lua file"), + BundleFileType::Lua => lua::compile(name.clone(), sjson) + .wrap_err_with(|| format!("Failed to compile Lua file '{}'", name)), BundleFileType::Unknown(_) => { eyre::bail!("Unknown file type. Cannot compile from SJSON"); } @@ -315,13 +699,17 @@ impl BundleFile { s } - pub fn matches_name(&self, name: &IdString64) -> bool { - if self.name == *name { + pub fn matches_name(&self, name: S) -> bool + where + S: Into, + { + let name = name.into(); + if self.name == name { return true; } if let IdString64::String(name) = name { - self.name(false, None) == *name || self.name(true, None) == *name + self.name(false, None) == name || self.name(true, None) == name } else { false } diff --git a/lib/sdk/src/bundle/filetype.rs b/lib/sdk/src/bundle/filetype.rs deleted file mode 100644 index 68ff6b5..0000000 --- a/lib/sdk/src/bundle/filetype.rs +++ /dev/null @@ -1,174 +0,0 @@ -use color_eyre::{eyre, Result}; -use serde::Serialize; - -use crate::murmur::Murmur64; - -macro_rules! make_enum { - ( - $( $variant:ident, $hash:expr, $ext:expr $(, $decompiled:expr)? ; )+ - ) => { - #[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] - pub enum BundleFileType { - $( - $variant, - )+ - Unknown(Murmur64), - } - - impl BundleFileType { - pub fn ext_name(&self) -> String { - match self { - $( - Self::$variant => String::from($ext), - )+ - Self::Unknown(s) => format!("{s:016X}"), - } - } - - pub fn decompiled_ext_name(&self) -> String { - match self { - $( - $( Self::$variant => String::from($decompiled), )? - )+ - _ => self.ext_name(), - } - } - } - - impl std::str::FromStr for BundleFileType { - type Err = color_eyre::Report; - fn from_str(s: &str) -> Result { - match s { - $( - $ext => Ok(Self::$variant), - )+ - s => eyre::bail!("Unknown type string '{}'", s), - } - } - } - - impl From for BundleFileType { - fn from(h: u64) -> Self { - match h { - $( - $hash => Self::$variant, - )+ - hash => Self::Unknown(hash.into()), - } - } - } - - impl From for u64 { - fn from(t: BundleFileType) -> u64 { - match t { - $( - BundleFileType::$variant => $hash, - )+ - BundleFileType::Unknown(hash) => hash.into(), - } - } - } - } -} - -make_enum! { - AnimationCurves, 0xdcfb9e18fff13984, "animation_curves"; - Animation, 0x931e336d7646cc26, "animation"; - Apb, 0x3eed05ba83af5090, "apb"; - BakedLighting, 0x7ffdb779b04e4ed1, "baked_lighting"; - Bik, 0xaa5965f03029fa18, "bik"; - BlendSet, 0xe301e8af94e3b5a3, "blend_set"; - Bones, 0x18dead01056b72e9, "bones"; - Chroma, 0xb7893adf7567506a, "chroma"; - CommonPackage, 0xfe9754bd19814a47, "common_package"; - Config, 0x82645835e6b73232, "config"; - Crypto, 0x69108ded1e3e634b, "crypto"; - Data, 0x8fd0d44d20650b68, "data"; - Entity, 0x9831ca893b0d087d, "entity"; - Flow, 0x92d3ee038eeb610d, "flow"; - Font, 0x9efe0a916aae7880, "font"; - Ies, 0x8f7d5a2c0f967655, "ies"; - Ini, 0xd526a27da14f1dc5, "ini"; - Input, 0x2bbcabe5074ade9e, "input"; - Ivf, 0xfa4a8e091a91201e, "ivf"; - Keys, 0xa62f9297dc969e85, "keys"; - Level, 0x2a690fd348fe9ac5, "level"; - Lua, 0xa14e8dfa2cd117e2, "lua"; - Material, 0xeac0b497876adedf, "material"; - Mod, 0x3fcdd69156a46417, "mod"; - MouseCursor, 0xb277b11fe4a61d37, "mouse_cursor"; - NavData, 0x169de9566953d264, "nav_data"; - NetworkConfig, 0x3b1fa9e8f6bac374, "network_config"; - OddleNet, 0xb0f2c12eb107f4d8, "oodle_net"; - Package, 0xad9c6d9ed1e5e77a, "package"; - Particles, 0xa8193123526fad64, "particles"; - PhysicsProperties, 0xbf21403a3ab0bbb1, "physics_properties"; - RenderConfig, 0x27862fe24795319c, "render_config"; - RtPipeline, 0x9ca183c2d0e76dee, "rt_pipeline"; - Scene, 0x9d0a795bfe818d19, "scene"; - Shader, 0xcce8d5b5f5ae333f, "shader"; - ShaderLibrary, 0xe5ee32a477239a93, "shader_library"; - ShaderLibraryGroup, 0x9e5c3cc74575aeb5, "shader_library_group"; - ShadingEnvionmentMapping, 0x250e0a11ac8e26f8, "shading_envionment_mapping"; - ShadingEnvironment, 0xfe73c7dcff8a7ca5, "shading_environment"; - Slug, 0xa27b4d04a9ba6f9e, "slug"; - SlugAlbum, 0xe9fc9ea7042e5ec0, "slug_album"; - SoundEnvironment, 0xd8b27864a97ffdd7, "sound_environment"; - SpuJob, 0xf97af9983c05b950, "spu_job"; - StateMachine, 0xa486d4045106165c, "state_machine"; - StaticPVS, 0xe3f0baa17d620321, "static_pvs"; - Strings, 0x0d972bab10b40fd3, "strings"; - SurfaceProperties, 0xad2d3fa30d9ab394, "surface_properties"; - Texture, 0xcd4238c6a0c69e32, "texture", "dds"; - TimpaniBank, 0x99736be1fff739a4, "timpani_bank"; - TimpaniMaster, 0x00a3e6c59a2b9c6c, "timpani_master"; - Tome, 0x19c792357c99f49b, "tome"; - Ugg, 0x712d6e3dd1024c9c, "ugg"; - Unit, 0xe0a48d0be9a7453f, "unit"; - Upb, 0xa99510c6e86dd3c2, "upb"; - VectorField, 0xf7505933166d6755, "vector_field"; - Wav, 0x786f65c00a816b19, "wav"; - WwiseBank, 0x535a7bd3e650d799, "wwise_bank", "bnk"; - WwiseDep, 0xaf32095c82f2b070, "wwise_dep"; - WwiseEvent, 0xaabdd317b58dfc8a, "wwise_event"; - WwiseMetadata, 0xd50a8b7e1c82b110, "wwise_metadata"; - WwiseStream, 0x504b55235d21440e, "wwise_stream", "ogg"; - Xml, 0x76015845a6003765, "xml"; - Theme, 0x38BB9442048A7FBD, "theme"; - MissionThemes, 0x80F2DE893657F83A, "mission_themes"; -} - -impl BundleFileType { - pub fn hash(&self) -> Murmur64 { - Murmur64::from(*self) - } -} - -impl Serialize for BundleFileType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - let value = self.ext_name(); - value.serialize(serializer) - } -} - -impl From for BundleFileType { - fn from(value: Murmur64) -> Self { - Self::from(Into::::into(value)) - } -} - -impl From for Murmur64 { - fn from(t: BundleFileType) -> Murmur64 { - let hash: u64 = t.into(); - Murmur64::from(hash) - } -} - -impl std::fmt::Display for BundleFileType { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.ext_name()) - } -} diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index edb71bb..813df06 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -7,14 +7,13 @@ use color_eyre::{Help, Report, SectionExt}; use oodle::{OodleLZ_CheckCRC, OodleLZ_FuzzSafe, CHUNK_SIZE}; use crate::binary::sync::*; +use crate::bundle::file::Properties; use crate::murmur::{HashGroup, IdString64, Murmur64}; pub(crate) mod database; pub(crate) mod file; -pub(crate) mod filetype; -pub use file::{BundleFile, BundleFileVariant, Properties}; -pub use filetype::BundleFileType; +pub use file::{BundleFile, BundleFileType, BundleFileVariant}; #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] enum BundleFormat { @@ -236,7 +235,7 @@ impl Bundle { // Ceiling division (or division toward infinity) to calculate // the number of chunks required to fit the unpacked data. - let num_chunks = unpacked_data.len().div_ceil(CHUNK_SIZE); + let num_chunks = (unpacked_data.len() + CHUNK_SIZE - 1) / CHUNK_SIZE; tracing::trace!(num_chunks); w.write_u32(num_chunks as u32)?; diff --git a/lib/sdk/src/filetype/lua.rs b/lib/sdk/src/filetype/lua.rs index dd0494e..bfe6de7 100644 --- a/lib/sdk/src/filetype/lua.rs +++ b/lib/sdk/src/filetype/lua.rs @@ -15,7 +15,6 @@ use tokio::fs; use crate::binary::sync::ReadExt; use crate::binary::sync::WriteExt; use crate::bundle::file::{BundleFileVariant, UserFile}; -use crate::murmur::IdString64; use crate::{BundleFile, BundleFileType}; const BITSQUID_LUAJIT_HEADER: u32 = 0x8253461B; @@ -118,22 +117,26 @@ where } #[tracing::instrument(skip_all)] -pub fn compile(name: impl Into, code: impl AsRef) -> Result { +pub fn compile(name: S, code: C) -> Result +where + S: Into, + C: AsRef, +{ let name = name.into(); let code = code.as_ref(); tracing::trace!( "Compiling '{}', {} bytes of code", - name.display(), - code.len() + name, + code.as_bytes().len() ); let bytecode = unsafe { let state = lua::luaL_newstate(); lua::luaL_openlibs(state); - let name = CString::new(format!("@{}", name.display()).into_bytes()) - .wrap_err_with(|| format!("Cannot convert name into CString: {}", name.display()))?; + let name = CString::new(format!("@{name}").into_bytes()) + .wrap_err_with(|| format!("Cannot convert name into CString: {}", name))?; match lua::luaL_loadbuffer( state, code.as_ptr() as _, @@ -156,10 +159,10 @@ pub fn compile(name: impl Into, code: impl AsRef) -> Result unreachable!(), } - lua::lua_setglobal(state, c"fn".as_ptr()); + lua::lua_setglobal(state, b"fn\0".as_ptr() as _); - let run = c"return string.dump(fn, false)"; - match lua::luaL_loadstring(state, run.as_ptr()) as u32 { + let run = b"return string.dump(fn, false)\0"; + match lua::luaL_loadstring(state, run.as_ptr() as _) as u32 { lua::LUA_OK => {} lua::LUA_ERRSYNTAX => { let err = lua::lua_tostring(state, -1); diff --git a/lib/sdk/src/filetype/package.rs b/lib/sdk/src/filetype/package.rs index 758f79f..1f50f81 100644 --- a/lib/sdk/src/filetype/package.rs +++ b/lib/sdk/src/filetype/package.rs @@ -7,22 +7,13 @@ use std::str::FromStr; use async_recursion::async_recursion; use color_eyre::eyre::{self, Context}; use color_eyre::Result; +use path_slash::PathBufExt; use tokio::fs; use crate::binary::sync::{ReadExt, WriteExt}; -use crate::bundle::file::UserFile; -use crate::bundle::filetype::BundleFileType; -use crate::murmur::{HashGroup, IdString64, Murmur64}; +use crate::bundle::file::{BundleFileType, UserFile}; +use crate::murmur::{HashGroup, Murmur64}; -/// Resolves a relative path that might contain wildcards into a list of -/// paths that exist on disk and match that wildcard. -/// This is similar to globbing in Unix shells, but with much less features. -/// -/// The only wilcard character allowed is `*`, and only at the end of the string, -/// where it matches all files recursively in that directory. -/// -/// `t` is an optional extension name, that may be used to force a wildcard -/// path to only match that file type `t`. #[tracing::instrument] #[async_recursion] async fn resolve_wildcard( @@ -99,12 +90,12 @@ where Ok(paths) } -type PackageType = HashMap>; +type PackageType = HashMap>; type PackageDefinition = HashMap>; #[derive(Default)] pub struct Package { - _name: IdString64, + _name: String, _root: PathBuf, inner: PackageType, flags: u8, @@ -125,9 +116,9 @@ impl DerefMut for Package { } impl Package { - pub fn new(name: impl Into, root: PathBuf) -> Self { + pub fn new(name: String, root: PathBuf) -> Self { Self { - _name: name.into(), + _name: name, _root: root, inner: Default::default(), flags: 1, @@ -138,22 +129,17 @@ impl Package { self.values().fold(0, |total, files| total + files.len()) } - pub fn add_file(&mut self, file_type: BundleFileType, name: impl Into) { + pub fn add_file>(&mut self, file_type: BundleFileType, name: P) { self.inner.entry(file_type).or_default().insert(name.into()); } #[tracing::instrument("Package::from_sjson", skip(sjson), fields(sjson_len = sjson.as_ref().len()))] - pub async fn from_sjson( - sjson: S, - name: impl Into + std::fmt::Debug, - root: P, - ) -> Result + pub async fn from_sjson(sjson: S, name: String, root: P) -> Result where P: AsRef + std::fmt::Debug, S: AsRef, { let root = root.as_ref(); - let name = name.into(); let definition: PackageDefinition = serde_sjson::from_str(sjson.as_ref())?; let mut inner: PackageType = Default::default(); @@ -187,11 +173,7 @@ impl Package { continue; }; - tracing::debug!("Adding file {}", path.display()); - inner - .entry(t) - .or_default() - .insert(path.display().to_string()); + inner.entry(t).or_default().insert(path); } } } @@ -210,9 +192,11 @@ impl Package { pub fn to_sjson(&self) -> Result { let mut map: PackageDefinition = Default::default(); - for (t, names) in self.iter() { - for name in names.iter() { - map.entry(t.ext_name()).or_default().insert(name.clone()); + for (t, paths) in self.iter() { + for path in paths.iter() { + map.entry(t.ext_name()) + .or_default() + .insert(path.display().to_string()); } } @@ -238,11 +222,11 @@ impl Package { for _ in 0..file_count { let t = BundleFileType::from(r.read_u64()?); let hash = Murmur64::from(r.read_u64()?); - let name = ctx.lookup_hash(hash, HashGroup::Filename); + let path = ctx.lookup_hash(hash, HashGroup::Filename); inner .entry(t) .or_default() - .insert(name.display().to_string()); + .insert(PathBuf::from(path.display().to_string())); } let flags = r.read_u8()?; @@ -255,7 +239,7 @@ impl Package { let pkg = Self { inner, - _name: name.into(), + _name: name, _root: PathBuf::new(), flags, }; @@ -271,10 +255,12 @@ impl Package { w.write_u32(0x2b)?; w.write_u32(self.values().flatten().count() as u32)?; - for (t, names) in self.iter() { - for name in names.iter() { + for (t, paths) in self.iter() { + for path in paths.iter() { w.write_u64(t.hash().into())?; - w.write_u64(Murmur64::hash(name.as_bytes()).into())?; + + let hash = Murmur64::hash(path.to_slash_lossy().as_bytes()); + w.write_u64(hash.into())?; } } @@ -294,11 +280,17 @@ where Ok(vec![UserFile::new(s.into_bytes())]) } +// #[tracing::instrument(skip_all)] +// pub fn compile(_ctx: &crate::Context, data: String) -> Result> { +// let pkg = Package::from_sjson(data)?; +// pkg.to_binary() +// } + #[cfg(test)] mod test { use std::path::PathBuf; - use crate::bundle::filetype::BundleFileType; + use crate::BundleFileType; use super::resolve_wildcard; use super::Package; diff --git a/lib/sdk/src/filetype/strings.rs b/lib/sdk/src/filetype/strings.rs index 8643266..ca2ed8c 100644 --- a/lib/sdk/src/filetype/strings.rs +++ b/lib/sdk/src/filetype/strings.rs @@ -28,14 +28,10 @@ impl Language { #[derive(serde::Serialize)] pub struct Strings(HashMap>); -#[inline(always)] fn read_string(r: R) -> Result where R: Read, { - // We can safely ignore the warning here, as all data is already in memory, and no additional - // `BufReader` should be needed. - #[allow(clippy::unbuffered_bytes)] r.bytes() .take_while(|b| b.as_ref().map(|b| *b != 0).unwrap_or(false)) .map(|b| b.map_err(Report::new)) @@ -45,7 +41,7 @@ where impl Strings { #[tracing::instrument(skip_all, fields(languages = variants.len()))] - pub fn from_variants(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result { + pub fn from_variants(ctx: &crate::Context, variants: &Vec) -> Result { let mut map: HashMap> = HashMap::new(); for (i, variant) in variants.iter().enumerate() { @@ -80,7 +76,7 @@ impl Strings { } #[tracing::instrument(skip_all)] -pub fn decompile(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result> { +pub fn decompile(ctx: &crate::Context, variants: &Vec) -> Result> { let strings = Strings::from_variants(ctx, variants)?; let content = strings.to_sjson()?; diff --git a/lib/sdk/src/lib.rs b/lib/sdk/src/lib.rs index 9b1806b..a24b3bd 100644 --- a/lib/sdk/src/lib.rs +++ b/lib/sdk/src/lib.rs @@ -9,5 +9,5 @@ pub mod murmur; pub use binary::{FromBinary, ToBinary}; pub use bundle::database::BundleDatabase; pub use bundle::decompress; -pub use bundle::{Bundle, BundleFile, BundleFileType, BundleFileVariant, Properties}; +pub use bundle::{Bundle, BundleFile, BundleFileType, BundleFileVariant}; pub use context::{CmdLine, Context}; diff --git a/lib/sdk/src/murmur/dictionary.rs b/lib/sdk/src/murmur/dictionary.rs index 267f0a4..2d51af1 100644 --- a/lib/sdk/src/murmur/dictionary.rs +++ b/lib/sdk/src/murmur/dictionary.rs @@ -147,14 +147,14 @@ impl Dictionary { Ok(()) } - pub fn add(&mut self, value: impl AsRef<[u8]>, group: HashGroup) { - let long = Murmur64::from(murmurhash64::hash(value.as_ref(), SEED as u64)); - let short = Murmur32::from(murmurhash64::hash32(value.as_ref(), SEED)); + pub fn add(&mut self, value: String, group: HashGroup) { + let long = Murmur64::from(murmurhash64::hash(value.as_bytes(), SEED as u64)); + let short = Murmur32::from(murmurhash64::hash32(value.as_bytes(), SEED)); let entry = Entry { long, short, - value: String::from_utf8_lossy(value.as_ref()).to_string(), + value, group, }; diff --git a/lib/sdk/src/murmur/idstring32.rs b/lib/sdk/src/murmur/idstring32.rs deleted file mode 100644 index 99ea7aa..0000000 --- a/lib/sdk/src/murmur/idstring32.rs +++ /dev/null @@ -1,162 +0,0 @@ -use std::fmt; - -use serde::{Deserializer, Serializer}; - -use super::Murmur32; - -// This type encodes the fact that when reading in a bundle, we don't always have a dictionary -// entry for every hash in there. So we do want to have the real string available when needed, -// but at the same time retain the original hash information for when we don't. -// This is especially important when wanting to write back the read bundle, as the hashes need to -// stay the same. -// The previous system of always turning hashes into strings worked well for the purpose of -// displaying hashes, but would have made it very hard to turn a stringyfied hash back into -// an actual hash. -#[derive(Clone, Debug, Eq)] -pub enum IdString32 { - Hash(Murmur32), - String(String), -} - -impl IdString32 { - pub fn to_murmur32(&self) -> Murmur32 { - match self { - Self::Hash(hash) => *hash, - Self::String(s) => Murmur32::hash(s.as_bytes()), - } - } - - pub fn display(&self) -> IdString32Display { - let s = match self { - IdString32::Hash(hash) => hash.to_string(), - IdString32::String(s) => s.clone(), - }; - - IdString32Display(s) - } - - pub fn is_string(&self) -> bool { - match self { - IdString32::Hash(_) => false, - IdString32::String(_) => true, - } - } - - pub fn is_hash(&self) -> bool { - match self { - IdString32::Hash(_) => true, - IdString32::String(_) => false, - } - } -} - -impl From for IdString32 { - fn from(value: String) -> Self { - Self::String(value) - } -} - -impl From for IdString32 { - fn from(value: u32) -> Self { - Self::Hash(value.into()) - } -} - -impl From for u32 { - fn from(value: IdString32) -> Self { - value.to_murmur32().into() - } -} - -impl From for IdString32 { - fn from(value: Murmur32) -> Self { - Self::Hash(value) - } -} - -impl From for Murmur32 { - fn from(value: IdString32) -> Self { - value.to_murmur32() - } -} - -impl PartialEq for IdString32 { - fn eq(&self, other: &Self) -> bool { - self.to_murmur32() == other.to_murmur32() - } -} - -impl std::hash::Hash for IdString32 { - fn hash(&self, state: &mut H) { - state.write_u32(self.to_murmur32().into()); - } -} - -impl serde::Serialize for IdString32 { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_u32(self.to_murmur32().into()) - } -} - -struct IdString32Visitor; - -impl<'de> serde::de::Visitor<'de> for IdString32Visitor { - type Value = IdString32; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("an u32 or a string") - } - - fn visit_u32(self, value: u32) -> Result - where - E: serde::de::Error, - { - Ok(IdString32::Hash(value.into())) - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - Ok(IdString32::String(v.to_string())) - } - - fn visit_string(self, v: String) -> Result - where - E: serde::de::Error, - { - Ok(IdString32::String(v)) - } -} - -impl<'de> serde::Deserialize<'de> for IdString32 { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - deserializer.deserialize_u32(IdString32Visitor) - } -} - -pub struct IdString32Display(String); - -impl std::fmt::Display for IdString32Display { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl std::fmt::UpperHex for IdString32 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::UpperHex::fmt(&self.to_murmur32(), f) - } -} - -impl std::fmt::LowerHex for IdString32 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::LowerHex::fmt(&self.to_murmur32(), f) - } -} diff --git a/lib/sdk/src/murmur/idstring64.rs b/lib/sdk/src/murmur/idstring64.rs deleted file mode 100644 index 781a0cd..0000000 --- a/lib/sdk/src/murmur/idstring64.rs +++ /dev/null @@ -1,175 +0,0 @@ -use std::{fmt, path::Path}; - -use path_slash::PathExt as _; -use serde::{Deserializer, Serializer}; - -use super::Murmur64; - -// This type encodes the fact that when reading in a bundle, we don't always have a dictionary -// entry for every hash in there. So we do want to have the real string available when needed, -// but at the same time retain the original hash information for when we don't. -// This is especially important when wanting to write back the read bundle, as the hashes need to -// stay the same. -// The previous system of always turning hashes into strings worked well for the purpose of -// displaying hashes, but would have made it very hard to turn a stringyfied hash back into -// an actual hash. -#[derive(Clone, Debug, Eq)] -pub enum IdString64 { - Hash(Murmur64), - String(String), -} - -impl IdString64 { - pub fn to_murmur64(&self) -> Murmur64 { - match self { - Self::Hash(hash) => *hash, - Self::String(s) => Murmur64::hash(s.as_bytes()), - } - } - - pub fn display(&self) -> IdString64Display { - let s = match self { - IdString64::Hash(hash) => hash.to_string(), - IdString64::String(s) => s.clone(), - }; - - IdString64Display(s) - } - - pub fn is_string(&self) -> bool { - match self { - IdString64::Hash(_) => false, - IdString64::String(_) => true, - } - } - - pub fn is_hash(&self) -> bool { - match self { - IdString64::Hash(_) => true, - IdString64::String(_) => false, - } - } - - // Would love to have this as a proper `impl From`, but - // rustc will complain that it overlaps with the `impl From>`. - pub fn from_path(p: impl AsRef) -> Self { - Self::String(p.as_ref().to_slash_lossy().to_string()) - } -} - -impl From for IdString64 { - fn from(value: String) -> Self { - Self::String(value) - } -} - -impl From for IdString64 { - fn from(value: u64) -> Self { - Self::Hash(value.into()) - } -} - -impl From for IdString64 { - fn from(value: Murmur64) -> Self { - Self::Hash(value) - } -} - -impl From for Murmur64 { - fn from(value: IdString64) -> Self { - value.to_murmur64() - } -} - -impl From for u64 { - fn from(value: IdString64) -> Self { - value.to_murmur64().into() - } -} - -impl Default for IdString64 { - fn default() -> Self { - Self::Hash(0.into()) - } -} - -impl PartialEq for IdString64 { - fn eq(&self, other: &Self) -> bool { - self.to_murmur64() == other.to_murmur64() - } -} - -impl std::hash::Hash for IdString64 { - fn hash(&self, state: &mut H) { - state.write_u64(self.to_murmur64().into()); - } -} - -impl serde::Serialize for IdString64 { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_u64(self.to_murmur64().into()) - } -} - -struct IdString64Visitor; - -impl<'de> serde::de::Visitor<'de> for IdString64Visitor { - type Value = IdString64; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("an u64 or a string") - } - - fn visit_u64(self, value: u64) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::Hash(value.into())) - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::String(v.to_string())) - } - - fn visit_string(self, v: String) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::String(v)) - } -} - -impl<'de> serde::Deserialize<'de> for IdString64 { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - deserializer.deserialize_u64(IdString64Visitor) - } -} - -pub struct IdString64Display(String); - -impl std::fmt::Display for IdString64Display { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl std::fmt::UpperHex for IdString64 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::UpperHex::fmt(&self.to_murmur64(), f) - } -} - -impl std::fmt::LowerHex for IdString64 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::LowerHex::fmt(&self.to_murmur64(), f) - } -} diff --git a/lib/sdk/src/murmur/mod.rs b/lib/sdk/src/murmur/mod.rs index 6449d38..87a8473 100644 --- a/lib/sdk/src/murmur/mod.rs +++ b/lib/sdk/src/murmur/mod.rs @@ -8,8 +8,6 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; mod dictionary; // Currently unused // mod murmurhash32; -mod idstring32; -mod idstring64; mod murmurhash64; mod types; mod util; @@ -17,8 +15,6 @@ mod util; pub const SEED: u32 = 0; pub use dictionary::{Dictionary, Entry, HashGroup}; -pub use idstring32::*; -pub use idstring64::*; pub use murmurhash64::hash; pub use murmurhash64::hash32; pub use murmurhash64::hash_inverse as inverse; diff --git a/lib/sdk/src/murmur/murmurhash64.rs b/lib/sdk/src/murmur/murmurhash64.rs index ca69852..f15248c 100644 --- a/lib/sdk/src/murmur/murmurhash64.rs +++ b/lib/sdk/src/murmur/murmurhash64.rs @@ -119,9 +119,4 @@ fn test_hash() { } #[test] -fn test_inverse() { - let h = hash("lua".as_bytes(), crate::murmur::SEED as u64); - let inv = hash_inverse(h, crate::murmur::SEED as u64); - assert_eq!(h, hash(&inv.to_le_bytes(), crate::murmur::SEED as u64)); - assert_ne!(h, hash(&inv.to_be_bytes(), crate::murmur::SEED as u64)); -} +fn test_inverse() {} diff --git a/lib/sdk/src/murmur/types.rs b/lib/sdk/src/murmur/types.rs index c66e2cf..e96b992 100644 --- a/lib/sdk/src/murmur/types.rs +++ b/lib/sdk/src/murmur/types.rs @@ -150,12 +150,6 @@ impl fmt::UpperHex for Murmur32 { } } -impl fmt::LowerHex for Murmur32 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::LowerHex::fmt(&self.0, f) - } -} - impl fmt::Display for Murmur32 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:08X}", self) @@ -224,3 +218,148 @@ impl<'de> Deserialize<'de> for Murmur32 { deserializer.deserialize_any(Self(0)) } } + +// This type encodes the fact that when reading in a bundle, we don't always have a dictionary +// entry for every hash in there. So we do want to have the real string available when needed, +// but at the same time retain the original hash information for when we don't. +// This is especially important when wanting to write back the read bundle, as the hashes need to +// stay the same. +// The previous system of always turning hashes into strings worked well for the purpose of +// displaying hashes, but would have made it very hard to turn a stringyfied hash back into +// an actual hash. +#[derive(Clone, Debug, Eq)] +pub enum IdString64 { + Hash(Murmur64), + String(String), +} + +impl IdString64 { + pub fn to_murmur64(&self) -> Murmur64 { + match self { + Self::Hash(hash) => *hash, + Self::String(s) => Murmur64::hash(s.as_bytes()), + } + } + + pub fn display(&self) -> IdString64Display { + let s = match self { + IdString64::Hash(hash) => hash.to_string(), + IdString64::String(s) => s.clone(), + }; + + IdString64Display(s) + } + + pub fn is_string(&self) -> bool { + match self { + IdString64::Hash(_) => false, + IdString64::String(_) => true, + } + } + + pub fn is_hash(&self) -> bool { + match self { + IdString64::Hash(_) => true, + IdString64::String(_) => false, + } + } +} + +impl> From for IdString64 { + fn from(value: S) -> Self { + Self::String(value.into()) + } +} + +impl From for IdString64 { + fn from(value: Murmur64) -> Self { + Self::Hash(value) + } +} + +impl From for Murmur64 { + fn from(value: IdString64) -> Self { + value.to_murmur64() + } +} + +impl PartialEq for IdString64 { + fn eq(&self, other: &Self) -> bool { + self.to_murmur64() == other.to_murmur64() + } +} + +impl std::hash::Hash for IdString64 { + fn hash(&self, state: &mut H) { + state.write_u64(self.to_murmur64().into()); + } +} + +impl serde::Serialize for IdString64 { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_u64(self.to_murmur64().into()) + } +} + +struct IdString64Visitor; + +impl<'de> serde::de::Visitor<'de> for IdString64Visitor { + type Value = IdString64; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("an u64 or a string") + } + + fn visit_u64(self, value: u64) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::Hash(value.into())) + } + + fn visit_str(self, v: &str) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::String(v.to_string())) + } + + fn visit_string(self, v: String) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::String(v)) + } +} + +impl<'de> serde::Deserialize<'de> for IdString64 { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_u64(IdString64Visitor) + } +} + +pub struct IdString64Display(String); + +impl std::fmt::Display for IdString64Display { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +impl std::fmt::UpperHex for IdString64 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::UpperHex::fmt(&self.to_murmur64(), f) + } +} + +impl std::fmt::LowerHex for IdString64 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::LowerHex::fmt(&self.to_murmur64(), f) + } +} diff --git a/lib/serde_sjson b/lib/serde_sjson new file mode 160000 index 0000000..73d2b23 --- /dev/null +++ b/lib/serde_sjson @@ -0,0 +1 @@ +Subproject commit 73d2b23ce50e75b184f5092ad515e97a0adbe6da