diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index a80af5d2..4bd2b603 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -4100,7 +4100,7 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) bool remove = false; // Only consider recently deferred packets - int tickInterval = GetTickCount() - deferred->m_recievedTick; + uint64_t tickInterval = GetTickCount64() - deferred->m_recievedTick; if (tickInterval < MAX_ENTITY_LINK_DEFERRAL_INTERVAL) { // Note: we assume it's the destination entity @@ -4126,6 +4126,6 @@ void ClientConnection::checkDeferredEntityLinkPackets(int newEntityId) ClientConnection::DeferredEntityLinkPacket::DeferredEntityLinkPacket(shared_ptr packet) { - m_recievedTick = GetTickCount(); + m_recievedTick = GetTickCount64(); m_packet = packet; } diff --git a/Minecraft.Client/ClientConnection.h b/Minecraft.Client/ClientConnection.h index 3448496d..6ccae1fe 100644 --- a/Minecraft.Client/ClientConnection.h +++ b/Minecraft.Client/ClientConnection.h @@ -169,7 +169,7 @@ private: class DeferredEntityLinkPacket { public: - DWORD m_recievedTick; + DWORD64 m_recievedTick; shared_ptr m_packet; DeferredEntityLinkPacket(shared_ptr packet); diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index bcd8120a..a2c944fc 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -9624,20 +9624,20 @@ int CMinecraftApp::GetDLCInfoTexturesOffersCount() void CMinecraftApp::SetAutosaveTimerTime(void) { #if defined(_XBOX_ONE) || defined(__ORBIS__) - m_uiAutosaveTimer= GetTickCount()+1000*60; + m_uiAutosaveTimer= GetTickCount64()+1000*60; #else - m_uiAutosaveTimer= GetTickCount()+GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Autosave)*1000*60*15; + m_uiAutosaveTimer= GetTickCount64()+GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Autosave)*1000*60*15; #endif }// value x 15 to get mins, x60 for secs bool CMinecraftApp::AutosaveDue(void) { - return (GetTickCount()>m_uiAutosaveTimer); + return (GetTickCount64()>m_uiAutosaveTimer); } unsigned int CMinecraftApp::SecondsToAutosave() { - return (m_uiAutosaveTimer - GetTickCount() ) / 1000; + return (m_uiAutosaveTimer - GetTickCount64() ) / 1000; } void CMinecraftApp::SetTrialTimerStart(void) diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index 0c1c261e..1fc8e9b6 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -689,7 +689,7 @@ public: bool AutosaveDue(void); unsigned int SecondsToAutosave(); private: - unsigned int m_uiAutosaveTimer; + uint64_t m_uiAutosaveTimer; unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT]; // DLC diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 430f2c11..24949be0 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -830,10 +830,11 @@ void CPlatformNetworkManagerStub::TickSearch() if (m_SessionsUpdatedCallback == nullptr) return; - static DWORD lastSearchTime = 0; - DWORD now = GetTickCount(); + static DWORD64 lastSearchTime = 0; + DWORD64 now = GetTickCount64(); if (now - lastSearchTime < 2000) return; + lastSearchTime = now; SearchForGames(); diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Common/Tutorial/Tutorial.cpp index c985ef49..621482af 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/Tutorial.cpp @@ -1299,7 +1299,7 @@ void Tutorial::tick() // Don't do anything for the first 2 seconds so that the loading screen is gone if(!m_bHasTickedOnce) { - int time = GetTickCount(); + uint64_t time = GetTickCount64(); if(m_firstTickTime == 0) { m_firstTickTime = time; @@ -1363,7 +1363,7 @@ void Tutorial::tick() if(!m_allowShow) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount64() ) ) { uiTempDisabled = true; } @@ -1413,7 +1413,7 @@ void Tutorial::tick() if(ui.IsPauseMenuDisplayed( m_iPad ) ) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount64() ) ) { uiTempDisabled = true; } @@ -1423,7 +1423,7 @@ void Tutorial::tick() if( uiTempDisabled ) { ui.SetTutorialVisible( m_iPad, true ); - lastMessageTime = GetTickCount(); + lastMessageTime = GetTickCount64(); uiTempDisabled = false; } @@ -1490,7 +1490,7 @@ void Tutorial::tick() { isCurrentTask = false; if( - ( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) ) + ( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount64() ) ) && task->isCompleted() ) { @@ -1567,7 +1567,7 @@ void Tutorial::tick() { ++it; } - if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) + if( task != nullptr && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount64() ) { task->setShownForMinimumTime(); @@ -1642,12 +1642,12 @@ void Tutorial::tick() } } - if(m_hintDisplayed && (lastMessageTime + m_iTutorialDisplayMessageTime ) < GetTickCount() ) + if(m_hintDisplayed && (lastMessageTime + m_iTutorialDisplayMessageTime ) < GetTickCount64() ) { m_hintDisplayed = false; } - if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() ) + if( currentFailedConstraint[m_CurrentState] == nullptr && currentTask[m_CurrentState] != nullptr && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount64() ) { // Reminder PopupMessageDetails *message = new PopupMessageDetails(); @@ -1675,7 +1675,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) if(message != nullptr && !message->m_forceDisplay && m_lastMessageState == m_CurrentState && message->isSameContent(m_lastMessage) && - ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) ) + ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount64() && message->m_isReminder ) ) ) { delete message; @@ -1686,7 +1686,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) { m_lastMessageState = m_CurrentState; - if(!message->m_replaceCurrent) lastMessageTime = GetTickCount(); + if(!message->m_replaceCurrent) lastMessageTime = GetTickCount64(); wstring text; if(!message->m_messageString.empty()) @@ -1755,7 +1755,7 @@ bool Tutorial::setMessage(PopupMessageDetails *message) ui.SetTutorialDescription( m_iPad, &popupInfo ); } } - else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() ) + else if( (m_lastMessage != nullptr && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount64() ) { // This should cause the popup to dissappear TutorialPopupInfo popupInfo; @@ -1777,7 +1777,7 @@ bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message) bool hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)); bool messageShown = false; - DWORD time = GetTickCount(); + DWORD64 time = GetTickCount64(); if(message != nullptr && (message->m_forceDisplay || hintsOn) && (!message->m_delay || ( @@ -1816,7 +1816,7 @@ void Tutorial::showTutorialPopup(bool show) if(!show) { - if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) ) + if( currentTask[m_CurrentState] != nullptr && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount64() ) ) { uiTempDisabled = true; } diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.h b/Minecraft.Client/Common/Tutorial/Tutorial.h index c36a9086..0be90696 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.h +++ b/Minecraft.Client/Common/Tutorial/Tutorial.h @@ -75,7 +75,7 @@ private: bool m_bSceneIsSplitscreen; bool m_bHasTickedOnce; - int m_firstTickTime; + uint64_t m_firstTickTime; protected: unordered_map messages; @@ -93,8 +93,8 @@ protected: //D3DXVECTOR3 m_OriginalPosition; public: - DWORD lastMessageTime; - DWORD m_lastHintDisplayedTime; + DWORD64 lastMessageTime; + DWORD64 m_lastHintDisplayedTime; private: PopupMessageDetails *m_lastMessage; diff --git a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp index 50a45a42..540a7067 100644 --- a/Minecraft.Client/Common/Tutorial/TutorialMode.cpp +++ b/Minecraft.Client/Common/Tutorial/TutorialMode.cpp @@ -69,7 +69,7 @@ void TutorialMode::tick() tutorial->tick(); /* - if( tutorial.m_allTutorialsComplete && (tutorial.lastMessageTime + m_iTutorialDisplayMessageTime) < GetTickCount() ) + if( tutorial.m_allTutorialsComplete && (tutorial.lastMessageTime + m_iTutorialDisplayMessageTime) < GetTickCount64() ) { // Exit tutorial minecraft->gameMode = new SurvivalMode( this ); diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index bdc0175e..3c89c453 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -1323,7 +1323,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) if(pressed) { // Start repeat timer - m_actionRepeatTimer[iPad][key] = GetTickCount() + UI_REPEAT_KEY_DELAY_MS; + m_actionRepeatTimer[iPad][key] = GetTickCount64() + UI_REPEAT_KEY_DELAY_MS; } else if (released) { @@ -1333,7 +1333,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) else if (down) { // Check is enough time has elapsed to be a repeat key - DWORD currentTime = GetTickCount(); + DWORD64 currentTime = GetTickCount64(); if(m_actionRepeatTimer[iPad][key] > 0 && currentTime > m_actionRepeatTimer[iPad][key]) { repeat = true; @@ -1438,7 +1438,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) if(pressed) { // Start repeat timer - m_actionRepeatTimer[iPad][key] = GetTickCount() + UI_REPEAT_KEY_DELAY_MS; + m_actionRepeatTimer[iPad][key] = GetTickCount64() + UI_REPEAT_KEY_DELAY_MS; } else if (released) { @@ -1448,7 +1448,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) else if (down) { // Check is enough time has elapsed to be a repeat key - DWORD currentTime = GetTickCount(); + DWORD64 currentTime = GetTickCount64(); if(m_actionRepeatTimer[iPad][key] > 0 && currentTime > m_actionRepeatTimer[iPad][key]) { repeat = true; @@ -2131,7 +2131,7 @@ UIScene *UIController::GetTopScene(int iPad, EUILayer layer, EUIGroup group) size_t UIController::RegisterForCallbackId(UIScene *scene) { EnterCriticalSection(&m_registeredCallbackScenesCS); - size_t newId = GetTickCount(); + size_t newId = GetTickCount64(); newId &= 0xFFFFFF; // Chop off the top BYTE, we don't need any more accuracy than that newId |= (scene->getSceneType() << 24); // Add in the scene's type to help keep this unique m_registeredCallbackScenes[newId] = scene; diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index f57681a8..42d6cb28 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -2387,7 +2387,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player) #ifdef MINECRAFT_SERVER_BUILD return true; #else - int time = GetTickCount(); + uint64_t time = GetTickCount64(); DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount(); if( currentPlayerCount == 0 ) return false; int index = s_slowQueuePlayerIndex % (int)currentPlayerCount; @@ -2413,7 +2413,7 @@ void MinecraftServer::chunkPacketManagement_PreTick() void MinecraftServer::chunkPacketManagement_PostTick() { // 4J Ensure that the slow queue owner keeps cycling if it's not been used in a while - int time = GetTickCount(); + uint64_t time = GetTickCount64(); if( ( s_slowQueuePacketSent ) || ( (time - s_slowQueueLastTime) > ( 2 * MINECRAFT_SERVER_SLOW_QUEUE_DELAY ) ) ) { // app.DebugPrintf("Considering cycling: (%d) %d - %d -> %d > %d\n",s_slowQueuePacketSent, time, s_slowQueueLastTime, (time - s_slowQueueLastTime), (2*MINECRAFT_SERVER_SLOW_QUEUE_DELAY)); diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 7966c5c9..3cd01835 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -157,11 +157,11 @@ void Screen::updateEvents() } // Arrow key repeat: deliver on first press (when key down and last==0) and while held (throttled) - static DWORD s_arrowLastTime[2] = { 0, 0 }; + static DWORD64 s_arrowLastTime[2] = { 0, 0 }; static bool s_arrowFirstRepeat[2] = { false, false }; const DWORD ARROW_REPEAT_DELAY_MS = 250; const DWORD ARROW_REPEAT_INTERVAL_MS = 50; - DWORD now = GetTickCount(); + DWORD64 now = GetTickCount64(); // Poll keyboard events (special keys that may not come through WM_CHAR, e.g. Escape, arrows) for (int vk = 0; vk < 256; vk++) @@ -177,7 +177,7 @@ void Screen::updateEvents() } else { - DWORD last = s_arrowLastTime[idx]; + DWORD64 last = s_arrowLastTime[idx]; if (last == 0) deliver = true; else if (!deliver) diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 85f07232..161ec99d 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -1501,7 +1501,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param) char senderIP[64]; inet_ntop(AF_INET, &senderAddr.sin_addr, senderIP, sizeof(senderIP)); - DWORD now = GetTickCount(); + DWORD64 now = GetTickCount64(); EnterCriticalSection(&s_discoveryLock); diff --git a/Minecraft.Client/Windows64/Windows64_Xuid.h b/Minecraft.Client/Windows64/Windows64_Xuid.h index 1d621329..1fd6f024 100644 --- a/Minecraft.Client/Windows64/Windows64_Xuid.h +++ b/Minecraft.Client/Windows64/Windows64_Xuid.h @@ -162,7 +162,7 @@ namespace Win64Xuid seed ^= (uint64_t)qpc.QuadPart; seed ^= ((uint64_t)GetCurrentProcessId() << 32); seed ^= (uint64_t)GetCurrentThreadId(); - seed ^= (uint64_t)GetTickCount(); + seed ^= (uint64_t)GetTickCount64(); seed ^= (uint64_t)(size_t)&qpc; seed ^= (uint64_t)(size_t)GetModuleHandleA(NULL); diff --git a/Minecraft.Server/Windows64/ServerMain.cpp b/Minecraft.Server/Windows64/ServerMain.cpp index 1c0ef266..e1ff1d0a 100644 --- a/Minecraft.Server/Windows64/ServerMain.cpp +++ b/Minecraft.Server/Windows64/ServerMain.cpp @@ -641,7 +641,7 @@ int main(int argc, char **argv) { autosaveIntervalMs = (DWORD)(serverProperties.autosaveIntervalSeconds * 1000); } - DWORD nextAutosaveTick = GetTickCount() + autosaveIntervalMs; + DWORD64 nextAutosaveTick = GetTickCount64() + autosaveIntervalMs; bool autosaveRequested = false; ServerRuntime::ServerCli serverCli; serverCli.Start(); @@ -668,7 +668,7 @@ int main(int argc, char **argv) break; } - DWORD now = GetTickCount(); + DWORD64 now = GetTickCount64(); if ((LONG)(now - nextAutosaveTick) >= 0) { if (app.GetXuiServerAction(kServerActionPad) == eXuiServerAction_Idle && !ConsoleSaveFileOriginal::hasPendingBackgroundSave()) diff --git a/Minecraft.Server/WorldManager.cpp b/Minecraft.Server/WorldManager.cpp index fd7d368b..a0472d2d 100644 --- a/Minecraft.Server/WorldManager.cpp +++ b/Minecraft.Server/WorldManager.cpp @@ -228,8 +228,8 @@ static int LoadSaveDataCallbackProc(LPVOID lpParam, const bool bIsCorrupt, const */ static bool WaitForSaveInfoResult(SaveInfoQueryContext *context, DWORD timeoutMs, WorldManagerTickProc tickProc) { - DWORD start = GetTickCount(); - while ((GetTickCount() - start) < timeoutMs) + DWORD64 start = GetTickCount64(); + while ((GetTickCount64() - start) < timeoutMs) { if (context->done) { @@ -270,8 +270,8 @@ static bool WaitForSaveInfoResult(SaveInfoQueryContext *context, DWORD timeoutMs */ static bool WaitForSaveLoadResult(SaveDataLoadContext *context, DWORD timeoutMs, WorldManagerTickProc tickProc) { - DWORD start = GetTickCount(); - while ((GetTickCount() - start) < timeoutMs) + DWORD64 start = GetTickCount64(); + while ((GetTickCount64() - start) < timeoutMs) { if (context->done) { @@ -611,11 +611,11 @@ WorldBootstrapResult BootstrapWorldForServer( */ bool WaitForWorldActionIdle( int actionPad, - DWORD timeoutMs, + DWORD64 timeoutMs, WorldManagerTickProc tickProc, WorldManagerHandleActionsProc handleActionsProc) { - DWORD start = GetTickCount(); + DWORD64 start = GetTickCount64(); while (app.GetXuiServerAction(actionPad) != eXuiServerAction_Idle && !MinecraftServer::serverHalted()) { // Keep network and storage progressing while waiting @@ -628,7 +628,7 @@ bool WaitForWorldActionIdle( { handleActionsProc(); } - if ((GetTickCount() - start) >= timeoutMs) + if ((GetTickCount64() - start) >= timeoutMs) { return false; } diff --git a/Minecraft.World/system.cpp b/Minecraft.World/system.cpp index 71d0a85e..3103d6d3 100644 --- a/Minecraft.World/system.cpp +++ b/Minecraft.World/system.cpp @@ -66,7 +66,7 @@ int64_t System::nanoTime() // Precision is sufficient for ~100 days of uptime. return static_cast(static_cast(counter.QuadPart) * 1000000000.0 / static_cast(s_frequency.QuadPart)); #else - return GetTickCount() * 1000000LL; + return GetTickCount64() * 1000000LL; #endif }