mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-18 21:21:53 +00:00
Merge branch '4jcraft:dev' into dev
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "ServerLevel.h"
|
||||
#include "../MinecraftServer.h"
|
||||
@@ -1570,7 +1573,7 @@ int ServerLevel::runUpdate(void* lpParam) {
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
#ifdef __PS3__
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
#endif //__PS3__
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "Platform/stdafx.h"
|
||||
#include "Minecraft.h"
|
||||
#include "GameState/GameMode.h"
|
||||
@@ -780,7 +783,7 @@ void Minecraft::run()
|
||||
{
|
||||
this->toggleFullScreen();
|
||||
}
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -795,7 +798,7 @@ void Minecraft::run()
|
||||
|
||||
achievementPopup->render();
|
||||
|
||||
Sleep(0); // 4J - was Thread.yield()
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(0)); // 4J - was Thread.yield())
|
||||
|
||||
// if (Keyboard::isKeyDown(Keyboard::KEY_F7)) Display.update(); // 4J - removed condition
|
||||
Display::update();
|
||||
@@ -2110,7 +2113,7 @@ void Minecraft::run_middle() {
|
||||
{
|
||||
this->toggleFullScreen();
|
||||
}
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -2139,7 +2142,10 @@ void Minecraft::run_middle() {
|
||||
achievementPopup->render();
|
||||
|
||||
PIXBeginNamedEvent(0, "Sleeping");
|
||||
Sleep(0); // 4J - was Thread.yield()
|
||||
std::this_thread::yield(); // 4jcraft added now that we have
|
||||
// portable thread yield.
|
||||
// std::this_thread::sleep_for(
|
||||
// std::chrono::milliseconds(0)); // 4J - was Thread.yield())
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// if (Keyboard::isKeyDown(Keyboard::KEY_F7))
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// #include "Minecraft.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "Input/ConsoleInput.h"
|
||||
#include "Level/DerivedServerLevel.h"
|
||||
@@ -229,7 +231,7 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData* initData,
|
||||
// 4J-JEV: Need to wait for levelGenerationOptions to load.
|
||||
while (app.getLevelGenerationOptions() != NULL &&
|
||||
!app.getLevelGenerationOptions()->hasLoadedData())
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
||||
if (app.getLevelGenerationOptions() != NULL &&
|
||||
!app.getLevelGenerationOptions()->ready()) {
|
||||
@@ -335,7 +337,7 @@ int MinecraftServer::runPostUpdate(void* lpParam) {
|
||||
} else {
|
||||
LeaveCriticalSection(&server->m_postProcessCS);
|
||||
}
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
} while (!server->m_postUpdateTerminate &&
|
||||
ShutdownManager::ShouldRun(ShutdownManager::ePostProcessThread));
|
||||
// #ifndef __PS3__
|
||||
@@ -356,7 +358,7 @@ int MinecraftServer::runPostUpdate(void* lpParam) {
|
||||
printf("processing request %00d\n",
|
||||
server->m_postProcessRequests.size());
|
||||
#endif
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
#endif
|
||||
EnterCriticalSection(&server->m_postProcessCS);
|
||||
}
|
||||
@@ -1078,7 +1080,7 @@ void MinecraftServer::stopServer(bool didInit) {
|
||||
// files have completed saving.
|
||||
#if defined(_DURANGO) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1580,7 +1582,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
||||
app.SetXuiServerAction(i, eXuiServerAction_Idle);
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
// else
|
||||
@@ -1588,7 +1590,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
||||
// while (running)
|
||||
// {
|
||||
// handleConsoleInputs();
|
||||
// Sleep(10);
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// }
|
||||
// }
|
||||
#if 0
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "ServerChunkCache.h"
|
||||
#include "../Level/ServerLevel.h"
|
||||
@@ -277,7 +280,7 @@ LevelChunk* ServerChunkCache::create(
|
||||
}
|
||||
|
||||
#ifdef __PS3__
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
#endif // __PS3__
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
#include "../Minecraft.World/Platform/stdafx.h"
|
||||
#include "../Minecraft.World/Platform/stdafx.h"
|
||||
|
||||
#include "../Minecraft.World/Recipes/Recipy.h"
|
||||
#include "../Minecraft.Client/GameState/Options.h"
|
||||
@@ -69,6 +68,9 @@
|
||||
#include <save_data_dialog.h>
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "Leaderboards/LeaderboardManager.h"
|
||||
|
||||
// CMinecraftApp app;
|
||||
@@ -4831,7 +4833,7 @@ int CMinecraftApp::SignoutExitWorldThreadProc(void* lpParameter) {
|
||||
// We can't start/join a new game until the session is destroyed, so wait
|
||||
// for it to be idle again
|
||||
while (g_NetworkManager.IsInSession()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@@ -7724,7 +7726,7 @@ int CMinecraftApp::RemoteSaveThreadProc(void* lpParameter) {
|
||||
eAppAction_WaitRemoteServerSaveComplete) {
|
||||
// Tick all the games connections
|
||||
pMinecraft->tickAllConnections();
|
||||
Sleep(100);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
if (app.GetXuiAction(ProfileManager.GetPrimaryPad()) !=
|
||||
@@ -9227,7 +9229,8 @@ bool CMinecraftApp::RetrieveNextTMSPPContent() {
|
||||
C4JStorage::ETMSStatus_Fail_ReadInProgress) {
|
||||
app.DebugPrintf(
|
||||
"TMSPP_ReadFile failed - read in progress\n");
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(50));
|
||||
LeaveCriticalSection(&csTMSPPDownloadQueue);
|
||||
return false;
|
||||
}
|
||||
@@ -9266,7 +9269,8 @@ bool CMinecraftApp::RetrieveNextTMSPPContent() {
|
||||
app.DebugPrintf(
|
||||
"@@@@@@@@@@@@@@@@@ TMSPP_ReadFile failed - busy "
|
||||
"(probably reading already)\n");
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(50));
|
||||
LeaveCriticalSection(&csTMSPPDownloadQueue);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "../../stdafx.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <np.h>
|
||||
// #include <sys/ppu_thread.h>
|
||||
@@ -54,7 +56,7 @@ SonyLeaderboardManager::~SonyLeaderboardManager() {
|
||||
// 4J-JEV: Wait for thread to stop and hope it doesn't take too long.
|
||||
long long startShutdown = System::currentTimeMillis();
|
||||
while (m_threadScoreboard->isRunning()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
assert((System::currentTimeMillis() - startShutdown) < 16);
|
||||
}
|
||||
|
||||
@@ -87,7 +89,8 @@ int SonyLeaderboardManager::scoreboardThreadEntry(LPVOID lpParam) {
|
||||
}
|
||||
|
||||
if ((!needsWriting) && (self->m_eStatsState != eStatsState_Getting)) {
|
||||
Sleep(50); // 4J-JEV: When we're not reading or writing.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(
|
||||
50)); // 4J-JEV: When we're not reading or writing.
|
||||
}
|
||||
|
||||
} while ((self->m_running || self->m_eStatsState == eStatsState_Getting ||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
@@ -344,7 +347,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||
// message I could find
|
||||
pMinecraft->progressRenderer->progressStagePercentage(
|
||||
g_NetworkManager.GetJoiningReadyPercentage());
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
if (changedMessage) {
|
||||
pMinecraft->progressRenderer->progressStagePercentage(100);
|
||||
@@ -367,7 +370,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||
// this
|
||||
while (!app.DLCInstallProcessCompleted() && app.DLCInstallPending() &&
|
||||
!g_NetworkManager.IsLeavingGame()) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
if (g_NetworkManager.IsLeavingGame()) {
|
||||
MinecraftServer::HaltServer();
|
||||
@@ -448,7 +451,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||
|
||||
// 4J Stu - We were ticking this way too fast which could cause the
|
||||
// connection to time out The connections should tick at 20 per second
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
} while ((IsInSession() && !connection->isStarted() &&
|
||||
!connection->isClosed() && !g_NetworkManager.IsLeavingGame()) ||
|
||||
tPack->isLoadingData() ||
|
||||
@@ -548,7 +551,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft* minecraft,
|
||||
// 4J Stu - We were ticking this way too fast which could cause
|
||||
// the connection to time out The connections should tick at 20
|
||||
// per second
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
app.DebugPrintf("<***> %d %d %d %d %d\n", IsInSession(),
|
||||
!connection->isStarted(),
|
||||
!connection->isClosed(),
|
||||
@@ -959,7 +962,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||
while (tPack->isLoadingData() ||
|
||||
(Minecraft::GetInstance()->skins->needsUIUpdate() ||
|
||||
ui.IsReloadingSkin())) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
ui.CleanUpSkinReload();
|
||||
if (app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None) {
|
||||
@@ -977,7 +980,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||
#ifdef __PSVITA__
|
||||
// 4J-JEV: Wait for the loading/saving to finish.
|
||||
while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle)
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
#endif
|
||||
|
||||
Tile::ReleaseThreadStorage();
|
||||
@@ -999,7 +1002,7 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
||||
param->texturePackId)) {
|
||||
while ((Minecraft::GetInstance()->skins->needsUIUpdate() ||
|
||||
ui.IsReloadingSkin())) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
param->levelGen->loadBaseSaveData();
|
||||
}
|
||||
@@ -1037,7 +1040,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
|
||||
UIScene_PauseMenu::_ExitWorld(NULL);
|
||||
|
||||
while (g_NetworkManager.IsInSession()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
// Xbox should always be online when receiving invites - on PS3 we need to
|
||||
@@ -1242,7 +1245,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) !=
|
||||
eXuiServerAction_Idle &&
|
||||
!MinecraftServer::serverHalted()) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),
|
||||
eXuiServerAction_PauseServer, (void*)TRUE);
|
||||
@@ -1282,7 +1285,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
// if we don't do this then there's an async thread running doing this,
|
||||
// which could then finish at any inappropriate time later
|
||||
while (s_pPlatformNetworkManager->IsAddingPlayer()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1313,7 +1316,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
|
||||
// wait for the current session to end
|
||||
while (g_NetworkManager.IsInSession()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
// Reset this flag as the we don't need to know that we only lost the room
|
||||
@@ -1343,7 +1346,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
|
||||
// Wait for all the local players to rejoin the session
|
||||
while (g_NetworkManager.GetPlayerCount() < numLocalPlayers) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
// Restore the network player of all the server players that are local
|
||||
@@ -1393,7 +1396,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
// Make sure that we have transitioned through any joining/creating stages
|
||||
// so we're actually ready to set to play
|
||||
while (!s_pPlatformNetworkManager->IsReadyToPlayOrIdle()) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1402,7 +1405,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
#ifndef _XBOX
|
||||
// Wait until the message box has been closed
|
||||
while (ui.IsSceneInStack(XUSER_INDEX_ANY, eUIScene_MessageBox)) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1952,7 +1955,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus(
|
||||
#if 0
|
||||
while( waitHere )
|
||||
{
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <sys/event.h>
|
||||
|
||||
#include "../../../Minecraft.World/Platform/stdafx.h"
|
||||
|
||||
#include "SonyCommerce.h"
|
||||
#include "../../../../Platform/PS3/PS3Extras/ShutdownManager.h"
|
||||
#include <sys/event.h>
|
||||
|
||||
bool SonyCommerce::m_bCommerceInitialised = false;
|
||||
SceNpCommerce2SessionInfo SonyCommerce::m_sessionInfo;
|
||||
@@ -122,7 +125,8 @@ int SonyCommerce::TickLoop(void* lpParam) {
|
||||
ShutdownManager::ShouldRun(ShutdownManager::eCommerceThread)) {
|
||||
processEvent();
|
||||
processMessage();
|
||||
Sleep(16); // sleep for a frame
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(16)); // sleep for a frame
|
||||
}
|
||||
|
||||
ShutdownManager::HasFinished(ShutdownManager::eCommerceThread);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "SonyRemoteStorage.h"
|
||||
@@ -286,7 +287,7 @@ bool SonyRemoteStorage::shutdown() {
|
||||
void SonyRemoteStorage::waitForStorageManagerIdle() {
|
||||
C4JStorage::ESaveGameState storageState = StorageManager.GetSaveState();
|
||||
while (storageState != C4JStorage::ESaveGame_Idle) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// app.DebugPrintf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
// >>>>> storageState = %d\n", storageState);
|
||||
storageState = StorageManager.GetSaveState();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "IUIScene_PauseMenu.h"
|
||||
#include "UIScene.h"
|
||||
@@ -393,7 +396,7 @@ int IUIScene_PauseMenu::SaveWorldThreadProc(void* lpParameter) {
|
||||
while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) !=
|
||||
eXuiServerAction_Idle &&
|
||||
!MinecraftServer::serverHalted()) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType())
|
||||
@@ -661,7 +664,7 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) {
|
||||
// multiplayer client if host of the game will exit during the clients
|
||||
// loading to created world.
|
||||
while (g_NetworkManager.IsNetworkThreadRunning()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
pMinecraft->setLevel(NULL, exitReasonStringId, nullptr, saveStats);
|
||||
|
||||
@@ -681,7 +684,7 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) {
|
||||
// loads saved data We can't start/join a new game until the session is
|
||||
// destroyed, so wait for it to be idle again
|
||||
while (g_NetworkManager.IsInSession()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
app.SetChangingSessionType(false);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "UIScene_LoadOrJoinMenu.h"
|
||||
@@ -2229,7 +2232,7 @@ int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void* pParam,
|
||||
while (commerceState != CConsoleMinecraftApp::eCommerce_State_Offline &&
|
||||
commerceState != CConsoleMinecraftApp::eCommerce_State_Online &&
|
||||
commerceState != CConsoleMinecraftApp::eCommerce_State_Error) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
commerceState = app.GetCommerceState();
|
||||
}
|
||||
|
||||
@@ -2852,7 +2855,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) {
|
||||
#if defined(_DURANGO) || defined(__ORBIS__)
|
||||
while (StorageManager.GetSaveState() !=
|
||||
C4JStorage::ESaveGame_Idle) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
StorageManager.Tick();
|
||||
}
|
||||
#endif
|
||||
@@ -2999,7 +3002,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc(void* lpParameter) {
|
||||
// waiting to dismiss the dialog
|
||||
break;
|
||||
}
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
m_bSaveTransferRunning = false;
|
||||
#ifdef __PS3__
|
||||
@@ -3151,7 +3154,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc(void* lpParameter) {
|
||||
// waiting for dialog to be dismissed
|
||||
break;
|
||||
}
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3247,7 +3250,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc(void* lpParameter) {
|
||||
|
||||
while (StorageManager.SaveTransferClearState() !=
|
||||
C4JStorage::eSaveTransfer_Idle) {
|
||||
Sleep(5);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
}
|
||||
|
||||
pStateContainer->m_bSaveTransferInProgress = true;
|
||||
@@ -3432,7 +3435,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc(void* lpParameter) {
|
||||
|
||||
while (StorageManager.GetSaveState() !=
|
||||
C4JStorage::ESaveGame_Idle) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
|
||||
// 4J Stu - DO NOT tick this here. The main thread should be
|
||||
// the only place ticking the StorageManager. You WILL get
|
||||
@@ -3470,7 +3473,7 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc(void* lpParameter) {
|
||||
|
||||
break;
|
||||
}
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
if (pStateContainer->m_bSaveTransferCancelled) {
|
||||
@@ -3517,7 +3520,7 @@ void UIScene_LoadOrJoinMenu::RequestFileSize(SaveTransferStateContainer* pClass,
|
||||
IDS_SAVETRANSFER_TITLE_GET);
|
||||
pMinecraft->progressRenderer->progressStage(
|
||||
IDS_SAVETRANSFER_STAGE_GET_DETAILS);
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
pClass->m_eSaveTransferState =
|
||||
StorageManager.SaveTransferGetDetails(
|
||||
pClass->m_iPad, C4JStorage::eGlobalStorage_TitleUser,
|
||||
@@ -3573,7 +3576,7 @@ void UIScene_LoadOrJoinMenu::RequestFileData(SaveTransferStateContainer* pClass,
|
||||
pMinecraft->progressRenderer->progressStart(
|
||||
IDS_SAVETRANSFER_TITLE_GET);
|
||||
pMinecraft->progressRenderer->progressStage(-1);
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
pClass->m_eSaveTransferState = StorageManager.SaveTransferGetData(
|
||||
pClass->m_iPad, C4JStorage::eGlobalStorage_TitleUser, filename,
|
||||
&UIScene_LoadOrJoinMenu::SaveTransferReturned,
|
||||
@@ -3740,7 +3743,7 @@ int UIScene_LoadOrJoinMenu::CopySaveThreadProc(void* lpParameter) {
|
||||
|
||||
bool bContinue = true;
|
||||
do {
|
||||
Sleep(100);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
ui.EnterCallbackIdCriticalSection();
|
||||
pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId(
|
||||
(size_t)lpParameter);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Minecraft.cpp : Defines the entry point for the application.
|
||||
//
|
||||
|
||||
#include <assert.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "XUI_Death.h"
|
||||
#include <assert.h>
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
#include "../../Minecraft.World/Util/Vec3.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.stats.h"
|
||||
@@ -234,7 +237,7 @@ int CScene_Death::RespawnThreadProc(void* lpParameter) {
|
||||
// If we are offline, this should release straight away
|
||||
// WaitForSingleObject( pMinecraft->m_hPlayerRespawned, INFINITE );
|
||||
while (pMinecraft->localplayers[iPad]->GetPlayerRespawned() == false) {
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include "XUI_Ctrl_CraftIngredientSlot.h"
|
||||
#include "XUI_XZP_Icons.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
LPCWSTR CScene_Leaderboards::m_TitleIconNameA[7] = {
|
||||
L"XuiHSlot1", L"XuiHSlot2", L"XuiHSlot3", L"XuiHSlot4",
|
||||
L"XuiHSlot5", L"XuiHSlot6", L"XuiHSlot7",
|
||||
@@ -283,7 +286,7 @@ HRESULT CScene_Leaderboards::OnDestroy() {
|
||||
app.SetLiveLinkRequired(false);
|
||||
|
||||
while (m_isProcessingStatsRead) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
if (m_friends != NULL) delete[] m_friends;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include <xuiresource.h>
|
||||
#include <xuiapp.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <assert.h>
|
||||
#include "../../Minecraft.World/Util/StringHelpers.h"
|
||||
#include "../Tutorial/TutorialMode.h"
|
||||
@@ -2174,7 +2176,7 @@ bool CScene_MultiGameJoinLoad::WaitForTransferComplete(
|
||||
// cancelled
|
||||
return false;
|
||||
}
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
// update the progress
|
||||
pMinecraft->progressRenderer->progressStagePercentage(
|
||||
(unsigned int)(pClass->m_fProgress * 100.0f));
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
#include "../../Minecraft.World/Util/Vec3.h"
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.stats.h"
|
||||
@@ -1086,7 +1088,7 @@ int UIScene_PauseMenu::SaveWorldThreadProc(LPVOID lpParameter) {
|
||||
while (app.GetXuiServerAction(ProfileManager.GetPrimaryPad()) !=
|
||||
eXuiServerAction_Idle &&
|
||||
!MinecraftServer::serverHalted()) {
|
||||
Sleep(10);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
if (!MinecraftServer::serverHalted() && !app.GetChangingSessionType())
|
||||
@@ -1295,7 +1297,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) {
|
||||
// multiplayer client if host of the game will exit during the clients
|
||||
// loading to created world.
|
||||
while (g_NetworkManager.IsNetworkThreadRunning()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
pMinecraft->setLevel(NULL, exitReasonStringId, nullptr, saveStats);
|
||||
|
||||
@@ -1315,7 +1317,7 @@ void UIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) {
|
||||
// loads saved data We can't start/join a new game until the session is
|
||||
// destroyed, so wait for it to be idle again
|
||||
while (g_NetworkManager.IsInSession()) {
|
||||
Sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
app.SetChangingSessionType(false);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <xuiresource.h>
|
||||
#include <xuiapp.h>
|
||||
#include <assert.h>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "XUI_Ctrl_4JList.h"
|
||||
#include "XUI_Ctrl_4JIcon.h"
|
||||
@@ -363,7 +365,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc(
|
||||
// loop waiting for the write to complete
|
||||
uiComplete = 0;
|
||||
while (pClass->m_bWaitingForWrite && (hr == S_OK)) {
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
uiComplete++;
|
||||
if (uiComplete > 100) uiComplete = 100;
|
||||
|
||||
@@ -380,7 +382,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc(
|
||||
|
||||
// finish the bar
|
||||
for (int i = uiComplete; i < 100; i++) {
|
||||
Sleep(5);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
pMinecraft->progressRenderer->progressStagePercentage(i);
|
||||
}
|
||||
|
||||
@@ -396,7 +398,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc(
|
||||
|
||||
// sleep until we have the data
|
||||
while (pClass->m_bSaveDataReceived == false) {
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
// write the save to user TMS
|
||||
@@ -443,7 +445,7 @@ int CScene_TransferToXboxOne::UploadSaveForXboxOneThreadProc(
|
||||
} else {
|
||||
// loop waiting for the write to complete
|
||||
while (pClass->m_bWaitingForWrite && (hr == S_OK)) {
|
||||
Sleep(50);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
uiComplete += uiPercentageChunk;
|
||||
if (uiComplete > 100) uiComplete = 100;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <assert.h>
|
||||
// #include <system_service.h>
|
||||
#include <codecvt>
|
||||
#if defined(__linux__) && defined(__GLIBC__)
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
@@ -710,15 +709,6 @@ void CleanupDevice() {
|
||||
}
|
||||
#endif
|
||||
|
||||
int StartMinecraftThreadProc(void* lpParameter) {
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Tesselator::CreateNewThreadStorage(1024 * 1024);
|
||||
RenderManager.InitialiseContext();
|
||||
Minecraft::start(std::wstring(), std::wstring());
|
||||
delete Tesselator::getInstance();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
#if defined(__linux__) && defined(__GLIBC__)
|
||||
struct sigaction sa;
|
||||
@@ -1197,7 +1187,7 @@ void FreeRichPresenceStrings() {
|
||||
vRichPresenceStrings.clear();
|
||||
}
|
||||
|
||||
#ifdef MEMORY_TRACKING
|
||||
#if 0 // #ifdef MEMORY_TRACKING
|
||||
|
||||
int totalAllocGen = 0;
|
||||
std::unordered_map<int, int> allocCounts;
|
||||
|
||||
@@ -306,28 +306,6 @@ static inline ULONG TryEnterCriticalSection(
|
||||
return pthread_mutex_trylock(CriticalSection) == 0;
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsalloc
|
||||
static inline DWORD TlsAlloc(VOID) {
|
||||
pthread_key_t key;
|
||||
if (pthread_key_create(&key, NULL) == 0) return key;
|
||||
return TLS_OUT_OF_INDEXES;
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsfree
|
||||
static inline BOOL TlsFree(DWORD dwTlsIndex) {
|
||||
return pthread_key_delete(dwTlsIndex) == 0;
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsgetvalue
|
||||
static inline LPVOID TlsGetValue(DWORD dwTlsIndex) {
|
||||
return pthread_getspecific(dwTlsIndex);
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlssetvalue
|
||||
static inline BOOL TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) {
|
||||
return pthread_setspecific(dwTlsIndex, lpTlsValue) == 0;
|
||||
}
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-globalmemorystatus
|
||||
static inline VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) {
|
||||
// TODO: Parse /proc/meminfo and set lpBuffer based on that. Probably will
|
||||
@@ -336,17 +314,7 @@ static inline VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) {
|
||||
|
||||
static inline DWORD GetLastError(VOID) { return errno; }
|
||||
|
||||
static inline VOID Sleep(DWORD dwMilliseconds) {
|
||||
struct timespec ts;
|
||||
ts.tv_nsec = (dwMilliseconds * 1000000) % 1000000000;
|
||||
ts.tv_sec = dwMilliseconds / 1000;
|
||||
|
||||
int ret;
|
||||
do {
|
||||
ret = nanosleep(&ts, &ts);
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
#ifdef __LP64__
|
||||
static inline LONG64 InterlockedCompareExchangeRelease64(
|
||||
LONG64 volatile* Destination, LONG64 Exchange, LONG64 Comperand) {
|
||||
LONG64 expected = Comperand;
|
||||
@@ -354,6 +322,15 @@ static inline LONG64 InterlockedCompareExchangeRelease64(
|
||||
__ATOMIC_RELEASE, __ATOMIC_RELAXED);
|
||||
return expected;
|
||||
}
|
||||
#else
|
||||
static inline LONG64 InterlockedCompareExchangeRelease(
|
||||
LONG volatile* Destination, LONG Exchange, LONG Comperand) {
|
||||
LONG expected = Comperand;
|
||||
__atomic_compare_exchange_n(Destination, &expected, Exchange, false,
|
||||
__ATOMIC_RELEASE, __ATOMIC_RELAXED);
|
||||
return expected;
|
||||
}
|
||||
#endif
|
||||
|
||||
// internal helper: convert time_t to FILETIME (100ns intervals since
|
||||
// 1601-01-01)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "../Platform/stdafx.h"
|
||||
#include "LevelRenderer.h"
|
||||
#include <cmath>
|
||||
@@ -2321,7 +2324,7 @@ bool LevelRenderer::updateDirtyChunks() {
|
||||
}
|
||||
LeaveCriticalSection(&m_csDirtyChunks);
|
||||
#ifdef __PS3__
|
||||
Sleep(5);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
#endif // __PS3__
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user