feat(saves): add local save selection and editing
This commit is contained in:
1 parent
2b1da24263
commit
073a907617
18 files changed
+634
-4
No files matched your search
@@ -13,6 +13,7 @@ import { createCopyDraft, listCopies, readInstallRecord, renameCopy, setCurrentC
|
||||
import { readInstalledLab } from '../services/launch/lab-handoff.ts';
|
||||
import { getLaunchState, openServerStatus, startLaunch, stopLaunch } from '../services/launch/launch-controller.ts';
|
||||
import { resourcePaths } from '../services/resources/resource-paths.ts';
|
||||
import { createSave, getSaveDetails, getSaveList, saveWriteInProgress, selectSave, setSaveCurrencies } from '../services/saves/manage-saves.ts';
|
||||
import { broadcast, handle } from './register.ts';
|
||||
|
||||
/** Registers the handler of every contract channel. One line per channel; the work is in services/. */
|
||||
@@ -96,16 +97,23 @@ export function registerIpcHandlers(): void {
|
||||
|
||||
handle('copies:maintenanceInfo', ({ id }) => maintenanceInfo(id));
|
||||
handle('copies:maintain', async (request) => {
|
||||
if (saveWriteInProgress()) throw new AppError('maintenance_busy');
|
||||
const updated = await maintainCopy(request, (progress) => broadcast('event:copy-maintenance', progress));
|
||||
broadcast('event:copies-changed', updated);
|
||||
return updated;
|
||||
});
|
||||
handle('copies:cancelMaintenance', () => cancelMaintenance());
|
||||
|
||||
handle('saves:list', ({ copyId }) => getSaveList(copyId));
|
||||
handle('saves:details', ({ copyId, userId }) => getSaveDetails(copyId, userId));
|
||||
handle('saves:setCurrent', ({ copyId, userId }) => selectSave(copyId, userId));
|
||||
handle('saves:create', (request) => createSave(request));
|
||||
handle('saves:editCurrencies', ({ copyId, userId, values }) => setSaveCurrencies(copyId, userId, values));
|
||||
|
||||
handle('launch:getState', () => getLaunchState());
|
||||
handle('launch:getLabInfo', () => readInstalledLab().catch(() => null));
|
||||
handle('launch:start', () => {
|
||||
if (maintenanceInProgress()) throw new AppError('maintenance_busy');
|
||||
if (maintenanceInProgress() || saveWriteInProgress()) throw new AppError('maintenance_busy');
|
||||
return startLaunch((state) => broadcast('event:launch-state', state));
|
||||
});
|
||||
handle('launch:stop', async () => { await stopLaunch(); });
|
||||
|
||||
Reference in new issue
Block a user