diff --git a/Cargo.lock b/Cargo.lock index dbfa6fe..55dd12d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -673,6 +673,7 @@ dependencies = [ "color-eyre", "confy", "druid", + "dtmt-shared", "futures", "oodle-sys", "sdk", @@ -694,6 +695,7 @@ dependencies = [ "color-eyre", "confy", "csv-async", + "dtmt-shared", "futures", "futures-util", "glob", @@ -715,6 +717,13 @@ dependencies = [ "zip", ] +[[package]] +name = "dtmt-shared" +version = "0.1.0" +dependencies = [ + "serde", +] + [[package]] name = "dwrote" version = "0.11.0" diff --git a/crates/dtmm/Cargo.toml b/crates/dtmm/Cargo.toml index 9eaec24..65b1bca 100644 --- a/crates/dtmm/Cargo.toml +++ b/crates/dtmm/Cargo.toml @@ -11,11 +11,12 @@ clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "str color-eyre = "0.6.2" confy = "0.5.1" druid = { git = "https://github.com/linebender/druid.git", features = ["im"] } +dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } futures = "0.3.25" -sdk = { path = "../../lib/sdk", version = "0.2.0" } -serde = { version = "1.0.152", features = ["derive"] } -serde_sjson = { path = "../../lib/serde_sjson", version = "*" } oodle-sys = { path = "../../lib/oodle-sys", version = "*" } +sdk = { path = "../../lib/sdk", version = "0.2.0" } +serde_sjson = { path = "../../lib/serde_sjson", version = "*" } +serde = { version = "1.0.152", features = ["derive"] } tokio = { version = "1.23.0", features = ["rt", "fs", "tracing", "sync"] } tracing = "0.1.37" tracing-error = "0.2.0" diff --git a/crates/dtmm/src/engine.rs b/crates/dtmm/src/engine.rs index 06c8c5c..3509b0b 100644 --- a/crates/dtmm/src/engine.rs +++ b/crates/dtmm/src/engine.rs @@ -8,14 +8,14 @@ use std::sync::Arc; use color_eyre::eyre::Context; use color_eyre::{eyre, Help, Result}; use druid::FileInfo; +use dtmt_shared::ModConfig; use futures::stream; use futures::StreamExt; use sdk::filetype::lua; use sdk::filetype::package::Package; use sdk::murmur::Murmur64; use sdk::{ - Bundle, BundleDatabase, BundleFile, BundleFileType, BundleFileVariant, FromBinary, ModConfig, - ToBinary, + Bundle, BundleDatabase, BundleFile, BundleFileType, BundleFileVariant, FromBinary, ToBinary, }; use tokio::io::AsyncWriteExt; use tokio::{fs, try_join}; diff --git a/crates/dtmm/src/state.rs b/crates/dtmm/src/state.rs index 93afd61..315cd2e 100644 --- a/crates/dtmm/src/state.rs +++ b/crates/dtmm/src/state.rs @@ -7,7 +7,7 @@ use druid::{ AppDelegate, Command, Data, DelegateCtx, Env, FileInfo, Handled, Lens, Selector, SingleUse, Target, }; -use sdk::ModConfig; +use dtmt_shared::ModConfig; use tokio::sync::mpsc::UnboundedSender; use crate::Config; diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index cb8f646..3b8cb36 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -5,28 +5,29 @@ edition = "2021" [dependencies] clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "unicode"] } +cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } color-eyre = "0.6.2" +confy = "0.5.1" csv-async = { version = "1.2.4", features = ["tokio", "serde"] } -sdk = { path = "../../lib/sdk", version = "0.2.0" } +dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } futures = "0.3.25" futures-util = "0.3.24" glob = "0.3.0" libloading = "0.7.4" nanorand = "0.7.0" -pin-project-lite = "0.2.9" -serde = { version = "1.0.147", features = ["derive"] } oodle-sys = { path = "../../lib/oodle-sys", version = "*" } +pin-project-lite = "0.2.9" +promptly = "0.3.1" +sdk = { path = "../../lib/sdk", version = "0.2.0" } serde_sjson = { path = "../../lib/serde_sjson", version = "*" } -tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +serde = { version = "1.0.147", features = ["derive"] } +string_template = "0.2.1" tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } -tracing = { version = "0.1.37", features = ["async-await"] } +tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } tracing-error = "0.2.0" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -confy = "0.5.1" +tracing = { version = "0.1.37", features = ["async-await"] } zip = "0.6.3" -string_template = "0.2.1" -promptly = "0.3.1" -cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } [dev-dependencies] tempfile = "3.3.0" diff --git a/crates/dtmt/src/cmd/build.rs b/crates/dtmt/src/cmd/build.rs index 55acad1..f470d97 100644 --- a/crates/dtmt/src/cmd/build.rs +++ b/crates/dtmt/src/cmd/build.rs @@ -4,10 +4,11 @@ use std::sync::Arc; use clap::{value_parser, Arg, ArgMatches, Command}; use color_eyre::eyre::{self, Context, Result}; use color_eyre::{Help, Report}; +use dtmt_shared::ModConfig; use futures::future::try_join_all; use futures::StreamExt; use sdk::filetype::package::Package; -use sdk::{Bundle, BundleFile, ModConfig}; +use sdk::{Bundle, BundleFile}; use tokio::fs::{self, File}; use tokio::io::AsyncReadExt; diff --git a/lib/dtmt-shared/Cargo.toml b/lib/dtmt-shared/Cargo.toml new file mode 100644 index 0000000..30daa24 --- /dev/null +++ b/lib/dtmt-shared/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "dtmt-shared" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde = "1.0.152" diff --git a/lib/dtmt-shared/README.adoc b/lib/dtmt-shared/README.adoc new file mode 100644 index 0000000..01b26ec --- /dev/null +++ b/lib/dtmt-shared/README.adoc @@ -0,0 +1,13 @@ += dtmt-shared +:idprefix: +:idseparator: +:toc: macro +:toclevels: 1 +:!toc-title: +:caution-caption: :fire: +:important-caption: :exclamtion: +:note-caption: :paperclip: +:tip-caption: :bulb: +:warning-caption: :warning: + +A set of types and functions shared between multiple crates within _Darktide Mod Tools_ that don't fit into the engine SDK. diff --git a/lib/dtmt-shared/src/lib.rs b/lib/dtmt-shared/src/lib.rs new file mode 100644 index 0000000..592d779 --- /dev/null +++ b/lib/dtmt-shared/src/lib.rs @@ -0,0 +1,22 @@ +#[derive(Clone, Debug, Default, serde::Deserialize)] +pub struct ModConfigResources { + pub init: String, + #[serde(default)] + pub data: Option, + #[serde(default)] + pub localization: Option, +} + +#[derive(Clone, Debug, Default, serde::Deserialize)] +pub struct ModConfig { + #[serde(skip)] + pub dir: std::path::PathBuf, + pub id: String, + pub name: String, + pub description: String, + pub version: String, + pub packages: Vec, + pub resources: ModConfigResources, + #[serde(default)] + pub depends: Vec, +} diff --git a/lib/dtmt-shared/src/log.rs b/lib/dtmt-shared/src/log.rs new file mode 100644 index 0000000..6b48375 --- /dev/null +++ b/lib/dtmt-shared/src/log.rs @@ -0,0 +1,6 @@ +use tracing_subscriber::fmt::format::Writer; + +fn format_time(w: &mut Writer) -> std::fmt::Result { + let time = now_local(); + write!(w, ""); +} diff --git a/lib/sdk/src/lib.rs b/lib/sdk/src/lib.rs index 1e2f5bb..e229e28 100644 --- a/lib/sdk/src/lib.rs +++ b/lib/sdk/src/lib.rs @@ -9,26 +9,3 @@ pub use bundle::database::BundleDatabase; pub use bundle::decompress; pub use bundle::{Bundle, BundleFile, BundleFileType, BundleFileVariant}; pub use context::Context; - -#[derive(Clone, Debug, Default, serde::Deserialize)] -pub struct ModConfigResources { - pub init: String, - #[serde(default)] - pub data: Option, - #[serde(default)] - pub localization: Option, -} - -#[derive(Clone, Debug, Default, serde::Deserialize)] -pub struct ModConfig { - #[serde(skip)] - pub dir: std::path::PathBuf, - pub id: String, - pub name: String, - pub description: String, - pub version: String, - pub packages: Vec, - pub resources: ModConfigResources, - #[serde(default)] - pub depends: Vec, -}