mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-18 16:28:07 +00:00
Merge branch 'upstream-dev' into cleanup/shared-portability-reset-v2
# Conflicts: # Minecraft.Client/Level/ServerLevel.cpp # Minecraft.Client/Minecraft.cpp # Minecraft.Client/MinecraftServer.cpp # Minecraft.Client/Network/ClientConnection.cpp # Minecraft.Client/Network/ServerChunkCache.cpp # Minecraft.Client/Platform/Common/Audio/SoundEngine.cpp # Minecraft.Client/Platform/Common/Consoles_App.cpp # Minecraft.Client/Platform/Common/Network/GameNetworkManager.cpp # Minecraft.Client/Platform/Common/Network/Sony/SonyCommerce.cpp # Minecraft.Client/Platform/Common/Network/Sony/SonyRemoteStorage.cpp # Minecraft.Client/Platform/Common/UI/UIController.cpp # Minecraft.Client/Platform/Common/UI/UIScene_CreateWorldMenu.cpp # Minecraft.Client/Platform/Common/UI/UIScene_EnchantingMenu.cpp # Minecraft.Client/Platform/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp # Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp # Minecraft.Client/Platform/Common/UI/UIScene_MainMenu.cpp # Minecraft.Client/Platform/Common/XUI/XUI_Death.cpp # Minecraft.Client/Platform/Common/XUI/XUI_Leaderboards.cpp # Minecraft.Client/Platform/Common/XUI/XUI_MultiGameJoinLoad.cpp # Minecraft.Client/Platform/Common/XUI/XUI_PauseMenu.cpp # Minecraft.Client/Platform/Common/XUI/XUI_TransferToXboxOne.cpp # Minecraft.Client/Platform/Durango/Durango_Minecraft.cpp # Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp # Minecraft.Client/Platform/Orbis/Orbis_Minecraft.cpp # Minecraft.Client/Platform/PS3/PS3Extras/boost_1_53_0/boost/spirit/home/lex/lexer/lexertl/lexer.hpp # Minecraft.Client/Platform/PS3/PS3_Minecraft.cpp # Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/TileRenderer_SPU.cpp # Minecraft.Client/Platform/PS3/SPU_Tasks/ChunkUpdate/Tile_SPU.cpp # Minecraft.Client/Platform/PS3/Xbox_Minecraft.cpp # Minecraft.Client/Platform/PSVita/PSVita_Minecraft.cpp # Minecraft.Client/Platform/Xbox/Xbox_Minecraft.cpp # Minecraft.Client/Platform/stdafx.h # Minecraft.Client/Player/LocalPlayer.cpp # Minecraft.Client/Rendering/Chunk.cpp # Minecraft.Client/Rendering/EntityRenderers/ItemRenderer.cpp # Minecraft.Client/Rendering/GameRenderer.cpp # Minecraft.Client/Rendering/LevelRenderer.cpp # Minecraft.Client/Textures/BufferedImage.cpp # Minecraft.Client/UI/Screens/AchievementScreen.cpp # Minecraft.Client/UI/Screens/ContainerScreen.cpp # Minecraft.Client/UI/Screens/TrapScreen.cpp # Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp # Minecraft.World/IO/Files/File.cpp # Minecraft.World/Player/Player.cpp # Minecraft.World/Util/C4JThread.cpp
This commit is contained in:
@@ -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"
|
||||
@@ -246,7 +249,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);
|
||||
@@ -268,7 +271,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();
|
||||
@@ -349,7 +352,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() ||
|
||||
@@ -449,7 +452,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(),
|
||||
@@ -804,8 +807,6 @@ bool CGameNetworkManager::IsNetworkThreadRunning() {
|
||||
int CGameNetworkManager::RunNetworkGameThreadProc(void* lpParameter) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
Tile::CreateNewThreadStorage();
|
||||
|
||||
@@ -817,7 +818,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) {
|
||||
@@ -852,15 +853,13 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
SetThreadName(-1, "Minecraft Server thread");
|
||||
AABB::CreateNewThreadStorage();
|
||||
Vec3::CreateNewThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
OldChunkStorage::UseDefaultThreadStorage();
|
||||
Entity::useSmallIds();
|
||||
@@ -873,8 +872,6 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
||||
lpParameter); // saveData, app.GetGameHostOption(eGameHostOption_All));
|
||||
|
||||
Tile::ReleaseThreadStorage();
|
||||
AABB::ReleaseThreadStorage();
|
||||
Vec3::ReleaseThreadStorage();
|
||||
Level::destroyLightingCache();
|
||||
|
||||
if (lpParameter != NULL) delete (NetworkGameInitData*)lpParameter;
|
||||
@@ -885,15 +882,13 @@ int CGameNetworkManager::ServerThreadProc(void* lpParameter) {
|
||||
int CGameNetworkManager::ExitAndJoinFromInviteThreadProc(void* lpParam) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
// app.SetGameStarted(false);
|
||||
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
|
||||
@@ -912,8 +907,6 @@ void CGameNetworkManager::_LeaveGame() {
|
||||
int CGameNetworkManager::ChangeSessionTypeThreadProc(void* lpParam) {
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long
|
||||
// as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Vec3::UseDefaultThreadStorage();
|
||||
Compression::UseDefaultThreadStorage();
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
@@ -927,7 +920,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);
|
||||
@@ -970,7 +963,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
|
||||
@@ -1000,7 +993,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
|
||||
@@ -1046,14 +1039,14 @@ 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));
|
||||
}
|
||||
|
||||
s_pPlatformNetworkManager->_StartGame();
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
// Start the game again
|
||||
|
||||
Reference in New Issue
Block a user