fix encodings again

This commit is contained in:
Anthony Samms
2025-10-23 12:00:48 -04:00
parent 023f33155a
commit bc0bf8fdee
3 changed files with 42 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ import sys
import time
from pathlib import Path
from libs.tja import NoteList, TJAParser
from libs.tja import NoteList, TJAParser, test_encodings
from libs.utils import get_config, global_data
@@ -25,7 +25,8 @@ class DiffHashesDecoder(json.JSONDecoder):
def read_tjap3_score(input_file: Path):
"""Read a TJAPlayer3 score.ini file and return the scores and clears."""
score_ini = configparser.ConfigParser()
score_ini.read(input_file, encoding='utf-8')
encoding = test_encodings(input_file)
score_ini.read(input_file, encoding=encoding)
scores = [int(score_ini['HiScore.Drums']['HiScore1']),
int(score_ini['HiScore.Drums']['HiScore2']),
int(score_ini['HiScore.Drums']['HiScore3']),

View File

@@ -267,9 +267,10 @@ class Player:
self.player_number = str(player_number)
self.difficulty = difficulty
self.visual_offset = global_data.config["general"]["visual_offset"]
self.modifiers = modifiers
notes, self.branch_m, self.branch_e, self.branch_n = tja.notes_to_position(self.difficulty)
self.play_notes, self.draw_note_list, self.draw_bar_list = apply_modifiers(notes, modifiers)
self.play_notes, self.draw_note_list, self.draw_bar_list = apply_modifiers(notes, self.modifiers)
self.end_time = 0
if self.play_notes:
self.end_time = self.play_notes[-1].hit_ms
@@ -759,7 +760,7 @@ class Player:
def autoplay_manager(self, ms_from_start: float, current_time: float, background: Optional[Background]):
"""Manages autoplay behavior"""
if not global_data.modifiers.auto:
if not self.modifiers.auto:
return
# Handle drumroll and balloon hits
@@ -1551,7 +1552,7 @@ class Combo:
def __init__(self, combo: int, current_ms: float, is_2p: bool):
self.combo = combo
self.is_2p = is_2p
self.stretch_animation = tex.get_animation(5)
self.stretch_animation = tex.get_animation(5, is_copy=True)
self.color = [ray.fade(ray.WHITE, 1), ray.fade(ray.WHITE, 1), ray.fade(ray.WHITE, 1)]
self.glimmer_dict = {0: 0, 1: 0, 2: 0}
self.total_time = 250
@@ -1621,7 +1622,7 @@ class ScoreCounter:
def __init__(self, score: int, is_2p: bool):
self.is_2p = is_2p
self.score = score
self.stretch = tex.get_animation(4)
self.stretch = tex.get_animation(4, is_copy=True)
def update_count(self, score: int):
if self.score != score:

View File

@@ -64,6 +64,40 @@ class TwoPlayerGameScreen(GameScreen):
self.player_1.ending_anim = FailAnimation(self.player_1.is_2p)
self.player_2.ending_anim = FailAnimation(self.player_2.is_2p)
def update(self):
self.on_screen_start()
current_time = get_current_ms()
self.transition.update(current_time)
self.current_ms = current_time - self.start_ms
self.start_song(current_time)
self.update_background(current_time)
if self.song_music is not None:
audio.update_music_stream(self.song_music)
self.player_1.update(self.current_ms, current_time, self.background)
self.player_2.update(self.current_ms, current_time, self.background)
self.song_info.update(current_time)
self.result_transition.update(current_time)
if self.result_transition.is_finished and not audio.is_sound_playing('result_transition'):
return self.on_screen_end('RESULT')
elif self.current_ms >= self.player_1.end_time:
session_data.result_score, session_data.result_good, session_data.result_ok, session_data.result_bad, session_data.result_max_combo, session_data.result_total_drumroll = self.player_1.get_result_score()
session_data.result_gauge_length = self.player_1.gauge.gauge_length
if self.end_ms != 0:
if current_time >= self.end_ms + 1000:
if self.player_1.ending_anim is None:
self.write_score()
self.spawn_ending_anims()
if current_time >= self.end_ms + 8533.34:
if not self.result_transition.is_started:
self.result_transition.start()
audio.play_sound('result_transition', 'voice')
else:
self.end_ms = current_time
return self.global_keys()
def update_background(self, current_time):
if self.movie is not None:
self.movie.update()