Skip to content

Commit 4e59ca8

Browse files
authored
Merge pull request #56 from gurgalex/attempt_fix_pause
Attempt fix pause
2 parents e7cb51a + ac77a1e commit 4e59ca8

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.9.27
2+
# fix
3+
- Attempt yet another fix for sporadic startup crashes
4+
15
#v0.9.26
26
# feat
37
- The SAPI voice is now controlled by the Windows control panel.

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.26
1+
0.9.27

subot/main.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,6 @@ def speak_selected_menu_item(self):
972972
def run(self):
973973
self.hang_activity_sender = self._hang_monitor.register_component(thread_handle=self, hang_timeout_seconds=10)
974974
while not self.stop_event.is_set():
975-
if not self.parent.game_is_foreground:
976-
self.hang_activity_sender.notify_wait()
977-
time.sleep(1/settings.FPS)
978-
self.paused = True
979975
try:
980976
msg = self.incoming_frame_queue.get(timeout=5)
981977
self.hang_activity_sender.notify_activity(HangAnnotation(data={"data": "window analyze"}))
@@ -1000,6 +996,9 @@ def run(self):
1000996
# is it empty because stuff is shut down?
1001997
if self.stop_event.is_set():
1002998
return
999+
if self.paused:
1000+
self.hang_activity_sender.notify_wait()
1001+
continue
10031002

10041003
# something is wrong
10051004
raise Exception("No new full frame for 5 seconds")
@@ -1009,7 +1008,7 @@ def run(self):
10091008
self.frame = np.asarray(shot)
10101009
cv2.cvtColor(self.frame, cv2.COLOR_BGRA2GRAY, dst=self.gray_frame)
10111010

1012-
if self.parent.game_is_foreground:
1011+
if not self.paused:
10131012
self.ocr_screen()
10141013

10151014
quests = extract_quest_name_from_quest_area(self.gray_frame)
@@ -1365,7 +1364,7 @@ def handle_new_frame(self, data: NewFrame):
13651364
self.grid_near_rect = Bot.default_grid_rect(self.parent.nearby_rect_mss)
13661365

13671366
self.was_match = False
1368-
if not self.parent.game_is_foreground:
1367+
if self.paused:
13691368
return
13701369

13711370
realm_alignment = self.detect_what_realm_in()
@@ -1412,9 +1411,13 @@ def run(self):
14121411
try:
14131412
msg: MessageImpl = self.nearby_queue.get(timeout=5)
14141413
except queue.Empty:
1415-
# something has gone wrong with getting timely frames
1416-
root.warning("No nearby frame for 5 seconds")
1417-
return
1414+
if self.paused:
1415+
self.hang_activity_sender.notify_wait()
1416+
pass
1417+
else: # something has gone wrong with getting timely frames
1418+
empty_text = "No nearby frame for 5 seconds"
1419+
root.warning(empty_text)
1420+
raise Exception(empty_text)
14181421

14191422
self.hang_activity_sender.notify_activity(HangAnnotation({"event": "near_frame_processing"}))
14201423
if msg is None:

0 commit comments

Comments
 (0)