Add Uthernet configuration.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-04-18 19:01:05 +01:00
parent 9aefc20d24
commit f1b9232933
2 changed files with 50 additions and 7 deletions

View file

@ -21,6 +21,9 @@
#include "Debugger/Debug.h" #include "Debugger/Debug.h"
#include "Debugger/DebugDefs.h" #include "Debugger/DebugDefs.h"
#include "Tfe/tfe.h"
#include "Tfe/tfesupp.h"
#include "imgui_internal.h" #include "imgui_internal.h"
namespace namespace
@ -548,6 +551,41 @@ namespace sa2
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("Uthernet"))
{
standardLabelText("Status", tfe_enabled ? "enabled" : "disabled");
if (ImGui::BeginCombo("Interface", static_cast<const char *>(get_tfe_interface())))
{
if (tfe_enumadapter_open())
{
char *pname;
char *pdescription;
while (tfe_enumadapter(&pname, &pdescription))
{
// must call it each time
// as update_tfe_interface() will invalidate it
const char * current = static_cast<const char *>(get_tfe_interface());
const bool isSelected = strcmp(pname, current) == 0;
if (ImGui::Selectable(pname, isSelected))
{
update_tfe_interface(pname, nullptr);
RegSaveString(TEXT(REG_CONFIG), TEXT(REGVALUE_UTHERNET_INTERFACE), 1, pname);
}
if (isSelected)
{
ImGui::SetItemDefaultFocus();
}
lib_free(pname);
lib_free(pdescription);
}
tfe_enumadapter_close();
}
ImGui::EndCombo();
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Debugger")) if (ImGui::BeginTabItem("Debugger"))
{ {
if (ImGui::RadioButton("Color", g_iColorScheme == SCHEME_COLOR)) { g_iColorScheme = SCHEME_COLOR; } ImGui::SameLine(); if (ImGui::RadioButton("Color", g_iColorScheme == SCHEME_COLOR)) { g_iColorScheme = SCHEME_COLOR; } ImGui::SameLine();

View file

@ -153,21 +153,26 @@ namespace sa2
switch (slot) switch (slot)
{ {
case 3:
{
const bool enabled = card == CT_Uthernet;
REGSAVE(REGVALUE_UTHERNET_ACTIVE, enabled);
// needs a reboot anyway
break;
}
case 7: case 7:
{ {
const bool enabled = card == CT_GenericHDD; const bool enabled = card == CT_GenericHDD;
REGSAVE(REGVALUE_HDD_ENABLED, enabled); REGSAVE(REGVALUE_HDD_ENABLED, enabled);
HD_SetEnabled(enabled); HD_SetEnabled(enabled);
}
default:
{
// we do not use REGVALUE_SLOT5 as they are not "runtime friendly"
const std::string label = "Slot " + std::to_string(slot);
REGSAVE(label.c_str(), (DWORD)card);
cardManager.Insert(slot, card);
break; break;
} }
}; };
// we do not use REGVALUE_SLOT5 as they are not "runtime friendly"
const std::string label = "Slot " + std::to_string(slot);
REGSAVE(label.c_str(), (DWORD)card);
cardManager.Insert(slot, card);
} }
void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled) void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)