add chatgpt driven changes to video rendering

This commit is contained in:
2024-10-16 07:28:03 -04:00
parent 448aeab154
commit 939fd83e80
9 changed files with 148 additions and 68 deletions
+3
View File
@@ -34,6 +34,9 @@ fn main() -> eframe::Result {
if state.display_registers {
GemmaEguiSupport::registers_view(&computer, ui);
}
if state.is_running {
computer.step_system();
}
});
})
}
@@ -4,7 +4,8 @@ pub struct GemmaEGuiState {
pub display_memory: bool,
pub display_registers: bool,
pub memory_view_min: i32,
pub memory_view_max: i32
pub memory_view_max: i32,
pub is_running: bool
}
impl Default for GemmaEGuiState {
@@ -14,7 +15,8 @@ impl Default for GemmaEGuiState {
display_memory: true,
display_registers: true,
memory_view_min: 0x00,
memory_view_max: 0x100
memory_view_max: 0x100,
is_running: false
}
}
}
@@ -19,16 +19,18 @@ impl EGuiFileList {
let mut working_filename = selected_filename.clone();
ui.label(format!("Displaying {}", root.to_str().unwrap_or("Unable to Load Path")));
egui::ComboBox::from_label(format!(
"Currently selected string: {}",
selected_filename
))
ComboBox::from_label("Choose an option")
.selected_text(selected_filename.clone())
.show_ui(ui, |ui| {
for option in read_dir(root.as_path()).unwrap() {
ui.label(format!("{:?}", option.unwrap().file_name()));
// Add each option to the ComboBox
let mut label = option.unwrap().file_name();
ui.selectable_value(selected_filename, selected_filename.clone(), label.into_string().unwrap());
}
});
// Display the selected option
ui.label(format!("Selected value: {}", selected_filename));
}
}
@@ -39,6 +41,7 @@ impl GemmaEguiSupport {
ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| {
if ui.button("Start").clicked() {
println!("Start");
state.is_running = true;
}
if ui.button("Step").clicked() {
@@ -47,6 +50,7 @@ impl GemmaEguiSupport {
if ui.button("Stop").clicked() {
println!("STOP");
state.is_running = false;
}
if ui.button("Reset").clicked() {
system.reset();
@@ -60,6 +64,8 @@ impl GemmaEguiSupport {
// ...then feed the system.
system.load_bytes_to_memory(0x200, &read_bin);
}
let mut target = String::new();
EGuiFileList::display_path(PathBuf::from("resources/roms"), &mut target, ui);
});