diff options
| -rw-r--r-- | main.py | 78 | ||||
| -rwxr-xr-x | src/index.tsx | 71 |
2 files changed, 76 insertions, 73 deletions
@@ -6,48 +6,48 @@ from pathlib import Path class Plugin: async def _main(self): - decky.logger.info("Framegen plugin loaded (old decorator-free approach).") + decky.logger.info("Framegen plugin loaded") async def _unload(self): decky.logger.info("Framegen plugin unloaded.") - # Public method: front end can call this via callable("get_installed_games") - async def get_installed_games(self) -> str: - library_file = "/home/deck/.steam/steam/steamapps/libraryfolders.vdf" - libraries = [] - - # Find library folders - if os.path.exists(library_file): - with open(library_file, "r") as f: - lines = f.readlines() - for line in lines: - if '"path"' in line: - folder_path = line.split('"')[3] - libraries.append(os.path.join(folder_path, "steamapps")) - - # Gather installed games - games = [] - for library in libraries: - if os.path.exists(library): - manifest_files = [ - f for f in os.listdir(library) - if f.startswith("appmanifest_") - ] - for manifest in manifest_files: - manifest_path = os.path.join(library, manifest) - with open(manifest_path, "r") as mf: - lines = mf.readlines() - appid = "" - name = "" - for line in lines: - if '"appid"' in line: - appid = line.split('"')[3] - elif '"name"' in line: - name = line.split('"')[3] - if appid and name: - games.append({"appid": appid, "name": name}) - - return json.dumps(games) + # # Public method: front end can call this via callable("get_installed_games") + # async def get_installed_games(self) -> str: + # library_file = "/home/deck/.steam/steam/steamapps/libraryfolders.vdf" + # libraries = [] + + # # Find library folders + # if os.path.exists(library_file): + # with open(library_file, "r") as f: + # lines = f.readlines() + # for line in lines: + # if '"path"' in line: + # folder_path = line.split('"')[3] + # libraries.append(os.path.join(folder_path, "steamapps")) + + # # Gather installed games + # games = [] + # for library in libraries: + # if os.path.exists(library): + # manifest_files = [ + # f for f in os.listdir(library) + # if f.startswith("appmanifest_") + # ] + # for manifest in manifest_files: + # manifest_path = os.path.join(library, manifest) + # with open(manifest_path, "r") as mf: + # lines = mf.readlines() + # appid = "" + # name = "" + # for line in lines: + # if '"appid"' in line: + # appid = line.split('"')[3] + # elif '"name"' in line: + # name = line.split('"')[3] + # if appid and name: + # games.append({"appid": appid, "name": name}) + + # return json.dumps(games) # Public method: front end can call this via callable("run_install_fgmod") async def run_install_fgmod(self) -> dict: @@ -101,7 +101,7 @@ class Plugin: return { "status": "success", - "output": process.stdout + "output": "in the games' launch options, add: /home/deck/fgmod/fgmod %COMMAND%" } except subprocess.TimeoutExpired: diff --git a/src/index.tsx b/src/index.tsx index afb3cdd..b0c1e15 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,10 +1,13 @@ -import { useState, useEffect } from "react"; +import { + useState, + // useEffect +} from "react"; import { PanelSection, PanelSectionRow, ButtonItem, - Dropdown, - DropdownOption + // Dropdown, + // DropdownOption } from "@decky/ui"; import { definePlugin, callable } from "@decky/api"; import { FaShip } from "react-icons/fa"; @@ -16,7 +19,7 @@ const runInstallFGMod = callable< >("run_install_fgmod"); // "get_installed_games" corresponds to the Python method get_installed_games() -const fetchInstalledGames = callable<[], string>("get_installed_games"); +// const fetchInstalledGames = callable<[], string>("get_installed_games"); function FGModInstallerSection() { const [installing, setInstalling] = useState(false); @@ -64,44 +67,44 @@ function FGModInstallerSection() { ); } -function GameSelectorSection() { - const [games, setGames] = useState<DropdownOption[]>([]); - const [selectedGame, setSelectedGame] = useState<DropdownOption | null>(null); +// function GameSelectorSection() { +// const [games, setGames] = useState<DropdownOption[]>([]); +// const [selectedGame, setSelectedGame] = useState<DropdownOption | null>(null); - useEffect(() => { - const loadGames = async () => { - const result = await fetchInstalledGames(); - const gameList = JSON.parse(result) as { appid: string; name: string }[]; - setGames(gameList.map((g) => ({ data: g.appid, label: g.name }))); - }; +// useEffect(() => { +// const loadGames = async () => { +// const result = await fetchInstalledGames(); +// const gameList = JSON.parse(result) as { appid: string; name: string }[]; +// setGames(gameList.map((g) => ({ data: g.appid, label: g.name }))); +// }; - loadGames(); - }, []); +// loadGames(); +// }, []); - return ( - <PanelSection title="Installed Games"> - <PanelSectionRow> - <Dropdown - rgOptions={games} - selectedOption={selectedGame?.data || null} - onChange={(option) => setSelectedGame(option)} - strDefaultLabel="Select a game" - /> - </PanelSectionRow> - {selectedGame && ( - <PanelSectionRow> - <div>You selected: {selectedGame.label}</div> - </PanelSectionRow> - )} - </PanelSection> - ); -} +// return ( +// <PanelSection title="Installed Games"> +// <PanelSectionRow> +// <Dropdown +// rgOptions={games} +// selectedOption={selectedGame?.data || null} +// onChange={(option) => setSelectedGame(option)} +// strDefaultLabel="Select a game" +// /> +// </PanelSectionRow> +// {selectedGame && ( +// <PanelSectionRow> +// <div>You selected: {selectedGame.label}</div> +// </PanelSectionRow> +// )} +// </PanelSection> +// ); +// } function MainContent() { return ( <> <FGModInstallerSection /> - <GameSelectorSection /> + {/* <GameSelectorSection /> */} </> ); } |
