mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-11 04:52:09 +10:00
* feat: add new template options, asahi support, and refactoring * feat: install dir scanning, validation fixes, progress fixes, download manager refactor This kind of ballooned out of scope, but I implemented some much needed fixes for the download manager. First off, I cleanup the Downloadable trait, there was some duplication of function. Second, I refactored the "validate" into the GameDownloadAgent, which calls a 'validate_chunk_logic' yada, same structure as downloading. Third, I fixed the progress and validation issues. Fourth, I added game scanning * feat: out of box support for Asahi Linux * fix: clippy * fix: don't break database
51 lines
1.3 KiB
Rust
51 lines
1.3 KiB
Rust
use std::sync::Mutex;
|
|
|
|
use crate::{error::process_error::ProcessError, AppState};
|
|
|
|
#[tauri::command]
|
|
pub fn launch_game(
|
|
id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
|
|
//let meta = DownloadableMetadata {
|
|
// id,
|
|
// version: Some(version),
|
|
// download_type: DownloadType::Game,
|
|
//};
|
|
|
|
match process_manager_lock.launch_process(id, &state_lock) {
|
|
Ok(()) => {}
|
|
Err(e) => return Err(e),
|
|
}
|
|
|
|
drop(process_manager_lock);
|
|
drop(state_lock);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn kill_game(
|
|
game_id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
process_manager_lock
|
|
.kill_game(game_id)
|
|
.map_err(ProcessError::IOError)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn open_process_logs(
|
|
game_id: String,
|
|
state: tauri::State<'_, Mutex<AppState>>,
|
|
) -> Result<(), ProcessError> {
|
|
let state_lock = state.lock().unwrap();
|
|
let mut process_manager_lock = state_lock.process_manager.lock().unwrap();
|
|
process_manager_lock.open_process_logs(game_id)
|
|
}
|