feat First implementation of plugins system

feat: Added PCSX2 integration
feat: Revamped UI a bit made it look better on light mode
This commit is contained in:
Simeon Radivoev 2026-03-25 21:51:10 +02:00
parent d85268fad7
commit a78e75335f
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
95 changed files with 2639 additions and 1259 deletions

View file

@ -1,7 +1,9 @@
import { $ } from 'bun';
import { $, sleep } from 'bun';
import path from 'node:path';
import { createHash } from "node:crypto";
import { createReadStream } from "node:fs";
import { SettingsType } from '@/shared/constants';
import { config } from './api/app';
export function checkRunning (pid: number)
{
@ -111,3 +113,33 @@ export function shuffleInPlace (array: any[], startSeed?: number)
[array[i], array[j]] = [array[j], array[i]];
}
}
export function toggleElementInConfig<T> (id: KeysWithValueAssignableTo<SettingsType, Array<T>>, element: T, enabled: boolean)
{
const disabled = config.get(id as any) as T[];
if (enabled)
{
const index = disabled.indexOf(element);
if (index < 0)
{
config.set('disabledPlugins', disabled.concat(element));
}
} else
{
const index = disabled.indexOf(element);
if (index >= 0)
{
config.set('disabledPlugins', disabled.toSpliced(index, 1));
}
}
}
export async function simulateProgress (setProgress: (p: number) => void, signal?: AbortSignal)
{
for (let i = 0; i < 10; i++)
{
setProgress(i * 10);
if (signal && signal.aborted) return;
await sleep(1000);
}
}