Skip to content

Commit

Permalink
[bndbuild] Implementation emulation handing for windows too
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty/Benediction committed Aug 6, 2024
1 parent 960b74f commit de808a6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
Empty file modified cpclib-basm/pgo.sh
100755 → 100644
Empty file.
Empty file modified cpclib-bdasm/tries.sh
100755 → 100644
Empty file.
27 changes: 25 additions & 2 deletions cpclib-bndbuild/src/runners/emulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cfg_match! {
download_url: "http://www.roudoudou.com/ACE-DL/BWIN64.zip", // we assume a 64bits machine
folder : "AceWakePoint",
archive_format: ArchiveFormat::Zip,
exec_fname: "AceWakePoint/AceDL/AceDL.exe"
exec_fname: "AceDL.exe"
}}
}
}
Expand All @@ -160,6 +160,21 @@ cfg_match! {
}
}
}

impl WinapeVersion {
pub fn configuration(&self) -> EmulatorConfiguration {
match self {
WinapeVersion::v2_0b2 => {
EmulatorConfiguration {
download_url: "http://www.winape.net/download/WinAPE20B2.zip",
folder: "winape_2_0b2",
archive_format: ArchiveFormat::Zip,
exec_fname: "WinApe.exe"
}
},
}
}
}
}
cfg(target_os = "macos") =>
{
Expand All @@ -186,9 +201,13 @@ impl EmulatorConfiguration {
}

pub fn cache_folder(&self) -> Utf8PathBuf {
let proj_dirs = ProjectDirs::from("net.cpcscene", "Benediction", "BND Build").unwrap();
let proj_dirs = ProjectDirs::from("net.cpcscene", "benediction", "bnd build").unwrap();
let base_cache = proj_dirs.cache_dir();

if !base_cache.exists() {
std::fs::create_dir_all(base_cache);
}

base_cache.join(self.folder).try_into().unwrap()
}

Expand All @@ -199,6 +218,9 @@ impl EmulatorConfiguration {
pub fn install(&self) {
// get the file
let dest = self.cache_folder();



let resp = self.download().unwrap();
let mut input = resp.into_reader();

Expand All @@ -212,6 +234,7 @@ impl EmulatorConfiguration {
ArchiveFormat::Zip => {
let mut buffer = Vec::new();
input.read_to_end(&mut buffer).unwrap();
dbg!(&dest);
zip_extract::extract(Cursor::new(buffer), dest.as_std_path(), true).unwrap();
},
}
Expand Down
4 changes: 3 additions & 1 deletion cpclib-bndbuild/tests/emu/bndbuild.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# execute properly both on linux and windows
- tgt: ace
cmd: ace ../../../cpclib/tests/dsk/harley.dsk -autoRunFile '-CED-.exe'

# execute properly both on linux and windows
- tgt: cpcec
cmd: cpcec ../../../cpclib/tests/dsk/harley.dsk


# Fails under linux to provide the file
# Fail to properly provide the file both on linux and windows
- tgt: winape
cmd: winape ../../../cpclib/tests/dsk/harley.dsk /A:-CED-.exe

0 comments on commit de808a6

Please sign in to comment.