Skip to content

Commit

Permalink
Fixed compilation when on_gba is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zesterer committed Dec 17, 2024
1 parent 7cd5dd2 commit 578890e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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

0 comments on commit 578890e

Please sign in to comment.