Skip to content

Commit 7ddb6fe

Browse files
committed
Fixed chapter_split (i should test before pushing!)
1 parent bab1392 commit 7ddb6fe

File tree

5 files changed

+19
-40
lines changed

5 files changed

+19
-40
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
## v1.1.0
22

3-
More robust way of finding either Everest or Vanilla Celeste. Whether or not you started linsplit while in the menu, it should now work when opening a save file.
3+
More robust way of finding either Everest or Vanilla Celeste. Whether or not you started linsplit while in the menu, it should now work when opening a save file.
4+
5+
## v1.1.1
6+
7+
Hotfix for Chapter Split not working

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linsplit"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2024"
55
authors = ["Paloys"]
66
description = "An autosplitter for the game Celeste, working on Linux!"

src/linsplit_data.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ pub struct LinSplitData {
1414
splits: SplitData,
1515
socket: Arc<SplitterSocket>,
1616
game_data: RwLock<GameData>,
17-
exiting_chapter: RwLock<bool>,
1817
events: Arc<Mutex<VecDeque<Event>>>,
1918
event_notifications: Arc<Notify>,
19+
exiting_chapter: Mutex<bool>,
2020
current_split: Mutex<i32>,
2121
last_area_id: Mutex<Area>,
2222
last_area_difficulty: Mutex<AreaMode>,
@@ -37,7 +37,7 @@ impl LinSplitData {
3737
splits,
3838
socket,
3939
game_data,
40-
exiting_chapter: RwLock::new(false),
40+
exiting_chapter: Mutex::new(false),
4141
events,
4242
event_notifications,
4343
current_split: Mutex::new(-1),
@@ -59,21 +59,21 @@ impl LinSplitData {
5959
}
6060
Event::Splitted | Event::Finished => {
6161
*self.current_split.lock().await += 1;
62-
*self.exiting_chapter.write().await = false;
62+
*self.exiting_chapter.lock().await = false;
6363
}
6464
Event::Reset => {
6565
*self.current_split.lock().await = -1;
66-
*self.exiting_chapter.write().await = false;
66+
*self.exiting_chapter.lock().await = false;
6767
*self.last_area_id.lock().await = Area::Unknown;
6868
*self.last_area_difficulty.lock().await = AreaMode::Unknown;
6969
}
7070
Event::SplitUndone => {
7171
*self.current_split.lock().await -= 1;
72-
*self.exiting_chapter.write().await = false;
72+
*self.exiting_chapter.lock().await = false;
7373
}
7474
Event::SplitSkipped => {
7575
*self.current_split.lock().await += 1;
76-
*self.exiting_chapter.write().await = false;
76+
*self.exiting_chapter.lock().await = false;
7777
}
7878
_ => {}
7979
}
@@ -89,20 +89,20 @@ impl LinSplitData {
8989
completed: bool,
9090
last_completed: bool,
9191
) -> bool {
92-
if !*self.exiting_chapter.read().await {
92+
let mut exiting_chapter = self.exiting_chapter.lock().await;
93+
if !*exiting_chapter {
9394
let level_name = if chapter_area == Area::TheSummit {
9495
Some(level)
9596
} else {
9697
None
9798
};
98-
let mut chap = self.exiting_chapter.write().await;
99-
*chap = area_id == chapter_area
99+
*exiting_chapter = area_id == chapter_area
100100
&& completed
101101
&& !last_completed
102102
&& (chapter_area != Area::TheSummit
103103
|| (level_name
104104
.is_some_and(|name| !name.to_lowercase().starts_with("credits"))));
105-
return *self.exiting_chapter.read().await && self.splits.il_splits;
105+
return *exiting_chapter && self.splits.il_splits;
106106
}
107107
!completed && last_completed
108108
}
@@ -254,7 +254,7 @@ impl LinSplitData {
254254
//println!("{:?}", opt_split);
255255
if let Some(split) = opt_split {
256256
match split {
257-
Split::Manual => {} // TODO: increment split id when a split is detected
257+
Split::Manual => {}
258258
Split::LevelEnter { level } => should_split = area_id != Area::Menu && level_name != last_level_name && level.to_lowercase() == level_name.to_lowercase(),
259259
Split::LevelExit { level } => should_split = area_id != Area::Menu && level_name != last_level_name && level.to_lowercase() == last_level_name.to_lowercase(),
260260
Split::ChapterA => {
@@ -394,7 +394,7 @@ impl LinSplitData {
394394
let should_reset = self.splits.auto_reset
395395
&& self.splits.il_splits
396396
&& self.game_data.read().await.area_id == Area::Menu;
397-
let mut chap = self.exiting_chapter.write().await;
397+
let mut chap = self.exiting_chapter.lock().await;
398398
if should_reset {
399399
self.socket
400400
.send_command(Command::Reset {

src/memory_reader/game_data.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::fmt::{self, Display};
21
use std::time::Duration;
32

43
use tokio::select;
@@ -99,27 +98,3 @@ impl GameData {
9998
}
10099
}
101100

102-
impl Display for GameData {
103-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104-
write!(
105-
f,
106-
"{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
107-
format!("chapter_complete: {}", self.chapter_complete),
108-
format!("level_name: {}", self.level_name),
109-
// format!("area_id: {}", self.area_id), TODO fix this
110-
// format!("area_difficulty: {}", self.area_difficulty), TODO maybe fix this
111-
format!("chapter_started: {}", self.chapter_started),
112-
format!("game_time: {:.3}", self.game_time),
113-
format!("level_time: {:.3}", self.level_time),
114-
format!("strawberries: {}", self.strawberries),
115-
format!("cassettes: {}", self.cassettes),
116-
format!(
117-
"chapter_cassette_collected: {}",
118-
self.chapter_cassette_collected
119-
),
120-
format!("heart_gems: {}", self.heart_gems),
121-
format!("chapter_heart_collected: {}", self.chapter_heart_collected),
122-
//format!("starting_new_file: {}", self.starting_new_file),
123-
)
124-
}
125-
}

0 commit comments

Comments
 (0)