my first schip rom works in my schip emulator.
BUGFIX: Corrects runaway after drawing in my first schip rom scroll down, left, right all test with test rom assembler now assembles to the expected output it seems fixes incorrect loading of schip font to memory replaces schip font from new chatgpt feedback
This commit is contained in:
@@ -3,6 +3,7 @@ use gemma::chip8::computer_manager::Chip8ComputerManager;
|
||||
use std::path::Path;
|
||||
use std::time::Instant;
|
||||
use std::{default::Default, path::PathBuf};
|
||||
use support::ui_state::ROMPATH_DEFAULT;
|
||||
use support::{emmagui_support::GemmaImguiSupport, ui_state::ImGuiUiState};
|
||||
|
||||
mod support;
|
||||
@@ -45,7 +46,12 @@ fn main() {
|
||||
|
||||
let mut system = Chip8ComputerManager::default();
|
||||
println!("GOT A ROMS_DIRECTORY => [{:?}]", cli_options.roms_directory);
|
||||
let mut ui_state = ImGuiUiState::new(cli_options.roms_directory);
|
||||
println!("{:?}", std::env::var("PWD"));
|
||||
let mut ui_state = if cli_options.roms_directory.is_none() {
|
||||
ImGuiUiState::new(Some(PathBuf::from(ROMPATH_DEFAULT)))
|
||||
} else {
|
||||
ImGuiUiState::new(cli_options.roms_directory)
|
||||
};
|
||||
|
||||
support::simple_init(file!(), move |_, ui| {
|
||||
let current_time = Instant::now();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use crate::support::gui_file_list::GuiFileList;
|
||||
use crate::ImGuiUiState;
|
||||
use dimensioned::ucum::f32consts::CUP_M;
|
||||
use gemma::chip8::computer::Chip8Computer;
|
||||
use gemma::chip8::computer_manager::Chip8ComputerManager;
|
||||
use gemma::chip8::computer_manager::ManagerDumpables::{Keyboard, Registers, Video};
|
||||
use gemma::chip8::quirk_modes::QuirkMode::{self, *};
|
||||
use gemma::chip8::system_memory::Chip8SystemMemory;
|
||||
use gemma::constants::CHIP8_KEYBOARD;
|
||||
use imgui::{CollapsingHeader, Condition, ImColor32, Ui};
|
||||
@@ -116,7 +118,7 @@ impl GemmaImguiSupport {
|
||||
.build(|| {
|
||||
/* System Step Counter */
|
||||
ui.text(format!("Step {:04x}", system_to_control.num_cycles()).as_str());
|
||||
|
||||
ui.text(format!("Mode {}", system_to_control.quirks_mode()));
|
||||
/* ROM Lister */
|
||||
if CollapsingHeader::new("Roms").build(ui) {
|
||||
let new_filename = GuiFileList::display_path(
|
||||
@@ -158,7 +160,7 @@ impl GemmaImguiSupport {
|
||||
system_to_control.state().memory.peek(0x200),
|
||||
system_to_control.state().memory.peek(0x201),
|
||||
];
|
||||
let mut show_buttons = bytes[0] != 0 || bytes[1] == 0xe0;
|
||||
let show_buttons = bytes[0] != 0 || bytes[1] == 0xe0;
|
||||
|
||||
if show_buttons {
|
||||
if ui.button("Step") {
|
||||
@@ -175,7 +177,7 @@ impl GemmaImguiSupport {
|
||||
}
|
||||
ui.same_line();
|
||||
if ui.button("Reset") {
|
||||
system_to_control.reset();
|
||||
system_to_control.reset(system_to_control.quirks_mode());
|
||||
}
|
||||
if ui.button("Dump Video Memory") {
|
||||
println!("{}", system_to_control.dump_to_string(Video));
|
||||
@@ -201,6 +203,27 @@ impl GemmaImguiSupport {
|
||||
ui.input_int("Target IPS", &mut gui_state.target_ips)
|
||||
.build();
|
||||
};
|
||||
|
||||
let selectors = [Chip8, SChipModern, XOChip];
|
||||
for current_selector in selectors {
|
||||
let mut working_selector =
|
||||
ui.selectable_config(current_selector.clone().to_string());
|
||||
match system_to_control.quirks_mode() {
|
||||
Chip8 => {
|
||||
working_selector = working_selector.selected(true);
|
||||
}
|
||||
SChipModern => {
|
||||
working_selector = working_selector.selected(true);
|
||||
}
|
||||
XOChip => {
|
||||
working_selector = working_selector.selected(true);
|
||||
}
|
||||
}
|
||||
if working_selector.build() {
|
||||
system_to_control.reset(current_selector);
|
||||
println!("CLICK ON {}", ¤t_selector);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ pub struct ImGuiUiState {
|
||||
pub frame_time: u32,
|
||||
pub last_frame_instant: Instant,
|
||||
pub target_ips: i32,
|
||||
pub roms_root_path: PathBuf,
|
||||
pub roms_root_path: PathBuf
|
||||
}
|
||||
|
||||
impl Clone for ImGuiUiState {
|
||||
@@ -33,8 +33,7 @@ impl Clone for ImGuiUiState {
|
||||
frame_time: self.frame_time,
|
||||
last_frame_instant: self.last_frame_instant,
|
||||
target_ips: self.target_ips,
|
||||
|
||||
roms_root_path: self.roms_root_path.to_owned(),
|
||||
roms_root_path: self.roms_root_path.to_owned()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +52,7 @@ impl Default for ImGuiUiState {
|
||||
frame_time: 16,
|
||||
last_frame_instant: Instant::now(),
|
||||
target_ips: 200000,
|
||||
roms_root_path: PathBuf::from(ROMPATH_DEFAULT),
|
||||
roms_root_path: PathBuf::from(ROMPATH_DEFAULT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user