mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
Fix various crashes
This commit is contained in:
@@ -1235,7 +1235,7 @@ class FileNavigator:
|
|||||||
for item in self.directory_contents[sibling_key]:
|
for item in self.directory_contents[sibling_key]:
|
||||||
if not isinstance(item, Directory):
|
if not isinstance(item, Directory):
|
||||||
temp_items.append(item)
|
temp_items.append(item)
|
||||||
content_items = random.sample(temp_items, 10)
|
content_items = random.sample(temp_items, min(10, len(temp_items)))
|
||||||
|
|
||||||
if content_items == []:
|
if content_items == []:
|
||||||
self.go_back()
|
self.go_back()
|
||||||
|
|||||||
@@ -114,13 +114,13 @@ def build_song_hashes(output_dir=Path("cache")):
|
|||||||
global_data.total_songs = total_songs
|
global_data.total_songs = total_songs
|
||||||
|
|
||||||
for tja_path in files_to_process:
|
for tja_path in files_to_process:
|
||||||
|
try:
|
||||||
tja_path_str = str(tja_path)
|
tja_path_str = str(tja_path)
|
||||||
current_modified = tja_path.stat().st_mtime
|
current_modified = tja_path.stat().st_mtime
|
||||||
tja = TJAParser(tja_path)
|
tja = TJAParser(tja_path)
|
||||||
all_notes = NoteList()
|
all_notes = NoteList()
|
||||||
diff_hashes = dict()
|
diff_hashes = dict()
|
||||||
|
|
||||||
try:
|
|
||||||
for diff in tja.metadata.course_data:
|
for diff in tja.metadata.course_data:
|
||||||
diff_notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
diff_notes, branch_m, branch_e, branch_n = TJAParser.notes_to_position(TJAParser(tja.file_path), diff)
|
||||||
diff_hashes[diff] = tja.hash_note_data(diff_notes)
|
diff_hashes[diff] = tja.hash_note_data(diff_notes)
|
||||||
|
|||||||
@@ -31,12 +31,6 @@ def force_dedicated_gpu():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
try:
|
|
||||||
# AMD PowerXpress
|
|
||||||
ctypes.windll.kernel32.SetEnvironmentVariableW("AMD_VULKAN_ICD", "DISABLE")
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(e)
|
|
||||||
|
|
||||||
def rounded(num: float) -> int:
|
def rounded(num: float) -> int:
|
||||||
"""Round a number to the nearest integer"""
|
"""Round a number to the nearest integer"""
|
||||||
sign = 1 if (num >= 0) else -1
|
sign = 1 if (num >= 0) else -1
|
||||||
|
|||||||
@@ -140,6 +140,8 @@ class SongSelectScreen(Screen):
|
|||||||
elif action == "select_song":
|
elif action == "select_song":
|
||||||
current_song = self.navigator.get_current_item()
|
current_song = self.navigator.get_current_item()
|
||||||
if isinstance(current_song, Directory) and current_song.box.texture_index == 13:
|
if isinstance(current_song, Directory) and current_song.box.texture_index == 13:
|
||||||
|
if len(self.navigator.directory_contents[str(current_song.path)]) == 0:
|
||||||
|
return
|
||||||
self.dan_transition.start()
|
self.dan_transition.start()
|
||||||
audio.stop_sound('bgm')
|
audio.stop_sound('bgm')
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user