Skip to content

1.3.5.0

Latest

Choose a tag to compare

@ShirosakiMio ShirosakiMio released this 02 Dec 03:21
· 4 commits to main since this release

中文

✨ 新功能

  1. 新增 UI 缩放设置 (#2041):启动器设置新增「UI 缩放」档位,提供 75% / 100% / 125% / 150% / 175% / 200% 六档。新增 com.tungsten.fcllibrary.util.UiScale(SCALES 为上述六档,当前档位存于 SharedPreferences "launcher" 的 uiScale,默认 100):wrap(context) 在非 100% 时复制 Configuration 并把 densityDpi 按档位比例放大(createConfigurationContext),界面内全部 dp/sp 尺寸随之等比缩放;默认 100% 时原样返回、不包装,未调整过设置的设备保持系统原生显示效果。FCLActivity.attachBaseContext 改为 UiScale.wrap(LocaleUtils.setLanguage(base)),与语言切换共用同一条 context 包装链;LauncherSettingPage 切换档位后调用 getActivity().recreate() 立即生效。positionOf 对未知档位回退到 100% 档,并修正了钳制逻辑误伤第一档、选 75% 后设置页回显为 100% 的问题。

⚡ 优化

  1. 控制布局加载与启动扫描速度 (#2031):Controllers 的布局列表此前注册了元素 extractor(observableArrayList(controller -> new Observable[]{controller})),任意布局的任意属性变化都会触发全量保存——把列表内所有布局(包括按键数据尚未加载的轻量对象)完整解析后逐个写盘,因此启动和切换布局时随布局总数线性变慢。现改为不注册元素监听的普通 ObservableList,失效只由增删元素触发:新增的 onControllersChanged 只对新增布局调用自身 saveToDisk(),删除布局交给 cleanupOrphanControllers 把磁盘上不在内存列表的 json 改名 .bak 保留。新增 LayoutMetadataScanner 按字节扫描布局文件:跳过 UTF-8 BOM,按括号深度整体跳过 viewData 而不逐 token 解析,仅当布局 id 命中目标时才截取原文交给 ControlViewGroup.ViewData.Serializer;buttonStyles / directionStyles 同样只保留原文,由 Controller.parseLightweight0 解析并注册样式。parseLightweight 与 loadViewGroupData 由此不再遍历整份文件,加载耗时不再随布局内按键数量增长。controllerVersion 未声明时的哨兵值由 Constants.CONTROLLER_VERSION 改为 Integer.MIN_VALUE,显式声明的负值按原值保留交由版本校验处理。组复制 / 新建 / 改名 / 删除 / 上下移动(GameMenu、ViewGroupAdapter、ViewGroupDialog)与 Controller.upgrade() 补充显式落盘,不再依赖已移除的列表兜底链;新增 LayoutMetadataScannerTest 覆盖扫描行为。

🐛 修复

  1. 打开快捷输入等启动器弹窗触发游戏暂停 (#2051):JVMActivity.onWindowFocusChanged 此前把窗口焦点原样经 notifySdlWindowFocus 转发给 SDL,而快捷输入、发送键值等启动器弹窗会短暂抢走窗口焦点,游戏据此进入「失去焦点时暂停」弹出暂停菜单。现 SDL 焦点改为跟随活动的前后台状态:新增 sdlWindowFocused 字段记录上次状态,onWindowFocusChanged 仅在重新获得焦点时转发获焦,onPause / onResume 分别转发失焦 / 获焦,setSdlWindowFocus 对重复状态去重,且仅在 SdlBridge.getSdlEnabled() 开启时调用 SDLActivity.nativeFocusChanged。
  2. 控件下载页截图被拉伸裁剪 (#2044):截图此前直接以 ImageView 作为 ListView 的 item 并 override(Target.SIZE_ORIGINAL) 按原图尺寸加载,2400x1080 等大图会把 item 撑到原始高度、与列表布局错位并被裁剪。新增 item_controller_screenshot.xml(match_parent 宽、wrap_content 高,adjustViewBounds + fitCenter),ControllerScreenshotAdapter 改为 inflate 该布局并以 tag 复用 ImageView;Glide 解码上限设为 1280 并显式指定 DownsampleStrategy.FIT_CENTER——默认的 CENTER_OUTSIDE 策略在放大系数大于 1 时不会降采样,反而把 2400x1080 放大到约 2844x1280,加上 FIT_CENTER 后实际解码为 1280x576,解码上限与内存优化才真正生效。

English

✨ New Features

  1. New UI Scale setting (#2041): Launcher settings gained a "UI Scale" option with six levels: 75% / 100% / 125% / 150% / 175% / 200%. The new com.tungsten.fcllibrary.util.UiScale object stores the level in SharedPreferences "launcher" under uiScale (default 100); wrap(context) copies the Configuration and scales densityDpi by the level ratio (createConfigurationContext) whenever it is not 100%, so every dp/sp dimension scales proportionally, while the default 100% returns the context untouched so devices that never changed the setting keep the system-native display. FCLActivity.attachBaseContext now runs UiScale.wrap(LocaleUtils.setLanguage(base)), sharing the same context-wrapping chain as language switching; LauncherSettingPage calls getActivity().recreate() right after a change so it applies immediately. positionOf falls back to the 100% level for unknown values, and its clamp no longer treats the first level specially, fixing the setting page showing 100% after 75% was chosen.

⚡ Improvements

  1. Control layout loading and startup scanning speed (#2031): The layout list in Controllers used to register an element extractor (observableArrayList(controller -> new Observable[]{controller})), so any property change of any layout triggered a full save that parsed every layout in the list (including lightweight objects whose key data was never loaded) and wrote each one back to disk, making startup and layout switching scale linearly with the number of layouts. It is now a plain ObservableList without element listeners, so invalidation only comes from element additions and removals: the new onControllersChanged saves only the newly added layout through its own saveToDisk(), and removals are handled by cleanupOrphanControllers, which renames json files on disk that are no longer in the list to .bak. The new LayoutMetadataScanner scans layout files byte by byte: it skips a UTF-8 BOM, skips viewData wholesale by bracket depth instead of parsing it token by token, and hands the raw slice to ControlViewGroup.ViewData.Serializer only when the target layout id matches; buttonStyles / directionStyles are likewise kept raw and parsed and registered by Controller.parseLightweight0. parseLightweight and loadViewGroupData therefore no longer walk the whole file, and loading time no longer grows with the number of keys inside a layout. The sentinel for an undeclared controllerVersion changed from Constants.CONTROLLER_VERSION to Integer.MIN_VALUE, and explicitly declared negative values are kept as-is for version validation. Group copy / create / rename / delete / move up or down (GameMenu, ViewGroupAdapter, ViewGroupDialog) and Controller.upgrade() now save explicitly instead of relying on the removed list fallback; a new LayoutMetadataScannerTest covers the scanner.

🐛 Bug Fixes

  1. Opening launcher dialogs such as quick input pausing the game (#2051): JVMActivity.onWindowFocusChanged used to forward the window focus to SDL through notifySdlWindowFocus unchanged, and launcher dialogs such as quick input or send key briefly steal window focus, so the game took the focus loss as a pause trigger and opened the pause menu. SDL focus now follows the activity's foreground state instead: a new sdlWindowFocused field tracks the last state, onWindowFocusChanged forwards only a regained focus, onPause / onResume forward loss / gain respectively, setSdlWindowFocus ignores duplicate states, and SDLActivity.nativeFocusChanged is only called when SdlBridge.getSdlEnabled() is on.
  2. Screenshots stretched and cropped on the controller download page (#2044): The download page used a bare ImageView as the ListView item and loaded at override(Target.SIZE_ORIGINAL), so large screenshots such as 2400x1080 stretched the item to the original height, misaligning it with the list and cropping it. A new item_controller_screenshot.xml (match_parent width, wrap_content height, adjustViewBounds and fitCenter) is inflated by ControllerScreenshotAdapter and its ImageView is reused through the view tag; Glide decoding is capped at 1280 with an explicit DownsampleStrategy.FIT_CENTER, because the default CENTER_OUTSIDE strategy does not downsample when the scale factor is above 1 and actually enlarged the 2400x1080 image to about 2844x1280, whereas FIT_CENTER produces 1280x576 and makes the cap and memory savings effective.