Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub fn compile_process(
// Start compilation timer
let start = Instant::now();

// Start genact (if it's installed, directly checked by the start_genact() function)
let mut genact_process = start_genact();
// Start genact (if it's installed, directly checked by the start_genact function)
let mut genact_process = start_genact(game_state);

// Fallback compilation animation if genact is not installed
let spinner = ["-", "\\", "|", "/"];
Expand Down Expand Up @@ -138,12 +138,17 @@ pub fn compile_process(
}

// Helper to start genact for compilation animation (if it's installed)
fn start_genact() -> Option<Child> {
fn start_genact(game_state: &GameState) -> Option<Child> {
// Check if genact is installed
let genact_path = which("genact").ok()?;

// Calculate speed factor according to the number of CPU cores
let speed_factor = game_state.cpu.div_ceil(10);

// Run genact
Command::new(genact_path)
.arg("--speed-factor")
.arg(speed_factor.to_string())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
Expand Down