From 9626065598bb6f6e89919be28ccb1aece6bd5a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=C3=ABl?= <60509176+Bakoubak@users.noreply.github.com> Date: Sun, 29 Nov 2026 13:33:39 +0100 Subject: [PATCH] linux (compat): Add linux to most Win64 guards --- Minecraft.Client/ArchiveFile.cpp | 6 +- Minecraft.Client/BannerRenderer.cpp | 4 +- Minecraft.Client/BarrierParticle.cpp | 8 +- Minecraft.Client/ClientConnection.cpp | 10 +- .../Common/Audio/Consoles_SoundEngine.h | 2 +- Minecraft.Client/Common/Audio/SoundEngine.cpp | 2 +- Minecraft.Client/Common/Audio/SoundEngine.h | 4 +- Minecraft.Client/Common/Console_Utils.cpp | 4 +- Minecraft.Client/Common/Consoles_App.cpp | 58 +++---- Minecraft.Client/Common/Consoles_App.h | 4 +- Minecraft.Client/Common/DLC/DLCAudioFile.cpp | 16 +- Minecraft.Client/Common/DLC/DLCManager.cpp | 16 +- .../Common/GameRules/GameRuleManager.cpp | 2 +- .../GameRules/LevelGenerationOptions.cpp | 2 +- .../Common/Network/GameNetworkManager.cpp | 14 +- .../Common/Network/GameNetworkManager.h | 8 +- .../Network/PlatformNetworkManagerStub.cpp | 8 +- .../Network/PlatformNetworkManagerStub.h | 8 +- Minecraft.Client/Common/Network/SessionInfo.h | 6 +- .../Common/Tutorial/ChoiceTask.cpp | 8 +- .../Common/Tutorial/ControllerTask.cpp | 8 +- Minecraft.Client/Common/Tutorial/InfoTask.cpp | 2 +- .../UI/IUIScene_AbstractContainerMenu.cpp | 10 +- .../Common/UI/IUIScene_PauseMenu.cpp | 8 +- Minecraft.Client/Common/UI/UI.h | 2 +- Minecraft.Client/Common/UI/UIBitmapFont.cpp | 2 +- .../Common/UI/UIComponent_Chat.cpp | 2 +- .../UI/UIComponent_DebugUIMarketingGuide.cpp | 2 +- .../Common/UI/UIComponent_Tooltips.cpp | 12 +- .../Common/UI/UIComponent_Tooltips.h | 2 +- .../Common/UI/UIControl_ButtonList.cpp | 2 +- .../Common/UI/UIControl_ButtonList.h | 2 +- .../Common/UI/UIControl_Label.cpp | 2 +- Minecraft.Client/Common/UI/UIControl_Label.h | 2 +- .../Common/UI/UIControl_PlayerSkinPreview.cpp | 6 +- .../Common/UI/UIControl_Slider.cpp | 2 +- .../Common/UI/UIControl_TextInput.cpp | 6 +- .../Common/UI/UIControl_TextInput.h | 4 +- Minecraft.Client/Common/UI/UIController.cpp | 32 ++-- Minecraft.Client/Common/UI/UIController.h | 6 +- Minecraft.Client/Common/UI/UIEnums.h | 2 +- Minecraft.Client/Common/UI/UILayer.cpp | 2 +- Minecraft.Client/Common/UI/UIScene.cpp | 18 +-- Minecraft.Client/Common/UI/UIScene.h | 6 +- .../UI/UIScene_AbstractContainerMenu.cpp | 24 +-- .../Common/UI/UIScene_AnvilMenu.cpp | 8 +- .../Common/UI/UIScene_AnvilMenu.h | 2 +- .../Common/UI/UIScene_BindingsTypeMenu.cpp | 2 +- .../Common/UI/UIScene_BookAndQuillMenu.cpp | 8 +- .../Common/UI/UIScene_CraftingMenu.cpp | 10 +- .../Common/UI/UIScene_CraftingMenu.h | 10 +- .../Common/UI/UIScene_CreateWorldMenu.cpp | 20 +-- .../Common/UI/UIScene_CreateWorldMenu.h | 2 +- Minecraft.Client/Common/UI/UIScene_Credits.h | 6 +- .../Common/UI/UIScene_DLCMainMenu.cpp | 9 +- .../Common/UI/UIScene_DLCOffersMenu.cpp | 2 +- .../UI/UIScene_DebugCreateSchematic.cpp | 10 +- .../Common/UI/UIScene_DebugCreateSchematic.h | 2 +- .../Common/UI/UIScene_DebugSetCamera.cpp | 10 +- .../Common/UI/UIScene_DebugSetCamera.h | 8 +- .../Common/UI/UIScene_EditServerMenu.cpp | 14 +- .../Common/UI/UIScene_EditServerMenu.h | 2 +- .../Common/UI/UIScene_FriendMenu.cpp | 4 +- .../Common/UI/UIScene_HelpAndOptionsMenu.cpp | 6 +- .../Common/UI/UIScene_InGameFriendsMenu.cpp | 8 +- .../UI/UIScene_InGameSaveManagementMenu.cpp | 2 +- Minecraft.Client/Common/UI/UIScene_Intro.cpp | 34 ++-- .../Common/UI/UIScene_JoinMenu.cpp | 22 +-- Minecraft.Client/Common/UI/UIScene_JoinMenu.h | 2 +- .../Common/UI/UIScene_KeybindsMenu.cpp | 2 +- .../Common/UI/UIScene_Keyboard.cpp | 20 +-- Minecraft.Client/Common/UI/UIScene_Keyboard.h | 6 +- .../Common/UI/UIScene_LanguageSelector.h | 44 +++--- .../UI/UIScene_LaunchMoreOptionsMenu.cpp | 22 +-- .../Common/UI/UIScene_LaunchMoreOptionsMenu.h | 10 +- .../Common/UI/UIScene_LeaderboardsMenu.cpp | 4 +- .../Common/UI/UIScene_LoadCreateJoinMenu.cpp | 88 +++++------ .../Common/UI/UIScene_LoadCreateJoinMenu.h | 16 +- .../Common/UI/UIScene_LoadMenu.cpp | 104 ++++++------- .../Common/UI/UIScene_LoadOrJoinMenu.cpp | 66 ++++---- .../Common/UI/UIScene_LoadOrJoinMenu.h | 20 +-- .../Common/UI/UIScene_MainMenu.cpp | 146 +++++++++--------- .../Common/UI/UIScene_PauseMenu.cpp | 6 +- .../Common/UI/UIScene_ReinstallMenu.cpp | 2 +- .../UI/UIScene_SettingsGraphicsMenu.cpp | 6 +- .../Common/UI/UIScene_SignEntryMenu.cpp | 22 +-- .../Common/UI/UIScene_SignEntryMenu.h | 4 +- .../Common/UI/UIScene_SkinSelectMenu.cpp | 8 +- .../Common/UI/UIScene_SocialMenu.cpp | 28 ++-- .../Common/UI/UIScene_SocialMenu.h | 4 +- .../UI/UIScene_SuperflatEditLayerMenu.cpp | 10 +- .../UI/UIScene_SuperflatEditLayerMenu.h | 2 +- .../Common/UI/UIScene_SuperflatMenu.cpp | 2 +- .../Common/UI/UIScene_SuperflatMenu.h | 2 +- .../UI/UIScene_SuperflatPresetsMenu.cpp | 6 +- Minecraft.Client/Common/UI/UIStructs.h | 4 +- .../Common/UI/UIUnicodeBitmapFont.cpp | 2 +- Minecraft.Client/DLCTexturePack.cpp | 2 +- Minecraft.Client/EndermanRenderer.cpp | 4 +- Minecraft.Client/EntityRenderDispatcher.cpp | 4 +- Minecraft.Client/EntityTracker.cpp | 4 +- Minecraft.Client/ExperienceOrbRenderer.cpp | 4 +- Minecraft.Client/Extrax64Stubs.cpp | 10 +- Minecraft.Client/GameRenderer.cpp | 20 +-- Minecraft.Client/GameRenderer.h | 2 +- Minecraft.Client/Gui.cpp | 8 +- Minecraft.Client/Input.cpp | 12 +- Minecraft.Client/ItemInHandRenderer.cpp | 6 +- Minecraft.Client/LevelRenderer.h | 2 +- Minecraft.Client/LivingEntityRenderer.cpp | 2 +- Minecraft.Client/LocalPlayer.cpp | 2 +- Minecraft.Client/Minecraft.cpp | 34 ++-- Minecraft.Client/Minecraft.h | 2 +- Minecraft.Client/MinecraftServer.cpp | 36 ++--- Minecraft.Client/MinecraftServer.h | 4 +- Minecraft.Client/PaintingRenderer.cpp | 14 +- Minecraft.Client/ParticleEngine.cpp | 6 +- Minecraft.Client/PendingConnection.cpp | 38 ++--- Minecraft.Client/PlayerChunkMap.cpp | 18 +-- Minecraft.Client/PlayerConnection.cpp | 60 +++---- Minecraft.Client/PlayerList.cpp | 18 +-- Minecraft.Client/PlayerRenderer.cpp | 6 +- Minecraft.Client/Screen.cpp | 10 +- Minecraft.Client/ServerConnection.cpp | 16 +- Minecraft.Client/ServerLevel.cpp | 35 ++--- Minecraft.Client/ServerPlayer.cpp | 46 +++--- Minecraft.Client/ServerPlayerGameMode.cpp | 8 +- Minecraft.Client/TeleportCommand.cpp | 8 +- Minecraft.Client/TileRenderer.cpp | 6 +- Minecraft.Client/TrackedEntity.cpp | 6 +- Minecraft.Client/VillagerGolemRenderer.cpp | 10 +- .../Windows64/ControllerBinds.cpp | 2 +- Minecraft.Client/Windows64/ControllerBinds.h | 2 +- .../Windows64/KeyboardMouseInput.cpp | 2 +- .../Windows64/KeyboardMouseInput.h | 2 +- .../Network/NetworkPlayerWindows.cpp | 2 +- .../Windows64/Network/NetworkPlayerWindows.h | 2 +- .../Network/PlatformNetworkManagerWindows.cpp | 2 +- .../Network/PlatformNetworkManagerWindows.h | 2 +- .../Windows64/Network/WindowsNetworkConfig.h | 2 +- .../Windows64/Windows64_Minecraft.cpp | 2 +- Minecraft.Client/Windows64/Windows64_Xuid.h | 2 +- Minecraft.Client/stdafx.h | 4 +- Minecraft.Client/stubs.cpp | 2 +- Minecraft.Client/stubs.h | 6 +- Minecraft.Server/Security/RateLimiter.h | 2 +- Minecraft.World/AbstractContainerMenu.cpp | 12 +- Minecraft.World/BiomeOverrideLayer.cpp | 2 +- Minecraft.World/CactusTile.cpp | 4 +- Minecraft.World/ChorusFruitItem.cpp | 4 +- Minecraft.World/Class.h | 2 +- Minecraft.World/CocoaTile.cpp | 4 +- Minecraft.World/ConsoleSaveFileConverter.cpp | 2 +- Minecraft.World/ConsoleSaveFileOriginal.cpp | 14 +- Minecraft.World/ConsoleSaveFileOriginal.h | 4 +- Minecraft.World/CropTile.cpp | 4 +- Minecraft.World/CustomLevelSource.cpp | 4 +- Minecraft.World/DirectoryLevelStorage.cpp | 4 +- Minecraft.World/DyePowderItem.cpp | 6 +- Minecraft.World/EggTile.cpp | 4 +- Minecraft.World/File.cpp | 2 +- Minecraft.World/FileHeader.h | 2 +- Minecraft.World/FireTile.cpp | 6 +- Minecraft.World/GrassTile.cpp | 4 +- Minecraft.World/ItemEntity.cpp | 8 +- Minecraft.World/Level.cpp | 4 +- Minecraft.World/LiquidTileDynamic.cpp | 4 +- Minecraft.World/LivingEntity.cpp | 10 +- Minecraft.World/Mushroom.cpp | 6 +- Minecraft.World/NetherWartTile.cpp | 4 +- Minecraft.World/PistonBaseTile.cpp | 6 +- Minecraft.World/Player.cpp | 2 +- Minecraft.World/ReedTile.cpp | 4 +- Minecraft.World/Sapling.cpp | 4 +- Minecraft.World/StemTile.cpp | 4 +- Minecraft.World/ThreadName.cpp | 2 +- Minecraft.World/ThrownEnderpearl.cpp | 4 +- Minecraft.World/stdafx.h | 4 +- Minecraft.World/system.cpp | 2 +- include/lce_filesystem/lce_filesystem.cpp | 10 +- 180 files changed, 941 insertions(+), 935 deletions(-) diff --git a/Minecraft.Client/ArchiveFile.cpp b/Minecraft.Client/ArchiveFile.cpp index 9914cecd..40ba67d9 100644 --- a/Minecraft.Client/ArchiveFile.cpp +++ b/Minecraft.Client/ArchiveFile.cpp @@ -57,7 +57,7 @@ ArchiveFile::ArchiveFile(File file, bool allowFolder) FileInputStream fis(file); -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 +#if defined _XBOX_ONE || defined __ORBIS__ || (defined(_WINDOWS64) || defined(__linux__)) byteArray readArray(static_cast(file.length())); fis.read(readArray,0,file.length()); @@ -73,7 +73,7 @@ ArchiveFile::ArchiveFile(File file, bool allowFolder) dis.close(); fis.close(); -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 +#if defined _XBOX_ONE || defined __ORBIS__ || (defined(_WINDOWS64) || defined(__linux__)) bais.reset(); #endif app.DebugPrintf("Finished loading archive file\n"); @@ -139,7 +139,7 @@ byteArray ArchiveFile::getFile(const wstring &filename) { PMetaData data = it->second; -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 +#if defined _XBOX_ONE || defined __ORBIS__ || (defined(_WINDOWS64) || defined(__linux__)) out = byteArray(data->filesize ); memcpy( out.data, m_cachedData + data->ptr, data->filesize ); diff --git a/Minecraft.Client/BannerRenderer.cpp b/Minecraft.Client/BannerRenderer.cpp index 89003fe5..d077cf54 100644 --- a/Minecraft.Client/BannerRenderer.cpp +++ b/Minecraft.Client/BannerRenderer.cpp @@ -18,7 +18,7 @@ #include "Lighting.h" #include #include -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -319,7 +319,7 @@ void BannerRenderer::render(shared_ptr _banner, double x, double y, glScalef(f, -f, -f); int lightCol = banner->level->getLightColor(banner->x, banner->y, banner->z, 0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) lightCol = DynamicLighting::getLightmapWithDynamicLight(banner->x, banner->y, banner->z, lightCol); #endif float lightU = (float)(lightCol & 0xFFFF); diff --git a/Minecraft.Client/BarrierParticle.cpp b/Minecraft.Client/BarrierParticle.cpp index 93b6e7ef..e296c3a0 100644 --- a/Minecraft.Client/BarrierParticle.cpp +++ b/Minecraft.Client/BarrierParticle.cpp @@ -8,7 +8,7 @@ #include "../Minecraft.World/Facing.h" #include "../Minecraft.World/Level.h" #include "../Minecraft.World/JavaMath.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -53,7 +53,7 @@ void BarrierParticle::render(Tesselator* t, float a, float xa, float ya, float z float u1 = tex->getU1(); float v0 = tex->getV0(); float v1 = tex->getV1(); - + float half = size; float px = static_cast(xo + (this->x - xo) * a - xOff); @@ -63,7 +63,7 @@ void BarrierParticle::render(Tesselator* t, float a, float xa, float ya, float z float br = SharedConstants::TEXTURE_LIGHTING ? 1.0f : getBrightness(a); t->color(br * rCol, br * gCol, br * bCol, alpha); int lightColor = getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) lightColor = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(xo + (x - xo) * a), Mth::floor(yo + (y - yo) * a), Mth::floor(zo + (z - zo) * a), lightColor); #endif t->tex2(lightColor); @@ -83,4 +83,4 @@ void BarrierParticle::tick() remove(); xd = yd = zd = 0; -} \ No newline at end of file +} diff --git a/Minecraft.Client/ClientConnection.cpp b/Minecraft.Client/ClientConnection.cpp index 6106fb52..b0f7eb94 100644 --- a/Minecraft.Client/ClientConnection.cpp +++ b/Minecraft.Client/ClientConnection.cpp @@ -56,7 +56,7 @@ #endif #include "DLCTexturePack.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Network/PlatformNetworkManagerWindows.h" #include "Windows64/Network/WindowsNetworkConfig.h" #include "Windows64/Windows64_Xuid.h" @@ -908,7 +908,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) return; } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Win64 keeps local-player identity separate from network smallId; also guard against creating // a duplicate remote player for a local slot by checking the username directly. for (unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) @@ -960,7 +960,7 @@ void ClientConnection::handleAddPlayer(shared_ptr packet) player->m_displayName = player->getName(); #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { IQNetPlayer* matchedQNetPlayer = nullptr; PlayerUID pktXuid = player->getXuid(); @@ -1191,7 +1191,7 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr p void ClientConnection::handleRemoveEntity(shared_ptr packet) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On fork servers, IQNet cleanup is handled by the MC|ForkPLeave custom // payload so players stay in Tab regardless of render distance. On // upstream servers (no MC|ForkHello received), fall back to the old @@ -3926,7 +3926,7 @@ void ClientConnection::handleSoundEvent(shared_ptr packet) void ClientConnection::handleCustomPayload(shared_ptr customPayloadPacket) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Build a server-specific identity token file path next to the executable. // Each server gets its own token file based on a hash of the server address, // so connecting to multiple secured servers doesn't overwrite tokens. diff --git a/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h b/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h index a8de1083..3f239c0c 100644 --- a/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h +++ b/Minecraft.Client/Common/Audio/Consoles_SoundEngine.h @@ -14,7 +14,7 @@ // 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles #define _SEKRIT #include "../../Durango/Miles/include/mss.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #elif defined(__linux__) #else // PS4 // 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index 3fdd169a..265cb121 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -85,7 +85,7 @@ void SoundEngine::stopStreamingNow() m_bCurrentStreamIsMenuMusic = false; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) char SoundEngine::m_szSoundPath[]={"Windows64Media\\Sound\\"}; char SoundEngine::m_szMusicPath[]={"music\\"}; char SoundEngine::m_szRedistName[]={"redist64"}; diff --git a/Minecraft.Client/Common/Audio/SoundEngine.h b/Minecraft.Client/Common/Audio/SoundEngine.h index a9aae6ff..276c480e 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.h +++ b/Minecraft.Client/Common/Audio/SoundEngine.h @@ -94,7 +94,7 @@ enum eMusicStreamState typedef struct { - #ifndef _WINDOWS64 + #if !defined(_WINDOWS64) && !defined(__linux__) F32 x,y,z,volume,pitch; #else float x,y,z,volume,pitch; @@ -108,7 +108,7 @@ typedef struct } AUDIO_INFO; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) struct MiniAudioSound { ma_sound sound; diff --git a/Minecraft.Client/Common/Console_Utils.cpp b/Minecraft.Client/Common/Console_Utils.cpp index 3b7e5741..bfb52304 100644 --- a/Minecraft.Client/Common/Console_Utils.cpp +++ b/Minecraft.Client/Common/Console_Utils.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../../Minecraft.Server/ServerLogManager.h" #endif @@ -13,7 +13,7 @@ static VOID DebugSpewV( const CHAR* strFormat, va_list pArgList ) #if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ assert(0); #else -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Dedicated server routes legacy debug spew through ServerLogger to preserve CLI prompt handling. if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs()) { diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 6002f716..8ad29037 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -28,10 +28,10 @@ #include "../Xbox/Social/SocialManager.h" #include "Tutorial/TutorialMode.h" #include "UI/UICustomStrings.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../Windows64/Network/WindowsNetworkConfig.h" #endif -#if defined _XBOX || defined _WINDOWS64 +#if defined _XBOX || defined _WINDOWS64 || defined(__linux__) #include "../Xbox/XML/ATGXmlParser.h" #include "../Xbox/XML/xmlFilesCallback.h" #endif @@ -42,7 +42,7 @@ #include "GameRules/ConsoleSchematicFile.h" #include "../User.h" #include "../../Minecraft.World/LevelData.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../../Minecraft.Server/ServerLogManager.h" #endif #include "../../Minecraft.World/net.minecraft.world.entity.player.h" @@ -282,7 +282,7 @@ void CMinecraftApp::DebugPrintf(const char *szFormat, ...) #ifndef _FINAL_BUILD va_list ap; va_start(ap, szFormat); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Dedicated server routes client debug spew through ServerLogger so CLI output stays prompt-safe. if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs()) { @@ -306,7 +306,7 @@ void CMinecraftApp::DebugPrintf(int user, const char *szFormat, ...) return; va_list ap; va_start(ap, szFormat); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Dedicated server routes client debug spew through ServerLogger so CLI output stays prompt-safe. if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs()) { @@ -369,7 +369,7 @@ void CMinecraftApp::DebugPrintIggyf(int user, const char* szFormat, ...) return; va_list ap; va_start(ap, szFormat); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Dedicated server routes client debug spew through ServerLogger so CLI output stays prompt-safe. if (ServerRuntime::ServerLogManager::ShouldForwardClientDebugLogs()) { @@ -429,7 +429,7 @@ namespace { const wchar_t *ResolveStringKeyFromId(int iID) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) switch(iID) { #include "StringIdLookup.generated.inc" @@ -523,7 +523,7 @@ void CMinecraftApp::SetAction(int iPad, eXuiAction action, LPVOID param) bool CMinecraftApp::IsAppPaused() { -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) bool paused = m_bIsAppPaused; EnterCriticalSection(&m_saveNotificationCriticalSection); if( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 ) @@ -962,7 +962,7 @@ bool CMinecraftApp::LoadWritingBookMenu(int iPad, shared_ptr insta // GAME SETTINGS ////////////////////////////////////////////// -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static void Win64_GetSettingsPath(char *outPath, DWORD size, int iPad) { GetModuleFileNameA(nullptr, outPath, size); @@ -1026,7 +1026,7 @@ void CMinecraftApp::InitGameSettings() //SetDefaultGameSettings(i); - done on a callback from the profile manager // 4J-PB - adding in for Windows & PS3 to set the defaults for the joypad -#if defined _WINDOWS64// || defined __PSVITA__ +#if defined _WINDOWS64 || defined(__linux__) // || defined __PSVITA__ C_4JProfile::PROFILESETTINGS *pProfileSettings=ProfileManager.GetDashboardProfileSettings(i); // clear this for now - it will come from reading the system values memset(pProfileSettings,0,sizeof(C_4JProfile::PROFILESETTINGS)); @@ -1701,7 +1701,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_Gamma: if(iPad==ProfileManager.GetPrimaryPad()) { -#if defined(_WIN64) || defined(_WINDOWS64) +#if defined(_WIN64) || defined(_WINDOWS64) || defined(__linux__) pMinecraft->options->set(Options::Option::GAMMA, static_cast(GameSettingsA[iPad]->ucGamma) / 100.0f); #else // ucGamma range is 0-100, UpdateGamma is 0 - 32768 @@ -1931,7 +1931,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) //nothing to do here break; case eGameSetting_VSync: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { extern bool g_bVSync; g_bVSync = (GetGameSettings(iPad, eGameSetting_VSync) != 0); @@ -1939,7 +1939,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) #endif break; case eGameSetting_ExclusiveFullscreen: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { extern void SetExclusiveFullscreen(bool enabled); SetExclusiveFullscreen(GetGameSettings(iPad, eGameSetting_ExclusiveFullscreen) != 0); @@ -2059,13 +2059,13 @@ wstring CMinecraftApp::GetPlayerCapeName(int iPad) return Player::getCapePathFromId(GameSettingsA[iPad]->dwSelectedCape); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DWORD Win64_GetOnlineCapeOverride(int iPad); #endif DWORD CMinecraftApp::GetPlayerCapeId(int iPad) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DWORD onlineCape = Win64_GetOnlineCapeOverride(iPad); if (onlineCape != 0) return onlineCape; @@ -3134,7 +3134,7 @@ void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, int iPa StorageManager.WriteToProfile(i,true, bOverride5MinuteTimer); #else ProfileManager.WriteToProfile(i,true, bOverride5MinuteTimer); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_SaveSettings(GameSettingsA[i], i); #endif #endif @@ -3150,7 +3150,7 @@ void CMinecraftApp::CheckGameSettingsChanged(bool bOverride5MinuteTimer, int iPa StorageManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); #else ProfileManager.WriteToProfile(iPad,true, bOverride5MinuteTimer); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_SaveSettings(GameSettingsA[iPad], iPad); #endif #endif @@ -3835,7 +3835,7 @@ void CMinecraftApp::HandleXuiActions(void) SetAction(i,eAppAction_Idle); // HUCKLE - added for quit game on disconnect -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(g_Win64MultiplayerQuitOnDisconnect == true) { app.ExitGame(); @@ -5162,7 +5162,7 @@ void CMinecraftApp::loadStringTable() // we need to unload the current string table, this is a reload delete m_stringTable; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_stringTable = nullptr; const wstring localisationCandidates[] = { @@ -6200,7 +6200,7 @@ void CMinecraftApp::MountNextDLC(int iPad) } // 4J-JEV: For the sake of clarity in DLCMountedCallback. -#if defined(_XBOX) || defined(__PS3__) || defined(_WINDOWS64) +#if defined(_XBOX) || defined(__PS3__) || defined(_WINDOWS64) || defined(__linux__) #define CONTENT_DATA_DISPLAY_NAME(a) (a.szDisplayName) #else #define CONTENT_DATA_DISPLAY_NAME(a) (a.wszDisplayName) @@ -6208,7 +6208,7 @@ void CMinecraftApp::MountNextDLC(int iPad) int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask) { -#if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) //Chris TODO +#if defined(_XBOX) || defined(_DURANGO) || defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) || defined (__PSVITA__) //Chris TODO app.DebugPrintf("--- CMinecraftApp::DLCMountedCallback\n"); if(dwErr!=ERROR_SUCCESS) @@ -6235,7 +6235,7 @@ int CMinecraftApp::DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD d { app.DebugPrintf("Pack \"%ls\" is not installed, so adding it\n", CONTENT_DATA_DISPLAY_NAME(ContentData)); -#if defined(_XBOX) || defined(__PS3__) || defined(_WINDOWS64) +#if defined(_XBOX) || defined(__PS3__) || defined(_WINDOWS64) || defined(__linux__) pack = new DLCPack(ContentData.szDisplayName,dwLicenceMask); #elif defined _XBOX_ONE pack = new DLCPack(ContentData.wszDisplayName,ContentData.wszProductID,dwLicenceMask); @@ -6303,7 +6303,7 @@ void CMinecraftApp::HandleDLC(DLCPack *pack) { DWORD dwFilesProcessed = 0; #ifndef _XBOX -#if defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined (__PSVITA__) +#if defined(__PS3__) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) || defined (__PSVITA__) std::vector dlcFilenames; #elif defined _DURANGO std::vector dlcFilenames; @@ -6625,7 +6625,7 @@ int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) return -1; } -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) int CMinecraftApp::GetTPConfigVal(WCHAR *pwchDataFile) { return -1; @@ -7842,7 +7842,7 @@ HRESULT CMinecraftApp::RegisterConfigValues(WCHAR *pType, int iValue) return hr; } -#if (defined _XBOX || defined _WINDOWS64) +#if (defined _XBOX || (defined(_WINDOWS64) || defined(__linux__))) HRESULT CMinecraftApp::RegisterDLCData(WCHAR *pType, WCHAR *pBannerName, int iGender, uint64_t ullOfferID_Full, uint64_t ullOfferID_Trial, WCHAR *pFirstSkin, unsigned int uiSortIndex, int iConfig, WCHAR *pDataFile) { HRESULT hr=S_OK; @@ -9854,7 +9854,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto EnterCriticalSection(&pClass->csTMSPPDownloadQueue); for( TMSPPRequest *pCurrent : pClass->m_TMSPPDownloadQueue ) { -#if defined(_XBOX) || defined(_WINDOWS64) +#if defined(_XBOX) || defined(_WINDOWS64) || defined(__linux__) char szFile[MAX_TMSFILENAME_SIZE]; wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE); @@ -10601,7 +10601,7 @@ bool CMinecraftApp::IsLocalMultiplayerAvailable() if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool available = connectedControllers > 1; #else bool available = RenderManager.IsHiDef() && connectedControllers > 1; @@ -10827,7 +10827,7 @@ void CMinecraftApp::getLocale(vector &vecWstrLocales) locales.push_back(eMCLang_zhCN); break; -#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64 +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__)) case XC_LANGUAGE_DANISH: locales.push_back(eMCLang_daDA); locales.push_back(eMCLang_daDK); @@ -11141,7 +11141,7 @@ enum ETitleUpdateTexturePacks //eTUTP_Steampunk = 0x01000808, // 4J Stu - The released Steampunk pack had a sub-pack ID }; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) wstring titleUpdateTexturePackRoot = L"Windows64\\DLC\\"; #elif defined(__ORBIS__) wstring titleUpdateTexturePackRoot = L"/app0/orbis/CU/DLC/"; diff --git a/Minecraft.Client/Common/Consoles_App.h b/Minecraft.Client/Common/Consoles_App.h index e76a0478..57d10cef 100644 --- a/Minecraft.Client/Common/Consoles_App.h +++ b/Minecraft.Client/Common/Consoles_App.h @@ -959,7 +959,9 @@ public: #elif defined _DURANGO -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) + //CMinecraftAudio audio; +#elif defined __linux__ //CMinecraftAudio audio; #else // PS4 diff --git a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp index f8f7e4ce..4bad44fe 100644 --- a/Minecraft.Client/Common/DLC/DLCAudioFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCAudioFile.cpp @@ -1,13 +1,13 @@ #include "stdafx.h" #include "DLCManager.h" #include "DLCAudioFile.h" -#if defined _XBOX || defined _WINDOWS64 +#if defined _XBOX || defined _WINDOWS64 || defined(__linux__) #include "../../Xbox/XML/ATGXmlParser.h" #include "../../Xbox/XML/xmlFilesCallback.h" #endif DLCAudioFile::DLCAudioFile(const wstring &path) : DLCFile(DLCManager::e_DLCType_Audio,path) -{ +{ m_pbData = nullptr; m_dwBytes = 0; } @@ -148,11 +148,11 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) app.DebugPrintf("DLC version of %d is too old to be read\n", uiVersion); return false; } - + unsigned int uiParameterTypeCount=DLCManager::readUInt32(&pbData[uiCurrentByte], bSwapEndian); uiCurrentByte+=sizeof(int); C4JStorage::DLC_FILE_PARAM *pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; - + for(unsigned int i=0;idwType = bSwapEndian ? DLCManager::SwapInt32(pParams->dwType) : pParams->dwType; @@ -198,11 +198,11 @@ bool DLCAudioFile::processDLCDataFile(PBYTE pbData, DWORD dwLength) EAudioType type = static_cast(pFile->dwType); //Bounds Checking - if (type < 0 || type >= e_AudioType_Max) + if (type < 0 || type >= e_AudioType_Max) { app.DebugPrintf("Error parser: EAudioType (%d) out of bounds!\n", type); - - continue; + + continue; } // Params unsigned int uiParameterCount=DLCManager::readUInt32(pbTemp, bSwapEndian); @@ -255,4 +255,4 @@ wstring &DLCAudioFile::GetSoundName(int iIndex) iWorldType++; } return m_parameters[iWorldType].at(iIndex); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Common/DLC/DLCManager.cpp b/Minecraft.Client/Common/DLC/DLCManager.cpp index 8231391a..e95ba560 100644 --- a/Minecraft.Client/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Common/DLC/DLCManager.cpp @@ -103,7 +103,7 @@ const WCHAR *DLCManager::wchTypeNamesA[]= L"XMLVERSION", L"DISPLAYNAME", L"THEMENAME", - L"FREE", + L"FREE", L"CREDIT", L"CAPEPATH", L"BOX", @@ -367,7 +367,7 @@ DLCSkinFile *DLCManager::getSkinFile(const wstring &path) DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) { - DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; + DWORD corruptDLCCount = m_dwUnnamedCorruptDLCCount; DLCPack *firstCorruptPack = nullptr; for( DLCPack *pack : m_packs ) @@ -420,7 +420,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL else if (fromArchive) return false; wstring finalPathW = wPath; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; finalPathW = convStringToWstring(finalPath); @@ -436,7 +436,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL if(hasPckFolderFallback(finalPathW, folderPath)) { wstring resolvedFolderPath = folderPath; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) const char *folderPathA = wstringtofilename(folderPath); string mountedFolderPath = StorageManager.GetMountedPath(folderPathA); if(mountedFolderPath.size() > 0) @@ -457,7 +457,7 @@ bool DLCManager::readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DL } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #elif defined(_DURANGO) HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); @@ -864,7 +864,7 @@ DWORD DLCManager::retrievePackIDFromDLCDataFile(const string &path, DLCPack *pac DWORD packId = 0; wstring wPath = convStringToWstring(path); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; HANDLE file = CreateFile(finalPath.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); @@ -978,7 +978,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) if(type==e_DLCType_PackConfig) { if(it->second==e_DLCParamType_PackId) - { + { wstring wsTemp=static_cast(pParams->wchData); std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually @@ -1003,4 +1003,4 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) parameterMapping.clear(); return packId; -} \ No newline at end of file +} diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index e1e09ad5..1c61366e 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -661,7 +661,7 @@ void GameRuleManager::loadDefaultGameRules() #else // _XBOX -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck"); if(!packedTutorialFile.exists()) packedTutorialFile = File(L"Windows64\\Tutorial\\Tutorial.pck"); #elif defined(__ORBIS__) diff --git a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp index e6d21735..568d3bff 100644 --- a/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp +++ b/Minecraft.Client/Common/GameRules/LevelGenerationOptions.cpp @@ -455,7 +455,7 @@ unordered_map *LevelGenerationOptions::getUnfin void LevelGenerationOptions::loadBaseSaveData() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int gameRulesCount = m_parentDLCPack ? m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader) : 0; diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.cpp b/Minecraft.Client/Common/Network/GameNetworkManager.cpp index b5af2db0..1d0eb5cd 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.cpp +++ b/Minecraft.Client/Common/Network/GameNetworkManager.cpp @@ -41,7 +41,7 @@ #include "../Minecraft.World/DurangoStats.h" #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/Network/PlatformNetworkManagerWindows.h" #include "../../Windows64/Network/NetworkPlayerWindows.h" #include "../../Windows64/Windows64_Xuid.h" @@ -84,7 +84,9 @@ void CGameNetworkManager::Initialise() s_pPlatformNetworkManager = new CPlatformNetworkManagerSony(); #elif defined _DURANGO s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango(); -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) + s_pPlatformNetworkManager = new CPlatformNetworkManagerWindows(); +#elif defined __linux__ s_pPlatformNetworkManager = new CPlatformNetworkManagerWindows(); #else s_pPlatformNetworkManager = new CPlatformNetworkManagerStub(); @@ -249,7 +251,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame wstring fileRoot = L"GAME:\\res\\TitleUpdate\\GameRules\\" + param->levelGen->getBaseSavePath(); #endif #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) wstring fileRoot = L"Windows64Media\\Tutorial\\" + param->levelGen->getBaseSavePath(); File root(fileRoot); if(!root.exists()) fileRoot = L"Windows64\\Tutorial\\" + param->levelGen->getBaseSavePath(); @@ -433,7 +435,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame { shared_ptr preLogin = std::make_shared(minecraft->user->name); -#if defined(_WINDOWS64) && !defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && !defined(MINECRAFT_SERVER_BUILD) std::string joinHost; int joinPort = 0; extern bool Win64_GetJoinAddress(std::string& host, int& port); @@ -828,7 +830,7 @@ void CGameNetworkManager::CancelJoinGame(LPVOID lpParam) #ifdef _XBOX_ONE s_pPlatformNetworkManager->CancelJoinGame(); #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #endif } @@ -1590,7 +1592,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc } else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Non-host split-screen: open a dedicated TCP connection for this pad if (localPlayer && !g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay()) { diff --git a/Minecraft.Client/Common/Network/GameNetworkManager.h b/Minecraft.Client/Common/Network/GameNetworkManager.h index 9b6aa290..b05cf2ba 100644 --- a/Minecraft.Client/Common/Network/GameNetworkManager.h +++ b/Minecraft.Client/Common/Network/GameNetworkManager.h @@ -10,7 +10,9 @@ using namespace std; #include "../../Common/Network/Sony/PlatformNetworkManagerSony.h" #elif defined _DURANGO #include "../../Durango/Network/PlatformNetworkManagerDurango.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) +#include "../../Windows64/Network/PlatformNetworkManagerWindows.h" +#elif defined __linux__ #include "../../Windows64/Network/PlatformNetworkManagerWindows.h" #else #include "PlatformNetworkManagerStub.h" @@ -38,8 +40,10 @@ class CGameNetworkManager friend class CPlatformNetworkManagerSony; #elif defined _DURANGO friend class CPlatformNetworkManagerDurango; -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) friend class CPlatformNetworkManagerWindows; +#elif defined __linux__ + friend class CPlatformNetworkManagerWindows; #else friend class CPlatformNetworkManagerStub; #endif diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp index 628d7efa..48361738 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.cpp @@ -74,7 +74,7 @@ bool CPlatformNetworkManagerStub::Initialise(CGameNetworkManager *pGameNetworkMa m_bSearchPending = false; m_bIsOfflineGame = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_bJoinPending = false; m_joinLocalUsersMask = 0; m_joinHostName[0] = 0; @@ -285,7 +285,7 @@ void CPlatformNetworkManagerStub::HandleSignInChange() bool CPlatformNetworkManagerStub::_RunNetworkGame() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) extern QNET_STATE _iQNetStubState; _iQNetStubState = QNET_STATE_GAME_PLAY; @@ -507,7 +507,7 @@ wstring CPlatformNetworkManagerStub::GatherRTTStats() void CPlatformNetworkManagerStub::TickSearch() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_SessionsUpdatedCallback == nullptr) return; @@ -571,7 +571,7 @@ void CPlatformNetworkManagerStub::ForceFriendsSessionRefresh() m_pSearchResults[i] = nullptr; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Immediately rebuild the session list from servers.db so that // edits/deletions are visible as soon as the UI regains focus, // rather than waiting for the next TickSearch() cycle. diff --git a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h index 200f28ab..d0d937be 100644 --- a/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h +++ b/Minecraft.Client/Common/Network/PlatformNetworkManagerStub.h @@ -55,7 +55,7 @@ public: virtual void HandleSignInChange(); virtual bool _RunNetworkGame(); - + private: bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer); virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom); @@ -77,7 +77,7 @@ private: bool m_bIsPrivateGame; int m_flagIndexSize; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool m_bJoinPending; int m_joinLocalUsersMask; wchar_t m_joinHostName[32]; @@ -125,7 +125,7 @@ public: wstring GatherStats(); wstring GatherRTTStats(); -private: +private: vector friendsSessions[XUSER_MAX_COUNT]; int m_searchResultsCount[XUSER_MAX_COUNT]; int m_lastSearchStartTime[XUSER_MAX_COUNT]; @@ -138,7 +138,7 @@ private: XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT]; XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT]; int m_currentSearchResultsCount[XUSER_MAX_COUNT]; - + int m_lastSearchPad; bool m_bSearchResultsReady; bool m_bSearchPending; diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index 8f202501..3816fbe5 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -117,7 +117,7 @@ public: std::wstring description; bool hasServerInfo; std::vector serverPlayerNames; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int savedServerIndex; bool isFriendGame; #endif @@ -130,7 +130,7 @@ public: hasPartyMember = false; isDedicatedSession = false; hasServerInfo = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) savedServerIndex = -1; isFriendGame = false; #endif @@ -153,7 +153,7 @@ public: isDedicatedSession = other.isDedicatedSession; hasServerInfo = other.hasServerInfo; serverPlayerNames = other.serverPlayerNames; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) savedServerIndex = other.savedServerIndex; isFriendGame = other.isFriendGame; #endif diff --git a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp index 8e0b4bfa..4f15b21b 100644 --- a/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ChoiceTask.cpp @@ -49,13 +49,13 @@ bool ChoiceTask::isCompleted() sendTelemetry(); enableConstraints(false, true); return true; - } - + } + if(!menuDisplayed) { // If the player is under water then allow all keypresses so they can jump out if (hasValidPad && pMinecraft->localplayers[tutorialPad] != nullptr && pMinecraft->localplayers[tutorialPad]->isUnderLiquid(Material::water)) return false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bConfirmMappingComplete && (InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0 || g_KBMInput.IsKeyDown(VK_RETURN))) @@ -67,7 +67,7 @@ bool ChoiceTask::isCompleted() m_bConfirmMappingComplete = true; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bCancelMappingComplete && (InputManager.GetValue(xboxPad, m_iCancelMapping) > 0 || g_KBMInput.IsKeyDown('B'))) diff --git a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp index 733fea01..37d80e4d 100644 --- a/Minecraft.Client/Common/Tutorial/ControllerTask.cpp +++ b/Minecraft.Client/Common/Tutorial/ControllerTask.cpp @@ -46,7 +46,7 @@ bool ControllerTask::isCompleted() return true; bool bAllComplete = true; - + Minecraft *pMinecraft = Minecraft::GetInstance(); int iCurrent=0; @@ -66,7 +66,7 @@ bool ControllerTask::isCompleted() } else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bAllComplete = true; #else bAllComplete = false; @@ -91,7 +91,7 @@ bool ControllerTask::isCompleted() } else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bAllComplete = true; #else bAllComplete = false; @@ -128,4 +128,4 @@ void ControllerTask::setAsCurrentTask(bool active /*= true*/) { TutorialTask::setAsCurrentTask(active); enableConstraints(!active); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Common/Tutorial/InfoTask.cpp b/Minecraft.Client/Common/Tutorial/InfoTask.cpp index c2279e9b..3f6838fc 100644 --- a/Minecraft.Client/Common/Tutorial/InfoTask.cpp +++ b/Minecraft.Client/Common/Tutorial/InfoTask.cpp @@ -69,7 +69,7 @@ bool InfoTask::isCompleted() bool current = it.second; if(!current) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0 || g_KBMInput.IsKeyDown(VK_SPACE)) #else if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), it.first) > 0) diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index 93ca3aca..a0828203 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -21,7 +21,7 @@ #include #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -550,7 +550,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0 && !g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { int deltaX = g_KBMInput.GetMouseDeltaX(); @@ -787,7 +787,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() // If there is no stick input, and we are over a slot, then snap pointer to slot centre. // 4J - TomK - only if this particular component allows so! -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if((g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) && CanHaveFocus(eSectionUnderPointer)) #else if(CanHaveFocus(eSectionUnderPointer)) @@ -1522,7 +1522,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b } break; case ACTION_MENU_UP: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.WasMouseWheelConsumed()) { handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_UP); @@ -1535,7 +1535,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b } break; case ACTION_MENU_DOWN: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.WasMouseWheelConsumed()) { handleAdditionalKeyPress(ACTION_MENU_OTHER_STICK_DOWN); diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index f33097c9..7a85dfe2 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -404,7 +404,7 @@ int IUIScene_PauseMenu::SaveWorldThreadProc( LPVOID lpParameter ) Sleep(10); } -#if !defined(MINECRAFT_SERVER_BUILD) && (defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__)) +#if !defined(MINECRAFT_SERVER_BUILD) && ((defined(_WINDOWS64) || defined(__linux__)) || defined(_DURANGO) || defined(__ORBIS__)) while (ConsoleSaveFileOriginal::hasPendingBackgroundSave()) { ConsoleSaveFileOriginal::flushPendingBackgroundSave(); @@ -447,7 +447,7 @@ int IUIScene_PauseMenu::ExitWorldThreadProc( void* lpParameter ) return S_OK; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) { wchar_t wSearch[MAX_PATH]; @@ -479,7 +479,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) Minecraft *pMinecraft=Minecraft::GetInstance(); // 4J Added: Capture hardcore delete info before the server is destroyed -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool shouldDeleteHardcoreWorld = false; wstring hardcoreSaveFolderName; if (MinecraftServer::getInstance() != nullptr && MinecraftServer::getInstance()->getDeleteWorldOnExit()) @@ -725,7 +725,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter) Sleep(1); } // 4J Added: Hardcore mode — delete world save data now that the server is fully stopped -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (shouldDeleteHardcoreWorld && !hardcoreSaveFolderName.empty()) { wchar_t wFolderPath[MAX_PATH] = {}; diff --git a/Minecraft.Client/Common/UI/UI.h b/Minecraft.Client/Common/UI/UI.h index 945a9e0a..8e9f1ff5 100644 --- a/Minecraft.Client/Common/UI/UI.h +++ b/Minecraft.Client/Common/UI/UI.h @@ -89,7 +89,7 @@ #include "UIScene_SkinSelectMenu.h" #include "UIScene_HowToPlayMenu.h" #include "UIScene_LanguageSelector.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "UIScene_KeybindsMenu.h" #include "UIScene_BindingsTypeMenu.h" #include "UIScene_SuperflatMenu.h" diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index 52b97b9d..544b9df1 100644 --- a/Minecraft.Client/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIBitmapFont.cpp @@ -319,7 +319,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte bitmap->oversample = 0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On Windows64 the window can be any size, producing fractional // pixel_scale values that don't align to integer multiples of // truePixelScale. The original console code cached glyphs with a diff --git a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp index 552767cb..0a64fce8 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Chat.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Chat.cpp @@ -56,7 +56,7 @@ void UIComponent_Chat::handleTimerComplete(int id) float opacity = pGui->getOpacity(m_iPad, i); if( opacity > 0 ) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Chat drawn by Gui::render with color codes. Hides Iggy chat to avoid double chats. m_controlLabelBackground[i].setOpacity(0); m_labelChatText[i].setOpacity(0); diff --git a/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp b/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp index 3aab5b98..06adb8e4 100644 --- a/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_DebugUIMarketingGuide.cpp @@ -21,7 +21,7 @@ UIComponent_DebugUIMarketingGuide::UIComponent_DebugUIMarketingGuide(int iPad, v value[0].number = (F64)4; #elif defined __PSVITA__ value[0].number = (F64)5; -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) value[0].number = static_cast(0); #endif IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlatform , 1 , value ); diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp index 2f190ad5..1368efcb 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIComponent_Tooltips.h" #include "UISplitScreenHelpers.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -148,7 +148,7 @@ void UIComponent_Tooltips::updateSafeZone() safeBottom = getSafeZoneHalfHeight(); safeLeft = getSafeZoneHalfWidth(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // shift 720p-only 'tooltips' so that they match the HD layouts { const F64 screenW = ui.getScreenWidth(); @@ -181,7 +181,7 @@ void UIComponent_Tooltips::tick() { UIScene::tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(!m_bSplitscreen && !ui.IsReloadingSkin()) { const F64 screenW = ui.getScreenWidth(); @@ -398,7 +398,7 @@ void UIComponent_Tooltips::SetTooltipKeyIcons( const int keyVk[eToolTipNumButton for(unsigned int i = 0; i < eToolTipNumButtons; ++i) { int vk = keyVk[i]; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(vk == 0 && i == eToolTipButtonRS) { int pad = (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT) ? m_iPad : ProfileManager.GetPrimaryPad(); @@ -430,7 +430,7 @@ void UIComponent_Tooltips::_ApplyKeyIcon(unsigned int iToolTip) { wstring textureName; double widthScale = 1.0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(m_keyIconVk[iToolTip] < 0) { const wchar_t *folder = m_keyIconVk[iToolTip] == -3 ? L"PS3" : (m_keyIconVk[iToolTip] == -4 ? L"PS4" : L"xboxOne"); @@ -539,7 +539,7 @@ void UIComponent_Tooltips::_Relayout() IggyDataValue result; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateLayout, 0 , nullptr ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) doHorizontalResizeCheck(); #endif diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.h b/Minecraft.Client/Common/UI/UIComponent_Tooltips.h index 366761f1..21c03f47 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.h +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.h @@ -7,7 +7,7 @@ class UIComponent_Tooltips : public UIScene private: bool m_bSplitscreen; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) F64 m_lastResizeAwareScreenW; F64 m_lastResizeAwareScreenH; bool m_lastResizeAwareNudgeActive; diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp index 4f0e5ca0..297618c9 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp @@ -159,7 +159,7 @@ void UIControl_ButtonList::setButtonLabel(int iButtonId, const wstring &label) IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetButtonLabel, 2 , value ); } -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) void UIControl_ButtonList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) { IggyDataValue result; diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.h b/Minecraft.Client/Common/UI/UIControl_ButtonList.h index 666b1f0a..e5cd5138 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.h +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.h @@ -37,7 +37,7 @@ public: void setButtonLabel(int iButtonId, const wstring &label); -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) void SetTouchFocus(S32 iX, S32 iY, bool bRepeat); bool CanTouchTrigger(S32 iX, S32 iY); #endif diff --git a/Minecraft.Client/Common/UI/UIControl_Label.cpp b/Minecraft.Client/Common/UI/UIControl_Label.cpp index 419248bd..a2a9ef5d 100644 --- a/Minecraft.Client/Common/UI/UIControl_Label.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Label.cpp @@ -76,7 +76,7 @@ void UIControl_Label::ReInit() init(m_label, m_id); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIControl_Label::beginDirectEdit(int charLimit, bool bSigning, wstring author) { diff --git a/Minecraft.Client/Common/UI/UIControl_Label.h b/Minecraft.Client/Common/UI/UIControl_Label.h index 0f8844b0..70a3d472 100644 --- a/Minecraft.Client/Common/UI/UIControl_Label.h +++ b/Minecraft.Client/Common/UI/UIControl_Label.h @@ -10,7 +10,7 @@ private: public: UIControl_Label(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool m_bDirectEditing = false; wstring m_textBeforeEdit; IggyName m_funcSetCaretIndex; diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index 631ee84b..c1e03d31 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -14,7 +14,7 @@ //#define SKIN_PREVIEW_BOB_ANIM #define SKIN_PREVIEW_WALKING_ANIM -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Frame-rate-independent animation scaling. // The skin preview animations were designed for ~60fps (VSync on). // With uncapped FPS, each frame's contribution must be scaled down. @@ -341,7 +341,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou break; case e_SkinPreviewAnimation_Attacking: model->holdingRightHand = true; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_swingTime += GetSkinAnimDeltaScale(); #else m_swingTime++; @@ -398,7 +398,7 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou #ifdef SKIN_PREVIEW_WALKING_ANIM m_walkAnimSpeedO = m_walkAnimSpeed; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { float animScale = GetSkinAnimDeltaScale(); m_walkAnimSpeed += (0.1f - m_walkAnimSpeed) * 0.4f * animScale; diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp index 46b88a0f..eb3966e9 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -69,7 +69,7 @@ void UIControl_Slider::init(UIString label, int id, int min, int max, int curren bool IsUsingKeyboardMouse() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) return true; diff --git a/Minecraft.Client/Common/UI/UIControl_TextInput.cpp b/Minecraft.Client/Common/UI/UIControl_TextInput.cpp index f53b9722..7c9dd7d5 100644 --- a/Minecraft.Client/Common/UI/UIControl_TextInput.cpp +++ b/Minecraft.Client/Common/UI/UIControl_TextInput.cpp @@ -8,7 +8,7 @@ UIControl_TextInput::UIControl_TextInput() m_bHasFocus = false; m_bHasCaret = false; m_bCaretChecked = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_bDirectEditing = false; m_iCursorPos = 0; m_iCharLimit = 0; @@ -52,7 +52,7 @@ void UIControl_TextInput::init(UIString label, int id) #ifdef __PSVITA__ // 4J-TomK - add this buttonlist to the vita touch box list - + switch(m_parentScene->GetParentLayer()->m_iLayer) { case eUILayer_Fullscreen: @@ -139,7 +139,7 @@ void UIControl_TextInput::setCaretIndex(int index) IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetCaretIndex , 1 , value ); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIControl_TextInput::beginDirectEdit(int charLimit) { diff --git a/Minecraft.Client/Common/UI/UIControl_TextInput.h b/Minecraft.Client/Common/UI/UIControl_TextInput.h index fffaa5be..3c631f4f 100644 --- a/Minecraft.Client/Common/UI/UIControl_TextInput.h +++ b/Minecraft.Client/Common/UI/UIControl_TextInput.h @@ -11,7 +11,7 @@ private: bool m_bHasCaret; bool m_bCaretChecked; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool m_bDirectEditing; wstring m_textBeforeEdit; wstring m_editBuffer; @@ -37,7 +37,7 @@ public: void setCaretVisible(bool visible); void setCaretIndex(int index); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) enum EDirectEditResult { eDirectEdit_Continue, diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 600a7827..bd2dc0d9 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -13,7 +13,7 @@ #include "../../DLCTexturePack.h" #include "../../TexturePackRepository.h" #include "../../Minecraft.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../PostProcesser.h" #endif #include "../../../Minecraft.World/net.minecraft.world.entity.boss.enderdragon.h" @@ -22,7 +22,7 @@ #include "UIFontData.h" #include "UIUnicodeBitmapFont.h" #include "UISplitScreenHelpers.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif #ifdef __PSVITA__ @@ -68,7 +68,7 @@ DWORD UIController::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; // GetViewportRect and Fit16x9 are now in UISplitScreenHelpers.h -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static UIControl_Slider *FindSliderById(UIScene *pScene, int sliderId) { vector *controls = pScene->GetControls(); @@ -192,7 +192,7 @@ static void RADLINK DeallocateFunction ( void * alloc_callback_user_data , void LeaveCriticalSection(&controller->m_Allocatorlock); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static wstring GetControlTypeSkinPath(int controlType, bool hd) { const wchar_t *skinName = L"windows"; // default to windows if control type is unknown @@ -249,7 +249,7 @@ UIController::UIController() m_moj11 = nullptr; m_unicodeBitmapFont = nullptr; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_savedPlatformSkinHD = IGGY_INVALID_LIBRARY; m_savedPlatformSkin = IGGY_INVALID_LIBRARY; m_panoramaPlatformSkinHD = IGGY_INVALID_LIBRARY; @@ -265,7 +265,7 @@ UIController::UIController() #endif // 4J Stu - This is a bit of a hack until we change the Minecraft initialisation to store the proper screen size for other platforms -#if defined _WINDOWS64 || defined _DURANGO || defined __ORBIS__ +#if (defined(_WINDOWS64) || defined(__linux__)) || defined _DURANGO || defined __ORBIS__ m_fScreenWidth = 1920.0f; m_fScreenHeight = 1080.0f; m_bScreenWidthSetup = false; @@ -649,7 +649,7 @@ void UIController::loadSkins() m_iggyLibraries[eLibrary_Tooltips] = loadSkin(L"skinTooltips.swf", L"skinTooltips.swf"); m_iggyLibraries[eLibrary_Default] = loadSkin(L"skin.swf", L"skin.swf"); -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) // emulate control type skins const int controlType = app.GetGameSettings(ProfileManager.GetPrimaryPad(), eGameSetting_ControlType); wstring platformSkinHD = GetControlTypeSkinPath(controlType, true); @@ -809,7 +809,7 @@ void UIController::ReloadSkin() m_iggyLibraries[i] = IGGY_INVALID_LIBRARY; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_savedPlatformSkinHD = IGGY_INVALID_LIBRARY; m_savedPlatformSkin = IGGY_INVALID_LIBRARY; m_panoramaPlatformSkinHD = IGGY_INVALID_LIBRARY; @@ -817,7 +817,7 @@ void UIController::ReloadSkin() m_platformSkinOverrideDepth = 0; #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // 4J Stu - Don't load on a thread on windows. I haven't investigated this in detail, so a quick fix reloadSkinThreadProc(this); #else @@ -848,7 +848,7 @@ void UIController::StartReloadSkinThread() if(m_reloadSkinThread) m_reloadSkinThread->Run(); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIController::PushDefaultPlatformSkinForPanorama() { if(m_platformSkinOverrideDepth++ > 0) @@ -1009,7 +1009,7 @@ void UIController::tickInput() else #endif { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_mouseClickConsumedByScene = false; if (!g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT) && !g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT)) m_mouseClickBlocked = false; @@ -1765,7 +1765,7 @@ void UIController::handleKeyPress(unsigned int iPad, unsigned int key) pressed = InputManager.ButtonPressed(iPad,key); // Toggle released = InputManager.ButtonReleased(iPad,key); // Toggle -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0) { int vk = 0; @@ -2041,7 +2041,7 @@ void UIController::renderScenes() } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) PostProcesser::GetInstance().RunStage(PostProcessStage::AfterIggy); #endif } @@ -2108,7 +2108,7 @@ void UIController::setupCustomDrawGameState() m_customRenderingClearRect.top = LONG_MAX; m_customRenderingClearRect.bottom = LONG_MIN; -#if defined _WINDOWS64 || _DURANGO +#if (defined(_WINDOWS64) || defined(__linux__)) || _DURANGO PIXBeginNamedEvent(0,"StartFrame"); RenderManager.StartFrame(); PIXEndNamedEvent(); @@ -2273,7 +2273,7 @@ GDrawTexture * RADLINK UIController::TextureSubstitutionCreateCallback ( void * *height = 64; #endif - #if defined _WINDOWS64 + #if defined(_WINDOWS64) || defined(__linux__) // Only set the size to 96x96 for 1080p on Windows UIScene *scene = uiController->GetTopScene(0); //Fix for icon size changing on Achievements @@ -3520,7 +3520,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT if (message == -1) { -#if defined(_XBOX_ONE) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || (defined(_WINDOWS64) || defined(__linux__)) // IDS_CONTENT_RESTRICTION doesn't exist on XB1 message = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE; #else diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h index 9c20d8d9..a380765b 100644 --- a/Minecraft.Client/Common/UI/UIController.h +++ b/Minecraft.Client/Common/UI/UIController.h @@ -108,7 +108,7 @@ private: eLibrary_LCGraphics, eLibrary_LCLabels, -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) // Non-HD skin libraries needed by 720p/480p scene SWFs. eLibraryFallback_Platform, eLibraryFallback_GraphicsDefault, @@ -190,7 +190,7 @@ private: int m_accumulatedTicks; uint64_t m_lastUiSfx; // Tracks time (ms) of last UI sound effect -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) IggyLibrary m_savedPlatformSkinHD; IggyLibrary m_savedPlatformSkin; IggyLibrary m_panoramaPlatformSkinHD; @@ -264,7 +264,7 @@ public: virtual bool IsExpectingOrReloadingSkin(); virtual void CleanUpSkinReload(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void PushDefaultPlatformSkinForPanorama(); void PopDefaultPlatformSkinForPanorama(); #endif diff --git a/Minecraft.Client/Common/UI/UIEnums.h b/Minecraft.Client/Common/UI/UIEnums.h index e5d983ce..3b6afbd4 100644 --- a/Minecraft.Client/Common/UI/UIEnums.h +++ b/Minecraft.Client/Common/UI/UIEnums.h @@ -130,7 +130,7 @@ enum EUIScene eUIScene_EULA, eUIScene_InGameSaveManagementMenu, eUIScene_LanguageSelector, -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) eUIScene_KeybindsMenu, eUIScene_BindingsTypeMenu, eUIScene_SuperflatMenu, diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index 01c86950..710c1172 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -308,7 +308,7 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) case eUIScene_HowToPlayMenu: newScene = new UIScene_HowToPlayMenu(iPad, initData, this); break; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) case eUIScene_BindingsTypeMenu: newScene = new UIScene_BindingsTypeMenu(iPad, initData, this); break; diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index 4c91a181..c9067808 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -14,7 +14,7 @@ bool UIScene::SceneShouldUse1080p(const std::wstring &moviePath) { -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) int primaryPad = ProfileManager.GetPrimaryPad(); if(primaryPad < 0 || primaryPad >= XUSER_MAX_COUNT) primaryPad = 0; @@ -330,7 +330,7 @@ void UIScene::initialiseMovie() m_bUpdateOpacity = true; } -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) void UIScene::SetFocusToElement(int iID) { IggyDataValue result; @@ -366,7 +366,7 @@ void UIScene::loadMovie() EnterCriticalSection(&UIController::ms_reloadSkinCS); // MGH - added to prevent crash loading Iggy movies while the skins were being reloaded wstring moviePath = getMoviePath(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) const bool isPanoramaMovie = (moviePath == L"Panorama" || moviePath == L"PanoramaSplit"); if(isPanoramaMovie) { @@ -389,7 +389,7 @@ void UIScene::loadMovie() #elif defined __PSVITA__ moviePath.append(L"Vita.swf"); m_loadedResolution = eSceneResolution_Vita; -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) int primaryPad = ProfileManager.GetPrimaryPad(); if(primaryPad < 0 || primaryPad >= XUSER_MAX_COUNT) primaryPad = 0; @@ -484,7 +484,7 @@ void UIScene::loadMovie() // display size here differs from what render() passes to SetDisplaySize, // Iggy can cache glyph rasterizations at one scale during init and then // reuse them at a different scale during draw, producing mixed glyph sizes. -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { S32 fitW, fitH, fitOffX, fitOffY; Fit16x9(ui.getScreenWidth(), ui.getScreenHeight(), fitW, fitH, fitOffX, fitOffY); @@ -497,7 +497,7 @@ void UIScene::loadMovie() IggyPlayerInitializeAndTickRS ( swf ); int64_t afterTick = ui.iggyAllocCount; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Flush Iggy's internal font caches so all glyphs get rasterized fresh // at the current display scale on the first Draw. Without this, stale // cache entries from a previous scene (loaded at a different display size) @@ -610,7 +610,7 @@ void UIScene::tick() m_hasTickedOnce = true; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { vector inputs; getDirectEditInputs(inputs); @@ -640,7 +640,7 @@ UIControl* UIScene::GetMainPanel() return nullptr; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool UIScene::isDirectEditBlocking() { vector inputs; @@ -1209,7 +1209,7 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released return; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // If a navigation key is pressed with no focused element, focus the first // available one so arrow keys work even when the mouse is over empty space. if(pressed && (iggyKeyCode == IGGY_KEYCODE_UP || iggyKeyCode == IGGY_KEYCODE_DOWN || diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index 0de6c218..675a2e71 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -120,7 +120,7 @@ public: #ifdef __PSVITA__ EUIGroup GetParentLayerGroup() {return m_parentLayer->m_parentGroup->GetGroup();} #endif -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) UILayer *GetParentLayer() {return m_parentLayer;} vector *GetControls() {return &m_controls;} #endif @@ -152,7 +152,7 @@ public: virtual void tick(); IggyName registerFastName(const wstring &name); -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) void SetFocusToElement(int iID); #endif #ifdef __PSVITA__ @@ -192,7 +192,7 @@ public: // returns main panel if controls are not living in the root virtual UIControl* GetMainPanel(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Direct edit support: scenes override to register their text inputs. // Base class handles tickDirectEdit in tick(), click-outside-to-deselect // in handleMouseClick(), and provides isDirectEditBlocking() for guards. diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 3539ce33..93e0efc1 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -6,7 +6,7 @@ #include "../../../Minecraft.World/net.minecraft.world.inventory.h" #include "../../../Minecraft.World/net.minecraft.world.item.h" #include "../../MultiPlayerLocalPlayer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -40,7 +40,7 @@ void UIScene_AbstractContainerMenu::handleDestroy() { app.DebugPrintf("UIScene_AbstractContainerMenu::handleDestroy\n"); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) g_KBMInput.SetScreenCursorHidden(false); g_KBMInput.SetCursorHiddenForUI(false); #endif @@ -53,7 +53,7 @@ void UIScene_AbstractContainerMenu::handleDestroy() } // 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst packet loss. - // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) + // We need to make sure that we call closeContainer() anytime this menu is closed, even if it is forced to close by some other reason (like the player dying) if(pMinecraft->localplayers[m_iPad] != nullptr && pMinecraft->localplayers[m_iPad]->containerMenu->containerId == m_menu->containerId) { pMinecraft->localplayers[m_iPad]->closeContainer(); @@ -80,7 +80,7 @@ void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractConta void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) g_KBMInput.SetScreenCursorHidden(true); g_KBMInput.SetCursorHiddenForUI(true); #endif @@ -101,7 +101,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) // We may have varying depths of controls here, so base off the pointers parent #if TO_BE_IMPLEMENTED HXUIOBJ parent; - XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight ); + XuiElementGetBounds( m_pointerControl->m_hObj, &fPointerWidth, &fPointerHeight ); #else fPointerWidth = 50; fPointerHeight = 50; @@ -114,7 +114,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) // Get size of pointer m_fPointerImageOffsetX = 0; //floor(fPointerWidth/2.0f); m_fPointerImageOffsetY = 0; //floor(fPointerHeight/2.0f); - + m_fPanelMinX = fPanelX; m_fPanelMaxX = fPanelX + fPanelWidth; m_fPanelMinY = fPanelY; @@ -122,9 +122,9 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) #ifdef __ORBIS__ // we need to map the touchpad rectangle to the UI rectangle. While it works great for the creative menu, it is much too sensitive for the smaller menus. - //X coordinate of the touch point (0 to 1919) - //Y coordinate of the touch point (0 to 941: DUALSHOCK�4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation�4 development tool, - //0 to 753: JDX-1000x series controllers for the PlayStation�4 development tool,) + //X coordinate of the touch point (0 to 1919) + //Y coordinate of the touch point (0 to 941: DUALSHOCK�4 wireless controllers and the CUH-ZCT1J/CAP-ZCT1J/CAP-ZCT1U controllers for the PlayStation�4 development tool, + //0 to 753: JDX-1000x series controllers for the PlayStation�4 development tool,) m_fTouchPadMulX=fPanelWidth/1919.0f; m_fTouchPadMulY=fPanelHeight/941.0f; m_fTouchPadDeadZoneX=15.0f*m_fTouchPadMulX; @@ -168,7 +168,7 @@ void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex) //m_pointerControl->SetPosition( &vPointerPos ); m_pointerPos = vPointerPos; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if ((iPad == 0) && g_KBMInput.IsKBMActive()) { m_pointerPos.x = ((m_fPanelMinX + m_fPanelMaxX) * 0.5f) - m_fPointerImageOffsetX; @@ -286,7 +286,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg shared_ptr item = nullptr; int slotId = -1; if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0) - { + { m_cacheSlotRenders = false; item = pMinecraft->localplayers[m_iPad]->inventory->getCarried(); } @@ -298,7 +298,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg app.DebugPrintf("This is not the control we are looking for\n"); } else - { + { m_cacheSlotRenders = true; Slot *slot = m_menu->getSlot(slotId); item = slot->getItem(); diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index 8145ab68..bf452e12 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp @@ -96,7 +96,7 @@ void UIScene_AnvilMenu::tick() { UIScene_AbstractContainerMenu::tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Live update: sync item name per-keystroke while editing (like Java edition) if (m_textInputAnvil.isDirectEditing()) { @@ -319,7 +319,7 @@ UIControl *UIScene_AnvilMenu::getSection(ESceneSection eSection) return control; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_AnvilMenu::getDirectEditInputs(vector &inputs) { inputs.push_back(&m_textInputAnvil); @@ -339,7 +339,7 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) if (bRes) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); @@ -360,7 +360,7 @@ int UIScene_AnvilMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) void UIScene_AnvilMenu::handleEditNamePressed() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.h b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.h index fe5201f6..2d424ea6 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.h @@ -55,7 +55,7 @@ protected: virtual UIControl *getSection(ESceneSection eSection); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_BindingsTypeMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BindingsTypeMenu.cpp index 5fff4ff0..bcccc27e 100644 --- a/Minecraft.Client/Common/UI/UIScene_BindingsTypeMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BindingsTypeMenu.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIScene_BindingsTypeMenu.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIScene_BindingsTypeMenu::UIScene_BindingsTypeMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { diff --git a/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp index cc4c25ae..f855b929 100644 --- a/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BookAndQuillMenu.cpp @@ -79,7 +79,7 @@ UIScene_BookAndQuillMenu::UIScene_BookAndQuillMenu(int iPad, void *initData, UIL -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (signedBook == true) { return; } @@ -140,7 +140,7 @@ void UIScene_BookAndQuillMenu::KBMUpdate(bool bVal) { } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_BookAndQuillMenu::getDirectEditLabels(vector &labels) { labels.push_back(&m_typeText); } @@ -398,7 +398,7 @@ int UIScene_BookAndQuillMenu::KeyboardCompleteCallback(LPVOID lpParam, bool bRes { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(pchText, 128); #else InputManager.GetText(pchText); @@ -436,7 +436,7 @@ void UIScene_BookAndQuillMenu::handlePress(F64 controlId, F64 childId) switch((int)controlId) { case eControl_Type: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (signedBook == true) { break; } diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index 162a5f0f..284516a7 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -7,7 +7,7 @@ #include "../../../Minecraft.World/Tile.h" #include "../../../Minecraft.World/BannerPatternRecipe.h" #include "UIScene_CraftingMenu.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/Iggy/gdraw/gdraw_d3d11.h" #endif @@ -18,7 +18,7 @@ UIScene_CraftingMenu::UIScene_CraftingMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_hSlotBoundsValid = false; m_hSlotX0 = m_hSlotY0 = m_hSlotY1 = 0; m_hSlotSpacing = 0; @@ -245,14 +245,14 @@ wstring UIScene_CraftingMenu::getMoviePath() } } -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) UIControl* UIScene_CraftingMenu::GetMainPanel() { return &m_controlMainPanel; } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_CraftingMenu::handleCraftingGroupSwitch() { if (isSpecialTab()) { Special_EnterGroup(); @@ -556,7 +556,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) { decorations = false; int iIndex = slotId - CRAFTING_H_SLOT_START; - #ifdef _WINDOWS64 + #if defined(_WINDOWS64) || defined(__linux__) // Cache H slot SWF-space positions from the custom draw transform matrix if (iIndex == 0 || iIndex == 1) { diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h index 78c3f648..f32b0015 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h @@ -78,10 +78,10 @@ public: virtual void handleTouchBoxRebuild(); virtual void handleTimerComplete(int id); #endif -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || defined(_WINDOWS64) || defined(__linux__) virtual UIControl* GetMainPanel(); #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool handleMouseClick(F32 x, F32 y); // Cached from customDraw — H slot bounding boxes in SWF space F32 m_hSlotX0, m_hSlotY0, m_hSlotY1; @@ -91,7 +91,7 @@ public: //cached from swf at startup UIControl m_GroupH[2]; UIControl m_GroupV[2]; - + void handleCraftingGroupSwitch(); void handleCraftingSlotClick(int iIndex); void handleLeftMouseClick(F32 x, F32 y, F32 sceneX, F32 sceneY); @@ -217,7 +217,7 @@ protected: UI_MAP_NAME( m_funcEnableTab, L"EnableTab" ) UI_MAP_NAME( m_funcShowSuperCraftingSlots, L"ShowSuperCraftingSlots" ) -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UI_MAP_ELEMENT(m_GroupH[0], "TabH_1") UI_MAP_ELEMENT(m_GroupH[1], "TabH_2") @@ -290,7 +290,7 @@ protected: virtual void setPreviewSlotItem(shared_ptr item); virtual void setSpinnerTitle(LPCWSTR text); virtual void setHTabItem(int iIndex, shared_ptr item); - + virtual void HandleMessage(EUIMessage message, void *data); void handleInventoryUpdated(LPVOID data); diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 1ef22902..3c6d7e9e 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -17,7 +17,7 @@ #include "PSVita/Network/SQRNetworkManager_AdHoc_Vita.h" #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #include "Xbox/Resource.h" @@ -361,7 +361,7 @@ int UIScene_CreateWorldMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::E #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_CreateWorldMenu::getDirectEditInputs(vector &inputs) { inputs.push_back(&m_editWorldName); @@ -377,7 +377,7 @@ void UIScene_CreateWorldMenu::onDirectEditFinished(UIControl_TextInput *input, U void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) { handled = true; return; } #endif @@ -434,7 +434,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) { if(m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -443,7 +443,7 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) case eControl_EditWorldName: { m_bIgnoreInput=true; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!g_KBMInput.IsKBMActive()) { UIKeyboardInitData kbData; @@ -629,7 +629,7 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() TelemetryManager->RecordUpsellPresented(m_iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif -#if defined(_DURANGO) || defined(_WINDOWS64) +#if defined(_DURANGO) || (defined(_WINDOWS64) || defined(__linux__)) // trial pack warning UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -844,7 +844,7 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t) ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(pchText, 128); #else InputManager.GetText(pchText); @@ -1077,7 +1077,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() #endif else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On Windows64, Xbox Live is unavailable. Skip QuadrantSignin and start directly. CreateGame(this, 0); #else @@ -1187,7 +1187,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD StorageManager.ResetSaveData(); // Make our next save default to the name of the level StorageManager.SetSaveTitle((wchar_t *)wWorldName.c_str()); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // New world — save folder doesn't exist yet, clear for now (will be set after first autosave) app.SetCurrentSaveFolderName(L""); #endif @@ -1475,7 +1475,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor if(isClientSide && app.IsLocalMultiplayerAvailable()) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On Windows64, Xbox Live is unavailable. Skip QuadrantSignin and start directly. CreateGame(pClass, 0); return 0; diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h index dc826cc7..9b93460d 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h @@ -79,7 +79,7 @@ protected: public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.h b/Minecraft.Client/Common/UI/UIScene_Credits.h index ccb62831..50e97971 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.h +++ b/Minecraft.Client/Common/UI/UIScene_Credits.h @@ -15,7 +15,7 @@ #define MAX_CREDIT_STRINGS (PS3_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT + PS3_DOLBY_CREDIT) #elif defined(__ORBIS__) #define MAX_CREDIT_STRINGS (PS4_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT) -#elif defined(_DURANGO) || defined _WINDOWS64 +#elif defined(_DURANGO) || defined _WINDOWS64 || defined(__linux__) #define MAX_CREDIT_STRINGS (XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT) #elif defined(__PSVITA__) #define MAX_CREDIT_STRINGS (PSVITA_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT) @@ -32,7 +32,7 @@ private: }; static SCreditTextItemDef gs_aCreditDefs[MAX_CREDIT_STRINGS]; - + int m_iCurrDefIndex; // Index of last created text def. int m_iNumTextDefs; // Total number of text defs in the credits. @@ -47,7 +47,7 @@ public: UIScene_Credits(int iPad, void *initData, UILayer *parentLayer); virtual EUIScene getSceneType() { return eUIScene_Credits;} - + virtual void updateTooltips(); virtual void updateComponents(); diff --git a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp index fcc6e462..05774e03 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp @@ -50,7 +50,7 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void *initData, UILayer *pare // we also need to mount the local DLC so we can tell what's been purchased app.StartInstallDLCProcess(iPad); #endif - + TelemetryManager->RecordMenuShown(iPad, eUIScene_DLCMainMenu, 0); #if defined __ORBIS__ || defined __PSVITA__ @@ -130,7 +130,7 @@ void UIScene_DLCMainMenu::handlePress(F64 controlId, F64 childId) param->iPad = m_iPad; param->iType = iIndex; - // promote the DLC content request type + // promote the DLC content request type // Xbox One will have requested the marketplace content - there is only that type #ifndef _XBOX_ONE @@ -149,7 +149,7 @@ void UIScene_DLCMainMenu::handleTimerComplete(int id) switch(id) { case PLAYER_ONLINE_TIMER_ID: -#ifndef _WINDOWS64 +#if !defined(_WINDOWS64) && !defined(__linux__) if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) { // check the player hasn't gone offline @@ -213,7 +213,7 @@ void UIScene_DLCMainMenu::tick() string teststring=category.categoryName; m_buttonListOffers.addItem(teststring,i); - + iter++; } @@ -239,4 +239,3 @@ void UIScene_DLCMainMenu::tick() } #endif } - diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index 49358190..1119b2fc 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -86,7 +86,7 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id) switch(id) { case PLAYER_ONLINE_TIMER_ID: -#ifndef _WINDOWS64 +#if !defined(_WINDOWS64) && !defined(__linux__) if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) { // check the player hasn't gone offline diff --git a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp index 913c7d20..35fe7b7c 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.cpp @@ -56,7 +56,7 @@ UIControl_TextInput* UIScene_DebugCreateSchematic::getTextInputForControl(eContr } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_DebugCreateSchematic::getDirectEditInputs(vector &inputs) { inputs.push_back(&m_textInputName); @@ -104,7 +104,7 @@ void UIScene_DebugCreateSchematic::tick() void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif ui.AnimateKeyPress(iPad, key, repeat, pressed, released); @@ -131,7 +131,7 @@ void UIScene_DebugCreateSchematic::handleInput(int iPad, int key, bool repeat, b void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -188,7 +188,7 @@ void UIScene_DebugCreateSchematic::handlePress(F64 controlId, F64 childId) case eControl_EndZ: { m_keyboardCallbackControl = static_cast(static_cast(controlId)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl); @@ -239,7 +239,7 @@ int UIScene_DebugCreateSchematic::KeyboardCompleteCallback(LPVOID lpParam,bool b { UIScene_DebugCreateSchematic *pClass=static_cast(lpParam); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); diff --git a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.h b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.h index 690082b5..3fc32d04 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.h +++ b/Minecraft.Client/Common/UI/UIScene_DebugCreateSchematic.h @@ -59,7 +59,7 @@ protected: UI_END_MAP_ELEMENTS_AND_NAMES() virtual wstring getMoviePath(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); virtual bool handleMouseClick(F32 x, F32 y); diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp index d0761ab7..f4896c7b 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.cpp @@ -63,7 +63,7 @@ wstring UIScene_DebugSetCamera::getMoviePath() return L"DebugSetCamera"; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIControl_TextInput* UIScene_DebugSetCamera::getTextInputForControl(eControls ctrl) { switch (ctrl) @@ -113,7 +113,7 @@ void UIScene_DebugSetCamera::tick() void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) { handled = true; return; } #endif ui.AnimateKeyPress(iPad, key, repeat, pressed, released); @@ -140,7 +140,7 @@ void UIScene_DebugSetCamera::handleInput(int iPad, int key, bool repeat, bool pr void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif switch(static_cast(controlId)) @@ -156,7 +156,7 @@ void UIScene_DebugSetCamera::handlePress(F64 controlId, F64 childId) case eControl_YRot: case eControl_Elevation: m_keyboardCallbackControl = static_cast(static_cast(controlId)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { UIControl_TextInput* input = getTextInputForControl(m_keyboardCallbackControl); @@ -195,7 +195,7 @@ int UIScene_DebugSetCamera::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) UIScene_DebugSetCamera *pClass=static_cast(lpParam); uint16_t pchText[2048]; ZeroMemory(pchText, 2048 * sizeof(uint16_t)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(pchText, 2048); #else >>>>>>> origin/main diff --git a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.h b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.h index d758e049..611a0004 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.h +++ b/Minecraft.Client/Common/UI/UIScene_DebugSetCamera.h @@ -26,7 +26,7 @@ private: FreezePlayerParam *fpp; eControls m_keyboardCallbackControl; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIControl_TextInput* getTextInputForControl(eControls ctrl); #endif @@ -58,7 +58,7 @@ protected: virtual wstring getMoviePath(); virtual void tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); virtual bool handleMouseClick(F32 x, F32 y); @@ -69,10 +69,10 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); protected: - void handlePress(F64 controlId, F64 childId); + void handlePress(F64 controlId, F64 childId); virtual void handleCheckboxToggled(F64 controlId, bool selected); private: static int KeyboardCompleteCallback(LPVOID lpParam,const bool bRes); }; -#endif \ No newline at end of file +#endif diff --git a/Minecraft.Client/Common/UI/UIScene_EditServerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EditServerMenu.cpp index 5326b407..f41adc29 100644 --- a/Minecraft.Client/Common/UI/UIScene_EditServerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EditServerMenu.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "UI.h" #include "UIScene_EditServerMenu.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -41,7 +41,7 @@ wstring UIScene_EditServerMenu::getMoviePath() bool UIScene_EditServerMenu::canConfirm() { wstring address = m_address; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_editAddress.isDirectEditing()) address = m_editAddress.getEditBuffer(); #endif @@ -87,7 +87,7 @@ wstring UIScene_EditServerMenu::ReadKeyboardText() { uint16_t text[256]; ZeroMemory(text, sizeof(text)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(text, 256); #endif wstring result; @@ -125,7 +125,7 @@ void UIScene_EditServerMenu::openKeyboard(int control) bool isName = control == eControl_Name; UIControl_TextInput &input = isName ? m_editName : m_editAddress; int limit = isName ? kNameLimit : kAddressLimit; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { input.beginDirectEdit(limit); @@ -183,7 +183,7 @@ void UIScene_EditServerMenu::handleInput(int iPad, int key, bool repeat, bool pr { if (m_bIgnoreInput || m_bFinished) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) { handled = true; @@ -214,7 +214,7 @@ void UIScene_EditServerMenu::handlePress(F64 controlId, F64 childId) { if (m_bIgnoreInput || m_bFinished) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -234,7 +234,7 @@ void UIScene_EditServerMenu::handlePress(F64 controlId, F64 childId) } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_EditServerMenu::getDirectEditInputs(vector &inputs) { inputs.push_back(&m_editName); diff --git a/Minecraft.Client/Common/UI/UIScene_EditServerMenu.h b/Minecraft.Client/Common/UI/UIScene_EditServerMenu.h index 35db6667..5a716678 100644 --- a/Minecraft.Client/Common/UI/UIScene_EditServerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_EditServerMenu.h @@ -74,7 +74,7 @@ protected: public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handlePress(F64 controlId, F64 childId); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp index 82851c12..5f2185c2 100644 --- a/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FriendMenu.cpp @@ -25,7 +25,7 @@ UIScene_FriendMenu::UIScene_FriendMenu(int iPad, void *initData, UILayer *parent m_bPendingJoin = false; m_joinData.selectedSession = &m_joinSession; m_joinData.iPad = iPad; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_joinData.serverIndex = -1; #endif if (!isLocalPlayerInGame()) @@ -131,7 +131,7 @@ void UIScene_FriendMenu::startJoin(bool skipBlockedCheck) m_joinSession.data.netVersion = MINECRAFT_NET_VERSION; m_joinSession.data.isReadyToJoin = true; m_joinSession.data.isJoinable = true; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_joinSession.data.hostIP[0] = 0; m_joinSession.data.hostPort = 0; m_joinSession.isFriendGame = true; diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index d45d8201..926c2e91 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -43,7 +43,7 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); - // any content to be re-installed? + // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) { // We should show the reinstall menu @@ -130,7 +130,7 @@ void UIScene_HelpAndOptionsMenu::handleReload() // 4J-PB - do not need a storage device to see this menu - just need one when you choose to re-install them bool bNotInGame=(Minecraft::GetInstance()->level==nullptr); - // any content to be re-installed? + // any content to be re-installed? if(m_iPad==ProfileManager.GetPrimaryPad() && bNotInGame) { // We should show the reinstall menu @@ -213,7 +213,7 @@ void UIScene_HelpAndOptionsMenu::handlePress(F64 controlId, F64 childId) ui.NavigateToScene(m_iPad, eUIScene_HowToPlayMenu); break; case BUTTON_HAO_CONTROLS: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) ui.NavigateToScene(m_iPad, eUIScene_BindingsTypeMenu); #else ui.NavigateToScene(m_iPad, eUIScene_ControlsMenu); diff --git a/Minecraft.Client/Common/UI/UIScene_InGameFriendsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameFriendsMenu.cpp index 06806f6d..7c9af266 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameFriendsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameFriendsMenu.cpp @@ -3,7 +3,7 @@ #include "UIScene_InGameFriendsMenu.h" #include "UICustomStrings.h" #include "../../Minecraft.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" bool Win64_IsOnlineUsernameActive(); #endif @@ -28,7 +28,7 @@ wstring UIScene_InGameFriendsMenu::getMoviePath() bool UIScene_InGameFriendsMenu::isOnline() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) return SocialOnlineService::IsLinked() && Win64_IsOnlineUsernameActive(); #else return false; @@ -189,7 +189,7 @@ void UIScene_InGameFriendsMenu::showMessage(const wchar_t *title, const wstring void UIScene_InGameFriendsMenu::openAddFriendKeyboard() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIKeyboardInitData kbData; kbData.title = L"Friend's Username"; kbData.defaultText = L""; @@ -210,7 +210,7 @@ int UIScene_InGameFriendsMenu::AddFriendKeyboardCallback(LPVOID lpParam, const b { uint16_t text[64]; ZeroMemory(text, sizeof(text)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(text, 64); #endif wstring name; diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp index fb118b15..40052c95 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -276,7 +276,7 @@ void UIScene_InGameSaveManagementMenu::tick() #ifdef _DURANGO // Already utf16 on durango memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) int result = ::MultiByteToWideChar( CP_UTF8, // convert from UTF-8 MB_ERR_INVALID_CHARS, // error on invalid chars diff --git a/Minecraft.Client/Common/UI/UIScene_Intro.cpp b/Minecraft.Client/Common/UI/UIScene_Intro.cpp index 1cbc5d03..595704d4 100644 --- a/Minecraft.Client/Common/UI/UIScene_Intro.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Intro.cpp @@ -3,7 +3,7 @@ #include "UIScene_Intro.h" // HUCKLE - added below for joining game on launch -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/Network/WindowsNetworkConfig.h" #include "../../User.h" #endif @@ -28,7 +28,7 @@ UIScene_Intro::UIScene_Intro(int iPad, void *initData, UILayer *parentLayer) : U bChina = ProfileManager.LocaleIsChina(); #endif // 4J Stu - These map to values in the Actionscript -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int platformIdx = 0; #elif defined(_XBOX) int platformIdx = 1; @@ -102,15 +102,15 @@ void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, bo break; default: #if 0 - ui.NavigateToScene(0,eUIScene_EULA); + ui.NavigateToScene(0,eUIScene_EULA); #else - ui.NavigateToScene(0,eUIScene_SaveMessage); + ui.NavigateToScene(0,eUIScene_SaveMessage); #endif break; } #elif defined _XBOX_ONE ui.NavigateToScene(0,eUIScene_MainMenu); -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) // HUCKLE - added this for auto joining servers on game launch // THANKS so much to DrPerky and GeorgeV22 for helping with this bit, honestly got stuck for 4 hours :sob: if(g_Win64MultiplayerJoin == true) @@ -130,19 +130,19 @@ void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, bo ProfileManager.SetLockedProfile(primaryPad); ProfileManager.QuerySigninStatus(); - if (!app.DLCInstallProcessCompleted()) + if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(primaryPad); Minecraft* pMinecraft = Minecraft::GetInstance(); pMinecraft->user->name = convStringToWstring(ProfileManager.GetGamertag(primaryPad)); app.ApplyGameSettingsChanged(primaryPad); - + auto sessionInfo = std::make_unique(); // label and name const wchar_t* defaultName = L""; size_t nameLen = wcslen(defaultName); - + // ip and port strncpy_s(sessionInfo->data.hostIP, g_Win64MultiplayerIP, sizeof(sessionInfo->data.hostIP) - 1); sessionInfo->data.hostPort = g_Win64MultiplayerPort; @@ -166,7 +166,7 @@ void UIScene_Intro::handleInput(int iPad, int key, bool repeat, bool pressed, bo DWORD dwLocalUsersMask = 0; dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); - + CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( sessionInfo.get(), dwLocalUsersMask ); if (result == CGameNetworkManager::JOINGAME_PENDING) @@ -232,10 +232,10 @@ void UIScene_Intro::handleAnimationEnd() break; default: #if 0 - ui.NavigateToScene(0,eUIScene_EULA); + ui.NavigateToScene(0,eUIScene_EULA); #else - ui.NavigateToScene(0,eUIScene_SaveMessage); - #endif + ui.NavigateToScene(0,eUIScene_SaveMessage); + #endif break; } @@ -251,7 +251,7 @@ void UIScene_Intro::handleAnimationEnd() { m_bAnimationEnded = true; } -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) // HUCKLE - added this for auto joining servers on game launch // THANKS so much to DrPerky and GeorgeV22 for helping with this bit, honestly got stuck for 4 hours :sob: if(g_Win64MultiplayerJoin == true) @@ -271,19 +271,19 @@ void UIScene_Intro::handleAnimationEnd() ProfileManager.SetLockedProfile(primaryPad); ProfileManager.QuerySigninStatus(); - if (!app.DLCInstallProcessCompleted()) + if (!app.DLCInstallProcessCompleted()) app.StartInstallDLCProcess(primaryPad); Minecraft* pMinecraft = Minecraft::GetInstance(); pMinecraft->user->name = convStringToWstring(ProfileManager.GetGamertag(primaryPad)); app.ApplyGameSettingsChanged(primaryPad); - + auto sessionInfo = std::make_unique(); // label and name const wchar_t* defaultName = L""; size_t nameLen = wcslen(defaultName); - + // ip and port strncpy_s(sessionInfo->data.hostIP, g_Win64MultiplayerIP, sizeof(sessionInfo->data.hostIP) - 1); sessionInfo->data.hostPort = g_Win64MultiplayerPort; @@ -307,7 +307,7 @@ void UIScene_Intro::handleAnimationEnd() DWORD dwLocalUsersMask = 0; dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); - + CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( sessionInfo.get(), dwLocalUsersMask ); if (result == CGameNetworkManager::JOINGAME_PENDING) diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index 359879a0..d25cdded 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -30,7 +30,7 @@ UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLay m_friendInfoUpdatedOK = false; m_friendInfoUpdatedERROR = false; m_friendInfoRequestIssued = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_bViewingPlayerList = false; // reset the howtoplay state @@ -199,7 +199,7 @@ void UIScene_JoinMenu::tick() if (app.GetGameHostOption(uiGameHostSettings, eGameHostOption_FireSpreads)) m_labelValues[eLabel_FireOn].init(app.GetString(IDS_ON)); else m_labelValues[eLabel_FireOn].init(app.GetString(IDS_OFF)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_selectedSession->savedServerIndex >= 0 && !m_selectedSession->hasServerInfo) { for (int index = 0; index < eLabel_COUNT; ++index) @@ -245,7 +245,7 @@ void UIScene_JoinMenu::tick() m_labelValues[eLabel_TNTOn].init(app.GetString(IDS_OFF)); m_labelValues[eLabel_FireOn].init(app.GetString(IDS_OFF)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) SetPlayerListPage(m_bViewingPlayerList); #endif @@ -262,7 +262,7 @@ void UIScene_JoinMenu::tick() #endif } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (s_movieServerDesc) { if (IggyPlayerReadyToTick(s_movieServerDesc)) @@ -404,7 +404,7 @@ void UIScene_JoinMenu::updateServerDescription() { } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_JoinMenu::RebuildServerPlayerList() { m_buttonListPlayers.clearList(); @@ -476,7 +476,7 @@ void UIScene_JoinMenu::render(S32 width, S32 height, C4JRender::eViewportType vi { UIScene::render(width, height, viewpBort); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (s_movieServerDesc && !m_bViewingPlayerList) { IggyPlayerSetDisplaySize(s_movieServerDesc, width, height); @@ -496,7 +496,7 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, case ACTION_MENU_CANCEL: if(pressed) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_bViewingPlayerList) { SetPlayerListPage(false); @@ -522,7 +522,7 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, { sendInputToMovie(key, repeat, pressed, released); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) else if (pressed) { int sel = m_buttonListPlayers.getCurrentSelection(); @@ -542,7 +542,7 @@ void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, sendInputToMovie(key, repeat, pressed, released); handled = true; break; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) case ACTION_MENU_OTHER_STICK_UP: case ACTION_MENU_OTHER_STICK_DOWN: if (s_movieServerDesc) @@ -579,7 +579,7 @@ void UIScene_JoinMenu::handlePress(F64 controlId, F64 childId) } break; case eControl_GamePlayers: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bViewingPlayerList && static_cast(childId) == 0) SetPlayerListPage(true); #endif @@ -787,7 +787,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (result == CGameNetworkManager::JOINGAME_PENDING) { pClass->m_bIgnoreInput = false; diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.h b/Minecraft.Client/Common/UI/UIScene_JoinMenu.h index 06cf3b65..107c4132 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.h @@ -66,7 +66,7 @@ private: bool m_friendInfoUpdatedOK; bool m_friendInfoUpdatedERROR; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool m_bViewingPlayerList; void RebuildServerPlayerList(); void SetPlayerListPage(bool visible); diff --git a/Minecraft.Client/Common/UI/UIScene_KeybindsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_KeybindsMenu.cpp index 25a8ece0..9461adec 100644 --- a/Minecraft.Client/Common/UI/UIScene_KeybindsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_KeybindsMenu.cpp @@ -2,7 +2,7 @@ #include "UI.h" #include "UIScene_KeybindsMenu.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #include "../../Windows64/ControllerBinds.h" diff --git a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp index 12189af2..ccf61948 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp @@ -3,7 +3,7 @@ #include "UIScene_Keyboard.h" #include "../../Screen.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Global buffer that stores the text entered in the native keyboard scene. // Callbacks retrieve it via Win64_GetKeyboardText() declared in UIStructs.h. wchar_t g_Win64KeyboardResult[256] = {}; @@ -17,7 +17,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye // Setup all the Iggy references we need for this scene initialiseMovie(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_win64Callback = nullptr; m_win64CallbackParam = nullptr; m_win64TextBuffer = L""; @@ -64,7 +64,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye m_ButtonBackspace.init(L"Backspace", -1); // Initialise function keyboard Buttons and set alternative symbol button string -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bPCMode) #endif { @@ -81,7 +81,7 @@ UIScene_Keyboard::UIScene_Keyboard(int iPad, void *initData, UILayer *parentLaye IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcInitFunctionButtons , 1 , value ); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_bPCMode) { // PC text-input mode: hide all on-screen buttons, user types with physical keyboard @@ -163,7 +163,7 @@ bool UIScene_Keyboard::allowRepeat(int key) return true; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_Keyboard::tick() { UIScene::tick(); @@ -296,7 +296,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, switch(key) { case ACTION_MENU_CANCEL: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { // Cache before navigateBack() destroys this scene int(*cb)(LPVOID, const bool) = m_win64Callback; @@ -316,7 +316,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, case ACTION_MENU_STICK_PRESS: // LS case ACTION_MENU_LEFT_SCROLL: // LB case ACTION_MENU_RIGHT_SCROLL: // RB -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_bPCMode) { @@ -355,7 +355,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, switch(key) { case ACTION_MENU_OK: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_bPCMode) { // pressing enter sometimes causes a "y" to be entered. @@ -368,7 +368,7 @@ void UIScene_Keyboard::handleInput(int iPad, int key, bool repeat, bool pressed, case ACTION_MENU_RIGHT: case ACTION_MENU_UP: case ACTION_MENU_DOWN: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bPCMode) #endif sendInputToMovie(key, repeat, pressed, released); @@ -406,7 +406,7 @@ void UIScene_Keyboard::handleTimerComplete(int id) void UIScene_Keyboard::KeyboardDonePressed() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Use getLabel() here — this is a timer callback (not an Iggy callback) so it's safe. // getLabel() reflects both physical keyboard input (pushed via setLabel) and // on-screen button input (set directly by Flash ActionScript). diff --git a/Minecraft.Client/Common/UI/UIScene_Keyboard.h b/Minecraft.Client/Common/UI/UIScene_Keyboard.h index 146934c1..ec402434 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.h +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.h @@ -7,7 +7,7 @@ class UIScene_Keyboard : public UIScene private: bool m_bKeyboardDonePressed; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int(*m_win64Callback)(LPVOID, const bool); LPVOID m_win64CallbackParam; wstring m_win64TextBuffer; @@ -58,7 +58,7 @@ public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void tick(); #endif @@ -88,7 +88,7 @@ public: #endif // Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool hidesLowerScenes() { return true; } #else virtual bool hidesLowerScenes() { return false; } diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h index 6ebfdbf5..4ac98fa9 100644 --- a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h @@ -16,7 +16,7 @@ #define HAS_LANGUAGE_KO_KR(exp) exp, #define HAS_LANGUAGE_CN_TW(exp) exp, -#if defined(_DURANGO) || defined(_WINDOWS64) +#if defined(_DURANGO) || defined(_WINDOWS64)|| defined(__linux__) #define HAS_LANGUAGE_CN_CN(exp) exp, #define HAS_LANGUAGE_SK_SK(exp) exp, #define HAS_LANGUAGE_CZ_CZ(exp) exp, @@ -35,10 +35,10 @@ #define HAS_LANGUAGE_NB_NO(exp) exp, #define HAS_LANGUAGE_EL_GR(exp) exp, -#if defined(__ORBIS__) || defined(__PS3__) || defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__ORBIS__) || defined(__PS3__) || defined(__PSVITA__) || defined(_WINDOWS64)|| defined(__linux__) #define HAS_LANGUAGE_TR_TR(exp) exp, #else -#define HAS_LANGUAGE_TR_TR(exp) +#define HAS_LANGUAGE_TR_TR(exp) #endif class UIScene_LanguageSelector : public UIScene @@ -79,7 +79,7 @@ private: { eControl_Buttons, }; - + static const unsigned int m_uiHTPButtonNameA[eLanguageSelector_MAX]; UIControl_DynamicButtonList m_buttonListHowTo; @@ -92,7 +92,7 @@ public: UIScene_LanguageSelector(int iPad, void *initData, UILayer *parentLayer); virtual EUIScene getSceneType() { return eUIScene_LanguageSelector; } - + virtual void tick(); virtual void updateTooltips(); virtual void updateComponents(); @@ -114,41 +114,41 @@ const int uiLangMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = { HAS_LANGUAGE_SYSTEM(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_EN_US(XC_LANGUAGE_ENGLISH) - HAS_LANGUAGE_DE_DE(XC_LANGUAGE_GERMAN) + HAS_LANGUAGE_DE_DE(XC_LANGUAGE_GERMAN) HAS_LANGUAGE_ES_ES(XC_LANGUAGE_SPANISH) HAS_LANGUAGE_ES_MX(XC_LANGUAGE_SPANISH) - HAS_LANGUAGE_FR_FR(XC_LANGUAGE_FRENCH) - HAS_LANGUAGE_IT_IT(XC_LANGUAGE_ITALIAN) + HAS_LANGUAGE_FR_FR(XC_LANGUAGE_FRENCH) + HAS_LANGUAGE_IT_IT(XC_LANGUAGE_ITALIAN) HAS_LANGUAGE_PT_PT(XC_LANGUAGE_PORTUGUESE) HAS_LANGUAGE_PT_BR(XC_LANGUAGE_PORTUGUESE) - HAS_LANGUAGE_JA_JP(XC_LANGUAGE_JAPANESE) - HAS_LANGUAGE_KO_KR(XC_LANGUAGE_KOREAN) - HAS_LANGUAGE_CN_TW(XC_LANGUAGE_TCHINESE) + HAS_LANGUAGE_JA_JP(XC_LANGUAGE_JAPANESE) + HAS_LANGUAGE_KO_KR(XC_LANGUAGE_KOREAN) + HAS_LANGUAGE_CN_TW(XC_LANGUAGE_TCHINESE) HAS_LANGUAGE_CN_CN(XC_LANGUAGE_SCHINESE) HAS_LANGUAGE_DA_DK(XC_LANGUAGE_DANISH) HAS_LANGUAGE_FI_FI(XC_LANGUAGE_FINISH) - HAS_LANGUAGE_NL_NL(XC_LANGUAGE_DUTCH) - HAS_LANGUAGE_PL_PL(XC_LANGUAGE_POLISH) - HAS_LANGUAGE_RU_RU(XC_LANGUAGE_RUSSIAN) - HAS_LANGUAGE_SV_SE(XC_LANGUAGE_SWEDISH) + HAS_LANGUAGE_NL_NL(XC_LANGUAGE_DUTCH) + HAS_LANGUAGE_PL_PL(XC_LANGUAGE_POLISH) + HAS_LANGUAGE_RU_RU(XC_LANGUAGE_RUSSIAN) + HAS_LANGUAGE_SV_SE(XC_LANGUAGE_SWEDISH) HAS_LANGUAGE_NB_NO(XC_LANGUAGE_BNORWEGIAN) HAS_LANGUAGE_SK_SK(XC_LANGUAGE_SLOVAK) - HAS_LANGUAGE_CZ_CZ(XC_LANGUAGE_CZECH) + HAS_LANGUAGE_CZ_CZ(XC_LANGUAGE_CZECH) HAS_LANGUAGE_EL_GR(XC_LANGUAGE_GREEK) HAS_LANGUAGE_TR_TR(XC_LANGUAGE_TURKISH) }; -const int uiLocaleMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = +const int uiLocaleMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = { HAS_LANGUAGE_SYSTEM(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_EN_US(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_DE_DE(MINECRAFT_LANGUAGE_DEFAULT) - HAS_LANGUAGE_ES_ES(XC_LOCALE_SPAIN) - HAS_LANGUAGE_ES_MX(XC_LOCALE_LATIN_AMERICA) + HAS_LANGUAGE_ES_ES(XC_LOCALE_SPAIN) + HAS_LANGUAGE_ES_MX(XC_LOCALE_LATIN_AMERICA) HAS_LANGUAGE_FR_FR(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_IT_IT(MINECRAFT_LANGUAGE_DEFAULT) - HAS_LANGUAGE_PT_PT(XC_LOCALE_PORTUGAL) - HAS_LANGUAGE_PT_BR(XC_LOCALE_BRAZIL) + HAS_LANGUAGE_PT_PT(XC_LOCALE_PORTUGAL) + HAS_LANGUAGE_PT_BR(XC_LOCALE_BRAZIL) HAS_LANGUAGE_JA_JP(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_KO_KR(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_CN_TW(MINECRAFT_LANGUAGE_DEFAULT) @@ -164,4 +164,4 @@ const int uiLocaleMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = HAS_LANGUAGE_CZ_CZ(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_EL_GR(MINECRAFT_LANGUAGE_DEFAULT) HAS_LANGUAGE_TR_TR(MINECRAFT_LANGUAGE_DEFAULT) -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 583531ec..80d85fac 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -97,7 +97,7 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini m_checkboxes[eLaunchCheckbox_Structures].init(app.GetString(IDS_GENERATE_STRUCTURES),eLaunchCheckbox_Structures,m_params->bStructures); m_checkboxes[eLaunchCheckbox_FlatWorld].init(app.GetString(IDS_SUPERFLAT_WORLD),eLaunchCheckbox_FlatWorld,m_params->bFlatWorld); m_checkboxes[eLaunchCheckbox_BonusChest].init(app.GetString(IDS_BONUS_CHEST),eLaunchCheckbox_BonusChest,m_params->bBonusChest); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_params->bGenerateOptions) { m_buttonCustomiseSuperflat.init(L"Customize Superflat", eControl_CustomiseSuperflat); @@ -205,7 +205,7 @@ void UIScene_LaunchMoreOptionsMenu::updateTooltips() void UIScene_LaunchMoreOptionsMenu::openSuperflatCustomise() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_params->bGenerateOptions || !m_params->bFlatWorld) return; ui.PlayUISFX(eSFX_Press); ui.NavigateToScene(m_iPad, eUIScene_SuperflatMenu, m_params); @@ -231,7 +231,7 @@ void UIScene_LaunchMoreOptionsMenu::tick() { UIScene::tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_params->bGenerateOptions) { int enabled = m_params->bFlatWorld ? 1 : 0; @@ -301,7 +301,7 @@ void UIScene_LaunchMoreOptionsMenu::handleDestroy() void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -383,7 +383,7 @@ void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool UIScene_LaunchMoreOptionsMenu::handleMouseClick(F32 x, F32 y) { if (!hasFocus(m_iPad) || getMovie() == nullptr || g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) @@ -419,7 +419,7 @@ bool UIScene_LaunchMoreOptionsMenu::handleMouseClick(F32 x, F32 y) } #endif -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel() { if(m_tabIndex == 0) @@ -514,7 +514,7 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId wstring customText; switch(static_cast(controlId)) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) case eControl_CustomiseSuperflat: { customText = L"Customise the layers, biome and structures of your Superflat world."; @@ -654,7 +654,7 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b pClass->m_bIgnoreInput=false; if (bRes) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); @@ -676,7 +676,7 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b return 0; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_LaunchMoreOptionsMenu::getDirectEditInputs(vector &inputs) { inputs.push_back(&m_editSeed); @@ -692,7 +692,7 @@ void UIScene_LaunchMoreOptionsMenu::onDirectEditFinished(UIControl_TextInput *in void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) { if(m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -703,7 +703,7 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) break; case eControl_EditSeed: { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { m_editSeed.beginDirectEdit(60); diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h index ec4f6b02..01ade11d 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -63,7 +63,7 @@ private: UIControl_TextInput m_editSeed; UIControl_Slider m_sliderWorldSize; UIControl_Slider m_sliderWorldResize; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIControl_Button m_buttonCustomiseSuperflat; int m_iCustomiseEnabled; #endif @@ -110,7 +110,7 @@ private: UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Structures], "CheckboxStructures") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_BonusChest], "CheckboxBonusChest") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FlatWorld], "CheckboxFlatWorld") -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UI_MAP_ELEMENT( m_buttonCustomiseSuperflat, "ButtonCustomise") #endif @@ -152,13 +152,13 @@ protected: public: virtual void tick(); virtual void handleDestroy(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); #endif // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool handleMouseClick(F32 x, F32 y); #endif virtual void handleFocusChange(F64 controlId, F64 childId); @@ -184,7 +184,7 @@ private: #ifdef __PSVITA__ virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); #endif //__PSVITA__ -#if defined(__PSVITA__) || defined(_WINDOWS64) +#if defined(__PSVITA__) || (defined(_WINDOWS64) || defined(__linux__)) virtual UIControl* GetMainPanel(); #endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index 7272ecfd..215d34dc 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -925,7 +925,7 @@ void UIScene_LeaderboardsMenu::PopulateLeaderboard(LeaderboardManager::eStatsRet m_labelEntries.setLabel(entriesBuffer); //Show the no results message -#if !(defined(_XBOX) || defined(_WINDOWS64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__))) // 4J Stu - Temp to get the win build running, but so we check this for other platforms if (ret == LeaderboardManager::eStatsReturn_NetworkError) m_labelInfo.setLabel(app.GetString(IDS_ERROR_NETWORK)); else @@ -1016,7 +1016,7 @@ void UIScene_LeaderboardsMenu::handleTimerComplete(int id) switch(id) { case PLAYER_ONLINE_TIMER_ID: -#ifndef _WINDOWS64 +#if !defined(_WINDOWS64) && !defined(__linux__) if(ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())==false) { // check the player hasn't gone offline diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp index 52f73e7e..211ce44e 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp @@ -53,7 +53,7 @@ -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "..\..\..\Minecraft.World\NbtIo.h" @@ -112,7 +112,7 @@ static bool IsTutorialSaveMetadata(unsigned int uiHostOptions, DWORD uiTexturePa return uiHostOptions == expectedTutorial; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static bool TryLoadThumbnailFromDisk_Win64(const char *saveFolder, PBYTE *outData, DWORD *outSize) { if(outData) *outData = nullptr; @@ -626,7 +626,7 @@ int UIScene_LoadCreateJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBY app.DebugPrintf("Received data for save thumbnail\n"); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if((pbThumbnail == nullptr || dwThumbnailBytes == 0) && pClass != nullptr && pClass->m_iRequestingThumbnailId >= 0 && @@ -731,7 +731,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, m_bPendingJoinTabAvailabilityRefresh = false; m_bPendingJoinVisualRefresh = false; m_bRebuildingJoinVisual = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_lastHoverMouseX = -1; m_lastHoverMouseY = -1; m_mouseHoverTracked = false; @@ -775,7 +775,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, MAXIMUM_SAVE_STORAGE); @@ -869,7 +869,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || (defined(_WINDOWS64) || defined(__linux__)) // Always clear the saves when we enter this menu @@ -1200,7 +1200,7 @@ void UIScene_LoadCreateJoinMenu::updateTooltips() iY = IDS_TOOLTIPS_HIDE; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) else if (GetSelectedSavedServer() != nullptr) { iY = IDS_TOOLTIPS_OPTIONS; @@ -1253,7 +1253,7 @@ void UIScene_LoadCreateJoinMenu::Initialise() m_iGameListIndex = 0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_addServerPhase = eAddServer_Idle; m_selectedServerIndex = -1; @@ -1537,7 +1537,7 @@ UIControl* UIScene_LoadCreateJoinMenu::GetMainPanel() } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool UIScene_LoadCreateJoinMenu::ConvertMouseToSceneCoords(float &sceneMouseX, float &sceneMouseY) { if (g_KBMInput.IsMouseGrabbed() || !g_KBMInput.IsKBMActive()) @@ -1775,7 +1775,7 @@ void UIScene_LoadCreateJoinMenu::UpdateMouseHoverForActiveTab() case eTab_Join: { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) const int targetGameIndex = targetChildIndex - 1; #else const int targetGameIndex = targetChildIndex; @@ -2073,11 +2073,11 @@ void UIScene_LoadCreateJoinMenu::tick() UIScene::tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UpdateMouseHoverForActiveTab(); #endif -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__)) || defined __PSVITA__) if(m_bExitScene) // navigate forward or back @@ -2111,7 +2111,7 @@ void UIScene_LoadCreateJoinMenu::tick() #endif -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) if(m_bUpdateSaveSize) @@ -2167,7 +2167,7 @@ void UIScene_LoadCreateJoinMenu::tick() //CD - Fix - Adding define for ORBIS/XBOXONE -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) m_spaceIndicatorSaves.reset(); @@ -2212,7 +2212,7 @@ void UIScene_LoadCreateJoinMenu::tick() m_iSaveDetailsCount = m_pSaveDetails->iSaveC; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Build sorted index array (newest-first by filename timestamp YYYYMMDDHHMMSS) @@ -2252,7 +2252,7 @@ void UIScene_LoadCreateJoinMenu::tick() m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) int origIdx = sortedIdx[i]; @@ -2288,7 +2288,7 @@ void UIScene_LoadCreateJoinMenu::tick() #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { @@ -2389,7 +2389,7 @@ void UIScene_LoadCreateJoinMenu::tick() } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) delete[] sortedIdx; @@ -2418,7 +2418,7 @@ void UIScene_LoadCreateJoinMenu::tick() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData != nullptr && m_saveDetails[m_iRequestingThumbnailId].dwThumbnailSize > 0) { app.DebugPrintf("Using preloaded save thumbnail\n"); @@ -2435,7 +2435,7 @@ void UIScene_LoadCreateJoinMenu::tick() PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); @@ -2489,7 +2489,7 @@ void UIScene_LoadCreateJoinMenu::tick() memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) int result = ::MultiByteToWideChar( @@ -2569,7 +2569,7 @@ void UIScene_LoadCreateJoinMenu::tick() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData != nullptr && m_saveDetails[m_iRequestingThumbnailId].dwThumbnailSize > 0) { app.DebugPrintf("Using preloaded save thumbnail\n"); @@ -2585,7 +2585,7 @@ void UIScene_LoadCreateJoinMenu::tick() PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); @@ -2992,7 +2992,7 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() m_buttonListNewGames.addItem(app.GetString(IDS_CREATE_NEW_WORLD)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) TrySetButtonListIcon( m_buttonListNewGames, m_buttonListNewGames.getItemCount() - 1, @@ -3050,7 +3050,7 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(levelGen->isTutorial()) { TrySetButtonListIcon( @@ -3159,7 +3159,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo return false; }; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) auto openServerOptions = [&]() -> bool { if (!pressed || repeat || !BeginServerOptions()) @@ -3292,7 +3292,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Right click on a save opens save options. In Create, it hides mash-up worlds. @@ -3316,7 +3316,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo case ACTION_MENU_Y: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if(openServerOptions()) { break; @@ -3603,7 +3603,7 @@ int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(ui16Text, 128); @@ -3627,7 +3627,7 @@ int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam StorageManager.RenameSaveData(pClass->m_iSaveListIndex, ui16Text,&UIScene_LoadCreateJoinMenu::RenameSaveDataReturned,pClass); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) { @@ -3793,7 +3793,7 @@ void UIScene_LoadCreateJoinMenu::handleFocusChange(F64 controlId, F64 childId) m_iGameListIndex = childId; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_iGameListIndex -= 1; @@ -4042,7 +4042,7 @@ void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (static_cast(childId) == ADD_SERVER_BUTTON_INDEX) @@ -4068,7 +4068,7 @@ void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) int nIndex = static_cast(childId); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) nIndex -= 1; @@ -4346,7 +4346,7 @@ void UIScene_LoadCreateJoinMenu::CheckAndJoinGame(int gameIndex) m_initData->selectedSession = m_currentSessions->at( gameIndex ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_initData->serverIndex = m_initData->selectedSession->savedServerIndex; @@ -4617,7 +4617,7 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) unsigned int nIndex = m_buttonListGames.getCurrentSelection(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_currentSessions != nullptr && nIndex > 0 && (nIndex - 1) < m_currentSessions->size()) @@ -4640,7 +4640,7 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) m_buttonListGames.clearList(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) TrySetButtonListIcon(m_buttonListGames, -1, L"lceheadwer.png", L"lceheadwer"); TrySetButtonListIcon(m_buttonListGames, -1, L"CreateWorldIcon.png", L"CreateWorldIcon"); @@ -4735,7 +4735,7 @@ void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_buttonListGames.setCurrentSelection(sessionIndex + 1); @@ -4777,7 +4777,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() -#if !defined(_WINDOWS64) +#if !defined(_WINDOWS64) && !defined(__linux__) // if we're retrieving save info, don't show the list yet as we will be ignoring press events if(!m_bSavesDisplayed) { @@ -5020,7 +5020,7 @@ void UIScene_LoadCreateJoinMenu::handleTimerComplete(int id) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_currentSessions == nullptr) { UpdateGamesList(); @@ -5459,7 +5459,7 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) @@ -5541,7 +5541,7 @@ int UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { @@ -5727,7 +5727,7 @@ int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad, pClass->m_bIgnoreInput=true; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { @@ -8648,7 +8648,7 @@ void UIScene_LoadCreateJoinMenu::HandleDLCLicenseChange() -#if defined _XBOX_ONE || defined __ORBIS__ || defined(_WINDOWS64) +#if defined _XBOX_ONE || defined __ORBIS__ || (defined(_WINDOWS64) || defined(__linux__)) int UIScene_LoadCreateJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) @@ -8936,7 +8936,7 @@ int UIScene_LoadCreateJoinMenu::CopySaveErrorDialogFinishedCallback(void *pParam #endif // _XBOX_ONE -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // adding servers bellow diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h index 180e9f14..a198d594 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h @@ -1,7 +1,7 @@ #pragma once #include "UIScene.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "UIScene_EditServerMenu.h" #endif @@ -28,7 +28,7 @@ private: eControl_TabLoad, eControl_TabCreate, eControl_TabJoin, -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) eControl_SpaceIndicator, #endif }; @@ -76,7 +76,7 @@ protected: UIControl_Button m_tabLoad, m_tabCreate, m_tabJoin; UIControl_Label m_labelSavesListTitle, m_labelCreateListTitle, m_labelJoinListTitle, m_labelNoGames; UIControl m_controlSavesTimer, m_controlNewGameTimer, m_controlJoinTimer; -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) UIControl_SpaceIndicatorBar m_spaceIndicatorSaves; #endif @@ -102,7 +102,7 @@ private: UI_MAP_ELEMENT( m_buttonListSaves, "LoadGameList") UI_MAP_ELEMENT( m_controlSavesTimer, "LoadGameTimer") UI_MAP_ELEMENT( m_tabLoad, "TouchTabLoad") -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar") #endif UI_END_MAP_CHILD_ELEMENTS() @@ -170,7 +170,7 @@ private: bool m_bRebuildingJoinVisual; bool m_bHasNoGamesLabel; int m_iNewGameListIndex; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int m_lastHoverMouseX; int m_lastHoverMouseY; bool m_mouseHoverTracked; @@ -221,7 +221,7 @@ private: void RebuildJoinGamesListVisual(bool syncFocus); void UpdateJoinTabAvailability(); void UpdateSaveSizeBarVisibility(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UpdateMouseHoverForActiveTab(); virtual bool handleMouseClick(F32 x, F32 y) override; bool ConvertMouseToSceneCoords(float &sceneMouseX, float &sceneMouseY); @@ -264,7 +264,7 @@ public: private: void CheckAndJoinGame(int gameIndex); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static const int ADD_SERVER_BUTTON_INDEX = 0; enum eAddServerPhase { eAddServer_Idle, eAddServer_IP, eAddServer_Port, eAddServer_Name }; eAddServerPhase m_addServerPhase; @@ -412,7 +412,7 @@ private: static int CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); #endif -#if defined _XBOX_ONE || defined __ORBIS__ || defined(_WINDOWS64) +#if defined _XBOX_ONE || defined __ORBIS__ || (defined(_WINDOWS64) || defined(__linux__)) static int CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); static int CopySaveThreadProc( LPVOID lpParameter ); static int CopySaveDataReturned( LPVOID lpParameter, bool success, C4JStorage::ESaveGameState state ); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 49da13ca..0b6fa052 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -87,7 +87,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_CurrentDifficulty=app.GetGameSettings(m_iPad,eGameSetting_Difficulty); WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); + swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); m_MoreOptionsParams.bGenerateOptions=FALSE; @@ -148,7 +148,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye { // The profile settings say Online, but either the player is offline, or they are not allowed to play online m_MoreOptionsParams.bOnlineSettingChangedBySystem=true; - } + } } // Set up online game checkbox @@ -188,7 +188,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye if(dwImageBytes > 0 && pbImageData) { wchar_t textureName[64]; - swprintf(textureName,64,L"loadsave"); + swprintf(textureName,64,L"loadsave"); registerSubstitutionTexture(textureName,pbImageData,dwImageBytes); m_bitmapIcon.setTextureName( textureName ); } @@ -215,7 +215,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye dstlen=MAX_SAVEFILENAME_LENGTH; #ifdef __PS3__ L10nResult lres= UTF8stoUTF16s((uint8_t *)params->saveDetails->UTF8SaveFilename,&srclen,u16Message,&dstlen); -#elif defined(_DURANGO) +#elif defined(_DURANGO) // Already utf16 on durango memcpy(u16Message,params->saveDetails->UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); #else // __ORBIS__ @@ -256,7 +256,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_labelGameName.init(wSaveName); #endif #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (params->saveDetails != nullptr && params->saveDetails->UTF8SaveName[0] != '\0') { wchar_t wSaveName[128]; @@ -341,7 +341,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #else if(!m_bAvailableTexturePacksChecked) #endif - { + { DLC_INFO *pDLCInfo=nullptr; // first pass - look to see if there are any that are not in the list @@ -489,7 +489,7 @@ void UIScene_LoadMenu::tick() if(szSeed[0]!=0) { WCHAR TempString[256]; - swprintf( (WCHAR *)TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); + swprintf( (WCHAR *)TempString, 256, L"%ls: %hs", app.GetString( IDS_SEED ),szSeed); m_labelSeed.setLabel(TempString); } else @@ -689,7 +689,7 @@ int UIScene_LoadMenu::ContinueOffline(void *pParam,int iPad,C4JStorage::EMessage UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { pClass->m_MoreOptionsParams.bOnlineGame=false; pClass->LoadDataComplete(pClass); @@ -719,13 +719,13 @@ void UIScene_LoadMenu::handleInput(int iPad, int key, bool repeat, bool pressed, #ifdef __ORBIS__ case ACTION_MENU_TOUCHPAD_PRESS: #endif - + // 4J-JEV: Inform user why their game must be offline. #if defined _XBOX_ONE if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() ) { UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); } #endif @@ -928,7 +928,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() TelemetryManager->RecordUpsellPresented(m_iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif -#if defined(_WINDOWS64) || defined(_DURANGO) +#if defined(_WINDOWS64) || defined(_DURANGO) || defined(__linux__) // trial pack warning UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -946,38 +946,38 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() #endif return; } - } + } } - app.SetGameHostOption(eGameHostOption_WasntSaveOwner, (!m_bIsSaveOwner)); + app.SetGameHostOption(eGameHostOption_WasntSaveOwner, (!m_bIsSaveOwner)); #if defined _XBOX_ONE || defined __ORBIS__ app.SetGameHostOption(eGameHostOption_DisableSaving, m_MoreOptionsParams.bDisableSaving?1:0); StorageManager.SetSaveDisabled(m_MoreOptionsParams.bDisableSaving); #endif -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 +#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 || defined(__linux__) int newWorldSize = 0; int newHellScale = 0; switch(m_MoreOptionsParams.newWorldSize) { - case e_worldSize_Unknown: + case e_worldSize_Unknown: newWorldSize = 0; newHellScale = 0; break; - case e_worldSize_Classic: - newWorldSize = LEVEL_WIDTH_CLASSIC; + case e_worldSize_Classic: + newWorldSize = LEVEL_WIDTH_CLASSIC; newHellScale = HELL_LEVEL_SCALE_CLASSIC; break; - case e_worldSize_Small: - newWorldSize = LEVEL_WIDTH_SMALL; + case e_worldSize_Small: + newWorldSize = LEVEL_WIDTH_SMALL; newHellScale = HELL_LEVEL_SCALE_SMALL; break; - case e_worldSize_Medium: - newWorldSize = LEVEL_WIDTH_MEDIUM; + case e_worldSize_Medium: + newWorldSize = LEVEL_WIDTH_MEDIUM; newHellScale = HELL_LEVEL_SCALE_MEDIUM; break; - case e_worldSize_Large: - newWorldSize = LEVEL_WIDTH_LARGE; + case e_worldSize_Large: + newWorldSize = LEVEL_WIDTH_LARGE; newHellScale = HELL_LEVEL_SCALE_LARGE; break; default: @@ -1061,7 +1061,7 @@ bool UIScene_LoadMenu::canMoveSlider(F64 sliderId) { if (sliderId == eControl_GameMode && m_bHardcore) return false; - + return true; } @@ -1145,7 +1145,7 @@ void UIScene_LoadMenu::handleTimerComplete(int id) if(iImageDataBytes!=0) { - // set the image + // set the image registerSubstitutionTexture(textureName,pbImageData,iImageDataBytes,true); // add an item in m_texturePackList.addPack(m_iConfigA[i],textureName); @@ -1165,7 +1165,7 @@ void UIScene_LoadMenu::handleTimerComplete(int id) bool bAllDone=true; for(int i=0;i(pParam); // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) + if(result==C4JStorage::EMessage_ResultDecline) { // continue and reset the nether pClass->ConfirmResetEndOrLaunch(); @@ -1314,7 +1314,7 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes { UIScene_LoadMenu* pClass = static_cast(pParam); - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { if(pClass->m_levelGen != nullptr) { @@ -1333,7 +1333,7 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes #if TO_BE_IMPLEMENTED if(eLoadStatus==C4JStorage::ELoadGame_DeviceRemoved) { - // disable saving + // disable saving StorageManager.SetSaveDisabled(true); StorageManager.SetSaveDeviceSelected(m_iPad,false); UINT uiIDA[1]; @@ -1479,7 +1479,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; + param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); iResult=sceNpCommerceDialogOpen(¶m); @@ -1490,10 +1490,10 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::PSPlusReturned,pClass, app.GetStringTable(),nullptr,0,false); } -#endif +#endif else { - + #if defined(__ORBIS__) || defined(__PSVITA__) if(isOnlineGame) { @@ -1548,7 +1548,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) SceNpCommerceDialogParam param; sceNpCommerceDialogParamInitialize(¶m); param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; + param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); iResult=sceNpCommerceDialogOpen(¶m); @@ -1561,7 +1561,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) #endif else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On Windows64, IsSignedInLive() returns true as a stub but Xbox Live is // not available. Skip QuadrantSignin and proceed directly with local play. DWORD dwLocalUsersMask = CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); @@ -1614,7 +1614,7 @@ int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bI // show the message that trophies are disabled UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage(IDS_SAVEDATA_COPIED_TITLE, IDS_SAVEDATA_COPIED_TEXT, uiIDA, 1, + ui.RequestErrorMessage(IDS_SAVEDATA_COPIED_TITLE, IDS_SAVEDATA_COPIED_TEXT, uiIDA, 1, pClass->m_iPad,&UIScene_LoadMenu::TrophyDialogReturned,pClass); app.SetGameHostOption(eGameHostOption_WasntSaveOwner, true); #endif @@ -1635,7 +1635,7 @@ int UIScene_LoadMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage: UIScene_LoadMenu* pClass = static_cast(pParam); // results switched for this dialog - if(result==C4JStorage::EMessage_ResultDecline) + if(result==C4JStorage::EMessage_ResultDecline) { PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[(int)pClass->m_iSaveGameInfoIndex],UIScene_LoadMenu::DeleteSaveDataReturned,pClass); @@ -1667,7 +1667,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal TelemetryManager->RecordLevelResume(pClass->m_iPad, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, app.GetGameSettings(pClass->m_iPad,eGameSetting_Difficulty), app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount(), saveOrCheckpointId); } else - { + { StorageManager.ResetSaveData(); // Make our next save default to the name of the level StorageManager.SetSaveTitle(pClass->m_levelGen->getDefaultSaveName().c_str()); @@ -1686,7 +1686,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // 4J Added: Store save folder name for potential hardcore world deletion app.DebugPrintf("StartGameFromSave: pSaveDetails=%p, levelGen=%p, saveInfoIndex=%d\n", pSaveDetails, pClass->m_levelGen, pClass->m_iSaveGameInfoIndex); if (pSaveDetails != nullptr && pClass->m_levelGen == nullptr) @@ -1706,7 +1706,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal NetworkGameInitData *param = new NetworkGameInitData(); param->seed = pClass->m_seed; - param->saveData = nullptr; + param->saveData = nullptr; param->levelGen = pClass->m_levelGen; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; param->levelName = pClass->m_levelName; @@ -1757,7 +1757,7 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal param->settings = app.GetGameHostOption( eGameHostOption_All ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { extern wchar_t g_Win64UsernameW[17]; Minecraft::GetInstance()->user->name = g_Win64UsernameW; @@ -1943,7 +1943,7 @@ int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM UIScene_LoadMenu* pClass = (UIScene_LoadMenu *)pParam; pClass->m_bIgnoreInput = false; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadMenu::StartGame_SignInReturned, pClass, false, iPad); } @@ -1955,29 +1955,29 @@ int UIScene_LoadMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM // { // int32_t iResult; // UIScene_LoadMenu *pClass = (UIScene_LoadMenu *)pParam; -// +// // // continue offline, or upsell PS Plus? -// if(result==C4JStorage::EMessage_ResultDecline) +// if(result==C4JStorage::EMessage_ResultDecline) // { // // upsell psplus // iResult=sceNpCommerceDialogInitialize(); -// +// // SceNpCommerceDialogParam param; // sceNpCommerceDialogParamInitialize(¶m); // param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; -// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; +// param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; // param.userId = ProfileManager.getUserID(pClass->m_iPad); -// -// +// +// // iResult=sceNpCommerceDialogOpen(¶m); // } -// else if(result==C4JStorage::EMessage_ResultAccept) +// else if(result==C4JStorage::EMessage_ResultAccept) // { // // continue offline // pClass->m_MoreOptionsParams.bOnlineGame=false; // pClass->LoadDataComplete(pClass); // } -// +// // pClass->m_bIgnoreInput=false; // return 0; // } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index a9cf2211..9ca854b4 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -14,7 +14,7 @@ #include "../../TexturePack.h" #include "../Network/SessionInfo.h" #include "UICustomStrings.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "SocialOnlineService.h" #endif #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) @@ -29,7 +29,7 @@ #include "message_dialog.h" #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../../Minecraft.World/NbtIo.h" #include "../../../Minecraft.World/compression.h" #include "../Network/ExternalServerList.h" @@ -249,7 +249,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_controlJoinTimer.setVisible( true ); -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, MAXIMUM_SAVE_STORAGE); #endif m_bUpdateSaveSize = false; @@ -296,7 +296,7 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer } #endif -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) || defined(__linux__) // Always clear the saves when we enter this menu StorageManager.ClearSavesInfo(); #endif @@ -544,7 +544,7 @@ void UIScene_LoadOrJoinMenu::Initialise() { m_iSaveListIndex = 0; m_iGameListIndex = 0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_addServerPhase = eAddServer_Idle; #endif @@ -650,7 +650,7 @@ void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) if( m_bMultiplayerAllowed ) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Refresh the games list immediately so that any server // edits/deletions made in the JoinMenu are visible now. UpdateGamesList(); @@ -712,7 +712,7 @@ void UIScene_LoadOrJoinMenu::tick() } } -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) +#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined(__linux__) || defined __PSVITA__) if(m_bExitScene) // navigate forward or back { if(!m_bRetrievingSaveThumbnails) @@ -729,7 +729,7 @@ void UIScene_LoadOrJoinMenu::tick() if(m_eSaveTransferState == eSaveTransfer_Idle) m_bSaveTransferRunning = false; #endif -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) if(m_bUpdateSaveSize) { if((m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) @@ -750,7 +750,7 @@ void UIScene_LoadOrJoinMenu::tick() if(m_pSaveDetails!=nullptr) { //CD - Fix - Adding define for ORBIS/XBOXONE -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) m_spaceIndicatorSaves.reset(); #endif @@ -772,7 +772,7 @@ void UIScene_LoadOrJoinMenu::tick() m_saveDetails = new SaveListDetails[m_pSaveDetails->iSaveC]; m_iSaveDetailsCount = m_pSaveDetails->iSaveC; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Build sorted index array (newest-first by filename timestamp YYYYMMDDHHMMSS) int *sortedIdx = new int[m_pSaveDetails->iSaveC]; for (int si = 0; si < (int)m_pSaveDetails->iSaveC; ++si) sortedIdx[si] = si; @@ -792,7 +792,7 @@ void UIScene_LoadOrJoinMenu::tick() { #if defined(_XBOX_ONE) m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64)|| defined(__linux__) int origIdx = sortedIdx[i]; wchar_t wFilename[MAX_SAVEFILENAME_LENGTH]; ZeroMemory(wFilename, sizeof(wFilename)); @@ -827,7 +827,7 @@ void UIScene_LoadOrJoinMenu::tick() memcpy(m_saveDetails[i].UTF16SaveName, m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, 128); memcpy(m_saveDetails[i].UTF16SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { bool saveHardcore = false; wstring levelName = ReadLevelNameFromSaveFile(filePath, &saveHardcore); @@ -857,7 +857,7 @@ void UIScene_LoadOrJoinMenu::tick() #endif #endif } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) delete[] sortedIdx; #endif m_controlSavesTimer.setVisible( false ); @@ -875,7 +875,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting the first thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); #else C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); @@ -901,7 +901,7 @@ void UIScene_LoadOrJoinMenu::tick() #ifdef _DURANGO // Already utf16 on durango memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) int result = ::MultiByteToWideChar( CP_UTF8, // convert from UTF-8 MB_ERR_INVALID_CHARS, // error on invalid chars @@ -942,7 +942,7 @@ void UIScene_LoadOrJoinMenu::tick() app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); #else C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); @@ -1236,7 +1236,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr } } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL) if(pressed && !repeat && ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled()) { @@ -1463,7 +1463,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo { uint16_t ui16Text[128]; ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(ui16Text, 128); #else InputManager.GetText(ui16Text); @@ -1475,7 +1475,7 @@ int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,boo #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__)) // open the save and overwrite the metadata StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadOrJoinMenu::RenameSaveDataReturned,pClass); -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) { int listPos = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; @@ -1537,7 +1537,7 @@ void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { case eControl_GamesList: m_iGameListIndex = childId; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Offset past the "Add Server" button so m_iGameListIndex is a session index m_iGameListIndex -= 1; #endif @@ -1668,7 +1668,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) break; case eControl_GamesList: { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (static_cast(childId) == ADD_SERVER_BUTTON_INDEX) { ui.PlayUISFX(eSFX_Press); @@ -1685,7 +1685,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { int nIndex = static_cast(childId); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Offset by 1 because the "Add Server" button is at index 0 nIndex -= 1; #endif @@ -1828,7 +1828,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) m_initData->iPad = 0;; m_initData->selectedSession = m_currentSessions->at( gameIndex ); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_initData->serverIndex = m_initData->selectedSession->savedServerIndex; { FriendSessionInfo *session = m_initData->selectedSession; @@ -1986,7 +1986,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // If a texture pack is loading, or will be loading, then ignore this ( we are going to be destroyed anyway) if( Minecraft::GetInstance()->skins->getSelected()->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) ) return; -#if !defined(_WINDOWS64) +#if !defined(_WINDOWS64) && !defined(__linux__) // if we're retrieving save info, don't show the list yet as we will be ignoring press events if(!m_bSavesDisplayed) { @@ -1999,7 +1999,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() if(DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { unsigned int nIndex = m_buttonListGames.getCurrentSelection(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Offset past the "Add Server" button if (nIndex > 0) pSelectedSession = m_currentSessions->at( nIndex - 1 ); @@ -2087,7 +2087,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() // clear out the games list and re-fill m_buttonListGames.clearList(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Always add the "Add Server" button as the first entry in the games list m_buttonListGames.addItem(wstring(L"Add Server")); #endif @@ -2157,7 +2157,7 @@ void UIScene_LoadOrJoinMenu::UpdateGamesList() if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Offset past the "Add Server" button m_buttonListGames.setCurrentSelection(sessionIndex + 1); #else @@ -2220,7 +2220,7 @@ void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { case JOIN_LOAD_ONLINE_TIMER_ID: { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_currentSessions == nullptr) { UpdateGamesList(); @@ -2444,7 +2444,7 @@ void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() #endif //SONY_REMOTE_STORAGE_DOWNLOAD -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) { wchar_t wSearch[MAX_PATH]; @@ -2485,7 +2485,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JSt } else { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { // Use m_saveDetails (sorted display order) so the correct folder is targeted int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; @@ -2578,7 +2578,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS case C4JStorage::EMessage_ResultDecline: // rename { pClass->m_bIgnoreInput=true; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { wchar_t wSaveName[128]; ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); @@ -4218,7 +4218,7 @@ int UIScene_LoadOrJoinMenu::CopySaveErrorDialogFinishedCallback(void *pParam,int } #endif // _XBOX_ONE -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // adding servers bellow void UIScene_LoadOrJoinMenu::BeginAddServer() @@ -4346,4 +4346,4 @@ void UIScene_LoadOrJoinMenu::AppendServerToFile(const wstring& ip, const wstring if (!ExternalServerList::Append(entry)) app.DebugPrintf("Failed to save the external server list."); } -#endif // _WINDOWS64 \ No newline at end of file +#endif // _WINDOWS64 diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index 6c93f542..a191c731 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h @@ -1,7 +1,7 @@ #pragma once #include "UIScene.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "UIScene_EditServerMenu.h" #endif @@ -10,7 +10,7 @@ class LevelGenerationOptions; #if defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__) #define SONY_REMOTE_STORAGE_DOWNLOAD -#endif +#endif #if defined __PS3__ || __PSVITA__ #define SONY_REMOTE_STORAGE_UPLOAD #endif @@ -23,7 +23,7 @@ private: { eControl_SavesList, eControl_GamesList, -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) eControl_SpaceIndicator, #endif }; @@ -55,12 +55,12 @@ protected: UIControl_SaveList m_buttonListGames; UIControl_Label m_labelSavesListTitle, m_labelJoinListTitle, m_labelNoGames; UIControl m_controlSavesTimer, m_controlJoinTimer; -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) UIControl_SpaceIndicatorBar m_spaceIndicatorSaves; #endif private: - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_buttonListSaves, "SavesList") UI_MAP_ELEMENT( m_buttonListGames, "JoinList") @@ -71,7 +71,7 @@ private: UI_MAP_ELEMENT( m_controlSavesTimer, "SavesTimer") UI_MAP_ELEMENT( m_controlJoinTimer, "JoinTimer") -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(__linux__) UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar") #endif UI_END_MAP_ELEMENTS_AND_NAMES() @@ -83,7 +83,7 @@ private: vector *m_currentSessions; vector m_generators; vector *m_saves; - + bool m_bIgnoreInput; bool m_bAllLoaded; bool m_bRetrievingSaveThumbnails; @@ -112,7 +112,7 @@ private: public: UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer *parentLayer); virtual ~UIScene_LoadOrJoinMenu(); - + virtual void updateTooltips(); virtual void updateComponents(); @@ -183,7 +183,7 @@ public: private: void CheckAndJoinGame(int gameIndex); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static const int ADD_SERVER_BUTTON_INDEX = 0; enum eAddServerPhase { eAddServer_Idle, eAddServer_IP, eAddServer_Port, eAddServer_Name }; eAddServerPhase m_addServerPhase; @@ -201,7 +201,7 @@ private: static int PSN_SignInReturned(void *pParam,bool bContinue, int iPad); static void remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); #endif - + #ifdef __ORBIS__ //static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index 4caa6739..bd935ce5 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "../../Lighting.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/Iggy/gdraw/gdraw_d3d11.h" #include "../../Windows64/4JLibs/inc/4J_Render.h" #endif @@ -46,7 +46,7 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye app.SetReachedMainMenu(); #endif - + m_buttons[static_cast(eControl_Achievements)].init( (UIString)IDS_ACHIEVEMENTS,eControl_Achievements); m_buttons[static_cast(eControl_Social)].init(L"Social", eControl_Social); m_buttons[static_cast(eControl_HelpAndOptions)].init(IDS_HELP_AND_OPTIONS,eControl_HelpAndOptions); @@ -171,7 +171,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) handleReload(); ui.ShowPlayerDisplayname(false); m_bIgnorePress=false; - + if (eNavigateWhenReady >= 0) { return; @@ -197,7 +197,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) #ifdef _DURANGO ProfileManager.ClearGameUsers(); #endif - + if(navBack && ProfileManager.IsFullVersion()) { // Replace the Unlock Full Game with Downloadable Content @@ -213,7 +213,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) // 4J-PB - remove the "hobo humping" message legal say we can't have, and the 1080p one for Vita #ifdef __PSVITA__ - int splashIndex = eSplashRandomStart + 2 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 2) ); + int splashIndex = eSplashRandomStart + 2 + random->nextInt( (int)m_splashes.size() - (eSplashRandomStart + 2) ); #else int splashIndex = eSplashRandomStart + 1 + random->nextInt( static_cast(m_splashes.size()) - (eSplashRandomStart + 1) ); #endif @@ -270,7 +270,7 @@ void UIScene_MainMenu::handleReload() void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); - + if ( m_bIgnorePress || (eNavigateWhenReady >= 0) ) return; #if defined (__ORBIS__) || defined (__PSVITA__) @@ -304,7 +304,7 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, #endif #ifdef __PSVITA__ case ACTION_MENU_X: - if(pressed && ProfileManager.IsFullVersion()) + if(pressed && ProfileManager.IsFullVersion()) { UINT uiIDA[2]; uiIDA[0]=IDS__NETWORK_PSN; @@ -324,7 +324,7 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { int primaryPad = ProfileManager.GetPrimaryPad(); - + #ifdef _XBOX_ONE int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = nullptr; #else @@ -349,7 +349,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned; -#endif +#endif break; case eControl_MiniGames: #ifdef __ORBIS__ @@ -367,11 +367,11 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); signInReturnedFunc = &UIScene_MainMenu::CreateLoad_SignInReturned; -#endif +#endif break; case eControl_Social: ui.PlayUISFX(eSFX_Press); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) proceedToScene(primaryPad, eUIScene_SocialMenu); #endif break; @@ -429,7 +429,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) default: DEBUG_BREAK(); } - + bool confirmUser = false; // Note: if no sign in returned func, assume this isn't required @@ -567,7 +567,7 @@ void UIScene_MainMenu::render(S32 width, S32 height, C4JRender::eViewportType vi S32 sw = ssc.getWidth(); S32 sh = ssc.getHeight(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) RenderManager.StartFrame(); gdraw_D3D11_setViewport_4J(); #endif @@ -609,17 +609,17 @@ int UIScene_MainMenu::MustSignInReturned(void *pParam, int iPad, C4JStorage::EMe { UIScene_MainMenu* pClass = static_cast(pParam); - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { // we need to specify local game here to display local and LIVE profiles in the list switch(pClass->m_eAction) { case eAction_RunGame: ProfileManager.RequestSignInUI(false, true, false, false, true, &UIScene_MainMenu::CreateLoad_SignInReturned, pClass, iPad ); break; - case eAction_RunHelpAndOptions: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::HelpAndOptions_SignInReturned, pClass, iPad ); break; - case eAction_RunLeaderboards: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Leaderboards_SignInReturned, pClass, iPad ); break; - case eAction_RunAchievements: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Achievements_SignInReturned, pClass, iPad ); break; - case eAction_RunUnlockOrDLC: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass, iPad ); break; -#ifdef _DURANGO + case eAction_RunHelpAndOptions: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::HelpAndOptions_SignInReturned, pClass, iPad ); break; + case eAction_RunLeaderboards: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Leaderboards_SignInReturned, pClass, iPad ); break; + case eAction_RunAchievements: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::Achievements_SignInReturned, pClass, iPad ); break; + case eAction_RunUnlockOrDLC: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::UnlockFullGame_SignInReturned, pClass, iPad ); break; +#ifdef _DURANGO case eAction_RunXboxHelp: ProfileManager.RequestSignInUI(false, false, true, false, true, &UIScene_MainMenu::XboxHelp_SignInReturned, pClass, iPad ); break; #endif } @@ -637,7 +637,7 @@ int UIScene_MainMenu::MustSignInReturned(void *pParam, int iPad, C4JStorage::EMe ProfileManager.SetCurrentGameActivity(i, CONTEXT_PRESENCE_MENUS, false); } } - } + } return 0; } @@ -647,7 +647,7 @@ int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { #ifdef __PS3__ // we need to specify local game here to display local and LIVE profiles in the list @@ -712,7 +712,7 @@ int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM #endif } - else + else { if( pClass->m_eAction == eAction_RunGamePSN ) { @@ -722,7 +722,7 @@ int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM CreateLoad_SignInReturned(pClass, true, 0); } else - { + { pClass->m_bIgnorePress=false; } } @@ -759,7 +759,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, { // Changing to async TMS calls app.SetTMSAction(iPad,eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions); - + // block all input pClass->m_bIgnorePress=true; // We want to hide everything in this scene and display a timer until we get a completion for the TMS files @@ -767,9 +767,9 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, { pClass->m_Buttons[i].SetShow(FALSE); } - + pClass->updateTooltips(); - + pClass->m_Timer.SetShow(TRUE); } #endif @@ -787,7 +787,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); } } - } + } return 0; } @@ -809,7 +809,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #endif { UIScene_MainMenu* pClass = static_cast(pParam); - + if(bContinue) { // 4J-JEV: We only need to update rich-presence if the sign-in status changes. @@ -837,7 +837,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(CGameNetworkManager::usingAdhocMode()) { if(SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { + { bSignedInLive = true; } else @@ -949,7 +949,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in // offline ProfileManager.DisplayOfflineProfile(&CScene_Main::CreateLoad_OfflineProfileReturned,pClass, ProfileManager.GetPrimaryPad() ); #else - app.DebugPrintf("Offline Profile returned not implemented\n"); + app.DebugPrintf("Offline Profile returned not implemented\n"); #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif @@ -1000,7 +1000,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in } } - } + } return 0; } @@ -1037,9 +1037,9 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in ProfileManager.GetChatAndContentRestrictions(iPad,true,nullptr,&bContentRestricted,nullptr); #endif if(bContentRestricted) - { + { pClass->m_bIgnorePress=false; -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE) ) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_XBOX_ONE) ) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -1070,7 +1070,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in } } - } + } return 0; } @@ -1104,7 +1104,7 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in } } - } + } return 0; } @@ -1137,7 +1137,7 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue, } } - } + } return 0; } @@ -1165,7 +1165,7 @@ int UIScene_MainMenu::XboxHelp_SignInReturned(void *pParam, bool bContinue, int ProfileManager.SetCurrentGameActivity(i,CONTEXT_PRESENCE_MENUS,false); } } - } + } return 0; } @@ -1176,7 +1176,7 @@ int UIScene_MainMenu::ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessag //UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; // buttons reversed on this - if(result==C4JStorage::EMessage_ResultDecline) + if(result==C4JStorage::EMessage_ResultDecline) { //XLaunchNewImage(XLAUNCH_KEYWORD_DASH_ARCADE, 0); app.ExitGame(); @@ -1219,14 +1219,14 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * pClass->m_bRunGameChosen=true; pClass->m_bErrorDialogRunning=true; int32_t ret=sceErrorDialogInitialize(); - if ( ret==SCE_OK ) + if ( ret==SCE_OK ) { SceErrorDialogParam param; sceErrorDialogParamInitialize( ¶m ); // 4J-PB - We want to display the option to get the patch now param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) + if ( ret == SCE_OK ) { ret=sceErrorDialogOpen( ¶m ); } @@ -1307,14 +1307,14 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo { int32_t ret=sceErrorDialogInitialize(); pClass->m_bErrorDialogRunning=true; - if ( ret==SCE_OK ) + if ( ret==SCE_OK ) { SceErrorDialogParam param; sceErrorDialogParamInitialize( ¶m ); // 4J-PB - We want to display the option to get the patch now param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) + if ( ret == SCE_OK ) { ret=sceErrorDialogOpen( ¶m ); } @@ -1372,7 +1372,7 @@ int UIScene_MainMenu::PlayOfflineReturned(void *pParam, int iPad, C4JStorage::EM if(result==C4JStorage::EMessage_ResultAccept) { if (pClass->m_eAction == eAction_RunGame) - { + { CreateLoad_SignInReturned(pClass, true, 0); } else @@ -1381,7 +1381,7 @@ int UIScene_MainMenu::PlayOfflineReturned(void *pParam, int iPad, C4JStorage::EM } } else - { + { pClass->m_bIgnorePress=false; } @@ -1402,7 +1402,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { UINT uiIDA[1]; uiIDA[0]=IDS_OK; - + m_bIgnorePress=false; ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } @@ -1452,8 +1452,8 @@ void UIScene_MainMenu::RunPlayGame(int iPad) #ifdef __PSVITA__ if(CGameNetworkManager::usingAdhocMode()) - { - uiIDA[0]=IDS_NETWORK_ADHOC; + { + uiIDA[0]=IDS_NETWORK_ADHOC; // this should be "Connect to adhoc network" ui.RequestErrorMessage(IDS_PRO_NOTADHOCONLINE_TITLE, IDS_PRO_NOTADHOCONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); } @@ -1471,14 +1471,14 @@ void UIScene_MainMenu::RunPlayGame(int iPad) ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this, app.GetStringTable()); } else - { + { m_eAction=eAction_RunGamePSN; // Not signed in to PSN ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); return; } */ ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); - + } #else @@ -1499,7 +1499,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this); } else - { + { m_eAction=eAction_RunGamePSN; // Not signed in to PSN UINT uiIDA[2]; @@ -1625,7 +1625,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) { UINT uiIDA[1]; uiIDA[0]=IDS_OK; - + // guests can't look at leaderboards if(ProfileManager.IsGuest(iPad)) { @@ -1652,7 +1652,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) ui.RequestMessageBox(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); } else - { + { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; @@ -1672,7 +1672,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else - { + { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; @@ -1684,7 +1684,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) #endif } else - { + { // we're supposed to check for parental control restrictions before showing leaderboards // The title enforces the user's NP parental control setting for age-based content //restriction in network communications. @@ -1698,7 +1698,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -1748,14 +1748,14 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) int32_t ret=sceErrorDialogInitialize(); m_bErrorDialogRunning=true; - if ( ret==SCE_OK ) + if ( ret==SCE_OK ) { SceErrorDialogParam param; sceErrorDialogParamInitialize( ¶m ); // 4J-PB - We want to display the option to get the patch now param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) + if ( ret == SCE_OK ) { ret=sceErrorDialogOpen( ¶m ); } @@ -1803,7 +1803,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) if(bContentRestricted) { m_bIgnorePress=false; -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; @@ -1872,7 +1872,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else - { + { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; @@ -1916,7 +1916,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else - { + { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; @@ -1954,10 +1954,10 @@ void UIScene_MainMenu::tick() if ( (eNavigateWhenReady >= 0) ) { - + int lockedProfile = ProfileManager.GetLockedProfile(); -#ifdef _DURANGO +#ifdef _DURANGO // 4J-JEV: DLC menu contains text localised to system language which we can't change. // We need to switch to this language in-case it uses a different font. if (eNavigateWhenReady == eUIScene_DLCMainMenu) setLanguageOverride(false); @@ -1986,7 +1986,7 @@ void UIScene_MainMenu::tick() if ( (lockedProfile >= 0) && isSignedIn && ((status == C4JStorage::eOptions_Callback_Read)||(status == C4JStorage::eOptions_Callback_Write)) - && !pendingFontChange + && !pendingFontChange ) #endif { @@ -1997,7 +1997,7 @@ void UIScene_MainMenu::tick() #ifdef _DURANGO else { - app.DebugPrintf("[MainMenu] Delaying navigation: lockedProfile=%i, %s, status=%ls, %s.\n", + app.DebugPrintf("[MainMenu] Delaying navigation: lockedProfile=%i, %s, status=%ls, %s.\n", lockedProfile, isSignedIn ? "SignedIn" : "SignedOut", app.toStringOptionsStatus(status).c_str(), @@ -2047,9 +2047,9 @@ void UIScene_MainMenu::tick() #if defined _XBOX_ONE if(m_bWaitingForDLCInfo) - { + { if(app.GetTMSDLCInfoRead()) - { + { m_bWaitingForDLCInfo=false; ProfileManager.SetLockedProfile(m_iPad); proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_DLCMainMenu); @@ -2069,9 +2069,9 @@ void UIScene_MainMenu::tick() // process the error dialog (for a patch being available) // SQRNetworkManager_Orbis::tickErrorDialog also runs the error dialog, so wrap this so this doesn't terminate a signin dialog if(m_bErrorDialogRunning) - { + { SceErrorDialogStatus stat = sceErrorDialogUpdateStatus(); - if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED ) + if( stat == SCE_ERROR_DIALOG_STATUS_FINISHED ) { sceErrorDialogTerminate(); // if m_bRunGameChosen is true, we're here after selecting play game, and we should let the user continue with an offline game @@ -2165,7 +2165,7 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) } void UIScene_MainMenu::LoadTrial(void) -{ +{ app.SetTutorialMode( true ); // clear out the app's terrain features list @@ -2178,7 +2178,7 @@ void UIScene_MainMenu::LoadTrial(void) // No saving in the trial StorageManager.SetSaveDisabled(true); - app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); + app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); // Set the global flag, so that we don't disable saving again once the save is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); @@ -2215,7 +2215,7 @@ void UIScene_MainMenu::LoadTrial(void) loadingParams->completionData = completionData; ui.ShowTrialTimer(true); - + #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif @@ -2233,12 +2233,12 @@ int UIScene_MainMenu::SelectNetworkModeReturned(void *pParam,int iPad,C4JStorage { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) + if(result==C4JStorage::EMessage_ResultAccept) { app.DebugPrintf("Setting network mode to PSN\n"); app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 0); } - else if(result==C4JStorage::EMessage_ResultDecline) + else if(result==C4JStorage::EMessage_ResultDecline) { app.DebugPrintf("Setting network mode to Adhoc\n"); app.SetGameSettings(0, eGameSetting_PSVita_NetworkModeAdhoc, 1); diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index f528d1e2..bd53fde3 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -35,7 +35,7 @@ UIScene_PauseMenu::UIScene_PauseMenu(int iPad, void *initData, UILayer *parentLa m_buttons[BUTTON_PAUSE_RESUMEGAME].init(app.GetString(IDS_RESUME_GAME),BUTTON_PAUSE_RESUMEGAME); m_buttons[BUTTON_PAUSE_HELPANDOPTIONS].init(app.GetString(IDS_HELP_AND_OPTIONS),BUTTON_PAUSE_HELPANDOPTIONS); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_buttons[BUTTON_PAUSE_LEADERBOARDS].init(L"Friends",BUTTON_PAUSE_LEADERBOARDS); #else m_buttons[BUTTON_PAUSE_LEADERBOARDS].init(app.GetString(IDS_LEADERBOARDS),BUTTON_PAUSE_LEADERBOARDS); @@ -538,7 +538,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) navigateBack(); break; case BUTTON_PAUSE_LEADERBOARDS: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) ui.NavigateToScene(m_iPad, eUIScene_InGameFriendsMenu); break; #endif @@ -623,7 +623,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; diff --git a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp index b4012e3d..5aa20a95 100644 --- a/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ReinstallMenu.cpp @@ -91,7 +91,7 @@ void UIScene_ReinstallMenu::handlePress(F64 controlId, F64 childId) ui.NavigateToScene(m_iPad, eUIScene_HowToPlayMenu); break; case BUTTON_HAO_CONTROLS: -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) ui.NavigateToScene(m_iPad, eUIScene_BindingsTypeMenu); #else ui.NavigateToScene(m_iPad, eUIScene_ControlsMenu); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 19c4a2df..a4bfb555 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -5,7 +5,7 @@ #include "../../Options.h" #include "../../GameRenderer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) extern bool g_bVSync; extern void SetExclusiveFullscreen(bool enabled); #endif @@ -111,7 +111,7 @@ void UIScene_SettingsGraphicsMenu::tick() m_multiList.AddNewCheckbox(L"neoCosmetics", eControl_NeoCosmetics, (app.GetGameSettings(m_iPad, eGameSetting_NeoCosmetics) != 0)); m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG), eControl_BedrockFog, (app.GetGameSettings(m_iPad, eGameSetting_BedrockFog) != 0)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_multiList.AddNewCheckbox(L"VSync", eControl_VSync, (app.GetGameSettings(m_iPad, eGameSetting_VSync) != 0)); m_multiList.AddNewCheckbox(L"Fullscreen", eControl_ExclusiveFullscreen, (app.GetGameSettings(m_iPad, eGameSetting_ExclusiveFullscreen) != 0)); #endif @@ -300,7 +300,7 @@ void UIScene_SettingsGraphicsMenu::setGameSettings() app.SetGameSettings(m_iPad, eGameSetting_Gamma, m_multiList.GetSliderValue(eControl_Gamma)); app.SetGameSettings(m_iPad, eGameSetting_FOV, m_multiList.GetSliderValue(eControl_FOV)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) app.SetGameSettings(m_iPad, eGameSetting_VSync, m_multiList.GetCheckboxValue(eControl_VSync) ? 1 : 0); app.SetGameSettings(m_iPad, eGameSetting_ExclusiveFullscreen, m_multiList.GetCheckboxValue(eControl_ExclusiveFullscreen) ? 1 : 0); g_bVSync = m_multiList.GetCheckboxValue(eControl_VSync); diff --git a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp index 41bb3cfd..9d463ae9 100644 --- a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.cpp @@ -19,7 +19,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void *_initData, UILayer m_bConfirmed = false; m_bIgnoreInput = false; m_iSignCursorFrame = 0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_iActiveDirectEditLine = -1; m_bNeedsInitialEdit = true; m_bSkipTickNav = false; @@ -84,7 +84,7 @@ void UIScene_SignEntryMenu::tick() { UIScene::tick(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On first tick, auto-start editing line 1 if KBM is active (Java-style flow) if (m_bNeedsInitialEdit) { @@ -134,7 +134,7 @@ void UIScene_SignEntryMenu::tick() m_iSignCursorFrame++; if (m_iSignCursorFrame / 6 % 2 == 0) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_iActiveDirectEditLine >= 0) m_sign->SetSelectedLine(m_iActiveDirectEditLine); else @@ -165,7 +165,7 @@ void UIScene_SignEntryMenu::tick() for(int i=0;i<4;i++) { wstring temp=m_textInputLines[i].getLabel(); - m_sign->SetMessage(i,temp); + m_sign->SetMessage(i,temp); } m_sign->setChanged(); @@ -187,7 +187,7 @@ void UIScene_SignEntryMenu::tick() void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bConfirmed || m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) { handled = true; return; } #endif @@ -221,7 +221,7 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre case ACTION_MENU_UP: case ACTION_MENU_DOWN: sendInputToMovie(key, repeat, pressed, released); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Auto-start editing if focus moved to a line (e.g. UP from Confirm) if (g_KBMInput.IsKBMActive()) { @@ -242,7 +242,7 @@ void UIScene_SignEntryMenu::handleInput(int iPad, int key, bool repeat, bool pre } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_SignEntryMenu::getDirectEditInputs(vector &inputs) { for (int i = 0; i < 4; i++) @@ -313,7 +313,7 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) pClass->m_bIgnoreInput = false; if (bRes) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); Win64_GetKeyboardText(pchText, 128); @@ -330,7 +330,7 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(LPVOID lpParam,bool bRes) void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif switch(static_cast(controlId)) @@ -346,7 +346,7 @@ void UIScene_SignEntryMenu::handlePress(F64 controlId, F64 childId) case eControl_Line4: { m_iEditingLine = static_cast(controlId); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { // Only start editing from keyboard (Enter on focused line), not mouse clicks @@ -402,4 +402,4 @@ void UIScene_SignEntryMenu::handleDestroy() #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) InputManager.DestroyKeyboard(); #endif -} \ No newline at end of file +} diff --git a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.h b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.h index 4e1c2a5b..eb0a88c3 100644 --- a/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SignEntryMenu.h @@ -22,7 +22,7 @@ private: bool m_bConfirmed; bool m_bIgnoreInput; int m_iSignCursorFrame; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int m_iActiveDirectEditLine; bool m_bNeedsInitialEdit; bool m_bSkipTickNav; @@ -56,7 +56,7 @@ protected: public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); virtual bool handleMouseClick(F32 x, F32 y); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index d9fd92c9..75bc80d4 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -3,7 +3,7 @@ #include "UIScene_SkinSelectMenu.h" #include "../../../Minecraft.World/StringHelpers.h" #include "TexturePackRepository.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif #ifdef __ORBIS__ @@ -440,7 +440,7 @@ bool UIScene_SkinSelectMenu::handleMouseClick(F32 x, F32 y) return true; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_bMouseDragging = true; m_bMouseDragMoved = false; m_iMouseDragLastX = g_KBMInput.GetMouseX(); @@ -474,7 +474,7 @@ bool UIScene_SkinSelectMenu::slideSkin(bool next) void UIScene_SkinSelectMenu::tickMouseDrag() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!m_bMouseDragging) return; if (m_bIgnoreInput) { @@ -658,7 +658,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; diff --git a/Minecraft.Client/Common/UI/UIScene_SocialMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SocialMenu.cpp index e53a6c7e..e591ad08 100644 --- a/Minecraft.Client/Common/UI/UIScene_SocialMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SocialMenu.cpp @@ -6,7 +6,7 @@ #include "../../Minecraft.h" #include "../../Textures.h" #include "../../Tesselator.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #include "../../Windows64/Windows64_Xuid.h" @@ -126,7 +126,7 @@ UIScene_SocialMenu::UIScene_SocialMenu(int iPad, void *initData, UILayer *parent m_bNeedsFriendsRepopulate = false; m_bPendingAddFriend = false; m_bIgnoreInput = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_username = g_Win64UsernameW; #endif @@ -137,7 +137,7 @@ UIScene_SocialMenu::UIScene_SocialMenu(int iPad, void *initData, UILayer *parent IggyValueSetBooleanRS(m_editUsername.getIggyValuePath(), 0, "m_bDebugInput", true); m_editUsername.init(m_username, eControl_Username); m_editUsername.SetCharLimit(kUsernameLimit); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) m_editUsername.setCharFilter(&IsUsernameChar); #endif m_bOnlineProfileOn = LoadSettingFlag(kOnlineProfileFile, false); @@ -252,7 +252,7 @@ void UIScene_SocialMenu::updateDescription() bool online = SocialOnlineService::IsLinked() && m_bOnlineProfileOn; wstring uuid = L"Unknown"; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) unsigned long long xuid = online ? SocialOnlineService::GetOnlineId() : static_cast(Win64Xuid::ResolvePersistentXuid()); wchar_t buffer[32]; swprintf(buffer, 32, L"%016llX", xuid); @@ -407,7 +407,7 @@ void UIScene_SocialMenu::updateUsernameLabel() void UIScene_SocialMenu::syncUsernameMode() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (usingOnlineName()) { Win64_UseOnlineUsername(SocialOnlineService::GetLinkedName()); @@ -474,7 +474,7 @@ void UIScene_SocialMenu::applyUsername(const wstring &name) m_editUsername.setLabel(m_username); return; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_SetUsernameOverride(sanitized); m_username = Win64_GetLocalUsername(); #endif @@ -490,7 +490,7 @@ int UIScene_SocialMenu::UsernameKeyboardCallback(LPVOID lpParam, const bool bRes { uint16_t text[64]; ZeroMemory(text, sizeof(text)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(text, 64); #endif wstring name; @@ -505,7 +505,7 @@ void UIScene_SocialMenu::openKeyboard() { if (!checkUsernameEditable()) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (g_KBMInput.IsKBMActive()) { m_editUsername.beginDirectEdit(kUsernameLimit); @@ -531,7 +531,7 @@ int UIScene_SocialMenu::AddFriendKeyboardCallback(LPVOID lpParam, const bool bRe { uint16_t text[64]; ZeroMemory(text, sizeof(text)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(text, 64); #endif wstring name; @@ -545,7 +545,7 @@ int UIScene_SocialMenu::AddFriendKeyboardCallback(LPVOID lpParam, const bool bRe void UIScene_SocialMenu::openAddFriendKeyboard() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) UIKeyboardInitData kbData; kbData.title = L"Friend's Username"; kbData.defaultText = L""; @@ -948,7 +948,7 @@ void UIScene_SocialMenu::handleInput(int iPad, int key, bool repeat, bool presse { if (m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) { handled = true; @@ -1058,7 +1058,7 @@ void UIScene_SocialMenu::handlePress(F64 controlId, F64 childId) { if (m_bIgnoreInput) return; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (isDirectEditBlocking()) return; #endif @@ -1070,7 +1070,7 @@ void UIScene_SocialMenu::handlePress(F64 controlId, F64 childId) if (std::find(m_friendsSelectable.begin(), m_friendsSelectable.end(), static_cast(childId)) != m_friendsSelectable.end()) m_friendsSelection = static_cast(childId); ui.PlayUISFX(eSFX_Press); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_friendsSelection == eFriendsItem_AddFriend) { openAddFriendKeyboard(); @@ -1168,7 +1168,7 @@ void UIScene_SocialMenu::handleCheckboxToggled(F64 controlId, bool selected) } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void UIScene_SocialMenu::getDirectEditInputs(vector &inputs) { if (m_activeTab == eTab_Profile) diff --git a/Minecraft.Client/Common/UI/UIScene_SocialMenu.h b/Minecraft.Client/Common/UI/UIScene_SocialMenu.h index 5d37f467..7cef6a62 100644 --- a/Minecraft.Client/Common/UI/UIScene_SocialMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SocialMenu.h @@ -92,7 +92,7 @@ private: void tickStatusScroll(); wstring m_pendingFriendName; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) FriendMenuInitData m_friendMenuData; PendingRequestsInitData m_pendingRequestsData; #endif @@ -157,7 +157,7 @@ public: virtual UIControl* GetMainPanel(); virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleCheckboxToggled(F64 controlId, bool selected); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool handleMouseClick(F32 x, F32 y); virtual void getDirectEditInputs(vector &inputs); virtual void onDirectEditFinished(UIControl_TextInput *input, UIControl_TextInput::EDirectEditResult result); diff --git a/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.cpp index 672402dc..b9a1cf2a 100644 --- a/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.cpp @@ -4,7 +4,7 @@ #include "SuperflatData.h" #include "UICustomStrings.h" #include "../../../Minecraft.World/net.minecraft.world.item.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -71,7 +71,7 @@ UIScene_SuperflatEditLayerMenu::UIScene_SuperflatEditLayerMenu(int iPad, void *i m_heightLabel.init(L""); m_typeLabel.init(L""); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) g_KBMInput.SetScreenCursorHidden(true); g_KBMInput.SetCursorHiddenForUI(true); #endif @@ -79,7 +79,7 @@ UIScene_SuperflatEditLayerMenu::UIScene_SuperflatEditLayerMenu(int iPad, void *i void UIScene_SuperflatEditLayerMenu::handleDestroy() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) g_KBMInput.SetScreenCursorHidden(false); g_KBMInput.SetCursorHiddenForUI(false); #endif @@ -347,7 +347,7 @@ void UIScene_SuperflatEditLayerMenu::tick() return; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (m_bPopulated && hasFocus(m_iPad) && g_KBMInput.IsKBMActive() && !g_KBMInput.IsMouseGrabbed()) { int dx = g_KBMInput.GetMouseDeltaX(); @@ -645,7 +645,7 @@ void UIScene_SuperflatEditLayerMenu::handleSliderMove(F64 sliderId, F64 currentV updatePreview(); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool UIScene_SuperflatEditLayerMenu::canMoveSlider(F64 sliderId) { return false; diff --git a/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.h b/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.h index bfa1456d..23d8fc0b 100644 --- a/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SuperflatEditLayerMenu.h @@ -113,7 +113,7 @@ public: virtual void handlePress(F64 controlId, F64 childId); virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleSliderMove(F64 sliderId, F64 currentValue); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool handleMouseClick(F32 x, F32 y); virtual bool canMoveSlider(F64 sliderId); virtual void handleMouseHover(F32 x, F32 y); diff --git a/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.cpp index 46903e7f..8855e856 100644 --- a/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.cpp @@ -730,7 +730,7 @@ void UIScene_SuperflatMenu::applySliderChange(int id, int value) commit(); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool UIScene_SuperflatMenu::handleMouseClick(F32 x, F32 y) { if (m_bBusy) diff --git a/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.h b/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.h index 9419cd8f..077a5e1f 100644 --- a/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SuperflatMenu.h @@ -140,7 +140,7 @@ public: virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleSliderMove(F64 sliderId, F64 currentValue); virtual void handleCheckboxToggled(F64 controlId, bool selected); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) virtual bool handleMouseClick(F32 x, F32 y); #endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_SuperflatPresetsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SuperflatPresetsMenu.cpp index fe1d5406..37bba298 100644 --- a/Minecraft.Client/Common/UI/UIScene_SuperflatPresetsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SuperflatPresetsMenu.cpp @@ -5,7 +5,7 @@ #include "UICustomStrings.h" #include "../../../Minecraft.World/net.minecraft.world.item.h" #include "../../../Minecraft.World/net.minecraft.world.level.tile.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../../Windows64/KeyboardMouseInput.h" #endif @@ -60,7 +60,7 @@ int UIScene_SuperflatPresetsMenu::KeyboardCompleteCallback(LPVOID lpParam, bool { uint16_t pchText[128]; ZeroMemory(pchText, 128 * sizeof(uint16_t)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_GetKeyboardText(pchText, 128); #else InputManager.GetText(pchText); @@ -126,7 +126,7 @@ void UIScene_SuperflatPresetsMenu::tick() kbData.maxChars = 40; kbData.callback = &UIScene_SuperflatPresetsMenu::KeyboardCompleteCallback; kbData.lpParam = this; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) kbData.pcMode = g_KBMInput.IsKBMActive(); #endif ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData); diff --git a/Minecraft.Client/Common/UI/UIStructs.h b/Minecraft.Client/Common/UI/UIStructs.h index 9df3e21b..03eb7480 100644 --- a/Minecraft.Client/Common/UI/UIStructs.h +++ b/Minecraft.Client/Common/UI/UIStructs.h @@ -293,13 +293,13 @@ typedef struct _JoinMenuInitData { FriendSessionInfo *selectedSession; int iPad; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) int serverIndex; // Index of the server in servers.db, -1 if not a saved server #endif } JoinMenuInitData; // Native keyboard (Windows64 replacement for InputManager.RequestKeyboard WinAPI dialog) -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) typedef struct _UIKeyboardInitData { const wchar_t* title; diff --git a/Minecraft.Client/Common/UI/UIUnicodeBitmapFont.cpp b/Minecraft.Client/Common/UI/UIUnicodeBitmapFont.cpp index 6900558b..b6e941e6 100644 --- a/Minecraft.Client/Common/UI/UIUnicodeBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIUnicodeBitmapFont.cpp @@ -118,7 +118,7 @@ rrbool UIUnicodeBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale, IggyBitma // Since our glyphs are 16px (2x the Mojangles 8px), our truePixelScale is 20.0f float truePixelScale = 2.0f / m_referenceFontData->m_fAdvPerPixel; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bitmap->pixel_scale_correct = truePixelScale; if (pixel_scale < truePixelScale) { diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index 6b935a89..be4839bb 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -12,7 +12,7 @@ #include "Common/UI/UI.h" #include "Common/DLC/DLCAudioFile.h" -#if defined _XBOX || defined _WINDOWS64 +#if defined _XBOX || (defined(_WINDOWS64) || defined(__linux__)) #include "Xbox/XML/ATGXmlParser.h" #include "Xbox/XML/xmlFilesCallback.h" #endif diff --git a/Minecraft.Client/EndermanRenderer.cpp b/Minecraft.Client/EndermanRenderer.cpp index 8ca43c4f..54f9bebd 100644 --- a/Minecraft.Client/EndermanRenderer.cpp +++ b/Minecraft.Client/EndermanRenderer.cpp @@ -4,7 +4,7 @@ #include "TextureAtlas.h" #include "../Minecraft.World/net.minecraft.world.entity.monster.h" #include "../Minecraft.World/net.minecraft.world.level.tile.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -65,7 +65,7 @@ void EndermanRenderer::additionalRendering(shared_ptr _mob, float if (SharedConstants::TEXTURE_LIGHTING) { int col = mob->getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) col = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(mob->xOld + (mob->x - mob->xOld) * a), Mth::floor(mob->yOld + (mob->y - mob->yOld) * a), Mth::floor(mob->zOld + (mob->z - mob->zOld) * a), col); #endif int u = col % 65536; diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index 88ab5bc9..b1314ce6 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -92,7 +92,7 @@ #include "GuardianRenderer.h" #include "GuardianModel.h" #include "MobRenderer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -302,7 +302,7 @@ void EntityRenderDispatcher::render(shared_ptr entity, float a) { col = SharedConstants::FULLBRIGHT_LIGHTVALUE; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) else { col = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(entity->xOld + (entity->x - entity->xOld) * a), Mth::floor(entity->yOld + (entity->y - entity->yOld) * a), Mth::floor(entity->zOld + (entity->z - entity->zOld) * a), col); diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index 6ee853e0..30485c9d 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -21,7 +21,7 @@ #include "../Minecraft.World/net.minecraft.world.level.chunk.h" #include "PlayerConnection.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) extern bool g_Win64DedicatedServer; #endif @@ -149,7 +149,7 @@ void EntityTracker::tick() // NOTE: On dedicated servers, IsSameSystem() always returns false for remote // players (no split-screen), so this loop does nothing. Skip it entirely to // avoid the O(players * movedPlayers) overhead. -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!g_Win64DedicatedServer) #endif { diff --git a/Minecraft.Client/ExperienceOrbRenderer.cpp b/Minecraft.Client/ExperienceOrbRenderer.cpp index 4fb4d156..47245db8 100644 --- a/Minecraft.Client/ExperienceOrbRenderer.cpp +++ b/Minecraft.Client/ExperienceOrbRenderer.cpp @@ -7,7 +7,7 @@ #include "EntityRenderDispatcher.h" #include "../Minecraft.World/Mth.h" #include "../Minecraft.World/JavaMath.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -41,7 +41,7 @@ void ExperienceOrbRenderer::render(shared_ptr _orb, double x, double y, if (SharedConstants::TEXTURE_LIGHTING) { int col = orb->getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) col = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(orb->xOld + (orb->x - orb->xOld) * a), Mth::floor(orb->yOld + (orb->y - orb->yOld) * a), Mth::floor(orb->zOld + (orb->z - orb->zOld) * a), col); #endif int u = col % 65536; diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index f5526b70..e185baf3 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -16,7 +16,7 @@ #include "Durango/Social/SocialManager.h" #include "Durango/Sentient/DynamicConfigurations.h" #include "Durango/DurangoExtras/xcompress.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Sentient/SentientManager.h" #include "StatsCounter.h" #include "Windows64/Social/SocialManager.h" @@ -37,7 +37,7 @@ #endif #if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__) -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) //C4JStorage StorageManager; C_4JProfile ProfileManager; #endif @@ -46,7 +46,7 @@ CSentientManager SentientManager; CXuiStringTable StringTable; -#if !defined(_XBOX_ONE) && !defined(_WINDOWS64) +#if !defined(_XBOX_ONE) && (!defined(_WINDOWS64) && !defined(__linux__)) ATG::XMLParser::XMLParser() {} ATG::XMLParser::~XMLParser() {} HRESULT ATG::XMLParser::ParseXMLBuffer(CONST CHAR* strBuffer, UINT uBufferSize) { return S_OK; } @@ -553,7 +553,7 @@ DWORD XEnableGuestSignin(BOOL fEnable) { return 0; } /////////////////////////////////////////////// Profile library -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static void* profileData[4]; static bool s_bProfileIsFullVersion; static unsigned int s_profileDataBytesPerPad = 0; @@ -727,7 +727,7 @@ void C_4JProfile::SetPrimaryPlayerChanged(bool bVal) {} bool C_4JProfile::QuerySigninStatus(void) { return true; } void C_4JProfile::GetXUID(int iPad, PlayerUID * pXuid, bool bOnlineXuid) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Each pad gets a unique XUID derived from the persistent uid.dat value. // Pad 0 uses the base XUID directly. Pads 1-3 get a deterministic hash // of (base + pad) to produce fully independent IDs with no overlap risk. diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index bd304d52..9e387a83 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -53,7 +53,7 @@ #include "TexturePackRepository.h" #include "TexturePack.h" #include "TextureAtlas.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Common/PostProcesser.h" #include "DynamicLighting.h" #endif @@ -465,7 +465,7 @@ float GameRenderer::getFov(float a, bool applyEffects) int playerIdx = player ? player->GetXboxPad() : 0; float fov = m_fov;//70; if (fov < 1) fov = 1; // Crash fix - + if (applyEffects) { fov += mc->options->fov * 40; @@ -554,7 +554,7 @@ void GameRenderer::moveCameraToPlayer(float a) y += m_elytaCamShift[camIdx()]; } - + if (localplayer != nullptr && !player->isSleeping()) { float roll = cameraRollO[camIdx()] + (cameraRoll[camIdx()] - cameraRollO[camIdx()]) * a; @@ -1071,7 +1071,7 @@ void GameRenderer::CachePlayerGammas() } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void GameRenderer::RunWorldPostProcess() const { const int iPad = mc->player->GetXboxPad(); @@ -1239,7 +1239,7 @@ int GameRenderer::getLightTexture(int iPad, Level *level) void GameRenderer::render(float a, bool bFirst) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DynamicLighting::updateAll(this); #endif if (mc->player == nullptr) @@ -1491,7 +1491,7 @@ void GameRenderer::DisableUpdateThread() void GameRenderer::renderLevel(float a, int64_t until) { // if (updateLightTexture) updateLightTexture(); // 4J - TODO - Java 1.0.1 has this line enabled, should check why - don't want to put it in now in case it breaks split-screen -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) const int iPad = mc->player->GetXboxPad(); RenderManager.TextureSetMipMapOptions( app.GetGameSettings(iPad, eGameSetting_MipMap_Strength), @@ -1776,14 +1776,14 @@ void GameRenderer::renderLevel(float a, int64_t until) if (!mc->options->anaglyph3d) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) RunWorldPostProcess(); #endif return; } } glColorMask(true, true, true, false); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) RunWorldPostProcess(); #endif } @@ -2024,7 +2024,7 @@ void GameRenderer::renderSnowAndRain(float a) #else //t->tex2(level->getLightColor(x, yl, z, 0)); int rainLight = level->getLightColor(x, yl, z, 0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) rainLight = DynamicLighting::getLightmapWithDynamicLight(x, yl, z, rainLight); #endif t->tex2(rainLight); @@ -2066,7 +2066,7 @@ void GameRenderer::renderSnowAndRain(float a) br, br, br, Alpha, br, br, br, Alpha, tex2); #else int snowLight = level->getLightColor(x, yl, z, 0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) snowLight = DynamicLighting::getLightmapWithDynamicLight(x, yl, z, snowLight); #endif t->tex2((snowLight * 3 + 0xf000f0) / 4); diff --git a/Minecraft.Client/GameRenderer.h b/Minecraft.Client/GameRenderer.h index 80736092..410c8adc 100644 --- a/Minecraft.Client/GameRenderer.h +++ b/Minecraft.Client/GameRenderer.h @@ -89,7 +89,7 @@ private: float m_cachedGammaPerPlayer[NUM_LIGHT_TEXTURES]; static float ComputeGammaFromSlider(float slider0to100); void CachePlayerGammas(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void RunWorldPostProcess() const; #endif public: diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index 899e860b..01de0e66 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -2,7 +2,7 @@ #include "Gui.h" #include "ItemRenderer.h" #include "GameRenderer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Common/PostProcesser.h" #endif #include "Options.h" @@ -1364,7 +1364,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) // Disable the depth test so the text shows on top of the paperdoll glDisable(GL_DEPTH_TEST); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) float scaleWidth = (g_rScreenWidth / 1920.0f); float scaleHeight = (g_rScreenHeight / 1080.0f); @@ -1386,7 +1386,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) yPos += 10; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) glScalef(1, 1, 1); #endif // Restore the depth test @@ -1404,7 +1404,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) glColor4f(1, 1, 1, 1); glDisable(GL_BLEND); glEnable(GL_ALPHA_TEST); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) PostProcesser::GetInstance().RunStage(PostProcessStage::AfterNativeHud); #endif } diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index ca99c5dc..40020846 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -7,7 +7,7 @@ #include "Input.h" #include "../Minecraft.Client/LocalPlayer.h" #include "Options.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/KeyboardMouseInput.h" #endif @@ -45,7 +45,7 @@ void Input::tick(LocalPlayer *player) float kbXA = 0.0f; float kbYA = 0.0f; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { if( pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT) ) @@ -92,7 +92,7 @@ void Input::tick(LocalPlayer *player) } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { // Left Shift = sneak (hold to crouch) @@ -173,7 +173,7 @@ void Input::tick(LocalPlayer *player) float turnX = tx * abs(tx) * turnSpeed; float turnY = ty * abs(ty) * turnSpeed; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0 && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive()) { float mouseSensitivity = static_cast(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InGame)) / 100.0f; @@ -197,7 +197,7 @@ void Input::tick(LocalPlayer *player) unsigned int jump = InputManager.GetValue(iPad, MINECRAFT_ACTION_JUMP); bool kbJump = false; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) kbJump = (iPad == 0) && g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive() && g_KBMInput.IsBindDown(KeyboardMouseInput::KB_JUMP); #endif if( (jump > 0 || kbJump) && pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_JUMP) ) @@ -209,7 +209,7 @@ void Input::tick(LocalPlayer *player) if (app.GetFreezePlayers()) jumping = false; #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (iPad == 0 && g_KBMInput.IsKeyPressed(VK_ESCAPE) && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index f48dc6d3..8ca0df88 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -22,7 +22,7 @@ #include "../Minecraft.World/net.minecraft.world.level.h" #include "../Minecraft.World/net.minecraft.world.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -476,7 +476,7 @@ void ItemInHandRenderer::render(float a) { br = 1; int col = minecraft->level->getLightColor(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z), 0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) col = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z), col); #endif int u = col % 65536; @@ -619,7 +619,7 @@ void ItemInHandRenderer::render(float a) glPushMatrix(); float d = 0.8f; -#if defined __ORBIS__ || defined __PS3__ || defined _WINDOWS64 +#if defined __ORBIS__ || defined __PS3__ || (defined(_WINDOWS64) || defined(__linux__)) static const float swingPowFactor = 1.0f; #else static const float swingPowFactor = 4.0f; // 4J added, to slow the swing down when nearest the player for avoiding luminance flash issues diff --git a/Minecraft.Client/LevelRenderer.h b/Minecraft.Client/LevelRenderer.h index 3d4f7f08..6ed6dc01 100644 --- a/Minecraft.Client/LevelRenderer.h +++ b/Minecraft.Client/LevelRenderer.h @@ -58,7 +58,7 @@ public: static const int CHUNK_SIZE = 16; #endif static const int CHUNK_Y_COUNT = Level::maxBuildHeight / CHUNK_SIZE; -#if defined _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static const int MAX_COMMANDBUFFER_ALLOCATIONS = 2047 * 1024 * 1024; // Changed to 2047. 4J had set to 512. #elif defined _XBOX_ONE static const int MAX_COMMANDBUFFER_ALLOCATIONS = 512 * 1024 * 1024; // 4J - added diff --git a/Minecraft.Client/LivingEntityRenderer.cpp b/Minecraft.Client/LivingEntityRenderer.cpp index a46bc6db..f57d129c 100644 --- a/Minecraft.Client/LivingEntityRenderer.cpp +++ b/Minecraft.Client/LivingEntityRenderer.cpp @@ -566,7 +566,7 @@ void LivingEntityRenderer::renderNameTag(shared_ptr mob, const wst shared_ptr player = dynamic_pointer_cast(mob); if(app.isXuidDeadmau5( player->getXuid() ) ) offs = -10; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { extern bool Win64_GetPlayerEarsTexture(PlayerUID onlineXuid, PlayerUID xuid, wstring &outPath); wstring earsTexture; diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index 25848910..0d2aa4f3 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -286,7 +286,7 @@ void LocalPlayer::aiStep() } } if (isSneaking()) sprintTriggerTime = 0; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (input->sprinting && !isSprinting() && (onGround || isRiding()) && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && !isSneaking()) { setSprinting(true); diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index c8077536..bf91691f 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -73,7 +73,7 @@ #include "Common/UI/UIComponent_PressStartToPlay.h" #include "DLCTexturePack.h" #include "../Minecraft.World/InventoryMenu.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #define STB_IMAGE_WRITE_IMPLEMENTATION #include "Windows64/stb_image_write.h" #endif @@ -532,7 +532,7 @@ void Minecraft::setScreen(Screen *screen) oldScreen->removed(); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (screen != nullptr && g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); @@ -1066,7 +1066,7 @@ shared_ptr Minecraft::createExtraLocalPlayer(int idx, co PlayerUID playerXUIDOnline = INVALID_XUID; ProfileManager.GetXUID(idx,&playerXUIDOffline,false); ProfileManager.GetXUID(idx,&playerXUIDOnline,true); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Compatibility rule for Win64 id migration // host keeps legacy host XUID, non-host uses persistent uid.dat XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(idx); @@ -1218,7 +1218,7 @@ void Minecraft::createPrimaryLocalPlayer(int iPad) } } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void Minecraft::applyFrameMouseLook() { // Per-frame mouse look: consume mouse deltas every frame instead of waiting @@ -1503,7 +1503,7 @@ void Minecraft::run_middle() if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_GAME_INFO)) localplayers[i]->ullButtonsPressed|=1LL<ullButtonsPressed|=1LL<ullButtonsPressed&(1LL<isInputAllowed(MINECRAFT_ACTION_PICK_BLOCK); @@ -3860,7 +3860,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) player->lastClickTick[0] = ticks; } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool actionPressed = InputManager.ButtonPressed(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT)); bool actionHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_ACTION) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT)); #else @@ -3894,7 +3894,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) lastClickTick = ticks; } */ -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE) || (iPad == 0 && g_KBMInput.IsKBMActive() && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)); #else bool useHeld = InputManager.ButtonDown(iPad, MINECRAFT_ACTION_USE); @@ -4768,7 +4768,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt playerXUIDOnline.setForAdhoc(); } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On Windows, the implementation has been changed to use a per-client pseudo XUID based on `uid.dat`. // To maintain player data compatibility with existing worlds, the world host (the first player) will use the previous embedded pseudo XUID. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iPrimaryPlayer); @@ -4967,7 +4967,7 @@ void Minecraft::respawnPlayer(int iPad, int dimension, int newEntityId) PlayerUID playerXUIDOnline = INVALID_XUID; ProfileManager.GetXUID(iTempPad,&playerXUIDOffline,false); ProfileManager.GetXUID(iTempPad,&playerXUIDOnline,true); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Same compatibility rule as create/init paths. INetworkPlayer *localNetworkPlayer = g_NetworkManager.GetLocalPlayerByUserIndex(iTempPad); if(localNetworkPlayer != nullptr && localNetworkPlayer->IsHost()) diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 784fdbab..a66d5359 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -219,7 +219,7 @@ public: static Minecraft *GetInstance(); void run_middle(); void run_end(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) void applyFrameMouseLook(); // Per-frame mouse look to reduce input latency #endif diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index c8ecbd03..ae3b19bf 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -31,11 +31,11 @@ #include "../Minecraft.World/net.minecraft.world.item.h" #include "../Minecraft.World/net.minecraft.world.item.enchantment.h" #include "../Minecraft.World/net.minecraft.world.damagesource.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Network/PlatformNetworkManagerWindows.h" #include "Windows64/Network/WindowsNetworkConfig.h" #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/ServerLogger.h" #endif #include @@ -95,7 +95,7 @@ unordered_map MinecraftServer::ironTimers; static bool ShouldUseDedicatedServerProperties() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) return g_Win64DedicatedServer; #else return false; @@ -698,7 +698,7 @@ bool MinecraftServer::initServer(int64_t seed, NetworkGameInitData *initData, DW } #endif setPlayers(new PlayerList(this)); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { int maxP = getPlayerList()->getMaxPlayers(); if (g_pPlatformNetworkManagerWindows != nullptr) @@ -1304,7 +1304,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring if( levels[0]->isNew || levels[1]->isNew || levels[2]->isNew ) { -#ifndef _WINDOWS64 +#if !defined(_WINDOWS64) && !defined(__linux__) // On Windows64 we skip the automatic initial save so that choosing // "Exit without saving" on a new world does not leave an orphaned save folder. levels[0]->saveToDisc(mcprogress, false); @@ -1823,7 +1823,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) int64_t unprocessedTime = 0; while (running && !s_bServerHalted) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Full wall-clock cost of one run loop iteration (catch-up ticks // + setTime handlers + XUI delayed actions + Sleep). int64_t outerIterStart = getCurrentTimeMillis(); @@ -1866,20 +1866,20 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) while (unprocessedTime > MS_PER_TICK) { unprocessedTime -= MS_PER_TICK; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Per-iteration pre/tick/post timing. int64_t iter_t0 = System::currentTimeMillis(); #endif chunkPacketManagement_PreTick(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t iter_t1 = System::currentTimeMillis(); #endif tick(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t iter_t2 = System::currentTimeMillis(); #endif chunkPacketManagement_PostTick(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t iter_t3 = System::currentTimeMillis(); int64_t iter_total = iter_t3 - iter_t0; outerIterTickWork += iter_total; @@ -1952,7 +1952,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) switch(eAction) { case eXuiServerAction_AutoSaveGame: -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) || defined(MINECRAFT_SERVER_BUILD) +#if defined(_XBOX_ONE) || defined(__ORBIS__) || (defined(_WINDOWS64) || defined(__linux__)) || defined(MINECRAFT_SERVER_BUILD) { #if defined(_XBOX_ONE) || defined(__ORBIS__) PIXBeginNamedEvent(0, "Autosave"); @@ -1967,7 +1967,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) QueryPerformanceCounter(&qwTime); #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) LARGE_INTEGER asTicksPerSec, asT0, asT1; QueryPerformanceFrequency(&asTicksPerSec); double asSecsPerTick = 1.0 / (double)asTicksPerSec.QuadPart; @@ -1980,7 +1980,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) players->saveAll(nullptr); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&asAfterPlayers); #endif @@ -2000,7 +2000,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) #endif } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&asAfterLevels); #endif @@ -2016,7 +2016,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) PIXBeginNamedEvent(0, "Save to disc"); #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&asAfterRules); #endif @@ -2026,7 +2026,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) levels[0]->saveToDisc(Minecraft::GetInstance()->progressRenderer, true); #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&asAfterFlush); ServerRuntime::LogInfof("world-io", "autosave breakdown: players=%.0fms levels=%.0fms rules=%.0fms flush=%.0fms total=%.0fms", @@ -2200,7 +2200,7 @@ void MinecraftServer::run(int64_t seed, void *lpParameter) } Sleep(1); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t outerIterTotal = getCurrentTimeMillis() - outerIterStart; // Distribution histogram (gated). Buckets every outer iter, dumps @@ -2466,7 +2466,7 @@ void MinecraftServer::tick() // } int64_t totalMs = System::currentTimeMillis() - tickStart; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (totalMs > TICK_SLOW_THRESHOLD_MS) { // Build a single one-line breakdown so it greps cleanly. Per-level: diff --git a/Minecraft.Client/MinecraftServer.h b/Minecraft.Client/MinecraftServer.h index 3f70490e..60488ed9 100644 --- a/Minecraft.Client/MinecraftServer.h +++ b/Minecraft.Client/MinecraftServer.h @@ -18,7 +18,7 @@ class LevelType; class ProgressRenderer; class CommandDispatcher; -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) #define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 0 // Removed slow queue because at large player counts, chunks stopped appearing #else #define MINECRAFT_SERVER_SLOW_QUEUE_DELAY 250 @@ -267,7 +267,7 @@ private: #endif #endif - + private: // 4J Added diff --git a/Minecraft.Client/PaintingRenderer.cpp b/Minecraft.Client/PaintingRenderer.cpp index ce72fedc..793c73ce 100644 --- a/Minecraft.Client/PaintingRenderer.cpp +++ b/Minecraft.Client/PaintingRenderer.cpp @@ -5,7 +5,7 @@ #include "../Minecraft.World/net.minecraft.world.level.h" #include "../Minecraft.World/Random.h" #include "../Minecraft.World/Mth.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -20,7 +20,7 @@ void PaintingRenderer::render(shared_ptr _painting, double x, double y, { // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr painting = dynamic_pointer_cast(_painting); - + random->setSeed(187); glPushMatrix(); @@ -98,19 +98,19 @@ void PaintingRenderer::renderPainting(shared_ptr painting, int w, int t->vertexUV(x1, y0, -edgeWidth, uu1, uv0); t->vertexUV(x1, y0, edgeWidth, uu1, uv1); t->vertexUV(x0, y0, edgeWidth, uu0, uv1); - + t->normal(0, -1, 0); t->vertexUV(x0, y1, edgeWidth, uu0, uv0); t->vertexUV(x1, y1, edgeWidth, uu1, uv0); t->vertexUV(x1, y1, -edgeWidth, uu1, uv1); t->vertexUV(x0, y1, -edgeWidth, uu0, uv1); - + t->normal(-1, 0, 0); t->vertexUV(x0, y0, edgeWidth, su1, sv0); t->vertexUV(x0, y1, edgeWidth, su1, sv1); t->vertexUV(x0, y1, -edgeWidth, su0, sv1); t->vertexUV(x0, y0, -edgeWidth, su0, sv0); - + t->normal(1, 0, 0); t->vertexUV(x1, y0, -edgeWidth, su1, sv0); t->vertexUV(x1, y1, -edgeWidth, su1, sv1); @@ -132,7 +132,7 @@ void PaintingRenderer::setBrightness(shared_ptr painting, float ss, fl if (painting->dir == 3) z = Mth::floor(painting->z + ss/16.0f); int col = this->entityRenderDispatcher->level->getLightColor(x, y, z, 0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) col = DynamicLighting::getLightmapWithDynamicLight(x, y, z, col); #endif int u = col % 65536; @@ -144,4 +144,4 @@ void PaintingRenderer::setBrightness(shared_ptr painting, float ss, fl ResourceLocation *PaintingRenderer::getTextureLocation(shared_ptr mob) { return &PAINTING_LOCATION; -} \ No newline at end of file +} diff --git a/Minecraft.Client/ParticleEngine.cpp b/Minecraft.Client/ParticleEngine.cpp index 01a93b47..6849c931 100644 --- a/Minecraft.Client/ParticleEngine.cpp +++ b/Minecraft.Client/ParticleEngine.cpp @@ -13,7 +13,7 @@ #include "../Minecraft.World/StringHelpers.h" #include "../Minecraft.World/net.minecraft.world.level.dimension.h" #include "../Minecraft.World/InputOutputStream.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -159,7 +159,7 @@ void ParticleEngine::render(shared_ptr player, float a, int list) if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { int lightColor = p->getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) lightColor = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(p->xOld + (p->x - p->xOld) * a), Mth::floor(p->yOld + (p->y - p->yOld) * a), Mth::floor(p->zOld + (p->z - p->zOld) * a), lightColor); #endif t->tex2(lightColor); @@ -205,7 +205,7 @@ void ParticleEngine::renderLit(shared_ptr player, float a, int list) if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { int lightColor = p->getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) lightColor = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(p->xOld + (p->x - p->xOld) * a), Mth::floor(p->yOld + (p->y - p->yOld) * a), Mth::floor(p->zOld + (p->z - p->zOld) * a), lightColor); #endif t->tex2(lightColor); diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp index 31fdfe74..02d8f066 100644 --- a/Minecraft.Client/PendingConnection.cpp +++ b/Minecraft.Client/PendingConnection.cpp @@ -14,7 +14,7 @@ #include "../Minecraft.World/net.minecraft.world.item.h" #include "../Minecraft.World/SharedConstants.h" #include "Settings.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include #include #include "Common/Network/GameNetworkManager.h" @@ -33,11 +33,11 @@ Random *PendingConnection::random = new Random(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool g_bRejectDuplicateNames = true; #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) namespace { static SOCKET GetWindowsTransportSocket(unsigned char smallId) @@ -131,7 +131,7 @@ void PendingConnection::handlePreLogin(shared_ptr packet) return; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { std::string connectionIp = ""; int connectionPort = 0; @@ -178,7 +178,7 @@ void PendingConnection::handlePreLogin(shared_ptr packet) } #endif -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (ServerRuntime::Security::GetSettings().onlineMode) { if (m_verifyTicket != nullptr || m_onlineVerified) @@ -197,7 +197,7 @@ void PendingConnection::handlePreLogin(shared_ptr packet) void PendingConnection::tickOnlineVerify() { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (m_verifyTicket == nullptr || done) return; int state = m_verifyTicket->state.load(); @@ -258,7 +258,7 @@ void PendingConnection::sendPreLoginResponse() } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Security: strip real XUIDs from pre-login response to prevent unauthenticated enumeration. // The client receives the correct player count but cannot identify who is connected. // Real XUID data is sent post-login via PlayerInfoPacket broadcasts. @@ -305,7 +305,7 @@ void PendingConnection::handleLogin(shared_ptr packet) return; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (ServerRuntime::Security::GetSettings().onlineMode) { if (!m_onlineVerified || packet->m_onlineXuid != m_verifiedXuid || _wcsicmp(packet->userName.c_str(), name.c_str()) != 0) @@ -323,7 +323,7 @@ void PendingConnection::handleLogin(shared_ptr packet) //if (true)// 4J removed !server->onlineMode) bool sentDisconnect = false; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { std::string connectionIp = ""; int connectionPort = 0; @@ -396,7 +396,7 @@ void PendingConnection::handleLogin(shared_ptr packet) duplicateXuid = true; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Cross-reference: if someone claims the same XUID as an existing player from a different IP, // log and reject as a potential spoofing attempt. // Note: this runs on the main tick thread (via PendingConnection::tick -> Connection::tick -> @@ -457,7 +457,7 @@ void PendingConnection::handleLogin(shared_ptr packet) } bool whitelistSatisfied = true; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (ServerRuntime::Access::IsWhitelistEnabled()) { whitelistSatisfied = false; @@ -478,14 +478,14 @@ void PendingConnection::handleLogin(shared_ptr packet) } else if (bannedXuid) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ServerRuntime::ServerLogManager::OnRejectedPlayerLogin(GetPendingConnectionSmallId(connection), name, ServerRuntime::ServerLogManager::eLoginRejectReason_BannedXuid); #endif disconnect(DisconnectPacket::eDisconnect_Banned); } else if (!whitelistSatisfied) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Cache name->XUID so `whitelist add ` can resolve the XUID ServerRuntime::ServerLogManager::CachePlayerXuid(name, loginXuid); ServerRuntime::ServerLogManager::OnRejectedPlayerLogin(GetPendingConnectionSmallId(connection), name, ServerRuntime::ServerLogManager::eLoginRejectReason_NotWhitelisted); @@ -496,7 +496,7 @@ void PendingConnection::handleLogin(shared_ptr packet) } else if (duplicateXuid) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ServerRuntime::ServerLogManager::OnRejectedPlayerLogin(GetPendingConnectionSmallId(connection), name, ServerRuntime::ServerLogManager::eLoginRejectReason_DuplicateXuid); #endif // Reject the incoming connection — a player with this UID is already @@ -505,7 +505,7 @@ void PendingConnection::handleLogin(shared_ptr packet) app.DebugPrintf("LOGIN: Rejecting duplicate xuid for name: %ls\n", name.c_str()); disconnect(DisconnectPacket::eDisconnect_Banned); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) else if (g_bRejectDuplicateNames) { bool nameTaken = false; @@ -520,7 +520,7 @@ void PendingConnection::handleLogin(shared_ptr packet) } if (nameTaken) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ServerRuntime::ServerLogManager::OnRejectedPlayerLogin(GetPendingConnectionSmallId(connection), name, ServerRuntime::ServerLogManager::eLoginRejectReason_DuplicateName); #endif app.DebugPrintf("Rejecting duplicate name: %ls\n", name.c_str()); @@ -573,7 +573,7 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) return; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { std::string connectionIp = ""; int connectionPort = 0; @@ -633,7 +633,7 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) PlayerUID playerXuid = packet->m_offlineXuid; if(playerXuid == INVALID_XUID) playerXuid = packet->m_onlineXuid; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Cache name->XUID for console commands (whitelist add, revoketoken, etc.) ServerRuntime::ServerLogManager::CachePlayerXuid(name, playerXuid); #endif @@ -641,7 +641,7 @@ void PendingConnection::handleAcceptedLogin(shared_ptr packet) shared_ptr playerEntity = server->getPlayers()->getPlayerForLogin(this, name, playerXuid,packet->m_onlineXuid); if (playerEntity != nullptr) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ServerRuntime::ServerLogManager::OnAcceptedPlayerLogin(GetPendingConnectionSmallId(connection), name, packet->m_offlineXuid, packet->m_onlineXuid, packet->m_isGuest); #endif diff --git a/Minecraft.Client/PlayerChunkMap.cpp b/Minecraft.Client/PlayerChunkMap.cpp index 9ac67927..938e81d4 100644 --- a/Minecraft.Client/PlayerChunkMap.cpp +++ b/Minecraft.Client/PlayerChunkMap.cpp @@ -13,7 +13,7 @@ #include "../Minecraft.World/System.h" #include "PlayerList.h" #include -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/ServerLogger.h" // Per-tick accumulators for tickAddRequests timing. @@ -377,7 +377,7 @@ ServerLevel *PlayerChunkMap::getLevel() void PlayerChunkMap::tick() { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Substep timing for slow chunkMap diagnostics. const int64_t CHUNKMAP_SLOW_THRESHOLD_MS = 50; int64_t cm_t0 = System::currentTimeMillis(); @@ -402,7 +402,7 @@ void PlayerChunkMap::tick() chunk->updateInhabitedTime(); } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t cm_t1 = System::currentTimeMillis(); #endif @@ -424,7 +424,7 @@ void PlayerChunkMap::tick() i++; } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t cm_t2 = System::currentTimeMillis(); #endif @@ -432,7 +432,7 @@ void PlayerChunkMap::tick() { tickAddRequests(players[i]); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t cm_t3 = System::currentTimeMillis(); int64_t cm_total = cm_t3 - cm_t0; if (cm_total > CHUNKMAP_SLOW_THRESHOLD_MS) @@ -533,7 +533,7 @@ void PlayerChunkMap::getChunkAndRemovePlayer(int x, int z, shared_ptr player) for (int processed = 0; processed < CHUNKS_PER_PLAYER_PER_TICK; processed++) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) LARGE_INTEGER qpcFreq, qpcA, qpcB, qpcC; QueryPerformanceFrequency(&qpcFreq); QueryPerformanceCounter(&qpcA); @@ -575,7 +575,7 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) } } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&qpcB); g_findUsAccum += (qpcB.QuadPart - qpcA.QuadPart) * 1000000 / qpcFreq.QuadPart; #endif @@ -585,7 +585,7 @@ void PlayerChunkMap::tickAddRequests(shared_ptr player) { getChunk(itNearest->x, itNearest->z, true)->add(itNearest->player); addRequests.erase(itNearest); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&qpcC); g_addUsAccum += (qpcC.QuadPart - qpcB.QuadPart) * 1000000 / qpcFreq.QuadPart; g_addCount++; diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index 0cbeeae4..020eb7f3 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -60,7 +60,7 @@ #include -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/ServerLogManager.h" #include "../Minecraft.Server/Access/Access.h" #include "../Minecraft.Server/FourKitBridge.h" @@ -148,7 +148,7 @@ unsigned char PlayerConnection::getLogSmallId() void PlayerConnection::tick() { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!hasDoneFirstTickFourKit) { FourKitBridge::FirePlayerJoin(player->entityId, player->name, player->getUUID(), (unsigned long long)player->getOnlineXuid(), (unsigned long long)player->getXuid()); @@ -206,7 +206,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason) std::wstring kickLeaveMessage; bool fourKitHandledQuit = false; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (reason != DisconnectPacket::eDisconnect_Closed && reason != DisconnectPacket::eDisconnect_ConnectionCreationFailed && reason != DisconnectPacket::eDisconnect_Quitting) @@ -403,7 +403,7 @@ void PlayerConnection::handleMovePlayer(shared_ptr packet) return; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (xLastOk != xt || yLastOk != yt || zLastOk != zt || yRotT != yRotOld || xRotT != xRotOld) { double moveToX, moveToY, moveToZ; @@ -569,7 +569,7 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) if (packet->action == PlayerActionPacket::DROP_ITEM) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { shared_ptr selected = player->inventory->getSelected(); if (selected != nullptr && selected->count > 0) @@ -596,7 +596,7 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) } else if (packet->action == PlayerActionPacket::DROP_ALL_ITEMS) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { shared_ptr selected = player->inventory->getSelected(); if (selected != nullptr && selected->count > 0) @@ -669,7 +669,7 @@ void PlayerConnection::handlePlayerAction(shared_ptr packet) if (packet->action == PlayerActionPacket::START_DESTROY_BLOCK) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) lastLeftClickTick = tickCount; { shared_ptr heldItem = player->inventory->getSelected(); @@ -719,7 +719,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) if (packet->getFace() == 255) { if (item == nullptr) return; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int iId = item->id; int iCount = item->count; @@ -740,7 +740,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) { if (synched && player->distanceToSqr(x + 0.5, y + 0.5, z + 0.5) < 8 * 8) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int iId = item ? item->id : 0; int iCount = item ? item->count : 0; @@ -761,7 +761,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) // Anti-cheat: block placement/use must pass server-side spawn protection. if (!server->isUnderSpawnProtection(level, x, y, z, player)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int placeX = x, placeY = y, placeZ = z; bool validFace = true; @@ -782,7 +782,7 @@ void PlayerConnection::handleUseItem(shared_ptr packet) #endif player->gameMode->useItemOn(player, level, item, x, y, z, face, packet->getClickX(), packet->getClickY(), packet->getClickZ(), false, &blockHandled); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (validFace) { int newTileId = level->getTile(placeX, placeY, placeZ); @@ -946,7 +946,7 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason, return; } bool fourKitHandledQuit = false; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ServerRuntime::ServerLogManager::OnPlayerDisconnected( getLogSmallId(), (player != NULL) ? player->name : std::wstring(), @@ -1029,7 +1029,7 @@ void PlayerConnection::handleChat(shared_ptr packet) handleCommand(message); return; } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { std::wstring formatted; if (!FourKitBridge::FirePlayerChat(player->entityId, message, formatted)) @@ -1052,7 +1052,7 @@ void PlayerConnection::handleChat(shared_ptr packet) void PlayerConnection::handleCommand(const wstring& message) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) std::wstring commandLine = message; if (FourKitBridge::FireCommandPreprocess(player->entityId, commandLine, commandLine)) return; @@ -2288,7 +2288,7 @@ void PlayerConnection::handleAnimate(shared_ptr packet) player->resetLastActionTime(); if (packet->action == AnimatePacket::SWING) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (lastLeftClickTick != tickCount) { int useItemInHand = 1; @@ -2427,7 +2427,7 @@ void PlayerConnection::handleInteract(shared_ptr packet) if (packet->action == InteractPacket::INTERACT) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int mappedType = FourKitBridge::MapEntityType((int)target->GetType()); float targetHealth = 0, targetMaxHealth = 0, targetEyeHeight = 0; @@ -2449,7 +2449,7 @@ void PlayerConnection::handleInteract(shared_ptr packet) } else if (packet->action == InteractPacket::ATTACK) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) lastLeftClickTick = tickCount; #endif if ((target->GetType() == eTYPE_ITEMENTITY) || (target->GetType() == eTYPE_EXPERIENCEORB) || (target->GetType() == eTYPE_ARROW) || target == player) @@ -2710,7 +2710,7 @@ void PlayerConnection::handleServerSettingsChanged(shared_ptrIsHost()); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // On dedicated servers, only the host can change server settings. // Moderators (OPs) should not be able to alter game rules. if (!isHost) @@ -2745,7 +2745,7 @@ void PlayerConnection::handleKickPlayer(shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); bool isHost = (networkPlayer != nullptr && networkPlayer->IsHost()); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Live ops.json check for non-host players if (!isHost) { @@ -2765,7 +2765,7 @@ void PlayerConnection::handleKickPlayer(shared_ptr packet) #endif if( isHost || player->isModerator()) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // On dedicated servers, non-host moderators cannot kick other moderators or the host. if (!isHost) { @@ -2795,7 +2795,7 @@ void PlayerConnection::handleKickPlayer(shared_ptr packet) void PlayerConnection::handleGameCommand(shared_ptr packet) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) INetworkPlayer *networkPlayer = getNetworkPlayer(); bool isHost = (networkPlayer != nullptr && networkPlayer->IsHost()); if (!isHost) @@ -2831,11 +2831,11 @@ void PlayerConnection::handleClientCommand(shared_ptr packe { if (player->wonGame) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int oldEntityId = player->entityId; #endif player = server->getPlayers()->respawn(player, player->m_enteredEndExitPortal?0:player->dimension, true); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) FourKitBridge::UpdatePlayerEntityId(oldEntityId, player->entityId); #endif } @@ -2848,11 +2848,11 @@ void PlayerConnection::handleClientCommand(shared_ptr packe else { if (player->getHealth() > 0) return; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int oldEntityId = player->entityId; #endif player = server->getPlayers()->respawn(player, 0, false); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) FourKitBridge::UpdatePlayerEntityId(oldEntityId, player->entityId); #endif } @@ -2914,7 +2914,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac player->resetLastActionTime(); if (player->containerMenu->containerId == packet->containerId && player->containerMenu->isSynched(player)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int fourKitClickResult = FourKitBridge::FireInventoryClick(player->entityId, packet->slotNum, packet->buttonNum, packet->clickType); if (fourKitClickResult == 1) { @@ -2955,7 +2955,7 @@ void PlayerConnection::handleContainerClick(shared_ptr pac // player.containerMenu.broadcastChanges(); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (fourKitClickResult == 2) { vector> refreshItems; @@ -3108,7 +3108,7 @@ void PlayerConnection::handleSignUpdate(shared_ptr packet) lines[i] = packet->lines[i].substr(0,15); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { std::wstring outLines[4]; bool cancelled = FourKitBridge::FireSignChange( @@ -3148,7 +3148,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) { INetworkPlayer *networkPlayer = getNetworkPlayer(); bool isHost = (networkPlayer != nullptr && networkPlayer->IsHost()); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Live ops.json check for non-host players if (!isHost) { @@ -3238,7 +3238,7 @@ void PlayerConnection::handlePlayerInfo(shared_ptr packet) serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanToggleClassicHunger,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CanToggleClassicHunger) ); serverPlayer->setPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanTeleport,Player::getPlayerGamePrivilege(packet->m_playerPrivileges,Player::ePlayerGamePrivilege_CanTeleport) ); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // On dedicated servers, OP can only be granted/revoked if the target is in ops.json. // This prevents runtime OP escalation via crafted PlayerInfoPackets. bool wantsOp = Player::getPlayerGamePrivilege(packet->m_playerPrivileges, Player::ePlayerGamePrivilege_Op) != 0; diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index f483a57b..3fa612f5 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -19,7 +19,7 @@ #include "../Minecraft.World/net.minecraft.network.packet.h" #include "../Minecraft.World/net.minecraft.network.h" #include "Windows64/Windows64_Xuid.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Network/PlatformNetworkManagerWindows.h" #endif #include "../Minecraft.World/Pos.h" @@ -33,7 +33,7 @@ #include "../Minecraft.World/EntityIO.h" #if defined(_XBOX) #include "Xbox/Network/NetworkPlayerXbox.h" -#elif defined(_WINDOWS64) +#elif defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Network/NetworkPlayerWindows.h" #elif defined(__PS3__) || defined(__ORBIS__) #include "Common/Network/Sony/NetworkPlayerSony.h" @@ -41,7 +41,7 @@ #include "../Minecraft.World/Recipes.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/Access/Access.h" #include "../Minecraft.Server/Common/StringUtils.h" #include "../Minecraft.Server/ServerLogger.h" @@ -150,7 +150,7 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr } } #endif -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (networkPlayer != nullptr) { NetworkPlayerWindows* windowsPlayer = dynamic_cast(networkPlayer); @@ -335,7 +335,7 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr // 4J-PB - removed, since it needs to be localised in the language the client is in //server->players->broadcastAll( shared_ptr( new ChatPacket(L"�e" + playerEntity->name + L" joined the game.") ) ); -#if !(defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)) +#if !((defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD)) broadcastAll(std::make_shared(player->name, ChatPacket::e_ChatPlayerJoinedGame)); #endif @@ -684,7 +684,7 @@ shared_ptr PlayerList::getPlayerForLogin(PendingConnection *pendin player->gameMode->player = player; // 4J added as had to remove this assignment from ServerPlayer ctor player->setXuid( xuid ); // 4J Added player->setOnlineXuid( onlineXuid ); // 4J Added -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) { // Use packet-supplied identity from LoginPacket. // Do not recompute from name here: mixed-version clients must stay compatible. @@ -1203,7 +1203,7 @@ void PlayerList::tick() player->connection->disconnect( DisconnectPacket::eDisconnect_Closed ); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // The old Connection's read/write threads are now dead (disconnect waits // for them). Safe to recycle the smallId — no stale write thread can // resolve getPlayer() to a new connection that reuses this slot. @@ -1894,7 +1894,7 @@ bool PlayerList::isXuidBanned(PlayerUID xuid) } LeaveCriticalSection(&m_banCS); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!banned && g_Win64DedicatedServer) { banned = ServerRuntime::Access::IsPlayerBanned(xuid); @@ -1939,7 +1939,7 @@ void PlayerList::banPlayerForHardcoreDeath(ServerPlayer *player) // Always apply the in-memory XUID ban (works for both client-hosted and dedicated) banXuid(player->getOnlineXuid()); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (g_Win64DedicatedServer) { const std::string playerName = ServerRuntime::StringUtils::WideToUtf8(player->getName()); diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index 63352613..22403f8d 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -3,7 +3,7 @@ #include "SkullTileRenderer.h" #include "../Minecraft.World/SkullTileEntity.h" #include "HumanoidMobRenderer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) bool Win64_GetPlayerEarsTexture(PlayerUID onlineXuid, PlayerUID xuid, wstring &outPath); bool Win64_ResolvePlayerCape(PlayerUID onlineXuid, PlayerUID xuid, const wstring ¤t, wstring &outPath); #include "CosmeticModels.h" @@ -440,7 +440,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) { if (app.isXuidDeadmau5(mob->getXuid())) drawEars = bindTexture(mob->customTextureUrl, L""); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) wstring cosmeticTexture; std::string cosmeticBoxes; unsigned int cosmeticIndex = 0; @@ -477,7 +477,7 @@ void PlayerRenderer::additionalRendering(shared_ptr _mob, float a) shared_ptr capeChestItem = mob->inventory->armor[LivingEntity::SLOT_CHEST - 1]; bool wearingElytra = capeChestItem != nullptr && dynamic_cast(capeChestItem->getItem()) != nullptr; wstring capeTexture = mob->customTextureUrl2; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) Win64_ResolvePlayerCape(mob->getOnlineXuid(), mob->getXuid(), mob->customTextureUrl2, capeTexture); #endif if (!wearingElytra && !capeTexture.empty() && bindTexture(capeTexture, L"") && !mob->isInvisible()) diff --git a/Minecraft.Client/Screen.cpp b/Minecraft.Client/Screen.cpp index 38a645bb..6fdcc8d0 100644 --- a/Minecraft.Client/Screen.cpp +++ b/Minecraft.Client/Screen.cpp @@ -6,7 +6,7 @@ #include "Tesselator.h" #include "Textures.h" #include "../Minecraft.World/SoundTypes.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/KeyboardMouseInput.h" #endif @@ -55,7 +55,7 @@ void Screen::keyPressed(wchar_t eventCharacter, int eventKey) wstring Screen::getClipboard() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!OpenClipboard(nullptr)) return wstring(); HANDLE h = GetClipboardData(CF_UNICODETEXT); wstring out; @@ -73,7 +73,7 @@ wstring Screen::getClipboard() void Screen::setClipboard(const wstring& str) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!OpenClipboard(nullptr)) return; EmptyClipboard(); size_t len = (str.length() + 1) * sizeof(wchar_t); @@ -135,7 +135,7 @@ void Screen::init() void Screen::updateEvents() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Poll mouse button state and dispatch click/release events for (int btn = 0; btn < 3; btn++) { @@ -251,7 +251,7 @@ void Screen::updateEvents() void Screen::mouseEvent() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Mouse event dispatching is handled directly in updateEvents() for Windows #else /* 4J - TODO diff --git a/Minecraft.Client/ServerConnection.cpp b/Minecraft.Client/ServerConnection.cpp index 9ebf7259..fc472b09 100644 --- a/Minecraft.Client/ServerConnection.cpp +++ b/Minecraft.Client/ServerConnection.cpp @@ -10,7 +10,7 @@ #include "../Minecraft.World/Socket.h" #include "../Minecraft.World/net.minecraft.world.level.h" #include "MultiPlayerLevel.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/Security/SecurityConfig.h" #include "../Minecraft.Server/ServerLogManager.h" #include "../Minecraft.Server/ServerLogger.h" @@ -50,7 +50,7 @@ void ServerConnection::addPlayerConnection(shared_ptr uc) void ServerConnection::handleConnection(shared_ptr uc) { EnterCriticalSection(&pending_cs); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int maxPending = ServerRuntime::Security::GetSettings().maxPendingConnections; if (maxPending > 0 && static_cast(pending.size()) >= maxPending) { @@ -131,7 +131,7 @@ void ServerConnection::tick() vector< shared_ptr > tempPlayers = players; LeaveCriticalSection(&players_cs); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // Substep timing for chunk / tick / flush across all players. LARGE_INTEGER scFreq, scA, scB, scC, scD; QueryPerformanceFrequency(&scFreq); @@ -153,7 +153,7 @@ void ServerConnection::tick() unsigned int i = (unsigned int)((startIdx + k) % playerCount); shared_ptr player = tempPlayers[i]; shared_ptr serverPlayer = player->getPlayer(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&scA); #endif if( serverPlayer ) @@ -161,12 +161,12 @@ void ServerConnection::tick() serverPlayer->updateFrameTick(); serverPlayer->doChunkSendingTick(false); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&scB); sc_chunkUs += (scB.QuadPart - scA.QuadPart) * 1000000 / scFreq.QuadPart; #endif player->tick(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&scC); sc_tickUs += (scC.QuadPart - scB.QuadPart) * 1000000 / scFreq.QuadPart; #endif @@ -181,13 +181,13 @@ void ServerConnection::tick() { player->connection->flush(); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) QueryPerformanceCounter(&scD); sc_flushUs += (scD.QuadPart - scC.QuadPart) * 1000000 / scFreq.QuadPart; #endif } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int64_t sc_loopTotal = System::currentTimeMillis() - sc_loopT0; if (sc_loopTotal > 50) { diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index f130c555..95a4a22d 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -40,7 +40,7 @@ #include "../Minecraft.World/ProgressListener.h" #include "PS3/PS3Extras/ShutdownManager.h" #include "PlayerChunkMap.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "../Minecraft.Server/ServerLogger.h" #endif @@ -199,7 +199,7 @@ ServerLevel::~ServerLevel() void ServerLevel::tick() { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // ts[N] = wall-clock at substep N. Logged when level total exceeds // LEVEL_SLOW_THRESHOLD_MS to pinpoint the dominant substep. const int64_t LEVEL_SLOW_THRESHOLD_MS = 50; @@ -231,7 +231,7 @@ void ServerLevel::tick() } awakenAllPlayers(); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[1] = System::currentTimeMillis(); #endif @@ -249,7 +249,7 @@ void ServerLevel::tick() mobSpawner->tick(this, finalSpawnEnemies, finalSpawnFriendlies, finalSpawnPersistent); } PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[2] = System::currentTimeMillis(); #endif PIXBeginNamedEvent(0,"Chunk source tick"); @@ -267,7 +267,7 @@ void ServerLevel::tick() } } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[3] = System::currentTimeMillis(); #endif @@ -283,12 +283,12 @@ void ServerLevel::tick() { PIXBeginNamedEvent(0,"Incremental save"); // @3makJoud - // commenting this line of code, as it were commited by the Smartcmd or shall i say Dumpcmd, + // commenting this line of code, as it were commited by the Smartcmd or shall i say Dumpcmd, // as it saves entities every single tick which kills performance on low end devices //save(false, nullptr); PIXEndNamedEvent(); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[4] = System::currentTimeMillis(); #endif @@ -306,7 +306,7 @@ void ServerLevel::tick() setDayTime(levelData->getDayTime() + 1); } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[5] = System::currentTimeMillis(); #endif @@ -314,7 +314,7 @@ void ServerLevel::tick() // if (tickCount % 5 == 0) { tickPendingTicks(false); PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[6] = System::currentTimeMillis(); #endif @@ -323,12 +323,12 @@ void ServerLevel::tick() tickTiles(); MemSect(0); PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[7] = System::currentTimeMillis(); #endif chunkMap->tick(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[8] = System::currentTimeMillis(); #endif @@ -338,14 +338,14 @@ void ServerLevel::tick() villageSiege->tick(); //MemSect(0); PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[9] = System::currentTimeMillis(); #endif PIXBeginNamedEvent(0,"Tick portal forcer"); portalForcer->tick(getGameTime()); PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[10] = System::currentTimeMillis(); #endif @@ -353,13 +353,13 @@ void ServerLevel::tick() PIXBeginNamedEvent(0,"runTileEvents"); runTileEvents(); PIXEndNamedEvent(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[11] = System::currentTimeMillis(); #endif // 4J Added runQueuedSendTileUpdates(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) ts[12] = System::currentTimeMillis(); int64_t levelTotal = ts[12] - ts[0]; if (levelTotal > LEVEL_SLOW_THRESHOLD_MS) @@ -592,14 +592,14 @@ void ServerLevel::tickTiles() int yy = getTopRainBlock(x + xo, z + zo); if (shouldFreeze(x + xo, yy - 1, z + zo)) { - #if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) + #if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockForm(dimension->id, x + xo, yy - 1, z + zo, Tile::ice_Id, 0)) #endif setTileAndUpdate(x + xo, yy - 1, z + zo, Tile::ice_Id); } if (isRaining() && getGameRules()->getBoolean(GameRules::RULE_WEATHER_CYCLE) && shouldSnow(x + xo, yy, z + zo)) { - #if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) + #if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockForm(dimension->id, x + xo, yy, z + zo, Tile::snow_layer_Id, 0)) #endif setTileAndUpdate(x + xo, yy, z + zo, Tile::snow_layer_Id); @@ -1739,4 +1739,3 @@ void ServerLevel::sendParticles(const ParticleType* type, double x, double y, do { this->sendParticles(type, false, x, y, z, count, dx, dy, dz, speed, data); } - diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 2d49e563..6cc9fdd0 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -37,7 +37,7 @@ #include "../Minecraft.World/LevelChunk.h" #include "LevelRenderer.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "../Minecraft.World/ChatPacket.h" @@ -789,7 +789,7 @@ shared_ptr ServerPlayer::getCarried(int slot) void ServerPlayer::die(DamageSource *source) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) shared_ptr deathPacket = getCombatTracker()->getDeathMessagePacket(); std::wstring deathMsg = FormatDeathMessage(deathPacket); @@ -1041,7 +1041,7 @@ void ServerPlayer::changeDimension(int i) } else { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) bool portalDestModified = false; double portalOutX = 0, portalOutY = 0, portalOutZ = 0; #endif @@ -1052,7 +1052,7 @@ void ServerPlayer::changeDimension(int i) Pos *pos = server->getLevel(i)->getDimensionSpecificSpawn(); if (pos != nullptr) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double outX, outY, outZ; bool cancelled = FourKitBridge::FirePlayerPortal(entityId, @@ -1077,7 +1077,7 @@ void ServerPlayer::changeDimension(int i) } else { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double scale = server->getLevel(i)->getLevelData()->getHellScale(); double toX = x, toY = y, toZ = z; @@ -1114,7 +1114,7 @@ void ServerPlayer::changeDimension(int i) } server->getPlayers()->toggleDimension( dynamic_pointer_cast(shared_from_this()), i); connection->send(std::make_shared(LevelEvent::SOUND_PORTAL_TRAVEL, 0, 0, 0, 0, false)); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (portalDestModified) { connection->teleport(portalOutX, portalOutY, portalOutZ, yRot, xRot); @@ -1149,7 +1149,7 @@ void ServerPlayer::take(shared_ptr e, int orgCount) Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, bool bTestUse) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!bTestUse && FourKitBridge::FireBedEnter(entityId, dimension, x, y, z)) return OTHER_PROBLEM; #endif @@ -1166,7 +1166,7 @@ Player::BedSleepingResult ServerPlayer::startSleepInBed(int x, int y, int z, boo void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int bedX = bedPosition ? bedPosition->x : 0; int bedY = bedPosition ? bedPosition->y : 0; int bedZ = bedPosition ? bedPosition->z : 0; @@ -1178,7 +1178,7 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo } Player::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint); if (connection != nullptr) connection->teleport(x, y, z, yRot, xRot); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (wasSleeping) FourKitBridge::FireBedLeave(entityId, dimension, bedX, bedY, bedZ); #endif @@ -1227,7 +1227,7 @@ bool ServerPlayer::startCrafting(int x, int y, int z) containerMenu = new CraftingMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::WORKBENCH, L"", 9)) { doCloseContainer(); @@ -1253,7 +1253,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z) containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9)) { doCloseContainer(); @@ -1271,7 +1271,7 @@ bool ServerPlayer::openFireworks(int x, int y, int z) containerMenu = new FireworksMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FIREWORKS, L"", 9)) { doCloseContainer(); @@ -1297,7 +1297,7 @@ bool ServerPlayer::startEnchanting(int x, int y, int z, const wstring &name) containerMenu = new EnchantmentMenu(inventory, level, x, y, z); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::ENCHANTMENT, name.empty() ? L"" : name, 9)) { doCloseContainer(); @@ -1323,7 +1323,7 @@ bool ServerPlayer::startRepairing(int x, int y, int z) containerMenu = new AnvilMenu(inventory, level, x, y, z, dynamic_pointer_cast(shared_from_this())); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::REPAIR_TABLE, L"", 9)) { doCloseContainer(); @@ -1354,7 +1354,7 @@ bool ServerPlayer::openContainer(shared_ptr container) containerMenu = new ContainerMenu(inventory, container); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, containerType, container->getCustomName(), container->getContainerSize())) { doCloseContainer(); @@ -1380,7 +1380,7 @@ bool ServerPlayer::openHopper(shared_ptr container) containerMenu = new HopperMenu(inventory, container); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize())) { doCloseContainer(); @@ -1406,7 +1406,7 @@ bool ServerPlayer::openHopper(shared_ptr container) containerMenu = new HopperMenu(inventory, container); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HOPPER, container->getCustomName(), container->getContainerSize())) { doCloseContainer(); @@ -1432,7 +1432,7 @@ bool ServerPlayer::openFurnace(shared_ptr furnace) containerMenu = new FurnaceMenu(inventory, furnace); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::FURNACE, furnace->getCustomName(), furnace->getContainerSize())) { doCloseContainer(); @@ -1458,7 +1458,7 @@ bool ServerPlayer::openTrap(shared_ptr trap) containerMenu = new TrapMenu(inventory, trap); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, trap->GetType() == eTYPE_DROPPERTILEENTITY ? ContainerOpenPacket::DROPPER : ContainerOpenPacket::TRAP, trap->getCustomName(), trap->getContainerSize())) { doCloseContainer(); @@ -1484,7 +1484,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr brewing_s containerMenu = new BrewingStandMenu(inventory, brewing_stand); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BREWING_STAND, brewing_stand->getCustomName(), brewing_stand->getContainerSize())) { doCloseContainer(); @@ -1510,7 +1510,7 @@ bool ServerPlayer::openBeacon(shared_ptr beacon) nextContainerCounter(); containerMenu = new BeaconMenu(inventory, beacon); containerMenu->containerId = containerCounter; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::BEACON, beacon->getCustomName(), beacon->getContainerSize())) { doCloseContainer(); @@ -1541,7 +1541,7 @@ bool ServerPlayer::openTrading(shared_ptr traderTarget, const wstring containerMenu->addSlotListener(this); shared_ptr container = static_cast(containerMenu)->getTradeContainer(); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::TRADER_NPC, name.empty() ? L"" : name, container->getContainerSize())) { doCloseContainer(); @@ -1582,7 +1582,7 @@ bool ServerPlayer::openHorseInventory(shared_ptr horse, shared_ptr< containerMenu = new HorseInventoryMenu(inventory, container, horse); containerMenu->containerId = containerCounter; containerMenu->addSlotListener(this); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireInventoryOpen(entityId, ContainerOpenPacket::HORSE, horse->getCustomName(), container->getContainerSize())) { doCloseContainer(); diff --git a/Minecraft.Client/ServerPlayerGameMode.cpp b/Minecraft.Client/ServerPlayerGameMode.cpp index 87ff3a15..2a122b2b 100644 --- a/Minecraft.Client/ServerPlayerGameMode.cpp +++ b/Minecraft.Client/ServerPlayerGameMode.cpp @@ -11,7 +11,7 @@ #include "../Minecraft.World/net.minecraft.world.level.chunk.h" #include "../Minecraft.World/net.minecraft.world.level.dimension.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.World/EnchantmentHelper.h" #include "../Minecraft.World/ExperienceOrb.h" #include "../Minecraft.Server/FourKitBridge.h" @@ -255,7 +255,7 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) int t = level->getTile(x, y, z); int data = level->getData(x, y, z); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int eventExp = 0; if (!isCreative() && !gameModeForPlayer->isAdventureRestricted() || !gameModeForPlayer->isSpectator()) { @@ -350,13 +350,13 @@ bool ServerPlayerGameMode::destroyBlock(int x, int y, int z) } if (changed && canDestroy) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) g_suppressExpDrops = true; #endif Tile::tiles[t]->playerDestroy(level, player, x, y, z, data); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) g_suppressExpDrops = false; if (finalExp > 0) { diff --git a/Minecraft.Client/TeleportCommand.cpp b/Minecraft.Client/TeleportCommand.cpp index 13edbe4f..fa723b07 100644 --- a/Minecraft.Client/TeleportCommand.cpp +++ b/Minecraft.Client/TeleportCommand.cpp @@ -8,7 +8,7 @@ #include "../Minecraft.World/net.minecraft.world.level.h" #include "../Minecraft.World/net.minecraft.world.level.dimension.h" #include "TeleportCommand.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -37,7 +37,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman byte xRot = dis.readByte(); subject->ride(nullptr); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double outX, outY, outZ; bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId, @@ -64,7 +64,7 @@ void TeleportCommand::execute(shared_ptr source, byteArray comman return; subject->ride(nullptr); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64 || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double outX, outY, outZ; bool cancelled = FourKitBridge::FirePlayerTeleport(subject->entityId, @@ -110,4 +110,4 @@ shared_ptr TeleportCommand::preparePacket(PlayerUID subject, dos.writeByte(yRot); dos.writeByte(xRot); return std::make_shared(eGameCommand_Teleport, baos.toByteArray()); -} \ No newline at end of file +} diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index cb503510..88fdc106 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -16,7 +16,7 @@ #include "Options.h" #include "../Minecraft.World/TallGrass2.h" #include "../Minecraft.World/FlowerPotTileEntity.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #endif @@ -168,7 +168,7 @@ int TileRenderer::getLightColor( Tile *tt, LevelSource *level, int x, int y, int } } if (!gotCachedValue) ret = tt->getLightColor(level, x, y, z); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) ret = DynamicLighting::getLightmapWithDynamicLight(x, y, z, ret); #endif return ret; @@ -6596,7 +6596,7 @@ bool TileRenderer::tesselateBeaconInWorld(Tile *tt, int x, int y, int z) noCulling = false; clearFixedTexture(); - + return true; } diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index e0638aca..403187cd 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -23,7 +23,7 @@ #include -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) extern bool g_Win64DedicatedServer; #endif @@ -384,7 +384,7 @@ void TrackedEntity::sendDirtyEntityData() void TrackedEntity::broadcast(shared_ptr packet) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // On dedicated servers, IsSameSystem() always returns false for remote players // (no split-screen), so the dedup loop never filters anything. Skip straight // to sending to all players in seenBy to avoid O(seenBy^2) overhead. @@ -513,7 +513,7 @@ TrackedEntity::eVisibility TrackedEntity::isVisible(EntityTracker *tracker, shar // players who canReceiveAllPackets(). // NOTE: On dedicated servers, all real players are remote so IsSameSystem() // always returns false. Skip this O(players) loop entirely. -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (!bVisible && !g_Win64DedicatedServer) #else if (!bVisible) diff --git a/Minecraft.Client/VillagerGolemRenderer.cpp b/Minecraft.Client/VillagerGolemRenderer.cpp index 55841bbd..0315f00d 100644 --- a/Minecraft.Client/VillagerGolemRenderer.cpp +++ b/Minecraft.Client/VillagerGolemRenderer.cpp @@ -6,7 +6,7 @@ #include "TextureAtlas.h" #include "VillagerGolemRenderer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #include "../Minecraft.World/Mth.h" #endif @@ -25,7 +25,7 @@ void VillagerGolemRenderer::render(shared_ptr mob, double x, double y, d void VillagerGolemRenderer::setupRotations(shared_ptr _mob, float bob, float bodyRot, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - // do some casting around instead shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::setupRotations(mob, bob, bodyRot, a); @@ -44,7 +44,7 @@ ResourceLocation *VillagerGolemRenderer::getTextureLocation(shared_ptr m void VillagerGolemRenderer::additionalRendering(shared_ptr _mob, float a) { - // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - + // 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr we have here - // do some casting around instead shared_ptr mob = dynamic_pointer_cast(_mob); MobRenderer::additionalRendering(mob, a); @@ -63,7 +63,7 @@ void VillagerGolemRenderer::additionalRendering(shared_ptr _mob, f if (SharedConstants::TEXTURE_LIGHTING) { int col = mob->getLightColor(a); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) col = DynamicLighting::getLightmapWithDynamicLight(Mth::floor(mob->xOld + (mob->x - mob->xOld) * a), Mth::floor(mob->yOld + (mob->y - mob->yOld) * a), Mth::floor(mob->zOld + (mob->z - mob->zOld) * a), col); #endif int u = col % 65536; @@ -77,4 +77,4 @@ void VillagerGolemRenderer::additionalRendering(shared_ptr _mob, f tileRenderer->renderTile(Tile::rose, 0, 1); glPopMatrix(); glDisable(GL_RESCALE_NORMAL); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Windows64/ControllerBinds.cpp b/Minecraft.Client/Windows64/ControllerBinds.cpp index 1d05a7d0..79a9b63a 100644 --- a/Minecraft.Client/Windows64/ControllerBinds.cpp +++ b/Minecraft.Client/Windows64/ControllerBinds.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "ControllerBinds.h" diff --git a/Minecraft.Client/Windows64/ControllerBinds.h b/Minecraft.Client/Windows64/ControllerBinds.h index af02f2b0..2ec8e318 100644 --- a/Minecraft.Client/Windows64/ControllerBinds.h +++ b/Minecraft.Client/Windows64/ControllerBinds.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) class ControllerBinds { diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index 37d8ac43..0440c582 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "KeyboardMouseInput.h" #include diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index d787540b..9a5c50f3 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include diff --git a/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.cpp b/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.cpp index 3ce99e40..6b121749 100644 --- a/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.cpp +++ b/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "NetworkPlayerWindows.h" #include "..\..\..\Minecraft.World\Socket.h" diff --git a/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.h b/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.h index b497ec98..acd94f80 100644 --- a/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.h +++ b/Minecraft.Client/Windows64/Network/NetworkPlayerWindows.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #include diff --git a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp index 83f0a598..547962e6 100644 --- a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp +++ b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #include diff --git a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h index 153daf5d..cf6fa5fe 100644 --- a/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h +++ b/Minecraft.Client/Windows64/Network/PlatformNetworkManagerWindows.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #include diff --git a/Minecraft.Client/Windows64/Network/WindowsNetworkConfig.h b/Minecraft.Client/Windows64/Network/WindowsNetworkConfig.h index 67af67d4..55dd52a4 100644 --- a/Minecraft.Client/Windows64/Network/WindowsNetworkConfig.h +++ b/Minecraft.Client/Windows64/Network/WindowsNetworkConfig.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #define WIN64_NET_DEFAULT_PORT 25565 diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 278758b9..1082dab1 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -1005,7 +1005,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) int vk = static_cast(wParam); if ((lParam & 0x40000000) && vk != VK_LEFT && vk != VK_RIGHT && vk != VK_BACK) break; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) const Minecraft* pm = Minecraft::GetInstance(); ChatScreen* chat = pm && pm->screen ? dynamic_cast(pm->screen) : nullptr; if (chat) diff --git a/Minecraft.Client/Windows64/Windows64_Xuid.h b/Minecraft.Client/Windows64/Windows64_Xuid.h index b76c3540..4d8ca644 100644 --- a/Minecraft.Client/Windows64/Windows64_Xuid.h +++ b/Minecraft.Client/Windows64/Windows64_Xuid.h @@ -1,6 +1,6 @@ #pragma once -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #include diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index 7e1ba077..86ac95df 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -182,7 +182,7 @@ typedef XUID GameSessionUID; #include "Durango/4JLibs/inc/4J_Profile.h" #include "Durango/4JLibs/inc/4J_Render.h" #include "Durango/4JLibs/inc/4J_Storage.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #include #include "Windows64/4JLibs/inc/4J_Input.h" #include "Windows64/4JLibs/inc/4J_Profile.h" @@ -292,7 +292,7 @@ typedef XUID GameSessionUID; #include "Durango/Iggy/include/iggy.h" #include "Durango/Iggy/gdraw/gdraw_d3d11.h" #include "Durango/Durango_UIController.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #include "Windows64/Sentient/MinecraftTelemetry.h" #include "Windows64Media/strings.h" #include "Windows64/Windows64_App.h" diff --git a/Minecraft.Client/stubs.cpp b/Minecraft.Client/stubs.cpp index ddf2d99d..7163f99a 100644 --- a/Minecraft.Client/stubs.cpp +++ b/Minecraft.Client/stubs.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "Windows64/KeyboardMouseInput.h" static const int s_keyToVK[] = { diff --git a/Minecraft.Client/stubs.h b/Minecraft.Client/stubs.h index c9f3b0f2..be9d7ceb 100644 --- a/Minecraft.Client/stubs.h +++ b/Minecraft.Client/stubs.h @@ -187,7 +187,7 @@ class Keyboard public: static void create() {} static void destroy() {} -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static bool isKeyDown(int keyCode); #else static bool isKeyDown(int) { return false; } @@ -253,7 +253,7 @@ public: static const int KEY_RIGHT = 55; static const int KEY_SLASH = 56; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Map LWJGL-style key constant to Windows VK code static int toVK(int keyConst); #endif @@ -264,7 +264,7 @@ class Mouse public: static void create() {} static void destroy() {} -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) static int getX(); static int getY(); static bool isButtonDown(int button); diff --git a/Minecraft.Server/Security/RateLimiter.h b/Minecraft.Server/Security/RateLimiter.h index aab7a5cb..655fd12c 100644 --- a/Minecraft.Server/Security/RateLimiter.h +++ b/Minecraft.Server/Security/RateLimiter.h @@ -4,7 +4,7 @@ #include #include -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #endif diff --git a/Minecraft.World/AbstractContainerMenu.cpp b/Minecraft.World/AbstractContainerMenu.cpp index 02bdd3bf..193e95a3 100644 --- a/Minecraft.World/AbstractContainerMenu.cpp +++ b/Minecraft.World/AbstractContainerMenu.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.redstone.h" #include "Slot.h" #include "AbstractContainerMenu.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "Mth.h" #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -252,7 +252,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto { if (buttonNum == 0) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { auto carried = inventory->getCarried(); bool dropAllowed = true; @@ -278,14 +278,14 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto #endif player->drop(inventory->getCarried()); inventory->setCarried(nullptr); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) } } #endif } if (buttonNum == 1) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { auto carried = inventory->getCarried(); bool dropAllowed = true; @@ -312,7 +312,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto #endif player->drop(inventory->getCarried()->remove(1)); if (inventory->getCarried()->count == 0) inventory->setCarried(nullptr); -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) } } #endif @@ -538,7 +538,7 @@ shared_ptr AbstractContainerMenu::clicked(int slotIndex, int butto if (slot != nullptr && slot->hasItem() && slot->mayPickup(player)) { int dropCount = buttonNum == 0 ? 1 : slot->getItem()->count; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) // fix for issue reported by aiden { auto slotItem = slot->getItem(); diff --git a/Minecraft.World/BiomeOverrideLayer.cpp b/Minecraft.World/BiomeOverrideLayer.cpp index 39747bc0..4f9b6b6e 100644 --- a/Minecraft.World/BiomeOverrideLayer.cpp +++ b/Minecraft.World/BiomeOverrideLayer.cpp @@ -13,7 +13,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup) wstring path = L"GAME:\\GameRules\\biomemap.bin"; HANDLE file = CreateFile(path.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string path = "GameRules\\biomemap.bin"; #else string path = "GAME:\\GameRules\\biomemap.bin"; diff --git a/Minecraft.World/CactusTile.cpp b/Minecraft.World/CactusTile.cpp index c63fc8c4..21e5f2f9 100644 --- a/Minecraft.World/CactusTile.cpp +++ b/Minecraft.World/CactusTile.cpp @@ -7,7 +7,7 @@ #include "net.minecraft.h" #include "net.minecraft.world.h" #include "CactusTile.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -59,7 +59,7 @@ void CactusTile::tick(Level *level, int x, int y, int z, Random *random) int age = level->getData(x, y, z); if (age == 15) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockGrow(level->dimension->id, x, y + 1, z, id, 0)) return; #endif diff --git a/Minecraft.World/ChorusFruitItem.cpp b/Minecraft.World/ChorusFruitItem.cpp index 0f77ff3e..4a9ff90d 100644 --- a/Minecraft.World/ChorusFruitItem.cpp +++ b/Minecraft.World/ChorusFruitItem.cpp @@ -7,7 +7,7 @@ #include "ItemInstance.h" #include "ChorusFruitItem.h" #include "SoundTypes.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -48,7 +48,7 @@ bool ChorusFruitItem::randomTeleport(Level *level, shared_ptr player, do player->setPos(xo, yo, zo); if (!ok) return false; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double outX, outY, outZ; bool cancelled = FourKitBridge::FirePlayerTeleport( diff --git a/Minecraft.World/Class.h b/Minecraft.World/Class.h index 07e15715..f4dcd678 100644 --- a/Minecraft.World/Class.h +++ b/Minecraft.World/Class.h @@ -361,7 +361,7 @@ inline bool eTYPE_FLAGSET(eINSTANCEOF flag, eINSTANCEOF claz) /// FOR CHECKING /// -#if !(defined _WINDOWS64) +#if !((defined(_WINDOWS64) || defined(__linux__))) class SubClass { diff --git a/Minecraft.World/CocoaTile.cpp b/Minecraft.World/CocoaTile.cpp index 5385e99a..b1b36394 100644 --- a/Minecraft.World/CocoaTile.cpp +++ b/Minecraft.World/CocoaTile.cpp @@ -5,7 +5,7 @@ #include "net.minecraft.world.h" #include "net.minecraft.h" #include "CocoaTile.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -70,7 +70,7 @@ void CocoaTile::tick(Level *level, int x, int y, int z, Random *random) int age = getAge(data); if (age < 2) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockGrow(level->dimension->id, x, y, z, level->getTile(x, y, z), ((age + 1) << 2) | getDirection(data))) return; #endif diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index cc4602a6..8c7bbc6b 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -133,7 +133,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS if(progress) { -#ifndef _WINDOWS64 +#if !defined(_WINDOWS64) && !defined(__linux__) progress->progressStage(IDS_SAVETRANSFER_STAGE_CONVERTING); #endif } diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index e98e46d9..5173fff2 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -677,7 +677,7 @@ bool ConsoleSaveFileOriginal::doesFileExist(ConsoleSavePath file) void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) { -#if defined(MINECRAFT_SERVER_BUILD) || defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) +#if defined(MINECRAFT_SERVER_BUILD) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_DURANGO) || defined(__ORBIS__) #if defined(MINECRAFT_SERVER_BUILD) const bool useBackgroundSave = true; #else @@ -713,7 +713,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) unsigned int fileSize = header.GetFileSize(); -#if defined(MINECRAFT_SERVER_BUILD) || defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) +#if defined(MINECRAFT_SERVER_BUILD) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_DURANGO) || defined(__ORBIS__) if (useBackgroundSave) { byte *snap = new (std::nothrow) byte[fileSize]; @@ -874,7 +874,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) PBYTE pbDataSaveImage=nullptr; DWORD dwDataSizeSaveImage=0; -#if ( defined _XBOX || defined _DURANGO || defined _WINDOWS64 ) +#if ( defined _XBOX || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__)) ) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); #elif ( defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ ) app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage); @@ -916,7 +916,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) } ReleaseSaveAccess(); -#elif (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) +#elif (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__))) // set the icon and save image StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); app.DebugPrintf("Save thumbnail size %d\n",dwThumbnailDataSize); @@ -940,7 +940,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) #endif } -#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) +#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__))) int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) { @@ -951,7 +951,7 @@ int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) app.DebugPrintf("SaveSaveDataCallback: save write failed\n"); } -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // 4J Added: After save completes, capture the save folder name for hardcore world deletion if (bRes && app.GetCurrentSaveFolderName().empty()) { @@ -996,7 +996,7 @@ int ConsoleSaveFileOriginal::SaveSaveDataCallback(LPVOID lpParam,bool bRes) } #endif -#if defined(MINECRAFT_SERVER_BUILD) || defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) +#if defined(MINECRAFT_SERVER_BUILD) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_DURANGO) || defined(__ORBIS__) s_bgSaveActive.store(false, std::memory_order_release); #endif diff --git a/Minecraft.World/ConsoleSaveFileOriginal.h b/Minecraft.World/ConsoleSaveFileOriginal.h index c5a6192a..577cd1fe 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.h +++ b/Minecraft.World/ConsoleSaveFileOriginal.h @@ -32,7 +32,7 @@ private: void MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite); public: -#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || defined _WINDOWS64) +#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ || defined _DURANGO || (defined(_WINDOWS64) || defined(__linux__))) static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); #endif ConsoleSaveFileOriginal(const wstring &fileName, LPVOID pvSaveData = nullptr, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); @@ -77,7 +77,7 @@ public: virtual void LockSaveAccess(); virtual void ReleaseSaveAccess(); -#if defined(MINECRAFT_SERVER_BUILD) || defined(_WINDOWS64) || defined(_DURANGO) || defined(__ORBIS__) +#if defined(MINECRAFT_SERVER_BUILD) || (defined(_WINDOWS64) || defined(__linux__)) || defined(_DURANGO) || defined(__ORBIS__) static void flushPendingBackgroundSave(); static bool hasPendingBackgroundSave(); #endif diff --git a/Minecraft.World/CropTile.cpp b/Minecraft.World/CropTile.cpp index a8408462..e9ff27f5 100644 --- a/Minecraft.World/CropTile.cpp +++ b/Minecraft.World/CropTile.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.item.h" #include "net.minecraft.world.h" #include "CropTile.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -72,7 +72,7 @@ void CropTile::tick(Level *level, int x, int y, int z, Random *random) if (random->nextInt(static_cast(25 / growthSpeed) + 1) == 0) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockGrow(level->dimension->id, x, y, z, level->getTile(x, y, z), age + 1)) return; #endif diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index e4f80602..dce5b4df 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -24,7 +24,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt wstring path = L"GAME:\\GameRules\\heightmap.bin"; #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string path = "GameRules\\heightmap.bin"; #else string path = "GAME:\\GameRules\\heightmap.bin"; @@ -66,7 +66,7 @@ CustomLevelSource::CustomLevelSource(Level *level, int64_t seed, bool generateSt wstring waterHeightPath = L"GAME:\\GameRules\\waterheight.bin"; #else -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string waterHeightPath = "GameRules\\waterheight.bin"; #else string waterHeightPath = "GAME:\\GameRules\\waterheight.bin"; diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index e2aabbfe..02d63db7 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -285,7 +285,7 @@ LevelData *DirectoryLevelStorage::prepareLevel() for(unsigned int i = 0; i < count; ++i) { PlayerUID playerUid = dis.readPlayerUID(); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) app.DebugPrintf(" -- %d\n", playerUid); #else app.DebugPrintf(" -- %ls\n", playerUid.toString().c_str()); @@ -695,7 +695,7 @@ void DirectoryLevelStorage::saveMapIdLookup() app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size()); for ( auto& it : m_playerMappings ) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) app.DebugPrintf(" -- %d\n", it.first); #else app.DebugPrintf(" -- %ls\n", it.first.toString().c_str()); diff --git a/Minecraft.World/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index b3cf0f76..d07e37f2 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -127,7 +127,7 @@ bool DyePowderItem::useOn(shared_ptr itemInstance, shared_ptrgetAuxValue() == WHITE) { // bone meal is a fertilizer, so instantly grow trees and stuff -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (growCrop(itemInstance, level, x, y, z, bTestUseOnOnly, player->entityId)) #else if (growCrop(itemInstance, level, x, y, z, bTestUseOnOnly)) @@ -179,7 +179,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (level->random->nextFloat() < 0.45) static_cast(Tile::sapling)->advanceTree(level, x, y, z, level->random, false, entityId); #else if (level->random->nextFloat() < 0.45) static_cast(Tile::sapling)->advanceTree(level, x, y, z, level->random); @@ -198,7 +198,7 @@ bool DyePowderItem::growCrop(shared_ptr itemInstance, Level *level { if (!level->isClientSide) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (level->random->nextFloat() < 0.4) static_cast(Tile::tiles[tile])->growTree(level, x, y, z, level->random, false, entityId); #else if (level->random->nextFloat() < 0.4) static_cast(Tile::tiles[tile])->growTree(level, x, y, z, level->random); diff --git a/Minecraft.World/EggTile.cpp b/Minecraft.World/EggTile.cpp index 16c9aa0b..7522fc0c 100644 --- a/Minecraft.World/EggTile.cpp +++ b/Minecraft.World/EggTile.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.tile.h" #include "net.minecraft.world.entity.item.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -78,7 +78,7 @@ void EggTile::teleport(Level *level, int x, int y, int z) // Don't set tiles on client, and don't create particles on the server (matches later change in Java) if(!level->isClientSide) { - #if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) + #if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockFromTo(level->dimension->id, x, y, z, xt, yt, zt, 6 /*SELF*/)) continue; #endif diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 23e1051c..a7541f9f 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -36,7 +36,7 @@ File::File( const wstring& pathname ) //: parent( nullptr ) else m_abstractPathName = pathname; -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) string path = wstringtochararray(m_abstractPathName); string finalPath = StorageManager.GetMountedPath(path.c_str()); if(finalPath.size() == 0) finalPath = path; diff --git a/Minecraft.World/FileHeader.h b/Minecraft.World/FileHeader.h index 60f5d903..d50c887b 100644 --- a/Minecraft.World/FileHeader.h +++ b/Minecraft.World/FileHeader.h @@ -68,7 +68,7 @@ enum ESavePlatform SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_PS4 #elif defined __PSVITA__ SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_PSVITA -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) SAVE_FILE_PLATFORM_LOCAL = SAVE_FILE_PLATFORM_WIN64 #endif }; diff --git a/Minecraft.World/FireTile.cpp b/Minecraft.World/FireTile.cpp index dd06f353..f8899388 100644 --- a/Minecraft.World/FireTile.cpp +++ b/Minecraft.World/FireTile.cpp @@ -7,7 +7,7 @@ #include "SoundTypes.h" #include "../Minecraft.Client/MinecraftServer.h" #include "../Minecraft.Client/PlayerList.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -239,7 +239,7 @@ void FireTile::tick(Level *level, int x, int y, int z, Random *random) { if (!(level->isRaining() && level->isRainingAt(xx, yy, zz) || level->isRainingAt(xx - 1, yy, z) || level->isRainingAt(xx + 1, yy, zz) || level->isRainingAt(xx, yy, zz - 1) || level->isRainingAt(xx, yy, zz + 1))) { - #if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) + #if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockSpread(level->dimension->id, xx, yy, zz, x, y, z, id, min(age + random->nextInt(5) / 4, 15))) #endif { @@ -266,7 +266,7 @@ void FireTile::checkBurnOut(Level *level, int x, int y, int z, int chance, Rando int odds = burnOdds[level->getTile(x, y, z)]; if (random->nextInt(chance) < odds) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockBurn(level->dimension->id, x, y, z)) return; #endif diff --git a/Minecraft.World/GrassTile.cpp b/Minecraft.World/GrassTile.cpp index 710cbc6f..474bb405 100644 --- a/Minecraft.World/GrassTile.cpp +++ b/Minecraft.World/GrassTile.cpp @@ -6,7 +6,7 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.h" #include "net.minecraft.world.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -122,7 +122,7 @@ void GrassTile::tick(Level *level, int x, int y, int z, Random *random) int above = level->getTile(xt, yt + 1, zt); if (level->getTile(xt, yt, zt) == Tile::dirt_Id && level->getData(xt, yt, zt) == 0 && level->getRawBrightness(xt, yt + 1, zt) >= MIN_BRIGHTNESS && Tile::lightBlock[above] <= 2) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockSpread(level->dimension->id, xt, yt, zt, x, y, z, Tile::grass_Id, 0)) #endif level->setTileAndUpdate(xt, yt, zt, Tile::grass_Id); diff --git a/Minecraft.World/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index aa042d27..ef87bb53 100644 --- a/Minecraft.World/ItemEntity.cpp +++ b/Minecraft.World/ItemEntity.cpp @@ -13,7 +13,7 @@ #include "ItemEntity.h" #include "SoundTypes.h" -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #if defined(MINECRAFT_SERVER_BUILD) @@ -75,7 +75,7 @@ ItemEntity::ItemEntity(Level *level) : Entity( level ) ItemEntity::~ItemEntity() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DynamicLighting::removeDynamicEntityLightSource(this); #endif } @@ -252,7 +252,7 @@ void ItemEntity::playerTouch(shared_ptr player) int orgCount = item->count; if (throwTime == 0) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int outItemId = item->id, outItemCount = orgCount, outItemAux = item->getAuxValue(); if (FourKitBridge::FirePlayerPickupItem( @@ -335,7 +335,7 @@ void ItemEntity::setItem(shared_ptr item) { getEntityData()->set(DATA_ITEM, item); getEntityData()->markDirty(DATA_ITEM); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (DynamicLighting::getEntityLuminance(this) > 0) { DynamicLighting::addDynamicEntityLightSource(this); diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 72aab34e..8fab1d0b 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -39,7 +39,7 @@ #include "../Minecraft.Client/Common/DLC/DLCPack.h" #include "../Minecraft.Client/PS3/PS3Extras/ShutdownManager.h" #include "../Minecraft.Client/MinecraftServer.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include "../Minecraft.Client/DynamicLighting.h" #endif @@ -1745,7 +1745,7 @@ bool Level::addEntity(shared_ptr e) MemSect(44); entityAdded(e); MemSect(0); -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) if (e->GetType() & BIT_LIVING_ENTITY) { DynamicLighting::addDynamicEntityLightSource(e.get()); diff --git a/Minecraft.World/LiquidTileDynamic.cpp b/Minecraft.World/LiquidTileDynamic.cpp index 25a8e821..eb1a7392 100644 --- a/Minecraft.World/LiquidTileDynamic.cpp +++ b/Minecraft.World/LiquidTileDynamic.cpp @@ -2,7 +2,7 @@ #include "net.minecraft.world.level.h" #include "LiquidTileDynamic.h" #include "net.minecraft.world.level.dimension.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -183,7 +183,7 @@ void LiquidTileDynamic::trySpreadTo(Level *level, int x, int y, int z, int fromX { if (canSpreadTo(level, x, y, z)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int face = 6; // SELF int dx = x - fromX, dy = y - fromY, dz = z - fromZ; diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 41f5852b..b8b1f528 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -35,7 +35,7 @@ #include "ItemEntity.h" #include "TilePos.h" -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) #include "DynamicLighting.h" #if defined(MINECRAFT_SERVER_BUILD) @@ -132,7 +132,7 @@ LivingEntity::LivingEntity( Level* level) : Entity(level) LivingEntity::~LivingEntity() { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DynamicLighting::removeDynamicEntityLightSource(this); #endif @@ -369,7 +369,7 @@ void LivingEntity::tickDeath() { if (!isBaby() && level->getGameRules()->getBoolean(GameRules::RULE_DOMOBLOOT)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int xpCount = fourKitDeathExpSet ? fourKitDeathExp : this->getExperienceReward(lastHurtByPlayer); #else int xpCount = this->getExperienceReward(lastHurtByPlayer); @@ -852,7 +852,7 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) noActionTime = 0; if (getHealth() <= 0) return false; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { // (SYLV)todo: map these properly @@ -1028,7 +1028,7 @@ void LivingEntity::die(DamageSource *source) dead = true; -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!level->isClientSide && !instanceof(eTYPE_SERVERPLAYER) && !instanceof(eTYPE_PLAYER)) { int entityTypeId = FourKitBridge::MapEntityType((int)GetType()); diff --git a/Minecraft.World/Mushroom.cpp b/Minecraft.World/Mushroom.cpp index 72bcfd01..62b1ce23 100644 --- a/Minecraft.World/Mushroom.cpp +++ b/Minecraft.World/Mushroom.cpp @@ -5,7 +5,7 @@ #include "Dimension.h" #include "Mushroom.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -53,7 +53,7 @@ void Mushroom::tick(Level *level, int x, int y, int z, Random *random) if (level->isEmptyTile(x2, y2, z2) && canSurvive(level, x2, y2, z2)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockSpread(level->dimension->id, x2, y2, z2, x, y, z, id, 0)) #endif level->setTileAndData(x2, y2, z2, id, 0, UPDATE_CLIENTS); @@ -95,7 +95,7 @@ bool Mushroom::growTree(Level *level, int x, int y, int z, Random *random, bool f = new HugeMushroomFeature(1); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireStructureGrow(level->dimension->id, x, y, z, (id == Tile::mushroom_brown_Id ? 6 : 7), !naturalGrowth, entityId)) { if (f != nullptr) delete f; f = nullptr; diff --git a/Minecraft.World/NetherWartTile.cpp b/Minecraft.World/NetherWartTile.cpp index f586b346..872ca75d 100644 --- a/Minecraft.World/NetherWartTile.cpp +++ b/Minecraft.World/NetherWartTile.cpp @@ -4,7 +4,7 @@ #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.item.h" #include "net.minecraft.world.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -66,7 +66,7 @@ void NetherWartTile::tick(Level *level, int x, int y, int z, Random *random) { if (random->nextInt(10) == 0) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockGrow(level->dimension->id, x, y, z, level->getTile(x, y, z), age + 1)) { return; diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index d9a75742..78968a1b 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -13,7 +13,7 @@ #include #include #include -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -249,7 +249,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, if (param1 == TRIGGER_EXTEND) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { int pushLength = 0; int cx = x + Facing::STEP_X[facing]; @@ -298,7 +298,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, } else if (param1 == TRIGGER_CONTRACT) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FirePistonRetract(level->dimension->id, x, y, z, facing)) { level->setData(x, y, z, facing | EXTENDED_BIT, UPDATE_CLIENTS); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index a6303103..90916b13 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -416,7 +416,7 @@ void Player::tick() if( count++ == 100 ) { #if 0 -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) // Drop some items so we have them in inventory to play with this->drop( shared_ptr( new ItemInstance(Tile::recordPlayer) ) ); this->drop( shared_ptr( new ItemInstance(Item::map) ) ); diff --git a/Minecraft.World/ReedTile.cpp b/Minecraft.World/ReedTile.cpp index db56c9bc..0e595431 100644 --- a/Minecraft.World/ReedTile.cpp +++ b/Minecraft.World/ReedTile.cpp @@ -5,7 +5,7 @@ #include "net.minecraft.world.level.material.h" #include "net.minecraft.world.phys.h" #include "ReedTile.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -63,7 +63,7 @@ void ReedTile::tick(Level *level, int x, int y, int z, Random* random) int age = level->getData(x, y, z); if (age == 15) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (FourKitBridge::FireBlockGrow(level->dimension->id, x, y + 1, z, id, 0)) return; #endif diff --git a/Minecraft.World/Sapling.cpp b/Minecraft.World/Sapling.cpp index 5c76d3fa..1f36f47b 100644 --- a/Minecraft.World/Sapling.cpp +++ b/Minecraft.World/Sapling.cpp @@ -10,7 +10,7 @@ #include "RoofTreeFeature.h" #include "MegaPineTreeFeature.h" -#if defined(_WINDOWS64) +#if defined(_WINDOWS64) || defined(__linux__) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -203,7 +203,7 @@ void Sapling::growTree(Level* level, int x, int y, int z, Random* random, bool n } } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) int TreeType = data; if (data != TYPE_EVERGREEN && data != TYPE_BIRCH && data != TYPE_JUNGLE) { diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index 06a9f192..e9c6e508 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -6,7 +6,7 @@ #include "../Minecraft.Client/Minecraft.h" #include "../Minecraft.Client/Common/Colours/ColourTable.h" #include "StemTile.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #include "Dimension.h" #endif @@ -93,7 +93,7 @@ void StemTile::tick(Level *level, int x, int y, int z, Random *random) int below = level->getTile(xx, y - 1, zz); if (level->getTile(xx, y, zz) == 0 && (below == Tile::farmland_Id || below == Tile::dirt_Id || below == Tile::grass_Id)) { -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) if (!FourKitBridge::FireBlockGrow(level->dimension->id, xx, y, zz, fruit->id, 0)) #endif level->setTileAndUpdate(xx, y, zz, fruit->id); diff --git a/Minecraft.World/ThreadName.cpp b/Minecraft.World/ThreadName.cpp index 1f63aaf0..040c7541 100644 --- a/Minecraft.World/ThreadName.cpp +++ b/Minecraft.World/ThreadName.cpp @@ -19,7 +19,7 @@ void SetThreadName( DWORD dwThreadID, LPCSTR szThreadName ) info.dwThreadID = dwThreadID; info.dwFlags = 0; -#if ( defined _WINDOWS64 | defined _DURANGO ) +#if ( (defined(_WINDOWS64) || defined(__linux__)) | defined _DURANGO ) __try { RaiseException(0x406D1388, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR *)&info); diff --git a/Minecraft.World/ThrownEnderpearl.cpp b/Minecraft.World/ThrownEnderpearl.cpp index b2109a1b..3655b412 100644 --- a/Minecraft.World/ThrownEnderpearl.cpp +++ b/Minecraft.World/ThrownEnderpearl.cpp @@ -9,7 +9,7 @@ #include "../Minecraft.Client/PlayerConnection.h" #include "ThrownEnderpearl.h" #include "Endermite.h" -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) #include "../Minecraft.Server/FourKitBridge.h" #endif @@ -102,7 +102,7 @@ void ThrownEnderpearl::onHit(HitResult *res) getOwner()->ride(nullptr); } -#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD) +#if (defined(_WINDOWS64) || defined(__linux__)) && defined(MINECRAFT_SERVER_BUILD) { double outX, outY, outZ; diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index acf9c3ce..28044a49 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -164,7 +164,7 @@ void MemSect(int sect); #include "../Minecraft.Client/Durango/4JLibs/inc/4J_Render.h" #include "../Minecraft.Client/Durango/4JLibs/inc/4J_Storage.h" #include "../Minecraft.Client/Durango/4JLibs/inc/4J_Input.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Profile.h" #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Render.h" #include "../Minecraft.Client/Windows64/4JLibs/inc/4J_Storage.h" @@ -226,7 +226,7 @@ void MemSect(int sect); #include "../Minecraft.Client/Durango/Sentient/MinecraftTelemetry.h" #include "../Minecraft.Client/Durango/Sentient/TelemetryEnum.h" -#elif defined _WINDOWS64 +#elif defined(_WINDOWS64) || defined(__linux__) #include "../Minecraft.Client/Windows64/Windows64_App.h" #include "Windows64Media/strings.h" #include "../Minecraft.Client/Windows64/Sentient/SentientTelemetryCommon.h" diff --git a/Minecraft.World/system.cpp b/Minecraft.World/system.cpp index 71d0a85e..9cab8553 100644 --- a/Minecraft.World/system.cpp +++ b/Minecraft.World/system.cpp @@ -52,7 +52,7 @@ void System::arraycopy(arrayWithLength src, unsigned int srcPos, arrayWithL //The current value of the system timer, in nanoseconds. int64_t System::nanoTime() { -#if defined _WINDOWS64 || defined _XBOX || defined _WIN32 +#if (defined(_WINDOWS64) || defined(__linux__)) || defined _XBOX || defined _WIN32 static LARGE_INTEGER s_frequency = { 0 }; if (s_frequency.QuadPart == 0) { diff --git a/include/lce_filesystem/lce_filesystem.cpp b/include/lce_filesystem/lce_filesystem.cpp index e4dac0a0..4e25c64c 100644 --- a/include/lce_filesystem/lce_filesystem.cpp +++ b/include/lce_filesystem/lce_filesystem.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "lce_filesystem.h" -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) #include #endif // TODO: More os' filesystem handling for when the project moves away from only Windows @@ -9,7 +9,7 @@ bool FileOrDirectoryExists(const char* path) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DWORD attribs = GetFileAttributesA(path); return (attribs != INVALID_FILE_ATTRIBUTES); #else @@ -20,7 +20,7 @@ bool FileOrDirectoryExists(const char* path) bool FileExists(const char* path) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DWORD attribs = GetFileAttributesA(path); return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); #else @@ -31,7 +31,7 @@ bool FileExists(const char* path) bool DirectoryExists(const char* path) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) DWORD attribs = GetFileAttributesA(path); return (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY)); #else @@ -42,7 +42,7 @@ bool DirectoryExists(const char* path) bool GetFirstFileInDirectory(const char* directory, char* outFilePath, size_t outFilePathSize) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) char searchPath[MAX_PATH]; snprintf(searchPath, MAX_PATH, "%s\\*", directory);