diff --git a/src/gb/GB.cpp b/src/gb/GB.cpp index e04568b9..935a1d34 100644 --- a/src/gb/GB.cpp +++ b/src/gb/GB.cpp @@ -808,7 +808,7 @@ void gbWriteMemory(register u16 address, register u8 value) } EmuReseted = false; gbMemory[0xff02] = value; - if (gbSerialOn) { + if (gbSerialOn && GetLinkMode() == LINK_GAMEBOY) { gbSerialTicks = GBSERIAL_CLOCK_TICKS; LinkIsWaiting = true; @@ -2201,8 +2201,10 @@ void gbGetHardwareType() void gbReset() { #ifndef NO_LINK - EmuReseted = true; - gbLinkReset(); + if (GetLinkMode() == LINK_GAMEBOY) { + EmuReseted = true; + gbLinkReset(); + } #endif gbGetHardwareType(); @@ -5254,7 +5256,8 @@ void gbEmulate(int ticksToStop) static int SIOctr = 0; SIOctr++; if (SIOctr % 5) - if (gbSerialOn) { //Transfer Started + //Transfer Started + if (gbSerialOn && GetLinkMode() == LINK_GAMEBOY) { #ifdef OLD_GB_LINK if (linkConnected) { gbSerialTicks -= clockTicks; diff --git a/src/gba/GBALink.cpp b/src/gba/GBALink.cpp index 156a5133..fafd2179 100644 --- a/src/gba/GBALink.cpp +++ b/src/gba/GBALink.cpp @@ -300,7 +300,6 @@ typedef struct { int type; bool server; bool speed; //speedhack - bool active; //network/single computer } LANLINKDATA; class lserver{ @@ -1882,7 +1881,7 @@ bool LinkRFUUpdate() { //if (IsLinkConnected()) { //} - if (!lanlink.active || rfu_enabled) { + if (rfu_enabled) { if (transfer&&rfu_transfer_end <= 0) { if (rfu_waiting) { @@ -2231,6 +2230,9 @@ static ConnectionState InitSocket() { ConnectionState InitLink(LinkMode mode) { + if (mode == LINK_DISCONNECTED) + return LINK_ABORT; + // Do nothing if we are already connected if (GetLinkMode() != LINK_DISCONNECTED) { systemMessage(0, N_("Error, link already connected")); @@ -2720,7 +2722,7 @@ u8 gbStartLink(u8 b) //used on internal clock if (!gba_link_enabled) return 0xff; //Single Computer - if (!lanlink.active) + if (GetLinkMode() == LINK_GAMEBOY) { u32 tm = GetTickCount(); do { @@ -2764,7 +2766,7 @@ u16 gbLinkUpdate(u8 b, int gbSerialOn) //used on external clock if (gbSerialOn) { if (gba_link_enabled) //Single Computer - if (!lanlink.active) + if (GetLinkMode() == LINK_GAMEBOY) { u32 tm;// = GetTickCount(); //do { diff --git a/src/win32/LinkOptions.cpp b/src/win32/LinkOptions.cpp index 2ff4112a..8c3ad57b 100644 --- a/src/win32/LinkOptions.cpp +++ b/src/win32/LinkOptions.cpp @@ -133,6 +133,15 @@ void LinkOptions::OnOk() SetLinkTimeout(timeout); LinkMode newMode = (LinkMode) m_type; + + if (newMode == LINK_DISCONNECTED) { + theApp.linkTimeout = timeout; + theApp.linkMode = LINK_DISCONNECTED; + theApp.linkHost = host; + CDialog::OnOK(); + return; + } + bool needsServerHost = newMode == LINK_GAMECUBE_DOLPHIN || (newMode == LINK_CABLE_SOCKET && !m_server); if (needsServerHost) {