mirror of
https://codeberg.org/unspeaker/vestal.git
synced 2025-12-06 12:56:41 +01:00
propose output layout
This commit is contained in:
parent
88a5f28f9e
commit
8f7faca54a
1 changed files with 30 additions and 1 deletions
|
|
@ -80,7 +80,8 @@ fn main () -> Usually<()> {
|
||||||
.search(canonicalize(path.clone().parent().expect("invalid parent path"))?)
|
.search(canonicalize(path.clone().parent().expect("invalid parent path"))?)
|
||||||
.search("/home/user/Lab/Cosmo/wineprefix/drive_c/windows/system32")
|
.search("/home/user/Lab/Cosmo/wineprefix/drive_c/windows/system32")
|
||||||
.load(true)?
|
.load(true)?
|
||||||
.resolve(true)?;
|
.resolve(true)?
|
||||||
|
.relink()?;
|
||||||
} else {
|
} else {
|
||||||
println!("Pass a path to a VST DLL");
|
println!("Pass a path to a VST DLL");
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +152,34 @@ impl Module {
|
||||||
}
|
}
|
||||||
Ok(module)
|
Ok(module)
|
||||||
}
|
}
|
||||||
|
/// Build an ELF executable out of the DLL
|
||||||
|
fn relink (self: Arc<Self>) -> Usually<Arc<Self>> {
|
||||||
|
let page = 32*1024;
|
||||||
|
let mut size = 0;
|
||||||
|
for module in self.namespace.read().unwrap().values() {
|
||||||
|
size += module.code_size.div_ceil(page);
|
||||||
|
}
|
||||||
|
println!("\n{}", fmt_num(size*page));
|
||||||
|
let mut layout: BTreeMap<usize, Arc<Self>> = Default::default();
|
||||||
|
let mut index = 0;
|
||||||
|
let mut append = |module: &Arc<Self>|{
|
||||||
|
println!("{} [+{}] {:16}",
|
||||||
|
fmt_num(index),
|
||||||
|
fmt_num(module.code_size),
|
||||||
|
module.name);
|
||||||
|
layout.insert(index, self.clone());
|
||||||
|
index += module.code_size.div_ceil(page) * page;
|
||||||
|
};
|
||||||
|
append(&self);
|
||||||
|
for module in self.namespace.read().unwrap().values() {
|
||||||
|
if module.name == self.name {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
append(module);
|
||||||
|
}
|
||||||
|
let mut output = vec![0x90;size];
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_dll_name (path: &impl AsRef<Path>) -> Arc<str> {
|
fn to_dll_name (path: &impl AsRef<Path>) -> Arc<str> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue