a2qlinux 0.5.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/CHANGELOG.md +15 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/PKG-INFO +3 -3
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/README.md +2 -2
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/__init__.py +12 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/_version.py +2 -2
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/bin/questlog_ctl.exe +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/bin/wpcap.dll +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/desktop.py +2 -3
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/diagnose.py +1 -1
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/launcher.py +150 -4
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/setup_desktop.py +107 -24
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/steam.py +2 -1
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/tray.py +4 -7
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/ARCHITECTURE.md +140 -6
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/INSTALL.md +11 -8
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/RELEASE.md +6 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/TROUBLESHOOTING.md +4 -2
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/UPDATING.md +2 -2
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/USING.md +22 -6
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_launcher.py +91 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_setup_desktop.py +89 -5
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/.gitignore +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/LICENSE +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/config.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/kde_overlays.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/pcap_bridge.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/a2qlinux/update.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/bridge/build.sh +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/bridge/questlog_ctl.c +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/bridge/tests/bridge_client_test.c +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/bridge/tests/zorder_guard_test.c +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/bridge/wpcap_bridge.c +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/docs/README.md +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/pyproject.toml +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/__init__.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_config.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_desktop.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_diagnose.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_kde_overlays.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_pcap_bridge.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_replay_stream.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_steam.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_update.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tests/test_version.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tools/__init__.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tools/pcap2questlog.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tools/replay_stream.py +0 -0
- {a2qlinux-0.5.0 → a2qlinux-0.6.0}/tools/tcp_owner_probe.c +0 -0
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
What changed for players, release by release. Technical details are in
|
|
4
4
|
`docs/ARCHITECTURE.md`.
|
|
5
5
|
|
|
6
|
+
## [0.6.0] — 2026-11-12
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- The menu entry, the desktop shortcut and the tray icon are called
|
|
10
|
+
**A2Qlinux** instead of "Questlog (AION 2)", and their icon is Questlog's
|
|
11
|
+
Q in red, so they are told apart from Questlog's own icon. Searching the
|
|
12
|
+
menu for "Questlog" still finds the entry. Existing entries are renamed
|
|
13
|
+
on the next start, keeping any options added to them by hand.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- A Questlog that gets stuck while starting (its window stays empty and it
|
|
17
|
+
counts no fights, because of a rare fault in Wine) is noticed, usually
|
|
18
|
+
within a few seconds, ended and started again, without touching the game.
|
|
19
|
+
Only if the second start gets stuck too does A2Qlinux stop and say so.
|
|
20
|
+
|
|
6
21
|
## [0.5.0] — 2026-11-10
|
|
7
22
|
|
|
8
23
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: a2qlinux
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Questlog Desktop (AION 2 damage meter) on Linux under Proton, with live game traffic.
|
|
5
5
|
Project-URL: homepage, https://github.com/raman78/A2Qlinux
|
|
6
6
|
Project-URL: repository, https://github.com/raman78/A2Qlinux
|
|
@@ -89,7 +89,7 @@ for Arch, Debian, Ubuntu, Fedora and openSUSE. In short:
|
|
|
89
89
|
`a2qlinux-setup --desktop-shortcut`. It installs Questlog, checks
|
|
90
90
|
everything else and prints the command for anything still missing — see
|
|
91
91
|
[Installing A2Qlinux and Questlog](https://github.com/raman78/A2Qlinux/blob/main/docs/INSTALL.md#installing-a2qlinux-and-questlog).
|
|
92
|
-
4. Start **
|
|
92
|
+
4. Start **A2Qlinux** from the menu, or set the Steam launch option
|
|
93
93
|
that `a2qlinux-setup` prints (it says when the option is already set).
|
|
94
94
|
|
|
95
95
|
## Documentation
|
|
@@ -132,7 +132,7 @@ the repository. Releasing:
|
|
|
132
132
|
A2Qlinux is an independent project, not made or endorsed by Questlog's
|
|
133
133
|
authors or by AION 2's publisher. It contains no Questlog code or assets:
|
|
134
134
|
Questlog is downloaded from its authors, and its icon is taken from your own
|
|
135
|
-
installation. Questlog and its name belong to its authors (questlog.gg).
|
|
135
|
+
installation (and its Q coloured red, for A2Qlinux's menu entry and tray icon). Questlog and its name belong to its authors (questlog.gg).
|
|
136
136
|
|
|
137
137
|
Whether third-party meters are allowed is for the game's publisher, NCSOFT,
|
|
138
138
|
to decide. It has not said so either way, and its rules forbid
|
|
@@ -47,7 +47,7 @@ for Arch, Debian, Ubuntu, Fedora and openSUSE. In short:
|
|
|
47
47
|
`a2qlinux-setup --desktop-shortcut`. It installs Questlog, checks
|
|
48
48
|
everything else and prints the command for anything still missing — see
|
|
49
49
|
[Installing A2Qlinux and Questlog](https://github.com/raman78/A2Qlinux/blob/main/docs/INSTALL.md#installing-a2qlinux-and-questlog).
|
|
50
|
-
4. Start **
|
|
50
|
+
4. Start **A2Qlinux** from the menu, or set the Steam launch option
|
|
51
51
|
that `a2qlinux-setup` prints (it says when the option is already set).
|
|
52
52
|
|
|
53
53
|
## Documentation
|
|
@@ -90,7 +90,7 @@ the repository. Releasing:
|
|
|
90
90
|
A2Qlinux is an independent project, not made or endorsed by Questlog's
|
|
91
91
|
authors or by AION 2's publisher. It contains no Questlog code or assets:
|
|
92
92
|
Questlog is downloaded from its authors, and its icon is taken from your own
|
|
93
|
-
installation. Questlog and its name belong to its authors (questlog.gg).
|
|
93
|
+
installation (and its Q coloured red, for A2Qlinux's menu entry and tray icon). Questlog and its name belong to its authors (questlog.gg).
|
|
94
94
|
|
|
95
95
|
Whether third-party meters are allowed is for the game's publisher, NCSOFT,
|
|
96
96
|
to decide. It has not said so either way, and its rules forbid
|
|
@@ -28,3 +28,15 @@ def shown_version(root=None):
|
|
|
28
28
|
reason = (done.stderr.strip().splitlines() or [f"exit code {done.returncode}"])[0]
|
|
29
29
|
return f"{__version__} (source checkout; git describe failed: {reason})"
|
|
30
30
|
return f"{done.stdout.strip().removeprefix('v')} (source checkout)"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _icon_path():
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
return Path.home() / ".local" / "share" / "icons" / "a2qlinux.png"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# What the menu entry, the tray icon and the notifications are called and show.
|
|
39
|
+
# The icon is Questlog's own, recoloured on the player's computer by
|
|
40
|
+
# a2qlinux-setup (setup_desktop.a2qlinux_icon); A2Qlinux does not ship it.
|
|
41
|
+
APP_NAME = "A2Qlinux"
|
|
42
|
+
ICON = _icon_path()
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0,
|
|
21
|
+
__version__ = version = '0.6.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 6, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
Binary file
|
|
Binary file
|
|
@@ -23,6 +23,7 @@ import subprocess
|
|
|
23
23
|
import sys
|
|
24
24
|
import time
|
|
25
25
|
|
|
26
|
+
from . import APP_NAME, ICON
|
|
26
27
|
from .config import questlog_dir
|
|
27
28
|
|
|
28
29
|
LOCK = questlog_dir() / "proton-stream" / ".lock"
|
|
@@ -102,9 +103,7 @@ def ask_running_launcher(game_starting):
|
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
def notify(text):
|
|
105
|
-
subprocess.run(["notify-send", "--app-name=
|
|
106
|
-
"--icon=" + str(Path.home() / ".local/share/icons/questlog-aion2.png"),
|
|
107
|
-
"Questlog (AION 2)", text], check=False)
|
|
106
|
+
subprocess.run(["notify-send", f"--app-name={APP_NAME}", f"--icon={ICON}", APP_NAME, text], check=False)
|
|
108
107
|
|
|
109
108
|
|
|
110
109
|
def main():
|
|
@@ -201,7 +201,7 @@ def check_running(results, appid):
|
|
|
201
201
|
if not fed:
|
|
202
202
|
results.append((PROBLEM, "Now: Questlog runs, but was not started by A2Qlinux: it gets no game "
|
|
203
203
|
"traffic, and the game waits until it is closed. Quit it from its own tray "
|
|
204
|
-
"icon and start '
|
|
204
|
+
"icon and start 'A2Qlinux' from the menu"))
|
|
205
205
|
elif not running:
|
|
206
206
|
results.append((PROBLEM, "Now: Questlog runs with the bridge, but A2Qlinux has ended (status "
|
|
207
207
|
"window closed?): it gets no game traffic. Quit it and start it again"))
|
|
@@ -39,7 +39,7 @@ import sys
|
|
|
39
39
|
import threading
|
|
40
40
|
import time
|
|
41
41
|
|
|
42
|
-
from . import config, shown_version
|
|
42
|
+
from . import APP_NAME, ICON, config, shown_version
|
|
43
43
|
from . import update as questlog_update
|
|
44
44
|
from .pcap_bridge import BridgeServer, read_records
|
|
45
45
|
|
|
@@ -803,9 +803,7 @@ UPDATE_TRIAL = 60 # s: a just-updated Questlog that exits sooner i
|
|
|
803
803
|
|
|
804
804
|
def notify(text):
|
|
805
805
|
"""Desktop notification, for what the user should know even with the terminal hidden."""
|
|
806
|
-
subprocess.run(["notify-send", "--app-name=
|
|
807
|
-
"--icon=" + str(Path.home() / ".local/share/icons/questlog-aion2.png"),
|
|
808
|
-
"Questlog (AION 2)", text], check=False)
|
|
806
|
+
subprocess.run(["notify-send", f"--app-name={APP_NAME}", f"--icon={ICON}", APP_NAME, text], check=False)
|
|
809
807
|
|
|
810
808
|
|
|
811
809
|
def check_for_updates(questlog_dir, state_dir):
|
|
@@ -1095,6 +1093,125 @@ class QuestlogLaunch:
|
|
|
1095
1093
|
return self.returncode
|
|
1096
1094
|
|
|
1097
1095
|
|
|
1096
|
+
START_WAIT = 30 # s for a started Questlog to start its first own process (1 s when measured)
|
|
1097
|
+
STUCK_WAIT = 3 # s a stuck copy of Questlog's main process must last to count as a hang
|
|
1098
|
+
START_ATTEMPTS = 2 # starts in a row that may hang before the launcher gives up
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
def questlog_process_states():
|
|
1102
|
+
"""Questlog's processes in the game prefix, as (pid, helper, threads) each.
|
|
1103
|
+
|
|
1104
|
+
helper: Chromium's own processes (GPU, renderers, utilities) carry
|
|
1105
|
+
`--type=` on their command line. Questlog's main process does not, nor
|
|
1106
|
+
does a copy of it that Wine has forked to start a new process but that
|
|
1107
|
+
has not yet become that program - which has a single thread.
|
|
1108
|
+
"""
|
|
1109
|
+
states = []
|
|
1110
|
+
for pid in game_processes(APPID, ["questlog.exe"])["questlog.exe"]:
|
|
1111
|
+
helper = "\0--type=" in _read(f"/proc/{pid}/cmdline", 4096)
|
|
1112
|
+
threads = next((int(line.split(":", 1)[1]) for line in _read(f"/proc/{pid}/status").splitlines()
|
|
1113
|
+
if line.startswith("Threads:")), 0)
|
|
1114
|
+
states.append((pid, helper, threads))
|
|
1115
|
+
return states
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
def stuck_copies(states):
|
|
1119
|
+
"""PIDs that look like a forked copy of Questlog's main process: no `--type=`, one thread.
|
|
1120
|
+
|
|
1121
|
+
Only beside a main process with threads of its own, so that a main
|
|
1122
|
+
process that has not started its threads yet is never taken for one.
|
|
1123
|
+
"""
|
|
1124
|
+
if not any(not helper and threads > 1 for _, helper, threads in states):
|
|
1125
|
+
return set()
|
|
1126
|
+
return {pid for pid, helper, threads in states if not helper and threads == 1}
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
class StartWatch:
|
|
1130
|
+
"""Whether a started Questlog came up, or hung at its start (§6.9).
|
|
1131
|
+
|
|
1132
|
+
A healthy Questlog starts its GPU process about a second after its main
|
|
1133
|
+
process appears, and its other processes right after. Once Wine's start
|
|
1134
|
+
of that first process hung - the forked copy stuck in libc's environment
|
|
1135
|
+
lock before it could become the new program - and Questlog waited for it
|
|
1136
|
+
for ever, with no window and no capture. check() answers once per start:
|
|
1137
|
+
"up" when any of Questlog's own processes is there; "retry" when the same
|
|
1138
|
+
stuck copy has lasted `stuck_wait` seconds (a copy lives for a fraction
|
|
1139
|
+
of a second normally), or when none of Questlog's own processes came
|
|
1140
|
+
within `wait` seconds of its main process (some other hang, or a very
|
|
1141
|
+
slow start: hence the long wait); "give-up" instead of "retry" once that
|
|
1142
|
+
has happened `attempts` times in a row.
|
|
1143
|
+
"""
|
|
1144
|
+
|
|
1145
|
+
def __init__(self, wait=START_WAIT, stuck_wait=STUCK_WAIT, attempts=START_ATTEMPTS):
|
|
1146
|
+
self.wait = wait
|
|
1147
|
+
self.stuck_wait = stuck_wait
|
|
1148
|
+
self.attempts = attempts
|
|
1149
|
+
self.hung = 0 # hung starts in a row
|
|
1150
|
+
self.watching = False
|
|
1151
|
+
self.main_since = None
|
|
1152
|
+
self.stuck_since = {} # PID of a stuck-looking copy -> when it was first seen
|
|
1153
|
+
self.hidden = False # how the watched start was made, for its retry
|
|
1154
|
+
|
|
1155
|
+
def started(self, hidden=False):
|
|
1156
|
+
self.watching = True
|
|
1157
|
+
self.main_since = None
|
|
1158
|
+
self.stuck_since = {}
|
|
1159
|
+
self.hidden = hidden
|
|
1160
|
+
|
|
1161
|
+
def check(self, processes, now):
|
|
1162
|
+
if not self.watching:
|
|
1163
|
+
return None
|
|
1164
|
+
if any(helper for _, helper, _ in processes):
|
|
1165
|
+
self.watching = False
|
|
1166
|
+
self.hung = 0
|
|
1167
|
+
return "up"
|
|
1168
|
+
if not processes: # not there yet (the Wine session coming up), or gone
|
|
1169
|
+
self.main_since = None
|
|
1170
|
+
self.stuck_since = {}
|
|
1171
|
+
return None
|
|
1172
|
+
if self.main_since is None:
|
|
1173
|
+
self.main_since = now
|
|
1174
|
+
stuck = stuck_copies(processes)
|
|
1175
|
+
self.stuck_since = {pid: self.stuck_since.get(pid, now) for pid in stuck}
|
|
1176
|
+
if now - self.main_since < self.wait \
|
|
1177
|
+
and not any(now - since >= self.stuck_wait for since in self.stuck_since.values()):
|
|
1178
|
+
return None
|
|
1179
|
+
self.watching = False
|
|
1180
|
+
self.hung += 1
|
|
1181
|
+
return "retry" if self.hung < self.attempts else "give-up"
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
HUNG_END_WAIT = 5 # s for a hung Questlog's processes to go after SIGTERM, before SIGKILL
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
def end_hung_questlog():
|
|
1188
|
+
"""End a Questlog that hung at its start: SIGTERM to all its processes, SIGKILL after HUNG_END_WAIT.
|
|
1189
|
+
|
|
1190
|
+
It has not got to any game data yet, so nothing is waiting to be saved,
|
|
1191
|
+
and the session end of §6.4 is no use here: sent to a Questlog still
|
|
1192
|
+
starting, it was ignored for the whole QUESTLOG_QUIT_WAIT (measured).
|
|
1193
|
+
Questlog only (I2): the game's session is held by Questlog's launch (§5.1).
|
|
1194
|
+
"""
|
|
1195
|
+
def signal_all(signum):
|
|
1196
|
+
pids = game_processes(APPID, ["questlog.exe"])["questlog.exe"]
|
|
1197
|
+
for pid in pids:
|
|
1198
|
+
try:
|
|
1199
|
+
os.kill(pid, signum)
|
|
1200
|
+
except ProcessLookupError:
|
|
1201
|
+
pass
|
|
1202
|
+
return pids
|
|
1203
|
+
|
|
1204
|
+
ended = signal_all(signal.SIGTERM)
|
|
1205
|
+
deadline = time.monotonic() + HUNG_END_WAIT
|
|
1206
|
+
while time.monotonic() < deadline:
|
|
1207
|
+
if not game_processes(APPID, ["questlog.exe"])["questlog.exe"]:
|
|
1208
|
+
log(f"Questlog's {len(ended)} process(es) ended.")
|
|
1209
|
+
return
|
|
1210
|
+
time.sleep(0.2)
|
|
1211
|
+
left = signal_all(signal.SIGKILL)
|
|
1212
|
+
log(f"{len(left)} of Questlog's processes were still there {HUNG_END_WAIT} s after SIGTERM; killed them.")
|
|
1213
|
+
|
|
1214
|
+
|
|
1098
1215
|
def launch_questlog(executable, server, protontricks, log_path, hidden=False, hold_session=True):
|
|
1099
1216
|
"""Start Questlog in the game prefix; a QuestlogLaunch (hold_session) or the bare launch.
|
|
1100
1217
|
|
|
@@ -1213,6 +1330,7 @@ def main():
|
|
|
1213
1330
|
quit_control = QuitControl()
|
|
1214
1331
|
|
|
1215
1332
|
trial = {"until": 0.0} # end of a just-installed update's trial run
|
|
1333
|
+
start_watch = StartWatch()
|
|
1216
1334
|
|
|
1217
1335
|
def start_questlog(hidden=False):
|
|
1218
1336
|
# A fresh Questlog shows its window (unless hidden); earlier "open" requests are answered by that.
|
|
@@ -1222,6 +1340,7 @@ def main():
|
|
|
1222
1340
|
trial["until"] = time.monotonic() + UPDATE_TRIAL
|
|
1223
1341
|
log(f"Starting Questlog {questlog_update.installed_version(executable.parent) or '(version unknown)'}.")
|
|
1224
1342
|
started = launch_questlog(executable, server, protontricks, log_path, hidden=hidden)
|
|
1343
|
+
start_watch.started(hidden)
|
|
1225
1344
|
tray.start()
|
|
1226
1345
|
hide_questlog_tray_icon(protontricks, log_path)
|
|
1227
1346
|
return started
|
|
@@ -1251,6 +1370,33 @@ def main():
|
|
|
1251
1370
|
questlog = start_questlog()
|
|
1252
1371
|
continue
|
|
1253
1372
|
break
|
|
1373
|
+
if not quit_control.quitting and start_watch.watching:
|
|
1374
|
+
states = questlog_process_states()
|
|
1375
|
+
verdict = start_watch.check(states, time.monotonic())
|
|
1376
|
+
if verdict in ("retry", "give-up"):
|
|
1377
|
+
stuck = sorted(stuck_copies(states))
|
|
1378
|
+
how = (f"Wine's start of its first own process hung (stuck process "
|
|
1379
|
+
f"{', '.join(map(str, stuck))})" if stuck else
|
|
1380
|
+
f"none of its own processes followed within {START_WAIT} s")
|
|
1381
|
+
if verdict == "retry":
|
|
1382
|
+
log(f"Questlog hung at its start: {how}. Ending it and starting it again.")
|
|
1383
|
+
else:
|
|
1384
|
+
log(f"Questlog hung at its start again ({START_ATTEMPTS} starts in a row): {how}. "
|
|
1385
|
+
"Ending it; start A2Qlinux again from the menu. If this keeps happening, "
|
|
1386
|
+
"file a problem report (a2qlinux --diagnose --report).")
|
|
1387
|
+
tray.stop()
|
|
1388
|
+
end_hung_questlog()
|
|
1389
|
+
try:
|
|
1390
|
+
questlog.wait(timeout=30)
|
|
1391
|
+
except subprocess.TimeoutExpired:
|
|
1392
|
+
log("The previous Questlog launcher did not end; continuing anyway.")
|
|
1393
|
+
if verdict == "give-up":
|
|
1394
|
+
notify(f"Questlog hung at its start {START_ATTEMPTS} times in a row and was ended. "
|
|
1395
|
+
"Start A2Qlinux again from the menu; details in the A2Qlinux window.")
|
|
1396
|
+
return 1
|
|
1397
|
+
questlog = start_questlog(hidden=start_watch.hidden)
|
|
1398
|
+
told = False
|
|
1399
|
+
continue
|
|
1254
1400
|
for request in requests.take():
|
|
1255
1401
|
if request == "tray-died":
|
|
1256
1402
|
log("Showing Questlog's own tray icon again, so it can still be quit.")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""a2qlinux-setup: the menu entry for Questlog
|
|
1
|
+
"""a2qlinux-setup: the menu entry "A2Qlinux" for Questlog, and a check of what A2Qlinux needs.
|
|
2
2
|
|
|
3
3
|
a2qlinux-setup [--questlog-dir DIR] [--desktop-shortcut] [--kde-overlays | --no-kde-overlays]
|
|
4
4
|
|
|
@@ -15,8 +15,10 @@ What it does, in order:
|
|
|
15
15
|
5. Installs the newest Questlog when its folder has no Questlog.exe
|
|
16
16
|
(update.install_fresh: the updater's download and checks).
|
|
17
17
|
6. Takes Questlog's icon from the installed Questlog (resources/icon.png in
|
|
18
|
-
its app.asar)
|
|
19
|
-
|
|
18
|
+
its app.asar) and colours its white Q red (a2qlinux_icon), so that
|
|
19
|
+
A2Qlinux's entry and tray icon are told apart from Questlog's own - the
|
|
20
|
+
icon is Questlog's and is not shipped here.
|
|
21
|
+
7. Writes the menu entry "A2Qlinux" (and, with --desktop-shortcut,
|
|
20
22
|
the same on the desktop), running the `a2qlinux` command.
|
|
21
23
|
8. On KDE Plasma 6, offers the KDE overlays (a2qlinux.kde_overlays): a
|
|
22
24
|
window rule and a script that show Questlog's full-screen overlay layer
|
|
@@ -39,14 +41,16 @@ import struct
|
|
|
39
41
|
import subprocess
|
|
40
42
|
import sys
|
|
41
43
|
|
|
42
|
-
from . import config, shown_version
|
|
44
|
+
from . import APP_NAME, ICON, config, shown_version
|
|
43
45
|
from . import kde_overlays
|
|
44
46
|
from .desktop import TERMINALS, terminal_command
|
|
45
47
|
from .update import install_fresh, read_asar_file
|
|
46
48
|
|
|
47
49
|
BIN = Path(__file__).resolve().parent / "bin"
|
|
48
|
-
ENTRY_ID = "questlog-aion2"
|
|
49
|
-
|
|
50
|
+
ENTRY_ID = "questlog-aion2" # the file name from before the entry was called A2Qlinux; kept, so that
|
|
51
|
+
# updating rewrites the one entry instead of adding a second one
|
|
52
|
+
OLD_ICON = Path.home() / ".local" / "share" / "icons" / f"{ENTRY_ID}.png" # Questlog's icon, uncoloured
|
|
53
|
+
ICON_COLOUR = (220, 40, 40) # red, for the white of Questlog's Q
|
|
50
54
|
MENU_ENTRY = Path.home() / ".local" / "share" / "applications" / f"{ENTRY_ID}.desktop"
|
|
51
55
|
|
|
52
56
|
# program -> the package that provides it, by its name in PACKAGES
|
|
@@ -256,18 +260,89 @@ def command(name):
|
|
|
256
260
|
raise RuntimeError(f"the command {name} is not installed; install A2Qlinux with pipx first")
|
|
257
261
|
|
|
258
262
|
|
|
263
|
+
def a2qlinux_icon(questlog_png, colour=ICON_COLOUR):
|
|
264
|
+
"""Questlog's icon (PNG bytes) with its white Q in `colour`, as PNG bytes.
|
|
265
|
+
|
|
266
|
+
The icon is a white Q on a dark tile. Each pixel is read as a mix of the
|
|
267
|
+
tile's colour (the darkest opaque pixel) and white, and the white share is
|
|
268
|
+
given to `colour` instead; so the tile stays as it is and the Q's soft
|
|
269
|
+
edges stay soft.
|
|
270
|
+
"""
|
|
271
|
+
from PyQt6.QtCore import QBuffer, QByteArray, QIODevice
|
|
272
|
+
from PyQt6.QtGui import QImage
|
|
273
|
+
image = QImage.fromData(questlog_png)
|
|
274
|
+
if image.isNull():
|
|
275
|
+
raise ValueError("Questlog's icon is not an image Qt can read")
|
|
276
|
+
image = image.convertToFormat(QImage.Format.Format_RGBA8888)
|
|
277
|
+
pixels = bytearray(image.constBits().asarray(image.sizeInBytes()))
|
|
278
|
+
tile = min((min(pixels[i:i + 3]) for i in range(0, len(pixels), 4) if pixels[i + 3] == 255), default=0)
|
|
279
|
+
span = max(255 - tile, 1)
|
|
280
|
+
for i in range(0, len(pixels), 4):
|
|
281
|
+
white = max(min(pixels[i:i + 3]) - tile, 0) / span
|
|
282
|
+
if white:
|
|
283
|
+
for c in range(3):
|
|
284
|
+
pixels[i + c] = round(min(max(pixels[i + c] - white * (255 - colour[c]), 0), 255))
|
|
285
|
+
coloured = QImage(bytes(pixels), image.width(), image.height(), image.bytesPerLine(),
|
|
286
|
+
QImage.Format.Format_RGBA8888)
|
|
287
|
+
data = QByteArray()
|
|
288
|
+
buffer = QBuffer(data)
|
|
289
|
+
buffer.open(QIODevice.OpenModeFlag.WriteOnly)
|
|
290
|
+
if not coloured.save(buffer, "PNG"):
|
|
291
|
+
raise ValueError("the coloured icon could not be written as PNG")
|
|
292
|
+
return bytes(data)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def write_icon(questlog_dir):
|
|
296
|
+
"""Write A2Qlinux's icon from the Questlog in `questlog_dir`, and remove the uncoloured one."""
|
|
297
|
+
icon = a2qlinux_icon(read_asar_file(Path(questlog_dir) / "resources" / "app.asar", "resources/icon.png"))
|
|
298
|
+
ICON.parent.mkdir(parents=True, exist_ok=True)
|
|
299
|
+
ICON.write_bytes(icon)
|
|
300
|
+
OLD_ICON.unlink(missing_ok=True)
|
|
301
|
+
|
|
302
|
+
|
|
259
303
|
def desktop_entry(questlog_dir):
|
|
260
304
|
run = command("a2qlinux") # where Questlog is comes from the settings file
|
|
261
305
|
return ("[Desktop Entry]\n"
|
|
262
306
|
"Type=Application\n"
|
|
263
|
-
"Name=
|
|
307
|
+
f"Name={APP_NAME}\n"
|
|
308
|
+
"GenericName=Questlog for AION 2\n"
|
|
264
309
|
"Comment=Questlog Desktop for AION 2 under Proton, fed with live game traffic\n"
|
|
310
|
+
"Keywords=Questlog;AION;AION 2;damage meter;\n"
|
|
265
311
|
f"Exec={run}\n"
|
|
266
312
|
f"Icon={ICON}\n"
|
|
267
313
|
"Terminal=false\n"
|
|
268
314
|
"Categories=Game;\n")
|
|
269
315
|
|
|
270
316
|
|
|
317
|
+
def with_current_keys(text, current):
|
|
318
|
+
"""`text` of our own entry, with every key of `current` except Exec as `current` has it.
|
|
319
|
+
|
|
320
|
+
Exec is kept, with any options added to it by hand; keys only `text` has
|
|
321
|
+
are kept too. Only the [Desktop Entry] group is touched (a [Desktop
|
|
322
|
+
Action …] group added by hand has keys of the same names); keys missing
|
|
323
|
+
from it are added at its end.
|
|
324
|
+
"""
|
|
325
|
+
wanted = {}
|
|
326
|
+
for line in current.splitlines():
|
|
327
|
+
key, sep, _ = line.partition("=")
|
|
328
|
+
if sep and key != "Exec":
|
|
329
|
+
wanted[key] = line
|
|
330
|
+
lines, group, end = [], None, None
|
|
331
|
+
for line in text.splitlines():
|
|
332
|
+
if line.startswith("["):
|
|
333
|
+
if group == "[Desktop Entry]":
|
|
334
|
+
end = len(lines)
|
|
335
|
+
group = line.strip()
|
|
336
|
+
key, sep, _ = line.partition("=")
|
|
337
|
+
in_entry = group == "[Desktop Entry]" and sep and key in wanted
|
|
338
|
+
lines.append(wanted.pop(key) if in_entry else line)
|
|
339
|
+
end = len(lines) if end is None else end
|
|
340
|
+
while end > 0 and not lines[end - 1].strip(): # before the blank line that ends the group
|
|
341
|
+
end -= 1
|
|
342
|
+
lines[end:end] = list(wanted.values())
|
|
343
|
+
return "\n".join(lines) + "\n"
|
|
344
|
+
|
|
345
|
+
|
|
271
346
|
def desktop_shortcut_path():
|
|
272
347
|
folder = subprocess.run(["xdg-user-dir", "DESKTOP"], capture_output=True, text=True).stdout.strip()
|
|
273
348
|
return Path(folder or Path.home() / "Desktop") / f"{ENTRY_ID}.desktop"
|
|
@@ -292,11 +367,14 @@ def refresh_entries(log=lambda text: None):
|
|
|
292
367
|
"""Keep the menu entry (and an existing desktop shortcut) pointing at this installation.
|
|
293
368
|
|
|
294
369
|
Run on every start of `a2qlinux`, like sto-clare does for its own entry.
|
|
295
|
-
An entry whose command is this installation's `a2qlinux`
|
|
296
|
-
with any options added to it by hand;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
370
|
+
An entry whose command is this installation's `a2qlinux` keeps that
|
|
371
|
+
command, with any options added to it by hand; only its other lines are
|
|
372
|
+
brought up to date (the name A2Qlinux and the coloured icon, for entries
|
|
373
|
+
written before them). Any other entry - missing, from an older layout
|
|
374
|
+
(python3 …/questlog_desktop.py), or from an installation that was moved
|
|
375
|
+
or removed - is written again. The desktop shortcut is only rewritten if
|
|
376
|
+
it exists. A missing icon is made again from Questlog's. Returns the
|
|
377
|
+
paths written.
|
|
300
378
|
"""
|
|
301
379
|
ours = command("a2qlinux")
|
|
302
380
|
questlog_dir = config.questlog_dir().resolve()
|
|
@@ -304,20 +382,27 @@ def refresh_entries(log=lambda text: None):
|
|
|
304
382
|
for path, create in ((MENU_ENTRY, True), (desktop_shortcut_path(), False)):
|
|
305
383
|
if not path.exists() and not create:
|
|
306
384
|
continue
|
|
385
|
+
current = desktop_entry(questlog_dir)
|
|
307
386
|
if entry_command(path) == ours:
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
387
|
+
text = path.read_text()
|
|
388
|
+
updated = with_current_keys(text, current)
|
|
389
|
+
if updated == text:
|
|
390
|
+
continue
|
|
391
|
+
path.write_text(updated)
|
|
392
|
+
log(f"Updated {path}: name A2Qlinux and its icon.")
|
|
393
|
+
else:
|
|
394
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
395
|
+
path.write_text(current)
|
|
396
|
+
log(f"Rewrote {path}: it did not run this installation's a2qlinux.")
|
|
311
397
|
if path != MENU_ENTRY:
|
|
312
398
|
path.chmod(0o755)
|
|
313
|
-
log(f"Rewrote {path}: it did not run this installation's a2qlinux.")
|
|
314
399
|
written.append(path)
|
|
315
400
|
if not ICON.exists():
|
|
316
401
|
try:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
402
|
+
write_icon(questlog_dir)
|
|
403
|
+
except (OSError, KeyError, ValueError, struct.error) as error:
|
|
404
|
+
log(f"A2Qlinux's icon could not be made from Questlog's ({error!r}); "
|
|
405
|
+
"the menu entry works without it, and a2qlinux-setup says why.")
|
|
321
406
|
return written
|
|
322
407
|
|
|
323
408
|
|
|
@@ -418,9 +503,7 @@ def main():
|
|
|
418
503
|
problems.append(str(error))
|
|
419
504
|
if (questlog_dir / "Questlog.exe").is_file():
|
|
420
505
|
try:
|
|
421
|
-
|
|
422
|
-
ICON.parent.mkdir(parents=True, exist_ok=True)
|
|
423
|
-
ICON.write_bytes(icon)
|
|
506
|
+
write_icon(questlog_dir)
|
|
424
507
|
print(f"Icon: {ICON}")
|
|
425
508
|
except (OSError, KeyError, ValueError, struct.error) as error:
|
|
426
509
|
problems.append(f"could not take Questlog's icon from {asar}: {error!r}")
|
|
@@ -451,7 +534,7 @@ def main():
|
|
|
451
534
|
for problem in problems:
|
|
452
535
|
print(f" - {problem}", file=sys.stderr)
|
|
453
536
|
return 1
|
|
454
|
-
print("\nReady. Start '
|
|
537
|
+
print(f"\nReady. Start '{APP_NAME}' from the menu.")
|
|
455
538
|
return 0
|
|
456
539
|
|
|
457
540
|
|
|
@@ -23,6 +23,7 @@ import subprocess
|
|
|
23
23
|
import sys
|
|
24
24
|
import time
|
|
25
25
|
|
|
26
|
+
from . import APP_NAME, ICON
|
|
26
27
|
from .desktop import LOCK
|
|
27
28
|
from .launcher import APPID, game_processes
|
|
28
29
|
|
|
@@ -78,7 +79,7 @@ def main():
|
|
|
78
79
|
sys.executable, "-m", "a2qlinux.desktop", "--for-game", *options],
|
|
79
80
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
|
|
80
81
|
if started.returncode:
|
|
81
|
-
subprocess.run(["notify-send", "--app-name=
|
|
82
|
+
subprocess.run(["notify-send", f"--app-name={APP_NAME}", f"--icon={ICON}", APP_NAME,
|
|
82
83
|
"Could not start Questlog from the Steam launch option; start it from its icon."],
|
|
83
84
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
|
|
84
85
|
|
|
@@ -18,16 +18,13 @@ starts and the desktop has a system tray, otherwise 1 with the reason on
|
|
|
18
18
|
stderr (Qt's own message when Qt cannot start). a2qlinux-setup runs it.
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
|
-
from pathlib import Path
|
|
22
21
|
import sys
|
|
23
22
|
|
|
24
23
|
from PyQt6.QtCore import QSocketNotifier
|
|
25
24
|
from PyQt6.QtGui import QIcon
|
|
26
25
|
from PyQt6.QtWidgets import QApplication, QMenu, QSystemTrayIcon
|
|
27
26
|
|
|
28
|
-
from a2qlinux import shown_version
|
|
29
|
-
|
|
30
|
-
ICON = Path.home() / ".local" / "share" / "icons" / "questlog-aion2.png" # written by a2qlinux-setup
|
|
27
|
+
from a2qlinux import APP_NAME, ICON, shown_version # ICON is written by a2qlinux-setup
|
|
31
28
|
|
|
32
29
|
|
|
33
30
|
def report(action):
|
|
@@ -36,8 +33,8 @@ def report(action):
|
|
|
36
33
|
|
|
37
34
|
def main():
|
|
38
35
|
app = QApplication(sys.argv)
|
|
39
|
-
app.setApplicationName(
|
|
40
|
-
app.setDesktopFileName("questlog-aion2")
|
|
36
|
+
app.setApplicationName(APP_NAME)
|
|
37
|
+
app.setDesktopFileName("questlog-aion2") # setup_desktop.ENTRY_ID
|
|
41
38
|
app.setQuitOnLastWindowClosed(False)
|
|
42
39
|
if not QSystemTrayIcon.isSystemTrayAvailable():
|
|
43
40
|
print("a2qlinux tray: the desktop has no system tray", file=sys.stderr)
|
|
@@ -47,7 +44,7 @@ def main():
|
|
|
47
44
|
|
|
48
45
|
version = f"A2Qlinux {shown_version()}"
|
|
49
46
|
tray = QSystemTrayIcon(QIcon(str(ICON)), app)
|
|
50
|
-
tray.setToolTip(f"Questlog
|
|
47
|
+
tray.setToolTip(f"{version} — Questlog for AION 2")
|
|
51
48
|
menu = QMenu()
|
|
52
49
|
menu.addAction(version).setEnabled(False) # which A2Qlinux runs, for reports; not clickable
|
|
53
50
|
menu.addSeparator()
|