summaryrefslogtreecommitdiff
path: root/py_modules/lsfg_vk/plugin.py
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-18 20:59:47 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-18 20:59:47 -0400
commitfb3d3d4d3414394237cc9d664d65c14be179927f (patch)
treea4f3bcc67983ef012893b6a14013150026b123db /py_modules/lsfg_vk/plugin.py
parentb9302548a4def670c8600086ba8685c075ceac3d (diff)
downloaddecky-lsfg-vk-fb3d3d4d3414394237cc9d664d65c14be179927f.tar.gz
decky-lsfg-vk-fb3d3d4d3414394237cc9d664d65c14be179927f.zip
add nerd stuff modal with dll details
Diffstat (limited to 'py_modules/lsfg_vk/plugin.py')
-rw-r--r--py_modules/lsfg_vk/plugin.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/py_modules/lsfg_vk/plugin.py b/py_modules/lsfg_vk/plugin.py
index a44840d..60eab8c 100644
--- a/py_modules/lsfg_vk/plugin.py
+++ b/py_modules/lsfg_vk/plugin.py
@@ -10,6 +10,7 @@ import json
import subprocess
import urllib.request
import ssl
+import hashlib
from typing import Dict, Any
from pathlib import Path
@@ -101,6 +102,67 @@ class Plugin:
return result_dict
+ async def get_dll_stats(self) -> Dict[str, Any]:
+ """Get detailed statistics about the detected DLL
+
+ Returns:
+ Dict containing DLL path, SHA256 hash, and other stats
+ """
+ try:
+ # First check if DLL is detected
+ dll_result = self.dll_detection_service.check_lossless_scaling_dll()
+
+ if not dll_result.get("detected") or not dll_result.get("path"):
+ return {
+ "success": False,
+ "error": "DLL not detected",
+ "dll_path": None,
+ "dll_sha256": None
+ }
+
+ dll_path = dll_result["path"]
+ if dll_path is None:
+ return {
+ "success": False,
+ "error": "DLL path is None",
+ "dll_path": None,
+ "dll_sha256": None
+ }
+
+ dll_path_obj = Path(dll_path)
+
+ # Calculate SHA256 hash
+ sha256_hash = hashlib.sha256()
+ try:
+ with open(dll_path_obj, "rb") as f:
+ # Read file in chunks to handle large files efficiently
+ for chunk in iter(lambda: f.read(4096), b""):
+ sha256_hash.update(chunk)
+ dll_sha256 = sha256_hash.hexdigest()
+ except Exception as e:
+ return {
+ "success": False,
+ "error": f"Failed to calculate SHA256: {str(e)}",
+ "dll_path": dll_path,
+ "dll_sha256": None
+ }
+
+ return {
+ "success": True,
+ "dll_path": dll_path,
+ "dll_sha256": dll_sha256,
+ "dll_source": dll_result.get("source"),
+ "error": None
+ }
+
+ except Exception as e:
+ return {
+ "success": False,
+ "error": f"Failed to get DLL stats: {str(e)}",
+ "dll_path": None,
+ "dll_sha256": None
+ }
+
# Configuration methods
async def get_lsfg_config(self) -> Dict[str, Any]:
"""Read current lsfg script configuration