[C++] How to make Launcher keep wating response until server start
this will make launcher keep wating response from server. without (re-opening launcher)
AtumLauncherDlg.h
Code:
// add this to bottom of header list (if dont know just put some where until you can complie it)
define TIMERID_SERVER_START_CHECK 5
...
// find this
public:
CUpdateWinSocket *m_pUpdateWinsocket;
// add this inside that public:
BOOL m_bReadyNextRequest;z
BOOL m_bProcessingServerRespone;
DWORD m_bDotCount;
AtumLauncherDlg.cpp
Code:
CAtumLauncherDlg::CAtumLauncherDlg(....)
// add this inside function
m_bProcessingServerRespone = FALSE;
m_bReadyNextRequest = FALSE;
m_bDotCount = 0;
...
LONG CAtumLauncherDlg::OnSocketNotify(WPARAM wParam, LPARAM lParam)
// find case T_PC_CONNECT_VERSION_OK:
// replace this
SetProgressGroupText(STRMSG_S_ATUMLAUNCHER_0000);
m_bProcessingVersionUpdate = TRUE;
// with this
m_bProcessingVersionUpdate = TRUE;
if (m_bProcessingServerRespone == FALSE)
{
m_bReadyNextRequest = TRUE;
SetTimer(TIMERID_SERVER_START_CHECK, 500, NULL);
SetProgressGroupText(STRMSG_S_ATUMLAUNCHER_0000_A);
return 0;
}
UPDATECOMPLETE:
SetProgressGroupText(STRMSG_S_ATUMLAUNCHER_0000_B);
...
//find case T_PC_CONNECT_GET_SERVER_GROUP_LIST_OK:
// then focus to this
AtumMessageBox(STRERR_S_ATUMLAUNCHER_0012);
OnCancel();
//replace with this
m_bReadyNextRequest = TRUE;
if (m_bDotCount > 3)
m_bDotCount = 0;
++m_bDotCount;
char xchar[128];
char xdot[5] = " ";
for (int nNum = 0; nNum < m_bDotCount; nNum++)
{
xdot[nNum] = '.';
}
sprintf(xchar, "%s%s", STRMSG_S_ATUMLAUNCHER_0000_A, xdot);
SetProgressGroupText(xchar); return 0;
...
// find m_nOldSel = nIndexMinCrowdednessServerGroup;
// put this under that line
m_bProcessingServerRespone = TRUE;
KillTimer(TIMERID_SERVER_START_CHECK);
m_bReadyNextRequest = TRUE;
goto UPDATECOMPLETE;
...
// find void CAtumLauncherDlg::OnTimer(UINT nIDEvent)
// add this below else if (TIMERID_NETWORK_STATE_CHECK == nIDEvent) { .. }
else if (TIMERID_SERVER_START_CHECK == nIDEvent)
{
if (m_bReadyNextRequest)
{
m_bReadyNextRequest = FALSE;
m_pUpdateWinsocket->WriteMessageType(T_PC_CONNECT_GET_SERVER_GROUP_LIST);
INIT_MSG_WITH_BUFFER(MSG_PC_CONNECT_VERSION, T_PC_CONNECT_VERSION, msgVersion, msgVersionBuff);
msgVersion->ClientVersion[0] = m_CurrentVersion.GetVersion()[0];
msgVersion->ClientVersion[1] = m_CurrentVersion.GetVersion()[1];
msgVersion->ClientVersion[2] = m_CurrentVersion.GetVersion()[2];
msgVersion->ClientVersion[3] = m_CurrentVersion.GetVersion()[3];
msgVersion->nFirst = 1;
m_pUpdateWinsocket->Write(msgVersionBuff, MSG_SIZE(MSG_PC_CONNECT_VERSION));
}
}
* dont forget add new text sting for
STRMSG_S_ATUMLAUNCHER_0000_A "Wating Server Starting"
STRMSG_S_ATUMLAUNCHER_0000_B "Ready"
Re: [C++] How to make Launcher keep wating response until server start
and since most no longer use a website in the launcher it would be good to add that answer.That "Feature" makes it take time to respond to the launcher (the load is not much but it can improve)