Support (again) the Uthernet2 card.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
4129a78254
commit
ed98c6ce01
7 changed files with 85 additions and 85 deletions
|
@ -23,6 +23,7 @@ enum SS_CARDTYPE
|
|||
CT_Saturn128K, // Saturn 128K (but may be populated with less RAM, in multiples of 16K)
|
||||
CT_FourPlay, // 4 port Atari 2600 style digital joystick card
|
||||
CT_SNESMAX, // 2 port Nintendo NES/SNES controller serial interface card
|
||||
CT_Uthernet2,
|
||||
};
|
||||
|
||||
enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS, SLOT_AUX };
|
||||
|
|
|
@ -89,6 +89,9 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
|
|||
case CT_Uthernet:
|
||||
m_slot[slot] = new DummyCard(type);
|
||||
break;
|
||||
case CT_Uthernet2:
|
||||
m_slot[slot] = new DummyCard(type);
|
||||
break;
|
||||
case CT_FourPlay:
|
||||
m_slot[slot] = new FourPlayCard(slot);
|
||||
break;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "StdAfx.h"
|
||||
#include "frontends/common2/utils.h"
|
||||
|
||||
#include "linux/network/uthernet2.h"
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "SaveState.h"
|
||||
|
||||
#include "Common.h"
|
||||
|
@ -60,6 +60,20 @@ namespace common2
|
|||
}
|
||||
}
|
||||
|
||||
void LoadUthernet2()
|
||||
{
|
||||
CardManager & cardManager = GetCardMgr();
|
||||
for (UINT slot = SLOT1; slot < NUM_SLOTS; slot++)
|
||||
{
|
||||
if (cardManager.QuerySlot(slot) == CT_Uthernet2)
|
||||
{
|
||||
// AppleWin does not know anything about this
|
||||
registerUthernet2(slot);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitialiseEmulator()
|
||||
{
|
||||
#ifdef RIFF_SPKR
|
||||
|
@ -75,6 +89,7 @@ namespace common2
|
|||
g_bFullSpeed = false;
|
||||
|
||||
LoadConfiguration();
|
||||
LoadUthernet2();
|
||||
SetCurrentCLK6502();
|
||||
GetAppleWindowTitle();
|
||||
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
|
||||
|
@ -88,16 +103,6 @@ namespace common2
|
|||
GetCardMgr().GetDisk2CardMgr().Reset();
|
||||
HD_Reset();
|
||||
|
||||
switch (tfe_enabled)
|
||||
{
|
||||
case 1:
|
||||
tfe_init(true);
|
||||
break;
|
||||
case 2:
|
||||
registerUthernet2();
|
||||
break;
|
||||
}
|
||||
|
||||
Snapshot_Startup();
|
||||
|
||||
DebugInitialize();
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "Tfe/tfe.h"
|
||||
#include "Tfe/tfesupp.h"
|
||||
#include "linux/network/uthernet2.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -287,7 +286,7 @@ namespace sa2
|
|||
|
||||
ImGui::LabelText("Slot", "Card");
|
||||
CardManager & manager = GetCardMgr();
|
||||
for (size_t slot = 1; slot < 8; ++slot)
|
||||
for (size_t slot = SLOT1; slot < NUM_SLOTS; ++slot)
|
||||
{
|
||||
const SS_CARDTYPE current = manager.QuerySlot(slot);
|
||||
if (ImGui::BeginCombo(std::to_string(slot).c_str(), getCardName(current).c_str()))
|
||||
|
@ -333,6 +332,44 @@ namespace sa2
|
|||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
const std::string current_interface = get_tfe_interface();
|
||||
|
||||
if (ImGui::BeginCombo("pcap", current_interface.c_str()))
|
||||
{
|
||||
std::vector<char *> ifaces;
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
char *pname;
|
||||
char *pdescription;
|
||||
|
||||
while (tfe_enumadapter(&pname, &pdescription))
|
||||
{
|
||||
ifaces.push_back(pname);
|
||||
lib_free(pdescription);
|
||||
}
|
||||
tfe_enumadapter_close();
|
||||
|
||||
for (const auto & iface : ifaces)
|
||||
{
|
||||
const bool isSelected = strcmp(iface, current_interface.c_str()) == 0;
|
||||
if (ImGui::Selectable(iface, isSelected))
|
||||
{
|
||||
// the following line interacts with tfe_enumadapter, so we must run it outside the above loop
|
||||
update_tfe_interface(iface);
|
||||
tfe_SetRegistryInterface(SLOT3, iface);
|
||||
}
|
||||
if (isSelected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
lib_free(iface);
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
|
@ -582,50 +619,6 @@ namespace sa2
|
|||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Uthernet"))
|
||||
{
|
||||
if (ImGui::RadioButton("Disabled", tfe_enabled == 0)) { saveTFEEnabled(0); } ImGui::SameLine();
|
||||
if (ImGui::RadioButton("Uthernet I", tfe_enabled == 1)) { saveTFEEnabled(1); } ImGui::SameLine();
|
||||
if (ImGui::RadioButton("Uthernet II", tfe_enabled == 2)) { saveTFEEnabled(2); }
|
||||
|
||||
const std::string current_interface = get_tfe_interface();
|
||||
|
||||
if (ImGui::BeginCombo("Interface", current_interface.c_str()))
|
||||
{
|
||||
std::vector<char *> ifaces;
|
||||
if (tfe_enumadapter_open())
|
||||
{
|
||||
char *pname;
|
||||
char *pdescription;
|
||||
|
||||
while (tfe_enumadapter(&pname, &pdescription))
|
||||
{
|
||||
ifaces.push_back(pname);
|
||||
lib_free(pdescription);
|
||||
}
|
||||
tfe_enumadapter_close();
|
||||
|
||||
for (const auto & iface : ifaces)
|
||||
{
|
||||
const bool isSelected = strcmp(iface, current_interface.c_str()) == 0;
|
||||
if (ImGui::Selectable(iface, isSelected))
|
||||
{
|
||||
// the following line interacts with tfe_enumadapter, so we must run it outside the above loop
|
||||
update_tfe_interface(iface);
|
||||
RegSaveString(TEXT(REG_CONFIG), TEXT(REGVALUE_UTHERNET_INTERFACE), 1, iface);
|
||||
}
|
||||
if (isSelected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
lib_free(iface);
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("Tape"))
|
||||
{
|
||||
CassetteTape & tape = CassetteTape::instance();
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace
|
|||
{CT_Saturn128K, "CT_Saturn128K"},
|
||||
{CT_FourPlay, "CT_FourPlay"},
|
||||
{CT_SNESMAX, "CT_SNESMAX"},
|
||||
{CT_Uthernet2, "CT_Uthernet2"},
|
||||
};
|
||||
|
||||
const std::map<eApple2Type, std::string> apple2Types =
|
||||
|
@ -95,11 +96,11 @@ namespace
|
|||
const std::map<size_t, std::vector<SS_CARDTYPE>> cardsForSlots =
|
||||
{
|
||||
{0, {CT_Empty, CT_LanguageCard, CT_Saturn128K}},
|
||||
{1, {CT_Empty, CT_GenericPrinter}},
|
||||
{2, {CT_Empty, CT_SSC}},
|
||||
{3, {CT_Empty, CT_Uthernet}},
|
||||
{4, {CT_Empty, CT_MockingboardC, CT_MouseInterface, CT_Phasor}},
|
||||
{5, {CT_Empty, CT_MockingboardC, CT_Z80, CT_SAM, CT_Disk2, CT_FourPlay, CT_SNESMAX}},
|
||||
{1, {CT_Empty, CT_GenericPrinter, CT_Uthernet2}},
|
||||
{2, {CT_Empty, CT_SSC, CT_Uthernet2}},
|
||||
{3, {CT_Empty, CT_Uthernet2}},
|
||||
{4, {CT_Empty, CT_MockingboardC, CT_MouseInterface, CT_Phasor, CT_Uthernet2}},
|
||||
{5, {CT_Empty, CT_MockingboardC, CT_Z80, CT_SAM, CT_Disk2, CT_FourPlay, CT_SNESMAX, CT_Uthernet2}},
|
||||
{6, {CT_Empty, CT_Disk2}},
|
||||
{7, {CT_Empty, CT_GenericHDD}},
|
||||
};
|
||||
|
@ -107,15 +108,6 @@ namespace
|
|||
const std::vector<SS_CARDTYPE> expansionCards =
|
||||
{CT_Empty, CT_LanguageCard, CT_Extended80Col, CT_Saturn128K, CT_RamWorksIII};
|
||||
|
||||
void internalInsertCard(const size_t slot, const SS_CARDTYPE card)
|
||||
{
|
||||
std::string& regSection = RegGetConfigSlotSection(slot);
|
||||
RegSaveValue(regSection.c_str(), REGVALUE_CARD_TYPE, TRUE, CT_Disk2);
|
||||
|
||||
CardManager & cardManager = GetCardMgr();
|
||||
cardManager.Insert(slot, card);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace sa2
|
||||
|
@ -168,28 +160,22 @@ namespace sa2
|
|||
|
||||
void insertCard(size_t slot, SS_CARDTYPE card)
|
||||
{
|
||||
CardManager & cardManager = GetCardMgr();
|
||||
switch (slot)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
const int enabled = card == CT_Uthernet ? 1 : 0;
|
||||
REGSAVE(REGVALUE_UTHERNET_ACTIVE, enabled);
|
||||
// needs a reboot anyway
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
{
|
||||
if (card == CT_MockingboardC)
|
||||
{
|
||||
internalInsertCard(9 - slot, card); // the other
|
||||
cardManager.Insert(9 - slot, card); // the other
|
||||
}
|
||||
else
|
||||
{
|
||||
CardManager & cardManager = GetCardMgr();
|
||||
if (cardManager.QuerySlot(slot) == CT_MockingboardC)
|
||||
{
|
||||
internalInsertCard(9 - slot, CT_Empty); // the other
|
||||
cardManager.Insert(9 - slot, CT_Empty); // the other
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -203,7 +189,19 @@ namespace sa2
|
|||
}
|
||||
};
|
||||
|
||||
internalInsertCard(slot, card);
|
||||
if (card == CT_Uthernet2)
|
||||
{
|
||||
// only 1 Uthernet2 allowed
|
||||
for (size_t s = SLOT1; s < NUM_SLOTS; ++s)
|
||||
{
|
||||
if (cardManager.QuerySlot(s) == card)
|
||||
{
|
||||
cardManager.Insert(s, CT_Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cardManager.Insert(slot, card);
|
||||
}
|
||||
|
||||
void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)
|
||||
|
|
|
@ -1009,14 +1009,14 @@ namespace
|
|||
|
||||
}
|
||||
|
||||
void registerUthernet2()
|
||||
void registerUthernet2(UINT uSlot)
|
||||
{
|
||||
#ifdef U2_USE_SLIRP
|
||||
slirp.reset();
|
||||
slirp = std::make_shared<SlirpNet>();
|
||||
#else
|
||||
const int check = tfe_enabled;
|
||||
tfe_init();
|
||||
tfe_init(true);
|
||||
if (tfe_enabled != check)
|
||||
{
|
||||
// tfe initialisation failed
|
||||
|
@ -1025,7 +1025,7 @@ void registerUthernet2()
|
|||
#endif
|
||||
dataAddress = 0;
|
||||
initialise();
|
||||
RegisterIoHandler(SLOT3, u2_C0, u2_C0, nullptr, nullptr, nullptr, nullptr);
|
||||
RegisterIoHandler(uSlot, u2_C0, u2_C0, nullptr, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void unRegisterUthernet2()
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
// this register the IOCalls for Uthernet 2 on slot 3
|
||||
// if TFE is not enabled (or available) all operations will timeout
|
||||
void registerUthernet2();
|
||||
void registerUthernet2(UINT uSlot);
|
||||
void unRegisterUthernet2();
|
||||
void processEventsUthernet2(uint32_t timeout);
|
||||
|
|
Loading…
Add table
Reference in a new issue