From 5583e04e0f3f2c298d19d94a4aed16123122b0d5 Mon Sep 17 00:00:00 2001 From: JuiceyDev Date: Thu, 5 Mar 2026 09:19:40 +0100 Subject: [PATCH] Fix runtime issues, --- 4J.Profile/4J_Profile.cpp | 13 ++- 4J.Render/4J_Render.cpp | 98 +++++++++++++++++++ 4J.Render/CMakeLists.txt | 6 ++ .../Build/Common/DLC/DLCManager.cpp | 52 +++++++--- Minecraft.Client/Textures/Texture.cpp | 2 +- Minecraft.World/IO/Files/File.cpp | 32 +++--- Minecraft.World/IO/Streams/Compression.cpp | 6 +- Minecraft.World/IO/Streams/Compression.h | 2 +- Minecraft.World/Util/StringHelpers.cpp | 2 +- 9 files changed, 169 insertions(+), 44 deletions(-) diff --git a/4J.Profile/4J_Profile.cpp b/4J.Profile/4J_Profile.cpp index e3fb33dda..3776dec6d 100644 --- a/4J.Profile/4J_Profile.cpp +++ b/4J.Profile/4J_Profile.cpp @@ -3,9 +3,18 @@ C_4JProfile ProfileManager; +static void *s_profileData[4] = {}; + void C_4JProfile::Initialise(DWORD dwTitleID, DWORD dwOfferID, unsigned short usProfileVersion, UINT uiProfileValuesC, UINT uiProfileSettingsC, DWORD *pdwProfileSettingsA, - int iGameDefinedDataSizeX4, unsigned int *puiGameDefinedDataChangedBitmask) {} + int iGameDefinedDataSizeX4, unsigned int *puiGameDefinedDataChangedBitmask) +{ + for (int i = 0; i < 4; i++) + { + s_profileData[i] = new unsigned char[iGameDefinedDataSizeX4 / 4]; + memset(s_profileData[i], 0, iGameDefinedDataSizeX4 / 4); + } +} void C_4JProfile::SetTrialTextStringTable(CXuiStringTable *pStringTable, int iAccept, int iReject) {} void C_4JProfile::SetTrialAwardText(eAwardType AwardType, int iTitle, int iText) {} int C_4JProfile::GetLockedProfile() { return -1; } @@ -58,7 +67,7 @@ static C_4JProfile::PROFILESETTINGS s_defaultSettings = {}; C_4JProfile::PROFILESETTINGS* C_4JProfile::GetDashboardProfileSettings(int iPad) { return &s_defaultSettings; } void C_4JProfile::WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged, bool bOverride5MinuteLimitOnProfileWrites) {} void C_4JProfile::ForceQueuedProfileWrites(int iPad) {} -void* C_4JProfile::GetGameDefinedProfileData(int iQuadrant) { return nullptr; } +void* C_4JProfile::GetGameDefinedProfileData(int iQuadrant) { return s_profileData[iQuadrant]; } void C_4JProfile::ResetProfileProcessState() {} void C_4JProfile::Tick(void) {} void C_4JProfile::RegisterAward(int iAwardNumber, int iGamerconfigID, eAwardType eType, bool bLeaderboardAffected, diff --git a/4J.Render/4J_Render.cpp b/4J.Render/4J_Render.cpp index 83962a57f..74727f007 100644 --- a/4J.Render/4J_Render.cpp +++ b/4J.Render/4J_Render.cpp @@ -57,8 +57,106 @@ void C4JRender::TextureDataUpdate(int xoffset, int yoffset, int width, int heigh void C4JRender::TextureSetParam(int param, int value) {} void C4JRender::TextureDynamicUpdateStart() {} void C4JRender::TextureDynamicUpdateEnd() {} +// really don't know if this is nessesary but didn't find any other functions to load images properly as a png.. +// im sorry. +#ifdef __linux__ +#include +#include +#include + +static HRESULT LoadPNGFromRows(png_structp png, png_infop info, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) +{ + int width = png_get_image_width(png, info); + int height = png_get_image_height(png, info); + png_byte color_type = png_get_color_type(png, info); + png_byte bit_depth = png_get_bit_depth(png, info); + + if (bit_depth == 16) png_set_strip_16(png); + if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png); + if (png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png); + if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_PALETTE) + png_set_filler(png, 0xFF, PNG_FILLER_AFTER); + if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb(png); + + png_read_update_info(png, info); + + unsigned char *buf = new unsigned char[width * height * 4]; + png_bytep *rows = new png_bytep[height]; + for (int y = 0; y < height; y++) + rows[y] = buf + y * width * 4; + png_read_image(png, rows); + delete[] rows; + // considering i worked on previous projects with raw pngs,,,,, + int *pixels = new int[width * height]; + for (int i = 0; i < width * height; i++) + { + unsigned char r = buf[i * 4 + 0]; + unsigned char g = buf[i * 4 + 1]; + unsigned char b = buf[i * 4 + 2]; + unsigned char a = buf[i * 4 + 3]; + pixels[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + delete[] buf; + + pSrcInfo->Width = width; + pSrcInfo->Height = height; + *ppDataOut = pixels; + return S_OK; +} + +HRESULT C4JRender::LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) +{ + FILE *fp = fopen(szFilename, "rb"); + if (!fp) return E_FAIL; + + png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png) { fclose(fp); return E_FAIL; } + png_infop info = png_create_info_struct(png); + if (!info) { png_destroy_read_struct(&png, NULL, NULL); fclose(fp); return E_FAIL; } + if (setjmp(png_jmpbuf(png))) { png_destroy_read_struct(&png, &info, NULL); fclose(fp); return E_FAIL; } + + png_init_io(png, fp); + png_read_info(png, info); + + HRESULT hr = LoadPNGFromRows(png, info, pSrcInfo, ppDataOut); + png_destroy_read_struct(&png, &info, NULL); + fclose(fp); + return hr; +} + +struct PNGMemReader { const unsigned char *data; png_size_t pos; png_size_t size; }; + +static void png_mem_read(png_structp png, png_bytep out, png_size_t len) +{ + PNGMemReader *r = (PNGMemReader *)png_get_io_ptr(png); + if (r->pos + len > r->size) len = r->size - r->pos; + memcpy(out, r->data + r->pos, len); + r->pos += len; +} + +HRESULT C4JRender::LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) +{ + png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png) return E_FAIL; + png_infop info = png_create_info_struct(png); + if (!info) { png_destroy_read_struct(&png, NULL, NULL); return E_FAIL; } + if (setjmp(png_jmpbuf(png))) { png_destroy_read_struct(&png, &info, NULL); return E_FAIL; } + + PNGMemReader reader = { pbData, 0, dwBytes }; + png_set_read_fn(png, &reader, png_mem_read); + png_read_info(png, info); + + HRESULT hr = LoadPNGFromRows(png, info, pSrcInfo, ppDataOut); + png_destroy_read_struct(&png, &info, NULL); + return hr; +} + +#else HRESULT C4JRender::LoadTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) { return S_OK; } HRESULT C4JRender::LoadTextureData(BYTE *pbData, DWORD dwBytes, D3DXIMAGE_INFO *pSrcInfo, int **ppDataOut) { return S_OK; } +#endif HRESULT C4JRender::SaveTextureData(const char *szFilename, D3DXIMAGE_INFO *pSrcInfo, int *ppDataOut) { return S_OK; } HRESULT C4JRender::SaveTextureDataToMemory(void *pOutput, int outputCapacity, int *outputLength, int width, int height, int *ppDataIn) { return S_OK; } void C4JRender::TextureGetStats() {} diff --git a/4J.Render/CMakeLists.txt b/4J.Render/CMakeLists.txt index 04d045825..4aae8d1b6 100644 --- a/4J.Render/CMakeLists.txt +++ b/4J.Render/CMakeLists.txt @@ -17,6 +17,12 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) +# giving a boost on the next macos implmentation + +if(UNIX AND NOT APPLE) + find_package(PNG REQUIRED) + target_link_libraries(${PROJECT_NAME} PRIVATE PNG::PNG) +endif() # Mimic cmake converter behaviour target_precompile_headers(${PROJECT_NAME} PRIVATE diff --git a/Minecraft.Client/Build/Common/DLC/DLCManager.cpp b/Minecraft.Client/Build/Common/DLC/DLCManager.cpp index fe77821df..c30eab3ca 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCManager.cpp +++ b/Minecraft.Client/Build/Common/DLC/DLCManager.cpp @@ -7,6 +7,25 @@ #include "../../../Minecraft.h" #include "../../../Textures/Packs/TexturePackRepository.h" +#ifdef __linux__ +#include +static const size_t DLC_WCHAR_BINARY = 2; +static wstring dlc_read_wstring(const void *data) +{ + const uint16_t *p = (const uint16_t *)data; + wstring s; + while (*p) s += (wchar_t)*p++; + return s; +} +#define DLC_WSTRING(ptr) dlc_read_wstring(ptr) +#define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + (n) * DLC_WCHAR_BINARY) +#define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + (n) * DLC_WCHAR_BINARY) +#else +#define DLC_WSTRING(ptr) wstring((WCHAR *)(ptr)) +#define DLC_PARAM_ADV(n) (sizeof(C4JStorage::DLC_FILE_PARAM) + sizeof(WCHAR) * (n)) +#define DLC_DETAIL_ADV(n) (sizeof(C4JStorage::DLC_FILE_DETAILS) + sizeof(WCHAR) * (n)) +#endif + const WCHAR *DLCManager::wchTypeNamesA[]= { L"DISPLAYNAME", @@ -282,6 +301,7 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/) } } + // gotta fix this someday if(corruptDLCCount > 0 && showMessage) { UINT uiIDA[1]; @@ -398,13 +418,13 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD for(unsigned int i=0;iwchData); + wstring parameterName = DLC_WSTRING(pParams->wchData); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { parameterMapping[pParams->dwType] = type; } - uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); + uiCurrentByte+= DLC_PARAM_ADV(pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; } //ulCurrentByte+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); @@ -416,7 +436,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD DWORD dwTemp=uiCurrentByte; for(unsigned int i=0;idwWchCount*sizeof(WCHAR); + dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } PBYTE pbTemp=((PBYTE )pFile);//+ sizeof(C4JStorage::DLC_FILE_DETAILS)*ulFileCount; @@ -435,7 +455,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD } else if(type != e_DLCType_PackConfig) { - dlcFile = pack->addFile(type,(WCHAR *)pFile->wchFile); + dlcFile = pack->addFile(type, DLC_WSTRING(pFile->wchFile)); } // Params @@ -452,15 +472,15 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD { if(type == e_DLCType_PackConfig) { - pack->addParameter(it->second,(WCHAR *)pParams->wchData); + pack->addParameter(it->second, DLC_WSTRING(pParams->wchData)); } else { - if(dlcFile != NULL) dlcFile->addParameter(it->second,(WCHAR *)pParams->wchData); - else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, (WCHAR *)pParams->wchData); + if(dlcFile != NULL) dlcFile->addParameter(it->second, DLC_WSTRING(pParams->wchData)); + else if(dlcTexturePack != NULL) dlcTexturePack->addParameter(it->second, DLC_WSTRING(pParams->wchData)); } } - pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); + pbTemp+=DLC_PARAM_ADV(pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; } //pbTemp+=ulParameterCount * sizeof(C4JStorage::DLC_FILE_PARAM); @@ -495,7 +515,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD switch(pFile->dwType) { case DLCManager::e_DLCType_Skin: - app.vSkinNames.push_back((WCHAR *)pFile->wchFile); + app.vSkinNames.push_back(DLC_WSTRING(pFile->wchFile)); break; } @@ -504,7 +524,7 @@ bool DLCManager::processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD // Move the pointer to the start of the next files data; pbTemp+=pFile->uiFileSize; - uiCurrentByte+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); + uiCurrentByte+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; } @@ -603,13 +623,13 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) for(unsigned int i=0;iwchData); + wstring parameterName = DLC_WSTRING(pParams->wchData); DLCManager::EDLCParameterType type = DLCManager::getParameterType(parameterName); if( type != DLCManager::e_DLCParamType_Invalid ) { parameterMapping[pParams->dwType] = type; } - uiCurrentByte+= sizeof(C4JStorage::DLC_FILE_PARAM)+(pParams->dwWchCount*sizeof(WCHAR)); + uiCurrentByte+= DLC_PARAM_ADV(pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)&pbData[uiCurrentByte]; } @@ -620,7 +640,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) DWORD dwTemp=uiCurrentByte; for(unsigned int i=0;idwWchCount*sizeof(WCHAR); + dwTemp+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile = (C4JStorage::DLC_FILE_DETAILS *)&pbData[dwTemp]; } PBYTE pbTemp=((PBYTE )pFile); @@ -644,7 +664,7 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) { if(it->second==e_DLCParamType_PackId) { - wstring wsTemp=(WCHAR *)pParams->wchData; + wstring wsTemp = DLC_WSTRING(pParams->wchData); std::wstringstream ss; // 4J Stu - numbered using decimal to make it easier for artists/people to number manually ss << std::dec << wsTemp.c_str(); @@ -654,14 +674,14 @@ DWORD DLCManager::retrievePackID(PBYTE pbData, DWORD dwLength, DLCPack *pack) } } } - pbTemp+=sizeof(C4JStorage::DLC_FILE_PARAM)+(sizeof(WCHAR)*pParams->dwWchCount); + pbTemp+=DLC_PARAM_ADV(pParams->dwWchCount); pParams = (C4JStorage::DLC_FILE_PARAM *)pbTemp; } if(bPackIDSet) break; // Move the pointer to the start of the next files data; pbTemp+=pFile->uiFileSize; - uiCurrentByte+=sizeof(C4JStorage::DLC_FILE_DETAILS)+pFile->dwWchCount*sizeof(WCHAR); + uiCurrentByte+=DLC_DETAIL_ADV(pFile->dwWchCount); pFile=(C4JStorage::DLC_FILE_DETAILS *)&pbData[uiCurrentByte]; } diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index c8dd00936..ce1a85b74 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -133,7 +133,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de for(unsigned int level = 1; level < m_iMipLevels; ++level) { int ww = width >> level; - int hh = height >> height; + int hh = height >> level; byteArray tempBytes = byteArray(ww * hh * depth * 4); for (int index = 0; index < tempBytes.length; index++) diff --git a/Minecraft.World/IO/Files/File.cpp b/Minecraft.World/IO/Files/File.cpp index 900acba91..67adfe805 100644 --- a/Minecraft.World/IO/Files/File.cpp +++ b/Minecraft.World/IO/Files/File.cpp @@ -129,9 +129,7 @@ bool File::mkdir() const #if defined (_UNICODE) return CreateDirectory( getPath().c_str(), NULL) != 0; #elif defined(__linux__) - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); - return ::mkdir(path.c_str(), 0777) == 0; // rwxrwxrwx + return ::mkdir(wstringtofilename(getPath()), 0777) == 0; #else return CreateDirectory( wstringtofilename(getPath()), NULL) != 0; #endif @@ -186,11 +184,10 @@ bool File::mkdirs() const } } #elif defined(__linux__) - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); + const char *mkpath = wstringtofilename(getPath()); struct stat info; - if (stat(path.c_str(), &info) != 0 || !(info.st_mode & S_IFDIR)) { - if (::mkdir(path.c_str(), 0777) != 0) { + if (stat(mkpath, &info) != 0 || !(info.st_mode & S_IFDIR)) { + if (::mkdir(mkpath, 0777) != 0) { return false; } } @@ -229,9 +226,8 @@ bool File::exists() const #if defined(_UNICODE) return GetFileAttributes( getPath().c_str() ) != -1; #elif defined(__linux__) - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); - return access(path.c_str(), F_OK) != -1; + // BAD DOBBY BAD DOBBY + return access(wstringtofilename(getPath()), F_OK) != -1; #else return GetFileAttributes( wstringtofilename(getPath()) ) != -1; #endif @@ -567,9 +563,9 @@ bool File::isDirectory() const #if defined(_UNICODE) return exists() && ( GetFileAttributes( getPath().c_str() ) & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY; #elif defined(__linux__) - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); - return access(path.c_str(), F_OK) != -1; + const char *dirpath = wstringtofilename(getPath()); + struct stat st; + return stat(dirpath, &st) == 0 && S_ISDIR(st.st_mode); #else return exists() && ( GetFileAttributes( wstringtofilename(getPath()) ) & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY; #endif @@ -645,10 +641,9 @@ __int64 File::length() return statData.fileSize; #elif defined(__linux__) struct stat fileInfoBuffer; - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); + const char *path = wstringtofilename(getPath()); - int result = stat(path.c_str(), &fileInfoBuffer); + int result = stat(path, &fileInfoBuffer); if(result == 0) { return fileInfoBuffer.st_size; @@ -726,10 +721,7 @@ __int64 File::lastModified() } #else struct stat fileStat; - struct stat fileInfoBuffer; - std::wstring wpath = getPath(); - std::string path(wpath.begin(), wpath.end()); - if (stat(path.c_str(), &fileStat) == 0 && !S_ISDIR(fileStat.st_mode)) { + if (stat(wstringtofilename(getPath()), &fileStat) == 0 && !S_ISDIR(fileStat.st_mode)) { return static_cast<__int64>(fileStat.st_mtime); } else { return 0l; diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index d73e6e506..d8dc7222f 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -300,7 +300,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize, HRESULT Compression::Compress(void *pDestination, unsigned int *pDestSize, void *pSource, unsigned int SrcSize) { // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this -#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ +#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ || defined __linux__ SIZE_T destSize = (SIZE_T)(*pDestSize); int res = ::compress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); *pDestSize = (unsigned int)destSize; @@ -328,7 +328,7 @@ HRESULT Compression::Decompress(void *pDestination, unsigned int *pDestSize, voi } // Using zlib for x64 compression - 360 is using native 360 compression and PS3 a stubbed non-compressing version of this -#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ +#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ || defined __linux__ SIZE_T destSize = (SIZE_T)(*pDestSize); int res = ::uncompress((Bytef *)pDestination, (uLongf *)&destSize, (Bytef *)pSource, SrcSize); *pDestSize = (unsigned int)destSize; @@ -405,7 +405,7 @@ HRESULT Compression::DecompressWithType(void *pDestination, unsigned int *pDestS } break; case eCompressionType_ZLIBRLE: -#if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64) +#if (defined __ORBIS__ || defined __PS3__ || defined _DURANGO || defined _WIN64 || defined __linux__) if (pDestination != NULL) return ::uncompress((PBYTE)pDestination, (unsigned long *) pDestSize, (PBYTE) pSource, SrcSize); // Decompress else break; // Cannot decompress when destination is NULL diff --git a/Minecraft.World/IO/Streams/Compression.h b/Minecraft.World/IO/Streams/Compression.h index 3d5fceca1..4f81cc784 100644 --- a/Minecraft.World/IO/Streams/Compression.h +++ b/Minecraft.World/IO/Streams/Compression.h @@ -77,7 +77,7 @@ private: //extern Compression gCompression; -#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ +#if defined __ORBIS__ || defined _DURANGO || defined _WIN64 || defined __PSVITA__ || defined __linux__ #define APPROPRIATE_COMPRESSION_TYPE Compression::eCompressionType_ZLIBRLE #elif defined __PS3__ #define APPROPRIATE_COMPRESSION_TYPE Compression::eCompressionType_PS3ZLIB diff --git a/Minecraft.World/Util/StringHelpers.cpp b/Minecraft.World/Util/StringHelpers.cpp index b9ae5d8eb..30512764e 100644 --- a/Minecraft.World/Util/StringHelpers.cpp +++ b/Minecraft.World/Util/StringHelpers.cpp @@ -56,7 +56,7 @@ const char *wstringtofilename(const wstring& name) for(unsigned int i = 0; i < name.length(); i++ ) { wchar_t c = name[i]; -#if defined __PS3__ || defined __ORBIS__ +#if defined __PS3__ || defined __ORBIS__ || defined __linux__ if(c=='\\') c='/'; #else if(c=='/') c='\\';