Fix __get_app_name logic to take last game name on multiple games launch (#60)
Co-authored-by: Egor Alekseychik <e.alekseychik@syberry.com>
This commit is contained in:
parent
2ca94dd377
commit
2711e80529
1 changed files with 9 additions and 12 deletions
|
@ -65,16 +65,13 @@ class LogAnalyser:
|
||||||
def get_app_info(
|
def get_app_info(
|
||||||
log_file: str,
|
log_file: str,
|
||||||
) -> Optional[tuple[str, str, str, list[str], dict[str, str]]]:
|
) -> Optional[tuple[str, str, str, list[str], dict[str, str]]]:
|
||||||
game_name_match = re.search(
|
game_name_match = re.findall(
|
||||||
r"Loader [A-Za-z]*: Application Loaded:\s([^;\n\r]*)",
|
r"Loader [A-Za-z]*: Application Loaded:\s([^;\n\r]*)",
|
||||||
log_file,
|
log_file,
|
||||||
re.MULTILINE,
|
re.MULTILINE,
|
||||||
)
|
)
|
||||||
if game_name_match is not None and len(game_name_match.groups()) > 0:
|
if game_name_match:
|
||||||
game_name = None
|
game_name = game_name_match[-1].rstrip()
|
||||||
app_id = None
|
|
||||||
if game_name_match.group(1) is not None:
|
|
||||||
game_name = game_name_match.group(1).rstrip()
|
|
||||||
app_id_match = re.match(r".* \[([a-zA-Z0-9]*)\]", game_name)
|
app_id_match = re.match(r".* \[([a-zA-Z0-9]*)\]", game_name)
|
||||||
if app_id_match:
|
if app_id_match:
|
||||||
app_id = app_id_match.group(1).strip().upper()
|
app_id = app_id_match.group(1).strip().upper()
|
||||||
|
@ -384,13 +381,13 @@ class LogAnalyser:
|
||||||
self._game_info["cheats"] = "\n".join(cheats)
|
self._game_info["cheats"] = "\n".join(cheats)
|
||||||
|
|
||||||
def __get_app_name(self):
|
def __get_app_name(self):
|
||||||
app_match = re.search(
|
app_match = re.findall(
|
||||||
r"Loader [A-Za-z]*: Application Loaded:\s([^;\n\r]*)",
|
r"Loader [A-Za-z]*: Application Loaded:\s([^;\n\r]*)",
|
||||||
self._log_text,
|
self._log_text,
|
||||||
re.MULTILINE,
|
re.MULTILINE,
|
||||||
)
|
)
|
||||||
if app_match is not None and app_match.group(1) is not None:
|
if app_match:
|
||||||
self._game_info["game_name"] = app_match.group(1).rstrip()
|
self._game_info["game_name"] = app_match[-1].rstrip()
|
||||||
|
|
||||||
def __get_controller_notes(self):
|
def __get_controller_notes(self):
|
||||||
controllers_regex = re.compile(r"Hid Configure: ([^\r\n]+)")
|
controllers_regex = re.compile(r"Hid Configure: ([^\r\n]+)")
|
||||||
|
|
Loading…
Reference in a new issue