From cf98f8e7bbfd0a8b218900b1bb0910efa6c25d86 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 1 Oct 2024 13:02:54 -0700 Subject: [PATCH] use rbxassetid parser from deferred_loader --- Cargo.lock | 80 ++++++++++++++++++++++++++++++++++++++++++++++++----- Cargo.toml | 2 +- src/main.rs | 17 +----------- 3 files changed, 75 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a85cb73..ea1ba6e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -512,6 +512,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -585,6 +594,16 @@ dependencies = [ "syn 2.0.77", ] +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "image" version = "0.24.9" @@ -998,6 +1017,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1313,9 +1338,9 @@ dependencies = [ [[package]] name = "roblox_emulator" -version = "0.2.0" +version = "0.2.2" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "62ab7e851fb72ba7d690734e1d33d8bd47e83a25b7dbdb28b4771fd3425f7538" +checksum = "1f084d8b843fd96371cca381799313c9b3d0634d2da23ac0c6334bdaf0a2225e" dependencies = [ "glam", "mlua", @@ -1433,20 +1458,20 @@ dependencies = [ [[package]] name = "strafesnet_deferred_loader" -version = "0.3.3" +version = "0.3.4" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "596aba6d2747818781336ad95a1ee496e37f70052fd625a299fc7a555a6938d4" +checksum = "64d6ca274b6582165ffd30a7a8eb33ad454af3a891e962efb4a0be37df0817ff" dependencies = [ - "lazy-regex", "strafesnet_common", + "url", "vbsp", ] [[package]] name = "strafesnet_rbx_loader" -version = "0.3.6" +version = "0.3.7" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" -checksum = "edb389090ec58f2cb2ec93eafd362c9ef5dc4895092145dbd5d86602cdab3e5d" +checksum = "5bbe74cf64c253b1b0277165653dff2dfaf6a1383293cb645c9e5e1375e9dbb3" dependencies = [ "bytemuck", "glam", @@ -1607,6 +1632,21 @@ dependencies = [ "weezl", ] +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml_datetime" version = "0.6.8" @@ -1655,12 +1695,27 @@ dependencies = [ "once_cell", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.13" @@ -1673,6 +1728,17 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "utf8parse" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index b9236cc..1ba2c8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ 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" } strafesnet_bsp_loader = { version = "0.1.3", registry = "strafesnet" } -strafesnet_deferred_loader = { version = "0.3.1", features = ["legacy"], registry = "strafesnet" } +strafesnet_deferred_loader = { version = "0.3.4", features = ["legacy"], registry = "strafesnet" } strafesnet_rbx_loader = { version = "0.3.6", registry = "strafesnet" } strafesnet_snf = { version = "0.1.0", registry = "strafesnet" } vbsp = "0.5.0" diff --git a/src/main.rs b/src/main.rs index 2e4abd2..d1d20f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use std::{collections::HashSet,io::{Read,Seek},path::PathBuf}; use clap::{Args,Parser,Subcommand}; use anyhow::Result as AResult; use rbx_dom_weak::Instance; +use strafesnet_deferred_loader::rbxassetid::RobloxAssetId; #[derive(Parser)] #[command(author, version, about, long_about = None)] @@ -152,22 +153,6 @@ fn get_dom(input:&mut R)->AResult{ } } -struct RobloxAssetId(u64); -struct RobloxAssetIdParseErr; -impl std::str::FromStr for RobloxAssetId { - type Err=RobloxAssetIdParseErr; - fn from_str(s: &str) -> Result{ - 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::() { - return Ok(Self(id)); - } - } - } - Err(RobloxAssetIdParseErr) - } -} /* The ones I'm interested in: Beam.Texture Decal.Texture