mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
fix: update include paths and add Linux compatibility for various files
This commit is contained in:
parent
398981f81d
commit
3379b2ab6a
|
|
@ -10,7 +10,7 @@ target_sources(${PROJECT_NAME}
|
||||||
INP_Main.cpp
|
INP_Main.cpp
|
||||||
INP_StringCheck.cpp
|
INP_StringCheck.cpp
|
||||||
stdafx.cpp
|
stdafx.cpp
|
||||||
../../Minecraft.Client/Linux/Stubs/LinuxStubs.h
|
../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h
|
||||||
)
|
)
|
||||||
target_include_directories(${PROJECT_NAME}
|
target_include_directories(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include "../../Minecraft.Client/Linux/Stubs/LinuxStubs.h"
|
#include "../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h"
|
||||||
#endif // __linux__
|
#endif
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#include <GL/glu.h>
|
||||||
|
#else
|
||||||
|
|
||||||
const int GL_BYTE = 0;
|
const int GL_BYTE = 0;
|
||||||
const int GL_FLOAT = 0;
|
const int GL_FLOAT = 0;
|
||||||
|
|
@ -115,10 +118,34 @@ void glFog(int,FloatBuffer *);
|
||||||
void glColorMaterial(int,int);
|
void glColorMaterial(int,int);
|
||||||
void glMultiTexCoord2f(int, float, float);
|
void glMultiTexCoord2f(int, float, float);
|
||||||
|
|
||||||
//1.8.2
|
|
||||||
void glClientActiveTexture(int);
|
void glClientActiveTexture(int);
|
||||||
void glActiveTexture(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
|
class GL11
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -136,6 +163,7 @@ public:
|
||||||
static void glBufferDataARB(int, ByteBuffer *, int) {}
|
static void glBufferDataARB(int, ByteBuffer *, int) {}
|
||||||
static void glGenBuffersARB(IntBuffer *) {}
|
static void glGenBuffersARB(IntBuffer *) {}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class Level;
|
class Level;
|
||||||
|
|
|
||||||
|
|
@ -413,12 +413,27 @@ static inline HANDLE CreateFileA(const char *lpFileName, DWORD dwDesiredAccess,
|
||||||
return fd == -1 ? INVALID_HANDLE_VALUE : (HANDLE)(intptr_t)fd;
|
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,
|
static inline HANDLE CreateFile(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||||
void *lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
void *lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||||
{
|
{
|
||||||
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, 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)
|
static inline BOOL CloseHandle(HANDLE hObject)
|
||||||
{
|
{
|
||||||
if (hObject == INVALID_HANDLE_VALUE) return FALSE;
|
if (hObject == INVALID_HANDLE_VALUE) return FALSE;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
#include "../Build/stdafx.h"
|
#include "../Build/stdafx.h"
|
||||||
|
|
||||||
|
#ifndef __linux__
|
||||||
|
|
||||||
#include "../../Minecraft.World/IO/Streams/FloatBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/FloatBuffer.h"
|
||||||
#include "../../Minecraft.World/IO/Streams/IntBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/IntBuffer.h"
|
||||||
#include "../../Minecraft.World/IO/Streams/ByteBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/ByteBuffer.h"
|
||||||
|
|
@ -386,4 +389,7 @@ void glTexGen(int coord, int mode, FloatBuffer *vec)
|
||||||
void glCullFace(int dir)
|
void glCullFace(int dir)
|
||||||
{
|
{
|
||||||
RenderManager.StateSetFaceCullCW( dir == GL_BACK);
|
RenderManager.StateSetFaceCullCW( dir == GL_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
@ -1906,6 +1906,7 @@ endif()
|
||||||
################################################################################
|
################################################################################
|
||||||
# Target name
|
# Target name
|
||||||
################################################################################
|
################################################################################
|
||||||
|
if(MSVC)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
TARGET_NAME_CONTENTPACKAGE_NO_TU "${OUTPUT_DIRECTORY}${PROJECT_NAME}"
|
TARGET_NAME_CONTENTPACKAGE_NO_TU "${OUTPUT_DIRECTORY}${PROJECT_NAME}"
|
||||||
TARGET_NAME_CONTENTPACKAGE_SYMBOLS "${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_DEBUG "${OUTPUT_DIRECTORY}${PROJECT_NAME}"
|
||||||
TARGET_NAME_RELEASE "${OUTPUT_DIRECTORY}${PROJECT_NAME}"
|
TARGET_NAME_RELEASE "${OUTPUT_DIRECTORY}${PROJECT_NAME}"
|
||||||
TARGET_NAME_RELEASEFORART "${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
|
# Output directory
|
||||||
|
|
|
||||||
|
|
@ -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_Storage.h"
|
||||||
#include "../../Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h"
|
#include "../../Minecraft.Client/Platform/PSVita/4JLibs/inc/4J_Input.h"
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
// FIXME: Port 4JLibs to POSIX
|
#include "../../4J.Profile/4J_Profile.h"
|
||||||
#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Profile.h"
|
#include "../../4J.Render/4J_Render.h"
|
||||||
#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Render.h"
|
#include "../../4J.Storage/4J_Storage.h"
|
||||||
#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h"
|
#include "../../4J.Input/4J_Input.h"
|
||||||
#include "../../Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h"
|
|
||||||
#else
|
#else
|
||||||
#include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h"
|
#include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Profile.h"
|
||||||
#include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Render.h"
|
#include "../../Minecraft.Client/Platform/Orbis/4JLibs/inc/4J_Render.h"
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ LevelData *DirectoryLevelStorage::prepareLevel()
|
||||||
for(unsigned int i = 0; i < count; ++i)
|
for(unsigned int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
PlayerUID playerUid = dis.readPlayerUID();
|
PlayerUID playerUid = dis.readPlayerUID();
|
||||||
#ifdef _WINDOWS64
|
#if defined(_WINDOWS64) || defined(__linux__)
|
||||||
app.DebugPrintf(" -- %d\n", playerUid);
|
app.DebugPrintf(" -- %d\n", playerUid);
|
||||||
#else
|
#else
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
@ -692,7 +692,7 @@ void DirectoryLevelStorage::saveMapIdLookup()
|
||||||
app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size());
|
app.DebugPrintf("Saving %d mappings\n", m_playerMappings.size());
|
||||||
for(AUTO_VAR(it,m_playerMappings.begin()); it != m_playerMappings.end(); ++it)
|
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);
|
app.DebugPrintf(" -- %d\n", it->first);
|
||||||
#else
|
#else
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue