Exclude ctrlc
from bevy_app
for the Nintendo 3DS
#19453
Merged
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.
Background/motivation
The Nintendo 3DS is supported by the tier 3 rust target armv6k-nintendo-3ds. Bevy does not officially support the device, but as more of bevy becomes
no_std
compatible, more targets are being partially supported (e.g. GBA - #10680, https://github.com/bushrat011899/bevy_mod_gba) officially or not.The Nintendo 3DS runs Horizon as its OS which is unix-based, and the above target (at least partially) supports rust std. It makes sense that you would want to use it, since the 3DS supports things like filesystem reads and the system clock.
Problem
Unlike standard unix targets, armv6k-nintendo-3ds is not one that can use/build the the
ctrlc
dependency inbevy_app
which is enabled by the bevystd
cargo feature.Without the
std
feature flag, scheduled systems panic without providing another way for bevy to tick using theInstant
type (like you might for a GBA).Example
Solution
This PR simply excludes the
ctrlc
dependency and its uses inbevy_app
for the 3DS target (horizon
) with an addition to its existing feature flags.After this fix, we can use the
std
feature, and regular scheduled systems no longer panic because of missingInstant
(system clock) support.Testing
I compiled and ran a binary with the modified version of bevy, using
no_default_features
and feature flagsdefault_no_std
andstd
on a physical 3DS (classic) using homebrew andcargo-3ds
.Toolchain: armv6k-nintendo-3ds (nightly-2025-03-31)
Project reference: https://codeberg.org/pollyglot/hyperspace-dj/commit/440fc1018468885eed4c10c163f6bf3eefc64cb1
Considerations
It could be that we don't want to add specific exceptions inside bevy to support specific hardware with weird quirks inside general bevy code, but it's not obvious to me what we should use instead of an exception to (pre-existing) target cfg: every change here is merely an addition to a cfg that already checks for both the target family and the
std
flag.It is not clear to me if this PR is exhaustive enough to be considered an adequate solution for the larger goal of partially supporting the 3DS, but it seems to be a step in the right direction because it at least lets trivial App::run setups with scheduled systems work.