cpclib_runner/runner/tracker/
at3.rs1use std::fmt::Display;
2use std::sync::OnceLock;
3
4use crate::delegated::{
5 DownloadableInformation, ExecutableInformation, InternetStaticCompiledApplication,
6 MutiplatformUrls, StaticInformation
7};
8
9pub const AT_CMD: &str = "at3";
10
11#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
12pub enum At3Version {
13 #[default]
14 V3_2_3
15}
16
17impl Display for At3Version {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 let v = match self {
20 At3Version::V3_2_3 => "v3.2.3"
21 };
22
23 write!(f, "{v}")
24 }
25}
26
27impl StaticInformation for At3Version {
28 fn static_download_urls(&self) -> &'static crate::delegated::MutiplatformUrls {
29 static URL: OnceLock<MutiplatformUrls> = OnceLock::new();
30
31 URL.get_or_init(|| {
32 MutiplatformUrls::builder()
33 .linux("https://bitbucket.org/JulienNevo/arkostracker3/downloads/ArkosTracker-linux64-3.2.3.zip")
34 .windows("https://bitbucket.org/JulienNevo/arkostracker3/downloads/ArkosTracker-windows-3.2.3.zip")
35 .macos("https://bitbucket.org/JulienNevo/arkostracker3/downloads/ArkosTracker-macos-3.2.3.zip")
36 .build()
37 })
38 }
39}
40
41impl DownloadableInformation for At3Version {
42 fn target_os_archive_format(&self) -> crate::delegated::ArchiveFormat {
43 crate::delegated::ArchiveFormat::Zip
44 }
45}
46
47impl ExecutableInformation for At3Version {
48 fn target_os_folder(&self) -> &'static str {
49 static FOLDER: OnceLock<String> = OnceLock::new();
50 FOLDER.get_or_init(|| format!("at3_{self}")).as_str()
51 }
52
53 fn target_os_exec_fname(&self) -> &'static str {
54 #[cfg(not(target_os = "windows"))]
55 return "ArkosTracker3";
56 #[cfg(target_os = "windows")]
57 return "ArkosTracker3.exe";
58 }
59}
60
61impl InternetStaticCompiledApplication for At3Version {}
62
63pub mod extra {
64 use std::ops::Deref;
65
66 use super::At3Version;
67 use crate::runner::extra::ExtraTool;
68
69 macro_rules! generate_song_handler {
70 ($($name: ident)*) => {
71 $(
72
73 #[derive(Clone, Debug, PartialEq, Eq, Hash)]
74 pub struct $name(ExtraTool<At3Version>);
75 impl Deref for $name {
76 type Target = ExtraTool<At3Version>;
77 fn deref(&self) -> &Self::Target {
78 &self.0
79 }
80 }
81
82 impl Default for $name {
83 fn default() -> Self {
84 let extra = ExtraTool::builder()
85 .tool(Default::default())
86 .target_os_exec_fname(concat!("tools/", stringify!($name)))
87 .build();
88
89 Self(extra)
90 }
91 }
92
93 impl $name {
94 pub const CMD: &'static str = stringify!($name);
95 }
96
97
98 )*
99 };
100 }
101
102 generate_song_handler! {SongToAkg SongToAkm SongToAky SongToEvents SongToRaw SongToSoundEffects SongToVgm SongToWav SongToYm}
103}