feat(launcher)!: manage multiple game copies

BREAKING CHANGE: The launcher stores copy registrations in copies.json. Installations recorded only in install.json must be registered again.
This commit is contained in:
N0VAN0M4LY committed 2026-11-29 15:14:41 +08:00
1 parent e41b73aaa3
commit 7d68dc0548
24 files changed
+408 -97

No files matched your search

+2
View File
@@ -12,6 +12,8 @@ export const IPC_CHANNEL_PREFIXES = [
'dialog:',
/** Installing the offline version: looking at the chosen folders, copying, patching. */
'install:',
/** Listing and managing installed copies. */
'copies:',
/** Starting and stopping the active copy. */
'launch:',
/** The launcher's own settings. */
+21 -1
View File
@@ -1,6 +1,9 @@
import { z } from 'zod';
import { BackgroundPictureSchema } from '../schemas/background.ts';
import {
CopiesSchema,
CopyIdSchema,
CopyNameSchema,
FolderSizeSchema,
GameFolderInspectionSchema,
InstallProgressSchema,
@@ -59,6 +62,10 @@ export const ipcContract = {
/** The chosen folder, or null when the player cancelled. */
output: z.object({ path: z.string().nullable() }),
},
'install:prepareCopy': {
input: z.void(),
output: z.object({ id: CopyIdSchema, dataPath: z.string() }),
},
'install:inspectGameFolder': {
input: z.object({ path: z.string().min(1) }),
output: GameFolderInspectionSchema,
@@ -88,13 +95,25 @@ export const ipcContract = {
},
'install:getRecord': {
input: z.void(),
output: z.object({ record: InstallRecordSchema.nullable(), defaultDataPath: z.string() }),
output: z.object({ record: InstallRecordSchema.nullable() }),
},
'install:listFeatures': {
/** Every feature the patches cover; which of them a copy lacks is in its install record. */
input: z.void(),
output: z.array(PatchFeatureSchema),
},
'copies:list': {
input: z.void(),
output: CopiesSchema,
},
'copies:setCurrent': {
input: z.object({ id: CopyIdSchema }),
output: CopiesSchema,
},
'copies:rename': {
input: z.object({ id: CopyIdSchema, name: CopyNameSchema }),
output: CopiesSchema,
},
'launch:getState': {
input: z.void(),
output: LaunchStateSchema,
@@ -137,6 +156,7 @@ export const ipcEvents = {
'event:settings-changed': SettingsSchema,
'event:install-progress': InstallProgressSchema,
'event:launch-state': LaunchStateSchema,
'event:copies-changed': CopiesSchema,
} as const;
export type IpcChannel = keyof typeof ipcContract;