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:
parent
d85268fad7
commit
a78e75335f
95 changed files with 2639 additions and 1259 deletions
25
src/bun/api/plugins/register-plugins.ts
Normal file
25
src/bun/api/plugins/register-plugins.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { PluginManager } from "./plugin-manager";
|
||||
|
||||
import pcsx2 from './builtin/emulators/com.simeonradivoev.gameflow.pcsx2/package.json';
|
||||
import { PluginDescriptionSchema, PluginDescriptionType, PluginSchema } from "@/bun/types/typesc.schema";
|
||||
import path from "node:path";
|
||||
|
||||
export default async function register (pluginManager: PluginManager)
|
||||
{
|
||||
|
||||
const plugins: (PluginDescriptionType & { main: string; root: string; })[] = [
|
||||
{ ...pcsx2, root: './builtin/emulators/com.simeonradivoev.gameflow.pcsx2' }
|
||||
];
|
||||
|
||||
await Promise.all(plugins.map(async (pluginPackage) =>
|
||||
{
|
||||
const file = await import(`./${path.join(pluginPackage.root, pluginPackage.main)}`);
|
||||
if (file.default && typeof file.default === 'function')
|
||||
{
|
||||
const pluginInstance = new file.default();
|
||||
const plugin = await PluginSchema.parseAsync(pluginInstance);
|
||||
const description = await PluginDescriptionSchema.parseAsync(pluginPackage);
|
||||
pluginManager.register(plugin, description, 'builtin');
|
||||
}
|
||||
}));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue