diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-22 20:10:48 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-22 20:10:48 -0500 |
| commit | dbbb342afa78c824e25a49ec679f725e44fe2fca (patch) | |
| tree | df3836eb50201f0081541e0f1302d87139a71dfa | |
| parent | 94bb49822beb9a525c9d29cf452cb6dd47b4fb2b (diff) | |
| download | Decky-Framegen-dbbb342afa78c824e25a49ec679f725e44fe2fca.tar.gz Decky-Framegen-dbbb342afa78c824e25a49ec679f725e44fe2fca.zip | |
python for prep script, clean up assets
| -rw-r--r-- | assets/NVIDIA-Linux-x86_64-$nvidiaver.run | 1 | ||||
| -rw-r--r-- | assets/d3dcompiler_47.dll | bin | 4346120 -> 0 bytes | |||
| -rw-r--r-- | assets/dlss-enabler-setup-3.02.000.0.exe | bin | 32327234 -> 0 bytes | |||
| -rw-r--r-- | assets/fakenvapi.ini | 16 | ||||
| -rw-r--r-- | assets/innoextract | bin | 1632672 -> 0 bytes | |||
| -rw-r--r-- | assets/nvapi64.dll | bin | 544256 -> 0 bytes | |||
| -rwxr-xr-x | assets/prepare.sh | 11 | ||||
| -rw-r--r-- | main.py | 87 |
8 files changed, 32 insertions, 83 deletions
diff --git a/assets/NVIDIA-Linux-x86_64-$nvidiaver.run b/assets/NVIDIA-Linux-x86_64-$nvidiaver.run deleted file mode 100644 index 10af2fe..0000000 --- a/assets/NVIDIA-Linux-x86_64-$nvidiaver.run +++ /dev/null @@ -1 +0,0 @@ -Not found diff --git a/assets/d3dcompiler_47.dll b/assets/d3dcompiler_47.dll Binary files differdeleted file mode 100644 index b120261..0000000 --- a/assets/d3dcompiler_47.dll +++ /dev/null diff --git a/assets/dlss-enabler-setup-3.02.000.0.exe b/assets/dlss-enabler-setup-3.02.000.0.exe Binary files differdeleted file mode 100644 index c63578a..0000000 --- a/assets/dlss-enabler-setup-3.02.000.0.exe +++ /dev/null diff --git a/assets/fakenvapi.ini b/assets/fakenvapi.ini deleted file mode 100644 index f1f3c0c..0000000 --- a/assets/fakenvapi.ini +++ /dev/null @@ -1,16 +0,0 @@ -[fakenvapi] -enable_logs=1 - -enable_trace_logs=0 - -; useful in native fsg fg games -force_latencyflex=0 - -; controls how latencyflex works -; 0 = conservative -; 1 = aggressive, will improve latency but in some cases will lower fps more than expected -; 2 = use reflex frame ids, some games are not compatible (i.e. cyberpunk) and will fallback to aggressive -latencyflex_mode=0 - -; 0 - follow in-game setting, 1 - force disable, 2 - force enable -force_reflex=0
\ No newline at end of file diff --git a/assets/innoextract b/assets/innoextract Binary files differdeleted file mode 100644 index a7fb871..0000000 --- a/assets/innoextract +++ /dev/null diff --git a/assets/nvapi64.dll b/assets/nvapi64.dll Binary files differdeleted file mode 100644 index f3d8051..0000000 --- a/assets/nvapi64.dll +++ /dev/null diff --git a/assets/prepare.sh b/assets/prepare.sh index debfede..57a1620 100755 --- a/assets/prepare.sh +++ b/assets/prepare.sh @@ -9,20 +9,13 @@ fakenvapiver=v1.2.0 standalone=1 if [[ -d "$mod_path" ]] && [[ ! $mod_path == . ]]; then - read -p "$mod_path already exists, override the old version? [y/N] " -n 1 -r </dev/tty - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - rm -r "$mod_path" - else - echo Aborting... - exit 1 - fi + rm -r "$mod_path" fi # In case script gets ran from a different directory cd $(dirname "$0") -mkdir "$mod_path" +mkdir -p "$mod_path" if [[ ! $standalone -eq 0 ]]; then [[ -f fgmod.sh ]] && cp fgmod.sh "$mod_path/fgmod" || exit 1 [[ -f fgmod-uninstaller.sh ]] && cp fgmod-uninstaller.sh "$mod_path" || exit 1 @@ -40,63 +40,36 @@ class Plugin(PluginBase): @callable async def run_install_fgmod(self) -> dict: - script = """ -#!/usr/bin/env bash - -set -euo pipefail -trap 'echo "An error occurred. Exiting." && exit 1' ERR - -# Define paths -zip_file="$HOME/homebrew/plugins/Decky-Framegen/assets/fgmod-1.5.1.zip" -downloads_dir="$HOME/Downloads" -destination_zip="$downloads_dir/fgmod-1.5.1.zip" - -# Step 1: Copy the ZIP file to Downloads if it doesn't already exist -if [[ ! -f "$destination_zip" ]]; then - echo "Copying ZIP file to Downloads directory..." - cp "$zip_file" "$destination_zip" || { echo "Error: ZIP file not found at $zip_file"; exit 1; } -else - echo "ZIP file already exists in Downloads directory. Skipping copy." -fi - -# Step 2: Navigate to Downloads -cd "$downloads_dir" - -# Step 3: Extract the ZIP file -echo "Extracting ZIP file..." -unzip -o "$(basename "$destination_zip")" || { echo "Error: Failed to extract ZIP file."; exit 1; } - -# Step 4: Locate the extracted directory dynamically -echo "Locating extracted directory..." -extracted_dir=$(find . -maxdepth 1 -type d -name "fgmod*" ! -name "__MACOSX" | head -n 1) - -if [[ -d "$extracted_dir" ]]; then - cd "$extracted_dir" - echo "Navigated to extracted directory: $extracted_dir" -else - echo "Error: Extracted directory not found." - exit 1 -fi - -# Step 5: Run the prepare.sh script and automatically answer "y" -echo "Running prepare.sh..." -if [[ -f "./prepare.sh" ]]; then - chmod +x ./prepare.sh - echo "y" | ./prepare.sh || { echo "Error: prepare.sh failed."; exit 1; } -else - echo "Error: prepare.sh not found in $extracted_dir" - exit 1 -fi - -# Step 6: Signal success to the front end -echo "Installation successful!" -# Log the success explicitly for the frontend -echo "STATUS: SUCCESS" - -exit 0 -""" try: - process = subprocess.run(script, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + # Define paths + assets_dir = Path("/home/deck/homebrew/plugins/Decky-Framegen/assets") + downloads_dir = Path.home() / "Downloads" + + # Copy files to Downloads, overwriting if they exist + files_to_copy = ["prepare.sh", "fgmod.sh", "fgmod-uninstaller.sh"] + for file in files_to_copy: + src = assets_dir / file + dest = downloads_dir / file + if src.exists(): + dest.write_bytes(src.read_bytes()) + dest.chmod(0o755) # Make the file executable + else: + return {"status": "error", "message": f"{file} is missing in {assets_dir}"} + + # Run prepare.sh + prepare_script = downloads_dir / "prepare.sh" + process = subprocess.run([str(prepare_script)], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + + # Verify key files exist, if not create it + fgmod_path = Path("/home/deck/fgmod") + if not fgmod_path.exists(): + fgmod_path.mkdir(parents=True) + return {"status": "info", "message": "fgmod directory was not found and has been created"} + + # Check for success message + if "All done!" not in process.stdout: + return {"status": "error", "message": "Installation did not complete successfully"} + return {"status": "success", "output": process.stdout} except subprocess.CalledProcessError as e: return {"status": "error", "message": e.stderr} @@ -105,4 +78,4 @@ exit 0 decky.logger.info("Plugin loaded.") async def _unload(self): - decky.logger.info("Plugin unloaded.")
\ No newline at end of file + decky.logger.info("Plugin unloaded.") |
