Compare commits

...

2 Commits

Author SHA1 Message Date
0f29afd231
Update to latest version of dependencies 2024-10-10 11:43:13 -05:00
227e1e779b
Fix INX and DCX not being wrapping 2024-10-10 11:21:23 -05:00
10 changed files with 1993 additions and 1287 deletions

3213
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,22 +6,22 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.79"
bitflags = "2.3.3"
device_query = "1.1.3"
eframe = { version = "0.25.0", features = ["ron", "persistence"] }
egui-modal = "0.3.2"
enum_dispatch = "0.3.12"
env_logger = "0.10.0"
anyhow = "1.0.89"
bitflags = "2.6.0"
device_query = "2.1.0"
eframe = { version = "0.29.1", features = ["ron", "persistence"] }
egui-modal = "0.5.0"
enum_dispatch = "0.3.13"
env_logger = "0.11.5"
ihex = "3.0.0"
image = "0.24.6"
image = "0.25.2"
inventory = "0.3.15"
log = "0.4.19"
log = "0.4.22"
mopa = "0.2.2"
parking_lot = "0.12.1"
parking_lot = "0.12.3"
rand = "0.8.5"
rfd = "0.13.0"
ron = "0.8.0"
serde = { version = "1.0.171", features = ["derive"] }
soloud = "1.0.2"
ux = "0.1.5"
rfd = "0.15.0"
ron = "0.8.1"
serde = { version = "1.0.210", features = ["derive"] }
soloud = "1.0.5"
ux = "0.1.6"

View File

