Skip to content

Commit

Permalink
Uthernet2 as a Card.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
  • Loading branch information
audetto committed Dec 3, 2021
2 parents 9439b1b + 3128fdb commit 6e42274
Show file tree
Hide file tree
Showing 7 changed files with 862 additions and 801 deletions.
3 changes: 2 additions & 1 deletion source/CardManager.cpp
Expand Up @@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "SerialComms.h"
#include "SNESMAX.h"
#include "VidHD.h"
#include "linux/network/uthernet2.h"

void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
{
Expand Down Expand Up @@ -92,7 +93,7 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_Uthernet2:
m_slot[slot] = new DummyCard(type, slot);
m_slot[slot] = new Uthernet2(slot);
break;
case CT_FourPlay:
m_slot[slot] = new FourPlayCard(slot);
Expand Down
18 changes: 0 additions & 18 deletions source/frontends/common2/utils.cpp
Expand Up @@ -2,8 +2,6 @@
#include "frontends/common2/utils.h"
#include "frontends/common2/programoptions.h"

#include "linux/network/uthernet2.h"

#include "SaveState.h"

#include "Common.h"
Expand Down Expand Up @@ -62,20 +60,6 @@ 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
Expand All @@ -92,7 +76,6 @@ namespace common2

GetVideo().SetVidHD(false);
LoadConfiguration();
LoadUthernet2();
SetCurrentCLK6502();
GetAppleWindowTitle();
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES | DRAW_DISK_STATUS);
Expand Down Expand Up @@ -131,7 +114,6 @@ namespace common2
MB_Destroy();
DSUninit();

unRegisterUthernet2();
tfe_shutdown();

if (cardManager.QuerySlot(SLOT7) == CT_GenericHDD)
Expand Down
2 changes: 2 additions & 0 deletions source/frontends/sdl/imgui/sdlsettings.cpp
Expand Up @@ -331,6 +331,8 @@ namespace sa2
if (ImGui::Selectable(getCardName(card).c_str(), isSelected))
{
SetExpansionMemType(card);
CreateLanguageCard();
MemInitializeIO();
}
if (isSelected)
{
Expand Down
21 changes: 7 additions & 14 deletions source/frontends/sdl/imgui/settingshelper.cpp
Expand Up @@ -3,6 +3,7 @@
#include "Registry.h"
#include "Harddisk.h"
#include "Core.h"
#include "Memory.h"
#include "Debugger/Debug.h"

#include "Tfe/tfe.h"
Expand Down Expand Up @@ -102,8 +103,8 @@ namespace
{3, {CT_Empty, CT_Uthernet, CT_Uthernet2, CT_VidHD}},
{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}},
{6, {CT_Empty, CT_Disk2, CT_Uthernet2}},
{7, {CT_Empty, CT_GenericHDD, CT_Uthernet2}},
};

const std::vector<SS_CARDTYPE> expansionCards =
Expand Down Expand Up @@ -183,19 +184,11 @@ namespace sa2
}
};

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);

// keep everything consistent
// a bit of a heavy call, but nothing simpler is available now
MemInitializeIO();
}

void setVideoStyle(Video & video, const VideoStyle_e style, const bool enabled)
Expand Down
2 changes: 0 additions & 2 deletions source/frontends/sdl/main.cpp
Expand Up @@ -7,7 +7,6 @@
#include "StdAfx.h"
#include "linux/benchmark.h"
#include "linux/context.h"
#include "linux/network/uthernet2.h"

#include "frontends/common2/fileregistry.h"
#include "frontends/common2/utils.h"
Expand Down Expand Up @@ -143,7 +142,6 @@ void run_sdl(int argc, const char * argv [])

eventTimer.tic();
sa2::writeAudio();
processEventsUthernet2(5);
frame->ProcessEvents(quit);
eventTimer.toc();

Expand Down

0 comments on commit 6e42274

Please sign in to comment.