apply of clippy.

fixed missing imports and builds and tests as expected again
This commit is contained in:
2024-10-30 09:48:59 -04:00
parent 4fb2d6af29
commit 011874bca6
20 changed files with 114 additions and 154 deletions
+4 -17
View File
@@ -1,20 +1,7 @@
use std::default::Default;
use std::fs::DirEntry;
use std::time::Instant;
use gemma::{
chip8::computer::Chip8Computer,
constants::{CHIP8_MEMORY_SIZE, CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_WIDTH},
};
use imgui::*;
use sys::{ImColor, ImVec2, ImVector_ImU32};
use rand::random;
use gemma::chip8::computer_manager::Chip8ComputerManager;
use gemma::chip8::cpu_states::Chip8CpuStates::WaitingForInstruction;
use gemma::chip8::system_memory::Chip8SystemMemory;
use support::{emmagui_support::GemmaImguiSupport, ui_state::ImGuiUiState};
use clap::{Parser, Subcommand};
use gemma::chip8::quirk_modes::QuirkMode;
use gemma::chip8::quirk_modes::QuirkMode::Chip8;
mod support;
@@ -78,22 +65,22 @@ fn main() {
}
// GUI Parts
if ui_state.show_video {
GemmaImguiSupport::video_display(&system.state(), &ui_state, ui);
GemmaImguiSupport::video_display(system.state(), &ui_state, ui);
}
GemmaImguiSupport::system_controls(&mut system, &mut ui_state, ui);
if ui_state.show_registers {
GemmaImguiSupport::registers_view(&system.state(), ui);
GemmaImguiSupport::registers_view(system.state(), ui);
}
if ui_state.show_memory {
let active_instruction = system.state().registers.peek_pc();
GemmaImguiSupport::hex_memory_display(system.state().memory.clone(), (0x100, 0x10), active_instruction as i16, ui);
GemmaImguiSupport::hex_memory_display(system.state().memory, (0x100, 0x10), active_instruction as i16, ui);
}
if ui_state.show_keypad {
GemmaImguiSupport::keypad_display(&system.state(), ui);
GemmaImguiSupport::keypad_display(system.state(), ui);
}
});
}
@@ -1,20 +1,15 @@
use std::ffi::OsString;
use gemma::constants::CHIP8_KEYBOARD;
use std::fs::{File, read_dir};
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::time::Duration;
use imgui::{Condition, ImColor32, Ui};
use log::debug;
use gemma::chip8::computer::Chip8Computer;
use gemma::chip8::computer_manager::Chip8ComputerManager;
use gemma::chip8::computer_manager::ManagerDumpables::{Keyboard, Registers, Video};
use gemma::chip8::keypad::Keypad;
use gemma::chip8::system_memory::Chip8SystemMemory;
use gemma::constants::{CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_WIDTH};
use crate::ImGuiUiState;
use crate::support::gui_file_list::GuiFileList;
use super::ui_state;
const ROM_ROOT: &str = "/home/tmerritt/Projects/chip8_toy/resources/roms";
@@ -25,7 +20,7 @@ const CELL_HEIGHT: i32 = 5i32;
impl GemmaImguiSupport {
pub fn keypad_display(system_to_display: &Chip8Computer, ui: &Ui) {
ui.window(format!("Keypad"))
ui.window("Keypad".to_string())
.size([100.0, 100.0], Condition::FirstUseEver)
.build(|| {
for row in CHIP8_KEYBOARD {
@@ -35,7 +30,7 @@ impl GemmaImguiSupport {
} else {
format!("{:1x}", key)
};
ui.text(format!("{}", label));
ui.text(&label);
ui.same_line();
}
ui.text("");
+2 -2
View File
@@ -20,8 +20,8 @@ impl GuiFileList {
known_files.sort();
for (index, entry) in known_files.iter().enumerate() {
let mut working_select = ui.selectable_config(format!("{}", entry.clone().into_string().unwrap()));
if entry.to_str().unwrap().to_string() == selected_filename.as_str().to_string() {
let mut working_select = ui.selectable_config(entry.clone().into_string().unwrap().to_string());
if *entry.to_str().unwrap() == *selected_filename.as_str() {
working_select = working_select.selected(true);
}
if working_select.build() {