2.4.2
minecraft-pi-reborn/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2022-07-29 22:13:03 -04:00
parent 379da809cd
commit c11c7203ef
19 changed files with 127 additions and 90 deletions

View File

@ -1 +1 @@
2.4.1
2.4.2

View File

@ -8,3 +8,24 @@ function(install_symlink target link)
file(CREATE_LINK "${target}" "${CMAKE_BINARY_DIR}/symlink/${link}" SYMBOLIC)
install(FILES "${CMAKE_BINARY_DIR}/symlink/${link}" DESTINATION "${parent}")
endfunction()
# Embed Resources
function(embed_resource target file)
# Read Hex Data
file(READ "${file}" data HEX)
# Convert Hex Data For C Compatibility
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," data "${data}")
# Get C Name
get_filename_component(name "${file}" NAME)
string(MAKE_C_IDENTIFIER "${name}" name)
# Write Data
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" "#include <stddef.h>\nconst unsigned char ${name}[] = {${data}};\nconst size_t ${name}_len = sizeof (${name});\n")
# Add To Target
target_sources("${target}" PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
# Mark Dependency
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS "${file}"
)
endfunction()

View File

@ -1,5 +1,9 @@
# Changelog
**2.4.2**
* Fix Picking Up Lava
* Fix Wayland App ID
**2.4.1**
* Allow More Characters In Usernames And Chat
* Fix Running On ARMHF Debian Buster

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@ -8,14 +8,8 @@ add_executable(launcher src/bootstrap.c src/patchelf.c src/crash-report.c)
if(MCPI_SERVER_MODE)
target_sources(launcher PRIVATE src/server/launcher.c)
else()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c"
COMMAND xxd -i available-feature-flags "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/client/available-feature-flags"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/client"
VERBATIM
)
target_sources(launcher PRIVATE src/client/launcher.cpp "${CMAKE_CURRENT_BINARY_DIR}/available-feature-flags.c")
embed_resource(launcher src/client/available-feature-flags)
target_sources(launcher PRIVATE src/client/launcher.cpp)
endif()
target_link_libraries(launcher reborn-util)
# RPath
@ -44,7 +38,7 @@ else()
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
"Terminal=false\n"
"StartupNotify=false\n"
"StartupWMClass=${MCPI_APP_TITLE}\n"
"StartupWMClass=${MCPI_APP_ID}\n"
)
endif()
install(

View File

@ -37,7 +37,7 @@ static std::string strip_feature_flag_default(std::string flag, bool *default_re
// Load Available Feature Flags
extern unsigned char available_feature_flags[];
extern unsigned int available_feature_flags_len;
extern size_t available_feature_flags_len;
static void load_available_feature_flags(std::function<void(std::string)> callback) {
// Get Path
char *binary_directory = get_binary_directory();
@ -112,7 +112,7 @@ static void run_zenity_and_set_env(const char *env_name, std::vector<std::string
full_command.push_back("--title");
full_command.push_back(DIALOG_TITLE);
full_command.push_back("--name");
full_command.push_back(MCPI_APP_TITLE);
full_command.push_back(MCPI_APP_ID);
full_command.insert(full_command.end(), command.begin(), command.end());
// Convert To C Array
const char *full_command_array[full_command.size() + 1];

View File

@ -22,7 +22,7 @@ static void show_report(const char *log_filename) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_TITLE,
"--name", MCPI_APP_ID,
"--width", CRASH_REPORT_DIALOG_WIDTH,
"--height", CRASH_REPORT_DIALOG_HEIGHT,
"--text-info",

View File

@ -6,5 +6,6 @@
#cmakedefine MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN
#cmakedefine MCPI_USE_GLES1_COMPATIBILITY_LAYER
#cmakedefine MCPI_APP_TITLE "@MCPI_APP_TITLE@"
#cmakedefine MCPI_APP_ID "@MCPI_APP_ID@"
#cmakedefine MCPI_VERSION "@MCPI_VERSION@"
#cmakedefine MCPI_SDK_DIR "@MCPI_SDK_DIR@"

@ -1 +1 @@
Subproject commit c50d53160fa9b579dda0d0a4f9a7c2512940df8e
Subproject commit c18851f52ec9704eb06464058a600845ec1eada1

View File

@ -14,6 +14,11 @@ endif()
add_library(GLESv1_CM SHARED ${GLES_SRC})
if(NOT MCPI_HEADLESS_MODE)
target_link_libraries(GLESv1_CM PRIVATE glfw PUBLIC reborn-util PRIVATE dl PRIVATE m)
# Shaders
if(MCPI_USE_GLES1_COMPATIBILITY_LAYER)
embed_resource(GLESv1_CM src/compatibility-layer/shaders/main.vert)
embed_resource(GLESv1_CM src/compatibility-layer/shaders/main.frag)
endif()
endif()
# Common

View File

@ -54,16 +54,16 @@ static void log_shader(GLuint shader, const char *name) {
ERR("Failed To Compile %s Shader", name);
}
}
static GLuint compile_shader(const char *vertex_shader_text, const char *fragment_shader_text) {
static GLuint compile_shader(const char *vertex_shader_text, const int vertex_shader_length, const char *fragment_shader_text, const int fragment_shader_length) {
// Vertex Shader
const GLuint vertex_shader = real_glCreateShader()(REAL_GL_VERTEX_SHADER);
real_glShaderSource()(vertex_shader, 1, &vertex_shader_text, NULL);
real_glShaderSource()(vertex_shader, 1, &vertex_shader_text, &vertex_shader_length);
real_glCompileShader()(vertex_shader);
log_shader(vertex_shader, "Vertex");
// Fragment Shader
const GLuint fragment_shader = real_glCreateShader()(REAL_GL_FRAGMENT_SHADER);
real_glShaderSource()(fragment_shader, 1, &fragment_shader_text, NULL);
real_glShaderSource()(fragment_shader, 1, &fragment_shader_text, &fragment_shader_length);
real_glCompileShader()(fragment_shader);
log_shader(fragment_shader, "Fragment");
@ -78,70 +78,14 @@ static GLuint compile_shader(const char *vertex_shader_text, const char *fragmen
}
// Shader
extern unsigned char main_vert[];
extern size_t main_vert_len;
extern unsigned char main_frag[];
extern size_t main_frag_len;
static GLuint get_shader() {
static GLuint program = 0;
if (program == 0) {
static const char *vertex_shader_text =
"#version 100\n"
"precision mediump float;\n"
// Matrices
"uniform mat4 u_projection;\n"
"uniform mat4 u_model_view;\n"
"uniform mat4 u_texture;\n"
// Texture
"attribute vec3 a_vertex_coords;\n"
"attribute vec2 a_texture_coords;\n"
"varying vec4 v_texture_pos;\n"
// Color
"attribute vec4 a_color;\n"
"varying vec4 v_color;\n"
// Fog
"varying vec4 v_fog_eye_position;\n"
// Main
"void main() {\n"
" v_texture_pos = u_texture * vec4(a_texture_coords.xy, 0.0, 1.0);\n"
" gl_Position = u_projection * u_model_view * vec4(a_vertex_coords.xyz, 1.0);\n"
" v_color = a_color;\n"
" v_fog_eye_position = u_model_view * vec4(a_vertex_coords.xyz, 1.0);\n"
"}";
static const char *fragment_shader_text =
"#version 100\n"
"precision mediump float;\n"
// Texture
"uniform bool u_has_texture;"
"uniform sampler2D u_texture_unit;\n"
// Color
"varying vec4 v_color;\n"
"varying vec4 v_texture_pos;\n"
// Alpha Test
"uniform bool u_alpha_test;\n"
// Fog
"uniform bool u_fog;\n"
"uniform vec4 u_fog_color;\n"
"uniform bool u_fog_is_linear;\n"
"uniform float u_fog_start;\n"
"uniform float u_fog_end;\n"
"varying vec4 v_fog_eye_position;\n"
// Main
"void main(void) {\n"
" gl_FragColor = v_color;\n"
" if (u_has_texture) {\n"
" gl_FragColor *= texture2D(u_texture_unit, v_texture_pos.xy);\n"
" }\n"
" if (u_alpha_test && gl_FragColor.a <= 0.1) {\n"
" discard;\n"
" }\n"
" if (u_fog) {\n"
" float fog_factor;\n"
" if (u_fog_is_linear) {\n"
" fog_factor = (u_fog_end - length(v_fog_eye_position)) / (u_fog_end - u_fog_start);\n"
" } else {\n"
" fog_factor = exp(-u_fog_start * length(v_fog_eye_position));\n"
" }\n"
" gl_FragColor = mix(gl_FragColor, u_fog_color, 1.0 - clamp(fog_factor, 0.0, 1.0));\n"
" }\n"
"}";
program = compile_shader(vertex_shader_text, fragment_shader_text);
program = compile_shader((const char *) main_vert, main_vert_len, (const char *) main_frag, main_frag_len);
}
return program;
}

View File

@ -0,0 +1,39 @@
#version 100
precision mediump float;
// Texture
uniform bool u_has_texture;
uniform sampler2D u_texture_unit;
// Color
varying vec4 v_color;
varying vec4 v_texture_pos;
// Alpha Test
uniform bool u_alpha_test;
// Fog
uniform bool u_fog;
uniform vec4 u_fog_color;
uniform bool u_fog_is_linear;
uniform float u_fog_start;
uniform float u_fog_end;
varying vec4 v_fog_eye_position;
// Main
void main(void) {
gl_FragColor = v_color;
// Texture
if (u_has_texture) {
gl_FragColor *= texture2D(u_texture_unit, v_texture_pos.xy);
}
// Alpha Test
if (u_alpha_test && gl_FragColor.a <= 0.1) {
discard;
}
// Fog
if (u_fog) {
float fog_factor;
if (u_fog_is_linear) {
fog_factor = (u_fog_end - length(v_fog_eye_position)) / (u_fog_end - u_fog_start);
} else {
fog_factor = exp(-u_fog_start * length(v_fog_eye_position));
}
gl_FragColor = mix(gl_FragColor, u_fog_color, 1.0 - clamp(fog_factor, 0.0, 1.0));
}
}

View File

@ -0,0 +1,22 @@
#version 100
precision mediump float;
// Matrices
uniform mat4 u_projection;
uniform mat4 u_model_view;
uniform mat4 u_texture;
// Texture
attribute vec3 a_vertex_coords;
attribute vec2 a_texture_coords;
varying vec4 v_texture_pos;
// Color
attribute vec4 a_color;
varying vec4 v_color;
// Fog
varying vec4 v_fog_eye_position;
// Main
void main(void) {
v_texture_pos = u_texture * vec4(a_texture_coords.xy, 0.0, 1.0);
gl_Position = u_projection * u_model_view * vec4(a_vertex_coords.xyz, 1.0);
v_color = a_color;
v_fog_eye_position = u_model_view * vec4(a_vertex_coords.xyz, 1.0);
}

View File

@ -308,6 +308,9 @@ void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *ic
// Extra Settings
glfwWindowHint(GLFW_AUTO_ICONIFY, GLFW_FALSE);
glfwWindowHint(GLFW_ALPHA_BITS, 0); // Fix Transparent Window On Wayland
// App ID
glfwWindowHintString(GLFW_X11_CLASS_NAME, MCPI_APP_ID);
glfwWindowHintString(GLFW_WAYLAND_APP_ID, MCPI_APP_ID);
// Create Window
glfw_window = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, title, NULL, NULL);

View File

@ -40,7 +40,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) unsigned char *item, Ite
if (tile == *(int32_t *) (*Tile_calmWater + Tile_id_property_offset)) {
new_auxiliary = *(int32_t *) (*Tile_water + Tile_id_property_offset);
} else if (tile == *(int32_t *) (*Tile_calmLava + Tile_id_property_offset)) {
new_auxiliary = *(int32_t *) (*Tile_water + Tile_id_property_offset);
new_auxiliary = *(int32_t *) (*Tile_lava + Tile_id_property_offset);
}
if (new_auxiliary != 0) {
// Valid
@ -108,6 +108,9 @@ static int32_t BucketItem_useOn(__attribute__((unused)) unsigned char *item, Ite
Material_isSolid_t Material_isSolid = *(Material_isSolid_t *) (material_vtable + Material_isSolid_vtable_offset);
valid = !(*Material_isSolid)(material);
}
if (item_instance->auxiliary != *(int32_t *) (*Tile_water + Tile_id_property_offset) && item_instance->auxiliary != *(int32_t *) (*Tile_lava + Tile_id_property_offset)) {
valid = false;
}
if (valid) {
(*Level_setTileAndData)(level, x, y, z, item_instance->auxiliary, 0);
item_instance->auxiliary = 0;

View File

@ -29,7 +29,7 @@ static void *chat_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_TITLE,
"--name", MCPI_APP_ID,
"--entry",
"--text", "Enter Chat Message:",
NULL

View File

@ -88,7 +88,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_TITLE,
"--name", MCPI_APP_ID,
"--entry",
"--text", "Enter World Name:",
"--entry-text", DEFAULT_WORLD_NAME,
@ -115,7 +115,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_TITLE,
"--name", MCPI_APP_ID,
"--list",
"--radiolist",
"--width", GAME_MODE_DIALOG_SIZE,
@ -148,7 +148,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", MCPI_APP_TITLE,
"--name", MCPI_APP_ID,
"--entry",
"--only-numerical",
"--text", "Enter Seed (Leave Blank For Random):",

View File

@ -11,20 +11,22 @@ build() {
cd "build/${MODE}-${ARCH}"
# Create Prefix
local prefix="$(cd ../../; pwd)/out/${MODE}-${ARCH}"
rm -rf "${prefix}"
mkdir -p "${prefix}"
if [ -z "${DESTDIR+x}" ]; then
export DESTDIR="$(cd ../../; pwd)/out/${MODE}-${ARCH}"
rm -rf "${DESTDIR}"
mkdir -p "${DESTDIR}"
fi
# Build ARM Components
cd arm
cmake --build .
DESTDIR="${prefix}" cmake --install .
cmake --install .
cd ../
# Build Native Components
cd native
cmake --build .
DESTDIR="${prefix}" cmake --install .
cmake --install .
cd ../
# Exit

View File

@ -30,8 +30,7 @@ run() {
# Host Dependencies Needed For Compile
queue_pkg \
libwayland-bin \
xxd
libwayland-bin
# Host Dependencies Needed For Running
queue_pkg \