SIO: Add debugging option to redirect to TTY

Until I bother to finish my sio branch...
This commit is contained in:
Stenzek 2025-07-01 19:00:15 +10:00
parent d0f4f579e1
commit 0098c60ee8
No known key found for this signature in database
5 changed files with 13 additions and 3 deletions

View File

@ -953,7 +953,7 @@ void Bus::AddTTYCharacter(char ch)
}
s_tty_line_buffer.clear();
}
else
else if (ch != '\0')
{
s_tty_line_buffer += ch;
}

View File

@ -510,6 +510,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro
pio_flash_image_path = si.GetStringValue("PIO", "FlashImagePath");
pio_flash_write_enable = si.GetBoolValue("PIO", "FlashImageWriteEnable", false);
pio_switch_active = si.GetBoolValue("PIO", "SwitchActive", true);
sio_redirect_to_tty = si.GetBoolValue("SIO", "RedirectToTTY", false);
pcdrv_enable = si.GetBoolValue("PCDrv", "Enabled", false);
pcdrv_enable_writes = si.GetBoolValue("PCDrv", "EnableWrites", false);
@ -797,6 +798,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
si.SetStringValue("PIO", "FlashImagePath", pio_flash_image_path.c_str());
si.SetBoolValue("PIO", "FlashImageWriteEnable", pio_flash_write_enable);
si.SetBoolValue("PIO", "SwitchActive", pio_switch_active);
si.SetBoolValue("SIO", "RedirectToTTY", sio_redirect_to_tty);
si.SetBoolValue("PCDrv", "Enabled", pcdrv_enable);
si.SetBoolValue("PCDrv", "EnableWrites", pcdrv_enable_writes);

View File

@ -340,6 +340,7 @@ struct Settings : public GPUSettings
bool memory_card_fast_forward_access : 1 = false;
bool pio_switch_active : 1 = true;
bool pio_flash_write_enable : 1 = false;
bool sio_redirect_to_tty : 1 = false;
bool pcdrv_enable_writes : 1 = false;
// achievements

View File

@ -1,7 +1,8 @@
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "sio.h"
#include "bus.h"
#include "controller.h"
#include "util/state_wrapper.h"
@ -137,7 +138,11 @@ void SIO::WriteRegister(u32 offset, u32 value)
{
case 0x00: // SIO_DATA
{
if (g_settings.sio_redirect_to_tty)
Bus::AddTTYCharacter(static_cast<char>(value));
else
WARNING_LOG("SIO_DATA (W) <- 0x{:02X}", value);
return;
}

View File

@ -317,6 +317,7 @@ void AdvancedSettingsWidget::addTweakOptions()
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Export Shared Memory"), "Hacks", "ExportSharedMemory",
false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Redirect SIO to TTY"), "SIO", "RedirectToTTY", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable PCDrv"), "PCDrv", "Enabled", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable PCDrv Writes"), "PCDrv", "EnableWrites", false);
addDirectoryOption(m_dialog, m_ui.tweakOptionTable, tr("PCDrv Root Directory"), "PCDrv", "Root");
@ -360,6 +361,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable GDB Server
setIntRangeTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_GDB_SERVER_PORT); // GDB Server Port
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Export Shared Memory
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Redirect SIO to TTY
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Enable PCDRV Writes
setDirectoryOption(m_ui.tweakOptionTable, i++, ""); // PCDrv Root Directory