Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ readme = "README.md"
categories = ["command-line-utilities"]
rust-version = "1.85"

[lib]
name = "decomp_toolkit"
path = "src/lib.rs"

[[bin]]
name = "dtk"
path = "src/main.rs"
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/dol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,11 +869,11 @@ fn resolve_external_relocations(
Ok(())
}

struct AnalyzeResult {
obj: ObjInfo,
dep: Vec<Utf8NativePathBuf>,
symbols_cache: Option<FileReadInfo>,
splits_cache: Option<FileReadInfo>,
pub struct AnalyzeResult {
pub obj: ObjInfo,
pub dep: Vec<Utf8NativePathBuf>,
pub symbols_cache: Option<FileReadInfo>,
pub splits_cache: Option<FileReadInfo>,
}

fn load_dol_module(
Expand All @@ -897,7 +897,7 @@ fn load_dol_module(
Ok((obj, object_path))
}

fn load_analyze_dol(config: &ProjectConfig, object_base: &ObjectBase) -> Result<AnalyzeResult> {
pub fn load_analyze_dol(config: &ProjectConfig, object_base: &ObjectBase) -> Result<AnalyzeResult> {
let (mut obj, object_path) = load_dol_module(&config.base, object_base)?;
let mut dep = vec![object_path];

Expand Down
22 changes: 22 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![deny(unused_crate_dependencies)]
//! decomp-toolkit as a library.
//!
//! The `dtk` binary in `main.rs` is the primary consumer, and these modules are
//! arranged for it rather than as a curated public API.
//!
//! Nothing here is covered by a stability promise: it moves with `dtk`.

pub mod analysis;
pub mod argp_version;
pub mod cmd;
pub mod obj;
pub mod util;
pub mod vfs;

// Dependencies of the `dtk` binary alone. `unused_crate_dependencies` is
// checked per target, so without these the library target reports them unused.
use enable_ansi_support as _;
#[cfg(target_env = "musl")]
use mimalloc as _;
use supports_color as _;
use tracing_subscriber as _;
9 changes: 1 addition & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
#![deny(unused_crate_dependencies)]
use std::{env, ffi::OsStr, fmt::Display, path::PathBuf, process::exit, str::FromStr};

use anyhow::Error;
use argp::{FromArgValue, FromArgs};
use decomp_toolkit::{argp_version, cmd};
use enable_ansi_support::enable_ansi_support;
use supports_color::Stream;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::EnvFilter;

pub mod analysis;
pub mod argp_version;
pub mod cmd;
pub mod obj;
pub mod util;
pub mod vfs;

// musl's allocator is very slow, so use mimalloc when targeting musl.
// Otherwise, use the system allocator to avoid extra code size.
#[cfg(target_env = "musl")]
Expand Down