mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
feat: 全新 Korom 资源管理服务组件,优化内存占用
新增完整的程序本体资源管理与内存优化功能: 1. 新增背景图预处理服务,主进程将大图降采样至屏幕适配尺寸,避免全分辨率大图占用渲染进程大量内存 2. 实现资源注册表系统,支持引用计数、LRU自动逐出与释放回调 3. 新增资源与内存调试面板,可查看渲染进程JS堆、Electron进程内存与资源缓存状态 4. 修复进程内存信息API的单位与字段映射错误 5. 优化背景层缓存键避免过长dataURL,为Silk动画添加窗口隐藏时停帧逻辑减少GPU占用 6. 修复资源注册表类型适配问题并更新项目文档
This commit is contained in:
@@ -66,6 +66,7 @@ build/ ← generated by switch-icon.js (gitignored)
|
||||
- `electron/config.ts`: YAML config management (sparse save)
|
||||
- `electron/auth.ts`: Auth data persistence (JSON file)
|
||||
- `electron/core/`: @xmcl/* integrations (auth, installer, launcher, modrinth, instance)
|
||||
- `electron/core/background-image.ts`: 背景图处理服务(自选背景降采样/重编码,程序本体资源管理)
|
||||
- `electron/handlers/`: IPC handlers (config, auth, install, launch, mods, instance, background, task, system, window)
|
||||
|
||||
## Frontend notes
|
||||
@@ -73,6 +74,12 @@ build/ ← generated by switch-icon.js (gitignored)
|
||||
- `src/api/ipc.ts`: Core IPC utilities (invoke, onIpcEvent)
|
||||
- `src/api/*.ts`: API modules wrapping IPC calls
|
||||
- `src/stores/`: Zustand state management
|
||||
- `src/resources/`: 启动器程序本体「资源管理」子系统(与游戏无关):
|
||||
- `registry.ts` 资源注册表服务(acquire/release、引用计数、预算 + LRU 逐出、onRelease 释放回调)
|
||||
- `store.ts` 注册表 → zustand 镜像(调试面板消费)
|
||||
- `image.ts` 图片解码管线(按显示尺寸降采样)、`hooks.ts`/`ManagedImage.tsx` 复用组件(供列表缩略图)
|
||||
- 当前接线点:`BackgroundLayer` 把当前背景登记为 `background` 类资源;主进程 `background:prepare` 在进渲染端前压小大图
|
||||
- 监控入口:debug 页「资源与内存」(`debug-resource`)
|
||||
- `src/hooks/useTheme.ts`: Dark mode sync with Electron theme
|
||||
- `src/components/system/WindowControls.tsx`: Custom window controls (min/max/close), uses `<button>` with `WebkitAppRegion: "no-drag"`
|
||||
- `src/components/system/TitleBar.tsx`: Custom title bar with navigation, uses `WebkitAppRegion: "drag"`
|
||||
|
||||
Reference in New Issue
Block a user