@ -79,7 +79,6 @@ pub trait Card {
fn settings_ui(_settings: ron::Value) -> anyhow::Result<impl SettingsUi>
where
Self: Sized;
#[allow(clippy::settings_ui_ret_no_self)]
fn settings_ui_dyn(settings: ron::Value) -> anyhow::Result<Box<dyn SettingsUi>>
where
Self: Sized + 'static,

View File

@ -401,8 +401,8 @@ impl I8080 {
self.update_arith_flags(ac, self.carry, res);
self.regs[src] = res;
}
Opcode::Inx(dst) => self.set_pair(dst, self.get_pair(dst) + 1),
Opcode::Dcx(dst) => self.set_pair(dst, self.get_pair(dst) + 2),
Opcode::Inx(dst) => self.set_pair(dst, self.get_pair(dst).wrapping_add(1)),
Opcode::Dcx(dst) => self.set_pair(dst, self.get_pair(dst).wrapping_sub(1)),
Opcode::Dad(src) => {
let a = u32::from(self.get_pair(RegisterPair::HL));
let b = u32::from(self.get_pair(src));

View File

@ -1,7 +1,7 @@
use std::path::Path;
use eframe::{
egui::{self, Key, KeyboardShortcut, Modifiers, Sense, TextureOptions, Ui, Widget},
egui::{self, Key, KeyboardShortcut, Modifiers, Sense, TextureOptions, Ui, UiBuilder, Widget},
epaint::{vec2, Pos2, Rect, TextureHandle},
};
@ -102,7 +102,7 @@ impl Widget for &mut Frontpanel<'_> {
let mut resp = ui.allocate_response(vec2(800.0, 333.0), Sense::click());
// resp.request_focus();
let fp_rect = resp.rect;
ui.allocate_ui_at_rect(fp_rect, |ui| {
ui.allocate_new_ui(UiBuilder::new().max_rect(fp_rect), |ui| {
ui.image(&self.textures.fp);
for led in &LEDS {
let pos = led.pos + fp_rect.left_top().to_vec2();
@ -115,7 +115,7 @@ impl Widget for &mut Frontpanel<'_> {
LedSource::Address => self.state.addr,
};
let led_on = (led_data & led.mask) > 0;
ui.allocate_ui_at_rect(Rect::from_center_size(pos, vec2(16.0, 16.0)), |ui| {
ui.allocate_new_ui(UiBuilder::new().max_rect(Rect::from_center_size(pos, vec2(16.0, 16.0))), |ui| {
ui.add(led::Led::new(led_on, &led_textures));
});
}
@ -125,7 +125,7 @@ impl Widget for &mut Frontpanel<'_> {
for (i, switch) in SWITCHES.iter().enumerate() {
let pos = switch.pos + fp_rect.left_top().to_vec2();
if i == 0 {
ui.allocate_ui_at_rect(Rect::from_center_size(pos, vec2(11.0, 25.0)), |ui| {
ui.allocate_new_ui(UiBuilder::new().max_rect(Rect::from_center_size(pos, vec2(11.0, 25.0))), |ui| {
let mut power_inv = !self.state.power;
if ui
.add(switch::ToggleSwitch::new(
@ -144,7 +144,7 @@ impl Widget for &mut Frontpanel<'_> {
if (1..17).contains(&i) {
let bit_mask = 1 << (16 - i);
let mut sw_state = self.state.ad_sws & bit_mask > 0;
ui.allocate_ui_at_rect(Rect::from_center_size(pos, vec2(11.0, 25.0)), |ui| {
ui.allocate_new_ui(UiBuilder::new().max_rect(Rect::from_center_size(pos, vec2(11.0, 25.0))), |ui| {
let key_offset = (i - 1) % 8;
let key = ["Q", "W", "E", "R", "T", "Y", "U", "I"][key_offset];
let key = Key::from_name(key).unwrap();
@ -182,7 +182,7 @@ impl Widget for &mut Frontpanel<'_> {
24 => &mut self.state.aux2,
_ => unreachable!(),
};
ui.allocate_ui_at_rect(Rect::from_center_size(pos, vec2(11.0, 25.0)), |ui| {
ui.allocate_new_ui(UiBuilder::new().max_rect(Rect::from_center_size(pos, vec2(11.0, 25.0))), |ui| {
let sw_offset = i - 17;
let up_key = ["S", "D", "F", "G", "H", "J", "K", "L"][sw_offset];
let down_key = ["X", "C", "V", "B", "N", "M", ",", "."][sw_offset];
@ -277,7 +277,7 @@ impl Textures {
name: impl Into<String>,
path: impl AsRef<Path>,
) -> Result<TextureHandle, image::ImageError> {
let image = image::io::Reader::open(path.as_ref())?.decode()?;
let image = image::ImageReader::open(path.as_ref())?.decode()?;
let image = egui::ColorImage::from_rgba_unmultiplied(
[image.width() as _, image.height() as _],
image.to_rgba8().as_flat_samples().as_slice(),

View File

@ -112,7 +112,7 @@ impl Widget for ThreePosSwitch<'_> {
*self.state = SwitchState::Up;
} else if down_shortcut_pressed {
*self.state = SwitchState::Down;
} else if resp.drag_released() || up_shortcut_released || down_shortcut_released {
} else if resp.drag_stopped() || up_shortcut_released || down_shortcut_released {
*self.state = SwitchState::Neut;
}
if *self.state != SwitchState::Neut

View File

@ -106,8 +106,10 @@ impl Window for LoadBinWindow {
ui.selectable_value(&mut self.ftype, BinaryType::IntelHex, "Intel HEX");
});
ui.horizontal(|ui| {
ui.set_enabled(self.ftype != BinaryType::IntelHex);
ui.add(DragValue::new(&mut self.start_addr).clamp_range(0..=65535));
if self.ftype == BinaryType::IntelHex {
ui.disable();
}
ui.add(DragValue::new(&mut self.start_addr).range(0..=65535));
ui.label("Start address");
});
modal.buttons(ui, |ui| {

View File

@ -30,7 +30,7 @@ fn main() -> Result<(), eframe::Error> {
eframe::run_native(
"Altair 8800 Emulator",
NativeOptions::default(),
Box::new(|cc| Box::new(AltairEmulator::new(cc))),
Box::new(|cc| Ok(Box::new(AltairEmulator::new(cc)))),
)
}

View File

@ -73,7 +73,9 @@ impl Window for OptionWindow {
}
OptionsCategory::Cards => {
TopBottomPanel::top("card_opts").show_inside(ui, |ui| {
ui.set_enabled(self.allow_changing_cards);
if !self.allow_changing_cards {
ui.disable();
}
SidePanel::left("card_opts_left")
.show_separator_line(false)
.show_inside(ui, |ui| {
@ -109,7 +111,7 @@ impl Window for OptionWindow {
}
}
}
ComboBox::from_id_source("cards_opts_add")
ComboBox::from_id_salt("cards_opts_add")
.selected_text("Add")
.show_ui(ui, |ui| {
for typ in inventory::iter::<Type> {

View File

@ -91,7 +91,7 @@ impl SettingsUi for TwoSioSettingsUi {
fn draw_ui(&mut self, ui: &mut Ui) {
ui.horizontal(|ui| {
ui.label("Base address");
ComboBox::from_id_source("2sio_base").selected_text(format!("{:#x}", self.settings.start_addr)).show_ui(ui, |ui| {
ComboBox::from_id_salt("2sio_base").selected_text(format!("{:#x}", self.settings.start_addr)).show_ui(ui, |ui| {
for i in 0..64 {
let start_addr = (i as u8) * 4;
ui.selectable_value(&mut self.settings.start_addr, start_addr, format!("{:#x}", start_addr));