From f5c79d1324606111bcf59197363d87bf26c4a026 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Mon, 27 Jan 2025 23:29:09 -0500 Subject: frontend uninstaller script implementation start --- src/index.tsx | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src/index.tsx') 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 ( - + {games.map((game) => ( - handleGameClick(game)} - > - {game.name} - +
+ handlePatchClick(game)} + > + Patch: {game.name} + + handleUnpatchClick(game)} + > + Unpatch: {game.name} + +
{clickedGame?.appid === game.appid && (
{result} -- cgit v1.2.3