|
diff --git a/launcher/src/run.sh b/launcher/src/run.sh |
|
index 9bc3d43..08cfe33 100755 |
|
--- a/launcher/src/run.sh |
|
+++ b/launcher/src/run.sh |
|
@@ -2,34 +2,50 @@ |
|
|
|
set -e |
|
|
|
-# Check Root |
|
-if [ ! "$(id -u)" = '0' ]; then |
|
- echo 'Must Run As Root' 1>&2 |
|
- exit 1 |
|
+# All Feature Flags |
|
+export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)" |
|
+ |
|
+# Print Feature Flags Option |
|
+if [ "$1" = "--print-features" ]; then |
|
+ echo "${AVAILABLE_FEATURES}" |
|
+ exit 0 |
|
fi |
|
|
|
-# Check |
|
-if ! id user > /dev/null 2>&1; then |
|
- # Create User Groups |
|
- if [ -z "${USER_GID+x}" ]; then |
|
- USER_GID='1000' |
|
- fi |
|
- groupadd --force --gid "${USER_GID}" user |
|
- |
|
- # Create User |
|
- if [ -z "${USER_UID+x}" ]; then |
|
- USER_UID='1000' |
|
- fi |
|
- useradd --shell /bin/sh --home-dir /home --no-create-home --uid "${USER_UID}" --gid "${USER_GID}" user |
|
- |
|
- # Add Other Groups |
|
- if [ ! -z "${USER_OTHER_GIDS+x}" ]; then |
|
- for gid in ${USER_OTHER_GIDS}; do |
|
- groupadd --force --gid "${gid}" "group-${gid}" |
|
- usermod -aG "${gid}" user |
|
- done |
|
- fi |
|
+# Export Important Variables |
|
+export ZENITY_CLASS='Minecraft - Pi edition' |
|
+ |
|
+# Ensure Features Are Selected |
|
+if [ -z "${MCPI_FEATURES+x}" ]; then |
|
+ MCPI_FEATURES="$(eval "zenity --class \"${ZENITY_CLASS}\" --list --checklist --width 400 --height 400 --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")" |
|
+fi |
|
+if [ -z "${MCPI_RENDER_DISTANCE+x}" ]; then |
|
+ MCPI_RENDER_DISTANCE="$(zenity --class "${ZENITY_CLASS}" --list --radiolist --width 400 --height 400 --text 'Minecraft Render Distance:' --column 'Selected' --column 'Name' FALSE 'Far' FALSE 'Normal' TRUE 'Short' FALSE 'Tiny')" |
|
+fi |
|
+if [ -z "${MCPI_USERNAME+x}" ]; then |
|
+ MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')" |
|
fi |
|
+export MCPI_FEATURES |
|
+export MCPI_RENDER_DISTANCE |
|
+export MCPI_USERNAME |
|
+export MCPI_MODE="native" |
|
|
|
-# Start |
|
-exec gosu user ./launcher |
|
\ No newline at end of file |
|
+# Prepare Environment |
|
+export USER_HOME="${HOME}" |
|
+export USER_UID="$(id -u)" |
|
+export USER_GID="$(id -g)" |
|
+get_gid() { |
|
+ echo "$(getent group "$1" | cut -d : -f 3)" |
|
+} |
|
+export USER_OTHER_GIDS="$(get_gid video) $(get_gid render)" |
|
+ |
|
+# Run |
|
+set +e |
|
+./launcher |
|
+RET=$? |
|
+set -e |
|
+ |
|
+# Handle Crash |
|
+if [ ${RET} -ne 0 ]; then |
|
+ zenity --class "${ZENITY_CLASS}" --error --no-wrap --text 'Minecraft: Pi Edition has crashed!\n\nExit Code: '${RET}'\n\n<a href="file:///tmp/minecraft-pi">Open Log Folder</a>\n<a href="https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/src/branch/master/docs/TROUBLESHOOTING.md">Open Troubleshooting Guide</a>' |
|
+ exit ${RET} |
|
+fi |
|
diff --git a/mods/CMakeLists.txt b/mods/CMakeLists.txt |
|
index 97ac219..f5f1d37 100644 |
|
--- a/mods/CMakeLists.txt |
|
+++ b/mods/CMakeLists.txt |
|
@@ -13,7 +13,7 @@ add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) |
|
add_subdirectory(../libreborn libreborn) |
|
|
|
# Find GLFW |
|
-find_package(glfw3 3.3 REQUIRED) |
|
+find_package(glfw3 3.2 REQUIRED) |
|
|
|
## Mods |
|
|
|
@@ -62,4 +62,4 @@ add_library(init SHARED src/init/init.c) |
|
target_link_libraries(init compat server game_mode camera input misc options textures chat test) |
|
|
|
## Install Mods |
|
-install(TARGETS init compat readdir feature screenshot override server game_mode camera input misc options textures chat test DESTINATION /mods) |
|
\ No newline at end of file |
|
+install(TARGETS init compat readdir feature screenshot override server game_mode camera input misc options textures chat test DESTINATION /mods) |
|
diff --git a/mods/src/compat/compat.c b/mods/src/compat/compat.c |
|
index d47d024..88e2056 100644 |
|
--- a/mods/src/compat/compat.c |
|
+++ b/mods/src/compat/compat.c |
|
@@ -333,7 +333,9 @@ HOOK(SDL_WM_GrabInput, SDL_GrabMode, (SDL_GrabMode mode)) { |
|
} else { |
|
if (mode != SDL_GRAB_QUERY && mode != SDL_WM_GrabInput(SDL_GRAB_QUERY)) { |
|
glfwSetInputMode(glfw_window, GLFW_CURSOR, mode == SDL_GRAB_OFF ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED); |
|
+#ifdef GLFW_RAW_MOUSE_MOTION |
|
glfwSetInputMode(glfw_window, GLFW_RAW_MOUSE_MOTION, mode == SDL_GRAB_OFF ? GLFW_FALSE : GLFW_TRUE); |
|
+#endif |
|
|
|
// GLFW Cursor Hiding is Broken |
|
Display *x11_display = glfwGetX11Display(); |
|
@@ -428,4 +430,4 @@ void init_compat() { |
|
is_server = mode == 2; |
|
// Video is Handled By GLFW Not SDL |
|
setenv("SDL_VIDEODRIVER", "dummy", 1); |
|
-} |
|
\ No newline at end of file |
|
+} |
|
diff --git a/mods/src/test/test.c b/mods/src/test/test.c |
|
index 04af386..56723ba 100644 |
|
--- a/mods/src/test/test.c |
|
+++ b/mods/src/test/test.c |
|
@@ -26,22 +26,22 @@ struct timespec32 { |
|
void run_tests() { |
|
// Test clock_gettime64 |
|
{ |
|
+#ifdef SYS_clock_gettime64 |
|
struct timespec64 ts64; |
|
long out = syscall(SYS_clock_gettime64, CLOCK_MONOTONIC, &ts64); |
|
if (out != 0) { |
|
- if (errno == ENOSYS) { |
|
- // clock_gettime64 Unsupported, Testing clock_gettime |
|
- struct timespec32 ts32; |
|
- out = syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts32); |
|
- if (out != 0) { |
|
- // Failure |
|
- ERR("Unable To Run clock_gettime Syscall: %s", strerror(errno)); |
|
- } |
|
- } else { |
|
- // Failure |
|
- ERR("Unable To Run clock_gettime64 Syscall: %s", strerror(errno)); |
|
- } |
|
+ // Failure |
|
+ ERR("Unable To Run clock_gettime64 Syscall: %s", strerror(errno)); |
|
} |
|
+#else |
|
+ struct timespec32 ts32; |
|
+ long out = syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &ts32); |
|
+ if (out != 0) { |
|
+ // Failure |
|
+ ERR("Unable To Run clock_gettime Syscall: %s", strerror(errno)); |
|
+ } |
|
+ |
|
+#endif |
|
} |
|
|
|
// Test ~/.minecraft-pi Permissions |
|
@@ -57,4 +57,4 @@ void run_tests() { |
|
ERR("%s", "Invalid ~/.minecraft-pi Permissions"); |
|
} |
|
} |
|
-} |
|
\ No newline at end of file |
|
+} |