diff --git a/CHANGELOG.md b/CHANGELOG.md index ba0816e..2b8bdfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.17.0 + +- Added a package creation prompt +- Added a default package icon + ## 0.16.0 - Fixed the clear cache button not working diff --git a/public/no-icon.png b/public/no-icon.png new file mode 100644 index 0000000..3460dc7 Binary files /dev/null and b/public/no-icon.png differ diff --git a/rust/src/cmd.rs b/rust/src/cmd.rs index 05878cb..c8ccec6 100644 --- a/rust/src/cmd.rs +++ b/rust/src/cmd.rs @@ -1,11 +1,12 @@ use ini::Ini; use log; -use std::collections::{BTreeMap, HashMap}; +use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::path::PathBuf; use tokio::sync::Mutex; use tokio::fs; use tauri::{AppHandle, Manager, State}; use crate::model::config::GlobalConfigField; +use crate::model::local::PackageManifest; use crate::model::misc::Game; use crate::model::patch::Patch; use crate::modules::package::prepare_dlls; @@ -166,6 +167,65 @@ pub async fn toggle_package(state: State<'_, tokio::sync::Mutex>, key: .map_err(|e| e.to_string()) } +#[tauri::command] +pub async fn create_package( + name: String, + description: String, + website: String, + r#type: String, + games: Vec +) -> Result<(), String> { + log::debug!("invoke: create_package"); + + let dir = util::pkg_dir_of("local", &name); + + if dir.exists() { + return Err("Package already exists".to_owned()); + } + + let mut installers = Vec::new(); + + if r#type == "segatools" { + let mut map = BTreeMap::new(); + map.insert( + "identifier".to_owned(), + serde_json::Value::String("segatools".to_owned()) + ); + installers.push(map); + } else if r#type == "native" { + let mut map = BTreeMap::new(); + map.insert( + "identifier".to_owned(), + serde_json::Value::String("native_mod".to_owned()) + ); + map.insert( + "dll-game".to_owned(), + serde_json::Value::String("some.dll".to_owned()) + ); + map.insert( + "dll-amdaemon".to_owned(), + serde_json::Value::String("another.dll".to_owned()) + ); + installers.push(map); + } + + let manifest = PackageManifest { + name, + version_number: "1.0.0".to_owned(), + description, + website_url: website, + dependencies: BTreeSet::new(), + installers, + games: Some(games) + }; + + std::fs::create_dir(&dir).map_err(|e| e.to_string())?; + let json = serde_json::to_string_pretty(&manifest).map_err(|e| e.to_string())?; + std::fs::write(dir.join("manifest.json"), json).map_err(|e| e.to_string())?; + + Ok(()) +} + #[tauri::command] pub async fn reload_all_packages(state: State<'_, tokio::sync::Mutex>) -> Result<(), String> { log::debug!("invoke: reload_all_packages"); diff --git a/rust/src/lib.rs b/rust/src/lib.rs index da036bf..8d1a4c7 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -193,6 +193,7 @@ pub async fn run(_args: Vec) { cmd::install_package, cmd::delete_package, cmd::toggle_package, + cmd::create_package, cmd::list_profiles, cmd::init_profile, diff --git a/rust/src/model/local.rs b/rust/src/model/local.rs index 2914779..3d781db 100644 --- a/rust/src/model/local.rs +++ b/rust/src/model/local.rs @@ -6,10 +6,11 @@ use super::misc::Game; // manifest.json -#[derive(Deserialize)] +#[derive(Serialize, Deserialize)] pub struct PackageManifest { pub name: String, pub version_number: String, + pub website_url: String, pub description: String, pub dependencies: BTreeSet, diff --git a/rust/static/standard-amdaemon.json5 b/rust/static/standard-amdaemon.json5 index a04d4be..00f6c07 100644 --- a/rust/static/standard-amdaemon.json5 +++ b/rust/static/standard-amdaemon.json5 @@ -63,9 +63,9 @@ }, { // Ongeki - filename: "amdaemon.exe", + filename: "amdaemon.exe", version: "46d47eab", - sha256: '962C76331306D0839AFD40808EA99D83E651D39C4708C448ADE0C77E8BC0A1B0', + sha256: '962C76331306D0839AFD40808EA99D83E651D39C4708C448ADE0C77E8BC0A1B0', patches: [ { id: 'standard-localhost', diff --git a/rust/tauri.conf.json b/rust/tauri.conf.json index 3e3c1a2..182c836 100644 --- a/rust/tauri.conf.json +++ b/rust/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "STARTLINER", - "version": "0.16.0", + "version": "0.17.0", "identifier": "zip.patafour.startliner", "build": { "beforeDevCommand": "bun run dev", diff --git a/src/components/ModList.vue b/src/components/ModList.vue index 88c4942..de97f2e 100644 --- a/src/components/ModList.vue +++ b/src/components/ModList.vue @@ -1,12 +1,16 @@ + + diff --git a/src/components/ModTitlecard.vue b/src/components/ModTitlecard.vue index 6221cdf..0cd7091 100644 --- a/src/components/ModTitlecard.vue +++ b/src/components/ModTitlecard.vue @@ -1,7 +1,8 @@