Compare commits

..

1 Commits

Author SHA1 Message Date
8598147214 add test files 2023-09-05 00:47:23 -07:00
10 changed files with 13627 additions and 1242 deletions

View File

@ -1,2 +0,0 @@
[registries.strafesnet]
index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"

524
Cargo.lock generated
View File

@ -2,81 +2,11 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anstream"
version = "0.6.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
[[package]]
name = "anstyle-parse"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "anyhow"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[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"
@ -86,9 +16,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "autocfg"
version = "1.3.0"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
@ -104,28 +34,41 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "blake3"
version = "1.5.3"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9ec96fe9a81b5e365f9db71fe00edc4fe4ca2cc7dcb7861f0603012a7caa210"
checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5"
dependencies = [
"arrayref",
"arrayvec",
"cc",
"cfg-if",
"constant_time_eq",
"digest",
]
[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "byteorder"
version = "1.5.0"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cc"
version = "1.1.10"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292"
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
"libc",
]
[[package]]
name = "cfg-if"
@ -133,52 +76,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc"
dependencies = [
"clap_builder",
"clap_derive",
]
[[package]]
name = "clap_builder"
version = "4.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
[[package]]
name = "colorchoice"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]]
name = "constant_time_eq"
version = "0.3.0"
@ -186,93 +83,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2"
[[package]]
name = "crc32fast"
version = "1.4.2"
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"cfg-if",
"generic-array",
"typenum",
]
[[package]]
name = "flate2"
version = "1.0.31"
name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"crc32fast",
"miniz_oxide",
"block-buffer",
"crypto-common",
"subtle",
]
[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "getrandom"
version = "0.2.15"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "heck"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "lazy-regex"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "576c8060ecfdf2e56995cf3274b4f2d71fa5e4fa3607c1c0b63c10180ee58741"
dependencies = [
"lazy-regex-proc_macros",
"once_cell",
"regex",
]
[[package]]
name = "lazy-regex-proc_macros"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9efb9e65d4503df81c615dc33ff07042a9408ac7f26b45abee25566f7fbfd12c"
dependencies = [
"proc-macro2",
"quote",
"regex",
"syn",
]
[[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 = "libc"
version = "0.2.155"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "log"
version = "0.4.22"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lz4"
version = "1.26.0"
version = "1.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68"
checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1"
dependencies = [
"libc",
"lz4-sys",
@ -280,96 +154,67 @@ dependencies = [
[[package]]
name = "lz4-sys"
version = "1.10.0"
version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868"
checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "mapfixer"
version = "1.1.1"
name = "map-tool"
version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"flate2",
"lazy-regex",
"rbx_binary",
"rbx_dom_weak",
"rbx_reflection_database",
"rbx_xml",
]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "miniz_oxide"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [
"adler",
]
[[package]]
name = "num-traits"
version = "0.2.19"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "paste"
version = "1.0.15"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
]
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro2"
version = "1.0.86"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "profiling"
version = "1.0.15"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58"
checksum = "45f10e75d83c7aec79a6aa46f897075890e156b105eebe51cfa0abce51af025f"
dependencies = [
"profiling-procmacros",
]
[[package]]
name = "profiling-procmacros"
version = "1.0.15"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
checksum = "74c55e9e629af5298a40e0fa106435b2da30484c4ec76b41d19bc4d00dd8b903"
dependencies = [
"quote",
"syn",
@ -377,9 +222,9 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.36"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
@ -416,9 +261,9 @@ dependencies = [
[[package]]
name = "rbx_binary"
version = "0.7.4"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "18b401155b93f7151217bf51e36bdfa7bddcaf5f0d26b563c9ac3b08a3701c27"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e50573021d04b680018955662eba7dc4aac3de92219231798f6c9b41e38ab01"
dependencies = [
"log",
"lz4",
@ -431,9 +276,9 @@ dependencies = [
[[package]]
name = "rbx_dom_weak"
version = "2.7.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "850d0a6c8d22592b125c9a82f8654857a7aba10f061b930cc2b86438e54157f1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "161729449bbb0cfa657ce7bcca6a160d0af06d8b8d9efdc9abe14735dccacdb9"
dependencies = [
"rbx_types",
"serde",
@ -441,9 +286,9 @@ dependencies = [
[[package]]
name = "rbx_reflection"
version = "4.5.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "80d31f6675c27c9f60b2322feb5565f4a4389ccbb75de4e737915e9208f0831f"
version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08bd48487192046fec8f805f3fa29f3d7d5beb9890b0859b1a92bd8aff580343"
dependencies = [
"rbx_types",
"serde",
@ -452,9 +297,9 @@ dependencies = [
[[package]]
name = "rbx_reflection_database"
version = "0.2.10+roblox-607"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "f4da9f73ca317c158b922b757fe02317f7d3bc31d3f9fdb4a748d48b3951b8b8"
version = "0.2.7+roblox-588"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1be6cf674182806f11ad4899dd1feafe977591f1ae035ae05a58d4b74e487276"
dependencies = [
"lazy_static",
"rbx_reflection",
@ -464,9 +309,9 @@ dependencies = [
[[package]]
name = "rbx_types"
version = "1.8.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "6d0d394018a8df53fcd91e990301fe6e47b94e15067edfcb019e6238ae60e8bb"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "070106e926b8ae54c7bc443e5db4d868d7f0af51c1d7cfd7efe1364c1753d8a3"
dependencies = [
"base64",
"bitflags",
@ -477,54 +322,11 @@ dependencies = [
"thiserror",
]
[[package]]
name = "rbx_xml"
version = "0.13.3"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "d6d1a15f58a1e4b4f578abe6eb5e1461cb16eea82fb4a147d5995c9b79f08d1f"
dependencies = [
"base64",
"log",
"rbx_dom_weak",
"rbx_reflection",
"rbx_reflection_database",
"xml-rs",
]
[[package]]
name = "regex"
version = "1.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "rmp"
version = "0.8.14"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4"
checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20"
dependencies = [
"byteorder",
"num-traits",
@ -533,9 +335,9 @@ dependencies = [
[[package]]
name = "rmp-serde"
version = "1.3.0"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db"
checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a"
dependencies = [
"byteorder",
"rmp",
@ -544,18 +346,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.207"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2"
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.207"
version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e"
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
@ -563,16 +365,16 @@ dependencies = [
]
[[package]]
name = "strsim"
version = "0.11.1"
name = "subtle"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
version = "2.0.74"
version = "2.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7"
checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
dependencies = [
"proc-macro2",
"quote",
@ -581,18 +383,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.63"
version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.63"
version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
@ -600,119 +402,25 @@ dependencies = [
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
name = "typenum"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "utf8parse"
version = "0.2.2"
name = "unicode-ident"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "xml-rs"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601"
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

View File

@ -1,21 +1,11 @@
[package]
name = "mapfixer"
version = "1.1.1"
name = "map-tool"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.75"
clap = { version = "4.4.2", features = ["derive"] }
flate2 = "1.0.27"
lazy-regex = "3.1.0"
rbx_binary = { version = "0.7.4", registry = "strafesnet"}
rbx_dom_weak = { version = "2.7.0", registry = "strafesnet"}
rbx_reflection_database = { version = "0.2.10", registry = "strafesnet"}
rbx_xml = { version = "0.13.3", registry = "strafesnet"}
[profile.release]
lto = true
strip = true
codegen-units = 1
rbx_binary = "0.7.1"
rbx_dom_weak = "2.5.0"
rbx_reflection_database = "0.2.7"

28
LICENSE
View File

@ -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) <year> <copyright holders>
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.

BIN
ScriptFinder.rbxl Normal file

Binary file not shown.

126
allowed/0.lua Normal file
View File

@ -0,0 +1,126 @@
--local Model=game:GetService'InsertService':LoadAsset(1079831188):GetChildren()[1] Model:SetModelCFrame(CFrame.new(0,Model:GetModelSize().y/2,0))
--[[ Load ID list
local ids={5692157375}
local ServerStorage=game:GetService'ServerStorage'
local function load(id)
local Model=game:GetObjects("rbxassetid://"..id)[1]
Model.Parent=workspace
Model:MoveTo(Vector3.new(0,Model:GetExtentsSize().y/2,0))
wait()
Model.Parent=ServerStorage
end
for i=1,#ids do
local succ,err=ypcall(load,ids[i])
if not succ then
print(ids[i],"error",err)
end
end
--]]
--[[ Format map names
local c=game:GetService'ServerStorage':GetChildren()
for i=1,#c do
local le_name=c[i].Name:gsub("%s+","_"):lower()
c[i].Name=le_name
local DisplayName=c[i]:FindFirstChild("DisplayName",true)
if DisplayName and DisplayName.ClassName=="StringValue" then
local dn=DisplayName.Value
local ndn={}
for w in dn:gmatch'%S+' do
ndn[#ndn+1]=w:sub(1,1):upper()..w:sub(2)
end
if table.concat(ndn," ")~=dn then
print("Fix name:",le_name)
end
end
end
--]]
--[[ Duplicate script labeler
local IsA=game.IsA
local ID=0
local SourceHash={}
local SourceHashCount={}
local NameHash={}
local IDHash={}
local c=game:GetService'ServerStorage':GetDescendants()
for i=1,#c do
local s=c[i]
if IsA(s,"LuaSourceContainer") then
local src=s.Source
NameHash[s]=s.Name
local id=SourceHash[src]
if id then
s.Name="copy "..id
SourceHashCount[id]=SourceHashCount[id]+1
else
ID=ID+1
IDHash[ID]=s
SourceHash[src]=ID
SourceHashCount[ID]=1
if src:find'getfenv' or src:find'require' then
s.Name="flagged "..ID
else
s.Name="unique "..ID
end
end
end
end
for i=1,ID do
local s=IDHash[i]
local hc=SourceHashCount[i]
s.Name=s.Name..(hc==1 and " (1 copy)" or " ("..hc.." copies)")
end
_G.NameHash=NameHash
--]]
--[[ Undo labeler
local NameHash=_G.NameHash
for s,n in next,NameHash do
s.Name=n
end
--]]
local IsA=workspace.IsA
local GetChildren=workspace.GetChildren
local function rsearch(search,cond1,cond2)
local found={}
for _,thing in next,GetChildren(search) do
if not cond1 or cond1(thing) then
found[#found+1]=thing
end
if not cond2 or cond2(thing) then
local nfound=#found
local r=rsearch(thing,cond1,cond2)
for i=1,#r do
found[nfound+i]=r[i]
end
end
end
return found
end
local function cond1(thing)
return IsA(thing,"LuaSourceContainer")
end
local Maps=GetChildren(game:GetService'ServerStorage')
for i=1,#Maps do
local Map=Maps[i]
if Map.ClassName=="Model" then
local Scripts=rsearch(Map,cond1)
if #Scripts>0 then
local ScriptHolder=Instance.new("Model",workspace)
ScriptHolder.Name=Map.Name.."("..#Scripts..")"
for i=1,#Scripts do
local sc=Scripts[i]
local scd
if sc.ClassName~="ModuleScript" then
sc.Disabled=true
end
local s=sc:Clone()
s.Name=sc:GetFullName()
s.Parent=ScriptHolder
if sc.ClassName~="ModuleScript" then
sc.Disabled=scd
end
end
end
end
end

BIN
bhop_dumb_blocks_5.rbxm Normal file

Binary file not shown.

13180
bhop_easyhop.rbxmx Executable file

File diff suppressed because it is too large Load Diff

126
blocked/0.lua Normal file
View File

@ -0,0 +1,126 @@
--local Model=game:GetService'InsertService':LoadAsset(1079831188):GetChildren()[1] Model:SetModelCFrame(CFrame.new(0,Model:GetModelSize().y/2,0))
--[[ Load ID list
local ids={5692157375}
local ServerStorage=game:GetService'ServerStorage'
local function load(id)
local Model=game:GetObjects("rbxassetid://"..id)[1]
Model.Parent=workspace
Model:MoveTo(Vector3.new(0,Model:GetExtentsSize().y/2,0))
wait()
Model.Parent=ServerStorage
end
for i=1,#ids do
local succ,err=ypcall(load,ids[i])
if not succ then
print(ids[i],"error",err)
end
end
--]]
--[[ Format map names
local c=game:GetService'ServerStorage':GetChildren()
for i=1,#c do
local le_name=c[i].Name:gsub("%s+","_"):lower()
c[i].Name=le_name
local DisplayName=c[i]:FindFirstChild("DisplayName",true)
if DisplayName and DisplayName.ClassName=="StringValue" then
local dn=DisplayName.Value
local ndn={}
for w in dn:gmatch'%S+' do
ndn[#ndn+1]=w:sub(1,1):upper()..w:sub(2)
end
if table.concat(ndn," ")~=dn then
print("Fix name:",le_name)
end
end
end
--]]
--[[ Duplicate script labeler
local IsA=game.IsA
local ID=0
local SourceHash={}
local SourceHashCount={}
local NameHash={}
local IDHash={}
local c=game:GetService'ServerStorage':GetDescendants()
for i=1,#c do
local s=c[i]
if IsA(s,"LuaSourceContainer") then
local src=s.Source
NameHash[s]=s.Name
local id=SourceHash[src]
if id then
s.Name="copy "..id
SourceHashCount[id]=SourceHashCount[id]+1
else
ID=ID+1
IDHash[ID]=s
SourceHash[src]=ID
SourceHashCount[ID]=1
if src:find'getfenv' or src:find'require' then
s.Name="flagged "..ID
else
s.Name="unique "..ID
end
end
end
end
for i=1,ID do
local s=IDHash[i]
local hc=SourceHashCount[i]
s.Name=s.Name..(hc==1 and " (1 copy)" or " ("..hc.." copies)")
end
_G.NameHash=NameHash
--]]
--[[ Undo labeler
local NameHash=_G.NameHash
for s,n in next,NameHash do
s.Name=n
end
--]]
local IsA=workspace.IsA
local GetChildren=workspace.GetChildren
local function rsearch(search,cond1,cond2)
local found={}
for _,thing in next,GetChildren(search) do
if not cond1 or cond1(thing) then
found[#found+1]=thing
end
if not cond2 or cond2(thing) then
local nfound=#found
local r=rsearch(thing,cond1,cond2)
for i=1,#r do
found[nfound+i]=r[i]
end
end
end
return found
end
local function cond1(thing)
return IsA(thing,"LuaSourceContainer")
end
local Maps=GetChildren(game:GetService'ServerStorage')
for i=1,#Maps do
local Map=Maps[i]
if Map.ClassName=="Model" then
local Scripts=rsearch(Map,cond1)
if #Scripts>0 then
local ScriptHolder=Instance.new("Model",workspace)
ScriptHolder.Name=Map.Name.."("..#Scripts..")"
for i=1,#Scripts do
local sc=Scripts[i]
local scd
if sc.ClassName~="ModuleScript" then
sc.Disabled=true
end
local s=sc:Clone()
s.Name=sc:GetFullName()
s.Parent=ScriptHolder
if sc.ClassName~="ModuleScript" then
sc.Disabled=scd
end
end
end
end
end

View File

@ -1,802 +1,73 @@
use std::{io::{Read, Seek}, path::PathBuf};
use clap::{Args, Parser, Subcommand};
use anyhow::Result as AResult;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(propagate_version = true)]
struct Cli {
#[arg(long)]
path:Option<PathBuf>,
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
ExtractScripts(PathBufList),
Interactive,
Replace,
Scan,
Upload,
}
#[derive(Args)]
struct PathBufList {
paths:Vec<PathBuf>
}
#[derive(Args)]
struct MapList {
maps: Vec<u64>,
}
fn main() -> AResult<()> {
let cli = Cli::parse();
match cli.command {
Commands::ExtractScripts(pathlist)=>extract_scripts(pathlist.paths),
Commands::Interactive=>interactive(),
Commands::Replace=>replace(),
Commands::Scan=>scan(),
Commands::Upload=>upload(),
}
}
fn class_is_a(class: &str, superclass: &str) -> bool {
if class==superclass {
return true
}
let class_descriptor=rbx_reflection_database::get().classes.get(class);
if let Some(descriptor) = &class_descriptor {
if let Some(class_super) = &descriptor.superclass {
return class_is_a(&class_super, superclass)
}
}
false
}
fn recursive_collect_superclass(objects: &mut std::vec::Vec<rbx_dom_weak::types::Ref>,dom: &rbx_dom_weak::WeakDom, instance: &rbx_dom_weak::Instance, superclass: &str){
for &referent in instance.children() {
if let Some(c) = dom.get_by_ref(referent) {
if class_is_a(c.class.as_str(), superclass) {
objects.push(c.referent());//copy ref
}
recursive_collect_superclass(objects,dom,c,superclass);
}
}
}
fn get_full_name(dom:&rbx_dom_weak::WeakDom,instance:&rbx_dom_weak::Instance) -> String{
let mut full_name=instance.name.clone();
let mut pref=instance.parent();
while let Some(parent)=dom.get_by_ref(pref){
full_name.insert(0, '.');
full_name.insert_str(0, &parent.name);
pref=parent.parent();
}
full_name
if class==superclass {
return true
}
let class_descriptor=rbx_reflection_database::get().classes.get(class);
if let Some(descriptor) = &class_descriptor {
if let Some(class_super) = &descriptor.superclass {
return class_is_a(&class_super, superclass)
}
}
return false
}
//scan (scripts)
//iter maps/unprocessed
//passing moves to maps/verified
//failing moves to maps/blocked
//replace (edits & deletions)
//iter maps/blocked
//replace scripts and put in maps/unprocessed
//interactive
//iter maps/unprocessed
//for each unique script, load it into the file current.lua and have it open in sublime text
//I can edit the file and it will edit it in place
//I pass/fail(with comment)/allow each script
fn get_script_refs(dom:&rbx_dom_weak::WeakDom) -> Vec<rbx_dom_weak::types::Ref>{
let mut scripts = std::vec::Vec::new();
recursive_collect_superclass(&mut scripts, dom, dom.root(),"LuaSourceContainer");
scripts
fn recursive_collect_scripts(scripts: &mut std::vec::Vec<rbx_dom_weak::types::Ref>,dom: &rbx_dom_weak::WeakDom, instance: &rbx_dom_weak::Instance){
for &referent in instance.children() {
if let Some(c) = dom.get_by_ref(referent) {
if class_is_a(c.class.as_str(), "LuaSourceContainer") {
scripts.push(c.referent());//copy ref
}
recursive_collect_scripts(scripts,dom,c);
}
}
}
enum ReaderType<'a, R:Read+Seek>{
GZip(flate2::read::GzDecoder<&'a mut R>),
Raw(&'a mut R),
}
fn maybe_gzip_decode<R:Read+Seek>(input:&mut R)->AResult<ReaderType<R>>{
let mut first_2=[0u8;2];
if let (Ok(()),Ok(()))=(std::io::Read::read_exact(input, &mut first_2),std::io::Seek::rewind(input)){
match &first_2{
b"\x1f\x8b"=>Ok(ReaderType::GZip(flate2::read::GzDecoder::new(input))),
_=>Ok(ReaderType::Raw(input)),
}
}else{
Err(anyhow::Error::msg("failed to peek"))
}
}
fn load_dom<R:Read+Seek>(input:&mut R)->AResult<rbx_dom_weak::WeakDom>{
let mut first_8=[0u8;8];
if let (Ok(()),Ok(()))=(std::io::Read::read_exact(input, &mut first_8),std::io::Seek::rewind(input)){
match &first_8[0..4]{
b"<rob"=>{
match &first_8[4..8]{
b"lox!"=>rbx_binary::from_reader(input).map_err(anyhow::Error::msg),
b"lox "=>rbx_xml::from_reader(input,rbx_xml::DecodeOptions::default()).map_err(anyhow::Error::msg),
other=>Err(anyhow::Error::msg(format!("Unknown Roblox file type {:?}",other))),
}
},
_=>Err(anyhow::Error::msg("unsupported file type")),
}
}else{
Err(anyhow::Error::msg("peek failed"))
}
}
fn get_dom<R:Read+Seek>(input:&mut R)->AResult<rbx_dom_weak::WeakDom>{
match maybe_gzip_decode(input){
Ok(ReaderType::GZip(mut readable)) => {
//gzip
let mut extracted:Vec<u8>=Vec::new();
readable.read_to_end(&mut extracted)?;
Ok(load_dom(&mut std::io::Cursor::new(extracted))?)
},
Ok(ReaderType::Raw(readable)) => Ok(load_dom(readable)?),
Err(e) => Err(e)?,
}
}
fn get_id() -> AResult<u32>{
match std::fs::read_to_string("id"){
Ok(id_file)=>Ok(id_file.parse::<u32>()?),
Err(e) => match e.kind() {
std::io::ErrorKind::NotFound => Ok(0),//implicitly take on id=0
_ => Err(e)?,
}
}
}
fn get_set_from_file(file:&str) -> AResult<std::collections::HashSet<String>>{
let mut set=std::collections::HashSet::<String>::new();
for entry in std::fs::read_dir(file)? {
set.insert(std::fs::read_to_string(entry?.path())?);
}
Ok(set)
}
fn get_allowed_set() -> AResult<std::collections::HashSet<String>>{
get_set_from_file("scripts/allowed")
}
fn get_blocked() -> AResult<std::collections::HashSet<String>>{
get_set_from_file("scripts/blocked")
}
fn get_allowed_map() -> AResult<std::collections::HashMap::<u32,String>>{
let mut allowed_map = std::collections::HashMap::<u32,String>::new();
for entry in std::fs::read_dir("scripts/allowed")? {
let entry=entry?;
allowed_map.insert(entry.path().file_stem().unwrap().to_str().unwrap().parse::<u32>()?,std::fs::read_to_string(entry.path())?);
}
Ok(allowed_map)
}
fn get_replace_map() -> AResult<std::collections::HashMap::<String,u32>>{
let mut replace = std::collections::HashMap::<String,u32>::new();
for entry in std::fs::read_dir("scripts/replace")? {
let entry=entry?;
replace.insert(std::fs::read_to_string(entry.path())?,entry.path().file_stem().unwrap().to_str().unwrap().parse::<u32>()?);
}
Ok(replace)
}
fn check_source_illegal_keywords(source:&String)->bool{
source.find("getfenv").is_some()||source.find("require").is_some()
}
fn find_first_child_class<'a>(dom:&'a rbx_dom_weak::WeakDom,instance:&'a rbx_dom_weak::Instance,name:&'a str,class:&'a str) -> Option<&'a rbx_dom_weak::Instance> {
for &referent in instance.children() {
if let Some(c) = dom.get_by_ref(referent) {
if c.name==name&&class_is_a(c.class.as_str(),class) {
return Some(c);
}
}
}
None
}
fn get_mapinfo(dom:&rbx_dom_weak::WeakDom) -> AResult<(String,String,String,rbx_dom_weak::types::Ref)>{
let workspace_children=dom.root().children();
if workspace_children.len()!=1{
return Err(anyhow::Error::msg("there can only be one model"));
}
if let Some(model_instance) = dom.get_by_ref(workspace_children[0]) {
if let (Some(creator),Some(displayname))=(find_first_child_class(dom, model_instance, "Creator", "StringValue"),find_first_child_class(dom, model_instance, "DisplayName", "StringValue")){
if let (
Some(rbx_dom_weak::types::Variant::String(creator_string)),
Some(rbx_dom_weak::types::Variant::String(displayname_string))
)=(
creator.properties.get("Value"),
displayname.properties.get("Value")
){
return Ok((model_instance.name.clone(),creator_string.clone(),displayname_string.clone(),displayname.referent()));
}
}
}
Err(anyhow::Error::msg("no stuff in map"))
}
struct RobloxAssetId(u64);
struct RobloxAssetIdParseErr;
impl std::str::FromStr for RobloxAssetId {
type Err=RobloxAssetIdParseErr;
fn from_str(s: &str) -> Result<Self, Self::Err>{
let regman=lazy_regex::regex!(r"(\d+)$");
if let Some(captures) = regman.captures(s) {
if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture
if let Ok(id) = captures[0].parse::<u64>() {
return Ok(Self(id));
}
}
}
Err(RobloxAssetIdParseErr)
}
}
enum Scan{
Passed,
Blocked,
Flagged,
}
fn scan() -> AResult<()>{
let mut id = get_id()?;
//Construct allowed scripts
let allowed_set = get_allowed_set()?;
let mut blocked = get_blocked()?;
for entry in std::fs::read_dir("maps/unprocessed")? {
let file_thing=entry?;
let mut input = std::io::BufReader::new(std::fs::File::open(file_thing.path())?);
let dom = get_dom(&mut input)?;
let script_refs = get_script_refs(&dom);
//check scribb
let mut fail_count=0;
let mut fail_type=Scan::Passed;
for &script_ref in script_refs.iter() {
if let Some(script)=dom.get_by_ref(script_ref){
if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") {
//flag keywords and instantly fail
if check_source_illegal_keywords(s){
println!("{:?} - flagged.",file_thing.file_name());
fail_type=Scan::Flagged;
break;
}
if allowed_set.contains(s) {
continue;
}else{
fail_type=Scan::Blocked;//no need to check for Flagged, it breaks the loop.
fail_count+=1;
if !blocked.contains(s) {
blocked.insert(s.clone());//all fixed! just clone!
std::fs::write(format!("scripts/blocked/{}.lua",id),s)?;
id+=1;
}
}
}else{
panic!("FATAL: failed to get source for {:?}",file_thing.file_name());
}
}else{
panic!("FATAL: failed to get_by_ref {:?}",script_ref);
}
}
let mut dest=match fail_type {
Scan::Passed => PathBuf::from("maps/processed"),
Scan::Blocked => {
println!("{:?} - {} {} not allowed.",file_thing.file_name(),fail_count,if fail_count==1 {"script"}else{"scripts"});
PathBuf::from("maps/blocked")
}
Scan::Flagged => PathBuf::from("maps/flagged")
};
dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?;
}
std::fs::write("id",id.to_string())?;
Ok(())
}
fn extract_scripts(paths: Vec<PathBuf>) -> AResult<()>{
let mut id = 0;
//Construct allowed scripts
let mut script_set = std::collections::HashSet::<String>::new();
for path in paths {
let file_name=path.file_name();
let mut input = std::io::BufReader::new(std::fs::File::open(&path)?);
let dom = get_dom(&mut input)?;
let script_refs = get_script_refs(&dom);
//extract scribb
for &script_ref in script_refs.iter() {
if let Some(script)=dom.get_by_ref(script_ref){
if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") {
if script_set.contains(s) {
continue;
}else{
script_set.insert(s.clone());
std::fs::write(format!("scripts/extracted/{:?}_{}_{}.lua",file_name,id,script.name),s)?;
id+=1;
}
}else{
panic!("FATAL: failed to get source for {:?}",file_name);
}
}else{
panic!("FATAL: failed to get_by_ref {:?}",script_ref);
}
}
}
println!("extracted {} {}",id,if id==1 {"script"}else{"scripts"});
Ok(())
}
fn replace() -> AResult<()>{
let allowed_map=get_allowed_map()?;
let replace_map=get_replace_map()?;
for entry in std::fs::read_dir("maps/blocked")? {
let file_thing=entry?;
let mut input = std::io::BufReader::new(std::fs::File::open(file_thing.path())?);
let mut dom = get_dom(&mut input)?;
let script_refs = get_script_refs(&dom);
//check scribb
let mut any_failed=false;
for &script_ref in script_refs.iter() {
if let Some(script)=dom.get_by_ref(script_ref){
if let Some(rbx_dom_weak::types::Variant::String(source)) = script.properties.get("Source") {
if let (Some(replace_id),Some(replace_script))=(replace_map.get(source),dom.get_by_ref_mut(script.referent())) {
println!("replace {}",replace_id);
//replace the source
if let Some(replace_source)=allowed_map.get(replace_id){
replace_script.properties.insert("Source".to_string(), rbx_dom_weak::types::Variant::String(replace_source.clone()));
}else{
println!("failed to get replacement source {}",replace_id);
any_failed=true;
}
}else{
println!("failed to failed to get replace_id and replace_script");
any_failed=true;
}
}else{
panic!("FATAL: failed to get source for {:?}",file_thing.file_name());
}
}else{
panic!("FATAL: failed to get_by_ref {:?}",script_ref);
}
}
if any_failed {
println!("One or more scripts failed to replace.");
}else{
let mut dest=PathBuf::from("maps/unprocessed");
dest.push(file_thing.file_name());
let output = std::io::BufWriter::new(std::fs::File::open(dest)?);
//write workspace:GetChildren()[1]
let workspace_children=dom.root().children();
if workspace_children.len()!=1{
return Err(anyhow::Error::msg("there can only be one model"));
}
rbx_binary::to_writer(output, &dom, &[workspace_children[0]])?;
}
}
Ok(())
}
enum UploadAction {
Upload(u64),
Skip,
New,
Delete,
}
struct ParseUploadActionErr;
impl std::str::FromStr for UploadAction {
type Err=ParseUploadActionErr;
fn from_str(s: &str) -> Result<Self, Self::Err>{
if s=="skip\n"{
Ok(Self::Skip)
}else if s=="new\n"{
Ok(Self::New)
}else if s=="delete\n"{
Ok(Self::Delete)
}else if let Ok(asset_id)=s[..s.len()-1].parse::<u64>(){
Ok(Self::Upload(asset_id))
}else{
Err(ParseUploadActionErr)
}
}
}
fn upload() -> AResult<()>{
//interactive prompt per upload:
for entry in std::fs::read_dir("maps/passed")? {
let file_thing=entry?;
println!("map file: {:?}",file_thing.file_name());
let mut input = std::io::BufReader::new(std::fs::File::open(file_thing.path())?);
let dom = get_dom(&mut input)?;
let (modelname,creator,displayname,_) = get_mapinfo(&dom)?;
//Creator: [auto fill creator]
//DisplayName: [auto fill DisplayName]
//id: ["New" for blank because of my double enter key]
print!("Model name: {}\nCreator: {}\nDisplayName: {}\n",modelname,creator,displayname);
let upload_action;
loop{
print!("Action or Upload Asset Id: ");
std::io::Write::flush(&mut std::io::stdout())?;
let mut upload_action_string = String::new();
std::io::stdin().read_line(&mut upload_action_string)?;
if let Ok(parsed_upload_action)=upload_action_string.parse::<UploadAction>(){
upload_action=parsed_upload_action;
break;
}
}
match upload_action {
UploadAction::Upload(asset_id) => {
let status=std::process::Command::new("asset-tool")
.args([
"upload-asset",
"--cookie-envvar","RBXCOOKIE",
"--group-id","6980477"
])
.arg("--asset-id").arg(asset_id.to_string())
.arg("--input-file").arg(file_thing.path().into_os_string().into_string().unwrap())
.status()?;
match status.code() {
Some(0)=>{
//move file
let mut dest=PathBuf::from("maps/uploaded");
dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?;
}
Some(code)=>println!("upload failed! code={}",code),
None => println!("no status code!"),
}
}
UploadAction::Skip => continue,
UploadAction::New => {
let output=std::process::Command::new("asset-tool")
.args([
"create-asset",
"--cookie-envvar","RBXCOOKIE",
"--group-id","6980477"
])
.arg("--model-name").arg(modelname.as_str())
.arg("--input-file").arg(file_thing.path().into_os_string().into_string().unwrap())
.output()?;
match output.status.code() {
Some(0)=>{
//print output
println!("{}", std::str::from_utf8(output.stdout.as_slice())?);
//move file
let mut dest=PathBuf::from("maps/uploaded");
dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?;
}
Some(code)=>println!("upload failed! code={}",code),
None => println!("no status code!"),
}
}
UploadAction::Delete => std::fs::remove_file(file_thing.path())?,
}
}
Ok(())
}
enum Interactive{
Passed,
Blocked,
Flagged,
}
enum ScriptAction {
Pass,
Replace(u32),
Flag,
Block,
Delete,
}
enum ScriptActionParseResult {
Pass,
Block,
Exit,
Delete,
}
struct ParseScriptActionErr;
impl std::str::FromStr for ScriptActionParseResult {
type Err=ParseScriptActionErr;
fn from_str(s: &str) -> Result<Self, Self::Err>{
if s=="pass\n"||s=="1\n"{
Ok(Self::Pass)
}else if s=="block\n"{
Ok(Self::Block)
}else if s=="exit\n"{
Ok(Self::Exit)
}else if s=="delete\n"{
Ok(Self::Delete)
}else{
Err(ParseScriptActionErr)
}
}
}
fn is_first_letter_lowercase(s:&str)->bool{
s.chars().next().map(char::is_lowercase).unwrap_or(false)
}
fn is_title_case(display_name:&str)->bool{
display_name.len()!=0
&&!is_first_letter_lowercase(display_name)
&&{
let display_name_pattern=lazy_regex::regex!(r"\b\S+");
display_name_pattern.find_iter(display_name)
.all(|capture|match capture.as_str(){
"a"=>true,
"an"=>true,
"and"=>true,
"the"=>true,
"of"=>true,
other=>!is_first_letter_lowercase(other),
})
}
}
fn interactive() -> AResult<()>{
let mut id=get_id()?;
//Construct allowed scripts
let mut allowed_set=get_allowed_set()?;
let mut allowed_map=get_allowed_map()?;
let mut replace_map=get_replace_map()?;
let mut blocked = get_blocked()?;
let model_name_pattern=lazy_regex::regex!(r"^[a-z0-9_]+$");
'map_loop: for entry in std::fs::read_dir("maps/unprocessed")? {
let file_thing=entry?;
println!("processing map={:?}",file_thing.file_name());
let mut input = std::io::BufReader::new(std::fs::File::open(file_thing.path())?);
let mut dom = get_dom(&mut input)?;
let (modelname,creator,displayname,displayname_ref)=get_mapinfo(&dom)?;
let mut script_count=0;
let mut replace_count=0;
let mut block_count=0;
//if model name is illegal prompt for new name
print!("Model name: {}\nCreator: {}\nDisplayName: {}\n",modelname,creator,displayname);
if !model_name_pattern.is_match(modelname.as_str()){
//illegal
let new_model_name;
loop{
print!("Enter new model name: ");
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
let input_final=match input_string.trim(){
""=>modelname.as_str(),
other=>other,
};
if model_name_pattern.is_match(input_final)
||{
//If you entered a new model name and it still doesn't like it, allow override
println!("Final model name: {}",input_final);
print!("Are you sure you want this model name? [y/N]:");
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
match input_string.trim(){
"y"=>true,
_=>false,
}
}{
new_model_name=input_final.to_owned();
break;
}
}
let model_instance=dom.get_by_ref_mut(dom.root().children()[0]).unwrap();
model_instance.name=new_model_name;
//mark file as edited so a new file is generated
replace_count+=1;
}
if !is_title_case(displayname.as_str()){
//illegal
let new_display_name;
loop{
print!("Enter new display name: ");
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
let input_final=match input_string.trim(){
""=>displayname.as_str(),
other=>other,
};
if is_title_case(input_string.trim())
||{
//If you entered a new display name and it still doesn't like it, allow override
println!("Final display name: {}",input_final);
print!("Are you sure you want this display name? [y/N]:");
std::io::Write::flush(&mut std::io::stdout())?;
let mut input_string=String::new();
std::io::stdin().read_line(&mut input_string)?;
match input_string.trim(){
"y"=>true,
_=>false,
}
}{
new_display_name=input_final.to_owned();
break;
}
}
let displayname_instance=dom.get_by_ref_mut(displayname_ref).unwrap();
assert!(displayname_instance.properties.insert("Value".to_owned(),new_display_name.into()).is_some(),"StringValue we have a problem");
//mark file as edited so a new file is generated
replace_count+=1;
}
let script_refs = get_script_refs(&dom)
//grab the full path to the object in case it's deleted by another operation
.into_iter()
.filter_map(|referent|
dom.get_by_ref(referent)
.map(|script|
(referent,get_full_name(&dom,script))
)
).collect::<Vec<_>>();
//check scribb
let mut fail_type=Interactive::Passed;
for (script_ref,script_full_name) in script_refs{
if let Some(script)=dom.get_by_ref(script_ref){
if let Some(rbx_dom_weak::types::Variant::String(source)) = script.properties.get("Source") {
script_count+=1;
let source_action=if check_source_illegal_keywords(source) {
ScriptAction::Flag//script triggers flagging -> Flag
} else if blocked.contains(source) {
ScriptAction::Block//script is blocked -> Block
} else if allowed_set.contains(source) {
ScriptAction::Pass//script is allowed -> Pass
}else if let Some(replace_id)=replace_map.get(source) {
ScriptAction::Replace(*replace_id)
}else{
//interactive logic goes here
print!("unresolved source location={}\n",get_full_name(&dom, script));
//load source into current.lua
std::fs::write("current.lua",source)?;
//prompt action in terminal
//wait for input
let script_action;
loop{
print!("action: ");
std::io::Write::flush(&mut std::io::stdout())?;
let mut action_string = String::new();
std::io::stdin().read_line(&mut action_string)?;
if let Ok(parsed_script_action)=action_string.parse::<ScriptActionParseResult>(){
script_action=parsed_script_action;
break;
}
}
//update allowed/replace/blocked
match script_action{
ScriptActionParseResult::Pass => {
//if current.lua was updated, create an allowed and replace file and set script_action to replace(new_id)
let modified_source=std::fs::read_to_string("current.lua")?;
if &modified_source==source{
//it's always new.
//insert allowed_set
allowed_set.insert(modified_source.clone());
//insert allowed_map
allowed_map.insert(id,modified_source.clone());
//write allowed/id.lua
std::fs::write(format!("scripts/allowed/{}.lua",id),modified_source)?;
id+=1;
ScriptAction::Pass
}else{
//insert allowed_set
allowed_set.insert(modified_source.clone());
//insert allowed_map
allowed_map.insert(id,modified_source.clone());
//insert replace_map
replace_map.insert(source.clone(),id);//this cannot be reached if it already exists
//write allowed/id.lua
std::fs::write(format!("scripts/allowed/{}.lua",id),modified_source)?;
//write replace/id.lua
std::fs::write(format!("scripts/replace/{}.lua",id),source)?;
let ret=ScriptAction::Replace(id);
id+=1;
ret
}
},
ScriptActionParseResult::Block => {
blocked.insert(source.clone());
std::fs::write(format!("scripts/blocked/{}.lua",id),source)?;
id+=1;
ScriptAction::Block
},
ScriptActionParseResult::Exit => break 'map_loop,
ScriptActionParseResult::Delete => ScriptAction::Delete,
}
};
let location=get_full_name(&dom, script);
match source_action{
ScriptAction::Pass => println!("passed source location={}",location),
ScriptAction::Replace(replace_id)=>{
//replace the source
if let (Some(replace_source),Some(replace_script))=(allowed_map.get(&replace_id),dom.get_by_ref_mut(script.referent())){
replace_count+=1;
println!("replaced source id={} location={}",replace_id,location);
replace_script.properties.insert("Source".to_string(), rbx_dom_weak::types::Variant::String(replace_source.clone()));
}else{
panic!("failed to get replacement source id={} location={}",replace_id,location);
}
},
ScriptAction::Delete => {
println!("deleted source location={}",location);
replace_count+=1;//trigger a new file generation
dom.destroy(script.referent());
},
ScriptAction::Flag => {
println!("flagged source location={}",location);
fail_type=Interactive::Flagged;
},
ScriptAction::Block => {
block_count+=1;
println!("blocked source location={}",location);
match fail_type{
Interactive::Passed => fail_type=Interactive::Blocked,
_=>(),
}
},
}
}else{
panic!("FATAL: failed to get source for {:?}",file_thing.file_name());
}
}else{
println!("WARNING: script was deleted: {}",script_full_name);
}
}
let mut dest=match fail_type{
Interactive::Passed => {
println!("map={:?} passed with {} {}",file_thing.file_name(),script_count,if script_count==1 {"script"}else{"scripts"});
if replace_count==0{
PathBuf::from("maps/passed")
}else{
//create new file
println!("{} {} replaced - generating new file...",replace_count,if replace_count==1 {"script was"}else{"scripts were"});
let mut dest=PathBuf::from("maps/passed");
dest.push(file_thing.file_name());
let output = std::io::BufWriter::new(std::fs::File::create(dest)?);
//write workspace:GetChildren()[1]
let workspace_children=dom.root().children();
if workspace_children.len()!=1{
return Err(anyhow::Error::msg("there can only be one model"));
}
rbx_binary::to_writer(output, &dom, &[workspace_children[0]])?;
//move original to processed folder
PathBuf::from("maps/unaltered")
}
},//write map into maps/processed
Interactive::Blocked => {
println!("map={:?} blocked with {}/{} {} blocked",file_thing.file_name(),block_count,script_count,if script_count==1 {"script"}else{"scripts"});
PathBuf::from("maps/blocked")
},//write map into maps/blocked
Interactive::Flagged => {
println!("map={:?} flagged",file_thing.file_name());
PathBuf::from("maps/flagged")
},//write map into maps/flagged
};
dest.push(file_thing.file_name());
std::fs::rename(file_thing.path(), dest)?;
}
std::fs::write("id",id.to_string())?;
Ok(())
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Using buffered I/O is recommended with rbx_binary
let input = std::io::BufReader::new(std::fs::File::open("map.rbxm")?);
let dom = rbx_binary::from_reader(input)?;
//Construct allowed scripts
let mut allowed = std::collections::HashSet::<String>::new();
for entry in std::fs::read_dir("allowed")? {
allowed.insert(std::fs::read_to_string(entry?.path())?);
}
let mut scripts = std::vec::Vec::<rbx_dom_weak::types::Ref>::new();
recursive_collect_scripts(&mut scripts, &dom, dom.root());
//check scribb
let mut any_failed=false;
for (i,&referent) in scripts.iter().enumerate() {
if let Some(script) = dom.get_by_ref(referent) {
if let Some(rbx_dom_weak::types::Variant::String(s)) = script.properties.get("Source") {
if allowed.contains(s) {
println!("pass");
}else{
println!("fail");
any_failed=true;
std::fs::write(format!("blocked/{}.lua",i),s)?;
}
}else{
println!("failed to get source");
any_failed=true;
}
}else{
println!("failed to deref script");
any_failed=true;
}
}
if any_failed {
println!("One or more scripts are not allowed.");
return Ok(())//everything is not ok but idk how to return an error LMAO
}
println!("All scripts passed!");
// std::process::Command::new("rbxcompiler")
// .arg("--compile=false")
// .arg("--group=6980477")
// .arg("--asset=5692139100")
// .arg("--input=map.rbxm")
// .spawn()?;
Ok(())
}