Skip to content

Wood: redraw the battery after the free-space line, allow a full-width box - #2706

Merged
RocketRobz merged 1 commit into
DS-Homebrew:masterfrom
therenow9:fix/wood-free-space-battery
Oct 28, 2026
Merged

RocketRobz merged 1 commit into
DS-Homebrew:masterfrom
therenow9:fix/wood-free-space-battery

Conversation

@therenow9

Copy link
Copy Markdown
Contributor

What's changed?

Two small follow-ups to the free-space line (#2704) and the battery icon (#2703).

The battery disappeared after R when it sits inside the free-space box. bgOperations() calls drawFreeSpace() and then drawBattery(). When R switches between SD and the flashcard (or a file is deleted from the menu), drawFreeSpace() repaints its whole rectangle, which also covers a battery placed inside it. drawBattery() still had that frame marked as drawn (loadedBattery), so it returned early and the icon stayed gone until the battery level changed. drawFreeSpace() now sets loadedBattery = -1 after it repaints, so the icon is drawn again in the same pass. loadedBattery moves up a few lines so drawFreeSpace() can see it. Themes that keep the battery outside the box are unaffected (the redraw is the same frame again).

The free-space box can be full width. The box had to satisfy x+w < 256 and y+h < 192, so a 256-wide box was refused. It is now <= 256 / <= 192, the same bound as [box art]. printTopBox() only writes inside x..x+w-1 and y..y+h-1, so the box still stays on screen.

One file, graphics.cpp, +3/−2.

Where have you tested it?

New Nintendo 3DS XL with a DSpico, TWiLight on the console SD (master a529f31b0 modules; this build's akmenu.srldr only), themes DSpico Dark and DSpico Light, whose battery sits in the free-space banner at the top:

  • before the change (master): after R, the battery was gone on both SD and DSpico until the level changed (photos below);
  • with the change: the battery stays through repeated R presses, in both themes;
  • with the change, deleting a file from the menu (X → Delete), which also repaints the box: the battery stays.

Left: the banner as it should look, with the battery in the top-right (master, SD). Middle and right: master after R, the battery is missing on the DSpico and on SD.

battery-shown-sd-0406 battery-bug-dspico-0406 battery-bug-sd-0405

With this change:

battery-fixed-after-r.mp4

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: 96 warnings, the same set as master built the same way, so none are new.

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

…h box

The free-space line repaints its whole box when R switches cards or a
file is deleted. A theme that puts the battery inside that box lost
the icon until the battery level next changed, because drawBattery()
still had the frame marked as drawn. drawFreeSpace() now clears that
mark after it repaints, so the icon comes back in the same pass.

The free-space box may also reach the screen edge (x+w <= 256,
y+h <= 192), the same bound [box art] uses.
@RocketRobz
RocketRobz merged commit 524377b into DS-Homebrew:master Oct 28, 2026
1 check passed
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