Skip to content

Commit

Permalink
Try ManualSplit (#34)
Browse files Browse the repository at this point in the history
* Try ManualSplit

* Tweak ManualSplit action condition

because it can detect manual start and end splits, only middle splits need this special action

* README.md: Instructions for ManualSplit
  • Loading branch information
AlexKnauth authored Jan 24, 2024
1 parent a022aef commit 51021e1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ check the `Use Layout` checkbox, click `Browse` next to that,
and navigate to the Layout file from before.
Select it and click `Ok`.

Finally, do not manually split, skip, or undo splits while running with this autosplitter.
Finally, do not manually split or skip while running with this autosplitter,
unless either it's explicitly marked as `ManualSplit` or it's the end-split.
Don't manually split, skip, or undo splits in any other situation.
The autosplitter will not know that you did that, and the autosplitter's state will be out of sync with LiveSplit's state.

## Instructions for livesplit-one-druid
Expand Down Expand Up @@ -131,7 +133,9 @@ cargo build --release
sudo ./target/release/livesplit-one
```

Finally, do not manually split, skip, or undo splits while running with this autosplitter.
Finally, do not manually split or skip while running with this autosplitter,
unless either it's explicitly marked as `ManualSplit` or it's the end-split.
Don't manually split, skip, or undo splits in any other situation.
The autosplitter will not know that you did that,
and the autosplitter's state will be out of sync with `livesplit-one-druid`'s state.

Expand Down Expand Up @@ -171,7 +175,9 @@ cargo build --release
sudo ./target/release/livesplit-one
```

Finally, do not manually split, skip, or undo splits while running with this autosplitter.
Finally, do not manually split or skip while running with this autosplitter,
unless either it's explicitly marked as `ManualSplit` or it's the end-split.
Don't manually split, skip, or undo splits in any other situation.
The autosplitter will not know that you did that,
and the autosplitter's state will be out of sync with `livesplit-one-desktop`'s state.

Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ async fn tick_action(
splitter_action(SplitterAction::Reset, i, n);
break;
}
SplitterAction::ManualSplit => {
splitter_action(SplitterAction::ManualSplit, i, n);
next_tick().await;
break;
}
SplitterAction::Pass => {
if auto_reset {
match splits::splits(&splits[0], &process, &game_manager_finder, trans_now, scene_store, player_data_store) {
Expand Down Expand Up @@ -201,6 +206,11 @@ fn splitter_action(a: SplitterAction, i: &mut usize, n: usize) {
asr::timer::split();
*i += 1;
}
SplitterAction::ManualSplit => {
if 0 < *i && *i + 1 < n {
*i += 1;
}
}
}
if n <= *i {
*i = 0;
Expand Down
8 changes: 7 additions & 1 deletion src/splits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub enum SplitterAction {
Split,
Skip,
Reset,
ManualSplit,
}

impl SplitterAction {
Expand Down Expand Up @@ -53,6 +54,11 @@ fn should_split_skip(mb: Option<bool>) -> SplitterAction {
#[derive(Clone, Debug, Default, Deserialize, Eq, Gui, Ord, PartialEq, PartialOrd, RadioButtonOptions, Serialize)]
pub enum Split {
// region: Start, End, and Menu
/// Manual Split (Misc)
///
/// Never splits. Use this when you need to manually split while using ordered splits
#[default]
ManualSplit,
/// Start New Game (Start)
///
/// Splits when starting a new save file, including Normal, Steel Soul, and Godseeker mode
Expand All @@ -72,7 +78,6 @@ pub enum Split {
/// Credits Roll (Event)
///
/// Splits on any credits rolling
#[default]
EndingSplit,
/// The Hollow Knight (Ending)
///
Expand Down Expand Up @@ -3329,6 +3334,7 @@ pub fn transition_once_splits(s: &Split, p: &Pair<&str>, prc: &Process, g: &Game

pub fn continuous_splits(s: &Split, p: &Process, g: &GameManagerFinder, pds: &mut PlayerDataStore) -> SplitterAction {
match s {
Split::ManualSplit => SplitterAction::ManualSplit,
Split::RandoWake => should_split(g.disable_pause(p).is_some_and(|d| !d)
&& g.get_game_state(p).is_some_and(|s| s == GAME_STATE_PLAYING)
&& g.get_scene_name(p).is_some_and(|s| !is_menu(&s))),
Expand Down

0 comments on commit 51021e1

Please sign in to comment.