5 Commits

Author SHA1 Message Date
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
9 changed files with 98 additions and 51 deletions

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,7 +408,7 @@ 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):
@@ -441,7 +439,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

@@ -123,6 +123,8 @@ public class MainActivity extends Activity
DimSystemStatusBar.dim(null, getWindow());
Log.i("SDL", "libSDL: Creating startup screen");
Display display = getWindowManager().getDefaultDisplay();
int height = display.getHeight();
_layout = new LinearLayout(this);
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
@@ -139,6 +141,8 @@ public class MainActivity extends Activity
_btn.setEnabled(false);
_btn.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
_btn.setText(getResources().getString(R.string.device_change_cfg));
/* Add padding so play service popup doesnt block button */
_btn.setPadding(0, (int)(height * 0.1), 0, (int)(height * 0.1));
class onClickListener implements View.OnClickListener
{
public MainActivity p;

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=1300113
# Application user-visible version name (string)
AppVersionName="12.2.rev112"
AppVersionName="13.0.rev113"
# 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.0-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.0-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