Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/manual/network/ltoudp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ real Mac hardware through an adapter such as the [TashTalk](https://github.com/l

By default, MacOS will use serial port B for LocalTalk. To enable LToUDP, enable the bridge through the
'Ports' -> 'Channel B (printer)' -> 'Enable LocalTalk (UDP)', or start Snow with `--serial-bridge-b localtalk`.
The bridge setting is saved in the workspace, so it is re-enabled the next time the workspace is loaded.

![LToUDP menu](../../images/ltoudp_menu.png)

Expand Down
6 changes: 6 additions & 0 deletions docs/src/manual/ports.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ filename of the virtual serial port for use in your host operating system. On Li
and
on MacOS `/dev/ttys<nnn>`.

## Saving bridges in the workspace

Enabled bridges are saved in the workspace and re-enabled when the workspace is loaded. A PTY bridge gets a new device
filename every time it is enabled. Bridges specified on the command line (`--serial-bridge-a`, `--serial-bridge-b`)
take precedence over those saved in the workspace.

## Using the built-in terminal

![Terminal](../images/ports_terminal.png)
Expand Down
15 changes: 14 additions & 1 deletion frontend_egui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,7 @@ impl SnowGui {
}
}

fn draw_serial_bridge_menu(&self, ui: &mut egui::Ui, ch: SccCh) {
fn draw_serial_bridge_menu(&mut self, ui: &mut egui::Ui, ch: SccCh) {
let is_enabled = self.emu.is_serial_bridge_enabled(ch);
let emu_ready = self.emu.is_initialized();

Expand All @@ -1893,6 +1893,7 @@ impl SnowGui {
.clicked()
{
let _ = self.emu.disable_serial_bridge(ch);
self.workspace.serial_bridges[ch as usize] = None;
}
} else {
// Bridge is inactive - show enable options
Expand All @@ -1904,6 +1905,7 @@ impl SnowGui {
.clicked()
{
let _ = self.emu.enable_serial_bridge(ch, SerialBridgeConfig::Pty);
self.workspace.serial_bridges[ch as usize] = Some(SerialBridgeConfig::Pty);
}

let port = match ch {
Expand All @@ -1920,6 +1922,7 @@ impl SnowGui {
let _ = self
.emu
.enable_serial_bridge(ch, SerialBridgeConfig::Tcp(port));
self.workspace.serial_bridges[ch as usize] = Some(SerialBridgeConfig::Tcp(port));
}

if ui
Expand All @@ -1929,6 +1932,7 @@ impl SnowGui {
let _ = self
.emu
.enable_serial_bridge(ch, SerialBridgeConfig::LocalTalk);
self.workspace.serial_bridges[ch as usize] = Some(SerialBridgeConfig::LocalTalk);
}
}
}
Expand Down Expand Up @@ -2732,6 +2736,15 @@ impl SnowGui {
self.emu
.set_eth_link(id, self.workspace.get_ethernet_link_type());
}

// Bridges given on the command line take precedence over the workspace
for (idx, ch) in [SccCh::A, SccCh::B].into_iter().enumerate() {
if self.pending_serial_bridges[idx].is_none()
&& let Some(config) = self.workspace.serial_bridges[idx].clone()
{
let _ = self.emu.enable_serial_bridge(ch, config);
}
}
} else {
self.emu.deinit();
self.ff_on = false;
Expand Down
5 changes: 5 additions & 0 deletions frontend_egui/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use snow_core::mac::MacModel;
#[cfg(feature = "ethernet")]
use snow_core::mac::scsi::ethernet::EthernetLinkType;
use snow_core::mac::scsi::target::ScsiTargetType;
use snow_core::mac::serial_bridge::SerialBridgeConfig;

/// Custom deserializer that skips invalid shader configs instead of failing entirely
fn deserialize_shader_configs_lenient<'de, D>(
Expand Down Expand Up @@ -302,6 +303,9 @@ pub struct Workspace {

/// Ethernet link type
pub ethernet_link_type: WorkspaceEthernetLinkType,

/// Serial bridges per SCC channel (index 0 = Channel A, index 1 = Channel B)
pub serial_bridges: [Option<SerialBridgeConfig>; 2],
}

impl Default for Workspace {
Expand Down Expand Up @@ -338,6 +342,7 @@ impl Default for Workspace {
shader_enabled: false,
shader_configs: Vec::new(),
ethernet_link_type: WorkspaceEthernetLinkType::default(),
serial_bridges: [None, None],
}
}
}
Expand Down
Loading