cargo: fmt
Former-commit-id: 38a2a0b0d84bb995f4cc30696278d4883fe5b4dc Former-commit-id: 9867e49431810c5d48cb5ccbf5d18e2d01e428f3
This commit is contained in:
parent
9f5d376e4a
commit
0d14f4c2e7
|
@ -1,10 +1,10 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use log::debug;
|
use ansi_term::Style;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use bit::BitIndex;
|
use bit::BitIndex;
|
||||||
|
use log::debug;
|
||||||
use num::FromPrimitive;
|
use num::FromPrimitive;
|
||||||
use ansi_term::{Style};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use rustboyadvance_utils::{Shared, WeakPointer};
|
use rustboyadvance_utils::{Shared, WeakPointer};
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ use super::reg_string;
|
||||||
|
|
||||||
use super::{arm::ArmCond, psr::RegPSR, Addr, CpuMode, CpuState};
|
use super::{arm::ArmCond, psr::RegPSR, Addr, CpuMode, CpuState};
|
||||||
|
|
||||||
|
|
||||||
use super::memory::{MemoryAccess, MemoryInterface};
|
use super::memory::{MemoryAccess, MemoryInterface};
|
||||||
use MemoryAccess::*;
|
use MemoryAccess::*;
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,9 @@ fn detect_backup_type(bytes: &[u8]) -> Option<BackupType> {
|
||||||
|
|
||||||
for i in 0..5 {
|
for i in 0..5 {
|
||||||
let search = TwoWaySearcher::new(ID_STRINGS[i].as_bytes());
|
let search = TwoWaySearcher::new(ID_STRINGS[i].as_bytes());
|
||||||
if let Some(_) = search.search_in(bytes) { return Some(BackupType::from_u8(i as u8).unwrap()) }
|
if let Some(_) = search.search_in(bytes) {
|
||||||
|
return Some(BackupType::from_u8(i as u8).unwrap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,10 @@ use super::sysbus::consts::*;
|
||||||
pub const EEPROM_BASE_ADDR: u32 = 0x0DFF_FF00;
|
pub const EEPROM_BASE_ADDR: u32 = 0x0DFF_FF00;
|
||||||
|
|
||||||
fn is_gpio_access(addr: u32) -> bool {
|
fn is_gpio_access(addr: u32) -> bool {
|
||||||
matches!(addr & 0x1ff_ffff, GPIO_PORT_DATA | GPIO_PORT_DIRECTION | GPIO_PORT_CONTROL)
|
matches!(
|
||||||
|
addr & 0x1ff_ffff,
|
||||||
|
GPIO_PORT_DATA | GPIO_PORT_DIRECTION | GPIO_PORT_CONTROL
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BusIO for Cartridge {
|
impl BusIO for Cartridge {
|
||||||
|
|
|
@ -18,7 +18,7 @@ use super::timer::Timers;
|
||||||
|
|
||||||
use super::sound::interface::DynAudioInterface;
|
use super::sound::interface::DynAudioInterface;
|
||||||
|
|
||||||
use arm7tdmi::{Arm7tdmiCore};
|
use arm7tdmi::Arm7tdmiCore;
|
||||||
use rustboyadvance_utils::Shared;
|
use rustboyadvance_utils::Shared;
|
||||||
|
|
||||||
pub struct GameBoyAdvance {
|
pub struct GameBoyAdvance {
|
||||||
|
@ -214,7 +214,8 @@ impl GameBoyAdvance {
|
||||||
pub fn frame(&mut self) {
|
pub fn frame(&mut self) {
|
||||||
static mut OVERSHOOT: usize = 0;
|
static mut OVERSHOOT: usize = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
OVERSHOOT = CYCLES_FULL_REFRESH.saturating_sub(self.run::<false>(CYCLES_FULL_REFRESH - OVERSHOOT));
|
OVERSHOOT = CYCLES_FULL_REFRESH
|
||||||
|
.saturating_sub(self.run::<false>(CYCLES_FULL_REFRESH - OVERSHOOT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +223,8 @@ impl GameBoyAdvance {
|
||||||
fn frame_interruptible(&mut self) {
|
fn frame_interruptible(&mut self) {
|
||||||
static mut OVERSHOOT: usize = 0;
|
static mut OVERSHOOT: usize = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
OVERSHOOT = CYCLES_FULL_REFRESH.saturating_sub(self.run::<true>(CYCLES_FULL_REFRESH - OVERSHOOT));
|
OVERSHOOT = CYCLES_FULL_REFRESH
|
||||||
|
.saturating_sub(self.run::<true>(CYCLES_FULL_REFRESH - OVERSHOOT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@ use std::sync::{Arc, Condvar, Mutex};
|
||||||
|
|
||||||
use arm7tdmi::{
|
use arm7tdmi::{
|
||||||
gdb::wait_for_connection,
|
gdb::wait_for_connection,
|
||||||
gdbstub::{
|
gdbstub::{conn::ConnectionExt, stub::GdbStub},
|
||||||
conn::ConnectionExt,
|
|
||||||
stub::GdbStub,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{GBAError, GameBoyAdvance};
|
use crate::{GBAError, GameBoyAdvance};
|
||||||
|
|
|
@ -111,12 +111,8 @@ impl BusIO for IoDevices {
|
||||||
REG_WIN1H => (io.gpu.win1.left as u16) << 8 | (io.gpu.win1.right as u16),
|
REG_WIN1H => (io.gpu.win1.left as u16) << 8 | (io.gpu.win1.right as u16),
|
||||||
REG_WIN0V => (io.gpu.win0.top as u16) << 8 | (io.gpu.win0.bottom as u16),
|
REG_WIN0V => (io.gpu.win0.top as u16) << 8 | (io.gpu.win0.bottom as u16),
|
||||||
REG_WIN1V => (io.gpu.win1.top as u16) << 8 | (io.gpu.win1.bottom as u16),
|
REG_WIN1V => (io.gpu.win1.top as u16) << 8 | (io.gpu.win1.bottom as u16),
|
||||||
REG_WININ => {
|
REG_WININ => (io.gpu.win1.flags.bits() << 8) | io.gpu.win0.flags.bits(),
|
||||||
(io.gpu.win1.flags.bits() << 8) | io.gpu.win0.flags.bits()
|
REG_WINOUT => (io.gpu.winobj_flags.bits() << 8) | io.gpu.winout_flags.bits(),
|
||||||
}
|
|
||||||
REG_WINOUT => {
|
|
||||||
(io.gpu.winobj_flags.bits() << 8) | io.gpu.winout_flags.bits()
|
|
||||||
}
|
|
||||||
REG_BLDCNT => io.gpu.bldcnt.read(),
|
REG_BLDCNT => io.gpu.bldcnt.read(),
|
||||||
REG_BLDALPHA => io.gpu.bldalpha.read(),
|
REG_BLDALPHA => io.gpu.bldalpha.read(),
|
||||||
|
|
||||||
|
@ -308,13 +304,9 @@ impl BusIO for IoDevices {
|
||||||
fn write_8(&mut self, addr: Addr, value: u8) {
|
fn write_8(&mut self, addr: Addr, value: u8) {
|
||||||
match addr + IO_BASE {
|
match addr + IO_BASE {
|
||||||
/* FIFO_A */
|
/* FIFO_A */
|
||||||
0x0400_00A0..=0x0400_00A3 => {
|
0x0400_00A0..=0x0400_00A3 => self.sound.write_fifo(0, value as i8),
|
||||||
self.sound.write_fifo(0, value as i8)
|
|
||||||
}
|
|
||||||
/* FIFO_B */
|
/* FIFO_B */
|
||||||
0x0400_00A4..=0x0400_00A7 => {
|
0x0400_00A4..=0x0400_00A7 => self.sound.write_fifo(1, value as i8),
|
||||||
self.sound.write_fifo(1, value as i8)
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
let t = self.read_16(addr & !1);
|
let t = self.read_16(addr & !1);
|
||||||
let t = if addr & 1 != 0 {
|
let t = if addr & 1 != 0 {
|
||||||
|
|
|
@ -8,7 +8,7 @@ use super::cartridge::Cartridge;
|
||||||
use super::dma::DmaNotifer;
|
use super::dma::DmaNotifer;
|
||||||
use super::iodev::{IoDevices, WaitControl};
|
use super::iodev::{IoDevices, WaitControl};
|
||||||
use super::sched::*;
|
use super::sched::*;
|
||||||
use arm7tdmi::{Arm7tdmiCore};
|
use arm7tdmi::Arm7tdmiCore;
|
||||||
use rustboyadvance_utils::{Shared, WeakPointer};
|
use rustboyadvance_utils::{Shared, WeakPointer};
|
||||||
|
|
||||||
pub mod consts {
|
pub mod consts {
|
||||||
|
|
|
@ -42,7 +42,8 @@ fn load_bios(bios_path: &Path) -> Box<[u8]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
fs::create_dir_all(LOG_DIR).unwrap_or_else(|_| panic!("could not create log directory ({})", LOG_DIR));
|
fs::create_dir_all(LOG_DIR)
|
||||||
|
.unwrap_or_else(|_| panic!("could not create log directory ({})", LOG_DIR));
|
||||||
flexi_logger::Logger::with_env_or_str("info")
|
flexi_logger::Logger::with_env_or_str("info")
|
||||||
.log_to_file()
|
.log_to_file()
|
||||||
.directory(LOG_DIR)
|
.directory(LOG_DIR)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{path::PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use rustboyadvance_core::{
|
use rustboyadvance_core::{
|
||||||
cartridge::{BackupType, GamepakBuilder},
|
cartridge::{BackupType, GamepakBuilder},
|
||||||
|
|
Reference in a new issue