29 Commits

Author SHA1 Message Date
40fc2229a3 don't exit on empty tree 2024-02-24 00:08:45 -08:00
4007b2cb0d update deps 2024-02-22 20:10:22 -08:00
d9f67c5d1a mess with git history code 2024-02-22 19:54:40 -08:00
9bcf34fb1c grobble grobble 2024-01-25 01:27:42 -08:00
79544c5a4b stop printing intended behaviour 2024-01-25 01:16:54 -08:00
759727d4e9 move file reading to worker threads 2024-01-25 01:16:54 -08:00
1164f8e12a execute order 66 2024-01-25 00:26:35 -08:00
44725f65df perform a perfect backflip
This replaces the join set with a futures stream but does not fulfill the goal of scanning ahead with a cap.
2024-01-25 00:16:14 -08:00
dfe899a7d8 rearrange code into iterator 2024-01-24 21:10:13 -08:00
d5b8c10264 fix override file duplication 2024-01-24 18:37:50 -08:00
fc4cebc862 -1 loc 2024-01-24 18:37:22 -08:00
658266aa89 fix decompile template generation & decompilation + write correct data to final file 2024-01-24 17:27:15 -08:00
56899fa7da enormous code for custom logic 2024-01-24 16:51:19 -08:00
d9531f1d4e custom file stem 2024-01-24 16:25:00 -08:00
994eb9c4be remove unnecessary Option 2024-01-24 14:58:27 -08:00
17bfbef482 misc tweaks + tweak Query objects + remove ScriptHint::Undetermined 2024-01-24 14:42:39 -08:00
e5c7ed6b75 debug insanity 2024-01-24 01:44:18 -08:00
9d6780a0b0 write discern_file + tweaks 2024-01-24 00:39:01 -08:00
4fd7795457 write colossal code 2024-01-23 23:55:14 -08:00
1ea68d96ef mega_double_join unused 2024-01-23 20:50:51 -08:00
4ced7f6210 change return Err to Err()? 2024-01-23 20:37:03 -08:00
db2c760c49 extract_script_overrides 2024-01-23 20:33:27 -08:00
8ee041918b tweaks 2024-01-23 20:19:00 -08:00
5384bbcb3b support Script.module.lua properly 2024-01-23 18:47:15 -08:00
9f3bd80403 woah 2024-01-23 18:43:32 -08:00
7863137174 tweaking 2024-01-23 18:43:32 -08:00
15fd698a21 colossal fixes & tweaks 2024-01-23 18:43:32 -08:00
07f0b03d45 ok I wrote this I guess 2024-01-23 18:43:32 -08:00
7e27b378e9 wip compile 2024-01-22 20:28:24 -08:00
4 changed files with 255 additions and 490 deletions

162
Cargo.lock generated

