Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49c1f2c1da | |||
| 43d520f692 | |||
| 0b0d74a638 | |||
| b27cb536a5 | |||
| 15ea3dc85c | |||
| 9fde19eca0 | |||
| e9f5b4b6f0 | |||
| 7b643cdd75 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIControl_TextInput.h"
|
#include "UIControl_TextInput.h"
|
||||||
|
#include "..\..\Screen.h"
|
||||||
|
|
||||||
UIControl_TextInput::UIControl_TextInput()
|
UIControl_TextInput::UIControl_TextInput()
|
||||||
{
|
{
|
||||||
@@ -211,6 +212,31 @@ UIControl_TextInput::EDirectEditResult UIControl_TextInput::tickDirectEdit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paste from clipboard
|
||||||
|
if (g_KBMInput.IsKeyPressed('V') && g_KBMInput.IsKeyDown(VK_CONTROL))
|
||||||
|
{
|
||||||
|
wstring pasted = Screen::getClipboard();
|
||||||
|
wstring sanitized;
|
||||||
|
sanitized.reserve(pasted.length());
|
||||||
|
|
||||||
|
for (wchar_t pc : pasted)
|
||||||
|
{
|
||||||
|
if (pc >= 0x20) // Keep printable characters
|
||||||
|
{
|
||||||
|
if (m_iCharLimit > 0 && (m_editBuffer.length() + sanitized.length()) >= (size_t)m_iCharLimit)
|
||||||
|
break;
|
||||||
|
sanitized += pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sanitized.empty())
|
||||||
|
{
|
||||||
|
m_editBuffer.insert(m_iCursorPos, sanitized);
|
||||||
|
m_iCursorPos += (int)sanitized.length();
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Arrow keys, Home, End, Delete for cursor movement
|
// Arrow keys, Home, End, Delete for cursor movement
|
||||||
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
|
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIScene_Keyboard.h"
|
#include "UIScene_Keyboard.h"
|
||||||
|
#include "..\..\Screen.h"
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
// Global buffer that stores the text entered in the native keyboard scene.
|
// Global buffer that stores the text entered in the native keyboard scene.
|
||||||
@@ -224,6 +225,38 @@ void UIScene_Keyboard::tick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paste from clipboard
|
||||||
|
if (g_KBMInput.IsKeyPressed('V') && g_KBMInput.IsKeyDown(VK_CONTROL))
|
||||||
|
{
|
||||||
|
wstring pasted = Screen::getClipboard();
|
||||||
|
wstring sanitized;
|
||||||
|
sanitized.reserve(pasted.length());
|
||||||
|
|
||||||
|
for (wchar_t pc : pasted)
|
||||||
|
{
|
||||||
|
if (pc >= 0x20) // Keep printable characters
|
||||||
|
{
|
||||||
|
if (static_cast<int>(m_win64TextBuffer.length() + sanitized.length()) >= m_win64MaxChars)
|
||||||
|
break;
|
||||||
|
sanitized += pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sanitized.empty())
|
||||||
|
{
|
||||||
|
if (m_bPCMode)
|
||||||
|
{
|
||||||
|
m_win64TextBuffer.insert(m_iCursorPos, sanitized);
|
||||||
|
m_iCursorPos += (int)sanitized.length();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_win64TextBuffer += sanitized;
|
||||||
|
}
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_bPCMode)
|
if (m_bPCMode)
|
||||||
{
|
{
|
||||||
// Arrow keys, Home, End, Delete for cursor movement
|
// Arrow keys, Home, End, Delete for cursor movement
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId)
|
|||||||
UINT uiIDA[2];
|
UINT uiIDA[2];
|
||||||
uiIDA[0]=IDS_CANCEL;
|
uiIDA[0]=IDS_CANCEL;
|
||||||
uiIDA[1]=IDS_OK;
|
uiIDA[1]=IDS_OK;
|
||||||
ui.RequestErrorMessage(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this);
|
ui.RequestErrorMessage(IDS_WINDOWS_EXIT, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ float GameRenderer::getFov(float a, bool applyEffects)
|
|||||||
float fov = m_fov;//70;
|
float fov = m_fov;//70;
|
||||||
if (applyEffects)
|
if (applyEffects)
|
||||||
{
|
{
|
||||||
fov += mc->options->fov * 40;
|
//fov += mc->options->fov * 40;
|
||||||
fov *= oFov[playerIdx] + (this->fov[playerIdx] - oFov[playerIdx]) * a;
|
fov *= oFov[playerIdx] + (this->fov[playerIdx] - oFov[playerIdx]) * a;
|
||||||
}
|
}
|
||||||
if (player->getHealth() <= 0)
|
if (player->getHealth() <= 0)
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW
|
|||||||
setFlightAllowed(GetDedicatedServerBool(settings, L"allow-flight", true));
|
setFlightAllowed(GetDedicatedServerBool(settings, L"allow-flight", true));
|
||||||
|
|
||||||
// 4J Stu - Enabling flight to stop it kicking us when we use it
|
// 4J Stu - Enabling flight to stop it kicking us when we use it
|
||||||
#ifdef _DEBUG_MENUS_ENABLED
|
#if (defined _DEBUG_MENUS_ENABLED && defined _DEBUG)
|
||||||
setFlightAllowed(true);
|
setFlightAllowed(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1715,330 +1715,345 @@ void MinecraftServer::setPlayerIdleTimeout(int playerIdleTimeout)
|
|||||||
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
extern int c0a, c0b, c1a, c1b, c1c, c2a, c2b;
|
||||||
void MinecraftServer::run(int64_t seed, void *lpParameter)
|
void MinecraftServer::run(int64_t seed, void *lpParameter)
|
||||||
{
|
{
|
||||||
NetworkGameInitData *initData = nullptr;
|
NetworkGameInitData *initData = nullptr;
|
||||||
DWORD initSettings = 0;
|
DWORD initSettings = 0;
|
||||||
bool findSeed = false;
|
bool findSeed = false;
|
||||||
if(lpParameter != nullptr)
|
if(lpParameter != nullptr)
|
||||||
{
|
{
|
||||||
initData = static_cast<NetworkGameInitData *>(lpParameter);
|
initData = static_cast<NetworkGameInitData *>(lpParameter);
|
||||||
initSettings = app.GetGameHostOption(eGameHostOption_All);
|
initSettings = app.GetGameHostOption(eGameHostOption_All);
|
||||||
findSeed = initData->findSeed;
|
findSeed = initData->findSeed;
|
||||||
m_texturePackId = initData->texturePackId;
|
m_texturePackId = initData->texturePackId;
|
||||||
}
|
}
|
||||||
// try { // 4J - removed try/catch/finally
|
// try { // 4J - removed try/catch/finally
|
||||||
bool didInit = false;
|
bool didInit = false;
|
||||||
if (initServer(seed, initData, initSettings,findSeed))
|
if (initServer(seed, initData, initSettings,findSeed))
|
||||||
{
|
{
|
||||||
didInit = true;
|
didInit = true;
|
||||||
ServerLevel *levelNormalDimension = levels[0];
|
ServerLevel *levelNormalDimension = levels[0];
|
||||||
// 4J-PB - Set the Stronghold position in the leveldata if there isn't one in there
|
// 4J-PB - Set the Stronghold position in the leveldata if there isn't one in there
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
LevelData *pLevelData=levelNormalDimension->getLevelData();
|
LevelData *pLevelData=levelNormalDimension->getLevelData();
|
||||||
|
|
||||||
if(pLevelData && pLevelData->getHasStronghold()==false)
|
if(pLevelData && pLevelData->getHasStronghold()==false)
|
||||||
{
|
{
|
||||||
int x,z;
|
int x,z;
|
||||||
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
if(app.GetTerrainFeaturePosition(eTerrainFeature_Stronghold,&x,&z))
|
||||||
{
|
{
|
||||||
pLevelData->setXStronghold(x);
|
pLevelData->setXStronghold(x);
|
||||||
pLevelData->setZStronghold(z);
|
pLevelData->setZStronghold(z);
|
||||||
pLevelData->setHasStronghold();
|
pLevelData->setHasStronghold();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t lastTime = getCurrentTimeMillis();
|
int64_t lastTime = getCurrentTimeMillis();
|
||||||
int64_t unprocessedTime = 0;
|
int64_t unprocessedTime = 0;
|
||||||
while (running && !s_bServerHalted)
|
while (running && !s_bServerHalted)
|
||||||
{
|
{
|
||||||
int64_t now = getCurrentTimeMillis();
|
int64_t now = getCurrentTimeMillis();
|
||||||
|
|
||||||
// 4J Stu - When we pause the server, we don't want to count that as time passed
|
// 4J Stu - When we pause the server, we don't want to count that as time passed
|
||||||
// 4J Stu - TU-1 hotifx - Remove this line. We want to make sure that we tick connections at the proper rate when paused
|
// 4J Stu - TU-1 hotifx - Remove this line. We want to make sure that we tick connections at the proper rate when paused
|
||||||
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
|
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
|
||||||
//if(m_isServerPaused) lastTime = now;
|
//if(m_isServerPaused) lastTime = now;
|
||||||
|
|
||||||
int64_t passedTime = now - lastTime;
|
int64_t passedTime = now - lastTime;
|
||||||
if (passedTime > MS_PER_TICK * 40)
|
if (passedTime > MS_PER_TICK * 40)
|
||||||
{
|
{
|
||||||
// logger.warning("Can't keep up! Did the system time change, or is the server overloaded?");
|
// logger.warning("Can't keep up! Did the system time change, or is the server overloaded?");
|
||||||
passedTime = MS_PER_TICK * 40;
|
passedTime = MS_PER_TICK * 40;
|
||||||
}
|
}
|
||||||
if (passedTime < 0)
|
if (passedTime < 0)
|
||||||
{
|
{
|
||||||
// logger.warning("Time ran backwards! Did the system time change?");
|
// logger.warning("Time ran backwards! Did the system time change?");
|
||||||
passedTime = 0;
|
passedTime = 0;
|
||||||
}
|
}
|
||||||
unprocessedTime += passedTime;
|
unprocessedTime += passedTime;
|
||||||
lastTime = now;
|
lastTime = now;
|
||||||
|
|
||||||
// 4J Added ability to pause the server
|
// 4J Added ability to pause the server
|
||||||
if( !m_isServerPaused )
|
if( !m_isServerPaused )
|
||||||
{
|
{
|
||||||
bool didTick = false;
|
bool didTick = false;
|
||||||
if (levels[0]->allPlayersAreSleeping())
|
if (levels[0]->allPlayersAreSleeping())
|
||||||
{
|
{
|
||||||
tick();
|
tick();
|
||||||
unprocessedTime = 0;
|
unprocessedTime = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// int tickcount = 0;
|
// int tickcount = 0;
|
||||||
// int64_t beforeall = System::currentTimeMillis();
|
// int64_t beforeall = System::currentTimeMillis();
|
||||||
while (unprocessedTime > MS_PER_TICK)
|
while (unprocessedTime > MS_PER_TICK)
|
||||||
{
|
{
|
||||||
unprocessedTime -= MS_PER_TICK;
|
unprocessedTime -= MS_PER_TICK;
|
||||||
chunkPacketManagement_PreTick();
|
chunkPacketManagement_PreTick();
|
||||||
// int64_t before = System::currentTimeMillis();
|
// int64_t before = System::currentTimeMillis();
|
||||||
tick();
|
tick();
|
||||||
// int64_t after = System::currentTimeMillis();
|
// int64_t after = System::currentTimeMillis();
|
||||||
// PIXReportCounter(L"Server time",(float)(after-before));
|
// PIXReportCounter(L"Server time",(float)(after-before));
|
||||||
|
|
||||||
chunkPacketManagement_PostTick();
|
chunkPacketManagement_PostTick();
|
||||||
}
|
}
|
||||||
// int64_t afterall = System::currentTimeMillis();
|
// int64_t afterall = System::currentTimeMillis();
|
||||||
// PIXReportCounter(L"Server time all",(float)(afterall-beforeall));
|
// PIXReportCounter(L"Server time all",(float)(afterall-beforeall));
|
||||||
// PIXReportCounter(L"Server ticks",(float)tickcount);
|
// PIXReportCounter(L"Server ticks",(float)tickcount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4J Stu - TU1-hotfix
|
// 4J Stu - TU1-hotfix
|
||||||
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
|
//Fix for #13191 - The host of a game can get a message informing them that the connection to the server has been lost
|
||||||
// The connections should tick at the same frequency even when paused
|
// The connections should tick at the same frequency even when paused
|
||||||
while (unprocessedTime > MS_PER_TICK)
|
while (unprocessedTime > MS_PER_TICK)
|
||||||
{
|
{
|
||||||
unprocessedTime -= MS_PER_TICK;
|
unprocessedTime -= MS_PER_TICK;
|
||||||
// Keep ticking the connections to stop them timing out
|
// Keep ticking the connections to stop them timing out
|
||||||
connection->tick();
|
connection->tick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(MinecraftServer::setTimeAtEndOfTick)
|
if(MinecraftServer::setTimeAtEndOfTick)
|
||||||
{
|
{
|
||||||
MinecraftServer::setTimeAtEndOfTick = false;
|
MinecraftServer::setTimeAtEndOfTick = false;
|
||||||
for (unsigned int i = 0; i < levels.length; i++)
|
for (unsigned int i = 0; i < levels.length; i++)
|
||||||
{
|
{
|
||||||
// if (i == 0 || settings->getBoolean(L"allow-nether", true)) // 4J removed - we always have nether
|
// if (i == 0 || settings->getBoolean(L"allow-nether", true)) // 4J removed - we always have nether
|
||||||
{
|
{
|
||||||
ServerLevel *level = levels[i];
|
ServerLevel *level = levels[i];
|
||||||
level->setGameTime( MinecraftServer::setTime );
|
level->setGameTime( MinecraftServer::setTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(MinecraftServer::setTimeOfDayAtEndOfTick)
|
if(MinecraftServer::setTimeOfDayAtEndOfTick)
|
||||||
{
|
{
|
||||||
MinecraftServer::setTimeOfDayAtEndOfTick = false;
|
MinecraftServer::setTimeOfDayAtEndOfTick = false;
|
||||||
for (unsigned int i = 0; i < levels.length; i++)
|
for (unsigned int i = 0; i < levels.length; i++)
|
||||||
{
|
{
|
||||||
if (i == 0 || GetDedicatedServerBool(settings, L"allow-nether", true))
|
if (i == 0 || GetDedicatedServerBool(settings, L"allow-nether", true))
|
||||||
{
|
{
|
||||||
ServerLevel *level = levels[i];
|
ServerLevel *level = levels[i];
|
||||||
level->setDayTime( MinecraftServer::setTimeOfDay );
|
level->setDayTime( MinecraftServer::setTimeOfDay );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process delayed actions
|
// Process delayed actions
|
||||||
eXuiServerAction eAction;
|
eXuiServerAction eAction;
|
||||||
LPVOID param;
|
LPVOID param;
|
||||||
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
for(int i=0;i<XUSER_MAX_COUNT;i++)
|
||||||
{
|
{
|
||||||
eAction = app.GetXuiServerAction(i);
|
eAction = app.GetXuiServerAction(i);
|
||||||
param = app.GetXuiServerActionParam(i);
|
param = app.GetXuiServerActionParam(i);
|
||||||
|
|
||||||
switch(eAction)
|
switch(eAction)
|
||||||
{
|
{
|
||||||
case eXuiServerAction_AutoSaveGame:
|
case eXuiServerAction_AutoSaveGame:
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(MINECRAFT_SERVER_BUILD)
|
||||||
|
{
|
||||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
{
|
PIXBeginNamedEvent(0, "Autosave");
|
||||||
PIXBeginNamedEvent(0,"Autosave");
|
|
||||||
|
|
||||||
// Get the frequency of the timer
|
// Get the frequency of the timer
|
||||||
LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime;
|
LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime;
|
||||||
float fElapsedTime = 0.0f;
|
float fElapsedTime = 0.0f;
|
||||||
QueryPerformanceFrequency( &qwTicksPerSec );
|
QueryPerformanceFrequency(&qwTicksPerSec);
|
||||||
float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart;
|
float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart;
|
||||||
|
|
||||||
// Save the start time
|
// Save the start time
|
||||||
QueryPerformanceCounter( &qwTime );
|
QueryPerformanceCounter(&qwTime);
|
||||||
|
|
||||||
if (players != nullptr)
|
|
||||||
{
|
|
||||||
players->saveAll(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int j = 0; j < levels.length; j++)
|
|
||||||
{
|
|
||||||
if( s_bServerHalted ) break;
|
|
||||||
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
|
||||||
// with the data from the nethers leveldata.
|
|
||||||
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
|
||||||
ServerLevel *level = levels[levels.length - 1 - j];
|
|
||||||
PIXBeginNamedEvent(0, "Saving level %d",levels.length - 1 - j);
|
|
||||||
level->save(false, nullptr, true);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
|
||||||
if( !s_bServerHalted )
|
|
||||||
{
|
|
||||||
PIXBeginNamedEvent(0,"Saving game rules");
|
|
||||||
saveGameRules();
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
PIXBeginNamedEvent(0,"Save to disc");
|
|
||||||
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, true);
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
}
|
|
||||||
PIXEndNamedEvent();
|
|
||||||
|
|
||||||
QueryPerformanceCounter( &qwNewTime );
|
|
||||||
qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart;
|
|
||||||
fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart));
|
|
||||||
app.DebugPrintf("Autosave: Elapsed time %f\n", fElapsedTime);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case eXuiServerAction_SaveGame:
|
|
||||||
app.EnterSaveNotificationSection();
|
|
||||||
if (players != nullptr)
|
|
||||||
{
|
|
||||||
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
players->broadcastAll(std::make_shared<UpdateProgressPacket>(20));
|
if (players != nullptr)
|
||||||
|
{
|
||||||
|
players->saveAll(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int j = 0; j < levels.length; j++)
|
for (unsigned int j = 0; j < levels.length; j++)
|
||||||
{
|
{
|
||||||
|
if( s_bServerHalted ) break;
|
||||||
|
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
||||||
|
// with the data from the nethers leveldata.
|
||||||
|
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
||||||
|
ServerLevel *level = levels[levels.length - 1 - j];
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXBeginNamedEvent(0, "Saving level %d", levels.length - 1 - j);
|
||||||
|
#endif
|
||||||
|
level->save(false, nullptr, true);
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (!s_bServerHalted)
|
||||||
|
{
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXBeginNamedEvent(0, "Saving game rules");
|
||||||
|
#endif
|
||||||
|
saveGameRules();
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
|
PIXBeginNamedEvent(0, "Save to disc");
|
||||||
|
#endif
|
||||||
|
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, true);
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||||
|
PIXEndNamedEvent();
|
||||||
|
|
||||||
|
QueryPerformanceCounter(&qwNewTime);
|
||||||
|
qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart;
|
||||||
|
fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart));
|
||||||
|
app.DebugPrintf("Autosave: Elapsed time %f\n", fElapsedTime);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case eXuiServerAction_SaveGame:
|
||||||
|
app.EnterSaveNotificationSection();
|
||||||
|
if (players != nullptr)
|
||||||
|
{
|
||||||
|
players->saveAll(Minecraft::GetInstance()->progressRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(20));
|
||||||
|
|
||||||
|
for (unsigned int j = 0; j < levels.length; j++)
|
||||||
|
{
|
||||||
if( s_bServerHalted ) break;
|
if( s_bServerHalted ) break;
|
||||||
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
// 4J Stu - Save the levels in reverse order so we don't overwrite the level.dat
|
||||||
// with the data from the nethers leveldata.
|
// with the data from the nethers leveldata.
|
||||||
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
// Fix for #7418 - Functional: Gameplay: Saving after sleeping in a bed will place player at nighttime when restarting.
|
||||||
ServerLevel *level = levels[levels.length - 1 - j];
|
ServerLevel *level = levels[levels.length - 1 - j];
|
||||||
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
level->save(true, Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
||||||
|
|
||||||
players->broadcastAll(std::make_shared<UpdateProgressPacket>(33 + (j * 33)));
|
players->broadcastAll(std::make_shared<UpdateProgressPacket>(33 + (j * 33)));
|
||||||
}
|
}
|
||||||
if( !s_bServerHalted )
|
if( !s_bServerHalted )
|
||||||
{
|
{
|
||||||
saveGameRules();
|
saveGameRules();
|
||||||
|
|
||||||
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, (eAction==eXuiServerAction_AutoSaveGame));
|
||||||
}
|
}
|
||||||
app.LeaveSaveNotificationSection();
|
app.LeaveSaveNotificationSection();
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_DropItem:
|
case eXuiServerAction_DropItem:
|
||||||
// Find the player, and drop the id at their feet
|
// Find the player, and drop the id at their feet
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = players->players.at(0);
|
shared_ptr<ServerPlayer> player = players->players.at(0);
|
||||||
size_t id = (size_t) param;
|
size_t id = (size_t) param;
|
||||||
player->drop(std::make_shared<ItemInstance>(id, 1, 0));
|
player->drop(std::make_shared<ItemInstance>(id, 1, 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_SpawnMob:
|
case eXuiServerAction_SpawnMob:
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> player = players->players.at(0);
|
shared_ptr<ServerPlayer> player = players->players.at(0);
|
||||||
eINSTANCEOF factory = static_cast<eINSTANCEOF>((size_t)param);
|
eINSTANCEOF factory = static_cast<eINSTANCEOF>((size_t)param);
|
||||||
shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(factory,player->level ));
|
shared_ptr<Mob> mob = dynamic_pointer_cast<Mob>(EntityIO::newByEnumType(factory,player->level ));
|
||||||
mob->moveTo(player->x+1, player->y, player->z+1, player->level->random->nextFloat() * 360, 0);
|
mob->moveTo(player->x+1, player->y, player->z+1, player->level->random->nextFloat() * 360, 0);
|
||||||
mob->setDespawnProtected(); // 4J added, default to being protected against despawning (has to be done after initial position is set)
|
mob->setDespawnProtected(); // 4J added, default to being protected against despawning (has to be done after initial position is set)
|
||||||
player->level->addEntity(mob);
|
player->level->addEntity(mob);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_PauseServer:
|
case eXuiServerAction_PauseServer:
|
||||||
m_isServerPaused = ( (size_t) param == TRUE );
|
m_isServerPaused = ( (size_t) param == TRUE );
|
||||||
if( m_isServerPaused )
|
if( m_isServerPaused )
|
||||||
{
|
{
|
||||||
m_serverPausedEvent->Set();
|
m_serverPausedEvent->Set();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ToggleRain:
|
case eXuiServerAction_ToggleRain:
|
||||||
{
|
{
|
||||||
bool isRaining = levels[0]->getLevelData()->isRaining();
|
bool isRaining = levels[0]->getLevelData()->isRaining();
|
||||||
levels[0]->getLevelData()->setRaining(!isRaining);
|
levels[0]->getLevelData()->setRaining(!isRaining);
|
||||||
levels[0]->getLevelData()->setRainTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
levels[0]->getLevelData()->setRainTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ToggleThunder:
|
case eXuiServerAction_ToggleThunder:
|
||||||
{
|
{
|
||||||
bool isThundering = levels[0]->getLevelData()->isThundering();
|
bool isThundering = levels[0]->getLevelData()->isThundering();
|
||||||
levels[0]->getLevelData()->setThundering(!isThundering);
|
levels[0]->getLevelData()->setThundering(!isThundering);
|
||||||
levels[0]->getLevelData()->setThunderTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
levels[0]->getLevelData()->setThunderTime(levels[0]->random->nextInt(Level::TICKS_PER_DAY * 7) + Level::TICKS_PER_DAY / 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ServerSettingChanged_Gamertags:
|
case eXuiServerAction_ServerSettingChanged_Gamertags:
|
||||||
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)));
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_OPTIONS, app.GetGameHostOption(eGameHostOption_Gamertags)));
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ServerSettingChanged_BedrockFog:
|
case eXuiServerAction_ServerSettingChanged_BedrockFog:
|
||||||
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)));
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_IN_GAME_SETTINGS, app.GetGameHostOption(eGameHostOption_All)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eXuiServerAction_ServerSettingChanged_Difficulty:
|
case eXuiServerAction_ServerSettingChanged_Difficulty:
|
||||||
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty));
|
players->broadcastAll(std::make_shared<ServerSettingsChangedPacket>(ServerSettingsChangedPacket::HOST_DIFFICULTY, Minecraft::GetInstance()->options->difficulty));
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_ExportSchematic:
|
case eXuiServerAction_ExportSchematic:
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
app.EnterSaveNotificationSection();
|
app.EnterSaveNotificationSection();
|
||||||
|
|
||||||
//players->broadcastAll( shared_ptr<UpdateProgressPacket>( new UpdateProgressPacket(20) ) );
|
//players->broadcastAll( shared_ptr<UpdateProgressPacket>( new UpdateProgressPacket(20) ) );
|
||||||
|
|
||||||
if( !s_bServerHalted )
|
if( !s_bServerHalted )
|
||||||
{
|
{
|
||||||
ConsoleSchematicFile::XboxSchematicInitParam *initData = static_cast<ConsoleSchematicFile::XboxSchematicInitParam *>(param);
|
ConsoleSchematicFile::XboxSchematicInitParam *initData = static_cast<ConsoleSchematicFile::XboxSchematicInitParam *>(param);
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
File targetFileDir(File::pathRoot + File::pathSeparator + L"Schematics");
|
File targetFileDir(File::pathRoot + File::pathSeparator + L"Schematics");
|
||||||
#else
|
#else
|
||||||
File targetFileDir(L"Schematics");
|
File targetFileDir(L"Schematics");
|
||||||
#endif
|
#endif
|
||||||
if(!targetFileDir.exists()) targetFileDir.mkdir();
|
if(!targetFileDir.exists()) targetFileDir.mkdir();
|
||||||
|
|
||||||
wchar_t filename[128];
|
wchar_t filename[128];
|
||||||
swprintf(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1));
|
swprintf(filename,128,L"%ls%dx%dx%d.sch",initData->name,(initData->endX - initData->startX + 1), (initData->endY - initData->startY + 1), (initData->endZ - initData->startZ + 1));
|
||||||
|
|
||||||
File dataFile = File( targetFileDir, wstring(filename) );
|
File dataFile = File( targetFileDir, wstring(filename) );
|
||||||
if(dataFile.exists()) dataFile._delete();
|
if(dataFile.exists()) dataFile._delete();
|
||||||
FileOutputStream fos = FileOutputStream(dataFile);
|
FileOutputStream fos = FileOutputStream(dataFile);
|
||||||
DataOutputStream dos = DataOutputStream(&fos);
|
DataOutputStream dos = DataOutputStream(&fos);
|
||||||
ConsoleSchematicFile::generateSchematicFile(&dos, levels[0], initData->startX, initData->startY, initData->startZ, initData->endX, initData->endY, initData->endZ, initData->bSaveMobs, initData->compressionType);
|
ConsoleSchematicFile::generateSchematicFile(&dos, levels[0], initData->startX, initData->startY, initData->startZ, initData->endX, initData->endY, initData->endZ, initData->bSaveMobs, initData->compressionType);
|
||||||
dos.close();
|
dos.close();
|
||||||
|
|
||||||
delete initData;
|
delete initData;
|
||||||
}
|
}
|
||||||
app.LeaveSaveNotificationSection();
|
app.LeaveSaveNotificationSection();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case eXuiServerAction_SetCameraLocation:
|
case eXuiServerAction_SetCameraLocation:
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
{
|
{
|
||||||
DebugSetCameraPosition *pos = static_cast<DebugSetCameraPosition *>(param);
|
DebugSetCameraPosition *pos = static_cast<DebugSetCameraPosition *>(param);
|
||||||
|
|
||||||
app.DebugPrintf( "DEBUG: Player=%i\n", pos->player );
|
app.DebugPrintf( "DEBUG: Player=%i\n", pos->player );
|
||||||
app.DebugPrintf( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking at=(%f.2,%f.2)\n",
|
app.DebugPrintf( "DEBUG: Teleporting to pos=(%f.2, %f.2, %f.2), looking at=(%f.2,%f.2)\n",
|
||||||
pos->m_camX, pos->m_camY, pos->m_camZ,
|
pos->m_camX, pos->m_camY, pos->m_camZ,
|
||||||
pos->m_yRot, pos->m_elev
|
pos->m_yRot, pos->m_elev
|
||||||
);
|
);
|
||||||
|
|
||||||
shared_ptr<ServerPlayer> player = players->players.at(pos->player);
|
shared_ptr<ServerPlayer> player = players->players.at(pos->player);
|
||||||
player->debug_setPosition( pos->m_camX, pos->m_camY, pos->m_camZ,
|
player->debug_setPosition( pos->m_camX, pos->m_camY, pos->m_camZ,
|
||||||
pos->m_yRot, pos->m_elev );
|
pos->m_yRot, pos->m_elev );
|
||||||
|
|
||||||
// Doesn't work
|
// Doesn't work
|
||||||
//player->setYHeadRot(pos->m_yRot);
|
//player->setYHeadRot(pos->m_yRot);
|
||||||
//player->absMoveTo(pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, pos->m_elev);
|
//player->absMoveTo(pos->m_camX, pos->m_camY, pos->m_camZ, pos->m_yRot, pos->m_elev);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.SetXuiServerAction(i,eXuiServerAction_Idle);
|
app.SetXuiServerAction(i,eXuiServerAction_Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// while (running)
|
// while (running)
|
||||||
// {
|
// {
|
||||||
// handleConsoleInputs();
|
// handleConsoleInputs();
|
||||||
// Sleep(10);
|
// Sleep(10);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
#if 0
|
#if 0
|
||||||
@@ -2065,9 +2080,9 @@ void MinecraftServer::run(int64_t seed, void *lpParameter)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 4J Stu - Stop the server when the loops complete, as the finally would do
|
// 4J Stu - Stop the server when the loops complete, as the finally would do
|
||||||
stopServer(didInit);
|
stopServer(didInit);
|
||||||
stopped = true;
|
stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::broadcastStartSavingPacket()
|
void MinecraftServer::broadcastStartSavingPacket()
|
||||||
@@ -2375,6 +2390,9 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
|
|||||||
{
|
{
|
||||||
if( player == nullptr ) return false;
|
if( player == nullptr ) return false;
|
||||||
|
|
||||||
|
#ifdef MINECRAFT_SERVER_BUILD
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
int time = GetTickCount();
|
int time = GetTickCount();
|
||||||
DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount();
|
DWORD currentPlayerCount = g_NetworkManager.GetPlayerCount();
|
||||||
if( currentPlayerCount == 0 ) return false;
|
if( currentPlayerCount == 0 ) return false;
|
||||||
@@ -2386,6 +2404,7 @@ bool MinecraftServer::chunkPacketManagement_CanSendTo(INetworkPlayer *player)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player)
|
void MinecraftServer::chunkPacketManagement_DidSendTo(INetworkPlayer *player)
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ void Screen::updateEvents()
|
|||||||
// Map to Screen::keyPressed
|
// Map to Screen::keyPressed
|
||||||
int mappedKey = -1;
|
int mappedKey = -1;
|
||||||
wchar_t ch = 0;
|
wchar_t ch = 0;
|
||||||
if (vk == VK_ESCAPE) mappedKey = Keyboard::KEY_ESCAPE;
|
if (vk == VK_ESCAPE) mappedKey = Keyboard::KEY_ESCAPE;
|
||||||
else if (vk == VK_RETURN) mappedKey = Keyboard::KEY_RETURN;
|
else if (vk == VK_RETURN) mappedKey = Keyboard::KEY_RETURN;
|
||||||
else if (vk == VK_BACK) mappedKey = Keyboard::KEY_BACK;
|
else if (vk == VK_BACK) mappedKey = Keyboard::KEY_BACK;
|
||||||
else if (vk == VK_UP) mappedKey = Keyboard::KEY_UP;
|
else if (vk == VK_UP) mappedKey = Keyboard::KEY_UP;
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ void ServerPlayer::flagEntitiesToBeRemoved(unsigned int *flags, bool *removedFou
|
|||||||
if( ( *removedFound ) == false )
|
if( ( *removedFound ) == false )
|
||||||
{
|
{
|
||||||
*removedFound = true;
|
*removedFound = true;
|
||||||
memset(flags, 0, 2048/32);
|
// before this left 192 bytes uninitialized!!!!!
|
||||||
|
memset(flags, 0, (2048 / 32) * sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int index : entitiesToRemove)
|
for(int index : entitiesToRemove)
|
||||||
@@ -376,6 +377,9 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
|||||||
// connection->done);
|
// connection->done);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
#ifdef MINECRAFT_SERVER_BUILD
|
||||||
|
if (dontDelayChunks || (canSendToPlayer && !connection->done))
|
||||||
|
#else
|
||||||
if( dontDelayChunks ||
|
if( dontDelayChunks ||
|
||||||
(canSendToPlayer &&
|
(canSendToPlayer &&
|
||||||
#ifdef _XBOX_ONE
|
#ifdef _XBOX_ONE
|
||||||
@@ -390,21 +394,22 @@ void ServerPlayer::doChunkSendingTick(bool dontDelayChunks)
|
|||||||
#endif
|
#endif
|
||||||
//(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) &&
|
//(tickCount - lastBrupSendTickCount) > (connection->getNetworkPlayer()->GetCurrentRtt()>>4) &&
|
||||||
!connection->done) )
|
!connection->done) )
|
||||||
{
|
#endif
|
||||||
lastBrupSendTickCount = tickCount;
|
{
|
||||||
okToSend = true;
|
lastBrupSendTickCount = tickCount;
|
||||||
MinecraftServer::chunkPacketManagement_DidSendTo(connection->getNetworkPlayer());
|
okToSend = true;
|
||||||
|
MinecraftServer::chunkPacketManagement_DidSendTo(connection->getNetworkPlayer());
|
||||||
|
|
||||||
// static unordered_map<wstring,int64_t> mapLastTime;
|
// static unordered_map<wstring,int64_t> mapLastTime;
|
||||||
// int64_t thisTime = System::currentTimeMillis();
|
// int64_t thisTime = System::currentTimeMillis();
|
||||||
// int64_t lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()];
|
// int64_t lastTime = mapLastTime[connection->getNetworkPlayer()->GetUID().toString()];
|
||||||
// app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime);
|
// app.DebugPrintf(" - OK to send (%d ms since last)\n", thisTime - lastTime);
|
||||||
// mapLastTime[connection->getNetworkPlayer()->GetUID().toString()] = thisTime;
|
// mapLastTime[connection->getNetworkPlayer()->GetUID().toString()] = thisTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// app.DebugPrintf(" - <NOT OK>\n");
|
// app.DebugPrintf(" - <NOT OK>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (okToSend)
|
if (okToSend)
|
||||||
|
|||||||
@@ -25,12 +25,20 @@ public:
|
|||||||
static const int KEY_DROP = 'Q';
|
static const int KEY_DROP = 'Q';
|
||||||
static const int KEY_CRAFTING = 'C';
|
static const int KEY_CRAFTING = 'C';
|
||||||
static const int KEY_CRAFTING_ALT = 'R';
|
static const int KEY_CRAFTING_ALT = 'R';
|
||||||
|
static const int KEY_CHAT = 'T';
|
||||||
static const int KEY_CONFIRM = VK_RETURN;
|
static const int KEY_CONFIRM = VK_RETURN;
|
||||||
static const int KEY_CANCEL = VK_ESCAPE;
|
static const int KEY_CANCEL = VK_ESCAPE;
|
||||||
static const int KEY_PAUSE = VK_ESCAPE;
|
static const int KEY_PAUSE = VK_ESCAPE;
|
||||||
static const int KEY_THIRD_PERSON = VK_F5;
|
static const int KEY_TOGGLE_HUD = VK_F1;
|
||||||
static const int KEY_DEBUG_INFO = VK_F3;
|
static const int KEY_DEBUG_INFO = VK_F3;
|
||||||
static const int KEY_DEBUG_MENU = VK_F4;
|
static const int KEY_DEBUG_MENU = VK_F4;
|
||||||
|
static const int KEY_THIRD_PERSON = VK_F5;
|
||||||
|
static const int KEY_DEBUG_CONSOLE = VK_F6;
|
||||||
|
static const int KEY_HOST_SETTINGS = VK_F8;
|
||||||
|
static const int KEY_FULLSCREEN = VK_F11;
|
||||||
|
|
||||||
|
// todo: implement and shi
|
||||||
|
static const int KEY_SCREENSHOT = VK_F2;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Tick();
|
void Tick();
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
|
|||||||
struct Win64LaunchOptions
|
struct Win64LaunchOptions
|
||||||
{
|
{
|
||||||
int screenMode;
|
int screenMode;
|
||||||
bool serverMode;
|
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -207,13 +206,9 @@ static Win64LaunchOptions ParseLaunchOptions()
|
|||||||
{
|
{
|
||||||
Win64LaunchOptions options = {};
|
Win64LaunchOptions options = {};
|
||||||
options.screenMode = 0;
|
options.screenMode = 0;
|
||||||
options.serverMode = false;
|
|
||||||
|
|
||||||
g_Win64MultiplayerJoin = false;
|
g_Win64MultiplayerJoin = false;
|
||||||
g_Win64MultiplayerPort = WIN64_NET_DEFAULT_PORT;
|
g_Win64MultiplayerPort = WIN64_NET_DEFAULT_PORT;
|
||||||
g_Win64DedicatedServer = false;
|
|
||||||
g_Win64DedicatedServerPort = WIN64_NET_DEFAULT_PORT;
|
|
||||||
g_Win64DedicatedServerBindIP[0] = 0;
|
|
||||||
|
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||||
@@ -226,17 +221,6 @@ static Win64LaunchOptions ParseLaunchOptions()
|
|||||||
options.screenMode = argv[1][0] - L'0';
|
options.screenMode = argv[1][0] - L'0';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i)
|
|
||||||
{
|
|
||||||
if (_wcsicmp(argv[i], L"-server") == 0)
|
|
||||||
{
|
|
||||||
options.serverMode = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_Win64DedicatedServer = options.serverMode;
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i)
|
for (int i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(argv[i], L"-name") == 0 && (i + 1) < argc)
|
if (_wcsicmp(argv[i], L"-name") == 0 && (i + 1) < argc)
|
||||||
@@ -247,15 +231,8 @@ static Win64LaunchOptions ParseLaunchOptions()
|
|||||||
{
|
{
|
||||||
char ipBuf[256];
|
char ipBuf[256];
|
||||||
CopyWideArgToAnsi(argv[++i], ipBuf, sizeof(ipBuf));
|
CopyWideArgToAnsi(argv[++i], ipBuf, sizeof(ipBuf));
|
||||||
if (options.serverMode)
|
strncpy_s(g_Win64MultiplayerIP, sizeof(g_Win64MultiplayerIP), ipBuf, _TRUNCATE);
|
||||||
{
|
g_Win64MultiplayerJoin = true;
|
||||||
strncpy_s(g_Win64DedicatedServerBindIP, sizeof(g_Win64DedicatedServerBindIP), ipBuf, _TRUNCATE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strncpy_s(g_Win64MultiplayerIP, sizeof(g_Win64MultiplayerIP), ipBuf, _TRUNCATE);
|
|
||||||
g_Win64MultiplayerJoin = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(argv[i], L"-port") == 0 && (i + 1) < argc)
|
else if (_wcsicmp(argv[i], L"-port") == 0 && (i + 1) < argc)
|
||||||
{
|
{
|
||||||
@@ -263,10 +240,7 @@ static Win64LaunchOptions ParseLaunchOptions()
|
|||||||
const long port = wcstol(argv[++i], &endPtr, 10);
|
const long port = wcstol(argv[++i], &endPtr, 10);
|
||||||
if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535)
|
if (endPtr != argv[i] && *endPtr == 0 && port > 0 && port <= 65535)
|
||||||
{
|
{
|
||||||
if (options.serverMode)
|
g_Win64MultiplayerPort = static_cast<int>(port);
|
||||||
g_Win64DedicatedServerPort = static_cast<int>(port);
|
|
||||||
else
|
|
||||||
g_Win64MultiplayerPort = static_cast<int>(port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(argv[i], L"-fullscreen") == 0)
|
else if (_wcsicmp(argv[i], L"-fullscreen") == 0)
|
||||||
@@ -277,36 +251,6 @@ static Win64LaunchOptions ParseLaunchOptions()
|
|||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WINAPI HeadlessServerCtrlHandler(DWORD ctrlType)
|
|
||||||
{
|
|
||||||
switch (ctrlType)
|
|
||||||
{
|
|
||||||
case CTRL_C_EVENT:
|
|
||||||
case CTRL_BREAK_EVENT:
|
|
||||||
case CTRL_CLOSE_EVENT:
|
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
|
||||||
app.m_bShutdown = true;
|
|
||||||
MinecraftServer::HaltServer();
|
|
||||||
return TRUE;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetupHeadlessServerConsole()
|
|
||||||
{
|
|
||||||
if (AllocConsole())
|
|
||||||
{
|
|
||||||
FILE* stream = nullptr;
|
|
||||||
freopen_s(&stream, "CONIN$", "r", stdin);
|
|
||||||
freopen_s(&stream, "CONOUT$", "w", stdout);
|
|
||||||
freopen_s(&stream, "CONOUT$", "w", stderr);
|
|
||||||
SetConsoleTitleA("Minecraft Server");
|
|
||||||
}
|
|
||||||
|
|
||||||
SetConsoleCtrlHandler(HeadlessServerCtrlHandler, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DefineActions(void)
|
void DefineActions(void)
|
||||||
{
|
{
|
||||||
// The app needs to define the actions required, and the possible mappings for these
|
// The app needs to define the actions required, and the possible mappings for these
|
||||||
@@ -1350,161 +1294,6 @@ static Minecraft* InitialiseMinecraftRuntime()
|
|||||||
return pMinecraft;
|
return pMinecraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int HeadlessServerConsoleThreadProc(void* lpParameter)
|
|
||||||
{
|
|
||||||
UNREFERENCED_PARAMETER(lpParameter);
|
|
||||||
|
|
||||||
std::string line;
|
|
||||||
while (!app.m_bShutdown)
|
|
||||||
{
|
|
||||||
if (!std::getline(std::cin, line))
|
|
||||||
{
|
|
||||||
if (std::cin.eof())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cin.clear();
|
|
||||||
Sleep(50);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
wstring command = trimString(convStringToWstring(line));
|
|
||||||
if (command.empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MinecraftServer* server = MinecraftServer::getInstance();
|
|
||||||
if (server != nullptr)
|
|
||||||
{
|
|
||||||
server->handleConsoleInput(command, server);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int RunHeadlessServer()
|
|
||||||
{
|
|
||||||
SetupHeadlessServerConsole();
|
|
||||||
|
|
||||||
Settings serverSettings(new File(L"server.properties"));
|
|
||||||
const wstring configuredBindIp = serverSettings.getString(L"server-ip", L"");
|
|
||||||
|
|
||||||
const char* bindIp = "*";
|
|
||||||
if (g_Win64DedicatedServerBindIP[0] != 0)
|
|
||||||
{
|
|
||||||
bindIp = g_Win64DedicatedServerBindIP;
|
|
||||||
}
|
|
||||||
else if (!configuredBindIp.empty())
|
|
||||||
{
|
|
||||||
bindIp = wstringtochararray(configuredBindIp);
|
|
||||||
}
|
|
||||||
|
|
||||||
const int port = g_Win64DedicatedServerPort > 0 ? g_Win64DedicatedServerPort : serverSettings.getInt(L"server-port", WIN64_NET_DEFAULT_PORT);
|
|
||||||
|
|
||||||
printf("Starting headless server on %s:%d\n", bindIp, port);
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
const Minecraft* pMinecraft = InitialiseMinecraftRuntime();
|
|
||||||
if (pMinecraft == nullptr)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to initialise the Minecraft runtime.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.SetGameHostOption(eGameHostOption_Difficulty, serverSettings.getInt(L"difficulty", 1));
|
|
||||||
app.SetGameHostOption(eGameHostOption_Gamertags, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_GameType, serverSettings.getInt(L"gamemode", 0));
|
|
||||||
app.SetGameHostOption(eGameHostOption_LevelType, 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_Structures, serverSettings.getBoolean(L"generate-structures", true) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_BonusChest, serverSettings.getBoolean(L"bonus-chest", false) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_PvP, serverSettings.getBoolean(L"pvp", true) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_TrustPlayers, serverSettings.getBoolean(L"trust-players", true) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_FireSpreads, serverSettings.getBoolean(L"fire-spreads", true) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_TNT, serverSettings.getBoolean(L"tnt", true) ? 1 : 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanFly, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_MobGriefing, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_KeepInventory, 0);
|
|
||||||
app.SetGameHostOption(eGameHostOption_DoMobSpawning, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_DoMobLoot, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_DoTileDrops, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1);
|
|
||||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1);
|
|
||||||
|
|
||||||
MinecraftServer::resetFlags();
|
|
||||||
g_NetworkManager.HostGame(0, false, true, MINECRAFT_NET_MAX_PLAYERS, 0);
|
|
||||||
|
|
||||||
if (!WinsockNetLayer::IsActive())
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to bind the server socket on %s:%d.\n", bindIp, port);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_NetworkManager.FakeLocalPlayerJoined();
|
|
||||||
|
|
||||||
NetworkGameInitData* param = new NetworkGameInitData();
|
|
||||||
param->seed = 0;
|
|
||||||
param->settings = app.GetGameHostOption(eGameHostOption_All);
|
|
||||||
|
|
||||||
g_NetworkManager.ServerStoppedCreate(true);
|
|
||||||
g_NetworkManager.ServerReadyCreate(true);
|
|
||||||
|
|
||||||
C4JThread* thread = new C4JThread(&CGameNetworkManager::ServerThreadProc, param, "Server", 256 * 1024);
|
|
||||||
thread->SetProcessor(CPU_CORE_SERVER);
|
|
||||||
thread->Run();
|
|
||||||
|
|
||||||
g_NetworkManager.ServerReadyWait();
|
|
||||||
g_NetworkManager.ServerReadyDestroy();
|
|
||||||
|
|
||||||
if (MinecraftServer::serverHalted())
|
|
||||||
{
|
|
||||||
fprintf(stderr, "The server halted during startup.\n");
|
|
||||||
g_NetworkManager.LeaveGame(false);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.SetGameStarted(true);
|
|
||||||
g_NetworkManager.DoWork();
|
|
||||||
|
|
||||||
printf("Server ready on %s:%d\n", bindIp, port);
|
|
||||||
printf("Type 'help' for server commands.\n");
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
C4JThread* consoleThread = new C4JThread(&HeadlessServerConsoleThreadProc, nullptr, "Server console", 128 * 1024);
|
|
||||||
consoleThread->Run();
|
|
||||||
|
|
||||||
MSG msg = { 0 };
|
|
||||||
while (WM_QUIT != msg.message && !app.m_bShutdown && !MinecraftServer::serverHalted())
|
|
||||||
{
|
|
||||||
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
|
|
||||||
{
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UpdateTime();
|
|
||||||
ProfileManager.Tick();
|
|
||||||
StorageManager.Tick();
|
|
||||||
RenderManager.Tick();
|
|
||||||
ui.tick();
|
|
||||||
g_NetworkManager.DoWork();
|
|
||||||
app.HandleXuiActions();
|
|
||||||
|
|
||||||
Sleep(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Stopping server...\n");
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
app.m_bShutdown = true;
|
|
||||||
MinecraftServer::HaltServer();
|
|
||||||
g_NetworkManager.LeaveGame(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||||
_In_opt_ HINSTANCE hPrevInstance,
|
_In_opt_ HINSTANCE hPrevInstance,
|
||||||
_In_ LPTSTR lpCmdLine,
|
_In_ LPTSTR lpCmdLine,
|
||||||
@@ -1566,11 +1355,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
const Win64LaunchOptions launchOptions = ParseLaunchOptions();
|
const Win64LaunchOptions launchOptions = ParseLaunchOptions();
|
||||||
ApplyScreenMode(launchOptions.screenMode);
|
ApplyScreenMode(launchOptions.screenMode);
|
||||||
|
|
||||||
// Ensure uid.dat exists from startup in client mode (before any multiplayer/login path).
|
// Ensure uid.dat exists from startup (before any multiplayer/login path).
|
||||||
if (!launchOptions.serverMode)
|
Win64Xuid::ResolvePersistentXuid();
|
||||||
{
|
|
||||||
Win64Xuid::ResolvePersistentXuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no username, let's fall back
|
// If no username, let's fall back
|
||||||
if (g_Win64Username[0] == 0)
|
if (g_Win64Username[0] == 0)
|
||||||
@@ -1651,7 +1437,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
MyRegisterClass(hInstance);
|
MyRegisterClass(hInstance);
|
||||||
|
|
||||||
// Perform application initialization:
|
// Perform application initialization:
|
||||||
if (!InitInstance (hInstance, launchOptions.serverMode ? SW_HIDE : nCmdShow))
|
if (!InitInstance (hInstance, nCmdShow))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1670,13 +1456,6 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
ToggleFullscreen();
|
ToggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (launchOptions.serverMode)
|
|
||||||
{
|
|
||||||
const int serverResult = RunHeadlessServer();
|
|
||||||
CleanupDevice();
|
|
||||||
return serverResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Main message loop
|
// Main message loop
|
||||||
MSG msg = {0};
|
MSG msg = {0};
|
||||||
@@ -1986,7 +1765,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// F1 toggles the HUD
|
// F1 toggles the HUD
|
||||||
if (g_KBMInput.IsKeyPressed(VK_F1))
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_TOGGLE_HUD))
|
||||||
{
|
{
|
||||||
const int primaryPad = ProfileManager.GetPrimaryPad();
|
const int primaryPad = ProfileManager.GetPrimaryPad();
|
||||||
const unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD);
|
const unsigned char displayHud = app.GetGameSettings(primaryPad, eGameSetting_DisplayHUD);
|
||||||
@@ -1995,7 +1774,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// F3 toggles onscreen debug info
|
// F3 toggles onscreen debug info
|
||||||
if (g_KBMInput.IsKeyPressed(VK_F3))
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO))
|
||||||
{
|
{
|
||||||
if (const Minecraft* pMinecraft = Minecraft::GetInstance())
|
if (const Minecraft* pMinecraft = Minecraft::GetInstance())
|
||||||
{
|
{
|
||||||
@@ -2008,7 +1787,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
|
|
||||||
#ifdef _DEBUG_MENUS_ENABLED
|
#ifdef _DEBUG_MENUS_ENABLED
|
||||||
// F6 Open debug console
|
// F6 Open debug console
|
||||||
if (g_KBMInput.IsKeyPressed(VK_F6))
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_CONSOLE))
|
||||||
{
|
{
|
||||||
static bool s_debugConsole = false;
|
static bool s_debugConsole = false;
|
||||||
s_debugConsole = !s_debugConsole;
|
s_debugConsole = !s_debugConsole;
|
||||||
@@ -2016,14 +1795,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// F11 Toggle fullscreen
|
// toggle fullscreen
|
||||||
if (g_KBMInput.IsKeyPressed(VK_F11))
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_FULLSCREEN))
|
||||||
{
|
{
|
||||||
ToggleFullscreen();
|
ToggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TAB opens game info menu. - Vvis :3 - Updated by detectiveren
|
// TAB opens game info menu. - Vvis :3 - Updated by detectiveren
|
||||||
if (g_KBMInput.IsKeyPressed(VK_TAB) && !ui.GetMenuDisplayed(0))
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_HOST_SETTINGS) && !ui.GetMenuDisplayed(0))
|
||||||
{
|
{
|
||||||
if (Minecraft* pMinecraft = Minecraft::GetInstance())
|
if (Minecraft* pMinecraft = Minecraft::GetInstance())
|
||||||
{
|
{
|
||||||
@@ -2035,7 +1814,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open chat
|
// Open chat
|
||||||
if (g_KBMInput.IsKeyPressed('T') && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
|
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CHAT) && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
|
||||||
{
|
{
|
||||||
g_KBMInput.ClearCharBuffer();
|
g_KBMInput.ClearCharBuffer();
|
||||||
pMinecraft->setScreen(new ChatScreen());
|
pMinecraft->setScreen(new ChatScreen());
|
||||||
|
|||||||
Binary file not shown.
@@ -8811,4 +8811,7 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc
|
|||||||
<data name="IDS_TOOLTIPS_CURE">
|
<data name="IDS_TOOLTIPS_CURE">
|
||||||
<value>Cure</value>
|
<value>Cure</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="IDS_WINDOWS_EXIT">
|
||||||
|
<value>Exit Minecraft</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
// Auto-generated by StringTable builder — do not edit manually.
|
// Auto-generated by StringTable builder — do not edit manually.
|
||||||
// Source language: en-US
|
// Source language: en-US
|
||||||
// Total strings: 2286
|
// Total strings: 2287
|
||||||
|
|
||||||
#define IDS_NULL 0
|
#define IDS_NULL 0
|
||||||
#define IDS_OK 1
|
#define IDS_OK 1
|
||||||
@@ -2165,127 +2165,128 @@
|
|||||||
#define IDS_TUTORIAL_TASK_MINECART_PUSHING 2159
|
#define IDS_TUTORIAL_TASK_MINECART_PUSHING 2159
|
||||||
#define IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN 2160
|
#define IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN 2160
|
||||||
#define IDS_TOOLTIPS_CURE 2161
|
#define IDS_TOOLTIPS_CURE 2161
|
||||||
#define IDS_LANG_SYSTEM 2162
|
#define IDS_WINDOWS_EXIT 2162
|
||||||
#define IDS_LANG_ENGLISH 2163
|
#define IDS_LANG_SYSTEM 2163
|
||||||
#define IDS_LANG_GERMAN 2164
|
#define IDS_LANG_ENGLISH 2164
|
||||||
#define IDS_LANG_SPANISH 2165
|
#define IDS_LANG_GERMAN 2165
|
||||||
#define IDS_LANG_SPANISH_SPAIN 2166
|
#define IDS_LANG_SPANISH 2166
|
||||||
#define IDS_LANG_SPANISH_LATIN_AMERICA 2167
|
#define IDS_LANG_SPANISH_SPAIN 2167
|
||||||
#define IDS_LANG_FRENCH 2168
|
#define IDS_LANG_SPANISH_LATIN_AMERICA 2168
|
||||||
#define IDS_LANG_ITALIAN 2169
|
#define IDS_LANG_FRENCH 2169
|
||||||
#define IDS_LANG_PORTUGUESE 2170
|
#define IDS_LANG_ITALIAN 2170
|
||||||
#define IDS_LANG_PORTUGUESE_PORTUGAL 2171
|
#define IDS_LANG_PORTUGUESE 2171
|
||||||
#define IDS_LANG_PORTUGUESE_BRAZIL 2172
|
#define IDS_LANG_PORTUGUESE_PORTUGAL 2172
|
||||||
#define IDS_LANG_JAPANESE 2173
|
#define IDS_LANG_PORTUGUESE_BRAZIL 2173
|
||||||
#define IDS_LANG_KOREAN 2174
|
#define IDS_LANG_JAPANESE 2174
|
||||||
#define IDS_LANG_CHINESE_TRADITIONAL 2175
|
#define IDS_LANG_KOREAN 2175
|
||||||
#define IDS_LANG_CHINESE_SIMPLIFIED 2176
|
#define IDS_LANG_CHINESE_TRADITIONAL 2176
|
||||||
#define IDS_LANG_DANISH 2177
|
#define IDS_LANG_CHINESE_SIMPLIFIED 2177
|
||||||
#define IDS_LANG_FINISH 2178
|
#define IDS_LANG_DANISH 2178
|
||||||
#define IDS_LANG_DUTCH 2179
|
#define IDS_LANG_FINISH 2179
|
||||||
#define IDS_LANG_POLISH 2180
|
#define IDS_LANG_DUTCH 2180
|
||||||
#define IDS_LANG_RUSSIAN 2181
|
#define IDS_LANG_POLISH 2181
|
||||||
#define IDS_LANG_SWEDISH 2182
|
#define IDS_LANG_RUSSIAN 2182
|
||||||
#define IDS_LANG_NORWEGIAN 2183
|
#define IDS_LANG_SWEDISH 2183
|
||||||
#define IDS_LANG_GREEK 2184
|
#define IDS_LANG_NORWEGIAN 2184
|
||||||
#define IDS_LANG_TURKISH 2185
|
#define IDS_LANG_GREEK 2185
|
||||||
#define IDS_LEADERBOARD_KILLS_EASY 2186
|
#define IDS_LANG_TURKISH 2186
|
||||||
#define IDS_LEADERBOARD_KILLS_NORMAL 2187
|
#define IDS_LEADERBOARD_KILLS_EASY 2187
|
||||||
#define IDS_LEADERBOARD_KILLS_HARD 2188
|
#define IDS_LEADERBOARD_KILLS_NORMAL 2188
|
||||||
#define IDS_LEADERBOARD_MINING_BLOCKS_PEACEFUL 2189
|
#define IDS_LEADERBOARD_KILLS_HARD 2189
|
||||||
#define IDS_LEADERBOARD_MINING_BLOCKS_EASY 2190
|
#define IDS_LEADERBOARD_MINING_BLOCKS_PEACEFUL 2190
|
||||||
#define IDS_LEADERBOARD_MINING_BLOCKS_NORMAL 2191
|
#define IDS_LEADERBOARD_MINING_BLOCKS_EASY 2191
|
||||||
#define IDS_LEADERBOARD_MINING_BLOCKS_HARD 2192
|
#define IDS_LEADERBOARD_MINING_BLOCKS_NORMAL 2192
|
||||||
#define IDS_LEADERBOARD_FARMING_PEACEFUL 2193
|
#define IDS_LEADERBOARD_MINING_BLOCKS_HARD 2193
|
||||||
#define IDS_LEADERBOARD_FARMING_EASY 2194
|
#define IDS_LEADERBOARD_FARMING_PEACEFUL 2194
|
||||||
#define IDS_LEADERBOARD_FARMING_NORMAL 2195
|
#define IDS_LEADERBOARD_FARMING_EASY 2195
|
||||||
#define IDS_LEADERBOARD_FARMING_HARD 2196
|
#define IDS_LEADERBOARD_FARMING_NORMAL 2196
|
||||||
#define IDS_LEADERBOARD_TRAVELLING_PEACEFUL 2197
|
#define IDS_LEADERBOARD_FARMING_HARD 2197
|
||||||
#define IDS_LEADERBOARD_TRAVELLING_EASY 2198
|
#define IDS_LEADERBOARD_TRAVELLING_PEACEFUL 2198
|
||||||
#define IDS_LEADERBOARD_TRAVELLING_NORMAL 2199
|
#define IDS_LEADERBOARD_TRAVELLING_EASY 2199
|
||||||
#define IDS_LEADERBOARD_TRAVELLING_HARD 2200
|
#define IDS_LEADERBOARD_TRAVELLING_NORMAL 2200
|
||||||
#define IDS_TIPS_GAMETIP_0 2201
|
#define IDS_LEADERBOARD_TRAVELLING_HARD 2201
|
||||||
#define IDS_TIPS_GAMETIP_1 2202
|
#define IDS_TIPS_GAMETIP_0 2202
|
||||||
#define IDS_TIPS_GAMETIP_48 2203
|
#define IDS_TIPS_GAMETIP_1 2203
|
||||||
#define IDS_TIPS_GAMETIP_44 2204
|
#define IDS_TIPS_GAMETIP_48 2204
|
||||||
#define IDS_TIPS_GAMETIP_45 2205
|
#define IDS_TIPS_GAMETIP_44 2205
|
||||||
#define IDS_TIPS_TRIVIA_4 2206
|
#define IDS_TIPS_GAMETIP_45 2206
|
||||||
#define IDS_TIPS_TRIVIA_17 2207
|
#define IDS_TIPS_TRIVIA_4 2207
|
||||||
#define IDS_HOW_TO_PLAY_MULTIPLAYER 2208
|
#define IDS_TIPS_TRIVIA_17 2208
|
||||||
#define IDS_HOW_TO_PLAY_SOCIALMEDIA 2209
|
#define IDS_HOW_TO_PLAY_MULTIPLAYER 2209
|
||||||
#define IDS_HOW_TO_PLAY_CREATIVE 2210
|
#define IDS_HOW_TO_PLAY_SOCIALMEDIA 2210
|
||||||
#define IDS_TUTORIAL_TASK_FLY 2211
|
#define IDS_HOW_TO_PLAY_CREATIVE 2211
|
||||||
#define IDS_TOOLTIPS_SELECTDEVICE 2212
|
#define IDS_TUTORIAL_TASK_FLY 2212
|
||||||
#define IDS_TOOLTIPS_CHANGEDEVICE 2213
|
#define IDS_TOOLTIPS_SELECTDEVICE 2213
|
||||||
#define IDS_TOOLTIPS_VIEW_GAMERCARD 2214
|
#define IDS_TOOLTIPS_CHANGEDEVICE 2214
|
||||||
#define IDS_TOOLTIPS_VIEW_GAMERPROFILE 2215
|
#define IDS_TOOLTIPS_VIEW_GAMERCARD 2215
|
||||||
#define IDS_TOOLTIPS_INVITE_PARTY 2216
|
#define IDS_TOOLTIPS_VIEW_GAMERPROFILE 2216
|
||||||
#define IDS_CONFIRM_START_CREATIVE 2217
|
#define IDS_TOOLTIPS_INVITE_PARTY 2217
|
||||||
#define IDS_CONFIRM_START_SAVEDINCREATIVE 2218
|
#define IDS_CONFIRM_START_CREATIVE 2218
|
||||||
#define IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE 2219
|
#define IDS_CONFIRM_START_SAVEDINCREATIVE 2219
|
||||||
#define IDS_CONFIRM_START_HOST_PRIVILEGES 2220
|
#define IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE 2220
|
||||||
#define IDS_CONNECTION_LOST_LIVE 2221
|
#define IDS_CONFIRM_START_HOST_PRIVILEGES 2221
|
||||||
#define IDS_CONNECTION_LOST_LIVE_NO_EXIT 2222
|
#define IDS_CONNECTION_LOST_LIVE 2222
|
||||||
#define IDS_AWARD_AVATAR1 2223
|
#define IDS_CONNECTION_LOST_LIVE_NO_EXIT 2223
|
||||||
#define IDS_AWARD_AVATAR2 2224
|
#define IDS_AWARD_AVATAR1 2224
|
||||||
#define IDS_AWARD_AVATAR3 2225
|
#define IDS_AWARD_AVATAR2 2225
|
||||||
#define IDS_AWARD_THEME 2226
|
#define IDS_AWARD_AVATAR3 2226
|
||||||
#define IDS_UNLOCK_ACHIEVEMENT_TEXT 2227
|
#define IDS_AWARD_THEME 2227
|
||||||
#define IDS_UNLOCK_AVATAR_TEXT 2228
|
#define IDS_UNLOCK_ACHIEVEMENT_TEXT 2228
|
||||||
#define IDS_UNLOCK_GAMERPIC_TEXT 2229
|
#define IDS_UNLOCK_AVATAR_TEXT 2229
|
||||||
#define IDS_UNLOCK_THEME_TEXT 2230
|
#define IDS_UNLOCK_GAMERPIC_TEXT 2230
|
||||||
#define IDS_UNLOCK_ACCEPT_INVITE 2231
|
#define IDS_UNLOCK_THEME_TEXT 2231
|
||||||
#define IDS_UNLOCK_GUEST_TEXT 2232
|
#define IDS_UNLOCK_ACCEPT_INVITE 2232
|
||||||
#define IDS_LEADERBOARD_GAMERTAG 2233
|
#define IDS_UNLOCK_GUEST_TEXT 2233
|
||||||
#define IDS_GROUPNAME_POTIONS_480 2234
|
#define IDS_LEADERBOARD_GAMERTAG 2234
|
||||||
#define IDS_RETURNEDTOTITLESCREEN_TEXT 2235
|
#define IDS_GROUPNAME_POTIONS_480 2235
|
||||||
#define IDS_TRIALOVER_TEXT 2236
|
#define IDS_RETURNEDTOTITLESCREEN_TEXT 2236
|
||||||
#define IDS_FATAL_ERROR_TEXT 2237
|
#define IDS_TRIALOVER_TEXT 2237
|
||||||
#define IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT 2238
|
#define IDS_FATAL_ERROR_TEXT 2238
|
||||||
#define IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT 2239
|
#define IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT 2239
|
||||||
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL 2240
|
#define IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT 2240
|
||||||
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL 2241
|
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL 2241
|
||||||
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE 2242
|
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL 2242
|
||||||
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE 2243
|
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE 2243
|
||||||
#define IDS_SAVE_ICON_MESSAGE 2244
|
#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE 2244
|
||||||
#define IDS_GAMEOPTION_HOST_PRIVILEGES 2245
|
#define IDS_SAVE_ICON_MESSAGE 2245
|
||||||
#define IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS 2246
|
#define IDS_GAMEOPTION_HOST_PRIVILEGES 2246
|
||||||
#define IDS_ACHIEVEMENTS 2247
|
#define IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS 2247
|
||||||
#define IDS_LABEL_GAMERTAGS 2248
|
#define IDS_ACHIEVEMENTS 2248
|
||||||
#define IDS_IN_GAME_GAMERTAGS 2249
|
#define IDS_LABEL_GAMERTAGS 2249
|
||||||
#define IDS_SOCIAL_DEFAULT_DESCRIPTION 2250
|
#define IDS_IN_GAME_GAMERTAGS 2250
|
||||||
#define IDS_TITLE_UPDATE_NAME 2251
|
#define IDS_SOCIAL_DEFAULT_DESCRIPTION 2251
|
||||||
#define IDS_PLATFORM_NAME 2252
|
#define IDS_TITLE_UPDATE_NAME 2252
|
||||||
#define IDS_BACK_BUTTON 2253
|
#define IDS_PLATFORM_NAME 2253
|
||||||
#define IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS 2254
|
#define IDS_BACK_BUTTON 2254
|
||||||
#define IDS_KICK_PLAYER_DESCRIPTION 2255
|
#define IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS 2255
|
||||||
#define IDS_USING_TRIAL_TEXUREPACK_WARNING 2256
|
#define IDS_KICK_PLAYER_DESCRIPTION 2256
|
||||||
#define IDS_WORLD_SIZE_TITLE_SMALL 2257
|
#define IDS_USING_TRIAL_TEXUREPACK_WARNING 2257
|
||||||
#define IDS_WORLD_SIZE_TITLE_MEDIUM 2258
|
#define IDS_WORLD_SIZE_TITLE_SMALL 2258
|
||||||
#define IDS_WORLD_SIZE_TITLE_LARGE 2259
|
#define IDS_WORLD_SIZE_TITLE_MEDIUM 2259
|
||||||
#define IDS_WORLD_SIZE_TITLE_CLASSIC 2260
|
#define IDS_WORLD_SIZE_TITLE_LARGE 2260
|
||||||
#define IDS_WORLD_SIZE 2261
|
#define IDS_WORLD_SIZE_TITLE_CLASSIC 2261
|
||||||
#define IDS_GAMEOPTION_WORLD_SIZE 2262
|
#define IDS_WORLD_SIZE 2262
|
||||||
#define IDS_DISABLE_SAVING 2263
|
#define IDS_GAMEOPTION_WORLD_SIZE 2263
|
||||||
#define IDS_GAMEOPTION_DISABLE_SAVING 2264
|
#define IDS_DISABLE_SAVING 2264
|
||||||
#define IDS_RICHPRESENCE_GAMESTATE 2265
|
#define IDS_GAMEOPTION_DISABLE_SAVING 2265
|
||||||
#define IDS_RICHPRESENCE_IDLE 2266
|
#define IDS_RICHPRESENCE_GAMESTATE 2266
|
||||||
#define IDS_RICHPRESENCE_MENUS 2267
|
#define IDS_RICHPRESENCE_IDLE 2267
|
||||||
#define IDS_RICHPRESENCE_MULTIPLAYER 2268
|
#define IDS_RICHPRESENCE_MENUS 2268
|
||||||
#define IDS_RICHPRESENCE_MULTIPLAYEROFFLINE 2269
|
#define IDS_RICHPRESENCE_MULTIPLAYER 2269
|
||||||
#define IDS_RICHPRESENCE_MULTIPLAYER_1P 2270
|
#define IDS_RICHPRESENCE_MULTIPLAYEROFFLINE 2270
|
||||||
#define IDS_RICHPRESENCE_MULTIPLAYER_1POFFLINE 2271
|
#define IDS_RICHPRESENCE_MULTIPLAYER_1P 2271
|
||||||
#define IDS_RICHPRESENCESTATE_BLANK 2272
|
#define IDS_RICHPRESENCE_MULTIPLAYER_1POFFLINE 2272
|
||||||
#define IDS_RICHPRESENCESTATE_RIDING_PIG 2273
|
#define IDS_RICHPRESENCESTATE_BLANK 2273
|
||||||
#define IDS_RICHPRESENCESTATE_RIDING_MINECART 2274
|
#define IDS_RICHPRESENCESTATE_RIDING_PIG 2274
|
||||||
#define IDS_RICHPRESENCESTATE_BOATING 2275
|
#define IDS_RICHPRESENCESTATE_RIDING_MINECART 2275
|
||||||
#define IDS_RICHPRESENCESTATE_FISHING 2276
|
#define IDS_RICHPRESENCESTATE_BOATING 2276
|
||||||
#define IDS_RICHPRESENCESTATE_CRAFTING 2277
|
#define IDS_RICHPRESENCESTATE_FISHING 2277
|
||||||
#define IDS_RICHPRESENCESTATE_FORGING 2278
|
#define IDS_RICHPRESENCESTATE_CRAFTING 2278
|
||||||
#define IDS_RICHPRESENCESTATE_NETHER 2279
|
#define IDS_RICHPRESENCESTATE_FORGING 2279
|
||||||
#define IDS_RICHPRESENCESTATE_CD 2280
|
#define IDS_RICHPRESENCESTATE_NETHER 2280
|
||||||
#define IDS_RICHPRESENCESTATE_MAP 2281
|
#define IDS_RICHPRESENCESTATE_CD 2281
|
||||||
#define IDS_RICHPRESENCESTATE_ENCHANTING 2282
|
#define IDS_RICHPRESENCESTATE_MAP 2282
|
||||||
#define IDS_RICHPRESENCESTATE_BREWING 2283
|
#define IDS_RICHPRESENCESTATE_ENCHANTING 2283
|
||||||
#define IDS_RICHPRESENCESTATE_ANVIL 2284
|
#define IDS_RICHPRESENCESTATE_BREWING 2284
|
||||||
#define IDS_RICHPRESENCESTATE_TRADING 2285
|
#define IDS_RICHPRESENCESTATE_ANVIL 2285
|
||||||
|
#define IDS_RICHPRESENCESTATE_TRADING 2286
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void Bat::defineSynchedData()
|
|||||||
|
|
||||||
float Bat::getSoundVolume()
|
float Bat::getSoundVolume()
|
||||||
{
|
{
|
||||||
return 0.1f;
|
return 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Bat::getVoicePitch()
|
float Bat::getVoicePitch()
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void Cow::playStepSound(int xt, int yt, int zt, int t)
|
|||||||
|
|
||||||
float Cow::getSoundVolume()
|
float Cow::getSoundVolume()
|
||||||
{
|
{
|
||||||
return 0.4f;
|
return 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Cow::getDeathLoot()
|
int Cow::getDeathLoot()
|
||||||
|
|||||||
@@ -96,9 +96,20 @@ int Entity::getSmallId()
|
|||||||
puiUsedFlags++;
|
puiUsedFlags++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MINECRAFT_SERVER_BUILD
|
||||||
|
// in mc server dedi, a server with 8+ playerrs can cause this to go wack
|
||||||
|
int fallbackId = Entity::entityCounter++;
|
||||||
|
|
||||||
|
if (entityCounter == 0x7ffffff)
|
||||||
|
{
|
||||||
|
entityCounter = 2048;
|
||||||
|
}
|
||||||
|
return fallbackId;
|
||||||
|
#else
|
||||||
app.DebugPrintf("Out of small entity Ids... possible leak?\n");
|
app.DebugPrintf("Out of small entity Ids... possible leak?\n");
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entity::countFlagsForPIX()
|
void Entity::countFlagsForPIX()
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ void FireworksRecipe::ReleaseThreadStorage()
|
|||||||
void FireworksRecipe::setResultItem(shared_ptr<ItemInstance> item)
|
void FireworksRecipe::setResultItem(shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||||
|
if (tls == nullptr) tls = tlsDefault;
|
||||||
tls->resultItem = item;
|
tls->resultItem = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,6 +270,7 @@ bool FireworksRecipe::matches(shared_ptr<CraftingContainer> craftSlots, Level *l
|
|||||||
shared_ptr<ItemInstance> FireworksRecipe::assemble(shared_ptr<CraftingContainer> craftSlots)
|
shared_ptr<ItemInstance> FireworksRecipe::assemble(shared_ptr<CraftingContainer> craftSlots)
|
||||||
{
|
{
|
||||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||||
|
if (tls == nullptr) tls = tlsDefault;
|
||||||
return tls->resultItem->copy();
|
return tls->resultItem->copy();
|
||||||
//return resultItem->copy();
|
//return resultItem->copy();
|
||||||
}
|
}
|
||||||
@@ -281,6 +283,7 @@ int FireworksRecipe::size()
|
|||||||
const ItemInstance *FireworksRecipe::getResultItem()
|
const ItemInstance *FireworksRecipe::getResultItem()
|
||||||
{
|
{
|
||||||
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
ThreadStorage *tls = static_cast<ThreadStorage *>(TlsGetValue(tlsIdx));
|
||||||
|
if (tls == nullptr) tls = tlsDefault;
|
||||||
return tls->resultItem.get();
|
return tls->resultItem.get();
|
||||||
//return resultItem.get();
|
//return resultItem.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,12 @@ using namespace std;
|
|||||||
|
|
||||||
// 4J Stu - This value should be big enough that we don't get any crashes causes by memory overwrites,
|
// 4J Stu - This value should be big enough that we don't get any crashes causes by memory overwrites,
|
||||||
// however it does seem way too large for what is actually needed. Needs further investigation
|
// however it does seem way too large for what is actually needed. Needs further investigation
|
||||||
|
#ifdef MINECRAFT_SERVER_BUILD
|
||||||
|
// fixes a crash when 8+ players are present
|
||||||
|
#define LEVEL_CHUNKS_TO_UPDATE_MAX (32*32*8)
|
||||||
|
#else
|
||||||
#define LEVEL_CHUNKS_TO_UPDATE_MAX (19*19*8)
|
#define LEVEL_CHUNKS_TO_UPDATE_MAX (19*19*8)
|
||||||
|
#endif
|
||||||
|
|
||||||
class Vec3;
|
class Vec3;
|
||||||
class ChunkSource;
|
class ChunkSource;
|
||||||
|
|||||||
@@ -30,6 +30,65 @@ ensure_persist_file() {
|
|||||||
ln -sfn "${persist_path}" "${runtime_path}"
|
ln -sfn "${persist_path}" "${runtime_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait_for_xvfb_ready() {
|
||||||
|
local display="$1"
|
||||||
|
local xvfb_pid="$2"
|
||||||
|
local wait_seconds="${XVFB_WAIT_SECONDS:-10}"
|
||||||
|
local wait_ticks=$((wait_seconds * 10))
|
||||||
|
local display_number="${display#:}"
|
||||||
|
display_number="${display_number%%.*}"
|
||||||
|
|
||||||
|
if [ -z "${display_number}" ] || ! [[ "${display_number}" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "[error] Invalid DISPLAY format for Xvfb wait: ${display}" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local socket_path="/tmp/.X11-unix/X${display_number}"
|
||||||
|
local elapsed=0
|
||||||
|
|
||||||
|
while [ "${elapsed}" -lt "${wait_ticks}" ]; do
|
||||||
|
if ! kill -0 "${xvfb_pid}" 2>/dev/null; then
|
||||||
|
echo "[error] Xvfb exited before the display became ready." >&2
|
||||||
|
if [ -f /tmp/xvfb.log ]; then
|
||||||
|
echo "[error] ---- /tmp/xvfb.log ----" >&2
|
||||||
|
tail -n 200 /tmp/xvfb.log >&2 || true
|
||||||
|
echo "[error] ----------------------" >&2
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -S "${socket_path}" ]; then
|
||||||
|
# Keep a short extra delay so Wine does not race display handshake.
|
||||||
|
sleep 0.2
|
||||||
|
if kill -0 "${xvfb_pid}" 2>/dev/null && [ -S "${socket_path}" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# One more liveness check after the ready probe branch.
|
||||||
|
if ! kill -0 "${xvfb_pid}" 2>/dev/null; then
|
||||||
|
echo "[error] Xvfb exited during display readiness probe." >&2
|
||||||
|
if [ -f /tmp/xvfb.log ]; then
|
||||||
|
echo "[error] ---- /tmp/xvfb.log ----" >&2
|
||||||
|
tail -n 200 /tmp/xvfb.log >&2 || true
|
||||||
|
echo "[error] ----------------------" >&2
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 0.1
|
||||||
|
elapsed=$((elapsed + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[error] Timed out waiting for Xvfb display ${display}." >&2
|
||||||
|
if [ -f /tmp/xvfb.log ]; then
|
||||||
|
echo "[error] ---- /tmp/xvfb.log ----" >&2
|
||||||
|
tail -n 200 /tmp/xvfb.log >&2 || true
|
||||||
|
echo "[error] ----------------------" >&2
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
if [ ! -d "$SERVER_DIR" ]; then
|
if [ ! -d "$SERVER_DIR" ]; then
|
||||||
echo "[error] Server directory not found: $SERVER_DIR" >&2
|
echo "[error] Server directory not found: $SERVER_DIR" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -78,8 +137,25 @@ fi
|
|||||||
if [ -z "${DISPLAY:-}" ]; then
|
if [ -z "${DISPLAY:-}" ]; then
|
||||||
export DISPLAY="${XVFB_DISPLAY:-:99}"
|
export DISPLAY="${XVFB_DISPLAY:-:99}"
|
||||||
XVFB_SCREEN="${XVFB_SCREEN:-64x64x16}"
|
XVFB_SCREEN="${XVFB_SCREEN:-64x64x16}"
|
||||||
|
DISPLAY_NUMBER="${DISPLAY#:}"
|
||||||
|
DISPLAY_NUMBER="${DISPLAY_NUMBER%%.*}"
|
||||||
|
if [ -z "${DISPLAY_NUMBER}" ] || ! [[ "${DISPLAY_NUMBER}" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo "[error] Invalid XVFB_DISPLAY format: ${DISPLAY}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
XVFB_SOCKET="/tmp/.X11-unix/X${DISPLAY_NUMBER}"
|
||||||
|
XVFB_LOCK="/tmp/.X${DISPLAY_NUMBER}-lock"
|
||||||
|
# The check is performed assuming the same container will be restarted.
|
||||||
|
if [ -S "${XVFB_SOCKET}" ] || [ -e "${XVFB_LOCK}" ]; then
|
||||||
|
echo "[warn] Removing stale Xvfb state for ${DISPLAY} before startup." >&2
|
||||||
|
rm -f "${XVFB_SOCKET}" "${XVFB_LOCK}"
|
||||||
|
fi
|
||||||
Xvfb "${DISPLAY}" -nolisten tcp -screen 0 "${XVFB_SCREEN}" >/tmp/xvfb.log 2>&1 &
|
Xvfb "${DISPLAY}" -nolisten tcp -screen 0 "${XVFB_SCREEN}" >/tmp/xvfb.log 2>&1 &
|
||||||
sleep 0.2
|
XVFB_PID=$!
|
||||||
|
wait_for_xvfb_ready "${DISPLAY}" "${XVFB_PID}"
|
||||||
|
echo "[info] Xvfb ready on ${DISPLAY} (pid=${XVFB_PID}, screen=${XVFB_SCREEN})"
|
||||||
|
else
|
||||||
|
echo "[info] Using existing DISPLAY=${DISPLAY}; skipping Xvfb startup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args=(
|
args=(
|
||||||
|
|||||||
Reference in New Issue
Block a user