convert to workspace; scaffold wrapper

This commit is contained in:
🪞👃🪞 2024-10-27 21:12:04 +02:00
parent 47ee160c47
commit 52f5c58519
6 changed files with 662 additions and 20 deletions

10
crates/vestal/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "vestal"
version = "0.1.0"
edition = "2021"
[dependencies]
exe = "0.5.6"
goblin = "0.9.2"
clap = { version = "4.5.4", features = [ "derive" ] }

42
crates/vestal/src/main.rs Normal file
View file

@ -0,0 +1,42 @@
use clap::Parser;
use std::path::Path;
use exe::pe::{PE, VecPE};
use exe::types::{ImportDirectory, ImportData, CCharString};
type Usually<T> = Result<T, Box<dyn std::error::Error>>;
fn main () -> Usually<()> {
VestalCli::parse().run()
}
#[derive(Debug, Parser)]
#[command(version, about, long_about = None)]
pub enum VestalCli {
/// Inspect a DLL
Inspect {
path: String
}
}
impl VestalCli {
fn run (&self) -> Usually<()> {
match self {
Self::Inspect { path } => self.inspect(path.as_str())
}
}
fn inspect (&self, path: impl AsRef<Path>) -> Usually<()> {
let image = VecPE::from_disk_file(path)?;
let import_directory = ImportDirectory::parse(&image)?;
for descriptor in import_directory.descriptors {
let name = descriptor.get_name(&image)?.as_str()?;
println!("\n{name}:");
for import in descriptor.get_imports(&image).unwrap() {
match import {
ImportData::Ordinal(x) => println!("{name} #{}", x),
ImportData::ImportByName(s) => println!("{name} {}", s)
}
}
}
Ok(())
}
}

10
crates/wrapper/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "vestal_wrapper"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
[dependencies]
nih_plug = { git = "https://github.com/robbert-vdh/nih-plug" }

49
crates/wrapper/src/lib.rs Normal file
View file

@ -0,0 +1,49 @@
use std::sync::Arc;
use nih_plug::prelude::*;
#[derive(Default)] pub struct VestalWrapper { params: Arc<VestalWrapperParams> }
#[derive(Default, Clone, Params)] struct VestalWrapperParams {}
impl Plugin for VestalWrapper {
const NAME: &'static str = "VESTAL";
const VENDOR: &'static str = "AUTHOR";
const URL: &'static str = env!("CARGO_PKG_HOMEPAGE");
const EMAIL: &'static str = "EMAIL";
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const AUDIO_IO_LAYOUTS: &'static [AudioIOLayout] = &[];
const SAMPLE_ACCURATE_AUTOMATION: bool = true;
type SysExMessage = ();
type BackgroundTask = ();
fn params (&self) -> Arc<dyn Params> {
self.params.clone()
}
fn editor (&mut self, _async_executor: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
None
}
fn initialize (
&mut self, _: &AudioIOLayout, _: &BufferConfig, _: &mut impl InitContext<Self>,
) -> bool {
todo!("initialize");
true
}
fn reset (&mut self) {
todo!("reset");
}
fn process (
&mut self, _: &mut Buffer, _: &mut AuxiliaryBuffers, _: &mut impl ProcessContext<Self>
) -> ProcessStatus {
todo!("process");
ProcessStatus::Normal
}
}
impl ClapPlugin for VestalWrapper {
const CLAP_ID: &'static str = "ID";
const CLAP_DESCRIPTION: Option<&'static str> = Some("DESC");
const CLAP_MANUAL_URL: Option<&'static str> = Some(Self::URL);
const CLAP_SUPPORT_URL: Option<&'static str> = None;
const CLAP_FEATURES: &'static [ClapFeature] = &[];
}
impl Vst3Plugin for VestalWrapper {
const VST3_CLASS_ID: [u8; 16] = *b"VESTAL_________.";
const VST3_SUBCATEGORIES: &'static [Vst3SubCategory] = &[];
}
nih_export_clap!(VestalWrapper);
nih_export_vst3!(VestalWrapper);