feat(decals): import a decal cache for each copy

Store the chosen cache in the copy data directory and use it for future builds. Restore the placeholder index when the copy has no available cache.

Verified type checks, the launcher build, a temporary .43 build, and the import and replacement flow from the Windows package.
This commit is contained in:
N0VAN0M4LY committed 2026-11-30 09:59:14 +08:00
1 parent 10839f050f
commit 1e3843b7e9
18 files changed
+304 -53

No files matched your search

+2
View File
@@ -38,6 +38,8 @@ export const APP_ERROR_CODES = [
'maintenance_failed',
'maintenance_source_changed',
'copy_location_in_use',
'decal_source_invalid',
'decal_import_failed',
'launch_no_copy',
'launch_busy',
'launch_failed',
+4
View File
@@ -118,6 +118,10 @@ export const ipcContract = {
input: z.object({ id: CopyIdSchema, name: CopyNameSchema }),
output: CopiesSchema,
},
'copies:setDecalSource': {
input: z.object({ id: CopyIdSchema, path: z.string().min(1).nullable() }),
output: CopiesSchema,
},
'copies:maintenanceInfo': {
input: z.object({ id: CopyIdSchema }),
output: MaintenanceInfoSchema,
+3 -1
View File
@@ -86,6 +86,7 @@ const InstallChoicesSchema = z.object({
name: CopyNameSchema,
/** Where the local server keeps saves, caches and logs. */
dataPath: z.string().min(1),
decalSourcePath: z.string().min(1).optional(),
/** The player confirmed installing into a Steam library after the warning. */
steamLibraryConfirmed: z.boolean(),
/** The player chose to go on without the features of the unavailable patches. */
@@ -109,7 +110,7 @@ export const InstallRequestSchema = z.discriminatedUnion('method', [
]);
export type InstallRequest = z.output<typeof InstallRequestSchema>;
export const INSTALL_PHASES = ['checking', 'measuring', 'verifying', 'copying', 'backing-up', 'recording'] as const;
export const INSTALL_PHASES = ['checking', 'importing-decals', 'measuring', 'verifying', 'copying', 'backing-up', 'recording'] as const;
export const InstallProgressSchema = z.object({
phase: z.enum(INSTALL_PHASES),
@@ -137,6 +138,7 @@ export const InstallRecordSchema = z.object({
installedAt: z.string(),
lastCheckedAt: z.string().optional(),
currentSaveId: z.string().regex(/^\d+$/).optional(),
decalCacheId: z.uuid().optional(),
/** Relative paths read from the installation source during the last copy or update. */
sourceFiles: z.array(z.string().min(1)).optional(),
/** Relative resource paths linked to the source and detached on a version update. */