Native macOS App (first version): dm/tools/mac_app.sh, docs/MAC.md

The Mac host can now be packaged as a double-click macOS App with keyboard, mouse and gamepad input, saves under Application Support, a first-launch resource-folder picker and save-before-quit. dm/tools/mac_app.sh builds it after ./setup.sh; by default the package carries no derived content and points at this machine's build outputs, so it runs only on the Mac that built it and needs only a local ad-hoc signature.

Nobody has played this version by hand yet; what was verified was run unattended. See docs/MAC.md.
This commit is contained in:
jhaizhou
2026-10-13 16:49:19 +08:00
parent e0f3bba1da
commit 6a2474d917
18 changed files with 548 additions and 23 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ with tempfile.TemporaryDirectory() as t:
tpad=os.path.join(t,'pad'); os.makedirs(tpad); PR={}
lp,lt=touch_layout.read_layout(romfs,pouch_layout.INV); o=os.path.join(tpad,'pad_inv.json'); open(o,'w',encoding='utf-8').write(touch_layout.pad_inv_rw(lt)); PR[lp.lower()]=o
for rel,gd in (('controller/pauselayoutgardenhd.json',1),('controller/pauselayouthd.json',0)): # 手柄版暂停菜单:一键重开 / 切换难度 / 存放 / 分享诊断日志 | Controller pause menu: one-tap restart / change difficulty / Deposit / Share Diagnostics
lp,lt=touch_layout.read_layout(romfs,rel); o=os.path.join(tpad,'pad_pause%d.json'%gd); open(o,'w',encoding='utf-8').write(touch_layout.pad_pause(lt,gd)); PR[lp.lower()]=o
lp,lt=touch_layout.read_layout(romfs,rel); o=os.path.join(tpad,'pad_pause%d.json'%gd); open(o,'w',encoding='utf-8').write(touch_layout.pad_pause(lt,gd,share=not os.environ.get('DM_OVERLAY_MAC'))); PR[lp.lower()]=o
# 大秘境面板(借「消息记录」面板外壳,touch_layout._rift_panel):手柄版同一份。少了它手柄模式点秘境门开出来的是空的原版消息记录面板、进不了秘境;手柄键在 dm_rift_ui.c
# Greater Rift panel (borrows the shell of the "Message Log" panel, touch_layout._rift_panel): the controller version uses the same one. Without it,
# tapping the Rift portal in controller mode opens an empty original Message Log panel and the Rift cannot be entered; the controller keys are in
+4 -3
View File
@@ -623,12 +623,13 @@ def _pause_no_help(ys, hide=('Help',), restart_y=None, extra=()):
# "Options" is fixed on the fourth row (y 653): when the original gamepad UI opens the pause menu the free cursor is at the centre of the screen and highlights whichever row it rests on, and pressing confirm straight away activates it -- the centre row may only be one whose press has no consequence.
# "Game Difficulty: N" = one press raises the player-count setting by 1 (back to 1 after 8), with the current setting shown on this row; "Deposit" = the same thing as the "Deposit" button of the inventory (the gamepad focus cannot reach that button), using the original string @strGoldDeposit.
# Button image height is 120 units: in the version with the Chronicle, seven rows are spaced evenly by 125 between the original first and last rows (278–1028); the classic version's own background only fits four rows, so the background of the Chronicle version (same size) is used and the first six rows are laid out with the same spacing (without the Chronicle row, the following row moves up)
def pad_pause(s, garden):
def pad_pause(s, garden, share=True): # share=False(Mac App):没有系统分享面板,「分享诊断日志」行不放 | share=False (Mac App): there is no system share sheet, so the "Share Diagnostics" row is left out
ex = (('TouchPadDiff', '', 278), ('TouchPadStore', '@strGoldDeposit', 778)); y = 278
if garden: s = _pause_no_help({'Settings': (428, 653), 'Exit': (728, 403), 'Chronicle': (1028, 903), 'MessageLog': (278, 1028)}, hide=('Help', 'LootFilter'), restart_y=528, extra=ex)(s)[0]
sh = lambda y0, y1: {'MessageLog': (y0, y1)} if share else {}; hs = () if share else ('MessageLog',)
if garden: s = _pause_no_help({'Settings': (428, 653), 'Exit': (728, 403), 'Chronicle': (1028, 903), **sh(278, 1028)}, hide=('Help', 'LootFilter') + hs, restart_y=528, extra=ex)(s)[0]
else:
s = _sub1(s, '"filename": "Controller/Panel/EscapeMenu/EscapeOptionsBGClassic"', '"filename": "Controller/Panel/EscapeMenu/EscapeOptionsBG"')
s = _pause_no_help({'Settings': (578, 653), 'Exit': (878, 403), 'MessageLog': (428, 903)}, hide=('Help',), restart_y=528, extra=ex)(s)[0]
s = _pause_no_help({'Settings': (578, 653), 'Exit': (878, 403), **sh(428, 903)}, hide=('Help',) + hs, restart_y=528, extra=ex)(s)[0]
# 「游戏难度:N」的字:菜单开着时游戏停拍、原版系统通知要关了菜单才出,所以当前档位直接写在这一行上——按钮自己不带字,上面叠一个同字体的文字控件,宿主写(dm_padmode.c)
# Text of "Game Difficulty: N": while the menu is open the game stops ticking and the original system notification only appears once the menu is closed,
# so the current setting is written directly on this row. The button itself carries no text; a text widget with the same font is stacked on top and