Compare commits
7 commits
83870a507f
...
51741bc16c
Author | SHA1 | Date | |
---|---|---|---|
51741bc16c | |||
813b927da0 | |||
bb6396c932 | |||
3d05a2395e | |||
38a023bea6 | |||
9ac13834a1 | |||
1a000371fa |
14 changed files with 82 additions and 85 deletions
|
@ -24,7 +24,7 @@ PR=${PR:-}
|
|||
if [ -n "$PR" ]; then
|
||||
title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')"
|
||||
ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')"
|
||||
elif [ -f ".git/branch"]; then
|
||||
elif [ -f ".git/branch" ]; then
|
||||
ref=$(cat .git/branch)-$(git rev-parse --short $ref)
|
||||
else
|
||||
ref=$(git rev-parse --short "$(cat .git/ref || echo "HEAD")")
|
||||
|
|
|
@ -10,6 +10,6 @@ title "Install clippy"
|
|||
rustup component add clippy
|
||||
|
||||
title "Run clippy"
|
||||
cargo clippy --color always --no-deps
|
||||
cargo clippy --color always --no-deps -- -D warnings
|
||||
|
||||
title "Done"
|
||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,6 +1,3 @@
|
|||
[submodule "lib/serde_sjson"]
|
||||
path = lib/serde_sjson
|
||||
url = https://git.sclu1034.dev/lucas/serde_sjson.git
|
||||
[submodule "lib/luajit2-sys"]
|
||||
path = lib/luajit2-sys
|
||||
url = https://github.com/sclu1034/luajit2-sys.git
|
||||
|
|
95
Cargo.lock
generated
95
Cargo.lock
generated
|
@ -39,7 +39,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c43e7fd8284f025d0bd143c2855618ecdf697db55bde39211e5c9faec7669173"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"nom",
|
||||
"nom 7.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -141,7 +141,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -233,7 +233,7 @@ dependencies = [
|
|||
"regex",
|
||||
"rustc-hash 1.1.0",
|
||||
"shlex",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -253,7 +253,7 @@ dependencies = [
|
|||
"regex",
|
||||
"rustc-hash 2.1.0",
|
||||
"shlex",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -383,7 +383,7 @@ version = "0.6.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||
dependencies = [
|
||||
"nom",
|
||||
"nom 7.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -446,7 +446,7 @@ dependencies = [
|
|||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -457,24 +457,24 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
|||
|
||||
[[package]]
|
||||
name = "cli-table"
|
||||
version = "0.4.9"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b53f9241f288a7b12c56565f04aaeaeeab6b8923d42d99255d4ca428b4d97f89"
|
||||
checksum = "14da8d951cef7cc4f13ccc9b744d736963d57863c7e6fc33c070ea274546082c"
|
||||
dependencies = [
|
||||
"cli-table-derive",
|
||||
"termcolor",
|
||||
"unicode-width 0.1.13",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cli-table-derive"
|
||||
version = "0.4.6"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e83a93253aaae7c74eb7428ce4faa6e219ba94886908048888701819f82fb94"
|
||||
checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -740,7 +740,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -818,7 +818,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1286,7 +1286,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2033,7 +2033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2274,14 +2274,23 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom_locate"
|
||||
version = "4.2.0"
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3"
|
||||
checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom_locate"
|
||||
version = "5.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d"
|
||||
dependencies = [
|
||||
"bytecount",
|
||||
"memchr",
|
||||
"nom",
|
||||
"nom 8.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2410,7 +2419,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2557,7 +2566,7 @@ dependencies = [
|
|||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2718,7 +2727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2757,9 +2766,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2775,9 +2784,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -3036,7 +3045,7 @@ version = "1.0.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
|
||||
dependencies = [
|
||||
"bitflags 2.7.0",
|
||||
"bitflags 2.9.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.9.4",
|
||||
|
@ -3252,7 +3261,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3269,9 +3278,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_sjson"
|
||||
version = "1.0.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c5b0d7af37492e99b8559436ee76b9ec8935c75449b1c2ef08c205a9e92ae6f"
|
||||
dependencies = [
|
||||
"nom",
|
||||
"nom 8.0.0",
|
||||
"nom_locate",
|
||||
"serde",
|
||||
]
|
||||
|
@ -3482,9 +3493,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.90"
|
||||
version = "2.0.100"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3588,7 +3599,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3599,7 +3610,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3720,7 +3731,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3868,7 +3879,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4256,7 +4267,7 @@ dependencies = [
|
|||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -4290,7 +4301,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -4327,7 +4338,7 @@ checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.90",
|
||||
"syn 2.0.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4374,7 +4385,7 @@ version = "0.1.9"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4682,7 +4693,7 @@ version = "0.39.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||
dependencies = [
|
||||
"bitflags 2.7.0",
|
||||
"bitflags 2.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -6,7 +6,6 @@ members = [
|
|||
"lib/dtmt-shared",
|
||||
"lib/oodle",
|
||||
"lib/sdk",
|
||||
"lib/serde_sjson",
|
||||
"lib/luajit2-sys",
|
||||
"lib/color-eyre",
|
||||
]
|
||||
|
@ -20,7 +19,7 @@ bincode = "1.3.3"
|
|||
bitflags = "2.5.0"
|
||||
byteorder = "1.4.3"
|
||||
clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] }
|
||||
cli-table = { version = "0.4.7", default-features = false, features = ["derive"] }
|
||||
cli-table = { version = "0.5.0", default-features = false, features = ["derive"] }
|
||||
color-eyre = { path = "lib/color-eyre" }
|
||||
colors-transform = "0.2.11"
|
||||
confy = "0.6.1"
|
||||
|
@ -35,7 +34,7 @@ glob = "0.3.0"
|
|||
interprocess = "2.1.0"
|
||||
lazy_static = "1.4.0"
|
||||
luajit2-sys = { path = "lib/luajit2-sys" }
|
||||
minijinja = { version = "2.0.1", default-features = false }
|
||||
minijinja = { version = "2.0.1", default-features = false, features = ["serde"] }
|
||||
nanorand = "0.7.0"
|
||||
nexusmods = { path = "lib/nexusmods" }
|
||||
notify = "8.0.0"
|
||||
|
@ -47,7 +46,7 @@ pin-project-lite = "0.2.9"
|
|||
promptly = "0.3.1"
|
||||
sdk = { path = "lib/sdk" }
|
||||
serde = { version = "1.0.152", features = ["derive", "rc"] }
|
||||
serde_sjson = { path = "lib/serde_sjson" }
|
||||
serde_sjson = "1.2.1"
|
||||
steamlocate = "2.0.0-beta.2"
|
||||
strip-ansi-escapes = "0.2.0"
|
||||
time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset", "formatting", "macros"] }
|
||||
|
|
|
@ -116,14 +116,14 @@ async fn patch_game_settings(state: Arc<ActionState>) -> Result<()> {
|
|||
eyre::bail!("couldn't find 'boot_script' field");
|
||||
};
|
||||
|
||||
f.write_all(settings[0..i].as_bytes()).await?;
|
||||
f.write_all(&settings.as_bytes()[0..i]).await?;
|
||||
f.write_all(b"boot_script = \"scripts/mod_main\"").await?;
|
||||
|
||||
let Some(j) = settings[i..].find('\n') else {
|
||||
eyre::bail!("couldn't find end of 'boot_script' field");
|
||||
};
|
||||
|
||||
f.write_all(settings[(i + j)..].as_bytes()).await?;
|
||||
f.write_all(&settings.as_bytes()[(i + j)..]).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -453,10 +453,7 @@ async fn build_bundles(state: Arc<ActionState>) -> Result<Vec<Bundle>> {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn patch_boot_bundle(
|
||||
state: Arc<ActionState>,
|
||||
deployment_info: &String,
|
||||
) -> Result<Vec<Bundle>> {
|
||||
async fn patch_boot_bundle(state: Arc<ActionState>, deployment_info: &str) -> Result<Vec<Bundle>> {
|
||||
let bundle_dir = Arc::new(state.game_dir.join("bundle"));
|
||||
let bundle_path = bundle_dir.join(format!("{:x}", Murmur64::hash(BOOT_BUNDLE_NAME.as_bytes())));
|
||||
|
||||
|
@ -590,11 +587,7 @@ fn build_deployment_data(
|
|||
.map(|bundle| format!("{:x}", bundle.name().to_murmur64()))
|
||||
.collect(),
|
||||
// TODO:
|
||||
mod_folders: mod_folders
|
||||
.as_ref()
|
||||
.iter()
|
||||
.map(|folder| folder.clone())
|
||||
.collect(),
|
||||
mod_folders: mod_folders.as_ref().to_vec(),
|
||||
};
|
||||
serde_sjson::to_string(&info).wrap_err("Failed to serizalize deployment data")
|
||||
}
|
||||
|
|
|
@ -91,14 +91,14 @@ async fn patch_game_settings(state: Arc<ActionState>) -> Result<()> {
|
|||
eyre::bail!("couldn't find 'boot_script' field");
|
||||
};
|
||||
|
||||
f.write_all(settings[0..i].as_bytes()).await?;
|
||||
f.write_all(&settings.as_bytes()[0..i]).await?;
|
||||
f.write_all(b"boot_script = \"scripts/mod_main\"").await?;
|
||||
|
||||
let Some(j) = settings[i..].find('\n') else {
|
||||
eyre::bail!("couldn't find end of 'boot_script' field");
|
||||
};
|
||||
|
||||
f.write_all(settings[(i + j)..].as_bytes()).await?;
|
||||
f.write_all(&settings.as_bytes()[(i + j)..]).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ pub(crate) async fn reset_mod_deployment(state: ActionState) -> Result<()> {
|
|||
|
||||
for p in paths {
|
||||
let path = bundle_dir.join(p);
|
||||
let backup = bundle_dir.join(&format!("{}.bak", p));
|
||||
let backup = bundle_dir.join(format!("{}.bak", p));
|
||||
|
||||
let res = async {
|
||||
tracing::debug!(
|
||||
|
|
|
@ -397,7 +397,7 @@ fn extract_legacy_mod<R: Read + Seek>(
|
|||
tracing::trace!("Writing file '{}'", name.display());
|
||||
let mut out = std::fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.open(&name)
|
||||
.wrap_err_with(|| format!("Failed to open file '{}'", name.display()))?;
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ async fn parse_command_line_template(tmpl: &String) -> Result<CmdLine> {
|
|||
String::from_utf8_unchecked(bytes.to_vec())
|
||||
});
|
||||
|
||||
while let Some(arg) = parsed.next() {
|
||||
for arg in parsed.by_ref() {
|
||||
// Safety: See above.
|
||||
cmd.arg(unsafe { String::from_utf8_unchecked(arg.to_vec()) });
|
||||
}
|
||||
|
|
|
@ -54,17 +54,11 @@ impl<'a> ShellParser<'a> {
|
|||
}
|
||||
_ => {}
|
||||
},
|
||||
ParserState::SingleQuote => match c {
|
||||
b'\'' => {
|
||||
return Some(&self.bytes[start..(self.offset - 1)]);
|
||||
}
|
||||
_ => {}
|
||||
ParserState::SingleQuote => if c == b'\'' {
|
||||
return Some(&self.bytes[start..(self.offset - 1)]);
|
||||
},
|
||||
ParserState::DoubleQuote => match c {
|
||||
b'"' => {
|
||||
return Some(&self.bytes[start..(self.offset - 1)]);
|
||||
}
|
||||
_ => {}
|
||||
ParserState::DoubleQuote => if c == b'"' {
|
||||
return Some(&self.bytes[start..(self.offset - 1)]);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ impl Bundle {
|
|||
|
||||
// Ceiling division (or division toward infinity) to calculate
|
||||
// the number of chunks required to fit the unpacked data.
|
||||
let num_chunks = (unpacked_data.len() + CHUNK_SIZE - 1) / CHUNK_SIZE;
|
||||
let num_chunks = unpacked_data.len().div_ceil(CHUNK_SIZE);
|
||||
tracing::trace!(num_chunks);
|
||||
w.write_u32(num_chunks as u32)?;
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ pub fn compile(name: impl Into<IdString64>, code: impl AsRef<str>) -> Result<Bun
|
|||
tracing::trace!(
|
||||
"Compiling '{}', {} bytes of code",
|
||||
name.display(),
|
||||
code.as_bytes().len()
|
||||
code.len()
|
||||
);
|
||||
|
||||
let bytecode = unsafe {
|
||||
|
@ -156,10 +156,10 @@ pub fn compile(name: impl Into<IdString64>, code: impl AsRef<str>) -> Result<Bun
|
|||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
lua::lua_setglobal(state, b"fn\0".as_ptr() as _);
|
||||
lua::lua_setglobal(state, c"fn".as_ptr());
|
||||
|
||||
let run = b"return string.dump(fn, false)\0";
|
||||
match lua::luaL_loadstring(state, run.as_ptr() as _) as u32 {
|
||||
let run = c"return string.dump(fn, false)";
|
||||
match lua::luaL_loadstring(state, run.as_ptr()) as u32 {
|
||||
lua::LUA_OK => {}
|
||||
lua::LUA_ERRSYNTAX => {
|
||||
let err = lua::lua_tostring(state, -1);
|
||||
|
|
|
@ -28,10 +28,14 @@ impl Language {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct Strings(HashMap<String, HashMap<Language, String>>);
|
||||
|
||||
#[inline(always)]
|
||||
fn read_string<R>(r: R) -> Result<String>
|
||||
where
|
||||
R: Read,
|
||||
{
|
||||
// We can safely ignore the warning here, as all data is already in memory, and no additional
|
||||
// `BufReader` should be needed.
|
||||
#[allow(clippy::unbuffered_bytes)]
|
||||
r.bytes()
|
||||
.take_while(|b| b.as_ref().map(|b| *b != 0).unwrap_or(false))
|
||||
.map(|b| b.map_err(Report::new))
|
||||
|
@ -41,7 +45,7 @@ where
|
|||
|
||||
impl Strings {
|
||||
#[tracing::instrument(skip_all, fields(languages = variants.len()))]
|
||||
pub fn from_variants(ctx: &crate::Context, variants: &Vec<BundleFileVariant>) -> Result<Self> {
|
||||
pub fn from_variants(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result<Self> {
|
||||
let mut map: HashMap<String, HashMap<Language, String>> = HashMap::new();
|
||||
|
||||
for (i, variant) in variants.iter().enumerate() {
|
||||
|
@ -76,7 +80,7 @@ impl Strings {
|
|||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn decompile(ctx: &crate::Context, variants: &Vec<BundleFileVariant>) -> Result<Vec<UserFile>> {
|
||||
pub fn decompile(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result<Vec<UserFile>> {
|
||||
let strings = Strings::from_variants(ctx, variants)?;
|
||||
let content = strings.to_sjson()?;
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 73d2b23ce50e75b184f5092ad515e97a0adbe6da
|
Loading…
Add table
Add a link
Reference in a new issue