Files
d2r-mobile/dm/ios/NativeHUD
2026-10-12 16:51:08 +08:00
..
2026-10-12 16:51:08 +08:00
2026-10-12 16:51:08 +08:00
2026-10-12 16:51:08 +08:00

NativeHUD — bottom bar

中文:README.zh-CN.md

The strip at the bottom of the screen in game: life orb, mana orb, belt, town portal, feature entry, experience bar. Most of it is not UI drawn by the shell itself but widgets of the game's original HUD (the always-present in-game UI), rearranged.

Arrangement

From left to right:

Stick area → statue holding the life orb → seven slots → statue holding the mana orb → skill area

The seven slots in the middle are, in order: difficulty (tapping it opens a selection strip of 1–8), four belt slots, town portal, feature entry (opens feature pages such as the inventory). Above the seven slots is the experience bar.

How it is done

No mod is used; it goes through the overlay RomFS (a small set of assets generated at build time and shipped with the app, which the game checks first when reading files; see "Overlay RomFS" in ../README.md). Two things are replaced in the overlay:

  • The gamepad HUD layout. The original layout has the structural patch kept in the repository, ../tools/touchrectv1_patch.json, applied to it (for the patch format see ../tools/layout_patch.py), and is then arranged into the layout above by ../tools/gen_hud_v4.py. For the original widgets only position and scale are changed: the life orb, mana orb and belt are as before; town portal uses the original sixth skill button, and the feature entry uses the original 升级 (Level Up) button. The original experience bar is moved off screen and is instead drawn by the shell according to the new geometry.
  • One base image: the stone strip, the seven slot frames and the statues on both sides, with the orb centres cut out so that the orb liquid the game itself draws shows through. The base image is written to an old texture path the game no longer reads, registered in dm/data/casc_overlay/borrowed_paths.tsv.

In the skill area on the right, the game's five original skill buttons still occupy their places in the layout, and the skill circles the shell draws with UIKit are stacked on top of them (../Sources/DmTouchOverlay.m). The experience bar, the difficulty number and the selection strip are also drawn by this layer, with art and geometry generated at build time.

What a finger tap on these widgets counts as is decided by the layout in ../Sources/dm_touch_controls.c (dm_tc_layout_make): it converts the tap areas onto the same set of seven slots according to the screen height, aligned with the picture.

What is in this directory

The repository holds only what we drew ourselves:

File Contents
touch/close.png The close button image for the top-right corner of the panel frame, drawn by ../tools/gen_close_btn.py

The base image, layout and glyphs derived from the original are not kept in the repository. At ../run.sh build time they are generated by ../tools/gen_assets.py from your game files into ../Gen/assets/NativeHUD/:

Output Contents Generation script
v4/base.png Base image ../tools/gen_hud_v4.py (geometry and art sources are in ../tools/hud_v4_design.py)
v4/hud.json The modified gamepad HUD layout Same as above
v4/hud_v4_ui/ Art and geometry used by the UIKit layer Same as above

After that, ../tools/gen_romfs_overlay.py writes the base image and the layout into the overlay ../Gen/romfs_overlay.

The art for the base image has two sources: when an unpacked directory of the PC version of the game is available (environment variable DM_PC_DATA), its 2x originals are used; otherwise the same-named art from the Switch version is upscaled, which is slightly blurry. For where to put it and how to set it, see "Generating assets from your game files" in ../../README.md.

How to check after making changes

dm/ios/tools/check_hud_gen.sh

It checks two things: that these generated files have not been committed to the repository; and, when the game files are present on your machine, it actually generates the bottom bar once and reports red if that fails. When your machine has no game files, the second item is skipped.