diff --git a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp index 7b84e190b..753dd3411 100644 --- a/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp +++ b/Minecraft.Client/Build/Common/Leaderboards/LeaderboardManager.cpp @@ -9,6 +9,8 @@ const wstring LeaderboardManager::filterNames[eNumFilterModes] = L"Friends", L"MyScore", L"TopRank" }; +LeaderboardManager *LeaderboardManager::m_instance = NULL; + void LeaderboardManager::DeleteInstance() { delete m_instance; diff --git a/Minecraft.Client/Build/Common/Telemetry/TelemetryManager.h b/Minecraft.Client/Build/Common/Telemetry/TelemetryManager.h index 56bde22b5..5877845e5 100644 --- a/Minecraft.Client/Build/Common/Telemetry/TelemetryManager.h +++ b/Minecraft.Client/Build/Common/Telemetry/TelemetryManager.h @@ -1,6 +1,13 @@ #pragma once +// On Linux, the Orbis TelemetryEnum.h is already pulled in via stdafx.h -> +// SentientManager.h -> MinecraftTelemetry.h. Using the Windows64 path would +// cause duplicate enum definitions. +#if defined(__linux__) +#include "../../../Platform/Orbis/Sentient/TelemetryEnum.h" +#else #include "../../../Platform/Windows64/Sentient/TelemetryEnum.h" +#endif #include "../UI/UIEnums.h" class CTelemetryManager diff --git a/Minecraft.Client/Build/Extrax64Stubs.cpp b/Minecraft.Client/Build/Extrax64Stubs.cpp index ea7c6394e..0ebd31b49 100644 --- a/Minecraft.Client/Build/Extrax64Stubs.cpp +++ b/Minecraft.Client/Build/Extrax64Stubs.cpp @@ -26,6 +26,12 @@ #include "../Platform/PSVita/Social/SocialManager.h" #include "../Platform/PSVita/Sentient/DynamicConfigurations.h" #include +#elif defined __linux__ +// On Linux, stdafx.h already provides Orbis-compatible Sentient/Dynamic headers +// via #pragma once. Pull in SentientManager for CSentientManager class declaration +// and StatsCounter; CSocialManager is provided as inline stubs via Platform/Linux/Social/SocialManager.h. +#include "../Platform/Orbis/Sentient/SentientManager.h" +#include "../GameState/StatsCounter.h" #else #include "../Platform/Orbis/Sentient/SentientManager.h" #include "../GameState/StatsCounter.h" @@ -42,13 +48,14 @@ C_4JProfile ProfileManager; CSentientManager SentientManager; CXuiStringTable StringTable; -#ifndef _XBOX_ONE +#if !defined(_XBOX_ONE) && !defined(__linux__) ATG::XMLParser::XMLParser() {} ATG::XMLParser::~XMLParser() {} HRESULT ATG::XMLParser::ParseXMLBuffer( CONST CHAR* strBuffer, UINT uBufferSize ) { return S_OK; } VOID ATG::XMLParser::RegisterSAXCallbackInterface( ISAXCallback *pISAXCallback ) {} #endif +#ifndef __linux__ bool CSocialManager::IsTitleAllowedToPostAnything() { return false; } bool CSocialManager::AreAllUsersAllowedToPostImages() { return false; } bool CSocialManager::IsTitleAllowedToPostImages() { return false; } @@ -57,6 +64,7 @@ bool CSocialManager::PostLinkToSocialNetwork( ESocialNetwork eSocialNetwork, DWO bool CSocialManager::PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect ) { return false; } CSocialManager *CSocialManager::Instance() { return NULL; } void CSocialManager::SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc) {}; +#endif // !__linux__ DWORD XShowPartyUI(DWORD dwUserIndex) { return 0; } DWORD XShowFriendsUI(DWORD dwUserIndex) { return 0; } @@ -187,7 +195,9 @@ D3DXVECTOR3& D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& add ) { x += add.x; y BYTE IQNetPlayer::GetSmallId() { return 0; } void IQNetPlayer::SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags) { +#ifndef __linux__ app.DebugPrintf("Sending from 0x%x to 0x%x %d bytes\n",this,player,dwDataSize); +#endif } bool IQNetPlayer::IsSameSystem(IQNetPlayer *player) { return true; } DWORD IQNetPlayer::GetSendQueueSize( IQNetPlayer *player, DWORD dwFlags ) { return 0; } diff --git a/Minecraft.Client/Build/stdafx.h b/Minecraft.Client/Build/stdafx.h index 420f93ec3..7e54de33f 100644 --- a/Minecraft.Client/Build/stdafx.h +++ b/Minecraft.Client/Build/stdafx.h @@ -10,7 +10,7 @@ #define __STR2__(x) #x #define __STR1__(x) __STR2__(x) -#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : 4J Warning Msg: " +#define __LOC__ __FILE__ "(" __STR1__(__LINE__) ") : 4J Warning Msg: " // use - #pragma message(__LOC__"Need to do something here") @@ -295,14 +295,15 @@ typedef XUID GameSessionUID; #include "../Platform/Windows64/Windows64_UIController.h" #elif defined __linux__ // Linux build: avoid pulling in Windows64 platform headers (they cause - // symbol/class redefinitions). Use Linux-specific stubs and controller. - // FIXME: Produce proper Linux equivalents for telemetry/sentient/etc. - #include "../Platform/OrbisMedia/strings.h" // temporary strings - #include "../Platform/Xbox/Sentient/SentientTelemetryCommon.h" - #include "../Platform/Xbox/Sentient/DynamicConfigurations.h" - #include "../Platform/Xbox/GameConfig/Minecraft.spa.h" + // symbol/class redefinitions). Use Orbis-compatible stubs and Linux controller. + #include "../Platform/Linux/Linux_App.h" + #include "../Platform/OrbisMedia/strings.h" + #include "../Platform/Orbis/Sentient/SentientTelemetryCommon.h" + #include "../Platform/Orbis/Sentient/DynamicConfigurations.h" + #include "../Platform/Orbis/GameConfig/Minecraft.spa.h" #include "Common/Audio/SoundEngine.h" #include "../Platform/Linux/Linux_UIController.h" + #include "../Platform/Linux/Social/SocialManager.h" #elif defined __PSVITA__ #include "../Platform/PSVita/PSVita_App.h" #include "../Platform/PSVitaMedia/strings.h" // TODO - create PSVita-specific version of this diff --git a/Minecraft.Client/ClientConstants.h b/Minecraft.Client/ClientConstants.h index 82bba386f..850eb05e6 100644 --- a/Minecraft.Client/ClientConstants.h +++ b/Minecraft.Client/ClientConstants.h @@ -15,4 +15,5 @@ public: static const wstring VERSION_STRING; static const bool DEADMAU5_CAMERA_CHEATS = false; + static const bool IS_DEMO_VERSION = false; }; \ No newline at end of file diff --git a/Minecraft.Client/GameState/CreativeMode.cpp b/Minecraft.Client/GameState/CreativeMode.cpp index afcabccae..10adfce8f 100644 --- a/Minecraft.Client/GameState/CreativeMode.cpp +++ b/Minecraft.Client/GameState/CreativeMode.cpp @@ -2,6 +2,8 @@ #include "CreativeMode.h" #include "../Player/User.h" #include "../Player/LocalPlayer.h" +#include "../Level/MultiPlayerLevel.h" +#include "../Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" #include "../../Minecraft.World/Headers/net.minecraft.world.item.h" #include "../../Minecraft.World/Headers/net.minecraft.world.inventory.h" diff --git a/Minecraft.Client/GameState/GameMode.cpp b/Minecraft.Client/GameState/GameMode.cpp index c6df020f8..632618570 100644 --- a/Minecraft.Client/GameState/GameMode.cpp +++ b/Minecraft.Client/GameState/GameMode.cpp @@ -1,6 +1,7 @@ #include "../Build/stdafx.h" #include "GameMode.h" #include "../Player/LocalPlayer.h" +#include "../Level/MultiPlayerLevel.h" #include "../Rendering/LevelRenderer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" diff --git a/Minecraft.Client/GameState/SurvivalMode.cpp b/Minecraft.Client/GameState/SurvivalMode.cpp index 84f77eacf..0b71f4ee8 100644 --- a/Minecraft.Client/GameState/SurvivalMode.cpp +++ b/Minecraft.Client/GameState/SurvivalMode.cpp @@ -3,6 +3,8 @@ #include "DemoMode.h" #include "../Rendering/LevelRenderer.h" #include "../Player/LocalPlayer.h" +#include "../Level/MultiPlayerLevel.h" +#include "../Player/MultiPlayerLocalPlayer.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.h" #include "../../Minecraft.World/Headers/net.minecraft.world.level.tile.h" #include "../../Minecraft.World/Headers/net.minecraft.world.entity.player.h" @@ -67,7 +69,7 @@ bool SurvivalMode::destroyBlock(int x, int y, int z, int face) bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]); if (item != NULL) { - item->mineBlock(t, x, y, z, minecraft->player); + item->mineBlock(minecraft->level, t, x, y, z, minecraft->player); if (item->count == 0) { minecraft->player->removeSelectedItem(); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 670a6bed0..d5b2a669f 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -56,7 +56,7 @@ static void sigsegv_handler(int sig) { //#include "NetworkManager.h" #include "../../Rendering/Tesselator.h" #include "../../GameState/Options.h" -#include "../Windows64/Sentient/SentientManager.h" +#include "../Orbis/Sentient/SentientManager.h" #include "../../../Minecraft.World/Util/IntCache.h" #include "../../Textures/Textures.h" #include "../../../Minecraft.World/IO/Streams/Compression.h" diff --git a/Minecraft.Client/Platform/Linux/Linux_ShutdownManager.cpp b/Minecraft.Client/Platform/Linux/Linux_ShutdownManager.cpp new file mode 100644 index 000000000..cdb040555 --- /dev/null +++ b/Minecraft.Client/Platform/Linux/Linux_ShutdownManager.cpp @@ -0,0 +1,13 @@ +// Linux stub implementations for ShutdownManager +// The PS3/PSVita versions have full implementations; on Linux these are no-ops. +#include "../../Build/stdafx.h" +#include "../PS3/PS3Extras/ShutdownManager.h" + +void ShutdownManager::Initialise() {} +void ShutdownManager::StartShutdown() {} +void ShutdownManager::MainThreadHandleShutdown() {} + +void ShutdownManager::HasStarted(ShutdownManager::EThreadId /*threadId*/) {} +void ShutdownManager::HasStarted(ShutdownManager::EThreadId /*threadId*/, C4JThread::EventArray * /*eventArray*/) {} +bool ShutdownManager::ShouldRun(ShutdownManager::EThreadId /*threadId*/) { return true; } +void ShutdownManager::HasFinished(ShutdownManager::EThreadId /*threadId*/) {} diff --git a/Minecraft.Client/Platform/Linux/Social/SocialManager.h b/Minecraft.Client/Platform/Linux/Social/SocialManager.h new file mode 100644 index 000000000..43c3e046c --- /dev/null +++ b/Minecraft.Client/Platform/Linux/Social/SocialManager.h @@ -0,0 +1,42 @@ +// ts just stink, social manager is a stupid stub rn +#pragma once + +#ifndef _SOCIAL_MANAGER_H +#define _SOCIAL_MANAGER_H + +enum ESocialNetwork +{ + eFacebook = 0, + eNumSocialNetworks +}; + +class CSocialManager +{ +public: + static CSocialManager* Instance() + { + static CSocialManager s_instance; + return &s_instance; + } + + void Initialise() {} + void Tick() {} + + bool RefreshPostingCapability() { return false; } + bool IsTitleAllowedToPostAnything() { return false; } + bool IsTitleAllowedToPostImages() { return false; } + bool IsTitleAllowedToPostLinks() { return false; } + bool AreAllUsersAllowedToPostImages() { return false; } + + bool PostLinkToSocialNetwork( ESocialNetwork, DWORD, bool ) { return false; } + bool PostImageToSocialNetwork( ESocialNetwork, DWORD, bool ) { return false; } + + void SetSocialPostText( const WCHAR*, const WCHAR*, const WCHAR* ) {} + +private: + CSocialManager() {} + CSocialManager( const CSocialManager& ); + CSocialManager& operator=( const CSocialManager& ); +}; + +#endif // _SOCIAL_MANAGER_H diff --git a/Minecraft.Client/meson.build b/Minecraft.Client/meson.build index 5e073ba56..523528e5b 100644 --- a/Minecraft.Client/meson.build +++ b/Minecraft.Client/meson.build @@ -1,7 +1,21 @@ -# get all those files +# get all those files (excluding Sony-SDK-dependent, Xbox XUI, and redist dirs) _client_build_raw = run_command( 'sh', '-c', - 'find "' + meson.current_source_dir() / 'Build' + '" -name "*.cpp" ! -path "*/redist64/*"', + 'find "' + meson.current_source_dir() / 'Build' + '" -name "*.cpp"' + + ' ! -path "*/redist64/*"' + + ' ! -path "*/Network/Sony/*"' + + ' ! -path "*/Common/XUI/*"', + check : true, +).stdout().strip().split('\n') + +# Non-Build, non-Platform Minecraft.Client sources (Rendering/, UI/, Textures/, +# GameState/, Input/, Level/, Network/, Player/, Commands/, Utils/, etc.) +_client_root_raw = run_command( + 'sh', '-c', + 'find "' + meson.current_source_dir() + '" -name "*.cpp"' + + ' ! -path "*/Build/*"' + + ' ! -path "*/Platform/*"' + + ' ! -path "*/CMakeFiles/*"', check : true, ).stdout().strip().split('\n') @@ -12,6 +26,7 @@ _linux_cpp_sources = files( 'Platform/Linux/LinuxGL.cpp', 'Platform/Linux/Linux_Minecraft.cpp', 'Platform/Linux/Linux_UIController.cpp', + 'Platform/Linux/Linux_ShutdownManager.cpp', ) _linux_c_sources = files( @@ -19,7 +34,7 @@ _linux_c_sources = files( ) executable('Minecraft.Client', - _client_build_raw + _linux_cpp_sources + _linux_c_sources, + _client_build_raw + _client_root_raw + _linux_cpp_sources + _linux_c_sources, include_directories : include_directories('Build'), dependencies : [ render_dep, diff --git a/Minecraft.World/Blocks/Tile.h b/Minecraft.World/Blocks/Tile.h index 7eb8e72bf..c95dde200 100644 --- a/Minecraft.World/Blocks/Tile.h +++ b/Minecraft.World/Blocks/Tile.h @@ -560,7 +560,7 @@ public: virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual int getResourceCount(Random *random); virtual int getResource(int data, Random *random, int playerBonusLevel); - virtual float getDestroyProgress(shared_ptr player, Level *level, int x, int y, int z); + virtual float getDestroyProgress(shared_ptr player, Level *level = nullptr, int x = 0, int y = 0, int z = 0); virtual void spawnResources(Level *level, int x, int y, int z, int data, int playerBonusLevel); virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel); protected: @@ -582,7 +582,7 @@ public: virtual bool mayPlace(Level *level, int x, int y, int z); virtual bool TestUse(); virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr player); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param + virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace = 0, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool soundOnly = false); // 4J added soundOnly param virtual void stepOn(Level *level, int x, int y, int z, shared_ptr entity); virtual int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); virtual void prepareRender(Level *level, int x, int y, int z); diff --git a/Minecraft.World/Build/stdafx.h b/Minecraft.World/Build/stdafx.h index eff26050a..c5c28f6ae 100644 --- a/Minecraft.World/Build/stdafx.h +++ b/Minecraft.World/Build/stdafx.h @@ -239,12 +239,14 @@ void MemSect(int sect); #include "../../Minecraft.Client/Platform/PSVita/Sentient/SentientManager.h" #include "../../Minecraft.Client/Platform/PSVita/Sentient/MinecraftTelemetry.h" #elif defined(__linux__) - // FIXME: Move and port to ../Minecraft.Client/Linux + // Use Orbis-compatible headers on Linux (same as Minecraft.Client/Build/stdafx.h). + // All Orbis Sentient headers have #pragma once, preventing double-inclusion + // when DLC/other Common files also pull in Minecraft.Client stdafx.h. #include "../../Minecraft.Client/Platform/Linux/Linux_App.h" #include "../../Minecraft.Client/Platform/OrbisMedia/strings.h" - #include "../../Minecraft.Client/Platform/Xbox/Sentient/SentientTelemetryCommon.h" - #include "../../Minecraft.Client/Platform/Xbox/Sentient/DynamicConfigurations.h" - #include "../../Minecraft.Client/Platform/Xbox/GameConfig/Minecraft.spa.h" + #include "../../Minecraft.Client/Platform/Orbis/Sentient/SentientTelemetryCommon.h" + #include "../../Minecraft.Client/Platform/Orbis/Sentient/DynamicConfigurations.h" + #include "../../Minecraft.Client/Platform/Orbis/GameConfig/Minecraft.spa.h" // #include "../../Minecraft.Client/Platform/Windows64/Sentient/MinecraftTelemetry.h" #else #include "../../Minecraft.Client/Platform/Orbis/Orbis_App.h" diff --git a/Minecraft.World/Items/ItemInstance.h b/Minecraft.World/Items/ItemInstance.h index 6ee926f2a..acef2350a 100644 --- a/Minecraft.World/Items/ItemInstance.h +++ b/Minecraft.World/Items/ItemInstance.h @@ -69,7 +69,7 @@ public: Item *getItem() const; Icon *getIcon(); int getIconType(); - bool useOn(shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); + bool useOn(shared_ptr player, Level *level, int x, int y, int z, int face, float clickX = 0.0f, float clickY = 0.0f, float clickZ = 0.0f, bool bTestUseOnOnly=false); float getDestroySpeed(Tile *tile); bool TestUse(Level *level, shared_ptr player); shared_ptr use(Level *level, shared_ptr player); diff --git a/Minecraft.World/meson.build b/Minecraft.World/meson.build index 54958f894..aef4356b6 100644 --- a/Minecraft.World/meson.build +++ b/Minecraft.World/meson.build @@ -24,7 +24,10 @@ lib_world = static_library('Minecraft.World', ], ) +dep_zlib = dependency('zlib') + world_dep = declare_dependency( link_with : lib_world, + dependencies : [dep_zlib], include_directories : include_directories('Build/x64headers'), )