Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compilation when on_gba is disabled #202

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/ci-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- { toolchain: nightly }
steps:
- uses: actions/checkout@v2

- name: Install Apt Dependencies
run: sudo apt-get update && sudo apt-get install binutils-arm-none-eabi

Expand All @@ -32,3 +32,10 @@ jobs:
toolchain: ${{ matrix.rust.toolchain }}
command: build
args: --examples

- name: Check compilation succeeds when not on the GBA (check to prevent complaints about missing things)
uses: actions-rs/cargo@v1
with:
toolchain: ${{ matrix.rust.toolchain }}
command: check
args: --no-default-features
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
//! break any of these assumptions, if you do that some or all of the code
//! provided by this crate may become unsound.

#[cfg(feature = "on_gba")]
use prelude::{GbaCell, IrqFn};

mod macros;
Expand Down Expand Up @@ -118,6 +119,7 @@ pub mod video;

/// The function pointer that the assembly runtime calls when an interrupt
/// occurs.
#[cfg(feature = "on_gba")]
pub static RUST_IRQ_HANDLER: GbaCell<Option<IrqFn>> = GbaCell::new(None);

/// Wraps a value to be aligned to a minimum of 4.
Expand Down
3 changes: 3 additions & 0 deletions src/video/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ impl TextEntry {
}

#[inline]
#[cfg(feature = "on_gba")]
pub fn video3_clear_to(c: Color) {
let u = u32::from(c.0) << 16 | u32::from(c.0);
unsafe {
Expand All @@ -350,6 +351,7 @@ impl Video3Bitmap {
}

#[inline]
#[cfg(feature = "on_gba")]
pub fn video3_set_bitmap(bitmap: &Video3Bitmap) {
let p = VIDEO3_VRAM.as_usize() as *mut _;
unsafe {
Expand All @@ -365,6 +367,7 @@ pub struct Video4Indexmap(pub [u8; 240 * 160]);
/// ## Panics
/// Only frames 0 and 1 exist, if `frame` is 2 or more this will panic.
#[inline]
#[cfg(feature = "on_gba")]
pub fn video4_set_indexmap(indexes: &Video4Indexmap, frame: usize) {
let p = VIDEO4_VRAM.get_frame(usize::from(frame)).unwrap().as_usize()
as *mut [u32; 8];
Expand Down
Loading