More Miscellaneous Fixes + Fixed GLES v1.1 Support
This commit is contained in:
parent
23df63abb7
commit
484d3e7f90
28
.gitignore
vendored
28
.gitignore
vendored
@ -1,15 +1,15 @@
|
||||
out
|
||||
debian/tmp
|
||||
.vscode
|
||||
build*
|
||||
CMakeLists.txt.user
|
||||
/out
|
||||
/debian/tmp
|
||||
/.vscode
|
||||
/build*
|
||||
/CMakeLists.txt.user
|
||||
*.autosave
|
||||
AppImageBuilder.yml
|
||||
appimage-builder-cache
|
||||
appimage-build
|
||||
AppDir
|
||||
*.zsync
|
||||
*.AppImage
|
||||
core*
|
||||
qemu_*
|
||||
.prebuilt-armhf-toolchain
|
||||
/AppImageBuilder.yml
|
||||
/appimage-builder-cache
|
||||
/appimage-build
|
||||
/AppDir
|
||||
/*.zsync
|
||||
/*.AppImage
|
||||
/core*
|
||||
/qemu_*
|
||||
/cmake/.prebuilt-armhf-toolchain
|
||||
|
@ -1,9 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
|
||||
# Build Mode
|
||||
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
||||
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
||||
if(MCPI_BUILD_MODE STREQUAL "arm")
|
||||
set(BUILD_ARM_COMPONENTS TRUE)
|
||||
set(BUILD_NATIVE_COMPONENTS FALSE)
|
||||
elseif(MCPI_BUILD_MODE STREQUAL "native")
|
||||
set(BUILD_ARM_COMPONENTS FALSE)
|
||||
set(BUILD_NATIVE_COMPONENTS TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid Mode")
|
||||
endif()
|
||||
|
||||
# Specify Options
|
||||
option(MCPI_IS_MIXED_BUILD "Whether The Architecture-Independent And ARM Code Are Different Architecture" FALSE)
|
||||
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
||||
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
||||
option(MCPI_OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" FALSE)
|
||||
option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE)
|
||||
|
||||
@ -11,16 +22,15 @@ option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE)
|
||||
option(MCPI_SERVER_MODE "Server Mode" FALSE)
|
||||
option(MCPI_HEADLESS_MODE "Headless Mode" ${MCPI_SERVER_MODE})
|
||||
|
||||
# Prebuilt ARMHF Toolchain
|
||||
option(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" ${MCPI_IS_MIXED_BUILD})
|
||||
|
||||
# Media Layer
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
option(MCPI_USE_MEDIA_LAYER_PROXY "Whether To Enable The Media Layer Proxy" ${MCPI_IS_MIXED_BUILD})
|
||||
option(MCPI_USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE)
|
||||
if(MCPI_HEADLESS_MODE)
|
||||
set(DEFAULT_USE_MEDIA_LAYER_PROXY FALSE)
|
||||
else()
|
||||
set(MCPI_USE_MEDIA_LAYER_PROXY FALSE)
|
||||
set(MCPI_USE_GLES1_COMPATIBILITY_LAYER FALSE)
|
||||
set(DEFAULT_USE_MEDIA_LAYER_PROXY ${MCPI_IS_MIXED_BUILD})
|
||||
endif()
|
||||
option(MCPI_USE_MEDIA_LAYER_PROXY "Whether To Enable The Media Layer Proxy" ${DEFAULT_USE_MEDIA_LAYER_PROXY})
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
option(MCPI_USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE)
|
||||
endif()
|
||||
|
||||
# App ID
|
||||
@ -41,17 +51,6 @@ else()
|
||||
endif()
|
||||
set(MCPI_APP_TITLE "${DEFAULT_APP_TITLE}" CACHE STRING "App Title")
|
||||
|
||||
# Configure Build Mode
|
||||
if(MCPI_BUILD_MODE STREQUAL "arm")
|
||||
set(BUILD_ARM_COMPONENTS TRUE)
|
||||
set(BUILD_NATIVE_COMPONENTS FALSE)
|
||||
elseif(MCPI_BUILD_MODE STREQUAL "native")
|
||||
set(BUILD_ARM_COMPONENTS FALSE)
|
||||
set(BUILD_NATIVE_COMPONENTS TRUE)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid Mode")
|
||||
endif()
|
||||
|
||||
# Specify Variant Name
|
||||
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
|
||||
if(MCPI_SERVER_MODE)
|
||||
@ -86,7 +85,8 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
# Setup Prebuilt ARMHF Toolchain
|
||||
# Prebuilt ARMHF Toolchain
|
||||
option(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" ${MCPI_IS_MIXED_BUILD})
|
||||
if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
||||
include(cmake/prebuilt-armhf-toolchain.cmake)
|
||||
endif()
|
||||
@ -97,12 +97,10 @@ project(minecraft-pi-reborn)
|
||||
# Utility Functions
|
||||
include(cmake/util.cmake)
|
||||
|
||||
# Sanity Check
|
||||
# Sanity Checks
|
||||
if(BUILD_NATIVE_COMPONENTS AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" AND NOT MCPI_IS_MIXED_BUILD)
|
||||
message(FATAL_ERROR "Project is configured as a mixed-buld, but MCPI_IS_MIXED_BUILD is disabled.")
|
||||
endif()
|
||||
|
||||
# Require ARM Compilation
|
||||
if(BUILD_ARM_COMPONENTS AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
|
||||
message(FATAL_ERROR "ARM-Targeting Compiler Required")
|
||||
endif()
|
||||
@ -139,7 +137,7 @@ add_subdirectory(dependencies)
|
||||
|
||||
# Warnings
|
||||
add_compile_options(-Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 10.0)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 10.0)
|
||||
# Prevents False Positives
|
||||
add_compile_options(-Wno-stringop-overflow)
|
||||
endif()
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Locations
|
||||
set(toolchain_dir "${CMAKE_CURRENT_SOURCE_DIR}/.prebuilt-armhf-toolchain")
|
||||
set(toolchain_dir "${CMAKE_CURRENT_LIST_DIR}/.prebuilt-armhf-toolchain")
|
||||
set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")
|
||||
|
||||
# Force Toolchain
|
||||
@ -16,7 +16,7 @@ if(NOT EXISTS "${CMAKE_C_COMPILER}")
|
||||
if(arch STREQUAL "x86_64")
|
||||
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz")
|
||||
set(toolchain_sha256 "c254f7199261fe76c32ef42187502839bda7efad0a66646cf739d074eff45fad")
|
||||
elseif(arch STREQUAL "aarch64_be" OR arch STREQUAL "aarch64" OR arch STREQUAL "armv8b" OR arch STREQUAL "armv8l")
|
||||
elseif(arch STREQUAL "aarch64" OR arch STREQUAL "armv8b" OR arch STREQUAL "armv8l")
|
||||
set(toolchain_url "https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-aarch64-arm-none-linux-gnueabihf.tar.xz")
|
||||
set(toolchain_sha256 "c5603772af016008ddacb7e475dc226d0cccdf069925dfded43e452a59774fc3")
|
||||
else()
|
||||
@ -35,6 +35,7 @@ if(NOT EXISTS "${CMAKE_C_COMPILER}")
|
||||
SOURCE_DIR "${toolchain_dir}"
|
||||
)
|
||||
FetchContent_Populate(prebuilt-armhf-toolchain)
|
||||
|
||||
# Force Sysroot Rebuild
|
||||
file(REMOVE_RECURSE "${sysroot_dir}")
|
||||
endif()
|
||||
@ -51,11 +52,12 @@ if(NOT EXISTS "${sysroot_dir}")
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING
|
||||
PATTERN "*.so*"
|
||||
PATTERN "*.py*" EXCLUDE
|
||||
REGEX "gconv" EXCLUDE
|
||||
REGEX "audit" EXCLUDE
|
||||
)
|
||||
|
||||
# Delete Unneeded Files
|
||||
file(REMOVE_RECURSE "${sysroot_dir}/usr/lib/audit")
|
||||
file(REMOVE_RECURSE "${sysroot_dir}/usr/lib/gconv")
|
||||
|
||||
# Strip Files
|
||||
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*")
|
||||
foreach(file IN LISTS files)
|
||||
|
2
dependencies/CMakeLists.txt
vendored
2
dependencies/CMakeLists.txt
vendored
@ -7,6 +7,6 @@ if(BUILD_ARM_COMPONENTS AND NOT MCPI_OPEN_SOURCE_ONLY)
|
||||
add_subdirectory(minecraft-pi)
|
||||
endif()
|
||||
# Zenity (Minimal Build)
|
||||
if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE)
|
||||
if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_SERVER_MODE)
|
||||
add_subdirectory(zenity)
|
||||
endif()
|
||||
|
27
example-mods/chat-commands/.gitignore
vendored
27
example-mods/chat-commands/.gitignore
vendored
@ -1,14 +1,15 @@
|
||||
out
|
||||
debian/tmp
|
||||
.vscode
|
||||
build*
|
||||
CMakeLists.txt.user
|
||||
/out
|
||||
/debian/tmp
|
||||
/.vscode
|
||||
/build*
|
||||
/CMakeLists.txt.user
|
||||
*.autosave
|
||||
AppImageBuilder.yml
|
||||
appimage-builder-cache
|
||||
appimage-build
|
||||
AppDir
|
||||
*.zsync
|
||||
*.AppImage
|
||||
core*
|
||||
qemu_*
|
||||
/AppImageBuilder.yml
|
||||
/appimage-builder-cache
|
||||
/appimage-build
|
||||
/AppDir
|
||||
/*.zsync
|
||||
/*.AppImage
|
||||
/core*
|
||||
/qemu_*
|
||||
/cmake/.prebuilt-armhf-toolchain
|
||||
|
27
example-mods/expanded-creative/.gitignore
vendored
27
example-mods/expanded-creative/.gitignore
vendored
@ -1,14 +1,15 @@
|
||||
out
|
||||
debian/tmp
|
||||
.vscode
|
||||
build*
|
||||
CMakeLists.txt.user
|
||||
/out
|
||||
/debian/tmp
|
||||
/.vscode
|
||||
/build*
|
||||
/CMakeLists.txt.user
|
||||
*.autosave
|
||||
AppImageBuilder.yml
|
||||
appimage-builder-cache
|
||||
appimage-build
|
||||
AppDir
|
||||
*.zsync
|
||||
*.AppImage
|
||||
core*
|
||||
qemu_*
|
||||
/AppImageBuilder.yml
|
||||
/appimage-builder-cache
|
||||
/appimage-build
|
||||
/AppDir
|
||||
/*.zsync
|
||||
/*.AppImage
|
||||
/core*
|
||||
/qemu_*
|
||||
/cmake/.prebuilt-armhf-toolchain
|
||||
|
27
example-mods/recipes/.gitignore
vendored
27
example-mods/recipes/.gitignore
vendored
@ -1,14 +1,15 @@
|
||||
out
|
||||
debian/tmp
|
||||
.vscode
|
||||
build*
|
||||
CMakeLists.txt.user
|
||||
/out
|
||||
/debian/tmp
|
||||
/.vscode
|
||||
/build*
|
||||
/CMakeLists.txt.user
|
||||
*.autosave
|
||||
AppImageBuilder.yml
|
||||
appimage-builder-cache
|
||||
appimage-build
|
||||
AppDir
|
||||
*.zsync
|
||||
*.AppImage
|
||||
core*
|
||||
qemu_*
|
||||
/AppImageBuilder.yml
|
||||
/appimage-builder-cache
|
||||
/appimage-build
|
||||
/AppDir
|
||||
/*.zsync
|
||||
/*.AppImage
|
||||
/core*
|
||||
/qemu_*
|
||||
/cmake/.prebuilt-armhf-toolchain
|
||||
|
@ -1,7 +1,7 @@
|
||||
project(images)
|
||||
|
||||
# Title Background
|
||||
if(NOT MCPI_SERVER_MODE)
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
install(
|
||||
FILES "background.png"
|
||||
DESTINATION "${MCPI_INSTALL_DIR}/data/images/gui"
|
||||
|
@ -149,7 +149,7 @@ void pre_bootstrap(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
// Debug Zenity
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
#ifndef MCPI_SERVER_MODE
|
||||
{
|
||||
const char *is_debug = getenv("MCPI_DEBUG");
|
||||
if (is_debug != NULL && strlen(is_debug) > 0) {
|
||||
|
@ -7,13 +7,17 @@ add_subdirectory(dependencies)
|
||||
set(CORE_SRC src/base.cpp src/media.c src/screenshot.c $<TARGET_OBJECTS:media-layer-extras>) # SDL Re-Implementation Using GLFW
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
list(APPEND CORE_SRC src/audio/api.cpp src/audio/engine.c src/audio/file.cpp)
|
||||
else()
|
||||
list(APPEND CORE_SRC src/audio/stubs.c)
|
||||
endif()
|
||||
|
||||
# Build
|
||||
add_library(media-layer-core SHARED ${CORE_SRC}) # Dependencies Are Setup Later
|
||||
# Install
|
||||
install(TARGETS media-layer-core DESTINATION "${MCPI_LIB_DIR}")
|
||||
if(BUILD_ARM_COMPONENTS)
|
||||
install(TARGETS media-layer-core EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
|
||||
endif()
|
||||
|
||||
# Link
|
||||
target_link_libraries(media-layer-core PUBLIC media-layer-headers PUBLIC reborn-util PUBLIC pthread PUBLIC dl)
|
||||
|
6
media-layer/core/dependencies/CMakeLists.txt
Normal file
6
media-layer/core/dependencies/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
project(media-layer-core-dependencies)
|
||||
|
||||
# GLFW
|
||||
if(NOT MCPI_HEADLESS_MODE)
|
||||
add_subdirectory(glfw)
|
||||
endif()
|
28
media-layer/core/dependencies/glfw/CMakeLists.txt
Normal file
28
media-layer/core/dependencies/glfw/CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
||||
project(glfw)
|
||||
|
||||
# Silence Warnings
|
||||
add_compile_options(-w)
|
||||
|
||||
## GLFW
|
||||
|
||||
# Download
|
||||
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_EXAMPLES FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_DOCS FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_INSTALL FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_WIN32 FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_COCOA FALSE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_X11 TRUE CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_WAYLAND TRUE CACHE BOOL "" FORCE)
|
||||
set(GLFW_LIBRARY_TYPE "SHARED" CACHE BOOL "" FORCE)
|
||||
add_subdirectory(src EXCLUDE_FROM_ALL)
|
||||
|
||||
# Ensure Build
|
||||
add_custom_target(glfw-build ALL DEPENDS glfw)
|
||||
|
||||
# Install
|
||||
install(TARGETS glfw DESTINATION "${MCPI_LIB_DIR}")
|
||||
if(BUILD_ARM_COMPONENTS)
|
||||
install(TARGETS glfw EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
|
||||
endif()
|
6
media-layer/core/src/audio/stubs.c
Normal file
6
media-layer/core/src/audio/stubs.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <media-layer/audio.h>
|
||||
|
||||
void media_audio_update(__attribute__((unused)) float volume, __attribute__((unused)) float x, __attribute__((unused)) float y, __attribute__((unused)) float z, __attribute__((unused)) float yaw) {
|
||||
}
|
||||
void media_audio_play(__attribute__((unused)) const char *source, __attribute__((unused)) const char *name, __attribute__((unused)) float x, __attribute__((unused)) float y, __attribute__((unused)) float z, __attribute__((unused)) float pitch, __attribute__((unused)) float volume, __attribute__((unused)) int is_ui) {
|
||||
}
|
@ -29,6 +29,7 @@ void glDeleteBuffers(GLsizei n, const GLuint *buffers) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (buffers_map.count(buffers[i]) > 0) {
|
||||
real_glDeleteBuffers()(1, &buffers_map[i]);
|
||||
buffers_map.erase(buffers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,11 @@ void glDepthRangef(GLclampf near, GLclampf far) {
|
||||
}
|
||||
void glDepthFunc(GLenum func) {
|
||||
}
|
||||
static GLuint current_buffer = 0;
|
||||
void glBindBuffer(GLenum target, GLuint buffer) {
|
||||
if (target == GL_ARRAY_BUFFER) {
|
||||
current_buffer = buffer;
|
||||
}
|
||||
}
|
||||
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
|
||||
}
|
||||
@ -140,6 +144,10 @@ void glGetIntegerv(GLenum pname, GLint *data) {
|
||||
data[0] = current_texture;
|
||||
break;
|
||||
}
|
||||
case GL_ARRAY_BUFFER_BINDING: {
|
||||
data[0] = current_buffer;
|
||||
break;
|
||||
}
|
||||
case GL_UNPACK_ALIGNMENT: {
|
||||
data[0] = 1;
|
||||
break;
|
||||
|
@ -4,15 +4,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
void media_audio_update(float volume, float x, float y, float z, float yaw);
|
||||
void media_audio_play(const char *source, const char *name, float x, float y, float z, float pitch, float volume, int is_ui);
|
||||
#else
|
||||
static inline void media_audio_update(__attribute__((unused)) float volume, __attribute__((unused)) float x, __attribute__((unused)) float y, __attribute__((unused)) float z, __attribute__((unused)) float yaw) {
|
||||
}
|
||||
static inline void media_audio_play(__attribute__((unused)) const char *source, __attribute__((unused)) const char *name, __attribute__((unused)) float x, __attribute__((unused)) float y, __attribute__((unused)) float z, __attribute__((unused)) float pitch, __attribute__((unused)) float volume, __attribute__((unused)) int is_ui) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -35,6 +35,31 @@ CALL(11, glFogfv, void, (GLenum pname, const GLfloat *params)) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Track Bindings
|
||||
#if defined(MEDIA_LAYER_PROXY_SERVER)
|
||||
static GLuint bound_buffer = 0;
|
||||
static GLuint bound_texture = 0;
|
||||
static unsigned char vertex_array_enabled = 0;
|
||||
static unsigned char color_array_enabled = 0;
|
||||
static unsigned char tex_coord_array_enabled = 0;
|
||||
static unsigned char *get_array_enabled_pointer(GLenum array) {
|
||||
switch (array) {
|
||||
case GL_VERTEX_ARRAY: {
|
||||
return &vertex_array_enabled;
|
||||
}
|
||||
case GL_COLOR_ARRAY: {
|
||||
return &color_array_enabled;
|
||||
}
|
||||
case GL_TEXTURE_COORD_ARRAY: {
|
||||
return &tex_coord_array_enabled;
|
||||
}
|
||||
default: {
|
||||
ERR("Unsupported Array Pointer: %i", array);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// 'pointer' Is Only Supported As An Integer, Not As An Actual Pointer
|
||||
#if defined(MEDIA_LAYER_PROXY_SERVER)
|
||||
#define CALL_GL_POINTER(unique_id, name) \
|
||||
@ -58,6 +83,7 @@ CALL(11, glFogfv, void, (GLenum pname, const GLfloat *params)) {
|
||||
start_proxy_call(); \
|
||||
\
|
||||
/* Arguments */ \
|
||||
write_int(bound_buffer); \
|
||||
write_int((uint32_t) size); \
|
||||
write_int((uint32_t) type); \
|
||||
write_int((uint32_t) stride); \
|
||||
@ -69,10 +95,11 @@ CALL(11, glFogfv, void, (GLenum pname, const GLfloat *params)) {
|
||||
#else
|
||||
#define CALL_GL_POINTER(unique_id, name) \
|
||||
CALL(unique_id, name, unused, unused) { \
|
||||
/* Setup Buffer Binding */ \
|
||||
GLuint bound_buffer = (GLuint) read_int(); \
|
||||
glBindBuffer(GL_ARRAY_BUFFER, bound_buffer); \
|
||||
/* Check State */ \
|
||||
GLint current_buffer = 0; \
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, ¤t_buffer); \
|
||||
if (current_buffer == 0) { \
|
||||
if (bound_buffer == 0) { \
|
||||
PROXY_ERR("gl*Pointer() Functions Are Only Supported When A Buffer Is Bound To GL_ARRAY_BUFFER"); \
|
||||
} \
|
||||
GLint size = (GLint) read_int(); \
|
||||
@ -122,31 +149,6 @@ CALL(14, glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Track Bindings
|
||||
#if defined(MEDIA_LAYER_PROXY_SERVER)
|
||||
static GLuint bound_buffer = 0;
|
||||
static GLuint bound_texture = 0;
|
||||
static unsigned char vertex_array_enabled = 0;
|
||||
static unsigned char color_array_enabled = 0;
|
||||
static unsigned char tex_coord_array_enabled = 0;
|
||||
static unsigned char *get_array_enabled_pointer(GLenum array) {
|
||||
switch (array) {
|
||||
case GL_VERTEX_ARRAY: {
|
||||
return &vertex_array_enabled;
|
||||
}
|
||||
case GL_COLOR_ARRAY: {
|
||||
return &color_array_enabled;
|
||||
}
|
||||
case GL_TEXTURE_COORD_ARRAY: {
|
||||
return &tex_coord_array_enabled;
|
||||
}
|
||||
default: {
|
||||
ERR("Unsupported Array Pointer: %i", array);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CALL(15, glDrawArrays, void, (GLenum mode, GLint first, GLsizei count)) {
|
||||
#if defined(MEDIA_LAYER_PROXY_SERVER)
|
||||
// Lock Proxy
|
||||
@ -599,6 +601,12 @@ void glBindBuffer(GLenum target, GLuint buffer) {
|
||||
} else {
|
||||
PROXY_ERR("Unsupported Buffer Binding: %u", target);
|
||||
}
|
||||
// Not needed when using compatibility layer
|
||||
#ifndef MCPI_USE_GLES1_COMPATIBILITY_LAYER
|
||||
is_set_glVertexPointer = 0;
|
||||
is_set_glColorPointer = 0;
|
||||
is_set_glTexCoordPointer = 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -62,9 +62,6 @@ else()
|
||||
add_library(touch SHARED src/touch/touch.cpp)
|
||||
target_link_libraries(touch mods-headers reborn-patch symbols feature)
|
||||
|
||||
add_library(override SHARED src/override/override.c)
|
||||
target_link_libraries(override mods-headers reborn-patch symbols dl home)
|
||||
|
||||
add_library(textures SHARED src/textures/textures.cpp)
|
||||
target_link_libraries(textures mods-headers reborn-patch symbols media-layer-core feature misc)
|
||||
|
||||
@ -75,6 +72,9 @@ else()
|
||||
target_link_libraries(benchmark mods-headers reborn-patch symbols compat misc media-layer-core)
|
||||
endif()
|
||||
|
||||
add_library(override SHARED src/override/override.c)
|
||||
target_link_libraries(override mods-headers reborn-patch symbols dl home)
|
||||
|
||||
add_library(death SHARED src/death/death.cpp)
|
||||
target_link_libraries(death mods-headers reborn-patch symbols feature)
|
||||
|
||||
@ -99,11 +99,11 @@ else()
|
||||
endif()
|
||||
|
||||
## Install Mods
|
||||
set(MODS_TO_INSTALL init compat readdir feature game-mode misc death options chat creative home version test)
|
||||
set(MODS_TO_INSTALL init compat readdir feature game-mode misc override death options chat creative home version test)
|
||||
if(MCPI_SERVER_MODE)
|
||||
list(APPEND MODS_TO_INSTALL server)
|
||||
else()
|
||||
list(APPEND MODS_TO_INSTALL multiplayer sound override camera input sign touch textures atlas benchmark)
|
||||
list(APPEND MODS_TO_INSTALL multiplayer sound camera input sign touch textures atlas benchmark)
|
||||
endif()
|
||||
install(TARGETS ${MODS_TO_INSTALL} DESTINATION "${MCPI_INSTALL_DIR}/mods")
|
||||
# SDK
|
||||
|
@ -7,16 +7,9 @@
|
||||
|
||||
#include <libreborn/libreborn.h>
|
||||
|
||||
#ifndef MCPI_SERVER_MODE
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include <media-layer/core.h>
|
||||
|
||||
#include <mods/input/input.h>
|
||||
#include <mods/sign/sign.h>
|
||||
#include <mods/chat/chat.h>
|
||||
#include <mods/home/home.h>
|
||||
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
// Custom Title
|
||||
HOOK(SDL_WM_SetCaption, void, (__attribute__((unused)) const char *title, const char *icon)) {
|
||||
ensure_SDL_WM_SetCaption();
|
||||
@ -29,6 +22,15 @@ HOOK(SDL_ShowCursor, int, (int toggle)) {
|
||||
ensure_SDL_ShowCursor();
|
||||
return (*real_SDL_ShowCursor)(toggle == SDL_QUERY ? SDL_QUERY : SDL_DISABLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MCPI_SERVER_MODE
|
||||
#include <media-layer/core.h>
|
||||
|
||||
#include <mods/input/input.h>
|
||||
#include <mods/sign/sign.h>
|
||||
#include <mods/chat/chat.h>
|
||||
#include <mods/home/home.h>
|
||||
|
||||
// Intercept SDL Events
|
||||
HOOK(SDL_PollEvent, int, (SDL_Event *event)) {
|
||||
|
@ -253,7 +253,7 @@ void init_misc() {
|
||||
}
|
||||
|
||||
// Disable V-Sync
|
||||
if (feature_has("Disable V-Sync", server_disabled)) {
|
||||
if (feature_has("Disable V-Sync", server_enabled)) {
|
||||
media_disable_vsync();
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ void init_touch() {
|
||||
}
|
||||
|
||||
// Show Block Outlines
|
||||
int block_outlines = feature_has("Show Block Outlines", 0);
|
||||
int block_outlines = feature_has("Show Block Outlines", server_disabled);
|
||||
unsigned char outline_patch[4] = {(unsigned char) (block_outlines ? !touch_gui : touch_gui), 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0"
|
||||
patch((void *) 0x4a210, outline_patch);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user