diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ad9186a4..b0bb0a1a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,38 +6,33 @@ on: jobs: linux: - strategy: - fail-fast: false - matrix: - include: - - name: OpenGL ES - flags: "-DUSE_GLES1_COMPATIBILITY_LAYER=ON" - - name: OpenGL - flags: "-DUSE_GLES1_COMPATIBILITY_LAYER=OFF" - name: Linux (${{ matrix.name }}) + name: Linux runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install Dependencies run: | sudo apt-get update - sudo apt-get install --no-install-recommends -y build-essential cmake ninja-build libopenal-dev libsdl2-dev zlib1g-dev + sudo apt-get install --no-install-recommends -y \ + build-essential \ + cmake ninja-build \ + libopenal-dev \ + libsdl2-dev zlib1g-dev - name: Build run: | - cd platforms/sdl mkdir build cd build - cmake -GNinja ${{ matrix.flags }} .. + cmake -GNinja .. cmake --build . wasm: name: WASM runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install Dependencies @@ -51,15 +46,16 @@ jobs: runs-on: macos-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Install MacPorts uses: melusina-org/setup-macports@v1 - name: Install Dependencies run: | - sudo port install libsdl2 +universal - sudo port install libpng +universal + port selfupdate + port install libsdl2 +universal + port install libpng +universal - name: Build macOS Archive run: | cd platforms/macos/projects/Minecraft @@ -103,11 +99,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' @@ -116,3 +112,32 @@ jobs: run: | cd ${{ matrix.directory }} ./gradlew build + mingw: + strategy: + fail-fast: false + matrix: + include: + - name: Win32 + flags: "-DREMCPE_PLATFORM=windows" + - name: SDL + flags: "-DREMCPE_PLATFORM=sdl" + name: MinGW-w64 (${{ matrix.name }}) + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + build-essential \ + cmake ninja-build \ + mingw-w64 + - name: Build + run: | + mkdir build + cd build + cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-toolchain.cmake ${{ matrix.flags }} .. + cmake --build . diff --git a/.gitignore b/.gitignore index 22c107a57..85fe04251 100644 --- a/.gitignore +++ b/.gitignore @@ -123,7 +123,7 @@ xcuserdata/ /sound_data # Ignore linux/mingw build artifacts. -/build +/build* /minecraftcpp /minecraftcpp.exe @@ -242,3 +242,11 @@ xcuserdata/ # Ignore options.txt - where your configuration will be saved /game/options.txt /game/assetsO +/game/assets/gui/feedback_fill.png +/game/assets/gui/feedback_outer.png +/game/assets/snow.png +/game/assets/mob/pig.png + +# CLion +/.idea +/cmake-build-* \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 8838e392c..602032d83 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "thirdparty/coi-serviceworker"] path = thirdparty/coi-serviceworker url = https://github.com/gzuidhof/coi-serviceworker.git -[submodule "thirdparty/gles-compatibility-layer"] - path = thirdparty/gles-compatibility-layer - url = https://github.com/TheBrokenRail/gles-compatibility-layer.git [submodule "thirdparty/SDL-src"] path = thirdparty/SDL2/src url = https://github.com/libsdl-org/SDL.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..0a1bc69b7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 3.16.0) +project(reminecraftpe) + +# Store Output In Top-Level Build Directory +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") + +# WASM +if(EMSCRIPTEN) + function(add_compile_and_link_options) + add_compile_options(${ARGV}) + add_link_options(${ARGV}) + endfunction() + set(CMAKE_EXECUTABLE_SUFFIX ".js") + add_link_options("$<$:-gsource-map>") + add_link_options(-Wno-pthreads-mem-growth -sALLOW_MEMORY_GROWTH=1) +endif() + +# Clang +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_compile_options(-Wno-inconsistent-missing-override -Wno-enum-compare-switch -Wno-register) +endif() + +# Windows Linking +if(WIN32) + add_link_options( + -static-libgcc + -static-libstdc++ + ) +endif() + +# HaikuOS Network Library +if(HAIKU) + link_libraries(network) +endif() + +# Threading +if(EMSCRIPTEN) + add_compile_and_link_options(-pthread) +else() + find_package(Threads) + link_libraries(Threads::Threads) +endif() + +# Android Logging +if(ANDROID) + link_libraries(log) +endif() + +# stb_image And Other Libraries +add_subdirectory(thirdparty/stb_image EXCLUDE_FROM_ALL) + +# Load Common Code +add_subdirectory(source) + +# Load Platform-Specific Code +add_subdirectory(platforms) + +# Assets +if(EMSCRIPTEN) + target_link_options(reminecraftpe PRIVATE --use-preload-plugins --preload-file "${CMAKE_CURRENT_SOURCE_DIR}/game@/") +else() + file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/game/assets" "${CMAKE_CURRENT_BINARY_DIR}/assets" SYMBOLIC) +endif() \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 3b3441833..000000000 --- a/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# ReMinecraftPE - Makefile for linux - -# Commonly included directories. -SRC_DIR=source -BLD_DIR=build -RKN_DIR=thirdparty/raknet -ZLB_DIR=thirdparty/zlib -PLT_DIR=platforms - -# Target executable's name. -TARGET=minecraftcpp - -# Compilation flags for C++ source files -CXXFLAGS=-Isource -I. -Ithirdparty/raknet -Ithirdparty/zlib -DUSE_SDL -DUSE_OPENAL -DUSE_MATH_DEFINES -DHANDLE_CHARS_SEPARATELY -O3 -MMD - -# Compilation flags for zlib source files -ZLIBFLAGS=-O3 -I. -MMD - -# Link flags -LINKFLAGS=-L/opt/vc/lib/ -lpng -lpthread -lSDL2 -lGL -lopenal -lGLU - -#include everything in source/, plus certain files from platforms -SRC_FILES = $(shell find $(SRC_DIR) -type f -name '*.cpp') -PLT_FILES = $(shell find $(PLT_DIR)/sdl $(PLT_DIR)/openal -type f -name '*.cpp') -RKN_FILES = $(shell find $(RKN_DIR) -type f -name '*.cpp') -ZLB_FILES = $(shell find $(ZLB_DIR) -type f -name '*.c') - -OBJ_FILES = \ - $(patsubst $(SRC_DIR)/%,$(BLD_DIR)/s/%,$(SRC_FILES:.cpp=.o)) \ - $(patsubst $(PLT_DIR)/%,$(BLD_DIR)/p/%,$(PLT_FILES:.cpp=.o)) \ - $(patsubst $(RKN_DIR)/%,$(BLD_DIR)/r/%,$(RKN_FILES:.cpp=.o)) \ - $(patsubst $(ZLB_DIR)/%,$(BLD_DIR)/z/%,$(ZLB_FILES:.c=.o)) - -DEP_FILES = \ - $(patsubst $(SRC_DIR)/%,$(BLD_DIR)/s/%,$(SRC_FILES:.cpp=.d)) \ - $(patsubst $(PLT_DIR)/%,$(BLD_DIR)/p/%,$(PLT_FILES:.cpp=.d)) \ - $(patsubst $(RKN_DIR)/%,$(BLD_DIR)/r/%,$(RKN_FILES:.cpp=.d)) \ - $(patsubst $(ZLB_DIR)/%,$(BLD_DIR)/z/%,$(ZLB_FILES:.c=.d)) - -#default target. -.PHONY = all -all: program - -#link rules for the executable -$(TARGET): $(OBJ_FILES) - $(CXX) -o $@ $^ $(LINKFLAGS) - -#include header dependencies --include $(DEP_FILES) - -$(BLD_DIR)/p/%.o: $(PLT_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/r/%.o: $(RKN_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/z/%.o: $(ZLB_DIR)/%.c - @mkdir -p $(dir $@) - $(CC) $(ZLIBFLAGS) -c -o $@ $< - -$(BLD_DIR)/s/%.o: $(SRC_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -program: $(TARGET) - -clean: - rm -rf $(BLD_DIR) - rm -rf minecraftcpp diff --git a/MakefileMinGW b/MakefileMinGW deleted file mode 100644 index ab6f58460..000000000 --- a/MakefileMinGW +++ /dev/null @@ -1,86 +0,0 @@ -# ReMinecraftPE - Makefile for MinGW - -# User Settings -EMULATE_VBOS ?= no - -ifeq ($(EMULATE_VBOS), yes) - VBO_EMULATION_FLAG = -DUSE_GL_VBO_EMULATION -endif - -# Commonly included directories. -SRC_DIR=source -BLD_DIR=build -RKN_DIR=thirdparty/raknet -ZLB_DIR=thirdparty/zlib -PLT_DIR=platforms -TGL_DIR=thirdparty/GL - -# Target executable's name. -TARGET=minecraftcpp.exe - -# Compilation flags for C++ source files -CXXFLAGS=-Isource -I. -Ithirdparty/raknet -Ithirdparty/zlib -DUSE_MATH_DEFINES -DSHA1_HAS_TCHAR -DHANDLE_CHARS_SEPARATELY -DUSE_WIN32_THREADS -DLOCKLESS_TYPES_USE_MUTEX -DNDEBUG -O3 -mno-sse -mno-sse2 -mno-mmx -march=i386 -MMD $(VBO_EMULATION_FLAG) - -# Compilation flags for zlib source files -ZLIBFLAGS=-O3 -I. -MMD -Ithirdparty/stb_image/include - -# Link flags -LINKFLAGS=-lopengl32 -lws2_32 -lglu32 -lgdi32 -ldsound -ldxguid -luuid -static-libgcc -mwindows - -#include everything in source/, plus certain files from platforms -SRC_FILES = $(shell find $(SRC_DIR) -name '*.cpp') -PLT_FILES = $(shell find $(PLT_DIR)/windows -name '*.cpp') -RKN_FILES = $(shell find $(RKN_DIR) -name '*.cpp') -TGL_FILES = $(shell find $(TGL_DIR) -name '*.cpp') -ZLB_FILES = $(shell find $(ZLB_DIR) -name '*.c') - -OBJ_FILES = \ - $(patsubst $(SRC_DIR)/%,$(BLD_DIR)/s/%,$(SRC_FILES:.cpp=.o)) \ - $(patsubst $(PLT_DIR)/%,$(BLD_DIR)/p/%,$(PLT_FILES:.cpp=.o)) \ - $(patsubst $(RKN_DIR)/%,$(BLD_DIR)/r/%,$(RKN_FILES:.cpp=.o)) \ - $(patsubst $(TGL_DIR)/%,$(BLD_DIR)/g/%,$(TGL_FILES:.cpp=.o)) \ - $(patsubst $(ZLB_DIR)/%,$(BLD_DIR)/z/%,$(ZLB_FILES:.c=.o)) \ - build/t/stb_image_impl.o - -DEP_FILES = $(OBJ_FILES:.o=.d)) - -#default target. -.PHONY = all -all: program - -#link rules for the executable -$(TARGET): $(OBJ_FILES) - $(CXX) -o $@ $^ $(LINKFLAGS) - -#include header dependencies --include $(DEP_FILES) - -$(BLD_DIR)/p/%.o: $(PLT_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/g/%.o: $(TGL_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/r/%.o: $(RKN_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/z/%.o: $(ZLB_DIR)/%.c - @mkdir -p $(dir $@) - $(CC) $(ZLIBFLAGS) -c -o $@ $< - -$(BLD_DIR)/s/%.o: $(SRC_DIR)/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CXXFLAGS) -c -o $@ $< - -$(BLD_DIR)/t/%.o: thirdparty/stb_image/src/%.c - @mkdir -p $(dir $@) - $(CC) $(ZLIBFLAGS) -c -o $@ $< - -program: $(TARGET) - -clean: - rm -rf $(BLD_DIR) - rm -rf minecraftcpp diff --git a/README.md b/README.md index ebb4e7b9e..d72711ee5 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ based on Minecraft PE v0.1.3. * To keep the source code layout similar to the original Minecraft PE (reconstructed from clues hidden within certain versions of the game, such as the 0.1.0 touch prototype/debug build) * To port the game to more platforms, such as Windows (including older versions), Xbox 360, Wii, and more. - Currently there are ports for: + Currently, there are ports for: * Windows XP-11 * Android (thanks to [Stom](https://github.com/Stommm) for the help) * Linux * WebGL - * Mac OS (port by [BrentDaMage](https://github.com/BrentDaMage)) + * macOS (port by [BrentDaMage](https://github.com/BrentDaMage)) * iOS (3.0 and above; port by [BrentDaMage](https://github.com/BrentDaMage)) * HaikuOS (thanks to [SanyaSho](https://github.com/SanyaSho)) * Xbox 360 (work in progress; port by [BrentDaMage](https://github.com/BrentDaMage)) @@ -36,7 +36,7 @@ Note: While the original Minecraft PE v0.1.3 may not work on newer devices, ReMi ## License information -This project is licensed under the [BSD 1 clause license](LICENSE.md). However, it contains third party +This project is licensed under the [BSD 1 clause license](LICENSE.txt). However, it contains third party software with different but compatible licenses: - [RakNet](https://github.com/facebookarchive/RakNet): [Licensed under the BSD 2 clause license](thirdparty/raknet/LICENSE) @@ -142,7 +142,6 @@ This project uses CMake on Linux. Just like WebAssembly, the game assets must be #### How To Build ```sh -cd platforms/sdl mkdir build && cd build cmake -GNinja .. cmake --build . diff --git a/build-wasm.sh b/build-wasm.sh index bc1265706..033140ec2 100755 --- a/build-wasm.sh +++ b/build-wasm.sh @@ -31,7 +31,7 @@ mkdir -p build cd build # Configure Build -emcmake cmake -GNinja "$@" ../../platforms/sdl +emcmake cmake -GNinja "$@" ../../ # Build cmake --build . diff --git a/cmake/mingw-w64-toolchain.cmake b/cmake/mingw-w64-toolchain.cmake new file mode 100644 index 000000000..9610577a5 --- /dev/null +++ b/cmake/mingw-w64-toolchain.cmake @@ -0,0 +1,11 @@ +# https://gist.github.com/peterspackman/8cf73f7f12ba270aa8192d6911972fe8 +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) +set(CMAKE_C_COMPILER "${TOOLCHAIN_PREFIX}-gcc") +set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PREFIX}-g++") +set(CMAKE_Fortran_COMPILER "${TOOLCHAIN_PREFIX}-gfortran") +set(CMAKE_RC_COMPILER "${TOOLCHAIN_PREFIX}-windres") +set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN_PREFIX}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file diff --git a/compat/KeyCodes.hpp b/compat/KeyCodes.hpp index 783a04595..f2316c5f1 100644 --- a/compat/KeyCodes.hpp +++ b/compat/KeyCodes.hpp @@ -23,7 +23,7 @@ enum eSDLVirtualKeys #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN - #include + #include #elif __APPLE__ // https://i.stack.imgur.com/LD8pT.png #define AKEYCODE_FORWARD_DEL 0x75 diff --git a/platforms/CMakeLists.txt b/platforms/CMakeLists.txt new file mode 100644 index 000000000..daf641034 --- /dev/null +++ b/platforms/CMakeLists.txt @@ -0,0 +1,12 @@ +project(reminecraftpe-platforms) + +# Select & Build +set(DEFAULT_PLATFORM "sdl") +if(WIN32) + set(DEFAULT_PLATFORM "windows") +endif() +set(REMCPE_PLATFORM "${DEFAULT_PLATFORM}" CACHE STRING "ReMCPE Platform (Check /platforms)") +add_subdirectory("${REMCPE_PLATFORM}") + +# Load Sound +add_subdirectory(sound) \ No newline at end of file diff --git a/platforms/android/AppPlatform_android.cpp b/platforms/android/AppPlatform_android.cpp index 117f68b13..0f6fd4a4e 100644 --- a/platforms/android/AppPlatform_android.cpp +++ b/platforms/android/AppPlatform_android.cpp @@ -9,7 +9,7 @@ #include #include "AppPlatform_android.hpp" -#include "SoundSystemSL.hpp" +#include "CustomSoundSystem.hpp" #include "client/player/input/Mouse.hpp" #include "stb_image.h" @@ -174,7 +174,7 @@ SoundSystem* const AppPlatform_android::getSoundSystem() const void AppPlatform_android::initSoundSystem() { if (!m_pSoundSystem) - m_pSoundSystem = new SoundSystemSL(); + m_pSoundSystem = new SOUND_SYSTEM(); else LOG_E("Trying to initialize SoundSystem more than once!"); } diff --git a/platforms/android/project/app/src/main/cpp/CMakeLists.txt b/platforms/android/CMakeLists.txt similarity index 63% rename from platforms/android/project/app/src/main/cpp/CMakeLists.txt rename to platforms/android/CMakeLists.txt index 6a03a611f..0f69cc8d6 100644 --- a/platforms/android/project/app/src/main/cpp/CMakeLists.txt +++ b/platforms/android/CMakeLists.txt @@ -1,31 +1,27 @@ cmake_minimum_required(VERSION 3.16.0) project(reminecraftpe-android) -# Project Root -set(MC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../..") - # Native Android Build -add_compile_definitions(USE_NATIVE_ANDROID) -set(USE_NATIVE_ANDROID TRUE) +target_compile_definitions(reminecraftpe-core PUBLIC USE_NATIVE_ANDROID) # Build add_library(reminecraftpe SHARED - "${MC_ROOT}/platforms/android/android_native_app_glue.c" - "${MC_ROOT}/platforms/android/AppPlatform_android.cpp" - "${MC_ROOT}/platforms/android/SoundSystemSL.cpp" - "${MC_ROOT}/platforms/android/main.cpp" + android_native_app_glue.c + AppPlatform_android.cpp + main.cpp ) # Core -add_subdirectory("${MC_ROOT}/source" source) target_link_libraries(reminecraftpe reminecraftpe-core) +# OpenGL +target_link_libraries(reminecraftpe-core PUBLIC EGL GLESv1_CM) + # stb_image -add_subdirectory("${MC_ROOT}/thirdparty/stb_image" stb_image) target_link_libraries(reminecraftpe stb_image) # Extra Dependencies -target_link_libraries(reminecraftpe android OpenSLES) +target_link_libraries(reminecraftpe android) # Check for the presence of some optional asset based features. if(EXISTS "${MC_ROOT}/game/assets/gui/background/panorama_0.png") diff --git a/platforms/android/project/app/build.gradle b/platforms/android/project/app/build.gradle index 84b308c56..7743e2ab1 100644 --- a/platforms/android/project/app/build.gradle +++ b/platforms/android/project/app/build.gradle @@ -29,7 +29,7 @@ android { // testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { - arguments '-DANDROID_PLATFORM=android-21', '-DANDROID_STL=c++_static' + arguments '-DANDROID_PLATFORM=android-21', '-DANDROID_STL=c++_static', '-DREMCPE_PLATFORM=android', '-DREMCPE_SOUND_PLATFORM=opensl' abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } @@ -47,7 +47,7 @@ android { } externalNativeBuild { cmake { - path file('src/main/cpp/CMakeLists.txt') + path '../../../../CMakeLists.txt' version '3.22.1' } } diff --git a/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj b/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj index fd769b36a..c0dfd30a8 100644 --- a/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj +++ b/platforms/macos/projects/Minecraft/Minecraft.xcodeproj/project.pbxproj @@ -200,6 +200,8 @@ 8426107E2AE989730065905F /* RakNetInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840DD64E2AC810620006A435 /* RakNetInstance.cpp */; }; 8426107F2AE989730065905F /* ServerSideNetworkHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840DD6502AC810620006A435 /* ServerSideNetworkHandler.cpp */; }; 842610882AE98A4C0065905F /* libRakNet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84FFBD7E2ACA2876005A8CCF /* libRakNet.a */; }; + 8441F98F2DB4E911005977BD /* SoundSystemAL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8441F9862DB4E911005977BD /* SoundSystemAL.cpp */; }; + 8441F9962DB4E911005977BD /* SoundSystemAL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8441F9862DB4E911005977BD /* SoundSystemAL.cpp */; }; 8443B6EA2A98675F0086730C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8443B6E92A98675F0086730C /* libSDL2.a */; }; 8445E7A02D769329008DC834 /* EntityCategories.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8445E7952D769329008DC834 /* EntityCategories.cpp */; }; 8445E7A12D769329008DC834 /* EntityCategories.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8445E7962D769329008DC834 /* EntityCategories.hpp */; }; @@ -245,7 +247,6 @@ 84619B212AF1EDA300B0DE81 /* libWorld.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84BF630B2AF1859D008A9995 /* libWorld.a */; }; 84619B222AF1EDA300B0DE81 /* libZLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84498A832AF18C7A005EF5A5 /* libZLib.a */; }; 84619B392AF1F73900B0DE81 /* GL.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 840DD6552AC810620006A435 /* GL.hpp */; }; - 84619B3A2AF1FE1500B0DE81 /* SoundSystemAL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84EAE8E62AF1EAFA000894E8 /* SoundSystemAL.cpp */; }; 84619B3C2AF1FE4C00B0DE81 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84619B3B2AF1FE4C00B0DE81 /* OpenAL.framework */; }; 84619B3E2AF1FEB700B0DE81 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84619B3D2AF1FEB700B0DE81 /* QuartzCore.framework */; }; 8470AF2B2BE9B60A00BCA54E /* EntityType.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 8470AF282BE9B60900BCA54E /* EntityType.hpp */; }; @@ -895,7 +896,6 @@ 84EAE8DE2AF1EAA1000894E8 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84EAE8DD2AF1EAA1000894E8 /* UIKit.framework */; }; 84EAE8E02AF1EAA9000894E8 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84EAE8DF2AF1EAA9000894E8 /* CoreGraphics.framework */; }; 84EAE8E42AF1EABE000894E8 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84EAE8E32AF1EABE000894E8 /* OpenGLES.framework */; }; - 84EAE8F32AF1EAFA000894E8 /* SoundSystemAL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84EAE8E62AF1EAFA000894E8 /* SoundSystemAL.cpp */; }; 84EAE8F72AF1EAFA000894E8 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84EAE8F12AF1EAFA000894E8 /* main.cpp */; }; 84ED99D52AFF12D1003B6AF0 /* minecraftpe.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = 84ED99D42AFF12D1003B6AF0 /* minecraftpe.entitlements */; }; 84FFBE952ACA3415005A8CCF /* _FindFirst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840DD73A2AC810620006A435 /* _FindFirst.cpp */; }; @@ -1776,6 +1776,8 @@ 84336BA52B1EB57E00097DB0 /* Settings_iOS_Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Settings_iOS_Debug.xcconfig; path = ../Configuration/Settings_iOS_Debug.xcconfig; sourceTree = ""; }; 84336BA82B1EB88500097DB0 /* Settings_macOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Settings_macOS.xcconfig; path = ../Configuration/Settings_macOS.xcconfig; sourceTree = ""; }; 84336BA92B1EB9C200097DB0 /* Settings_macOS_Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Settings_macOS_Debug.xcconfig; path = ../Configuration/Settings_macOS_Debug.xcconfig; sourceTree = ""; }; + 8441F9852DB4E911005977BD /* CustomSoundSystem.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CustomSoundSystem.hpp; sourceTree = ""; }; + 8441F9862DB4E911005977BD /* SoundSystemAL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SoundSystemAL.cpp; sourceTree = ""; }; 8443B6E92A98675F0086730C /* libSDL2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL2.a; path = /opt/local/lib/libSDL2.a; sourceTree = ""; }; 8445E7952D769329008DC834 /* EntityCategories.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EntityCategories.cpp; sourceTree = ""; }; 8445E7962D769329008DC834 /* EntityCategories.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EntityCategories.hpp; sourceTree = ""; }; @@ -1945,7 +1947,6 @@ 84AA8B6D2B32F3B5003F5B82 /* PathfinderMob.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PathfinderMob.hpp; sourceTree = ""; }; 84AA8B6E2B32F3B5003F5B82 /* Pig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pig.cpp; sourceTree = ""; }; 84AA8B6F2B32F3B5003F5B82 /* Pig.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Pig.hpp; sourceTree = ""; }; - 84AA8B702B32F3B5003F5B82 /* Player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Player.cpp; sourceTree = ""; }; 84AA8B762B32F3B5003F5B82 /* WaterAnimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WaterAnimal.cpp; sourceTree = ""; }; 84AA8B772B32F3B5003F5B82 /* WaterAnimal.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = WaterAnimal.hpp; sourceTree = ""; }; 84AA8B992B32F3F3003F5B82 /* Chunk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Chunk.cpp; sourceTree = ""; }; @@ -2035,8 +2036,6 @@ 84AA8C3F2B32F535003F5B82 /* CowModel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CowModel.hpp; sourceTree = ""; }; 84AA8C402B32F535003F5B82 /* CreeperModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CreeperModel.cpp; sourceTree = ""; }; 84AA8C412B32F535003F5B82 /* CreeperModel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CreeperModel.hpp; sourceTree = ""; }; - 84AA8C442B32F535003F5B82 /* HumanoidModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HumanoidModel.cpp; sourceTree = ""; }; - 84AA8C462B32F535003F5B82 /* Model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Model.cpp; sourceTree = ""; }; 84AA8C482B32F535003F5B82 /* ModelPart.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModelPart.cpp; sourceTree = ""; }; 84AA8C492B32F535003F5B82 /* ModelPart.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ModelPart.hpp; sourceTree = ""; }; 84AA8C4A2B32F535003F5B82 /* PigModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PigModel.cpp; sourceTree = ""; }; @@ -2164,8 +2163,6 @@ 84EAE8DF2AF1EAA9000894E8 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 84EAE8E12AF1EAB5000894E8 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; 84EAE8E32AF1EABE000894E8 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; - 84EAE8E62AF1EAFA000894E8 /* SoundSystemAL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundSystemAL.cpp; sourceTree = ""; }; - 84EAE8E72AF1EAFA000894E8 /* SoundSystemAL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SoundSystemAL.hpp; sourceTree = ""; }; 84EAE8F02AF1EAFA000894E8 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; 84EAE8F12AF1EAFA000894E8 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 84ED99D42AFF12D1003B6AF0 /* minecraftpe.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = minecraftpe.entitlements; sourceTree = ""; }; @@ -2420,10 +2417,8 @@ 840DD5BF2AC810620006A435 /* Cube.hpp */, 840DD5BE2AC810620006A435 /* Cube.cpp */, 840DD5C12AC810620006A435 /* HumanoidModel.hpp */, - 84AA8C442B32F535003F5B82 /* HumanoidModel.cpp */, 840DD5C02AC810620006A435 /* HumanoidModel.cpp */, 840DD5C32AC810620006A435 /* Model.hpp */, - 84AA8C462B32F535003F5B82 /* Model.cpp */, 840DD5C22AC810620006A435 /* Model.cpp */, 84AA8C492B32F535003F5B82 /* ModelPart.hpp */, 84AA8C482B32F535003F5B82 /* ModelPart.cpp */, @@ -2687,7 +2682,6 @@ 84AA8B6F2B32F3B5003F5B82 /* Pig.hpp */, 84AA8B6E2B32F3B5003F5B82 /* Pig.cpp */, 840DD6632AC810620006A435 /* Player.hpp */, - 84AA8B702B32F3B5003F5B82 /* Player.cpp */, 840DD6622AC810620006A435 /* Player.cpp */, 840DD6652AC810620006A435 /* PrimedTnt.hpp */, 840DD6642AC810620006A435 /* PrimedTnt.cpp */, @@ -2722,22 +2716,22 @@ 840DD66F2AC810620006A435 /* item */ = { isa = PBXGroup; children = ( - 840DD6702AC810620006A435 /* CameraItem.cpp */, 840DD6712AC810620006A435 /* CameraItem.hpp */, - 840DD6722AC810620006A435 /* DoorItem.cpp */, + 840DD6702AC810620006A435 /* CameraItem.cpp */, 840DD6732AC810620006A435 /* DoorItem.hpp */, - 840DD6742AC810620006A435 /* Inventory.cpp */, + 840DD6722AC810620006A435 /* DoorItem.cpp */, 840DD6752AC810620006A435 /* Inventory.hpp */, - 840DD6762AC810620006A435 /* Item.cpp */, + 840DD6742AC810620006A435 /* Inventory.cpp */, 840DD6772AC810620006A435 /* Item.hpp */, - 840DD6782AC810620006A435 /* ItemInstance.cpp */, + 840DD6762AC810620006A435 /* Item.cpp */, 840DD6792AC810620006A435 /* ItemInstance.hpp */, - 84E78C812B58B5FB00D515EF /* RocketItem.cpp */, + 840DD6782AC810620006A435 /* ItemInstance.cpp */, 84E78C822B58B5FB00D515EF /* RocketItem.hpp */, - 840DD67A2AC810620006A435 /* TileItem.cpp */, + 84E78C812B58B5FB00D515EF /* RocketItem.cpp */, 840DD67B2AC810620006A435 /* TileItem.hpp */, - 840DD67C2AC810620006A435 /* TilePlanterItem.cpp */, + 840DD67A2AC810620006A435 /* TileItem.cpp */, 840DD67D2AC810620006A435 /* TilePlanterItem.hpp */, + 840DD67C2AC810620006A435 /* TilePlanterItem.cpp */, ); path = item; sourceTree = ""; @@ -2883,14 +2877,14 @@ children = ( 840DD6CF2AC810620006A435 /* BubbleParticle.cpp */, 840DD6D02AC810620006A435 /* ExplodeParticle.cpp */, - 8470AF3A2BE9B6FA00BCA54E /* FireworkParticle.cpp */, 8470AF3B2BE9B6FA00BCA54E /* FireworkParticle.hpp */, + 8470AF3A2BE9B6FA00BCA54E /* FireworkParticle.cpp */, 840DD6D12AC810620006A435 /* FlameParticle.cpp */, 840DD6D22AC810620006A435 /* LavaParticle.cpp */, - 840DD6D32AC810620006A435 /* Particle.cpp */, 840DD6D42AC810620006A435 /* Particle.hpp */, - 840DD6D52AC810620006A435 /* ParticleEngine.cpp */, + 840DD6D32AC810620006A435 /* Particle.cpp */, 840DD6D62AC810620006A435 /* ParticleEngine.hpp */, + 840DD6D52AC810620006A435 /* ParticleEngine.cpp */, 840DD6D72AC810620006A435 /* RedDustParticle.cpp */, 840DD6D82AC810620006A435 /* SmokeParticle.cpp */, 840DD6D92AC810620006A435 /* TerrainParticle.cpp */, @@ -2916,84 +2910,84 @@ 840DD6E12AC810620006A435 /* tile */ = { isa = PBXGroup; children = ( - 840DD6E22AC810620006A435 /* BookshelfTile.cpp */, 840DD6E32AC810620006A435 /* BookshelfTile.hpp */, - 840DD6E42AC810620006A435 /* Bush.cpp */, + 840DD6E22AC810620006A435 /* BookshelfTile.cpp */, 840DD6E52AC810620006A435 /* Bush.hpp */, - 840DD6E62AC810620006A435 /* ClayTile.cpp */, + 840DD6E42AC810620006A435 /* Bush.cpp */, 840DD6E72AC810620006A435 /* ClayTile.hpp */, - 840DD6E82AC810620006A435 /* ClothTile.cpp */, + 840DD6E62AC810620006A435 /* ClayTile.cpp */, 840DD6E92AC810620006A435 /* ClothTile.hpp */, - 840DD6EA2AC810620006A435 /* DirtTile.cpp */, + 840DD6E82AC810620006A435 /* ClothTile.cpp */, 840DD6EB2AC810620006A435 /* DirtTile.hpp */, - 840DD6EC2AC810620006A435 /* DoorTile.cpp */, + 840DD6EA2AC810620006A435 /* DirtTile.cpp */, 840DD6ED2AC810620006A435 /* DoorTile.hpp */, - 840DD6EE2AC810620006A435 /* FarmTile.cpp */, + 840DD6EC2AC810620006A435 /* DoorTile.cpp */, 840DD6EF2AC810620006A435 /* FarmTile.hpp */, - 840DD6F02AC810620006A435 /* FireTile.cpp */, + 840DD6EE2AC810620006A435 /* FarmTile.cpp */, 840DD6F12AC810620006A435 /* FireTile.hpp */, - 840DD6F22AC810620006A435 /* GlassTile.cpp */, + 840DD6F02AC810620006A435 /* FireTile.cpp */, 840DD6F32AC810620006A435 /* GlassTile.hpp */, - 840DD6F42AC810620006A435 /* GrassTile.cpp */, + 840DD6F22AC810620006A435 /* GlassTile.cpp */, 840DD6F52AC810620006A435 /* GrassTile.hpp */, - 840DD6F62AC810620006A435 /* GravelTile.cpp */, + 840DD6F42AC810620006A435 /* GrassTile.cpp */, 840DD6F72AC810620006A435 /* GravelTile.hpp */, - 840DD6F82AC810620006A435 /* HalfTransparentTile.cpp */, + 840DD6F62AC810620006A435 /* GravelTile.cpp */, 840DD6F92AC810620006A435 /* HalfTransparentTile.hpp */, - 840DD6FA2AC810620006A435 /* IceTile.cpp */, + 840DD6F82AC810620006A435 /* HalfTransparentTile.cpp */, 840DD6FB2AC810620006A435 /* IceTile.hpp */, - 840DD6FC2AC810620006A435 /* InvisibleTile.cpp */, + 840DD6FA2AC810620006A435 /* IceTile.cpp */, 840DD6FD2AC810620006A435 /* InvisibleTile.hpp */, - 840DD6FE2AC810620006A435 /* LadderTile.cpp */, + 840DD6FC2AC810620006A435 /* InvisibleTile.cpp */, 840DD6FF2AC810620006A435 /* LadderTile.hpp */, - 840DD7002AC810620006A435 /* LeafTile.cpp */, + 840DD6FE2AC810620006A435 /* LadderTile.cpp */, 840DD7012AC810620006A435 /* LeafTile.hpp */, - 840DD7022AC810620006A435 /* LiquidTile.cpp */, + 840DD7002AC810620006A435 /* LeafTile.cpp */, 840DD7032AC810620006A435 /* LiquidTile.hpp */, - 840DD7042AC810620006A435 /* LiquidTileDynamic.cpp */, + 840DD7022AC810620006A435 /* LiquidTile.cpp */, 840DD7052AC810620006A435 /* LiquidTileDynamic.hpp */, - 840DD7062AC810620006A435 /* LiquidTileStatic.cpp */, + 840DD7042AC810620006A435 /* LiquidTileDynamic.cpp */, 840DD7072AC810620006A435 /* LiquidTileStatic.hpp */, - 840DD7082AC810620006A435 /* MetalTile.cpp */, + 840DD7062AC810620006A435 /* LiquidTileStatic.cpp */, 840DD7092AC810620006A435 /* MetalTile.hpp */, - 840DD70A2AC810620006A435 /* ObsidianTile.cpp */, + 840DD7082AC810620006A435 /* MetalTile.cpp */, 840DD70B2AC810620006A435 /* ObsidianTile.hpp */, - 840DD70C2AC810620006A435 /* OreTile.cpp */, + 840DD70A2AC810620006A435 /* ObsidianTile.cpp */, 840DD70D2AC810620006A435 /* OreTile.hpp */, - 840DD70E2AC810620006A435 /* RedStoneOreTile.cpp */, + 840DD70C2AC810620006A435 /* OreTile.cpp */, 840DD70F2AC810620006A435 /* RedStoneOreTile.hpp */, - 840DD7102AC810620006A435 /* ReedTile.cpp */, + 840DD70E2AC810620006A435 /* RedStoneOreTile.cpp */, 840DD7112AC810620006A435 /* ReedTile.hpp */, - 84E78C852B58B66B00D515EF /* RocketLauncherTile.cpp */, + 840DD7102AC810620006A435 /* ReedTile.cpp */, 84E78C862B58B66B00D515EF /* RocketLauncherTile.hpp */, - 840DD7122AC810620006A435 /* SandStoneTile.cpp */, + 84E78C852B58B66B00D515EF /* RocketLauncherTile.cpp */, 840DD7132AC810620006A435 /* SandStoneTile.hpp */, - 840DD7142AC810620006A435 /* SandTile.cpp */, + 840DD7122AC810620006A435 /* SandStoneTile.cpp */, 840DD7152AC810620006A435 /* SandTile.hpp */, - 840DD7162AC810620006A435 /* Sapling.cpp */, + 840DD7142AC810620006A435 /* SandTile.cpp */, 840DD7172AC810620006A435 /* Sapling.hpp */, - 840DD7182AC810620006A435 /* SpongeTile.cpp */, + 840DD7162AC810620006A435 /* Sapling.cpp */, 840DD7192AC810620006A435 /* SpongeTile.hpp */, - 840DD71A2AC810620006A435 /* StairTile.cpp */, + 840DD7182AC810620006A435 /* SpongeTile.cpp */, 840DD71B2AC810620006A435 /* StairTile.hpp */, - 840DD71C2AC810620006A435 /* StoneSlabTile.cpp */, + 840DD71A2AC810620006A435 /* StairTile.cpp */, 840DD71D2AC810620006A435 /* StoneSlabTile.hpp */, - 840DD71E2AC810620006A435 /* StoneTile.cpp */, + 840DD71C2AC810620006A435 /* StoneSlabTile.cpp */, 840DD71F2AC810620006A435 /* StoneTile.hpp */, - 840DD7202AC810620006A435 /* Tile.cpp */, + 840DD71E2AC810620006A435 /* StoneTile.cpp */, 840DD7212AC810620006A435 /* Tile.hpp */, - 840DD7222AC810620006A435 /* TntTile.cpp */, + 840DD7202AC810620006A435 /* Tile.cpp */, 840DD7232AC810620006A435 /* TntTile.hpp */, - 840DD7242AC810620006A435 /* TopSnowTile.cpp */, + 840DD7222AC810620006A435 /* TntTile.cpp */, 840DD7252AC810620006A435 /* TopSnowTile.hpp */, - 840DD7262AC810620006A435 /* TorchTile.cpp */, + 840DD7242AC810620006A435 /* TopSnowTile.cpp */, 840DD7272AC810620006A435 /* TorchTile.hpp */, - 840DD7282AC810620006A435 /* TransparentTile.cpp */, + 840DD7262AC810620006A435 /* TorchTile.cpp */, 840DD7292AC810620006A435 /* TransparentTile.hpp */, - 840DD72A2AC810620006A435 /* TreeTile.cpp */, + 840DD7282AC810620006A435 /* TransparentTile.cpp */, 840DD72B2AC810620006A435 /* TreeTile.hpp */, - 840DD72C2AC810620006A435 /* WireTile.cpp */, + 840DD72A2AC810620006A435 /* TreeTile.cpp */, 840DD72D2AC810620006A435 /* WireTile.hpp */, + 840DD72C2AC810620006A435 /* WireTile.cpp */, ); path = tile; sourceTree = ""; @@ -3342,8 +3336,8 @@ isa = PBXGroup; children = ( 84790AEC2AD7DA410076F2A1 /* ios */, - 84EAE8E52AF1EAFA000894E8 /* openal */, 84EAE8E82AF1EAFA000894E8 /* sdl */, + 8441F98D2DB4E911005977BD /* sound */, ); name = platforms; path = ../../..; @@ -3385,6 +3379,23 @@ name = macOS; sourceTree = ""; }; + 8441F9872DB4E911005977BD /* openal */ = { + isa = PBXGroup; + children = ( + 8441F9852DB4E911005977BD /* CustomSoundSystem.hpp */, + 8441F9862DB4E911005977BD /* SoundSystemAL.cpp */, + ); + path = openal; + sourceTree = ""; + }; + 8441F98D2DB4E911005977BD /* sound */ = { + isa = PBXGroup; + children = ( + 8441F9872DB4E911005977BD /* openal */, + ); + path = sound; + sourceTree = ""; + }; 8470AF422BE9B8B600BCA54E /* environment */ = { isa = PBXGroup; children = ( @@ -3707,44 +3718,44 @@ 84AA8B9F2B32F3F3003F5B82 /* entity */ = { isa = PBXGroup; children = ( - 84AA8BA02B32F3F3003F5B82 /* ChickenRenderer.cpp */, 84AA8BA12B32F3F3003F5B82 /* ChickenRenderer.hpp */, - 84AA8BA22B32F3F3003F5B82 /* CowRenderer.cpp */, + 84AA8BA02B32F3F3003F5B82 /* ChickenRenderer.cpp */, 84AA8BA32B32F3F3003F5B82 /* CowRenderer.hpp */, - 84AA8BA42B32F3F3003F5B82 /* CreeperRenderer.cpp */, + 84AA8BA22B32F3F3003F5B82 /* CowRenderer.cpp */, 84AA8BA52B32F3F3003F5B82 /* CreeperRenderer.hpp */, - 84AA8BA62B32F3F3003F5B82 /* EntityRenderDispatcher.cpp */, + 84AA8BA42B32F3F3003F5B82 /* CreeperRenderer.cpp */, 84AA8BA72B32F3F3003F5B82 /* EntityRenderDispatcher.hpp */, - 84AA8BA82B32F3F3003F5B82 /* EntityRenderer.cpp */, + 84AA8BA62B32F3F3003F5B82 /* EntityRenderDispatcher.cpp */, 84AA8BA92B32F3F3003F5B82 /* EntityRenderer.hpp */, - 84AA8BAA2B32F3F3003F5B82 /* FallingTileRenderer.cpp */, + 84AA8BA82B32F3F3003F5B82 /* EntityRenderer.cpp */, 84AA8BAB2B32F3F3003F5B82 /* FallingTileRenderer.hpp */, - 84AA8BAC2B32F3F3003F5B82 /* HumanoidMobRenderer.cpp */, + 84AA8BAA2B32F3F3003F5B82 /* FallingTileRenderer.cpp */, 84AA8BAD2B32F3F3003F5B82 /* HumanoidMobRenderer.hpp */, - 84AA8BAE2B32F3F3003F5B82 /* ItemRenderer.cpp */, + 84AA8BAC2B32F3F3003F5B82 /* HumanoidMobRenderer.cpp */, 84AA8BAF2B32F3F3003F5B82 /* ItemRenderer.hpp */, - 84AA8BB02B32F3F3003F5B82 /* ItemSpriteRenderer.cpp */, + 84AA8BAE2B32F3F3003F5B82 /* ItemRenderer.cpp */, 84AA8BB12B32F3F3003F5B82 /* ItemSpriteRenderer.hpp */, - 84AA8BB22B32F3F3003F5B82 /* MobRenderer.cpp */, + 84AA8BB02B32F3F3003F5B82 /* ItemSpriteRenderer.cpp */, 84AA8BB32B32F3F3003F5B82 /* MobRenderer.hpp */, - 84AA8BB42B32F3F3003F5B82 /* PigRenderer.cpp */, + 84AA8BB22B32F3F3003F5B82 /* MobRenderer.cpp */, 84AA8BB52B32F3F3003F5B82 /* PigRenderer.hpp */, - 84E78C7D2B58B5CC00D515EF /* RocketRenderer.cpp */, + 84AA8BB42B32F3F3003F5B82 /* PigRenderer.cpp */, 84E78C7E2B58B5CC00D515EF /* RocketRenderer.hpp */, - 84AA8BB62B32F3F3003F5B82 /* SheepFurRenderer.cpp */, + 84E78C7D2B58B5CC00D515EF /* RocketRenderer.cpp */, 84AA8BB72B32F3F3003F5B82 /* SheepFurRenderer.hpp */, - 84AA8BB82B32F3F3003F5B82 /* SheepRenderer.cpp */, + 84AA8BB62B32F3F3003F5B82 /* SheepFurRenderer.cpp */, 84AA8BB92B32F3F3003F5B82 /* SheepRenderer.hpp */, - 84AA8BBA2B32F3F3003F5B82 /* SkeletonRenderer.cpp */, + 84AA8BB82B32F3F3003F5B82 /* SheepRenderer.cpp */, 84AA8BBB2B32F3F3003F5B82 /* SkeletonRenderer.hpp */, - 84AA8BBC2B32F3F3003F5B82 /* SpiderRenderer.cpp */, + 84AA8BBA2B32F3F3003F5B82 /* SkeletonRenderer.cpp */, 84AA8BBD2B32F3F3003F5B82 /* SpiderRenderer.hpp */, - 84AA8BBE2B32F3F3003F5B82 /* TntRenderer.cpp */, + 84AA8BBC2B32F3F3003F5B82 /* SpiderRenderer.cpp */, 84AA8BBF2B32F3F3003F5B82 /* TntRenderer.hpp */, - 84AA8BC02B32F3F3003F5B82 /* TripodCameraRenderer.cpp */, + 84AA8BBE2B32F3F3003F5B82 /* TntRenderer.cpp */, 84AA8BC12B32F3F3003F5B82 /* TripodCameraRenderer.hpp */, - 84AA8BC22B32F3F3003F5B82 /* ZombieRenderer.cpp */, + 84AA8BC02B32F3F3003F5B82 /* TripodCameraRenderer.cpp */, 84AA8BC32B32F3F3003F5B82 /* ZombieRenderer.hpp */, + 84AA8BC22B32F3F3003F5B82 /* ZombieRenderer.cpp */, ); path = entity; sourceTree = ""; @@ -3903,15 +3914,6 @@ path = mob; sourceTree = ""; }; - 84EAE8E52AF1EAFA000894E8 /* openal */ = { - isa = PBXGroup; - children = ( - 84EAE8E62AF1EAFA000894E8 /* SoundSystemAL.cpp */, - 84EAE8E72AF1EAFA000894E8 /* SoundSystemAL.hpp */, - ); - path = openal; - sourceTree = ""; - }; 84EAE8E82AF1EAFA000894E8 /* sdl */ = { isa = PBXGroup; children = ( @@ -4854,12 +4856,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 84EAE8F32AF1EAFA000894E8 /* SoundSystemAL.cpp in Sources */, 84EAE8F72AF1EAFA000894E8 /* main.cpp in Sources */, 841DD8772AF8AA7A00AA3B66 /* AppPlatform_sdl_base.cpp in Sources */, 841DD8782AF8AA7A00AA3B66 /* AppPlatform_sdl.cpp in Sources */, 84AA8E4D2B32FB33003F5B82 /* stb_vorbis.c in Sources */, 84AA8E802B32FB33003F5B82 /* stb_image_impl.c in Sources */, + 8441F9962DB4E911005977BD /* SoundSystemAL.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4867,12 +4869,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 84619B3A2AF1FE1500B0DE81 /* SoundSystemAL.cpp in Sources */, 849259592AD8FD4F0081F5B9 /* minecraftpeAppDelegate.mm in Sources */, 8492595A2AD8FD4F0081F5B9 /* minecraftpeViewController.mm in Sources */, 8492595B2AD8FD4F0081F5B9 /* Shader.fsh in Sources */, 8492595C2AD8FD4F0081F5B9 /* Shader.vsh in Sources */, 849259622AD8FDD10081F5B9 /* main.m in Sources */, + 8441F98F2DB4E911005977BD /* SoundSystemAL.cpp in Sources */, 84CEF0032AE3C97D006C5829 /* EAGLView.m in Sources */, 8495E4892AF0905B00A06901 /* AppPlatform_iOS.mm in Sources */, 8488C08A2B1EDD4F001AEC4F /* ShowKeyboardView.mm in Sources */, diff --git a/platforms/openal/CMakeLists.txt b/platforms/openal/CMakeLists.txt deleted file mode 100644 index 36450e0fe..000000000 --- a/platforms/openal/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cmake_minimum_required(VERSION 3.16.0) -project(reminecraftpe-openal) - -# Build -add_library(reminecraftpe-openal STATIC - SoundSystemAL.cpp -) - -# Core -target_link_libraries(reminecraftpe-openal PUBLIC reminecraftpe-core) - -# OpenAL -if(ANDROID) - # Use Vendored OpenAL - set(ALSOFT_UTILS FALSE CACHE BOOL "" FORCE) - set(ALSOFT_EXAMPLES FALSE CACHE BOOL "" FORCE) - set(ALSOFT_TESTS FALSE CACHE BOOL "" FORCE) - set(ALSOFT_REQUIRE_OPENSL TRUE CACHE BOOL "" FORCE) - add_subdirectory(../../thirdparty/OpenAL openal EXCLUDE_FROM_ALL) - target_link_libraries(reminecraftpe-openal PUBLIC OpenAL::OpenAL) -elseif(EMSCRIPTEN) - # Use Emscripten's OpenAL - target_link_libraries(reminecraftpe-openal PUBLIC openal) -else() - # Use System ZLib - find_library(OPENAL_LIBRARY NAMES openal REQUIRED) - target_link_libraries(reminecraftpe-openal PUBLIC "${OPENAL_LIBRARY}") -endif() - -# Headers -target_include_directories(reminecraftpe-openal PUBLIC .) diff --git a/platforms/sdl/CMakeLists.txt b/platforms/sdl/CMakeLists.txt index b5cff20c9..1d2e84112 100644 --- a/platforms/sdl/CMakeLists.txt +++ b/platforms/sdl/CMakeLists.txt @@ -2,36 +2,10 @@ cmake_minimum_required(VERSION 3.16.0) project(reminecraftpe-sdl) # SDL Build -add_compile_definitions(USE_SDL USE_OPENAL HANDLE_CHARS_SEPARATELY) -set(USE_SDL TRUE) - -# WASM -if(EMSCRIPTEN) - function(add_compile_and_link_options) - add_compile_options(${ARGV}) - add_link_options(${ARGV}) - endfunction() - set(CMAKE_EXECUTABLE_SUFFIX ".js") - add_link_options("$<$:-gsource-map>") -endif() - -# Clang -if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - add_compile_options(-Wno-inconsistent-missing-override -Wno-enum-compare-switch -Wno-register) -endif() - -# Network library -if(HAIKU) - link_libraries(network) -endif() - -# Threads -if(EMSCRIPTEN) - add_compile_and_link_options(-pthread) -else() - find_package(Threads) - link_libraries(Threads::Threads) -endif() +target_compile_definitions(reminecraftpe-core + PUBLIC USE_SDL + PUBLIC HANDLE_CHARS_SEPARATELY +) # Build set(SOURCES @@ -51,35 +25,53 @@ else() endif() # Core -add_subdirectory(../../source source) target_link_libraries(reminecraftpe reminecraftpe-core) -# OpenAL -add_subdirectory(../openal openal) -target_link_libraries(reminecraftpe reminecraftpe-openal) - # stb_image (If Needed) if(NOT EMSCRIPTEN) - add_subdirectory(../../thirdparty/stb_image stb_image) target_link_libraries(reminecraftpe stb_image) endif() # SDL +add_library(SDL INTERFACE) +if(ANDROID OR WIN32) + # Use Vendored SDL2 (Only For Android) + add_subdirectory(../../thirdparty/SDL2/src SDL EXCLUDE_FROM_ALL) + target_link_libraries(SDL INTERFACE SDL2::SDL2) +elseif(EMSCRIPTEN) + # Use Emscripten's SDL2 + set(SDL_FLAG -sUSE_SDL=2) + target_compile_options(SDL INTERFACE "${SDL_FLAG}") + target_link_options(SDL INTERFACE "${SDL_FLAG}") +else() + # Use System SDL2 + find_package(SDL2 REQUIRED) + target_link_libraries(SDL INTERFACE SDL2::SDL2) +endif() +target_link_libraries(reminecraftpe-core PUBLIC SDL) if(TARGET SDL2::SDL2main) target_link_libraries(reminecraftpe SDL2::SDL2main) endif() +# OpenGL +if(ANDROID) + find_library(GLES_LIB GLESv1_CM REQUIRED) + target_link_libraries(reminecraftpe-core PUBLIC "${GLES_LIB}") + target_compile_definitions(reminecraftpe-core PUBLIC USE_GLES) +else() + find_package(OpenGL REQUIRED) + target_link_libraries(reminecraftpe-core PUBLIC OpenGL::GL) + if(EMSCRIPTEN) + # Use WebGL 2 + target_link_options(reminecraftpe-core PUBLIC + -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 + -sLEGACY_GL_EMULATION -sGL_FFP_ONLY + ) + endif() +endif() + # WASM if(EMSCRIPTEN) - target_link_options(reminecraftpe PRIVATE -Wno-pthreads-mem-growth) - target_link_options(reminecraftpe PRIVATE -sALLOW_MEMORY_GROWTH=1) # Export Resize Function target_link_options(reminecraftpe PRIVATE -sEXPORTED_FUNCTIONS=_main,_resize_from_js -sEXPORTED_RUNTIME_METHODS=ccall) endif() - -# Assets -if(EMSCRIPTEN) - target_link_options(reminecraftpe PRIVATE --use-preload-plugins --preload-file "${CMAKE_CURRENT_SOURCE_DIR}/../../game@/") -elseif(NOT ANDROID) - file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/../../game/assets" "${CMAKE_CURRENT_BINARY_DIR}/assets" SYMBOLIC) -endif() diff --git a/platforms/sdl/android/app/build.gradle b/platforms/sdl/android/app/build.gradle index dddb581b7..f08bc84ae 100644 --- a/platforms/sdl/android/app/build.gradle +++ b/platforms/sdl/android/app/build.gradle @@ -33,7 +33,7 @@ android { } externalNativeBuild { cmake { - path '../../CMakeLists.txt' + path '../../../../CMakeLists.txt' version '3.22.1' } } diff --git a/platforms/sdl/android/app/src/main/AndroidManifest.xml b/platforms/sdl/android/app/src/main/AndroidManifest.xml index 99abe3faf..f580f1b9e 100644 --- a/platforms/sdl/android/app/src/main/AndroidManifest.xml +++ b/platforms/sdl/android/app/src/main/AndroidManifest.xml @@ -5,8 +5,8 @@ android:versionName="1.0" android:installLocation="auto"> - - + + /platforms/sound)") +add_subdirectory("${REMCPE_SOUND_PLATFORM}") +target_link_libraries(reminecraftpe reminecraftpe-sound) \ No newline at end of file diff --git a/platforms/sound/directsound/CMakeLists.txt b/platforms/sound/directsound/CMakeLists.txt new file mode 100644 index 000000000..24daf6bbf --- /dev/null +++ b/platforms/sound/directsound/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.16.0) +project(reminecraftpe-directsound) + +# Build +add_library(reminecraftpe-sound STATIC + SoundSystemDS.cpp +) + +# Libraries +target_link_libraries(reminecraftpe-sound + reminecraftpe-core + dsound + dxguid +) + +# Headers +target_include_directories(reminecraftpe-sound PUBLIC .) diff --git a/platforms/windows/SoundSystemDS.hpp b/platforms/sound/directsound/CustomSoundSystem.hpp similarity index 95% rename from platforms/windows/SoundSystemDS.hpp rename to platforms/sound/directsound/CustomSoundSystem.hpp index 7543c4a55..de50e210c 100644 --- a/platforms/windows/SoundSystemDS.hpp +++ b/platforms/sound/directsound/CustomSoundSystem.hpp @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include #include #include @@ -49,4 +49,6 @@ class SoundSystemDS : public SoundSystem IDirectSound* m_directsound; LPDIRECTSOUND3DLISTENER m_listener; std::vector m_buffers; -}; \ No newline at end of file +}; + +#define SOUND_SYSTEM SoundSystemDS diff --git a/platforms/windows/SoundSystemDS.cpp b/platforms/sound/directsound/SoundSystemDS.cpp similarity index 99% rename from platforms/windows/SoundSystemDS.cpp rename to platforms/sound/directsound/SoundSystemDS.cpp index 34ca8efd3..a13a04241 100644 --- a/platforms/windows/SoundSystemDS.cpp +++ b/platforms/sound/directsound/SoundSystemDS.cpp @@ -7,7 +7,7 @@ ********************************************************************/ #define WIN32_LEAN_AND_MEAN -#include "SoundSystemDS.hpp" +#include "CustomSoundSystem.hpp" #include "common/Utils.hpp" // @TODO: fix crash in playAt when Asan is active diff --git a/platforms/sound/openal/CMakeLists.txt b/platforms/sound/openal/CMakeLists.txt new file mode 100644 index 000000000..101c05f28 --- /dev/null +++ b/platforms/sound/openal/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.16.0) +project(reminecraftpe-openal) + +# Build +add_library(reminecraftpe-sound STATIC + SoundSystemAL.cpp +) + +# Core +target_link_libraries(reminecraftpe-sound PUBLIC reminecraftpe-core) + +# OpenAL +if(ANDROID) + # Use Vendored OpenAL + set(ALSOFT_UTILS FALSE CACHE BOOL "" FORCE) + set(ALSOFT_EXAMPLES FALSE CACHE BOOL "" FORCE) + set(ALSOFT_TESTS FALSE CACHE BOOL "" FORCE) + set(ALSOFT_REQUIRE_OPENSL TRUE CACHE BOOL "" FORCE) + add_subdirectory(../../../thirdparty/OpenAL openal EXCLUDE_FROM_ALL) + target_link_libraries(reminecraftpe-sound PUBLIC OpenAL::OpenAL) +elseif(EMSCRIPTEN) + # Use Emscripten's OpenAL + target_link_libraries(reminecraftpe-sound PUBLIC openal) +else() + # Use System OpenAL + find_package(OpenAL REQUIRED) + target_link_libraries(reminecraftpe-sound PUBLIC "${OPENAL_LIBRARY}") + target_include_directories(reminecraftpe-sound PUBLIC "${OPENAL_INCLUDE_DIR}") +endif() + +# Headers +target_include_directories(reminecraftpe-sound PUBLIC .) diff --git a/platforms/openal/SoundSystemAL.hpp b/platforms/sound/openal/CustomSoundSystem.hpp similarity index 87% rename from platforms/openal/SoundSystemAL.hpp rename to platforms/sound/openal/CustomSoundSystem.hpp index bc04737bf..639566914 100644 --- a/platforms/openal/SoundSystemAL.hpp +++ b/platforms/sound/openal/CustomSoundSystem.hpp @@ -1,20 +1,19 @@ #pragma once -#ifdef USE_OPENAL - -#ifdef _WIN32 -#include -#include -#pragma comment( lib, "OpenAl32.lib" ) -#elif defined(__APPLE__) +#ifdef __APPLE__ #include #include -#else +#elif defined(__EMSCRIPTEN__) #include #include +#else +#include "al.h" +#include "alc.h" +#ifdef _WIN32 +#pragma comment( lib, "OpenAL32.lib" ) +#endif #endif -#include #include #include @@ -24,6 +23,8 @@ #define MAX_IDLE_SOURCES 50 #define MAX_DISTANCE 16.0f +#define SOUND_SYSTEM SoundSystemAL + class SoundSystemAL : public SoundSystem { public: @@ -54,5 +55,3 @@ class SoundSystemAL : public SoundSystem Vec3 _lastListenerPos; float _listenerVolume; }; - -#endif diff --git a/platforms/openal/SoundSystemAL.cpp b/platforms/sound/openal/SoundSystemAL.cpp similarity index 99% rename from platforms/openal/SoundSystemAL.cpp rename to platforms/sound/openal/SoundSystemAL.cpp index 2130532c6..21c48688f 100644 --- a/platforms/openal/SoundSystemAL.cpp +++ b/platforms/sound/openal/SoundSystemAL.cpp @@ -1,5 +1,4 @@ -#ifdef USE_OPENAL -#include "SoundSystemAL.hpp" +#include "CustomSoundSystem.hpp" #include "common/Utils.hpp" @@ -344,5 +343,3 @@ void SoundSystemAL::stopEngine() // Mark as unloaded _initialized = false; } - -#endif diff --git a/platforms/sound/opensl/CMakeLists.txt b/platforms/sound/opensl/CMakeLists.txt new file mode 100644 index 000000000..89eeabc98 --- /dev/null +++ b/platforms/sound/opensl/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.16.0) +project(reminecraftpe-opensl) + +# Build +add_library(reminecraftpe-sound STATIC + SoundSystemSL.cpp +) + +# Core +target_link_libraries(reminecraftpe-sound PUBLIC reminecraftpe-core) + +# OpenSL +target_link_libraries(reminecraftpe-sound PUBLIC OpenSLES) + +# Headers +target_include_directories(reminecraftpe-sound PUBLIC .) diff --git a/platforms/android/SoundSystemSL.hpp b/platforms/sound/opensl/CustomSoundSystem.hpp similarity index 97% rename from platforms/android/SoundSystemSL.hpp rename to platforms/sound/opensl/CustomSoundSystem.hpp index 121625bc1..f9e37e3da 100644 --- a/platforms/android/SoundSystemSL.hpp +++ b/platforms/sound/opensl/CustomSoundSystem.hpp @@ -30,6 +30,8 @@ typedef std::list SLSoundList; +#define SOUND_SYSTEM SoundSystemSL + class SoundSystemSL : public SoundSystem { public: @@ -62,4 +64,4 @@ class SoundSystemSL : public SoundSystem static std::vector toRemove; static SLObjectItf objEngine; static pthread_mutex_t toRemoveMutex; -}; \ No newline at end of file +}; diff --git a/platforms/android/SoundSystemSL.cpp b/platforms/sound/opensl/SoundSystemSL.cpp similarity index 99% rename from platforms/android/SoundSystemSL.cpp rename to platforms/sound/opensl/SoundSystemSL.cpp index 65649cd94..fcfca14da 100644 --- a/platforms/android/SoundSystemSL.cpp +++ b/platforms/sound/opensl/SoundSystemSL.cpp @@ -5,7 +5,7 @@ The following code is licensed under the BSD 1 clause license. SPDX-License-Identifier: BSD-1-Clause ********************************************************************/ -#include "SoundSystemSL.hpp" +#include "CustomSoundSystem.hpp" #include "common/Utils.hpp" #define C_MAX_SOUNDS 4 diff --git a/platforms/windows/AppPlatform_win32.cpp b/platforms/windows/AppPlatform_win32.cpp index e5daf9d67..bde51080a 100644 --- a/platforms/windows/AppPlatform_win32.cpp +++ b/platforms/windows/AppPlatform_win32.cpp @@ -14,7 +14,6 @@ #include "GameMods.hpp" #include "AppPlatform_win32.hpp" -#include "LoggerWin32.hpp" #include "thirdparty/GL/GL.hpp" @@ -37,24 +36,18 @@ AppPlatform_win32::AppPlatform_win32() m_MouseDiffX = 0, m_MouseDiffY = 0; - // This initializes the Logger singleton to use the Windows-specific variant - // If we didn't initialize it here, the Minecraft class would have our back - m_pLogger = new LoggerWin32(); m_pSoundSystem = nullptr; } AppPlatform_win32::~AppPlatform_win32() { SAFE_DELETE(m_pSoundSystem); - - // DELETE THIS LAST - SAFE_DELETE(m_pLogger); } void AppPlatform_win32::initSoundSystem() { if (!m_pSoundSystem) - m_pSoundSystem = new SoundSystemDS(); + m_pSoundSystem = new SOUND_SYSTEM(); else LOG_E("Trying to initialize SoundSystem more than once!"); } diff --git a/platforms/windows/AppPlatform_win32.hpp b/platforms/windows/AppPlatform_win32.hpp index 772e4cfc2..76323b8b9 100644 --- a/platforms/windows/AppPlatform_win32.hpp +++ b/platforms/windows/AppPlatform_win32.hpp @@ -15,7 +15,7 @@ #include "client/player/input/Keyboard.hpp" #include "common/Utils.hpp" #include "LoggerWin32.hpp" -#include "SoundSystemDS.hpp" +#include "CustomSoundSystem.hpp" class AppPlatform_win32 : public AppPlatform { @@ -83,7 +83,6 @@ class AppPlatform_win32 : public AppPlatform int m_MouseDiffX, m_MouseDiffY; - LoggerWin32 *m_pLogger; - SoundSystemDS* m_pSoundSystem; + SOUND_SYSTEM* m_pSoundSystem; }; diff --git a/platforms/windows/CMakeLists.txt b/platforms/windows/CMakeLists.txt new file mode 100644 index 000000000..782c0a2a8 --- /dev/null +++ b/platforms/windows/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.16.0) +project(reminecraftpe-windows) + +# Win32 Build +target_compile_definitions(reminecraftpe-core + PUBLIC HANDLE_CHARS_SEPARATELY +) + +# Libraries +target_link_libraries(reminecraftpe-core + PUBLIC opengl32 + PUBLIC glu32 + PUBLIC gdi32 + PUBLIC uuid +) + +# Build +add_executable(reminecraftpe WIN32 + LoggerWin32.cpp + AppPlatform_win32.cpp + main.cpp +) + +# Core +target_link_libraries(reminecraftpe reminecraftpe-core) + +# stb_image (If Needed) +target_link_libraries(reminecraftpe stb_image) \ No newline at end of file diff --git a/platforms/windows/LoggerWin32.hpp b/platforms/windows/LoggerWin32.hpp index 22bd0da1d..ac7f4a55b 100644 --- a/platforms/windows/LoggerWin32.hpp +++ b/platforms/windows/LoggerWin32.hpp @@ -3,7 +3,7 @@ #include #include "common/Logger.hpp" -class LoggerWin32 : Logger +class LoggerWin32 : public Logger { void print(eLogLevel, const char* const str) override; void print(eLogLevel, std::string str) override; diff --git a/platforms/windows/main.cpp b/platforms/windows/main.cpp index 2279f7954..dc1b5b009 100644 --- a/platforms/windows/main.cpp +++ b/platforms/windows/main.cpp @@ -7,7 +7,7 @@ ********************************************************************/ #include -#include +#include #include "thirdparty/GL/GL.hpp" #include "compat/KeyCodes.hpp" @@ -19,6 +19,7 @@ #include "AppPlatform_win32.hpp" #include "resource.h" +#include "LoggerWin32.hpp" LPCTSTR g_WindowClassName = TEXT("MCPEClass"); @@ -73,7 +74,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) Minecraft::width = width; Minecraft::height = height; - Minecraft::setGuiScaleMultiplier(1.0f); // assume no meddling with the DPI stuff + Minecraft::setRenderScaleMultiplier(1.0f); // assume no meddling with the DPI stuff g_AppPlatform.setScreenSize(width, height); @@ -128,6 +129,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine SetInstance(hInstance); + // This initializes the Logger singleton to use the Windows-specific variant + // If we didn't initialize it here, the Minecraft class would have our back + Logger::setSingleton(new LoggerWin32); + // register the window class: WNDCLASS wc; wc.style = CS_OWNDC; diff --git a/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj b/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj index 3e71dab03..dab9c33b3 100644 --- a/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj +++ b/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj @@ -56,15 +56,15 @@ - + - + diff --git a/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj.filters b/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj.filters index c76c4fdab..5991da251 100644 --- a/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj.filters +++ b/platforms/windows/projects/MinecraftClient.Win32/MinecraftClient.Win32.vcxproj.filters @@ -24,7 +24,7 @@ Header Files - + Header Files @@ -44,7 +44,7 @@ Source Files - + Source Files diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index acf65732e..e08f8101e 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -306,69 +306,22 @@ add_subdirectory(../thirdparty/raknet raknet) target_link_libraries(reminecraftpe-core PUBLIC raknet) # zlib -add_library(zlib INTERFACE) -if(EMSCRIPTEN) +add_library(zlib-interface INTERFACE) +if(WIN32) + # Compile Vendored ZLib + add_subdirectory(../thirdparty/zlib zlib) + target_link_libraries(zlib-interface INTERFACE zlib) +elseif(EMSCRIPTEN) # Use Emscripten's ZLib set(ZLIB_FLAG -sUSE_ZLIB=1) - target_compile_options(zlib INTERFACE "${ZLIB_FLAG}") - target_link_options(zlib INTERFACE "${ZLIB_FLAG}") + target_compile_options(zlib-interface INTERFACE "${ZLIB_FLAG}") + target_link_options(zlib-interface INTERFACE "${ZLIB_FLAG}") else() # Use System ZLib find_package(ZLIB REQUIRED) - target_link_libraries(zlib INTERFACE ZLIB::ZLIB) -endif() -target_link_libraries(reminecraftpe-core PUBLIC zlib) - -# Platform Dependencies -if(USE_SDL) - # SDL - add_library(SDL INTERFACE) - if(ANDROID) - # Use Vendored SDL2 (Only For Android) - add_subdirectory(../thirdparty/SDL2/src SDL EXCLUDE_FROM_ALL) - target_link_libraries(SDL INTERFACE SDL2::SDL2) - elseif(EMSCRIPTEN) - # Use Emscripten's SDL2 - set(SDL_FLAG -sUSE_SDL=2) - target_compile_options(SDL INTERFACE "${SDL_FLAG}") - target_link_options(SDL INTERFACE "${SDL_FLAG}") - else() - # Use System SDL2 - find_package(SDL2 REQUIRED) - target_link_libraries(SDL INTERFACE SDL2::SDL2) - endif() - target_link_libraries(reminecraftpe-core PUBLIC SDL) - - # OpenGL - if(NOT EMSCRIPTEN AND NOT ANDROID) - option(USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE) - else() - set(USE_GLES1_COMPATIBILITY_LAYER TRUE CACHE BOOL "" FORCE) - endif() - if(USE_GLES1_COMPATIBILITY_LAYER) - set(GLES_COMPATIBILITY_LAYER_USE_SDL TRUE CACHE BOOL "" FORCE) - set(GLES_COMPATIBILITY_LAYER_DEPENDENCY SDL CACHE STRING "" FORCE) - set(GLES_COMPATIBILITY_LAYER_USE_ES3 FALSE CACHE BOOL "" FORCE) - add_subdirectory(../thirdparty/gles-compatibility-layer gles-compatibility-layer) - target_link_libraries(reminecraftpe-core PUBLIC gles-compatibility-layer) - target_compile_definitions(reminecraftpe-core PUBLIC USE_GLES1_COMPATIBILITY_LAYER) - if(EMSCRIPTEN) - # Use WebGL 2 - target_link_options(reminecraftpe-core PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2) - endif() - else() - find_package(OpenGL REQUIRED) - target_link_libraries(reminecraftpe-core PUBLIC OpenGL::GL) - endif() -elseif(USE_NATIVE_ANDROID) - # OpenGL - target_link_libraries(reminecraftpe-core PUBLIC EGL GLESv1_CM) -endif() - -# Android Logging -if(ANDROID) - target_link_libraries(reminecraftpe-core PUBLIC log) + target_link_libraries(zlib-interface INTERFACE ZLIB::ZLIB) endif() +target_link_libraries(reminecraftpe-core PUBLIC zlib-interface) # Sound Data if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../sound_data/sounds.h") @@ -377,3 +330,11 @@ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../sound_data/sounds.h") endif() target_compile_definitions(reminecraftpe-core PRIVATE MISSING_SOUND_DATA) endif() + +# OpenGL Support Code +if(WIN32) + target_sources(reminecraftpe-core PRIVATE ../thirdparty/GL/GLExt.cpp) +endif() + +# OGG Support +target_link_libraries(reminecraftpe-core PUBLIC stb_vorbis) \ No newline at end of file diff --git a/source/client/app/AppPlatform.hpp b/source/client/app/AppPlatform.hpp index 082552140..51ddc7945 100644 --- a/source/client/app/AppPlatform.hpp +++ b/source/client/app/AppPlatform.hpp @@ -31,7 +31,8 @@ class AppPlatform static AppPlatform* const singleton(); AppPlatform(); - ~AppPlatform(); + + virtual ~AppPlatform(); virtual void buyGame(); virtual int checkLicense(); diff --git a/source/client/app/Minecraft.cpp b/source/client/app/Minecraft.cpp index 1d38364d9..e0f5817b9 100644 --- a/source/client/app/Minecraft.cpp +++ b/source/client/app/Minecraft.cpp @@ -98,8 +98,6 @@ Minecraft::Minecraft() : m_fLastUpdated = 0; m_fDeltaTime = 0; m_lastInteractTime = 0; - - m_Logger = new Logger(); } int Minecraft::getLicenseId() @@ -885,7 +883,6 @@ Minecraft::~Minecraft() SAFE_DELETE(m_pUser); SAFE_DELETE(m_pLevelStorageSource); SAFE_DELETE(m_pInputHolder); - SAFE_DELETE(m_Logger); //@BUG: potentially leaking a CThread instance if this is destroyed early? } diff --git a/source/client/app/Minecraft.hpp b/source/client/app/Minecraft.hpp index f69d9284c..28e8fc252 100644 --- a/source/client/app/Minecraft.hpp +++ b/source/client/app/Minecraft.hpp @@ -107,7 +107,6 @@ class Minecraft : public App static int customDebugId; private: - Logger *m_Logger; Options *m_options; public: diff --git a/source/client/gui/screens/StartMenuScreen.cpp b/source/client/gui/screens/StartMenuScreen.cpp index 18c196e4f..5156523d0 100644 --- a/source/client/gui/screens/StartMenuScreen.cpp +++ b/source/client/gui/screens/StartMenuScreen.cpp @@ -13,7 +13,7 @@ #include "SelectWorldScreen.hpp" #include "JoinGameScreen.hpp" -#if defined(_WIN32) || (defined(TARGET_OS_MAC) && TARGET_OS_IPHONE == 0) +#if (defined(USE_SDL) || defined(_WIN32) || (defined(TARGET_OS_MAC) && TARGET_OS_IPHONE == 0)) && !defined(ANDROID) #define CAN_QUIT #endif diff --git a/source/client/renderer/GameRenderer.cpp b/source/client/renderer/GameRenderer.cpp index e0a300cca..ff7e3170a 100644 --- a/source/client/renderer/GameRenderer.cpp +++ b/source/client/renderer/GameRenderer.cpp @@ -331,7 +331,9 @@ void GameRenderer::setupFog(int i) fog_color[3] = 1.0f; glFogfv(GL_FOG_COLOR, fog_color); +#ifndef __EMSCRIPTEN__ glNormal3f(0.0f, -1.0f, 0.0f); +#endif glColor4f(1.0f, 1.0f, 1.0f, 1.0f); if (m_pMinecraft->m_pMobPersp->isUnderLiquid(Material::water)) diff --git a/source/client/renderer/Lighting.cpp b/source/client/renderer/Lighting.cpp index ccf769fee..7d162cc54 100644 --- a/source/client/renderer/Lighting.cpp +++ b/source/client/renderer/Lighting.cpp @@ -23,7 +23,9 @@ void Lighting::turnOn() glEnable(GL_LIGHT0); glEnable(GL_LIGHT1); glEnable(GL_COLOR_MATERIAL); +#if !defined(__EMSCRIPTEN__) && !defined(USE_GLES) glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); +#endif constexpr float a = 0.4f, d = 0.6f, s = 0.0f; diff --git a/source/client/renderer/Tesselator.cpp b/source/client/renderer/Tesselator.cpp index a6778c1b0..1a07bc957 100644 --- a/source/client/renderer/Tesselator.cpp +++ b/source/client/renderer/Tesselator.cpp @@ -342,12 +342,13 @@ void Tesselator::vertex(float x, float y, float z) } // Wasn't here in Java cuz I guess it's not needed? -/*#ifdef USE_GL_NORMAL_LIGHTING + // TBR: This is needed with Emscripten's OpenGL implementation. +#ifdef USE_GL_NORMAL_LIGHTING if (m_bHasNormal) { pVert2->m_normal = pVert1->m_normal; } -#endif*/ +#endif pVert2->m_x = pVert1->m_x; pVert2->m_y = pVert1->m_y; diff --git a/source/client/renderer/entity/MobRenderer.cpp b/source/client/renderer/entity/MobRenderer.cpp index 1fbeead8c..d5b3fde6c 100644 --- a/source/client/renderer/entity/MobRenderer.cpp +++ b/source/client/renderer/entity/MobRenderer.cpp @@ -213,7 +213,9 @@ void MobRenderer::renderNameTag(Mob* mob, const std::string& str, float x, float glPushMatrix(); glTranslatef(x + 0.0f, y + 2.3f, z); +#ifndef __EMSCRIPTEN__ glNormal3f(0.0f, 1.0f, 0.0f); +#endif // billboard the name towards the camera glRotatef(-m_pDispatcher->m_rot.x, 0.0f, 1.0f, 0.0f); glRotatef(+m_pDispatcher->m_rot.y, 1.0f, 0.0f, 0.0f); diff --git a/source/common/CThread.cpp b/source/common/CThread.cpp index f2857c8d9..530a40fbc 100644 --- a/source/common/CThread.cpp +++ b/source/common/CThread.cpp @@ -12,7 +12,7 @@ #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN -#include // for Sleep() +#include // for Sleep() #else #include #endif diff --git a/source/common/CThread.hpp b/source/common/CThread.hpp index b2b02b04a..ecc7cd955 100644 --- a/source/common/CThread.hpp +++ b/source/common/CThread.hpp @@ -13,7 +13,7 @@ #if defined(_WIN32) #ifndef USE_WIN32_THREADS -#if defined(_XBOX) || defined(USE_OLD_CPP) +#if defined(_XBOX) || defined(USE_OLD_CPP) || defined(__MINGW32__) // USE_WIN32_THREADS - Use a Win32 implementation of threads instead of using pthread #define USE_WIN32_THREADS #else @@ -41,7 +41,7 @@ #include #else #define WIN32_LEAN_AND_MEAN -#include +#include #endif #else diff --git a/source/common/Logger.cpp b/source/common/Logger.cpp index f629ac4f2..0b75ba832 100644 --- a/source/common/Logger.cpp +++ b/source/common/Logger.cpp @@ -12,11 +12,14 @@ Logger* const Logger::singleton() return m_singleton; } -Logger::Logger() +void Logger::setSingleton(Logger* logger) { // Stick with the first output handle we get - if (!m_singleton) - m_singleton = this; + if (!m_singleton) { + m_singleton = logger; + } else { + m_singleton->print(LOG_ERR, "Logging already setup!"); + } } Logger::~Logger() diff --git a/source/common/Logger.hpp b/source/common/Logger.hpp index 3d1f4a597..7ab2e5863 100644 --- a/source/common/Logger.hpp +++ b/source/common/Logger.hpp @@ -26,8 +26,8 @@ class Logger static Logger* m_singleton; public: static Logger* const singleton(); + static void setSingleton(Logger*); - Logger(); virtual ~Logger(); const char* GetTag(eLogLevel ll); diff --git a/source/common/Utils.cpp b/source/common/Utils.cpp index e187e142a..beb8f1785 100644 --- a/source/common/Utils.cpp +++ b/source/common/Utils.cpp @@ -14,7 +14,7 @@ #if defined(_WIN32) && !defined(_XBOX) #define WIN32_LEAN_AND_MEAN -#include +#include #include #include @@ -276,7 +276,7 @@ time_t getEpochTimeS() return time(0); } -#ifdef _WIN32 +#if defined(_WIN32) && !defined(USE_SDL) HINSTANCE g_hInstance = NULL; HWND g_hWnd = NULL; diff --git a/source/common/Utils.hpp b/source/common/Utils.hpp index 8098fc8f3..f0ae463d1 100644 --- a/source/common/Utils.hpp +++ b/source/common/Utils.hpp @@ -37,9 +37,9 @@ // Do we even need all this WinSock stuff anymore? #ifndef _XBOX // assume we're on a normal Windows device #define WIN32_LEAN_AND_MEAN -#include -#include -#include +#include +#include +#include #include #include diff --git a/thirdparty/GL/GL.hpp b/thirdparty/GL/GL.hpp index bfe1cf645..91157af67 100644 --- a/thirdparty/GL/GL.hpp +++ b/thirdparty/GL/GL.hpp @@ -16,10 +16,8 @@ #include #endif -#ifdef USE_GLES1_COMPATIBILITY_LAYER - #define USE_GLES // GLES or its compatibility layer. -#endif - +// Disable this on OpenGL ES 2+ +#define USE_GL_NORMAL_LIGHTING #ifdef USE_GLES #if MC_PLATFORM_IOS @@ -38,9 +36,6 @@ #define USE_GL_ORTHO_F #else - // Standard OpenGL supports normals and lighting, OpenGL ES doesn't - #define USE_GL_NORMAL_LIGHTING - #ifdef USE_SDL #define USE_OPENGL_2_FEATURES diff --git a/thirdparty/SDL2/SDL2.h b/thirdparty/SDL2/SDL2.h index 04de4d961..3d2518b96 100644 --- a/thirdparty/SDL2/SDL2.h +++ b/thirdparty/SDL2/SDL2.h @@ -3,6 +3,7 @@ #ifdef _WIN32 #pragma comment(lib, "SDL2.lib") #include +#include #else #include #endif \ No newline at end of file diff --git a/thirdparty/gles-compatibility-layer b/thirdparty/gles-compatibility-layer deleted file mode 160000 index 5bf535a68..000000000 --- a/thirdparty/gles-compatibility-layer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5bf535a68fe1ca0381b4628859e642b40a166017 diff --git a/thirdparty/raknet/CMakeLists.txt b/thirdparty/raknet/CMakeLists.txt index 99465983b..3fac7eb43 100644 --- a/thirdparty/raknet/CMakeLists.txt +++ b/thirdparty/raknet/CMakeLists.txt @@ -115,3 +115,12 @@ add_library(raknet STATIC RakSleep.cpp ) target_include_directories(raknet PUBLIC .) + +# Windows Support +if(WIN32) + target_compile_definitions(raknet + PUBLIC SHA1_HAS_TCHAR + PUBLIC LOCKLESS_TYPES_USE_MUTEX + ) + target_link_libraries(raknet ws2_32) +endif() \ No newline at end of file diff --git a/thirdparty/raknet/WindowsIncludes.h b/thirdparty/raknet/WindowsIncludes.h index 9ec686837..969d9aeb5 100644 --- a/thirdparty/raknet/WindowsIncludes.h +++ b/thirdparty/raknet/WindowsIncludes.h @@ -16,9 +16,9 @@ #include #elif defined (_WIN32) && !defined(WINDOWS_PHONE_8) && !defined(WINDOWS_STORE_RT) #define _WINPC -#include +#include #include -#include +#include // Must always include Winsock2.h before windows.h // or else: diff --git a/thirdparty/stb_image/CMakeLists.txt b/thirdparty/stb_image/CMakeLists.txt index 0e11124b8..475339635 100644 --- a/thirdparty/stb_image/CMakeLists.txt +++ b/thirdparty/stb_image/CMakeLists.txt @@ -4,3 +4,5 @@ project(stb_image) # Build add_library(stb_image STATIC src/stb_image_impl.c) target_include_directories(stb_image PUBLIC include) +add_library(stb_vorbis STATIC include/stb_vorbis.c) +target_include_directories(stb_vorbis PUBLIC include)