diff --git a/Minecraft.Client/Platform/DurangoMedia/loc/strings.h b/Minecraft.Client/Platform/DurangoMedia/loc/strings.h index 00d0722a2..0cce344bd 100644 --- a/Minecraft.Client/Platform/DurangoMedia/loc/strings.h +++ b/Minecraft.Client/Platform/DurangoMedia/loc/strings.h @@ -1955,15 +1955,4 @@ #define IDS_YOU_DIED 1953 #define IDS_YOU_HAVE 1954 #define IDS_ZOMBIE 1955 - -#ifdef __linux__ -#ifndef IDS_ERROR_NETWORK_TITLE -#define IDS_ERROR_NETWORK_TITLE IDS_ERROR_NETWORK -#endif -#ifndef IDS_ONLINE_SERVICE_TITLE -#define IDS_ONLINE_SERVICE_TITLE IDS_ERROR_NETWORK -#endif -#ifndef IDS_CONTENT_RESTRICTION -#define IDS_CONTENT_RESTRICTION IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE -#endif -#endif +// gone cuz previous implementation is better diff --git a/Minecraft.Client/Platform/Linux/LinuxGL.cpp b/Minecraft.Client/Platform/Linux/LinuxGL.cpp new file mode 100644 index 000000000..d24f71947 --- /dev/null +++ b/Minecraft.Client/Platform/Linux/LinuxGL.cpp @@ -0,0 +1,159 @@ +#ifdef __linux__ + +#include +#include +#include +#include +#include "../../Minecraft.World/IntBuffer.h" +#include "../../Minecraft.World/FloatBuffer.h" +#include "../../Minecraft.World/ByteBuffer.h" + +int glGenTextures() +{ + GLuint id = 0; + ::glGenTextures(1, &id); + return (int)id; +} + +void glGenTextures(IntBuffer *buf) +{ + GLuint id = 0; + ::glGenTextures(1, &id); + buf->put((int)id); + buf->flip(); +} + +void glDeleteTextures(int id) +{ + GLuint uid = (GLuint)id; + ::glDeleteTextures(1, &uid); +} + +void glDeleteTextures(IntBuffer *buf) +{ + int id = buf->get(0); + GLuint uid = (GLuint)id; + ::glDeleteTextures(1, &uid); +} + +void glLight(int light, int pname, FloatBuffer *params) +{ + ::glLightfv((GLenum)light, (GLenum)pname, params->_getDataPointer()); +} + +void glLightModel(int pname, FloatBuffer *params) +{ + ::glLightModelfv((GLenum)pname, params->_getDataPointer()); +} + +void glGetFloat(int pname, FloatBuffer *params) +{ + ::glGetFloatv((GLenum)pname, params->_getDataPointer()); +} + +void glTexGen(int coord, int pname, FloatBuffer *params) +{ + ::glTexGenfv((GLenum)coord, (GLenum)pname, params->_getDataPointer()); +} + +void glFog(int pname, FloatBuffer *params) +{ + ::glFogfv((GLenum)pname, params->_getDataPointer()); +} + +void glTexCoordPointer(int size, int type, FloatBuffer *pointer) +{ + ::glTexCoordPointer(size, (GLenum)type, 0, pointer->_getDataPointer()); +} + +void glNormalPointer(int type, ByteBuffer *pointer) +{ + ::glNormalPointer((GLenum)type, 0, pointer->getBuffer()); +} + +void glColorPointer(int size, bool normalized, int stride, ByteBuffer *pointer) +{ + (void)normalized; + ::glColorPointer(size, GL_UNSIGNED_BYTE, stride, pointer->getBuffer()); +} + +void glVertexPointer(int size, int type, FloatBuffer *pointer) +{ + ::glVertexPointer(size, (GLenum)type, 0, pointer->_getDataPointer()); +} + +void glEndList(int) +{ + ::glEndList(); +} + +void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer *pixels) +{ + void *data = pixels ? pixels->getBuffer() : nullptr; + ::glTexImage2D((GLenum)target, level, internalformat, width, height, border, (GLenum)format, (GLenum)type, data); +} + +void glCallLists(IntBuffer *lists) +{ + int count = lists->limit() - lists->position(); + ::glCallLists(count, GL_INT, lists->getBuffer()); +} + +static PFNGLGENQUERIESARBPROC _glGenQueriesARB = nullptr; +static PFNGLBEGINQUERYARBPROC _glBeginQueryARB = nullptr; +static PFNGLENDQUERYARBPROC _glEndQueryARB = nullptr; +static PFNGLGETQUERYOBJECTUIVARBPROC _glGetQueryObjectuivARB = nullptr; +static bool _queriesInitialized = false; + +static void initQueryFuncs() +{ + if (_queriesInitialized) return; + _queriesInitialized = true; + _glGenQueriesARB = (PFNGLGENQUERIESARBPROC)dlsym(RTLD_DEFAULT, "glGenQueriesARB"); + _glBeginQueryARB = (PFNGLBEGINQUERYARBPROC)dlsym(RTLD_DEFAULT, "glBeginQueryARB"); + _glEndQueryARB = (PFNGLENDQUERYARBPROC)dlsym(RTLD_DEFAULT, "glEndQueryARB"); + _glGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC)dlsym(RTLD_DEFAULT, "glGetQueryObjectuivARB"); +} + +void glGenQueriesARB(IntBuffer *buf) +{ + initQueryFuncs(); + if (_glGenQueriesARB) + { + GLuint id = 0; + _glGenQueriesARB(1, &id); + buf->put((int)id); + buf->flip(); + } +} + +void glBeginQueryARB(int target, int id) +{ + initQueryFuncs(); + if (_glBeginQueryARB) _glBeginQueryARB((GLenum)target, (GLuint)id); +} + +void glEndQueryARB(int target) +{ + initQueryFuncs(); + if (_glEndQueryARB) _glEndQueryARB((GLenum)target); +} + +void glGetQueryObjectuARB(int id, int pname, IntBuffer *params) +{ + initQueryFuncs(); + if (_glGetQueryObjectuivARB) + { + GLuint val = 0; + _glGetQueryObjectuivARB((GLuint)id, (GLenum)pname, &val); + params->put((int)val); + params->flip(); + } +} + +void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer *pixels) +{ + ::glReadPixels(x, y, width, height, (GLenum)format, (GLenum)type, pixels->getBuffer()); +} + +#endif diff --git a/Minecraft.Client/Platform/Linux/linux_game_stubs.cpp b/Minecraft.Client/Platform/Linux/linux_game_stubs.cpp new file mode 100644 index 000000000..3844e1deb --- /dev/null +++ b/Minecraft.Client/Platform/Linux/linux_game_stubs.cpp @@ -0,0 +1,44 @@ +#ifdef __linux__ + +#include +#include +#include +#include + +#include "../stubs.h" +#include "../Common/Consoles_App.h" + +void Display::update() {} + +int CMinecraftApp::GetTPConfigVal(WCHAR* pwchDataFile) { return 0; } + +#include "../../Minecraft.World/x64headers/extraX64.h" + +void PIXSetMarkerDeprecated(int a, const char* b, ...) {} + +#include "../Xbox/Network/NetworkPlayerXbox.h" + +NetworkPlayerXbox::NetworkPlayerXbox(IQNetPlayer* p) : m_qnetPlayer(p), m_pSocket(nullptr) {} +IQNetPlayer* NetworkPlayerXbox::GetQNetPlayer() { return m_qnetPlayer; } +unsigned char NetworkPlayerXbox::GetSmallId() { return 0; } +void NetworkPlayerXbox::SendData(INetworkPlayer*, const void*, int, bool) {} +bool NetworkPlayerXbox::IsSameSystem(INetworkPlayer*) { return false; } +int NetworkPlayerXbox::GetSendQueueSizeBytes(INetworkPlayer*, bool) { return 0; } +int NetworkPlayerXbox::GetSendQueueSizeMessages(INetworkPlayer*, bool) { return 0; } +int NetworkPlayerXbox::GetCurrentRtt() { return 0; } +bool NetworkPlayerXbox::IsHost() { return false; } +bool NetworkPlayerXbox::IsGuest() { return false; } +bool NetworkPlayerXbox::IsLocal() { return true; } +int NetworkPlayerXbox::GetSessionIndex() { return 0; } +bool NetworkPlayerXbox::IsTalking() { return false; } +bool NetworkPlayerXbox::IsMutedByLocalUser(int) { return false; } +bool NetworkPlayerXbox::HasVoice() { return false; } +bool NetworkPlayerXbox::HasCamera() { return false; } +int NetworkPlayerXbox::GetUserIndex() { return 0; } +void NetworkPlayerXbox::SetSocket(Socket* s) { m_pSocket = s; } +Socket* NetworkPlayerXbox::GetSocket() { return m_pSocket; } +const wchar_t* NetworkPlayerXbox::GetOnlineName() { return L"Player"; } +std::wstring NetworkPlayerXbox::GetDisplayName() { return L"Player"; } +PlayerUID NetworkPlayerXbox::GetUID() { return PlayerUID(); } + +#endif