TypeScript · 1748 bytes Raw Blame History
1 import { invoke } from "@tauri-apps/api/core";
2 import type {
3 GameInfo,
4 PrefixInfo,
5 ProtonInfo,
6 WemodStatus,
7 InitStatus,
8 DoctorReport,
9 ConfigDto,
10 } from "../types";
11
12 // Game API
13 export async function getGames(): Promise<GameInfo[]> {
14 return invoke("get_games");
15 }
16
17 export async function getGame(appId: number): Promise<GameInfo> {
18 return invoke("get_game", { appId });
19 }
20
21 export async function launchGame(appId: number, withWemod: boolean): Promise<void> {
22 return invoke("launch_game", { appId, withWemod });
23 }
24
25 // Prefix API
26 export async function getPrefixes(): Promise<PrefixInfo[]> {
27 return invoke("get_prefixes");
28 }
29
30 export async function getPrefixHealth(name: string): Promise<PrefixInfo> {
31 return invoke("get_prefix_health", { name });
32 }
33
34 export async function repairPrefix(name: string): Promise<void> {
35 return invoke("repair_prefix", { name });
36 }
37
38 // Init API
39 export async function getInitStatus(): Promise<InitStatus> {
40 return invoke("get_init_status");
41 }
42
43 export async function initWanda(): Promise<void> {
44 return invoke("init_wanda");
45 }
46
47 // Config API
48 export async function getConfig(): Promise<ConfigDto> {
49 return invoke("get_config");
50 }
51
52 export async function updateConfig(config: ConfigDto): Promise<void> {
53 return invoke("update_config", { configDto: config });
54 }
55
56 // WeMod API
57 export async function getWemodStatus(): Promise<WemodStatus> {
58 return invoke("get_wemod_status");
59 }
60
61 export async function updateWemod(): Promise<void> {
62 return invoke("update_wemod");
63 }
64
65 // Proton API
66 export async function getProtonVersions(): Promise<ProtonInfo[]> {
67 return invoke("get_proton_versions");
68 }
69
70 // Doctor API
71 export async function runDoctor(): Promise<DoctorReport> {
72 return invoke("run_doctor");
73 }