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 log::debug;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ansi_term::Style;
|
||||
use bit::BitIndex;
|
||||
use log::debug;
|
||||
use num::FromPrimitive;
|
||||
use ansi_term::{Style};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use rustboyadvance_utils::{Shared, WeakPointer};
|
||||
|
||||
|
@ -13,7 +13,6 @@ use super::reg_string;
|
|||
|
||||
use super::{arm::ArmCond, psr::RegPSR, Addr, CpuMode, CpuState};
|
||||
|
||||
|
||||
use super::memory::{MemoryAccess, MemoryInterface};
|
||||
use MemoryAccess::*;
|
||||
|
||||
|
@ -518,7 +517,7 @@ impl<I: MemoryInterface> fmt::Debug for Arm7tdmiCore<I> {
|
|||
let mut reg_name = reg_string(i).to_string();
|
||||
reg_name.make_ascii_uppercase();
|
||||
let entry = format!("\t{:-3} = 0x{:08x}", reg_name, gpr[i]);
|
||||
write!(
|
||||
write!(
|
||||
f,
|
||||
"{}{}",
|
||||
reg_normal_style.paint(entry),
|
||||
|
|
|
@ -222,7 +222,9 @@ fn detect_backup_type(bytes: &[u8]) -> Option<BackupType> {
|
|||
|
||||
for i in 0..5 {
|
||||
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
|
||||
}
|
||||
|
|
|
@ -103,7 +103,10 @@ use super::sysbus::consts::*;
|
|||
pub const EEPROM_BASE_ADDR: u32 = 0x0DFF_FF00;
|
||||
|
||||
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 {
|
||||
|
|
|
@ -18,7 +18,7 @@ use super::timer::Timers;
|
|||
|
||||
use super::sound::interface::DynAudioInterface;
|
||||
|
||||
use arm7tdmi::{Arm7tdmiCore};
|
||||
use arm7tdmi::Arm7tdmiCore;
|
||||
use rustboyadvance_utils::Shared;
|
||||
|
||||
pub struct GameBoyAdvance {
|
||||
|
@ -214,7 +214,8 @@ impl GameBoyAdvance {
|
|||
pub fn frame(&mut self) {
|
||||
static mut OVERSHOOT: usize = 0;
|
||||
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) {
|
||||
static mut OVERSHOOT: usize = 0;
|
||||
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::{
|
||||
gdb::wait_for_connection,
|
||||
gdbstub::{
|
||||
conn::ConnectionExt,
|
||||
stub::GdbStub,
|
||||
},
|
||||
gdbstub::{conn::ConnectionExt, stub::GdbStub},
|
||||
};
|
||||
|
||||
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_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_WININ => {
|
||||
(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_WININ => (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_BLDCNT => io.gpu.bldcnt.read(),
|
||||
REG_BLDALPHA => io.gpu.bldalpha.read(),
|
||||
|
||||
|
@ -308,13 +304,9 @@ impl BusIO for IoDevices {
|
|||
fn write_8(&mut self, addr: Addr, value: u8) {
|
||||
match addr + IO_BASE {
|
||||
/* FIFO_A */
|
||||
0x0400_00A0..=0x0400_00A3 => {
|
||||
self.sound.write_fifo(0, value as i8)
|
||||
}
|
||||
0x0400_00A0..=0x0400_00A3 => self.sound.write_fifo(0, value as i8),
|
||||
/* FIFO_B */
|
||||
0x0400_00A4..=0x0400_00A7 => {
|
||||
self.sound.write_fifo(1, value as i8)
|
||||
}
|
||||
0x0400_00A4..=0x0400_00A7 => self.sound.write_fifo(1, value as i8),
|
||||
_ => {
|
||||
let t = self.read_16(addr & !1);
|
||||
let t = if addr & 1 != 0 {
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::cartridge::Cartridge;
|
|||
use super::dma::DmaNotifer;
|
||||
use super::iodev::{IoDevices, WaitControl};
|
||||
use super::sched::*;
|
||||
use arm7tdmi::{Arm7tdmiCore};
|
||||
use arm7tdmi::Arm7tdmiCore;
|
||||
use rustboyadvance_utils::{Shared, WeakPointer};
|
||||
|
||||
pub mod consts {
|
||||
|
|
|
@ -42,7 +42,8 @@ fn load_bios(bios_path: &Path) -> Box<[u8]> {
|
|||
}
|
||||
|
||||
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")
|
||||
.log_to_file()
|
||||
.directory(LOG_DIR)
|
||||
|
@ -204,7 +205,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
}
|
||||
Event::Quit { .. } => break 'running,
|
||||
Event::DropFile { .. } => {
|
||||
Event::DropFile { .. } => {
|
||||
todo!("impl DropFile again")
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{path::PathBuf};
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rustboyadvance_core::{
|
||||
cartridge::{BackupType, GamepakBuilder},
|
||||
|
|
Reference in a new issue