Skip to content

Wood: optional battery icon on the top screen - #2703

Merged
RocketRobz merged 1 commit into
DS-Homebrew:masterfrom
therenow9:feat/wood-battery-icon
Oct 27, 2026
Merged

RocketRobz merged 1 commit into
DS-Homebrew:masterfrom
therenow9:feat/wood-battery-icon

Conversation

@therenow9

Copy link
Copy Markdown
Contributor

What's changed?

Wood themes can show the battery level on the top screen, like the DSi and 3DS themes already do. A theme opts in with a new uisettings.ini section and one image:

[battery]
show = 1
x = 228
y = 3

battery.bmp (in the theme folder, next to brightness.bmp) holds 8 frames of equal height, stacked vertically: frames 0-3 are 1-4 bars, frames 4-7 the same while charging. Pure black (0,0,0) is transparent. A bottom-up BMP at 1, 8, 16, 24 or 32 bits works. Any other format is skipped, so nothing unfilled is drawn.

The section is [battery], not [battery icon]. The old akmenu used [battery icon] for a bottom-screen icon built from other files, so old themes that still carry it stay unaffected.

  • drawBattery() reads sys().batteryStatus() (the same levels the DSi theme maps: 0xF/0xB/0x7/lower → 4/3/2/1 bars, bit 7 = charging) and redraws only when the frame changes. It is called from bgOperations() next to the calendar parts.
  • It is independent of showCalendar and skipped in macro mode, like box art. Themes without the section are unchanged.
  • If the icon would fall off the screen, nothing is drawn.
  • Changes are in graphics.cpp, graphics.h and main.cpp (+82/−4).
  • Theme authors should keep it outside a [box art] panel, because the panel repaints its whole rectangle.
  • This touches the same spots as the free-space and loader-badge PRs I'm opening alongside this one. Whichever merges second needs a small rebase; I'll do it.

Where have you tested it?

New Nintendo 3DS XL with a DSpico, TWiLight on the console SD (v27.25.1 + #2698 + this change):

  • a Wood theme with [battery] shows the bars at the level, and the charging frames while on the charger;
  • a theme without the section (CD - Indigo) is unchanged.

On battery, and on the charger:

Wood theme with the battery icon on the top screen, on battery Wood theme with the battery icon on the top screen, charging


Pull Request status

  • This PR has been tested using the latest version of devkitARM and libnds.

Built in the devkitpro/devkitarm:20241104 Docker image that the nightly workflow uses (no new warnings).

The code was written with help from an AI assistant (Claude Code). I reviewed it and tested it on my console.

A theme opts in with a [battery] section and battery.bmp: 8 frames,
1-4 bars, then 1-4 bars while charging. The frame follows
sys().batteryStatus() and is redrawn only when it changes. A new frame
is shown once it has held for 1 second (60 frames), so a single odd
reading (seen near a full charge) doesn't make the icon blink. Skipped
in macro mode; themes without the section are unchanged.
@therenow9
therenow9 force-pushed the feat/wood-battery-icon branch from 5e31590 to a67609b Compare October 27, 2026 23:42
@therenow9

Copy link
Copy Markdown
Contributor Author

@RocketRobz the merge issues are now resolved

@RocketRobz
RocketRobz merged commit 2effc55 into DS-Homebrew:master Oct 27, 2026
1 check passed
@therenow9
therenow9 deleted the feat/wood-battery-icon branch October 27, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants