MCPcopy Create free account
hub / github.com/ammaarreshi/Generals-Mac-iOS-iPad / Update_If_Required

Function Update_If_Required

Core/Tools/PATCHGET/CHATAPI.cpp:973–1069  ·  view source on GitHub ↗

Download a patch for the registration client if required This uses the chat API for ver checking and FTP.

Source from the content-addressed store, hash-verified

971// This uses the chat API for ver checking and FTP.
972//
973void Update_If_Required(void)
974{
975 int retval;
976 int i;
977 // Create the events
978 for (i=0; i<NUM_EVENTS; i++)
979 Events[i]=CreateEvent(nullptr,FALSE,FALSE,nullptr);
980
981 StartPatchCheck();
982
983 while (1)
984 {
985 ghttpThink();
986 MSG msg;
987 while(PeekMessage(&msg,nullptr,0,0, PM_REMOVE))
988 {
989 TranslateMessage(&msg);
990 DispatchMessage(&msg);
991 }
992 retval=WaitForMultipleObjectsEx(NUM_EVENTS,Events,FALSE,50,FALSE);
993 if (retval==WAIT_TIMEOUT)
994 continue;
995 //DBGMSG("An event was set");
996 retval-=WAIT_OBJECT_0;
997 break;
998 }
999
1000 //DBGMSG("Out of the loop")
1001
1002 if (retval==ABORT_EVENT)
1003 {
1004 exit(0);
1005 }
1006 else
1007 {
1008 //DBGMSG("NO update required");
1009 }
1010
1011 //DBGMSG("Shutting down");
1012
1013 // close all the event objects
1014 for (i=0; i<NUM_EVENTS; i++)
1015 CloseHandle(Events[i]);
1016
1017 /*
1018 Startup_Chat();
1019 int retval;
1020 int i;
1021
1022
1023 // Create the events
1024 for (i=0; i<NUM_EVENTS; i++)
1025 Events[i]=CreateEvent(nullptr,FALSE,FALSE,nullptr);
1026
1027 /// For Testing....
1028 ///pChat->RequestServerList(1000,262364,"register","regpas98",15);
1029 ///pChat->RequestServerList(1000,300,"register","regpas98",15);
1030

Callers 1

mainFunction · 0.85

Calls 2

StartPatchCheckFunction · 0.70
CloseHandleFunction · 0.50

Tested by

no test coverage detected