CLI argument to start the server at startup

This commit is contained in:
2025-01-01 13:13:01 -05:00
parent b94ae4d586
commit 2c5084d317
3 changed files with 24 additions and 5 deletions
+13 -4
View File
@@ -41,10 +41,15 @@ pub struct Application {
persistence: Persistence,
viewports: HashMap<ViewportId, Viewport>,
focused: Option<ViewportId>,
init_debug_port: Option<u16>,
}
impl Application {
pub fn new(client: EmulatorClient, proxy: EventLoopProxy<UserEvent>) -> Self {
pub fn new(
client: EmulatorClient,
proxy: EventLoopProxy<UserEvent>,
debug_port: Option<u16>,
) -> Self {
let icon = load_icon().ok().map(Arc::new);
let persistence = Persistence::new();
let mappings = MappingProvider::new(persistence.clone());
@@ -63,6 +68,7 @@ impl Application {
persistence,
viewports: HashMap::new(),
focused: None,
init_debug_port: debug_port,
}
}
@@ -86,9 +92,12 @@ impl ApplicationHandler<UserEvent> for Application {
self.persistence.clone(),
SimId::Player1,
);
let wrapper = Viewport::new(event_loop, self.icon.clone(), Box::new(app));
self.focused = Some(wrapper.id());
self.viewports.insert(wrapper.id(), wrapper);
self.open(event_loop, Box::new(app));
if let Some(port) = self.init_debug_port {
let mut server = GdbServerWindow::new(SimId::Player1, self.client.clone());
server.start(port);
self.open(event_loop, Box::new(server));
}
}
fn window_event(