Compare commits
10 Commits
f96ba8bb33
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bfae5a14e | |||
| 4034cf243d | |||
| b6e7414f04 | |||
|
|
83f3284827 | ||
|
|
3dab395af3 | ||
|
|
011c8f7123 | ||
|
|
f69c009da9 | ||
|
|
b66b4a2dc2 | ||
|
|
7037b2b5f2 | ||
|
|
d54e39b332 |
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: Setup caches
|
- name: Setup caches
|
||||||
uses: ./.github/actions/setup-cache
|
uses: ./.github/actions/setup-cache
|
||||||
with:
|
with:
|
||||||
host: win
|
host: linux
|
||||||
target: win
|
target: win
|
||||||
|
|
||||||
- name: Setup Ninja
|
- name: Setup Ninja
|
||||||
@@ -41,15 +41,21 @@ jobs:
|
|||||||
tar -xf llvm-mingw.tar.xz
|
tar -xf llvm-mingw.tar.xz
|
||||||
mv llvm-mingw-* llvm-mingw
|
mv llvm-mingw-* llvm-mingw
|
||||||
|
|
||||||
|
- name: Create Build Environment
|
||||||
|
# Some projects don't allow in-source building, so create a separate build directory
|
||||||
|
# We'll use this as our working directory for all subsequent commands
|
||||||
|
run: cmake -E make_directory ${{github.workspace}}/build
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
cmake -B build \
|
cmake $GITHUB_WORKSPACE \
|
||||||
-G Ninja \
|
-G Ninja \
|
||||||
-DCMAKE_SYSTEM_NAME=Windows \
|
-DCMAKE_SYSTEM_NAME=Windows \
|
||||||
-DCMAKE_C_COMPILER=$PWD/llvm-mingw/bin/x86_64-w64-mingw32-clang \
|
-DCMAKE_C_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang \
|
||||||
-DCMAKE_CXX_COMPILER=$PWD/llvm-mingw/bin/x86_64-w64-mingw32-clang++ \
|
-DCMAKE_CXX_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-clang++ \
|
||||||
-DCMAKE_RC_COMPILER=$PWD/llvm-mingw/bin/x86_64-w64-mingw32-windres \
|
-DCMAKE_RC_COMPILER=$GITHUB_WORKSPACE/llvm-mingw/bin/x86_64-w64-mingw32-windres \
|
||||||
|
-DALSOFT_BACKEND_PIPEWIRE=OFF \
|
||||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -61,11 +67,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: mcpe-windows
|
name: mcpe-windows
|
||||||
path: |
|
path: |
|
||||||
${{github.workspace}}/build/${{ env.BUILD_TYPE }}/MinecraftPE.exe
|
${{github.workspace}}/build/MinecraftPE.exe
|
||||||
${{github.workspace}}/build/${{ env.BUILD_TYPE }}/glfw3.dll
|
${{github.workspace}}/build/glfw3.dll
|
||||||
${{github.workspace}}/build/${{ env.BUILD_TYPE }}/libpng16.dll
|
${{github.workspace}}/build/libpng16.dll
|
||||||
${{github.workspace}}/build/${{ env.BUILD_TYPE }}/OpenAL32.dll
|
${{github.workspace}}/build/OpenAL32.dll
|
||||||
${{github.workspace}}/build/${{ env.BUILD_TYPE }}/z.dll
|
${{github.workspace}}/build/z.dll
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
name: Linux Build
|
name: Linux Build
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ if (${PLATFORM} STREQUAL "Desktop")
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
set(EXTRA_LIBS ws2_32)
|
include_directories(misc/windows)
|
||||||
|
set(EXTRA_LIBS ws2_32 winhttp)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
set(EXTRA_LIBS pthread m)
|
set(EXTRA_LIBS pthread m)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#if defined(X360__)
|
#if defined(X360__)
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
#include <WinSock2.h>
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <Ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
// Must always include Winsock2.h before windows.h
|
// Must always include Winsock2.h before windows.h
|
||||||
// or else:
|
// or else:
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
virtual bool supportsTouchscreen() override { return true; }
|
virtual bool supportsTouchscreen() override { return true; }
|
||||||
|
|
||||||
virtual void hideCursor(bool hide) {
|
virtual void hideCursor(bool hide) override {
|
||||||
int isHide = hide ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN;
|
int isHide = hide ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN;
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, isHide);
|
glfwSetInputMode(window, GLFW_CURSOR, isHide);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <platform/log.h>
|
#include <platform/log.h>
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <sys/stat.h>
|
#include <direct.h>
|
||||||
#include <sys/types.h>
|
#else
|
||||||
#include <unistd.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OptionsFile::OptionsFile() {
|
OptionsFile::OptionsFile() {
|
||||||
@@ -27,39 +28,44 @@ void OptionsFile::setOptionsPath(const std::string& path) {
|
|||||||
std::string OptionsFile::getOptionsPath() const {
|
std::string OptionsFile::getOptionsPath() const {
|
||||||
return settingsPath;
|
return settingsPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsFile::save(const StringVector& settings) {
|
void OptionsFile::save(const StringVector& settings) {
|
||||||
FILE* pFile = fopen(settingsPath.c_str(), "w");
|
FILE* pFile = fopen(settingsPath.c_str(), "w");
|
||||||
if(pFile != NULL) {
|
|
||||||
for(StringVector::const_iterator it = settings.begin(); it != settings.end(); ++it) {
|
|
||||||
fprintf(pFile, "%s\n", it->c_str());
|
|
||||||
}
|
|
||||||
fclose(pFile);
|
|
||||||
} else {
|
|
||||||
if (errno != ENOENT)
|
|
||||||
LOGI("OptionsFile::save failed to open '%s' for writing: %s", settingsPath.c_str(), strerror(errno));
|
|
||||||
|
|
||||||
// Ensure parent directory exists for safekeeping if path contains directories
|
if (!pFile && errno == ENOENT) {
|
||||||
std::string dir = settingsPath;
|
std::string dir = settingsPath;
|
||||||
size_t fpos = dir.find_last_of("/\\");
|
size_t fpos = dir.find_last_of("/\\");
|
||||||
if (fpos != std::string::npos) {
|
if (fpos != std::string::npos) {
|
||||||
dir.resize(fpos);
|
dir.resize(fpos);
|
||||||
struct stat st;
|
|
||||||
if (stat(dir.c_str(), &st) != 0) {
|
std::string toCreate;
|
||||||
// attempt recursive mkdir
|
for (size_t i = 0; i <= dir.size(); ++i) {
|
||||||
std::string toCreate;
|
if (i == dir.size() || dir[i] == '/' || dir[i] == '\\') {
|
||||||
for (size_t i = 0; i <= dir.size(); ++i) {
|
if (!toCreate.empty()) {
|
||||||
if (i == dir.size() || dir[i] == '/' || dir[i] == '\\') {
|
#if defined(_WIN32)
|
||||||
if (!toCreate.empty()) {
|
_mkdir(toCreate.c_str());
|
||||||
mkdir(toCreate.c_str(), 0755);
|
#else
|
||||||
}
|
mkdir(toCreate.c_str(), 0755);
|
||||||
}
|
#endif
|
||||||
if (i < dir.size())
|
}
|
||||||
toCreate.push_back(dir[i]);
|
}
|
||||||
}
|
if (i < dir.size())
|
||||||
}
|
toCreate.push_back(dir[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pFile = fopen(settingsPath.c_str(), "w");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pFile) {
|
||||||
|
LOGI("OptionsFile::save failed: %s", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& s : settings) {
|
||||||
|
fprintf(pFile, "%s\n", s.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ void Font::draw( const std::string& str, float x, float y, int color, bool darke
|
|||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glTranslatef2((GLfloat)x, (GLfloat)y, 0.0f);
|
glTranslatef2((GLfloat)x, (GLfloat)y, 0.0f);
|
||||||
for (unsigned int i = 0; i < str.length(); i++) {
|
for (unsigned int i = 0; i < str.length(); i++) {
|
||||||
while (str.length() > i + 1 && str[i] == '§') {
|
while (str.length() > i + 1 && str[i] == '\xa7') {
|
||||||
int cc = hex.find((char)tolower(str[i + 1]));
|
int cc = hex.find((char)tolower(str[i + 1]));
|
||||||
if (cc < 0 || cc > 15) cc = 15;
|
if (cc < 0 || cc > 15) cc = 15;
|
||||||
lists[index++] = listPos + 256 + cc + (darken ? 16 : 0);
|
lists[index++] = listPos + 256 + cc + (darken ? 16 : 0);
|
||||||
@@ -235,7 +235,7 @@ int Font::width( const std::string& str )
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < str.length(); i++) {
|
for (unsigned int i = 0; i < str.length(); i++) {
|
||||||
if (str[i] == '§') {
|
if (str[i] == '\xa7') {
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
//int ch = SharedConstants.acceptableLetters.indexOf(str.charAt(i));
|
//int ch = SharedConstants.acceptableLetters.indexOf(str.charAt(i));
|
||||||
@@ -274,7 +274,7 @@ std::string Font::sanitize( const std::string& str )
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < str.length(); i++) {
|
for (unsigned int i = 0; i < str.length(); i++) {
|
||||||
if (str[i] == '§') {
|
if (str[i] == '\xa7') {
|
||||||
i++;
|
i++;
|
||||||
//} else if (SharedConstants.acceptableLetters.indexOf(str.charAt(i)) >= 0) {
|
//} else if (SharedConstants.acceptableLetters.indexOf(str.charAt(i)) >= 0) {
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
// #else
|
// #else
|
||||||
// // Uglyness to fix redeclaration issues
|
// // Uglyness to fix redeclaration issues
|
||||||
// #ifdef WIN32
|
// #ifdef WIN32
|
||||||
// #include <WinSock2.h>
|
// #include <winsock2.h>
|
||||||
// #include <Windows.h>
|
// #include <Windows.h>
|
||||||
// #endif
|
// #endif
|
||||||
// #include <gl/glew.h>
|
// #include <gl/glew.h>
|
||||||
|
|||||||
@@ -205,16 +205,16 @@ int main(void) {
|
|||||||
|
|
||||||
delete app;
|
delete app;
|
||||||
|
|
||||||
appContext.platform->finish();
|
|
||||||
|
|
||||||
delete appContext.platform;
|
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
// Exit.
|
// Exit.
|
||||||
glfwDestroyWindow(platform->window);
|
glfwDestroyWindow(platform->window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
appContext.platform->finish();
|
||||||
|
|
||||||
|
delete appContext.platform;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include <WinSock2.h>
|
#include <winsock2.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include "SharedConstants.h"
|
#include "SharedConstants.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <WinSock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|||||||
@@ -140,7 +140,9 @@ RakNet::TimeUS GetTimeUS_Windows( void )
|
|||||||
#if _MSC_VER >= 1400 && defined (_M_X64)
|
#if _MSC_VER >= 1400 && defined (_M_X64)
|
||||||
GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask);
|
GetProcessAffinityMask(mProc, (PDWORD_PTR)&mProcMask, (PDWORD_PTR)&mSysMask);
|
||||||
#else
|
#else
|
||||||
|
#ifndef __MINGW32__
|
||||||
GetProcessAffinityMask(mProc, &mProcMask, &mSysMask);
|
GetProcessAffinityMask(mProc, &mProcMask, &mSysMask);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
mThread = GetCurrentThread();
|
mThread = GetCurrentThread();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#if defined(X360__)
|
#if defined(X360__)
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
#include <WinSock2.h>
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <Ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
// Must always include Winsock2.h before windows.h
|
// Must always include Winsock2.h before windows.h
|
||||||
// or else:
|
// or else:
|
||||||
|
|||||||
Reference in New Issue
Block a user