parent
04d5856f7d
commit
09b8b9c6f8
20 changed files with 351 additions and 231 deletions
|
|
@ -6,37 +6,48 @@ import desc from './package.json';
|
|||
|
||||
export default class DOLPHINIntegration implements PluginType
|
||||
{
|
||||
emulator = 'DOLPHIN';
|
||||
|
||||
|
||||
load (ctx: PluginContextType)
|
||||
{
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap(desc.name, (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap({ name: desc.name, emulator: this.emulator }, (ctx) =>
|
||||
{
|
||||
if (ctx.emulator === 'DOLPHIN')
|
||||
return { id: desc.name, supportLevel: "full", capabilities: ["batch", "config", "fullscreen", "resolution", "saves", "states"] };
|
||||
return { id: desc.name, supportLevel: "full", capabilities: ["batch", "config", "fullscreen", "resolution", "saves", "states"] };
|
||||
});
|
||||
|
||||
ctx.hooks.emulators.emulatorPostInstall.tapPromise(desc.name, async (ctx) =>
|
||||
ctx.hooks.emulators.emulatorPostInstall.tapPromise({ name: desc.name, emulator: this.emulator }, async (ctx) =>
|
||||
{
|
||||
await Bun.write(path.join(ctx.path, "portable.txt"), "");
|
||||
});
|
||||
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise(desc.name, async (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise({ name: desc.name, emulator: this.emulator }, async (ctx) =>
|
||||
{
|
||||
if (ctx.autoValidCommand.emulator === 'DOLPHIN' && ctx.autoValidCommand.metadata.emulatorDir)
|
||||
const args: string[] = [];
|
||||
|
||||
const storageFolder = path.join(config.get('downloadPath'), "storage", 'DOLPHIN');
|
||||
args.push(`--user=${storageFolder}`);
|
||||
|
||||
args.push(`--config=Dolphin.Display.Fullscreen=${config.get('launchInFullscreen') ? "True" : "False"}`);
|
||||
args.push(`--config=Dolphin.General.ISOPath0=${path.join(config.get('downloadPath'), 'roms', 'gc')}`);
|
||||
args.push(`--config=Dolphin.General.ISOPath1=${path.join(config.get('downloadPath'), 'roms', 'wii')}`);
|
||||
args.push(`--config=Dolphin.Interface.ConfirmStop=False`);
|
||||
args.push(`--config=Dolphin.Interface.SkipNKitWarning=True`);
|
||||
args.push(`--config=Dolphin.Analytics.PermissionAsked=True`);
|
||||
|
||||
const savesPath = path.join(config.get('downloadPath'), "saves", 'DOLPHIN');
|
||||
|
||||
args.push(`--config=Dolphin.General.WiiSDCardPath=${path.join(savesPath, 'WiiSD.raw')}`);
|
||||
args.push(`--config=Dolphin.General.WiiSDCardSyncFolder=${path.join(savesPath, 'WiiSDSync')}`);
|
||||
args.push(`--config=Dolphin.GBA.SavesPath=${path.join(savesPath, 'GBA')}`);
|
||||
|
||||
if (ctx.autoValidCommand.metadata.romPath)
|
||||
{
|
||||
const args = ["--batch"];
|
||||
|
||||
const storageFolder = path.join(config.get('downloadPath'), "saves", 'DOLPHIN');
|
||||
|
||||
args.push(...[`--user=${storageFolder}`, `--exec=${ctx.autoValidCommand.metadata.romPath}`]);
|
||||
args.push(`--config=Dolphin.Display.Fullscreen=${config.get('launchInFullscreen') ? "True" : "False"}`);
|
||||
args.push(`--config=Dolphin.General.ISOPath0=${path.join(config.get('downloadPath'), 'roms', 'gc')}`);
|
||||
args.push(`--config=Dolphin.General.ISOPath1=${path.join(config.get('downloadPath'), 'roms', 'wii')}`);
|
||||
args.push(`--config=Dolphin.Interface.ConfirmStop=False`);
|
||||
args.push(`--config=Dolphin.Interface.SkipNKitWarning=True`);
|
||||
args.push(`--config=Dolphin.Analytics.PermissionAsked=True`);
|
||||
|
||||
return args;
|
||||
args.push("--batch");
|
||||
args.push(`--exec=${ctx.autoValidCommand.metadata.romPath}`);
|
||||
}
|
||||
|
||||
return args;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -9,72 +9,73 @@ import desc from './package.json';
|
|||
|
||||
export default class PCSX2Integration implements PluginType
|
||||
{
|
||||
emulator = "PCSX2";
|
||||
|
||||
load (ctx: PluginContextType)
|
||||
{
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap(desc.name, (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap({ name: desc.name, emulator: this.emulator }, (ctx) =>
|
||||
{
|
||||
if (ctx.emulator === 'PCSX2')
|
||||
{
|
||||
const baseCapabilities: EmulatorCapabilities[] = ["batch", "fullscreen", "saves", "states"];
|
||||
const baseCapabilities: EmulatorCapabilities[] = ["batch", "fullscreen", "saves", "states"];
|
||||
|
||||
if (ctx.source?.type === 'store')
|
||||
{
|
||||
return {
|
||||
id: desc.name,
|
||||
supportLevel: "full",
|
||||
capabilities: [...baseCapabilities, "resolution", "config"]
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return { id: desc.name, supportLevel: "partial", capabilities: [...baseCapabilities] };
|
||||
}
|
||||
if (ctx.source?.type === 'store')
|
||||
{
|
||||
return {
|
||||
id: desc.name,
|
||||
supportLevel: "full",
|
||||
capabilities: [...baseCapabilities, "resolution", "config"]
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return { id: desc.name, supportLevel: "partial", capabilities: [...baseCapabilities] };
|
||||
}
|
||||
});
|
||||
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise(desc.name, async (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise({ name: desc.name, emulator: this.emulator }, async (ctx) =>
|
||||
{
|
||||
if (ctx.autoValidCommand.emulator === 'PCSX2' && ctx.autoValidCommand.metadata.emulatorDir)
|
||||
const args: string[] = [];
|
||||
if (ctx.autoValidCommand.metadata.romPath)
|
||||
{
|
||||
const args = ["-batch"];
|
||||
if (config.get('launchInFullscreen'))
|
||||
{
|
||||
args.push("-fullscreen");
|
||||
}
|
||||
args.push(...["-bigpicture", "-portable", "--", ctx.autoValidCommand.metadata.romPath]);
|
||||
|
||||
if (ctx.autoValidCommand.emulatorSource === 'store' && !ctx.dryRun)
|
||||
{
|
||||
const configFileContents = await Bun.file(configFile).text();
|
||||
|
||||
const biosFolder = path.join(config.get('downloadPath'), "bios", 'PCSX2');
|
||||
const storageFolder = path.join(config.get('downloadPath'), "storage", 'PCSX2');
|
||||
const savesFolder = path.join(config.get('downloadPath'), "saves", 'PCSX2');
|
||||
|
||||
const view = {
|
||||
BIOS_PATH: biosFolder,
|
||||
SNAPSHOTS_PATH: path.join(storageFolder, 'snaps'),
|
||||
SAVE_STATES_PATH: path.join(savesFolder, 'states'),
|
||||
MEMORY_CARDS_PATH: path.join(savesFolder, 'saves'),
|
||||
CACHE_PATH: path.join(storageFolder, 'cache'),
|
||||
COVERS_PATH: path.join(storageFolder, 'covers'),
|
||||
TEXTURES_PATH: path.join(storageFolder, 'textures'),
|
||||
RECURSIVE_PATHS: path.join(config.get('downloadPath'), 'roms', 'PS2'),
|
||||
};
|
||||
|
||||
await Promise.all(Object.values(view).map(p => ensureDir(p)));
|
||||
|
||||
let pscx2Path = '';
|
||||
if (process.platform === 'win32')
|
||||
pscx2Path = path.join(ctx.autoValidCommand.metadata.emulatorDir, 'inis');
|
||||
else
|
||||
pscx2Path = path.join(ctx.autoValidCommand.metadata.emulatorDir, "PCSX2", 'inis');
|
||||
|
||||
await Bun.write(path.join(pscx2Path, 'PCSX2.ini'), Mustache.render(configFileContents, view));
|
||||
}
|
||||
|
||||
return args;
|
||||
args.push(ctx.autoValidCommand.metadata.romPath);
|
||||
args.push("-batch");
|
||||
}
|
||||
if (config.get('launchInFullscreen'))
|
||||
{
|
||||
args.push("-fullscreen");
|
||||
}
|
||||
args.push(...["-bigpicture", "-portable", "--"]);
|
||||
|
||||
if (ctx.autoValidCommand.emulatorSource === 'store' && ctx.autoValidCommand.metadata.emulatorDir && !ctx.dryRun)
|
||||
{
|
||||
const configFileContents = await Bun.file(configFile).text();
|
||||
|
||||
const biosFolder = path.join(config.get('downloadPath'), "bios", 'PCSX2');
|
||||
const storageFolder = path.join(config.get('downloadPath'), "storage", 'PCSX2');
|
||||
const savesFolder = path.join(config.get('downloadPath'), "saves", 'PCSX2');
|
||||
|
||||
const view = {
|
||||
BIOS_PATH: biosFolder,
|
||||
SNAPSHOTS_PATH: path.join(storageFolder, 'snaps'),
|
||||
SAVE_STATES_PATH: path.join(savesFolder, 'states'),
|
||||
MEMORY_CARDS_PATH: path.join(savesFolder, 'saves'),
|
||||
CACHE_PATH: path.join(storageFolder, 'cache'),
|
||||
COVERS_PATH: path.join(storageFolder, 'covers'),
|
||||
TEXTURES_PATH: path.join(storageFolder, 'textures'),
|
||||
RECURSIVE_PATHS: path.join(config.get('downloadPath'), 'roms', 'PS2'),
|
||||
};
|
||||
|
||||
await Promise.all(Object.values(view).map(p => ensureDir(p)));
|
||||
|
||||
let pscx2Path = '';
|
||||
if (process.platform === 'win32')
|
||||
pscx2Path = path.join(ctx.autoValidCommand.metadata.emulatorDir, 'inis');
|
||||
else
|
||||
pscx2Path = path.join(ctx.autoValidCommand.metadata.emulatorDir, "PCSX2", 'inis');
|
||||
|
||||
await Bun.write(path.join(pscx2Path, 'PCSX2.ini'), Mustache.render(configFileContents, view));
|
||||
}
|
||||
|
||||
return args;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -12,85 +12,86 @@ import { homedir } from "node:os";
|
|||
|
||||
export default class PCSX2Integration implements PluginType
|
||||
{
|
||||
emulator = "PPSSPP";
|
||||
|
||||
load (ctx: PluginContextType)
|
||||
{
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap(desc.name, (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunchSupport.tap({ name: desc.name, emulator: this.emulator }, (ctx) =>
|
||||
{
|
||||
if (ctx.emulator === 'PPSSPP')
|
||||
const baseCapabilities: EmulatorCapabilities[] = ["batch", "fullscreen", "saves", "states"];
|
||||
|
||||
if (ctx.source?.type === 'store')
|
||||
{
|
||||
const baseCapabilities: EmulatorCapabilities[] = ["batch", "fullscreen", "saves", "states"];
|
||||
|
||||
if (ctx.source?.type === 'store')
|
||||
{
|
||||
return {
|
||||
id: desc.name,
|
||||
supportLevel: "full",
|
||||
capabilities: [...baseCapabilities, "resolution", "config"]
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return { id: desc.name, supportLevel: "partial", capabilities: [...baseCapabilities] };
|
||||
}
|
||||
|
||||
return {
|
||||
id: desc.name,
|
||||
supportLevel: "full",
|
||||
capabilities: [...baseCapabilities, "resolution", "config"]
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return { id: desc.name, supportLevel: "partial", capabilities: [...baseCapabilities] };
|
||||
}
|
||||
});
|
||||
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise(desc.name, async (ctx) =>
|
||||
ctx.hooks.games.emulatorLaunch.tapPromise({ name: desc.name, emulator: this.emulator }, async (ctx) =>
|
||||
{
|
||||
if (ctx.autoValidCommand.emulator === 'PPSSPP' && ctx.autoValidCommand.metadata.emulatorDir)
|
||||
const args: string[] = [];
|
||||
if (ctx.autoValidCommand.metadata.romPath)
|
||||
{
|
||||
const args = [ctx.autoValidCommand.metadata.romPath, "--escape-exit", "--pause-menu-exit"];
|
||||
if (config.get('launchInFullscreen'))
|
||||
{
|
||||
args.push("--fullscreen");
|
||||
}
|
||||
|
||||
if (ctx.autoValidCommand.emulatorSource === 'store' && !ctx.dryRun)
|
||||
{
|
||||
let confPath: string | undefined = undefined;
|
||||
let controlsPath: string | undefined = undefined;
|
||||
|
||||
switch (process.platform)
|
||||
{
|
||||
case "win32":
|
||||
confPath = configFilePathWin32;
|
||||
controlsPath = configControlsFilePathWin32;
|
||||
break;
|
||||
case 'linux':
|
||||
confPath = configFilePathLinux;
|
||||
controlsPath = configControlsFilePathLinux;
|
||||
break;
|
||||
}
|
||||
|
||||
let ppssppPath = '';
|
||||
if (process.platform === 'win32')
|
||||
{
|
||||
ppssppPath = path.join(ctx.autoValidCommand.metadata.emulatorDir, 'memstick', 'PSP', 'SYSTEM');
|
||||
} else
|
||||
{
|
||||
//TODO: Use way to set custom memstick path when they support it
|
||||
ensureDir(path.join(homedir(), '.config', 'ppsspp'));
|
||||
ppssppPath = path.join(homedir(), '.config', 'ppsspp', 'PSP', 'SYSTEM');
|
||||
}
|
||||
|
||||
ensureDir(ppssppPath);
|
||||
|
||||
if (confPath)
|
||||
{
|
||||
const configFileContents = await Bun.file(confPath).text();
|
||||
await Bun.write(path.join(ppssppPath, 'ppsspp.ini'), Mustache.render(configFileContents, {}));
|
||||
}
|
||||
|
||||
if (controlsPath)
|
||||
{
|
||||
const controlsFileContents = await Bun.file(controlsPath).text();
|
||||
await Bun.write(path.join(ppssppPath, 'controls.ini'), Mustache.render(controlsFileContents, {}));
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
args.push(ctx.autoValidCommand.metadata.romPath);
|
||||
}
|
||||
|
||||
args.push("--escape-exit", "--pause-menu-exit");
|
||||
if (config.get('launchInFullscreen'))
|
||||
{
|
||||
args.push("--fullscreen");
|
||||
}
|
||||
|
||||
if (ctx.autoValidCommand.emulatorSource === 'store' && ctx.autoValidCommand.metadata.emulatorDir && !ctx.dryRun)
|
||||
{
|
||||
let confPath: string | undefined = undefined;
|
||||
let controlsPath: string | undefined = undefined;
|
||||
|
||||
switch (process.platform)
|
||||
{
|
||||
case "win32":
|
||||
confPath = configFilePathWin32;
|
||||
controlsPath = configControlsFilePathWin32;
|
||||
break;
|
||||
case 'linux':
|
||||
confPath = configFilePathLinux;
|
||||
controlsPath = configControlsFilePathLinux;
|
||||
break;
|
||||
}
|
||||
|
||||
let ppssppPath = '';
|
||||
if (process.platform === 'win32')
|
||||
{
|
||||
ppssppPath = path.join(ctx.autoValidCommand.metadata.emulatorDir, 'memstick', 'PSP', 'SYSTEM');
|
||||
} else
|
||||
{
|
||||
//TODO: Use way to set custom memstick path when they support it
|
||||
ensureDir(path.join(homedir(), '.config', 'ppsspp'));
|
||||
ppssppPath = path.join(homedir(), '.config', 'ppsspp', 'PSP', 'SYSTEM');
|
||||
}
|
||||
|
||||
ensureDir(ppssppPath);
|
||||
|
||||
if (confPath)
|
||||
{
|
||||
const configFileContents = await Bun.file(confPath).text();
|
||||
await Bun.write(path.join(ppssppPath, 'ppsspp.ini'), Mustache.render(configFileContents, {}));
|
||||
}
|
||||
|
||||
if (controlsPath)
|
||||
{
|
||||
const controlsFileContents = await Bun.file(controlsPath).text();
|
||||
await Bun.write(path.join(ppssppPath, 'controls.ini'), Mustache.render(controlsFileContents, {}));
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue