Skip to content

Commit

Permalink
Update to latest nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
kelpsyberry committed Dec 3, 2023
1 parent 25e3081 commit f3a29da
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 55 deletions.
2 changes: 1 addition & 1 deletion core/src/cpu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod bus;
pub mod psr;
pub mod schedule;
pub(crate) use schedule::{Schedule, ScheduleConst};
pub(crate) use schedule::Schedule;
mod irqs;
pub(crate) use irqs::Irqs;
#[cfg(any(feature = "debugger-hooks", doc))]
Expand Down
20 changes: 8 additions & 12 deletions core/src/cpu/arm7/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,11 @@ impl Schedule {
}
}

impl const cpu::ScheduleConst for Schedule {
impl cpu::Schedule for Schedule {
type Timestamp = Timestamp;
type Event = Event;
type EventSlotIndex = EventSlotIndex;

#[inline]
fn timer_event_slot(i: timers::Index) -> EventSlotIndex {
EventSlotIndex::new(event_slots::TIMERS_START.get() + i.get())
}
}

impl cpu::Schedule for Schedule {
#[inline]
fn cur_time(&self) -> Timestamp {
self.cur_time
Expand All @@ -152,12 +145,15 @@ impl cpu::Schedule for Schedule {
self.schedule.set_event(slot_index, event);
}

#[inline]
fn timer_event_slot(i: timers::Index) -> EventSlotIndex {
EventSlotIndex::new(event_slots::TIMERS_START.get() + i.get())
}

#[inline]
fn set_timer_event(&mut self, i: timers::Index) {
self.schedule.set_event(
<Self as cpu::ScheduleConst>::timer_event_slot(i),
Event::Timer(i),
);
self.schedule
.set_event(Self::timer_event_slot(i), Event::Timer(i));
}

#[inline]
Expand Down
1 change: 1 addition & 0 deletions core/src/cpu/arm9/bus/ptrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ cfg_if::cfg_if! {
}
}

#[allow(clippy::struct_field_names)]
#[repr(C)]
pub struct Ptrs {
ptrs: [*mut u8; Self::ENTRIES],
Expand Down
1 change: 1 addition & 0 deletions core/src/cpu/arm9/cp15/ptrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mod mask {
pub const ALL: Mask = R_ALL | W_ALL;
}

#[allow(clippy::struct_field_names)]
#[repr(C)]
pub struct Ptrs {
r_code_ptrs: [*const u8; Self::ENTRIES],
Expand Down
20 changes: 8 additions & 12 deletions core/src/cpu/arm9/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,11 @@ impl Schedule {
}
}

impl const cpu::ScheduleConst for Schedule {
impl cpu::Schedule for Schedule {
type Timestamp = Timestamp;
type Event = Event;
type EventSlotIndex = EventSlotIndex;

#[inline]
fn timer_event_slot(i: timers::Index) -> EventSlotIndex {
EventSlotIndex::new(event_slots::TIMERS_START.get() + i.get())
}
}

impl cpu::Schedule for Schedule {
#[inline]
fn cur_time(&self) -> Timestamp {
self.cur_time
Expand All @@ -127,12 +120,15 @@ impl cpu::Schedule for Schedule {
self.schedule.set_event(slot_index, event);
}

#[inline]
fn timer_event_slot(i: timers::Index) -> EventSlotIndex {
EventSlotIndex::new(event_slots::TIMERS_START.get() + i.get())
}

#[inline]
fn set_timer_event(&mut self, i: timers::Index) {
self.schedule.set_event(
<Self as cpu::ScheduleConst>::timer_event_slot(i),
Event::Timer(i),
);
self.schedule
.set_event(Self::timer_event_slot(i), Event::Timer(i));
}

#[inline]
Expand Down
8 changes: 6 additions & 2 deletions core/src/cpu/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ impl MemWatchpointRootTable {

pub(super) fn remove(&mut self, addr: u32, size: u8, rw: MemWatchpointRwMask) {
let root_i = (addr >> 21) as usize;
let Some(sub_table) = &mut self.0[root_i] else { return };
let Some(sub_table) = &mut self.0[root_i] else {
return;
};
let sub_i = (addr >> 10 & 0x7FF) as usize;
let Some(leaf_table) = &mut sub_table.0[sub_i] else { return };
let Some(leaf_table) = &mut sub_table.0[sub_i] else {
return;
};
let mut mask = rw.bits() as usize;
for i in 0..size.trailing_zeros() {
mask |= mask << (2 << i);
Expand Down
9 changes: 3 additions & 6 deletions core/src/cpu/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use crate::{
utils::{Loadable, LoadableInPlace, Storable},
};

#[const_trait]
pub trait ScheduleConst {
pub trait Schedule {
type Timestamp: Copy
+ From<emu::Timestamp>
+ Into<emu::Timestamp>
Expand All @@ -21,10 +20,6 @@ pub trait ScheduleConst {
type Event: Copy + Loadable + LoadableInPlace + Storable;
type EventSlotIndex: Copy + Loadable + LoadableInPlace + Storable;

fn timer_event_slot(i: timers::Index) -> Self::EventSlotIndex;
}

pub trait Schedule: ~const ScheduleConst {
fn cur_time(&self) -> Self::Timestamp;
fn set_cur_time(&mut self, value: Self::Timestamp);
#[inline]
Expand All @@ -40,6 +35,8 @@ pub trait Schedule: ~const ScheduleConst {
}

fn set_event(&mut self, slot_index: Self::EventSlotIndex, event: Self::Event);

fn timer_event_slot(i: timers::Index) -> Self::EventSlotIndex;
fn set_timer_event(&mut self, i: timers::Index);

fn schedule_event(&mut self, slot_index: Self::EventSlotIndex, time: Self::Timestamp);
Expand Down
2 changes: 1 addition & 1 deletion core/src/emu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl Builder {

ds_rom
.setup(self.direct_boot)
.map_err(|_| BuildError::RomNeedsDecryptionButNoBiosProvided)?;
.map_err(|()| BuildError::RomNeedsDecryptionButNoBiosProvided)?;

let (global_engine_data, arm7_engine_data, arm9_engine_data) = engine.into_data();
let mut arm7 = Arm7::new(
Expand Down
7 changes: 6 additions & 1 deletion core/src/gpu/engine_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ use crate::{
};
use core::{
mem::{replace, transmute, MaybeUninit},
simd::{i32x4, u32x2, u64x2, SimdInt, SimdOrd, SimdUint},
simd::{
cmp::SimdOrd,
i32x4,
num::{SimdInt, SimdUint},
u32x2, u64x2,
},
};
use matrix::{Matrix, MatrixBuffer};
use vertex::Vertex;
Expand Down
2 changes: 1 addition & 1 deletion core/src/gpu/engine_3d/matrix.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::Savestate;
use core::ops::Mul;
use core::simd::{i32x4, i64x4, Simd, SimdCast, SimdElement, SimdInt};
use core::simd::{i32x4, i64x4, num::SimdInt, Simd, SimdCast, SimdElement};

#[derive(Clone, Copy, Debug)]
#[repr(align(16))]
Expand Down
6 changes: 4 additions & 2 deletions core/src/gpu/engine_3d/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::utils::Savestate;
use core::simd::{
i16x2, i32x4, i64x2, i64x4, mask64x4, simd_swizzle, u16x2, u16x4, u8x4, SimdInt, SimdPartialEq,
SimdUint,
cmp::SimdPartialEq,
i16x2, i32x4, i64x2, i64x4, mask64x4,
num::{SimdInt, SimdUint},
simd_swizzle, u16x2, u16x4, u8x4,
};

pub type TexCoords = i16x2;
Expand Down
1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
maybe_uninit_slice,
portable_simd,
const_mut_refs,
const_trait_impl,
const_for,
new_uninit
)]
Expand Down
5 changes: 4 additions & 1 deletion frontend/desktop/src/audio/input/cpal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ struct InputData {
}

impl InputData {
fn fill<T: Sample>(&mut self, data: &[T]) where f64: cpal::FromSample<T> {
fn fill<T: Sample>(&mut self, data: &[T])
where
f64: cpal::FromSample<T>,
{
if let Some(interp) = self.interp_rx.try_iter().last() {
self.interp = interp;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ mod map;
pub use map::Map;
mod state;
pub use state::{Changes, State};
pub mod trigger;
pub mod key_codes;
pub mod trigger;
pub use key_codes::{KeyCode, ScanCode};

use winit::keyboard::PhysicalKey;
Expand Down
8 changes: 2 additions & 6 deletions frontend/desktop/src/input/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ impl Trigger {

impl ToString for Trigger {
fn to_string(&self) -> String {
fn write_trigger(
result: &mut String,
trigger: &Trigger,
needs_parens_if_multiple: bool,
) {
fn write_trigger(result: &mut String, trigger: &Trigger, needs_parens_if_multiple: bool) {
match trigger {
&Trigger::KeyCode(key_code) => {
write!(result, "v{}", <&str>::from(key_code)).unwrap();
Expand Down Expand Up @@ -273,7 +269,7 @@ impl<'a> TriggerParser<'a> {
kind: ParseErrorKind::ExpectedValue,
});
}

if let Some(op) = op {
return Ok(Trigger::Chain(op, values));
} else {
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/ui/savestate_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ impl Editor {
for [a, b] in chunks {
text_heights.push(text_height(a).max(text_height(b)));
}
if let Some(last) = last.get(0) {
if let Some(last) = last.first() {
text_heights.push(text_height(last));
}
}
Expand Down
7 changes: 4 additions & 3 deletions frontend/desktop/src/ui/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ impl GfxState {
backends: wgpu::Backends::all(),
..Default::default()
});
let surface = unsafe { instance.create_surface_from_raw(window) }.expect("Couldn't create surface");
let surface =
unsafe { instance.create_surface_from_raw(window) }.expect("Couldn't create surface");

let adapter = match adapter {
AdapterSelection::Auto(power_preference) => {
Expand Down Expand Up @@ -85,7 +86,7 @@ impl GfxState {
format: {
let formats = surface.get_capabilities(&adapter).formats;
let preferred = formats
.get(0)
.first()
.expect("Couldn't get surface preferred format");
#[cfg(target_os = "macos")]
{
Expand Down Expand Up @@ -155,7 +156,7 @@ impl GfxState {
.surface
.get_capabilities(&self.adapter)
.formats
.get(0)
.first()
.expect("Couldn't get surface preferred format");
if new_format != self.surface_config.format {
self.surface_config.format = new_format;
Expand Down
2 changes: 1 addition & 1 deletion render/soft-3d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod data;
pub use data::RenderingData;
mod utils;

use core::simd::{SimdOrd, SimdUint};
use core::simd::{cmp::SimdOrd, num::SimdUint};
use dust_core::gpu::{
engine_3d::{
Color, InterpColor, PolyAddr, PolyVertIndex, PolygonAttrs, TexCoords, TextureParams,
Expand Down
7 changes: 6 additions & 1 deletion render/soft-3d/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
use core::simd::{i32x2, i64x2, u32x4, u64x4, SimdInt, SimdPartialEq, SimdPartialOrd, SimdUint};
use core::simd::{
cmp::{SimdPartialEq, SimdPartialOrd},
i32x2, i64x2,
num::{SimdInt, SimdUint},
u32x4, u64x4,
};
use dust_core::gpu::engine_3d::{
InterpColor, PolyVertIndex, PolyVertsLen, Polygon, ScreenVertex, TexCoords, VertexAddr,
};
Expand Down
2 changes: 1 addition & 1 deletion render/wgpu-3d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod utils;
use ahash::AHashMap as HashMap;
use core::{
mem::{self, MaybeUninit},
simd::SimdUint,
simd::num::SimdUint,
// simd::u16x2,
slice,
};
Expand Down
2 changes: 1 addition & 1 deletion render/wgpu-3d/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::simd::{f64x4, SimdUint};
use core::simd::{f64x4, num::SimdUint};
use dust_core::gpu::engine_3d::Color;

#[inline]
Expand Down

0 comments on commit f3a29da

Please sign in to comment.