10 Commits

Author SHA1 Message Date
24205dc948 Bump to version 13.4 2023-08-24 00:14:05 +01:00
13c29b3ed2 fix: move configuration button to bottom
Bump ndk and gradle
2023-08-23 23:45:30 +01:00
f5d3dec88d Bump ndk version
Upgrade gradle wrapper
Fix trailing whitespace in AppSettings
2023-04-17 14:00:03 +01:00
767969b04d bump revisions 2023-04-10 00:41:41 +01:00
b84940de47 fix: Restore cloud saves 2023-04-10 00:40:58 +01:00
a26ff60b8f Don't repeat assets downloads 2023-04-03 20:35:54 +01:00
9439ee7927 Add padding to startup button
Otherwise google games popup will prevent you from clicking it
2023-04-03 20:34:36 +01:00
eeb1b54cd5 Bump submodule openttd 2023-04-03 16:11:25 +01:00
bcdfccc28e Bump to version 13.0 2023-04-03 15:13:33 +01:00
6a67ec9197 feat: Allow multiple full app names 2023-04-03 14:14:17 +01:00
16 changed files with 317 additions and 186 deletions

2
.gitmodules vendored
View File

@@ -6,7 +6,7 @@
[submodule "project/jni/application/openttd/src"]
path = project/jni/application/openttd/src
url = https://github.com/n-ice-community/openttd-android.git
branch = 12
branch = 13
[submodule "project/jni/sdl2"]
path = project/jni/sdl2
url = https://github.com/libsdl-org/SDL.git

View File

@@ -10,13 +10,15 @@ sign_apk=false
sign_bundle=false
build_release=true
do_zipalign=true
named_variant="sdl"
base_app_name=""
# Fix Gradle compilation error
if [ -z "$ANDROID_NDK_HOME" ]; then
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
fi
while getopts "sirqbhz" OPT
while getopts "sirqbhzv:" OPT
do
case $OPT in
s) sign_apk=true;;
@@ -25,6 +27,7 @@ do
q) echo "Quick rebuild does not work anymore with Gradle!";;
b) sign_bundle=true;;
z) do_zipalign=false;;
v) named_variant=${OPTARG};;
h)
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
echo " -s: sign .apk file after building"
@@ -32,6 +35,7 @@ do
echo " -i: install APK file to device after building"
echo " -r: run APK file on device after building"
echo " -z: skip zipalign and apksigner"
echo " -v <v>: choose variant, either sdl or fdroid"
echo " debug: build debug package"
echo " release: build release package (default)"
echo " app-name: directory under project/jni/application to be compiled"
@@ -72,8 +76,19 @@ if [ "$#" -gt 0 ]; then
shift
fi
if [ ! -e project/local.properties ] || \
! grep -q "package $(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg);" project/src/Globals.java || \
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
function project_needs_setup {
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)
if [ -z "${base_app_name}" ]; then
echo "Could not determine App base name";
exit 2
fi
[ ! -e project/local.properties ] || \
! grep -q "package ${app_name};" project/src/Globals.java || \
! grep -q "package ${base_app_name}${named_variant};" project/src/Globals.java || \
[ "$(readlink AndroidAppSettings.cfg)" -nt "project/src/Globals.java" ] || \
[ -n "$(find project/java/* \
project/javaSDL2/* \
@@ -82,9 +97,12 @@ if [ ! -e project/local.properties ] || \
-cnewer \
project/src/Globals.java \
)" \
];
]
}
if project_needs_setup;
then
./changeAppSettings.sh -a
APP_FULL_NAME="${base_app_name}${named_variant}" ./changeAppSettings.sh -a
sleep 1
touch project/src/Globals.java
fi

View File

@@ -49,6 +49,12 @@ source ./AndroidAppSettings.cfg
var=""
if [ -n "${APP_FULL_NAME}" ]; then
echo ${APP_FULL_NAME}
AppFullName="${APP_FULL_NAME}"
CHANGED=1
fi
if [ "$CompatibilityHacks" = y ]; then
SwVideoMode=y
fi
@@ -164,7 +170,7 @@ AppVersionCode=$AppVersionCode
# Application user-visible version name (string)
AppVersionName="$AppVersionName"
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
@@ -172,14 +178,6 @@ AppVersionName="$AppVersionName"
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for the obb file
# You can mount expansion files created with jobb tool if you put 'mnt:main.12345' or 'mnt:patch.12345'
# The mount directory will be returned by calling getenv("ANDROID_OBB_MOUNT_DIR")
# Android app bundles do not support .obb files, they use asset packs instead.
# This app project includes one pre-configured install-time asset pack.
# To put your data into asset pack, copy it to the directory AndroidData/assetpack
# and run changeAppSettings.sh. The asset pack zip archive will be returned by
# getenv("ANDROID_ASSET_PACK_PATH"), this call will return NULL if the asset pack is not installed.
# You can put "assetpack" keyword to AppDataDownloadUrl, the code will check
# if the asset pack is installed and will not download the data from other URLs.
# You can extract files from the asset pack the same way you extract files from the app assets.
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
AppDataDownloadUrl="$AppDataDownloadUrl"
@@ -191,7 +189,7 @@ ResetSdlConfigForThisVersion=$ResetSdlConfigForThisVersion
DeleteFilesOnUpgrade="$DeleteFilesOnUpgrade"
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
# Text in English, use \\\\\\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText='$ReadmeText' | sed 's/\\\\n/\\\\\\\\n/g'
# libSDL version to use (1.2/2)
@@ -231,7 +229,7 @@ SdlVideoResize=$SdlVideoResize
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
SdlVideoResizeKeepAspect=$SdlVideoResizeKeepAspect
Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
InhibitSuspend=$InhibitSuspend
# Create Android service, so the app is less likely to be killed while in background
@@ -410,17 +408,18 @@ RedefinedKeysThirdGamepad="$RedefinedKeysThirdGamepad"
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
RedefinedKeysFourthGamepad="$RedefinedKeysFourthGamepad"
"# How long to show startup menu button, in msec, 0 to disable startup menu
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=$StartupMenuButtonTimeout
# Menu items to hide from startup menu, available menu items (SDL 1.2 only):
# $MenuOptionsAvailable
# ${MenuOptionsAvailable%%[[:space:]]}
HiddenMenuOptions='$HiddenMenuOptions'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# $FirstStartMenuOptionsDefault
# Available menu items:
# $MenuOptionsAvailable
# ${MenuOptionsAvailable%%[[:space:]]}
FirstStartMenuOptions='$FirstStartMenuOptions'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
@@ -441,7 +440,8 @@ MultiABI='$MultiABI'
# Optional shared libraries to compile - removing some of them will save space
# MP3 patents are expired, but libmad license is GPL, not LGPL
rep 'Available' project/jni/SettingsTemplate.mk
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
# rep 'Available' project/jni/SettingsTemplate.mk
CompiledLibraries="$CompiledLibraries"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)

View File

@@ -4,7 +4,7 @@ plugins {
android {
compileSdk 31
ndkVersion "23.1.7779620"
ndkVersion "25.2.9519653"
defaultConfig {
applicationId "net.olofson.ballfield"
@@ -35,5 +35,6 @@ android {
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation 'com.google.android.gms:play-services-games:21.0.0' // ==GOOGLEPLAYGAMESERVICES==
}

Binary file not shown.

View File

@@ -1,6 +1,8 @@
#Sat Nov 27 22:44:43 EET 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

293
project/gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,67 +17,98 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +118,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

15
project/gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -13,7 +13,7 @@ freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
@@ -40,6 +40,9 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Guideline;
import androidx.constraintlayout.widget.ConstraintSet;
import android.graphics.drawable.Drawable;
import android.graphics.Color;
import android.content.res.Configuration;
@@ -123,11 +126,14 @@ public class MainActivity extends Activity
DimSystemStatusBar.dim(null, getWindow());
Log.i("SDL", "libSDL: Creating startup screen");
_layout = new LinearLayout(this);
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
Display display = getWindowManager().getDefaultDisplay();
int height = display.getHeight();
_layout = new ConstraintLayout(this);
_layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
_layout2 = new LinearLayout(this);
_layout2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
_layout2.setId(View.generateViewId());
_layout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0));
loadingDialog = new ProgressDialog(this);
loadingDialog.setMessage(getString(R.string.accessing_network));
@@ -137,7 +143,7 @@ public class MainActivity extends Activity
{
_btn = new Button(this);
_btn.setEnabled(false);
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
_btn.setText(getResources().getString(R.string.device_change_cfg));
class onClickListener implements View.OnClickListener
{
@@ -157,7 +163,6 @@ public class MainActivity extends Activity
_layout2.addView(_btn);
}
_layout.addView(_layout2);
ImageView img = new ImageView(this);
@@ -170,9 +175,23 @@ public class MainActivity extends Activity
{
img.setImageResource(R.drawable.publisherlogo);
}
img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
img.setId(View.generateViewId());
img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0));
_layout.addView(img);
_layout.addView(_layout2);
ConstraintSet set = new ConstraintSet();
set.clone(_layout);
int[] chainIds = { img.getId(), _layout2.getId() }; // the ids you set on your views above
float[] weights = { 8, 2 };
set.createVerticalChain(ConstraintSet.PARENT_ID, ConstraintSet.TOP,
ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM,
chainIds, weights, ConstraintSet.CHAIN_SPREAD);
set.applyTo(_layout);
_videoLayout = new FrameLayout(this);
_videoLayout.addView(_layout);
@@ -182,7 +201,7 @@ public class MainActivity extends Activity
_videoLayout.addView(_ad.getView());
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT));
}
setContentView(_videoLayout);
_videoLayout.setFocusable(true);
_videoLayout.setFocusableInTouchMode(true);
@@ -302,7 +321,7 @@ public class MainActivity extends Activity
}
catch(Exception e) {}
}
public void setUpStatusLabel()
{
MainActivity Parent = this; // Too lazy to rename
@@ -400,7 +419,7 @@ public class MainActivity extends Activity
if(sdlInited)
return;
Log.i("SDL", "libSDL: Initializing video and SDL application");
sdlInited = true;
DimSystemStatusBar.dim(_videoLayout, getWindow());
_videoLayout.removeView(_layout);
@@ -617,7 +636,7 @@ public class MainActivity extends Activity
onResume();
}
}
public boolean isPaused()
{
return _isPaused;
@@ -1034,7 +1053,7 @@ public class MainActivity extends Activity
public void setAdvertisementPosition(int x, int y)
{
if( _ad.getView() != null )
{
final FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
@@ -1159,7 +1178,7 @@ public class MainActivity extends Activity
super.onNewIntent(i);
setIntent(i);
}
public void LoadLibraries()
{
try
@@ -1284,7 +1303,7 @@ public class MainActivity extends Activity
libDir.mkdirs();
}
catch( SecurityException ee ) { };
byte[] buf = new byte[16384];
while(true)
{
@@ -1520,7 +1539,7 @@ public class MainActivity extends Activity
private TextView _tv = null;
private Button _btn = null;
private LinearLayout _layout = null;
private ConstraintLayout _layout = null;
private LinearLayout _layout2 = null;
private Advertisement _ad = null;
public CloudSave cloudSave = null;

View File

@@ -264,7 +264,6 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
builder.addScope(Drive.SCOPE_APPFOLDER);
builder.addApi(Drive.API);
}
mGoogleApiClientBuilder = builder;

View File

@@ -2,5 +2,6 @@
/staging-openttd-build-*
/AndroidData/*.xz
/data
/data-plat-indp
/openttd-pc
/build-tools

View File

@@ -4,15 +4,15 @@
AppName="OpenTTD"
# Specify reversed site name of application (e.x. com.mysite.myapp)
AppFullName=org.openttd.fdroid
AppFullName=org.openttd.sdl
# Application version code (integer)
AppVersionCode=1220112
AppVersionCode=1340120
# Application user-visible version name (string)
AppVersionName="12.2.rev112"
AppVersionName="13.4.rev120"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
@@ -22,7 +22,7 @@ AppVersionName="12.2.rev112"
# The mount directory will be returned by calling getenv("ANDROID_OBB_MOUNT_DIR")
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
AppDataDownloadUrl="!!Data files|openttd-data-12.2-0.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!!!!MIDI music support|timidity.zip.xz^!!Internationalization files|icudt62l.zip.xz^!!Fonts|openttd-fonts.zip.xz"
AppDataDownloadUrl="!!Data files|openttd-data-13.4-0.zip.xz^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!!!!MIDI music support|timidity.zip.xz^!!Internationalization files|icudt62l.zip.xz^!!Fonts|openttd-fonts.zip.xz"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=y
@@ -32,9 +32,9 @@ DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag ai/regression ai/stationlis
# Here you may type readme text, which will be shown during startup. Format is:
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
ReadmeText=''
ReadmeText='' | sed 's/\\n/\\\\n/g'
# libSDL version to use (1.2/1.3/2.0)
# libSDL version to use (1.2/2)
LibSdlVersion=1.2
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
@@ -215,9 +215,11 @@ RedefinedKeys="LALT RETURN NO_REMAP NO_REMAP SPACE DELETE"
# Number of virtual keyboard keys - currently 12 keys is the maximum
AppTouchscreenKeyboardKeysAmount=0
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) + 6 additional keyboard keys
# Multitouch gestures should be moved to a separate variable, but are left here for compatibility
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2"
# Define SDL keysyms for multitouch gestures - pinch-zoom in, pinch-zoom out, rotate left, rotate right
RedefinedKeysScreenGestures="MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2 "
# Redefine on-screen keyboard keys to SDL keysyms - currently 12 keys is the maximum
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE "
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
RedefinedKeysScreenKbNames="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2"
@@ -251,7 +253,7 @@ RedefinedKeysFourthGamepad=""
# How long to show startup menu button, in msec, 0 to disable startup menu
StartupMenuButtonTimeout=1500
# Menu items to hide from startup menu, available menu items:
# Menu items to hide from startup menu, available menu items (SDL 1.2 only):
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
HiddenMenuOptions='SettingsMenuMouse.DisplaySizeConfig'
@@ -276,11 +278,11 @@ APP_PLATFORM=21
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
MultiABI='arm64-v8a armeabi-v7a x86 x86_64'
#MultiABI='arm64-v8a'
# Optional shared libraries to compile - removing some of them will save space
# MP3 patents are expired, but libmad license is GPL, not LGPL
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
# rep 'Available' project/jni/SettingsTemplate.mk
CompiledLibraries="c++_shared timidity expat fontconfig lzma lzo2 icui18n iculx icu-le-hb harfbuzz icudata icuuc"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
@@ -325,4 +327,3 @@ GooglePlayGameServicesId=942284197278
# The app will open files with following extension, file path will be added to commandline params
AppOpenFileExtension=''

View File

@@ -10,3 +10,4 @@ if [ ! -e build-tools/Makefile ]; then
fi
make -C build-tools -j8 VERBOSE=1 || exit 1
./download-data.sh

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
GFX_VERSION=7.1
SFX_VERSION=1.0.3
MSX_VERSION=0.4.2
ANDROID_DATA_FULLPATH=$(realpath ./AndroidData/)
GFX_VERSION=$(curl --fail https://cdn.openttd.org/opengfx-releases/latest.yaml | grep -Po "version: \K[0-9.]+")
SFX_VERSION=$(curl --fail https://cdn.openttd.org/opensfx-releases/latest.yaml | grep -Po "version: \K[0-9.]+")
MSX_VERSION=$(curl --fail https://cdn.openttd.org/openmsx-releases/latest.yaml | grep -Po "version: \K[0-9.]+")
# Base game data
pushd ./data-plat-indp
if ! [ -e "./opengfx-${GFX_VERSION}.tar" ]; then
curl --fail https://cdn.openttd.org/opengfx-releases/${GFX_VERSION}/opengfx-${GFX_VERSION}-all.zip | jar xv
fi
if ! [ -e "./opensfx-${SFX_VERSION}.tar" ]; then
curl --fail https://cdn.openttd.org/opensfx-releases/${SFX_VERSION}/opensfx-${SFX_VERSION}-all.zip | jar xv
fi
if ! [ -d "./openmsx-${MSX_VERSION}/" ]; then
curl --fail https://cdn.openttd.org/openmsx-releases/${MSX_VERSION}/openmsx-${MSX_VERSION}-all.zip | jar xv
tar xvf ./openmsx-${MSX_VERSION}.tar && rm ./openmsx-${MSX_VERSION}.tar
fi

View File

@@ -2,10 +2,7 @@
set -e
VER=12.2-0
GFX_VERSION=7.1
SFX_VERSION=1.0.3
MSX_VERSION=0.4.2
VER=13.4-0
ARCH=$1
ANDROID_DATA_FULLPATH=$(realpath ./AndroidData/)
@@ -14,10 +11,9 @@ pushd ./data
rm -f ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip.xz ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip
pushd ./baseset
curl --fail https://cdn.openttd.org/opengfx-releases/${GFX_VERSION}/opengfx-${GFX_VERSION}-all.zip | jar xv
curl --fail https://cdn.openttd.org/opensfx-releases/${SFX_VERSION}/opensfx-${SFX_VERSION}-all.zip | jar xv
curl --fail https://cdn.openttd.org/openmsx-releases/${MSX_VERSION}/openmsx-${MSX_VERSION}-all.zip | jar xv
tar xvf ./openmsx-${MSX_VERSION}.tar && rm ./openmsx-${MSX_VERSION}.tar
cp ../../data-plat-indp/opengfx*.tar .
cp ../../data-plat-indp/opensfx*.tar .
cp -r ../../data-plat-indp/openmsx*/ .
popd
zip -0 -r ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip ./ && xz -8 ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip