mirror of
https://github.com/italicsjenga/gba.git
synced 2024-12-23 19:01:30 +11:00
Mid January 0.3.1 fixes batch (#52)
* mGBA output wasn't resetting its length used * admonish people to stay updated * IWRAM fix * version bump * fix to work with latest nightly.
This commit is contained in:
parent
de62113e86
commit
e29453f8d8
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gba"
|
name = "gba"
|
||||||
description = "A crate (and book) for making GBA games with Rust."
|
description = "A crate (and book) for making GBA games with Rust."
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
authors = ["Lokathor <zefria@gmail.com>", "Thomas Winwood <twwinwood@gmail.com>"]
|
authors = ["Lokathor <zefria@gmail.com>", "Thomas Winwood <twwinwood@gmail.com>"]
|
||||||
repository = "https://github.com/rust-console/gba"
|
repository = "https://github.com/rust-console/gba"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,7 +1,5 @@
|
||||||
#![cfg_attr(not(test), no_std)]
|
#![cfg_attr(not(test), no_std)]
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
#![feature(const_int_wrapping)]
|
|
||||||
#![feature(const_int_rotate)]
|
|
||||||
#![feature(cfg_target_vendor)]
|
#![feature(cfg_target_vendor)]
|
||||||
#![allow(clippy::cast_lossless)]
|
#![allow(clippy::cast_lossless)]
|
||||||
#![deny(clippy::float_arithmetic)]
|
#![deny(clippy::float_arithmetic)]
|
||||||
|
@ -129,6 +127,15 @@ pub mod sram;
|
||||||
|
|
||||||
pub mod mgba;
|
pub mod mgba;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
/// This marks the end of the `.data` and `.bss` sections in IWRAM.
|
||||||
|
///
|
||||||
|
/// Memory in IWRAM _before_ this location is not free to use, you'll trash
|
||||||
|
/// your globals and stuff. Memory here or after is freely available for use
|
||||||
|
/// (careful that you don't run into your own stack of course).
|
||||||
|
static __bss_end: u8;
|
||||||
|
}
|
||||||
|
|
||||||
newtype! {
|
newtype! {
|
||||||
/// A color on the GBA is an RGB 5.5.5 within a `u16`
|
/// A color on the GBA is an RGB 5.5.5 within a `u16`
|
||||||
#[derive(PartialOrd, Ord, Hash)]
|
#[derive(PartialOrd, Ord, Hash)]
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
//! Special utils for if you're running on the mGBA emulator.
|
//! Special utils for if you're running on the mGBA emulator.
|
||||||
|
//!
|
||||||
|
//! Note that this assumes that you're using the very latest version (0.7-beta1
|
||||||
|
//! at the time of this writing). If you've got some older version of things
|
||||||
|
//! there might be any number of differences or problems.
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -6,6 +10,7 @@ use super::*;
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub enum MGBADebugLevel {
|
pub enum MGBADebugLevel {
|
||||||
|
/// Warning! This causes the emulator to halt emulation!
|
||||||
Fatal = 0,
|
Fatal = 0,
|
||||||
Error = 1,
|
Error = 1,
|
||||||
Warning = 2,
|
Warning = 2,
|
||||||
|
@ -51,9 +56,12 @@ impl MGBADebug {
|
||||||
pub fn send(&mut self, level: MGBADebugLevel) {
|
pub fn send(&mut self, level: MGBADebugLevel) {
|
||||||
if level == MGBADebugLevel::Fatal {
|
if level == MGBADebugLevel::Fatal {
|
||||||
Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Error as u16);
|
Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Error as u16);
|
||||||
|
|
||||||
|
// Note(Lokathor): A Fatal send causes the emulator to halt!
|
||||||
Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Fatal as u16);
|
Self::SEND_ADDRESS.write(Self::SEND_FLAG | MGBADebugLevel::Fatal as u16);
|
||||||
} else {
|
} else {
|
||||||
Self::SEND_ADDRESS.write(Self::SEND_FLAG | level as u16);
|
Self::SEND_ADDRESS.write(Self::SEND_FLAG | level as u16);
|
||||||
|
self.bytes_written = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue