mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-26 00:56:38 +11:00
fix object in opt-level 0
not sure why it didn't work before
This commit is contained in:
parent
f00e9e58ca
commit
6508885193
1 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
use super::DISPLAY_CONTROL;
|
use super::DISPLAY_CONTROL;
|
||||||
|
use crate::memory_mapped::MemoryMapped1DArray;
|
||||||
|
|
||||||
const OBJECT_MEMORY_STANDARD: *mut [ObjectAttributeStandard; 128] = 0x0700_0000 as *mut [_; 128];
|
const OBJECT_MEMORY_STANDARD: MemoryMapped1DArray<u32, 256> =
|
||||||
|
unsafe { MemoryMapped1DArray::new(0x0700_0000) };
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct ObjectControl {}
|
pub struct ObjectControl {}
|
||||||
|
@ -37,8 +39,6 @@ impl ObjectStandard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(packed)]
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub struct ObjectAttributeStandard {
|
pub struct ObjectAttributeStandard {
|
||||||
low: u32,
|
low: u32,
|
||||||
high: u32,
|
high: u32,
|
||||||
|
@ -46,8 +46,8 @@ pub struct ObjectAttributeStandard {
|
||||||
|
|
||||||
impl ObjectAttributeStandard {
|
impl ObjectAttributeStandard {
|
||||||
unsafe fn commit(&self, index: usize) {
|
unsafe fn commit(&self, index: usize) {
|
||||||
(&mut (*OBJECT_MEMORY_STANDARD)[index] as *mut ObjectAttributeStandard)
|
OBJECT_MEMORY_STANDARD.set(index * 2, self.low);
|
||||||
.write_volatile(*self)
|
OBJECT_MEMORY_STANDARD.set(index * 2 + 1, self.high);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_hflip(&mut self, hflip: bool) {
|
pub fn set_hflip(&mut self, hflip: bool) {
|
||||||
|
@ -108,7 +108,7 @@ impl ObjectControl {
|
||||||
pub unsafe fn clear_objects(&mut self) {
|
pub unsafe fn clear_objects(&mut self) {
|
||||||
let mut o = ObjectAttributeStandard::new();
|
let mut o = ObjectAttributeStandard::new();
|
||||||
o.set_mode(Mode::Hidden);
|
o.set_mode(Mode::Hidden);
|
||||||
for index in 0..(*OBJECT_MEMORY_STANDARD).len() {
|
for index in 0..128 {
|
||||||
o.commit(index);
|
o.commit(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue