From 567d9bec6c4bf0977a9b46068923c5495253a677 Mon Sep 17 00:00:00 2001 From: bgk Date: Fri, 21 Sep 2012 19:03:20 +0000 Subject: [PATCH] MFC: Fix to use the new link API git-svn-id: https://svn.code.sf.net/p/vbam/code/branches/bgk-link@1136 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/LinkOptions.cpp | 11 +++++++---- src/win32/VBA.cpp | 4 ++-- src/win32/VBA.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/win32/LinkOptions.cpp b/src/win32/LinkOptions.cpp index 2e7e5b3e..463936df 100644 --- a/src/win32/LinkOptions.cpp +++ b/src/win32/LinkOptions.cpp @@ -74,7 +74,7 @@ BOOL LinkOptions::OnInitDialog(){ AddMode("GameCube - Dolphin", LINK_GAMECUBE_DOLPHIN); AddMode("Wireless adapter - Single Computer", LINK_RFU_IPC); - sprintf(timeout, "%d", linktimeout); + sprintf(timeout, "%d", theApp.linkTimeout); m_timeout.LimitText(5); m_timeout.SetWindowText(timeout); @@ -115,7 +115,8 @@ void LinkOptions::AddMode(LPCTSTR name, int value) { void LinkOptions::OnOk() { static const int length = 256; - CString timeout; + int timeout; + CString timeoutStr; CString host; CString title; CString addressMessage; @@ -126,8 +127,9 @@ void LinkOptions::OnOk() CloseLink(); m_serverip.GetWindowText(host); - m_timeout.GetWindowText(timeout); - sscanf(timeout, "%d", &linktimeout); + m_timeout.GetWindowText(timeoutStr); + sscanf(timeoutStr, "%d", &timeout); + SetLinkTimeout(timeout); LinkMode newMode = (LinkMode) m_type; bool needsServerHost = newMode == LINK_GAMECUBE_DOLPHIN || (newMode == LINK_CABLE_SOCKET && !m_server); @@ -206,6 +208,7 @@ void LinkOptions::OnOk() return; } + theApp.linkTimeout = timeout; theApp.linkMode = GetLinkMode(); theApp.linkHost = host; diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index f5e89b30..9ac37f5c 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -1621,7 +1621,7 @@ void VBA::loadSettings() updateThrottle( (unsigned short)regQueryDwordValue( "throttle", 0 ) ); #ifndef NO_LINK - linktimeout = regQueryDwordValue("LinkTimeout", 1000); + linkTimeout = regQueryDwordValue("LinkTimeout", 1000); linkMode = regQueryDwordValue("LinkMode", LINK_DISCONNECTED); @@ -2553,7 +2553,7 @@ void VBA::saveSettings() regSetDwordValue("saveMoreCPU", Sm60FPS::bSaveMoreCPU); #ifndef NO_LINK - regSetDwordValue("LinkTimeout", linktimeout); + regSetDwordValue("LinkTimeout", linkTimeout); regSetDwordValue("LinkMode", linkMode); regSetStringValue("LinkHostAddr", linkHost); #endif diff --git a/src/win32/VBA.h b/src/win32/VBA.h index fbb6cd02..e1f96b3c 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -203,6 +203,7 @@ class VBA : public CWinApp CString wndClass; + int linkTimeout; int linkMode; CString linkHost;