Android: paste PGN, open files from other apps, a calmer screen while the engine thinks
- Paste: «Add a database» offers the clipboard's games when it holds text; they are kept in the app as a copy (one game opens on the board). Text with no game is said so. - Open with / Share: PGN, ZIP, 7z, .cbv from other apps are copied in, listed and opened; one copy at a time, the last one shown; not again from Recents; a lone .cbh says to add its folder. A copy is marked «copy» and removing it deletes it. - Engine: the button turns it off again; its words reach the screen up to 5 times a second and redraw only the strip and the arrows; Stockfish runs at nice 10 (uci EngineConfig::nice) with 2 threads by default. - PGN scan: tags right after a result on the same line start the next game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cb61f546ba
commit
7d77a1aaef
26 changed files with 618 additions and 66 deletions
|
|
@ -78,6 +78,9 @@ pub struct EngineConfig {
|
|||
/// (engines often look for weights/books next to themselves).
|
||||
pub working_dir: Option<PathBuf>,
|
||||
pub timeouts: Timeouts,
|
||||
/// Added to the engine's nice value on Unix (0 = as the app): a phone keeps its
|
||||
/// interface smooth while the engine thinks. Every thread of the engine has it.
|
||||
pub nice: i32,
|
||||
}
|
||||
|
||||
impl EngineConfig {
|
||||
|
|
@ -87,6 +90,7 @@ impl EngineConfig {
|
|||
args: Vec::new(),
|
||||
working_dir: None,
|
||||
timeouts: Timeouts::default(),
|
||||
nice: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -391,6 +395,19 @@ fn spawn_impl(cfg: EngineConfig, waker: Waker) -> Result<EngineHandle, EngineErr
|
|||
if let Some(dir) = workdir {
|
||||
command.current_dir(dir);
|
||||
}
|
||||
#[cfg(unix)]
|
||||
if cfg.nice != 0 {
|
||||
use std::os::unix::process::CommandExt;
|
||||
let nice = cfg.nice;
|
||||
// SAFETY: nice(2) is async-signal-safe and touches no memory of the parent. Its
|
||||
// result is not checked: an engine at the app's priority still works.
|
||||
unsafe {
|
||||
command.pre_exec(move || {
|
||||
libc::nice(nice);
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
// Console engines would otherwise open a terminal window per process.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue