lighty_event/module/
launch.rs

1// Copyright (c) 2025 Hamadi
2// Licensed under the MIT License
3
4//! Launch and installation events
5
6use serde::{Deserialize, Serialize};
7
8/// Launch and installation events
9#[derive(Debug, Clone, Serialize, Deserialize)]
10#[serde(tag = "event")]
11pub enum LaunchEvent {
12    /// All files already up-to-date (skip installation)
13    IsInstalled {
14        version: String,
15    },
16    /// Installation started
17    InstallStarted {
18        version: String,
19        total_bytes: u64,
20    },
21    /// Installation progress (global)
22    InstallProgress {
23        bytes: u64,
24    },
25    /// Installation completed
26    InstallCompleted {
27        version: String,
28        total_bytes: u64,
29    },
30    /// Game launch starting (before spawn)
31    Launching {
32        version: String,
33    },
34    /// Game process spawned successfully
35    Launched {
36        version: String,
37        pid: u32,
38    },
39    /// Game launch failed
40    NotLaunched {
41        version: String,
42        error: String,
43    },
44    /// Game process output
45    ProcessOutput {
46        pid: u32,
47        stream: String, // "stdout" | "stderr"
48        line: String,
49    },
50    /// Game process exited
51    ProcessExited {
52        pid: u32,
53        exit_code: i32,
54    },
55}