diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-27 23:29:09 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-27 23:29:09 -0500 |
| commit | f5c79d1324606111bcf59197363d87bf26c4a026 (patch) | |
| tree | 3e1cff937cdcf8492dcbabd3f7d0ee6e57b99189 | |
| parent | f36350ce4bc734f5f25cce12f8c5b3eac1b48276 (diff) | |
| download | Decky-Framegen-f5c79d1324606111bcf59197363d87bf26c4a026.tar.gz Decky-Framegen-f5c79d1324606111bcf59197363d87bf26c4a026.zip | |
frontend uninstaller script implementation start
| -rwxr-xr-x | src/index.tsx | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/index.tsx b/src/index.tsx index d1cdccc..c27c266 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -242,7 +242,7 @@ function InstalledGamesSection() { const sortedGames = [...result.games] .map(game => ({ ...game, - appid: parseInt(game.appid, 10) // Convert string to number + appid: parseInt(game.appid, 10), // Convert string to number })) .sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase())); setGames(sortedGames); @@ -254,7 +254,7 @@ function InstalledGamesSection() { fetchGames(); }, []); - const handleGameClick = async (game: { appid: number; name: string }) => { + const handlePatchClick = async (game: { appid: number; name: string }) => { setClickedGame(game); try { await SteamClient.Apps.SetAppLaunchOptions(game.appid, '/home/deck/fgmod/fgmod %COMMAND%'); @@ -268,16 +268,38 @@ function InstalledGamesSection() { } }; + const handleUnpatchClick = async (game: { appid: number; name: string }) => { + setClickedGame(game); + try { + await SteamClient.Apps.SetAppLaunchOptions(game.appid, '/home/deck/fgmod/fgmod-uninstaller.sh'); // Remove mod files and launch game + setResult(`Launch options cleared for ${game.name}. The game is now unpatched.`); + } catch (error) { + if (error instanceof Error) { + setResult(`Error clearing launch options: ${error.message}`); + } else { + setResult('Error clearing launch options'); + } + } + }; + return ( - <PanelSection title="Select a game below to patch:"> + <PanelSection title="Select a game below to patch or unpatch:"> {games.map((game) => ( <PanelSectionRow key={game.appid}> - <ButtonItem - layout="below" - onClick={() => handleGameClick(game)} - > - {game.name} - </ButtonItem> + <div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}> + <ButtonItem + layout="below" + onClick={() => handlePatchClick(game)} + > + Patch: {game.name} + </ButtonItem> + <ButtonItem + layout="below" + onClick={() => handleUnpatchClick(game)} + > + Unpatch: {game.name} + </ButtonItem> + </div> {clickedGame?.appid === game.appid && ( <div style={{ padding: '8px' }}> {result} |
