diff --git a/README.md b/README.md index 71421d8..71ee5b7 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,27 @@ fsdecrypt ABCD_1.00.00_20240101120000_0.app ABCD_1.01.00_20240215143000_1_1.00.0 The output folder is named after the input file (e.g. `ABCD_1.01.00_20240215143000_1_1.00.00/`). +## Windows Right-Click Menu + +Two batch files add an **"Unpack with fsdecrypt"** entry (with an unpack icon) +to the right-click menu of `.app` and `.opt` files: + +- **`install-context-menu.bat`** — install the menu entry +- **`uninstall-context-menu.bat`** — remove it + +Just double-click `install-context-menu.bat`. No administrator rights are +needed — it installs under the current user only (`HKCU`) and leaves the normal +double-click association untouched. Right-clicking a file then runs the full +extraction and keeps the console window open until you press a key. + +`install-context-menu.bat` finds `fsdecrypt.exe` automatically when run from the +repo root (it looks in `target\release` then `target\debug`) or when placed next +to the binary. The icon is taken from `assets\fsdecrypt.ico` (or `fsdecrypt.ico` +beside the script). The menu stores the absolute path it found, so re-run it if +you move the exe. + +> On Windows 11 the entry appears under **Show more options** (the classic menu). + ## External Key Files For games not in the built-in key database, place a file named `{GAME_ID}.bin` in the working directory: diff --git a/assets/fsdecrypt.ico b/assets/fsdecrypt.ico new file mode 100644 index 0000000..1644b51 Binary files /dev/null and b/assets/fsdecrypt.ico differ diff --git a/install-context-menu.bat b/install-context-menu.bat new file mode 100644 index 0000000..2ad1300 --- /dev/null +++ b/install-context-menu.bat @@ -0,0 +1,48 @@ +@echo off +setlocal enabledelayedexpansion +rem --------------------------------------------------------------------------- +rem Adds an "Unpack with fsdecrypt" entry (with icon) to the right-click menu +rem of .app and .opt files. Per-user only (HKCU) -- no administrator needed, +rem and it does not change the normal double-click association. +rem +rem Place this next to fsdecrypt.exe and run it, or run it from the repo root +rem after `cargo build --release`. Run uninstall-context-menu.bat to undo. +rem --------------------------------------------------------------------------- + +rem --- locate fsdecrypt.exe -------------------------------------------------- +set "EXE=" +if exist "%~dp0fsdecrypt.exe" set "EXE=%~dp0fsdecrypt.exe" +if not defined EXE if exist "%~dp0target\release\fsdecrypt.exe" set "EXE=%~dp0target\release\fsdecrypt.exe" +if not defined EXE if exist "%~dp0target\debug\fsdecrypt.exe" set "EXE=%~dp0target\debug\fsdecrypt.exe" +if not defined EXE ( + echo ERROR: could not find fsdecrypt.exe next to this script or under target\. + echo Build it first: cargo build --release + pause + exit /b 1 +) + +rem --- locate the icon (optional) -------------------------------------------- +set "ICON=" +if exist "%~dp0fsdecrypt.ico" set "ICON=%~dp0fsdecrypt.ico" +if not defined ICON if exist "%~dp0assets\fsdecrypt.ico" set "ICON=%~dp0assets\fsdecrypt.ico" + +echo Using exe : !EXE! +if defined ICON (echo Using icon: !ICON!) else (echo Using icon: ^(none found^)) +echo. + +call :install ".app" +call :install ".opt" + +echo. +echo Done. Right-click a .app or .opt file to see "Unpack with fsdecrypt". +echo ^(On Windows 11 it is under "Show more options".^) +pause +exit /b 0 + +:install +set "KEY=HKCU\Software\Classes\SystemFileAssociations\%~1\shell\fsdecrypt" +reg add "%KEY%" /ve /d "Unpack with fsdecrypt" /f >nul +if defined ICON reg add "%KEY%" /v Icon /d "!ICON!" /f >nul +reg add "%KEY%\command" /ve /d "cmd /c \"\"!EXE!\" \"%%1\" ^& pause\"" /f >nul +echo installed for %~1 +goto :eof diff --git a/uninstall-context-menu.bat b/uninstall-context-menu.bat new file mode 100644 index 0000000..05d006e --- /dev/null +++ b/uninstall-context-menu.bat @@ -0,0 +1,13 @@ +@echo off +setlocal +rem --------------------------------------------------------------------------- +rem Removes the "Unpack with fsdecrypt" right-click entry installed by +rem install-context-menu.bat. Safe to run even if it was never installed. +rem --------------------------------------------------------------------------- + +reg delete "HKCU\Software\Classes\SystemFileAssociations\.app\shell\fsdecrypt" /f >nul 2>&1 +reg delete "HKCU\Software\Classes\SystemFileAssociations\.opt\shell\fsdecrypt" /f >nul 2>&1 + +echo Removed "Unpack with fsdecrypt" from the right-click menu of .app and .opt files. +pause +exit /b 0