Add Nintendo 3DS port (Embedded Swift)#1
Merged
Merged
Conversation
Same shape as junkbot-swift's ports/3DS: the port's source/ compiles whole-module for armv6-none-none-eabi (the 3DS's ARM11), links against devkitPro's libctru, and packages as a homebrew .3dsx. The bottom screen is 320x240 -- the exact iPod Classic LCD -- and hosts the whole UI through a software rasterizer (RGB565 row-major canvas, transposed into the column-major LCD framebuffer by common/shim.c). The top screen shows a static controls banner. The desktop SwiftUI-subset core cannot compile under Embedded Swift (no Mirror, no untyped existentials, no Foundation, no Observation), so the port carries an embedded mini-core (source/ClassicCore.swift) that reproduces the same iPod semantics: menus with selection restore and scroll windowing, settings value rows, Notes-style wrapped text pages, Now Playing stacks with a live progress bar, and the eased navigation slide with a pinned status bar. The UI font is rasterized at build time from the host's Helvetica at 13 px (tools/gen_font.py, Pillow) into a 1bpp variable-width glyph table -- the same face and size the desktop Silica renderer resolves. Controls: D-pad/circle-pad up/down = click wheel, A = select, B = Menu (back), X/Y = play/pause, L/R = previous/next track, START = exit.
Builds ClassicUI.3dsx on macos-26 with devkitPro's 3ds-dev and a Swift nightly toolchain (release toolchains lack the armv6-none-none-eabi Embedded stdlib slice; nightlies are pruned, so the latest snapshot is resolved at run time -- same approach as junkbot-swift's 3DS CI), and uploads the .3dsx as a build artifact.
Replace the 1bpp thresholded glyph table with 8-bit antialiased coverage (tools/gen_font.py keeps Pillow's grayscale rasterization instead of hard-thresholding it away) and alpha-blend each glyph pixel against the destination in RGB565 (drawBytes/blend565). Glyphs draw one column past their advance so antialiased right edges aren't clipped. Font table grows from ~2.7 KB to ~21 KB; text now matches the desktop renderer's look instead of hard-stairstepped edges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds
ports/3DS: a Nintendo 3DS homebrew port of ClassicUI built with Embedded Swift, following the structure of junkbot-swift's ports/3DS — a Makefile-driven build targetingarmv6-none-none-eabi(the 3DS's ARM11 application core), linked against devkitPro's libctru and packaged as a.3dsxwith 3dsxtool/smdhtool.The bottom (touch) screen is 320×240 — the exact iPod Classic LCD — and hosts the whole UI through a software rasterizer into an RGB565 row-major canvas, transposed into the column-major LCD framebuffer by
common/shim.c. The top screen shows a static controls banner.Design
The desktop SwiftUI-subset core (
Sources/ClassicUICore) cannot compile under Embedded Swift: the view resolver requiresMirror(ViewBuilder tuple flattening), untyped existentials (any View), Foundation, and Observation, none of which exist on that target. Following the junkbot engine/port split, the port carries a small embedded mini-core (source/ClassicCore.swift) that reproduces the same iPod semantics:NavigationModel.swift)The UI font is rasterized at build time from the host's Helvetica at 13 px (
tools/gen_font.py, Pillow) into a 1bpp variable-width glyph table — the same face and size the desktop Silica renderer resolves.Renderer.swiftdeliberately imports nothing, so it also compiles on the host for pixel-level snapshot verification.Controls
Building
Requires devkitPro with 3ds-dev, a Swift toolchain whose Embedded stdlib ships an
armv6-none-none-eabislice, and python3 with Pillow. Verified: builds a 102 KBClassicUI.3dsx.Testing
.3dsxpackaging verified; not yet run on hardware or in an emulator.