Compare commits

...

5 Commits

Author SHA1 Message Date
Luke Street fdf421a5d8 Update dependencies (advisory fix) 2023-12-20 20:43:39 -07:00
Luke Street d470f7aec6 Version 0.6.5 2023-12-20 20:30:48 -07:00
Luke Street 227153193e Sanitize auto-function-split names
Fixes #16
2023-12-20 20:28:30 -07:00
Luke Street 2681e51443 Don't double remove obj path extension
Don't remember why I had it like this

Fixes #17
2023-12-20 20:22:00 -07:00
Luke Street 6f2bb62082 Downgrade vis_flags/active_flags error to warn
Fixes #18
2023-12-20 19:11:23 -07:00
5 changed files with 28 additions and 23 deletions

21
Cargo.lock generated
View File

@ -295,7 +295,7 @@ dependencies = [
[[package]]
name = "decomp-toolkit"
version = "0.6.4"
version = "0.6.5"
dependencies = [
"anyhow",
"ar",
@ -329,6 +329,7 @@ dependencies = [
"rayon",
"regex",
"rustc-hash",
"sanitise-file-name",
"serde",
"serde_json",
"serde_repr",
@ -921,6 +922,12 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "sanitise-file-name"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d36299972b96b8ae7e8f04ecbf75fb41a27bf3781af00abcf57609774cb911"
[[package]]
name = "scopeguard"
version = "1.2.0"
@ -1221,9 +1228,9 @@ checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unsafe-libyaml"
version = "0.2.9"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b"
[[package]]
name = "valuable"
@ -1424,18 +1431,18 @@ checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b"
[[package]]
name = "zerocopy"
version = "0.7.26"
version = "0.7.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.26"
version = "0.7.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a"
dependencies = [
"proc-macro2",
"quote",

View File

@ -3,7 +3,7 @@ name = "decomp-toolkit"
description = "Yet another GameCube/Wii decompilation toolkit."
authors = ["Luke Street <luke@street.dev>"]
license = "MIT OR Apache-2.0"
version = "0.6.4"
version = "0.6.5"
edition = "2021"
publish = false
repository = "https://github.com/encounter/decomp-toolkit"
@ -56,6 +56,7 @@ ppc750cl = { git = "https://github.com/encounter/ppc750cl", rev = "4a2bbbc6f84dc
rayon = "1.8.0"
regex = "1.10.2"
rustc-hash = "1.1.0"
sanitise-file-name = "1.0.0"
serde = "1.0.192"
serde_json = "1.0.108"
serde_repr = "0.1.17"

View File

@ -5,6 +5,7 @@ use std::{
use anyhow::{bail, Result};
use num_enum::{IntoPrimitive, TryFromPrimitive};
use tracing::warn;
use crate::{
obj::{ObjSymbol, ObjSymbolKind},
@ -210,17 +211,11 @@ impl FromReader for CommentSym {
out.align = u32::from_reader(reader, e)?;
out.vis_flags = u8::from_reader(reader, e)?;
if !matches!(out.vis_flags, 0 | 0xD | 0xE) {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Unknown vis_flags: {:#X}", out.vis_flags),
));
warn!("Unknown vis_flags: {:#X}", out.vis_flags);
}
out.active_flags = u8::from_reader(reader, e)?;
if !matches!(out.active_flags, 0 | 0x8 | 0x10 | 0x20) {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Unknown active_flags: {:#X}", out.active_flags),
));
warn!("Unknown active_flags: {:#X}", out.active_flags);
}
let value = u8::from_reader(reader, e)?;
if value != 0 {

View File

@ -110,10 +110,6 @@ pub fn generate_ldscript_partial(
Ok(out)
}
pub fn obj_path_for_unit(unit: &str) -> PathBuf {
PathBuf::from_slash(unit).with_extension("").with_extension("o")
}
pub fn obj_path_for_unit(unit: &str) -> PathBuf { PathBuf::from_slash(unit).with_extension("o") }
pub fn asm_path_for_unit(unit: &str) -> PathBuf {
PathBuf::from_slash(unit).with_extension("").with_extension("s")
}
pub fn asm_path_for_unit(unit: &str) -> PathBuf { PathBuf::from_slash(unit).with_extension("s") }

View File

@ -6,6 +6,7 @@ use std::{
use anyhow::{anyhow, bail, ensure, Context, Result};
use itertools::Itertools;
use petgraph::{graph::NodeIndex, Graph};
use sanitise_file_name::sanitize_with_options;
use tracing_attributes::instrument;
use crate::{
@ -69,7 +70,12 @@ fn split_ctors_dtors(obj: &mut ObjInfo, start: SectionAddress, end: SectionAddre
.section
.and_then(|idx| obj.sections.get(idx).map(|s| s.name.clone()))
.unwrap_or_else(|| "unknown".to_string());
format!("auto_{}_{}", function_symbol.name, section_name.trim_start_matches('.'))
let name =
sanitize_with_options(&function_symbol.name, &sanitise_file_name::Options {
length_limit: 20,
..Default::default()
});
format!("auto_{}_{}", name, section_name.trim_start_matches('.'))
});
log::debug!("Adding splits to unit {}", unit);