Get overlay structure ready
This commit is contained in:
parent
613df250b6
commit
3389b586bc
|
@ -1,14 +1 @@
|
||||||
pub fn add(left: usize, right: usize) -> usize {
|
pub mod types;
|
||||||
left + right
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn it_works() {
|
|
||||||
let result = add(2, 2);
|
|
||||||
assert_eq!(result, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
fn main() {
|
use mkoverlay::types::{OverlaySection, OverlaySlot};
|
||||||
println!("Blubbi");
|
|
||||||
|
fn generate_file() -> Vec<OverlaySlot> {
|
||||||
|
let mut slots = Vec::new();
|
||||||
|
let mut slot = OverlaySlot::new("slot_0".to_owned(), String::new());
|
||||||
|
let mut section = OverlaySection::new("main_area".to_owned());
|
||||||
|
|
||||||
|
section.add_file_pattern("bin/PSX-release/src/*.o".to_owned());
|
||||||
|
|
||||||
|
slot.add_section(section);
|
||||||
|
slots.push(slot);
|
||||||
|
|
||||||
|
slots
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Blubbi: {:?}", generate_file());
|
||||||
}
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct OverlaySection {
|
||||||
|
name: String,
|
||||||
|
file_pattern: Vec<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OverlaySection {
|
||||||
|
pub fn new(name: String) -> OverlaySection {
|
||||||
|
OverlaySection{name, file_pattern: Vec::new()}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_file_pattern(&mut self, file_pattern: String) {
|
||||||
|
self.file_pattern.push(file_pattern);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct OverlaySlot {
|
||||||
|
name: String,
|
||||||
|
start_adr: String,
|
||||||
|
sections: Vec<OverlaySection>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OverlaySlot {
|
||||||
|
pub fn new(name: String, start_adr: String) -> OverlaySlot {
|
||||||
|
OverlaySlot{name, start_adr, sections: Vec::new()}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_section(&mut self, section: OverlaySection) {
|
||||||
|
self.sections.push(section);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue