From 17d53be3ef9d376e48a7f9e90cf6c87cf8fbf8f5 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 25 Oct 2019 11:06:30 +0200 Subject: [PATCH 1/3] Fix mouse events conversion The conversion from SDL mouse state to Android mouse state used wrong constants as mask. Fixes --- app/src/event_converter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/event_converter.c b/app/src/event_converter.c index da4b2e30..700e5c50 100644 --- a/app/src/event_converter.c +++ b/app/src/event_converter.c @@ -149,10 +149,10 @@ convert_mouse_buttons(uint32_t state) { if (state & SDL_BUTTON_MMASK) { buttons |= AMOTION_EVENT_BUTTON_TERTIARY; } - if (state & SDL_BUTTON_X1) { + if (state & SDL_BUTTON_X1MASK) { buttons |= AMOTION_EVENT_BUTTON_BACK; } - if (state & SDL_BUTTON_X2) { + if (state & SDL_BUTTON_X2MASK) { buttons |= AMOTION_EVENT_BUTTON_FORWARD; } return buttons; From d841718956d2dbd9f2bface70d971c4e0bec545c Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 29 Oct 2019 18:46:35 +0100 Subject: [PATCH 2/3] Add a script to build the server without gradle Gradle versions may sometimes cause problems. This script offers an alternative. --- server/build_without_gradle.sh | 62 ++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 server/build_without_gradle.sh diff --git a/server/build_without_gradle.sh b/server/build_without_gradle.sh new file mode 100755 index 00000000..5f2eff22 --- /dev/null +++ b/server/build_without_gradle.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# +# This script generates the scrcpy binary "manually" (without gradle). +# +# Adapt Android platform and build tools versions (via ANDROID_PLATFORM and +# ANDROID_BUILD_TOOLS environment variables). +# +# Then execute: +# +# BUILD_DIR=my_build_dir ./build_without_gradle.sh + +set -e + +PLATFORM=${ANDROID_PLATFORM:-29} +BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-29.0.2} + +BUILD_DIR="$(realpath ${BUILD_DIR:-build_manual})" +CLASSES_DIR="$BUILD_DIR/classes" +SERVER_DIR=$(dirname "$0") +SERVER_BINARY=scrcpy-server.jar + +echo "Platform: android-$PLATFORM" +echo "Build-tools: $BUILD_TOOLS" +echo "Build dir: $BUILD_DIR" + +rm -rf "$CLASSES_DIR" "$BUILD_DIR/$SERVER_BINARY" classes.dex +mkdir -p "$CLASSES_DIR/com/genymobile/scrcpy" + +<< EOF cat > "$CLASSES_DIR/com/genymobile/scrcpy/BuildConfig.java" +package com.genymobile.scrcpy; + +public final class BuildConfig { + public static final boolean DEBUG = false; +} +EOF + +echo "Generating java from aidl..." +cd "$SERVER_DIR/src/main/aidl" +"$ANDROID_HOME/build-tools/$BUILD_TOOLS/aidl" -o "$CLASSES_DIR" \ + android/view/IRotationWatcher.aidl + +echo "Compiling java sources..." +cd ../java +javac -bootclasspath "$ANDROID_HOME/platforms/android-$PLATFORM/android.jar" \ + -cp "$CLASSES_DIR" -d "$CLASSES_DIR" -source 1.8 -target 1.8 \ + com/genymobile/scrcpy/*.java \ + com/genymobile/scrcpy/wrappers/*.java + +echo "Dexing..." +cd "$CLASSES_DIR" +"$ANDROID_HOME/build-tools/$BUILD_TOOLS/dx" --dex \ + --output "$BUILD_DIR/classes.dex" \ + android/view/*.class \ + com/genymobile/scrcpy/*.class \ + com/genymobile/scrcpy/wrappers/*.class + +echo "Archiving..." +cd "$BUILD_DIR" +jar cvf "$SERVER_BINARY" classes.dex +rm -rf classes.dex classes + +echo "Server generated in $BUILD_DIR/scrcpy-server.jar" From 1380f6e00f9e091f099d4d5184215dfa29b076ec Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 30 Oct 2019 21:55:12 +0100 Subject: [PATCH 3/3] Fix help for --record-format Record format requires a parameter. --- app/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main.c b/app/src/main.c index c00bf419..41383ed9 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -59,7 +59,7 @@ static void usage(const char *arg0) { " -f, --fullscreen\n" " Start in fullscreen.\n" "\n" - " -F, --record-format\n" + " -F, --record-format format\n" " Force recording format (either mp4 or mkv).\n" "\n" " -h, --help\n"