diff --git a/4J.Input/CMakeLists.txt b/4J.Input/CMakeLists.txt index 4783b4049..b23afb284 100644 --- a/4J.Input/CMakeLists.txt +++ b/4J.Input/CMakeLists.txt @@ -10,7 +10,7 @@ target_sources(${PROJECT_NAME} INP_Main.cpp INP_StringCheck.cpp stdafx.cpp - ../../Minecraft.Client/Linux/Stubs/LinuxStubs.h + ../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h ) target_include_directories(${PROJECT_NAME} PRIVATE diff --git a/4J.Render/4J_Render.h b/4J.Render/4J_Render.h index c69cf9df8..406702eba 100644 --- a/4J.Render/4J_Render.h +++ b/4J.Render/4J_Render.h @@ -1,8 +1,8 @@ #pragma once #ifdef __linux__ -#include "../../Minecraft.Client/Linux/Stubs/LinuxStubs.h" -#endif // __linux__ +#include "../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h" +#endif #include diff --git a/Minecraft.Client/Build/stubs.h b/Minecraft.Client/Build/stubs.h index f9196e206..b0c391c1d 100644 --- a/Minecraft.Client/Build/stubs.h +++ b/Minecraft.Client/Build/stubs.h @@ -1,6 +1,9 @@ #pragma once - +#ifdef __linux__ +#include +#include +#else const int GL_BYTE = 0; const int GL_FLOAT = 0; @@ -115,10 +118,34 @@ void glFog(int,FloatBuffer *); void glColorMaterial(int,int); void glMultiTexCoord2f(int, float, float); -//1.8.2 void glClientActiveTexture(int); void glActiveTexture(int); +#endif + +#ifdef __linux__ +#undef GL_SMOOTH +#undef GL_FLAT +#undef GL_ARRAY_BUFFER_ARB +#undef GL_STREAM_DRAW_ARB +class GL11 +{ +public: + static const int GL_SMOOTH = 0x1D01; + static const int GL_FLAT = 0x1D00; + static void glShadeModel(int mode) { ::glShadeModel(mode); } +}; + +class ARBVertexBufferObject +{ +public: + static const int GL_ARRAY_BUFFER_ARB = 0x8892; + static const int GL_STREAM_DRAW_ARB = 0x88E0; + static void glBindBufferARB(int, int) {} + static void glBufferDataARB(int, ByteBuffer *, int) {} + static void glGenBuffersARB(IntBuffer *) {} +}; +#else class GL11 { public: @@ -136,6 +163,7 @@ public: static void glBufferDataARB(int, ByteBuffer *, int) {} static void glGenBuffersARB(IntBuffer *) {} }; +#endif class Level; diff --git a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h index 0d5c41486..f4638c8e9 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h @@ -413,12 +413,27 @@ static inline HANDLE CreateFileA(const char *lpFileName, DWORD dwDesiredAccess, return fd == -1 ? INVALID_HANDLE_VALUE : (HANDLE)(intptr_t)fd; } +static inline HANDLE CreateFileW(const wchar_t *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, + void *lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + char narrowBuf[1024]; + wcstombs(narrowBuf, lpFileName, sizeof(narrowBuf)); + narrowBuf[sizeof(narrowBuf) - 1] = '\0'; + return CreateFileA(narrowBuf, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); +} + static inline HANDLE CreateFile(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, void *lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) { return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } +static inline HANDLE CreateFile(const wchar_t *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, + void *lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + return CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); +} + static inline BOOL CloseHandle(HANDLE hObject) { if (hObject == INVALID_HANDLE_VALUE) return FALSE; diff --git a/Minecraft.Client/Rendering/glWrapper.cpp b/Minecraft.Client/Rendering/glWrapper.cpp index d38274911..6134b7d45 100644 --- a/Minecraft.Client/Rendering/glWrapper.cpp +++ b/Minecraft.Client/Rendering/glWrapper.cpp @@ -1,4 +1,7 @@ #include "../Build/stdafx.h" + +#ifndef __linux__ + #include "../../Minecraft.World/IO/Streams/FloatBuffer.h" #include "../../Minecraft.World/IO/Streams/IntBuffer.h" #include "../../Minecraft.World/IO/Streams/ByteBuffer.h" @@ -386,4 +389,7 @@ void glTexGen(int coord, int mode, FloatBuffer *vec) void glCullFace(int dir) { RenderManager.StateSetFaceCullCW( dir == GL_BACK); -} \ No newline at end of file +} + +#endif +#endif \ No newline at end of file diff --git a/Minecraft.World/Build/CMakeLists.txt b/Minecraft.World/Build/CMakeLists.txt index 7f3ec8b04..b0f613c8e 100644 --- a/Minecraft.World/Build/CMakeLists.txt +++ b/Minecraft.World/Build/CMakeLists.txt @@ -1906,6 +1906,7 @@ endif() ################################################################################ # Target name ################################################################################ +if(MSVC) set_target_properties(${PROJECT_NAME} PROPERTIES TARGET_NAME_CONTENTPACKAGE_NO_TU "${OUTPUT_DIRECTORY}${PROJECT_NAME}" TARGET_NAME_CONTENTPACKAGE_SYMBOLS "${OUTPUT_DIRECTORY}${PROJECT_NAME}" @@ -1913,6 +1914,15 @@ set_target_properties(${PROJECT_NAME} PROPERTIES TARGET_NAME_DEBUG "${OUTPUT_DIRECTORY}${PROJECT_NAME}" TARGET_NAME_RELEASE "${OUTPUT_DIRECTORY}${PROJECT_NAME}" TARGET_NAME_RELEASEFORART "${OUTPUT_DIRECTORY}${PROJECT_NAME}") +else() +set_target_properties(${PROJECT_NAME} PROPERTIES + TARGET_NAME_CONTENTPACKAGE_NO_TU "${PROJECT_NAME}" + TARGET_NAME_CONTENTPACKAGE_SYMBOLS "${PROJECT_NAME}" + TARGET_NAME_CONTENTPACKAGE "${PROJECT_NAME}" + TARGET_NAME_DEBUG "${PROJECT_NAME}" + TARGET_NAME_RELEASE "${PROJECT_NAME}" + TARGET_NAME_RELEASEFORART "${PROJECT_NAME}") +endif() ################################################################################ # Output directory diff --git a/Minecraft.World/Build/stdafx.h b/Minecraft.World/Build/stdafx.h index b915a651e..421f7e1cf 100644 --- a/Minecraft.World/Build/stdafx.h +++ b/Minecraft.World/Build/stdafx.h @@ -176,11 +176,10 @@ void MemSect(int sect); #include "../../Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Storage.h" #include "../../Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h" #elif defined __linux__ -// FIXME: Port 4JLibs to POSIX -#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h" -#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Render.h" -#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h" -#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h" +#include "../../4J.Profile/4J_Profile.h" +#include "../../4J.Render/4J_Render.h" +#include "../../4J.Storage/4J_Storage.h" +#include "../../4J.Input/4J_Input.h" #else #include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h" #include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Render.h" diff --git a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp index 12eab3c37..f974f0c03 100644 --- a/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp +++ b/Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp @@ -284,7 +284,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 #ifdef __linux__ @@ -692,7 +692,7 @@ void DirectoryLevelStorage::saveMapIdLookup() app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size()); for(AUTO_VAR(it,m_playerMappings.begin()); it != m_playerMappings.end(); ++it) { -#ifdef _WINDOWS64 +#if defined(_WINDOWS64) || defined(__linux__) app.DebugPrintf(" -- %d\n", it->first); #else #ifdef __linux__