No debugging unless the game is running
This commit is contained in:
+6
-2
@@ -3,7 +3,7 @@ use winit::event_loop::EventLoopProxy;
|
||||
|
||||
use crate::{
|
||||
app::UserEvent,
|
||||
emulator::{EmulatorClient, SimId},
|
||||
emulator::{EmulatorClient, SimId, SimState},
|
||||
gdbserver::{GdbServer, GdbServerStatus},
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ use super::AppWindow;
|
||||
|
||||
pub struct GdbServerWindow {
|
||||
sim_id: SimId,
|
||||
client: EmulatorClient,
|
||||
port_str: String,
|
||||
connected: bool,
|
||||
quit_on_disconnect: bool,
|
||||
@@ -22,6 +23,7 @@ impl GdbServerWindow {
|
||||
pub fn new(sim_id: SimId, client: EmulatorClient, proxy: EventLoopProxy<UserEvent>) -> Self {
|
||||
Self {
|
||||
sim_id,
|
||||
client: client.clone(),
|
||||
port_str: (8080 + sim_id.to_index()).to_string(),
|
||||
connected: false,
|
||||
quit_on_disconnect: false,
|
||||
@@ -78,7 +80,9 @@ impl AppWindow for GdbServerWindow {
|
||||
self.connected = false;
|
||||
}
|
||||
let start_button = Button::new("Start");
|
||||
if ui.add_enabled(port_num.is_some(), start_button).clicked() {
|
||||
let can_start =
|
||||
port_num.is_some() && self.client.sim_state(self.sim_id) == SimState::Ready;
|
||||
if ui.add_enabled(can_start, start_button).clicked() {
|
||||
let port = port_num.unwrap();
|
||||
self.server.start(port);
|
||||
self.connected = true;
|
||||
|
||||
Reference in New Issue
Block a user