fix(plugin): add control socket, autostart_log=1, timeout-safe mangohudctl
This commit is contained in:
@@ -190,7 +190,8 @@ class Plugin:
|
|||||||
config_content = """\
|
config_content = """\
|
||||||
# DeckyVault MangoHud logging config
|
# DeckyVault MangoHud logging config
|
||||||
output_folder=/tmp
|
output_folder=/tmp
|
||||||
autostart_log=0
|
control=mangohud
|
||||||
|
autostart_log=1
|
||||||
fps
|
fps
|
||||||
frame_timing
|
frame_timing
|
||||||
cpu_power
|
cpu_power
|
||||||
@@ -233,20 +234,17 @@ benchmark_percentiles=97,AVG,1,0.1
|
|||||||
return {"success": False, "error": str(e)}
|
return {"success": False, "error": str(e)}
|
||||||
|
|
||||||
async def stop_mangohud_logging(self) -> dict:
|
async def stop_mangohud_logging(self) -> dict:
|
||||||
"""RPC: Stop MangoHud logging via mangohudctl."""
|
"""RPC: Stop MangoHud logging via mangohudctl. Best-effort, may fail if game already closed."""
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["mangohudctl", "set", "log_session", "false"],
|
["mangohudctl", "set", "log_session", "false"],
|
||||||
capture_output=True, text=True, timeout=5
|
capture_output=True, text=True, timeout=2
|
||||||
)
|
)
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
else:
|
|
||||||
return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"}
|
return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"}
|
||||||
except FileNotFoundError:
|
except (subprocess.TimeoutExpired, FileNotFoundError, Exception) as e:
|
||||||
return {"success": False, "error": "mangohudctl not found. Is MangoHud running?"}
|
|
||||||
except Exception as e:
|
|
||||||
return {"success": False, "error": str(e)}
|
return {"success": False, "error": str(e)}
|
||||||
|
|
||||||
async def _find_mangohud_log(self) -> str | None:
|
async def _find_mangohud_log(self) -> str | None:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
readAndParseMangohudLog,
|
readAndParseMangohudLog,
|
||||||
clearMangohudLog,
|
clearMangohudLog,
|
||||||
writeMangohudConfig,
|
writeMangohudConfig,
|
||||||
|
stopMangohudLogging,
|
||||||
getHardwareInfo,
|
getHardwareInfo,
|
||||||
getOsVersion,
|
getOsVersion,
|
||||||
getProtonVersion,
|
getProtonVersion,
|
||||||
@@ -80,6 +81,8 @@ function Content() {
|
|||||||
// ── Handle stop recording: parse log + read system info ────────
|
// ── Handle stop recording: parse log + read system info ────────
|
||||||
async function handleStop() {
|
async function handleStop() {
|
||||||
try {
|
try {
|
||||||
|
// Try to stop MangoHud logging (best-effort, may fail if game already closed)
|
||||||
|
await stopMangohudLogging()
|
||||||
stopRecording()
|
stopRecording()
|
||||||
|
|
||||||
// Parse the MangoHud log
|
// Parse the MangoHud log
|
||||||
|
|||||||
Reference in New Issue
Block a user