@ -43,9 +43,9 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.13"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540"
dependencies = [
"anstyle",
"anstyle-parse",
@ -109,7 +109,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "asset-tool"
version = "0.3.0"
version = "0.1.0"
dependencies = [
"anyhow",
"chrono",
@ -190,9 +190,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.15.4"
version = "3.15.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b"
[[package]]
name = "byteorder"
@ -208,11 +208,10 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]]
name = "cc"
version = "1.0.90"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730"
dependencies = [
"jobserver",
"libc",
]
@ -224,9 +223,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.35"
version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
dependencies = [
"android-tzdata",
"iana-time-zone",
@ -234,14 +233,14 @@ dependencies = [
"num-traits",
"serde",
"wasm-bindgen",
"windows-targets 0.52.4",
"windows-targets 0.52.3",
]
[[package]]
name = "clap"
version = "4.5.2"
version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b230ab84b0ffdf890d5a10abdbc8b83ae1c4918275daea1ab8801f71536b2651"
checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
dependencies = [
"clap_builder",
"clap_derive",
@ -249,9 +248,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.2"
version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
dependencies = [
"anstream",
"anstyle",
@ -607,15 +606,15 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.9"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
[[package]]
name = "http"
version = "0.2.12"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
dependencies = [
"bytes",
"fnv",
@ -727,9 +726,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.2.5"
version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown",
@ -747,20 +746,11 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "jobserver"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
dependencies = [
"libc",
]
[[package]]
name = "js-sys"
version = "0.3.69"
version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
dependencies = [
"wasm-bindgen",
]
@ -848,9 +838,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "log"
version = "0.4.21"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lz4"
@ -895,9 +885,9 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.11"
version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
"wasi",
@ -1139,9 +1129,9 @@ dependencies = [
[[package]]
name = "rayon"
version = "1.9.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd"
checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
dependencies = [
"either",
"rayon-core",
@ -1248,9 +1238,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.6"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
dependencies = [
"aho-corasick",
"memchr",
@ -1447,12 +1437,12 @@ dependencies = [
[[package]]
name = "socket2"
version = "0.5.6"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.48.0",
]
[[package]]
@ -1463,9 +1453,9 @@ checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
[[package]]
name = "syn"
version = "2.0.52"
version = "2.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb"
dependencies = [
"proc-macro2",
"quote",
@ -1501,9 +1491,9 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.10.1"
version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
dependencies = [
"cfg-if",
"fastrand",
@ -1727,9 +1717,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.92"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -1737,9 +1727,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.92"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
dependencies = [
"bumpalo",
"log",
@ -1752,9 +1742,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.42"
version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
dependencies = [
"cfg-if",
"js-sys",
@ -1764,9 +1754,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.92"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -1774,9 +1764,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.92"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [
"proc-macro2",
"quote",
@ -1787,15 +1777,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.92"
version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
[[package]]
name = "web-sys"
version = "0.3.69"
version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -1807,7 +1797,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.4",
"windows-targets 0.52.3",
]
[[package]]
@ -1825,7 +1815,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.4",
"windows-targets 0.52.3",
]
[[package]]
@ -1845,17 +1835,17 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f"
dependencies = [
"windows_aarch64_gnullvm 0.52.4",
"windows_aarch64_msvc 0.52.4",
"windows_i686_gnu 0.52.4",
"windows_i686_msvc 0.52.4",
"windows_x86_64_gnu 0.52.4",
"windows_x86_64_gnullvm 0.52.4",
"windows_x86_64_msvc 0.52.4",
"windows_aarch64_gnullvm 0.52.3",
"windows_aarch64_msvc 0.52.3",
"windows_i686_gnu 0.52.3",
"windows_i686_msvc 0.52.3",
"windows_x86_64_gnu 0.52.3",
"windows_x86_64_gnullvm 0.52.3",
"windows_x86_64_msvc 0.52.3",
]
[[package]]
@ -1866,9 +1856,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6"
[[package]]
name = "windows_aarch64_msvc"
@ -1878,9 +1868,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f"
[[package]]
name = "windows_i686_gnu"
@ -1890,9 +1880,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb"
[[package]]
name = "windows_i686_msvc"
@ -1902,9 +1892,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58"
[[package]]
name = "windows_x86_64_gnu"
@ -1914,9 +1904,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614"
[[package]]
name = "windows_x86_64_gnullvm"
@ -1926,9 +1916,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c"
[[package]]
name = "windows_x86_64_msvc"
@ -1938,9 +1928,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
version = "0.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6"
[[package]]
name = "winreg"

@ -1,6 +1,6 @@
[package]
name = "asset-tool"
version = "0.3.0"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

28
LICENSE

@ -1,23 +1,9 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
MIT License
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
Copyright (c) 2023 Quaternions
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,4 +1,4 @@
use std::{io::Read,path::PathBuf};
use std::io::Read;
use clap::{Args,Parser,Subcommand};
use anyhow::Result as AResult;
use futures::StreamExt;
@ -6,7 +6,7 @@ use rbx_dom_weak::types::Ref;
use tokio::io::AsyncReadExt;
type AssetID=u64;
type AssetIDFileMap=Vec<(AssetID,PathBuf)>;
type AssetIDFileMap=Vec<(AssetID,std::path::PathBuf)>;
const CONCURRENT_DECODE:usize=8;
const CONCURRENT_REQUESTS:usize=32;
@ -14,177 +14,81 @@ const CONCURRENT_REQUESTS:usize=32;
#[command(author,version,about,long_about=None)]
#[command(propagate_version = true)]
struct Cli{
//asset options
#[arg(short,long)]
group:Option<u64>,
#[arg(long)]
asset_id:Option<AssetID>,
//idk how to do this better
#[arg(long)]
cookie_literal:Option<String>,
#[arg(long)]
cookie_env:Option<String>,
#[arg(long)]
cookie_file:Option<std::path::PathBuf>,
//TODO: read the versions.json file instead of doing this
//TODO: write file dates instead of versions.json
#[arg(long)]
start_version:Option<u64>,
#[arg(long)]
end_version:Option<u64>,
#[arg(long)]
r#continue:bool,
//decompile options
#[arg(long)]
no_models:Option<bool>,
#[arg(long)]
no_scripts:Option<bool>,
#[arg(long)]
no_template:Option<bool>,
#[arg(long)]
style:Option<String>,
//git options
#[arg(long)]
git_committer_name:Option<String>,
#[arg(long)]
git_committer_email:Option<String>,
#[arg(short,long)]
input:Option<std::path::PathBuf>,
#[arg(short,long)]
output:Option<std::path::PathBuf>,
#[command(subcommand)]
command:Commands,
}
#[derive(Subcommand)]
enum Commands{
DownloadHistory(DownloadHistorySubcommand),
Download(DownloadSubcommand),
DownloadGroupInventoryJson(DownloadGroupInventoryJsonSubcommand),
Create(CreateSubcommand),
Upload(UploadSubcommand),
Compile(CompileSubcommand),
Decompile(DecompileSubcommand),
DecompileHistoryIntoGit(DecompileHistoryIntoGitSubcommand),
DownloadAndDecompileHistoryIntoGit(DownloadAndDecompileHistoryIntoGitSubcommand),
DownloadHistory,
Download(AssetIDList),
Upload,
Compile,
Decompile,
DecompileHistoryIntoGit,
DownloadAndDecompileHistoryIntoGit,
}
#[derive(Args)]
struct DownloadHistorySubcommand{
#[arg(long)]
asset_id:AssetID,
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
#[arg(long)]
output_folder:Option<PathBuf>,
#[arg(long)]
continue_from_versions:Option<bool>,
#[arg(long)]
start_version:Option<u64>,
#[arg(long)]
end_version:Option<u64>,
}
#[derive(Args)]
struct DownloadSubcommand{
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
#[arg(long)]
output_folder:Option<PathBuf>,
#[arg(required=true)]
asset_ids:Vec<AssetID>,
}
#[derive(Args)]
struct DownloadGroupInventoryJsonSubcommand{
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
#[arg(long)]
output_folder:Option<PathBuf>,
#[arg(long)]
group:u64,
}
#[derive(Args)]
struct CreateSubcommand{
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
#[arg(long)]
model_name:String,
#[arg(long)]
description:Option<String>,
#[arg(long)]
input_file:PathBuf,
#[arg(long)]
group:Option<u64>,
#[arg(long)]
free_model:Option<bool>,
#[arg(long)]
allow_comments:Option<bool>,
}
#[derive(Args)]
struct UploadSubcommand{
#[arg(long)]
asset_id:AssetID,
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
#[arg(long)]
input_file:PathBuf,
#[arg(long)]
group:Option<u64>,
}
#[derive(Args)]
struct CompileSubcommand{
#[arg(long)]
input_folder:PathBuf,
#[arg(long)]
output_file:PathBuf,
#[arg(long)]
style:Option<DecompileStyle>,
#[arg(long)]
template:Option<PathBuf>,
}
#[derive(Args)]
struct DecompileSubcommand{
#[arg(long)]
input_file:PathBuf,
#[arg(long)]
output_folder:PathBuf,
#[arg(long)]
style:DecompileStyle,
#[arg(long)]
write_template:Option<bool>,
#[arg(long)]
write_models:Option<bool>,
#[arg(long)]
write_scripts:Option<bool>,
}
#[derive(Args)]
struct DecompileHistoryIntoGitSubcommand{
#[arg(long)]
input_folder:PathBuf,
//currently output folder must be the current folder due to git2 limitations
//output_folder:cli.output.unwrap(),
#[arg(long)]
style:DecompileStyle,
#[arg(long)]
git_committer_name:String,
#[arg(long)]
git_committer_email:String,
#[arg(long)]
write_template:Option<bool>,
#[arg(long)]
write_models:Option<bool>,
#[arg(long)]
write_scripts:Option<bool>,
}
#[derive(Args)]
struct DownloadAndDecompileHistoryIntoGitSubcommand{
#[arg(long)]
asset_id:AssetID,
#[arg(long)]
cookie_type:CookieType,
#[arg(long)]
cookie:String,
//currently output folder must be the current folder due to git2 limitations
//output_folder:cli.output.unwrap(),
#[arg(long)]
style:DecompileStyle,
#[arg(long)]
git_committer_name:String,
#[arg(long)]
git_committer_email:String,
#[arg(long)]
write_template:Option<bool>,
#[arg(long)]
write_models:Option<bool>,
#[arg(long)]
write_scripts:Option<bool>,
}
#[derive(Clone,clap::ValueEnum)]
enum CookieType{
Literal,
Environment,
File,
}
#[derive(Clone,Copy,Debug,clap::ValueEnum)]
#[derive(Clone,Copy,Debug)]
enum DecompileStyle{
Rox,
Rojo,
RoxRojo,
}
#[derive(Args)]
struct AssetIDList{
asset_ids:Vec<AssetID>
}
#[derive(Args)]
struct PathBufList{
paths:Vec<std::path::PathBuf>
}
#[derive(serde::Deserialize)]
#[allow(nonstandard_style,dead_code)]
struct VersionPage{
@ -205,115 +109,103 @@ struct AssetVersion{
isPublished:bool,
}
#[derive(serde::Deserialize)]
#[allow(nonstandard_style,dead_code)]
struct InventoryPage{
totalResults:u64,//up to 50
filteredKeyword:Option<String>,//""
searchDebugInfo:Option<String>,//null
spellCheckerResult:Option<String>,//null
queryFacets:Option<String>,//null
imageSearchStatus:Option<String>,//null
previousPageCursor:Option<String>,
nextPageCursor:Option<String>,
data:Vec<InventoryItem>,
}
#[derive(serde::Deserialize,serde::Serialize)]
#[allow(nonstandard_style,dead_code)]
struct InventoryItem{
id:u64,
name:String,
}
#[tokio::main]
async fn main()->AResult<()>{
let cli=Cli::parse();
let cookie_enum={
match (cli.cookie_literal,cli.cookie_env,cli.cookie_file){
(Some(literal),None,None)=>Some(Cookie::Literal(literal)),
(None,Some(env_var),None)=>Some(Cookie::Environment(env_var)),
(None,None,Some(path))=>Some(Cookie::File(path)),
(None,None,None)=>None,
_=>Err(anyhow::Error::msg("Cookie was specified multiple times."))?,
}
};
let cookie=match cookie_enum{
Some(c)=>Some(format!(".ROBLOSECURITY={}",match c{
Cookie::Literal(s)=>s,
Cookie::Environment(var)=>std::env::var(var)?,
Cookie::File(path)=>tokio::fs::read_to_string(path).await?,
})),
None=>None,
};
let decompile_style=match cli.style.as_deref(){
Some("rox")
|Some("Rox")=>Some(DecompileStyle::Rox),
Some("rojo")
|Some("Rojo")=>Some(DecompileStyle::Rojo),
Some("rox-rojo")
|Some("rojo-rox")
|Some("roxrojo")
|Some("rojorox")
|Some("RoxRojo")
|Some("RojoRox")=>Some(DecompileStyle::RoxRojo),
None=>None,
_=>Err(anyhow::Error::msg("Invalid style"))?,
};
match cli.command{
Commands::DownloadHistory(subcommand)=>download_history(DownloadHistoryConfig{
continue_from_versions:subcommand.continue_from_versions.unwrap_or(false),
end_version:subcommand.end_version,
start_version:subcommand.start_version.unwrap_or(0),
output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
asset_id:subcommand.asset_id,
Commands::DownloadHistory=>download_history(DownloadHistoryConfig{
continue_from_versions:cli.r#continue,
end_version:cli.end_version,
start_version:cli.start_version.unwrap_or(0),
output_folder:cli.output.unwrap(),
cookie:cookie.unwrap(),
asset_id:cli.asset_id.unwrap(),
}).await,
Commands::Download(subcommand)=>{
let output_folder=subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap());
download_list(
Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
subcommand.asset_ids.into_iter().map(|asset_id|{
let mut path=output_folder.clone();
path.push(asset_id.to_string());
(asset_id,path)
}).collect()
).await
},
Commands::DownloadGroupInventoryJson(subcommand)=>download_group_inventory_json(
Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
subcommand.group,
subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
Commands::Download(asset_id_list)=>download_list(
cookie.unwrap(),
asset_id_list.asset_ids.into_iter().map(|asset_id|{
let mut path=cli.output.clone().unwrap();
path.push(asset_id.to_string());
(asset_id,path)
}).collect()
).await,
Commands::Create(subcommand)=>create(CreateConfig{
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
group:subcommand.group,
input_file:subcommand.input_file,
model_name:subcommand.model_name,
description:subcommand.description.unwrap_or_else(||String::with_capacity(0)),
free_model:subcommand.free_model.unwrap_or(false),
allow_comments:subcommand.allow_comments.unwrap_or(false),
Commands::Upload=>upload_list(cookie.unwrap(),cli.group,vec![(cli.asset_id.unwrap(),cli.output.unwrap())]).await,
Commands::Compile=>compile(CompileConfig{
input_folder:cli.input.unwrap(),
output_file:cli.output.unwrap(),
template:None,
style:None,
}).await,
Commands::Upload(subcommand)=>upload_list(
Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
subcommand.group,
vec![(subcommand.asset_id,subcommand.input_file)]
).await,
Commands::Compile(subcommand)=>compile(CompileConfig{
input_folder:subcommand.input_folder,
output_file:subcommand.output_file,
template:subcommand.template,
style:subcommand.style,
Commands::Decompile=>decompile(DecompileConfig{
style:decompile_style.unwrap(),
input_file:cli.input.unwrap(),
output_folder:cli.output.unwrap(),
write_template:!cli.no_template.unwrap_or(false),
write_models:!cli.no_models.unwrap_or(false),
write_scripts:!cli.no_scripts.unwrap_or(false),
}).await,
Commands::Decompile(subcommand)=>decompile(DecompileConfig{
style:subcommand.style,
input_file:subcommand.input_file,
output_folder:subcommand.output_folder,
write_template:subcommand.write_template.unwrap_or(false),
write_models:subcommand.write_models.unwrap_or(false),
write_scripts:subcommand.write_scripts.unwrap_or(true),
}).await,
Commands::DecompileHistoryIntoGit(subcommand)=>decompile_history_into_git(DecompileHistoryConfig{
git_committer_name:subcommand.git_committer_name,
git_committer_email:subcommand.git_committer_email,
input_folder:subcommand.input_folder,
output_folder:std::env::current_dir()?,
style:subcommand.style,
write_template:subcommand.write_template.unwrap_or(false),
write_models:subcommand.write_models.unwrap_or(false),
write_scripts:subcommand.write_scripts.unwrap_or(true),
Commands::DecompileHistoryIntoGit=>decompile_history_into_git(DecompileHistoryConfig{
git_committer_name:cli.git_committer_name.unwrap(),
git_committer_email:cli.git_committer_email.unwrap(),
input_folder:cli.input.unwrap(),
output_folder:cli.output.unwrap(),
style:decompile_style.unwrap(),
write_template:!cli.no_template.unwrap_or(false),
write_models:!cli.no_models.unwrap_or(false),
write_scripts:!cli.no_scripts.unwrap_or(false),
}).await,
Commands::DownloadAndDecompileHistoryIntoGit(subcommand)=>download_and_decompile_history_into_git(DownloadAndDecompileHistoryConfig{
git_committer_name:subcommand.git_committer_name,
git_committer_email:subcommand.git_committer_email,
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
asset_id:subcommand.asset_id,
output_folder:std::env::current_dir()?,
style:subcommand.style,
write_template:subcommand.write_template.unwrap_or(false),
write_models:subcommand.write_models.unwrap_or(false),
write_scripts:subcommand.write_scripts.unwrap_or(true),
Commands::DownloadAndDecompileHistoryIntoGit=>download_and_decompile_history_into_git(DownloadAndDecompileHistoryConfig{
git_committer_name:cli.git_committer_name.unwrap(),
git_committer_email:cli.git_committer_email.unwrap(),
cookie:cookie.unwrap(),
asset_id:cli.asset_id.unwrap(),
output_folder:cli.output.unwrap(),
style:decompile_style.unwrap(),
write_template:!cli.no_template.unwrap_or(false),
write_models:!cli.no_models.unwrap_or(false),
write_scripts:!cli.no_scripts.unwrap_or(false),
}).await,
}
}
struct Cookie(String);
impl Cookie{
async fn from_type(cookie_type:CookieType,cookie_string:String)->AResult<Self>{
Ok(Self(format!(".ROBLOSECURITY={}",match cookie_type{
CookieType::Literal=>cookie_string,
CookieType::Environment=>std::env::var(cookie_string)?,
CookieType::File=>tokio::fs::read_to_string(cookie_string).await?,
})))
}
enum Cookie{
Literal(String),
Environment(String),
File(std::path::PathBuf),
}
enum ReaderType<R:Read>{
@ -330,67 +222,8 @@ fn maybe_gzip_decode<R:Read>(input:R)->AResult<ReaderType<R>>{
}
}
struct CreateConfig{
cookie:String,
model_name:String,
description:String,
input_file:PathBuf,
group:Option<u64>,
free_model:bool,
allow_comments:bool,
}
async fn create(config:CreateConfig)->AResult<()>{
let client=reqwest::Client::new();
let client=&client;
let cookie=config.cookie.as_str();
let group=&config.group;
let mut url=reqwest::Url::parse("https://data.roblox.com/Data/Upload.ashx?json=1&type=Model&genreTypeId=1")?;
//url borrow scope
{
let mut query=url.query_pairs_mut();//borrow here
//archaic roblox api uses 0 for new asset
query.append_pair("assetid","0");
query.append_pair("name",config.model_name.as_str());
query.append_pair("description",config.description.as_str());
query.append_pair("ispublic",if config.free_model{"True"}else{"False"});
query.append_pair("allowComments",if config.allow_comments{"True"}else{"False"});
match group{
Some(group_id)=>{query.append_pair("groupId",group_id.to_string().as_str());},
None=>(),
}
}
let body=tokio::fs::read(config.input_file).await?;
let mut resp=client.post(url.clone())
.header("Cookie",cookie)
.body(body.clone())
.send().await?;
//This is called a CSRF challenge apparently
if resp.status()==reqwest::StatusCode::FORBIDDEN{
if let Some(csrf_token)=resp.headers().get("X-CSRF-Token"){
resp=client.post(url)
.header("X-CSRF-Token",csrf_token)
.header("Cookie",cookie)
.body(body)
.send().await?;
}else{
Err(anyhow::Error::msg("Roblox returned 403 with no CSRF"))?;
}
}
let body=match resp.status(){
reqwest::StatusCode::OK=>Ok(resp.bytes().await?),
other=>Err(anyhow::Error::msg(other)),
};
println!("response.body={:?}",body?);
Ok(())
}
async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFileMap)->AResult<()>{
let client=reqwest::Client::new();
//this is calling map on the vec because the closure produces an iterator of futures
futures::stream::iter(asset_id_file_map.into_iter()
.map(|(asset_id,file)|{
let client=&client;
@ -408,7 +241,7 @@ async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFi
}
}
let body=tokio::fs::read(file).await?;
let body=tokio::fs::read_to_string(file).await?;
let mut resp=client.post(url.clone())
.header("Cookie",cookie)
.body(body.clone())
@ -426,10 +259,8 @@ async fn upload_list(cookie:String,group:Option<u64>,asset_id_file_map:AssetIDFi
Err(anyhow::Error::msg("Roblox returned 403 with no CSRF"))?;
}
}
match resp.status(){
reqwest::StatusCode::OK=>Ok((asset_id,resp.bytes().await?)),
other=>Err(anyhow::Error::msg(other)),
}
Ok((asset_id,resp.bytes().await?))
}
}))
.buffer_unordered(CONCURRENT_REQUESTS)
@ -485,47 +316,6 @@ async fn download_list(cookie:String,asset_id_file_map:AssetIDFileMap)->AResult<
}).await;
Ok(())
}
async fn download_inventory_page(client:&reqwest::Client,cookie:&str,group:u64,cursor:Option<String>)->AResult<InventoryPage>{
let mut url=reqwest::Url::parse(format!("https://apis.roblox.com/toolbox-service/v1/creations/group/{}/10?limit=50",group).as_str())?;
//url borrow scope
{
let mut query=url.query_pairs_mut();//borrow here
match cursor.as_deref(){
Some(next_page)=>{query.append_pair("cursor",next_page);}
None=>(),
}
}
println!("page url={}",url);
let resp=client.get(url)
.header("Cookie",cookie)
.send().await?;
Ok(resp.json::<InventoryPage>().await?)
}
async fn get_inventory_pages(client:&reqwest::Client,cookie:&str,group:u64)->AResult<Vec<InventoryItem>>{
let mut cursor:Option<String>=None;
let mut asset_list=Vec::new();
loop{
let mut page=download_inventory_page(client,cookie,group,cursor).await?;
asset_list.append(&mut page.data);
if page.nextPageCursor.is_none(){
break;
}
cursor=page.nextPageCursor;
}
Ok(asset_list)
}
async fn download_group_inventory_json(cookie:String,group:u64,output_folder:PathBuf)->AResult<()>{
let client=reqwest::Client::new();
let item_list=get_inventory_pages(&client,cookie.as_str(),group).await?;
let mut path=output_folder.clone();
path.set_file_name("versions.json");
tokio::fs::write(path,serde_json::to_string(&item_list)?).await?;
Ok(())
}
async fn download_page(client:&reqwest::Client,cookie:&str,asset_id:AssetID,cursor:Option<String>)->AResult<VersionPage>{
let mut url=reqwest::Url::parse(format!("https://develop.roblox.com/v1/assets/{}/saved-versions",asset_id).as_str())?;
@ -590,7 +380,7 @@ struct DownloadHistoryConfig{
continue_from_versions:bool,
end_version:Option<u64>,
start_version:u64,
output_folder:PathBuf,
output_folder:std::path::PathBuf,
cookie:String,
asset_id:AssetID,
}
@ -808,7 +598,7 @@ fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{
lazy_regex::regex!(r"[^A-z0-9.-]").replace_all(s,"_")
}
fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:PathBuf,node:&TreeNode,node_name_override:String,mut properties:PropertiesOverride,style:DecompileStyle,write_models:bool,write_scripts:bool)->AResult<()>{
fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:std::path::PathBuf,node:&TreeNode,node_name_override:String,mut properties:PropertiesOverride,style:DecompileStyle,write_models:bool,write_scripts:bool)->AResult<()>{
file.push(sanitize(node_name_override.as_str()).as_ref());
match node.class{
Class::Folder=>(),
@ -969,7 +759,7 @@ fn generate_decompiled_context<R:Read>(input:R)->AResult<DecompiledContext>{
struct WriteConfig{
style:DecompileStyle,
output_folder:PathBuf,
output_folder:std::path::PathBuf,
write_template:bool,
write_models:bool,
write_scripts:bool,
@ -1076,8 +866,8 @@ async fn write_files(config:WriteConfig,mut context:DecompiledContext)->AResult<
struct DecompileConfig{
style:DecompileStyle,
input_file:PathBuf,
output_folder:PathBuf,
input_file:std::path::PathBuf,
output_folder:std::path::PathBuf,
write_template:bool,
write_models:bool,
write_scripts:bool,
@ -1109,7 +899,7 @@ async fn decompile(config:DecompileConfig)->AResult<()>{
struct WriteCommitConfig{
git_committer_name:String,
git_committer_email:String,
output_folder:PathBuf,
output_folder:std::path::PathBuf,
style:DecompileStyle,
write_template:bool,
write_models:bool,
@ -1200,9 +990,9 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,De
struct DecompileHistoryConfig{
git_committer_name:String,
git_committer_email:String,
input_folder:PathBuf,
input_folder:std::path::PathBuf,
style:DecompileStyle,
output_folder:PathBuf,
output_folder:std::path::PathBuf,
write_template:bool,
write_models:bool,
write_scripts:bool,
@ -1251,7 +1041,7 @@ struct DownloadAndDecompileHistoryConfig{
git_committer_name:String,
git_committer_email:String,
style:DecompileStyle,
output_folder:PathBuf,
output_folder:std::path::PathBuf,
write_template:bool,
write_models:bool,
write_scripts:bool,
@ -1329,7 +1119,7 @@ struct FileWithName{
name:String,
}
async fn get_file_async(mut path:PathBuf,file_name:impl AsRef<std::path::Path>)->Result<FileWithName,QueryResolveError>{
async fn get_file_async(mut path:std::path::PathBuf,file_name:impl AsRef<std::path::Path>)->Result<FileWithName,QueryResolveError>{
let name=file_name.as_ref().to_str().unwrap().to_owned();
path.push(file_name);
match tokio::fs::File::open(path).await{
@ -1349,7 +1139,7 @@ struct QuerySingle{
script:QueryHandle,
}
impl QuerySingle{
fn rox(search_path:&PathBuf,search_name:&str)->Self{
fn rox(search_path:&std::path::PathBuf,search_name:&str)->Self{
Self{
script:tokio::spawn(get_file_async(search_path.clone(),format!("{}.lua",search_name)))
}
@ -1370,7 +1160,7 @@ struct QueryTriple{
client:QueryHandle,
}
impl QueryTriple{
fn rox_rojo(search_path:&PathBuf,search_name:&str,search_module:bool)->Self{
fn rox_rojo(search_path:&std::path::PathBuf,search_name:&str,search_module:bool)->Self{
//this should be implemented as constructors of Triplet and Quadruplet to fully support Trey's suggestion
let module_name=if search_module{
format!("{}.module.lua",search_name)
@ -1383,7 +1173,7 @@ impl QueryTriple{
client:tokio::spawn(get_file_async(search_path.clone(),format!("{}.client.lua",search_name))),
}
}
fn rojo(search_path:&PathBuf)->Self{
fn rojo(search_path:&std::path::PathBuf)->Self{
QueryTriple::rox_rojo(search_path,"init",false)
}
}
@ -1453,7 +1243,7 @@ struct QueryQuad{
client:QueryHandle,
}
impl QueryQuad{
fn rox_rojo(search_path:&PathBuf,search_name:&str)->Self{
fn rox_rojo(search_path:&std::path::PathBuf,search_name:&str)->Self{
let fill=QueryTriple::rox_rojo(search_path,search_name,true);
Self{
module_implicit:QuerySingle::rox(search_path,search_name).script,//Script.lua
@ -1514,9 +1304,9 @@ async fn script_node(search_name:&str,mut file:FileWithName,hint:ScriptHint)->AR
(Some("ModuleScript"),_)
|(None,ScriptHint::ModuleScript)=>CompileClass::ModuleScript(script_with_overrides.source),
(Some("LocalScript"),_)
|(None,ScriptHint::LocalScript)=>CompileClass::LocalScript(script_with_overrides.source),
|(None,ScriptHint::Script)=>CompileClass::LocalScript(script_with_overrides.source),
(Some("Script"),_)
|(None,ScriptHint::Script)=>CompileClass::Script(script_with_overrides.source),
|(None,ScriptHint::LocalScript)=>CompileClass::Script(script_with_overrides.source),
other=>Err(anyhow::Error::msg(format!("Invalid hint or class {other:?}")))?,
},
})
@ -1662,9 +1452,9 @@ enum CompileStackInstruction{
}
struct CompileConfig{
input_folder:PathBuf,
output_file:PathBuf,
template:Option<PathBuf>,
input_folder:std::path::PathBuf,
output_file:std::path::PathBuf,
template:Option<std::path::PathBuf>,
style:Option<DecompileStyle>,
}
@ -1694,12 +1484,11 @@ async fn compile(config:CompileConfig)->AResult<()>{
std::io::BufReader::new(std::fs::File::open(template_path)?)
};
let mut dom=load_dom(input)?;
//hack to traverse root folder as the root object
dom.root_mut().name="src".to_owned();
//add in scripts and models
let mut folder=config.input_folder.clone();
let mut stack:Vec<CompileStackInstruction>=vec![CompileStackInstruction::TraverseReferent(dom.root_ref(),None)];
folder.push("src");
let mut stack:Vec<CompileStackInstruction>=dom.root().children().into_iter().map(|&referent|CompileStackInstruction::TraverseReferent(referent,None)).collect();
while let Some(instruction)=stack.pop(){
match instruction{
CompileStackInstruction::TraverseReferent(item_ref,blacklist)=>{