mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-26 00:56:38 +11:00
Use dma in objects
This commit is contained in:
parent
3710d9ad1c
commit
056a38703d
1 changed files with 11 additions and 5 deletions
|
@ -16,6 +16,7 @@ use super::palette16::Palette16;
|
||||||
use super::{Priority, DISPLAY_CONTROL};
|
use super::{Priority, DISPLAY_CONTROL};
|
||||||
use crate::agb_alloc::block_allocator::BlockAllocator;
|
use crate::agb_alloc::block_allocator::BlockAllocator;
|
||||||
use crate::agb_alloc::bump_allocator::StartEnd;
|
use crate::agb_alloc::bump_allocator::StartEnd;
|
||||||
|
use crate::dma;
|
||||||
use crate::fixnum::Vector2D;
|
use crate::fixnum::Vector2D;
|
||||||
|
|
||||||
use attributes::*;
|
use attributes::*;
|
||||||
|
@ -577,8 +578,11 @@ impl SpriteController {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
dest.as_ptr()
|
dma::dma_copy(
|
||||||
.copy_from_nonoverlapping(sprite.data.as_ptr(), sprite.data.len())
|
sprite.data.as_ptr().cast(),
|
||||||
|
dest.as_ptr().cast(),
|
||||||
|
sprite.data.len() / 2,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let storage = Storage::from_sprite_ptr(dest);
|
let storage = Storage::from_sprite_ptr(dest);
|
||||||
|
@ -610,9 +614,11 @@ impl SpriteControllerInner {
|
||||||
let dest = unsafe { PALETTE_ALLOCATOR.alloc(Palette16::layout())? };
|
let dest = unsafe { PALETTE_ALLOCATOR.alloc(Palette16::layout())? };
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
dest.as_ptr()
|
dma::dma_copy(
|
||||||
.cast::<u16>()
|
palette.colours.as_ptr().cast(),
|
||||||
.copy_from_nonoverlapping(palette.colours.as_ptr(), palette.colours.len())
|
dest.as_ptr().cast(),
|
||||||
|
palette.colours.len(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let storage = Storage::from_palette_ptr(dest);
|
let storage = Storage::from_palette_ptr(dest);
|
||||||
|
|
Loading…
Add table
Reference in a new issue