Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
013b065f2c | ||
|
|
39f7e6441a | ||
|
|
6f7c8c3dd8 | ||
|
|
835154bde2 | ||
|
|
9b25557e6e | ||
|
|
b518d73417 | ||
|
|
3d575a50a7 | ||
|
|
75db65d43a | ||
|
|
17329a1b29 | ||
|
|
4db68a3f10 | ||
|
|
db03304cf1 | ||
|
|
9bf537ab35 | ||
|
|
87fd3f221a | ||
|
|
fa1ddbd839 | ||
|
|
93ab5a75c1 | ||
|
|
ca04106253 | ||
|
|
d5f8496abc | ||
|
|
95de01a8fb |
3
.github/workflows/apple.yml
vendored
3
.github/workflows/apple.yml
vendored
@@ -148,6 +148,9 @@ jobs:
|
||||
rm stk-assets-full.zip
|
||||
cd ../../../../..
|
||||
mv ./macosx-arm64/supertuxkart.app SuperTuxKart.app
|
||||
# Use Ad Hoc certificate for now, use Apple developer certificate after STK is on App Store later
|
||||
codesign --force -s - SuperTuxKart.app/Contents/libs/*.dylib
|
||||
codesign --force --deep -s - SuperTuxKart.app
|
||||
zip -r SuperTuxKart-${{ env.release_tag }}-mac.zip SuperTuxKart.app
|
||||
- name: Create release
|
||||
if: ${{ env.release_tag != '' }}
|
||||
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.4)
|
||||
|
||||
# root CMakeLists for the SuperTuxKart project
|
||||
project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "1.3")
|
||||
set(PROJECT_VERSION "git")
|
||||
|
||||
add_definitions( -DSUPERTUXKART_VERSION="${PROJECT_VERSION}" )
|
||||
|
||||
|
||||
@@ -98,6 +98,11 @@ LOCAL_MODULE := ifaddrs
|
||||
LOCAL_PATH := .
|
||||
LOCAL_SRC_FILES := ../lib/ifaddrs/ifaddrs.c
|
||||
LOCAL_CFLAGS := -I../lib/ifaddrs
|
||||
# Starting NDK21 it enables NEON by default on 32-bit ARM target
|
||||
# Disable it to support more phones
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -109,6 +114,9 @@ LOCAL_CPP_FEATURES += rtti exceptions
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/angelscript/source/*.S) \
|
||||
$(wildcard ../lib/angelscript/source/*.cpp)
|
||||
LOCAL_CFLAGS := -I../lib/angelscript/source/
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -119,6 +127,9 @@ LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/enet/*.c)
|
||||
LOCAL_CFLAGS := -I../lib/enet/include/ -DHAS_SOCKLEN_T -DENABLE_IPV6
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -130,6 +141,9 @@ LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/bullet/src/*/*.cpp) \
|
||||
$(wildcard ../lib/bullet/src/*/*/*.cpp)
|
||||
LOCAL_CFLAGS := -I../lib/bullet/src/
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -140,6 +154,9 @@ LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/graphics_utils/mipmap/*.c)
|
||||
LOCAL_CFLAGS := -I../lib/graphics_utils/mipmap
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -153,6 +170,9 @@ LOCAL_SRC_FILES := $(wildcard ../lib/graphics_engine/src/*.c) \
|
||||
LOCAL_CFLAGS := -I../lib/graphics_engine/include \
|
||||
-I../lib/sdl2/include/ \
|
||||
-I../lib/irrlicht/include/
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -163,6 +183,9 @@ LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/mcpp/*.c)
|
||||
LOCAL_CFLAGS := -DMCPP_LIB -DHAVE_CONFIG_H
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -173,6 +196,9 @@ LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/sheenbidi/Source/*.c)
|
||||
LOCAL_CFLAGS := -I../lib/sheenbidi/Headers
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -183,6 +209,9 @@ LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti exceptions
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/tinygettext/src/*.cpp)
|
||||
LOCAL_CFLAGS := -I../lib/tinygettext/include -DDISABLE_ICONV
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
@@ -204,18 +233,37 @@ LOCAL_CFLAGS := -I../lib/irrlicht/source/Irrlicht/ \
|
||||
-DANDROID_PACKAGE_CALLBACK_NAME=$(PACKAGE_CALLBACK_NAME)
|
||||
LOCAL_CPPFLAGS := -std=gnu++0x
|
||||
LOCAL_STATIC_LIBRARIES := libjpeg png zlib
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
# hidapi
|
||||
LOCAL_MODULE := libhidapi
|
||||
LOCAL_CPPFLAGS += -std=c++11
|
||||
LOCAL_SRC_FILES := ../lib/sdl2/src/hidapi/android/hid.cpp
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
# SDL2
|
||||
LOCAL_MODULE := SDL2
|
||||
LOCAL_PATH := .
|
||||
LOCAL_CPP_FEATURES += rtti
|
||||
LOCAL_SRC_FILES := $(wildcard ../lib/sdl2/src/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/audio/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/audio/android/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/audio/dummy/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/audio/aaudio/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/audio/openslES/*.c) \
|
||||
../lib/sdl2/src/atomic/SDL_atomic.c.arm \
|
||||
../lib/sdl2/src/atomic/SDL_spinlock.c.arm \
|
||||
$(wildcard ../lib/sdl2/src/core/android/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/cpuinfo/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/dynapi/*.c) \
|
||||
@@ -246,15 +294,16 @@ LOCAL_SRC_FILES := $(wildcard ../lib/sdl2/src/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/timer/unix/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/video/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/video/android/*.c) \
|
||||
$(wildcard ../lib/sdl2/src/video/yuv2rgb/*.c) \
|
||||
../lib/sdl2/src/atomic/SDL_atomic.c.arm \
|
||||
../lib/sdl2/src/atomic/SDL_spinlock.c.arm \
|
||||
../lib/sdl2/src/hidapi/android/hid.cpp
|
||||
$(wildcard ../lib/sdl2/src/video/yuv2rgb/*.c)
|
||||
LOCAL_CFLAGS := -I../lib/sdl2/include/ -DGL_GLEXT_PROTOTYPES
|
||||
LOCAL_CPPFLAGS := -std=gnu++0x
|
||||
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
|
||||
LOCAL_SHARED_LIBRARIES := hidapi
|
||||
LOCAL_STATIC_LIBRARIES := cpufeatures
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# STK
|
||||
@@ -264,7 +313,7 @@ LOCAL_CPP_FEATURES += rtti exceptions
|
||||
LOCAL_SRC_FILES := $(wildcard ../src/*.cpp) \
|
||||
$(wildcard ../src/*/*.cpp) \
|
||||
$(wildcard ../src/*/*/*.cpp)
|
||||
LOCAL_LDLIBS := -llog -landroid -lGLESv1_CM -lGLESv2 -lOpenSLES -ldl -lm
|
||||
LOCAL_LDLIBS := -llog -lm -lOpenSLES
|
||||
LOCAL_CFLAGS := -I../lib/angelscript/include \
|
||||
-I../lib/bullet/src \
|
||||
-I../lib/sheenbidi/Headers \
|
||||
@@ -295,7 +344,7 @@ LOCAL_CFLAGS := -I../lib/angelscript/include \
|
||||
-DANDROID_PACKAGE_NAME=\"$(PACKAGE_NAME)\" \
|
||||
-DANDROID_APP_DIR_NAME=\"$(APP_DIR_NAME)\" \
|
||||
-DSUPERTUXKART_VERSION=\"$(PROJECT_VERSION)\" \
|
||||
-DANDROID_PACKAGE_CALLBACK_NAME=$(PACKAGE_CALLBACK_NAME)
|
||||
-DANDROID_PACKAGE_CLASS_NAME=\"$(PACKAGE_CLASS_NAME)\"
|
||||
LOCAL_CPPFLAGS := -std=gnu++0x
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := irrlicht bullet enet ifaddrs angelscript mcpp SDL2 \
|
||||
@@ -304,6 +353,9 @@ LOCAL_STATIC_LIBRARIES := irrlicht bullet enet ifaddrs angelscript mcpp SDL2 \
|
||||
harfbuzz freetype tinygettext graphics_utils \
|
||||
graphics_engine
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
|
||||
LOCAL_ARM_NEON := false
|
||||
endif
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
include $(CLEAR_VARS)
|
||||
$(call import-module, android/cpufeatures)
|
||||
|
||||
@@ -25,19 +25,45 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
<!-- Let Android know that we can handle some USB devices and should receive this event -->
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
<uses-feature android:name="android.software.input_methods" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.usb.host" android:required="false" />
|
||||
|
||||
<!-- Touchscreen support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Game controller support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.gamepad"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="false" />
|
||||
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.type.pc"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- Allow writing to external storage -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- Allow access to Bluetooth devices -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<!-- Allow access to the vibrator -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
</manifest>
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
To run SuperTuxKart on Android, you need a device that meets following
|
||||
requirements:
|
||||
|
||||
- Android 4.4 or later
|
||||
- Android 4.1 or later
|
||||
- Processor compatible with armv7 or x86
|
||||
- GPU that supports OpenGL ES 3.0
|
||||
- GPU that supports OpenGL ES 2.0
|
||||
- 1 GB RAM (STK uses ~150 MB in minimal configuration)
|
||||
- 300 MB of free space on internal storage
|
||||
- Touch screen or external keyboard
|
||||
@@ -62,9 +62,10 @@ directory will have following structure:
|
||||
> src
|
||||
> ...
|
||||
|
||||
You need also Android SDK for android-19 platform (the API for Android 4.4) and
|
||||
Android NDK. Version r20 is recommended, because it's known that it works
|
||||
without issues.
|
||||
You also need Android SDK for android-26 platform or later (SDL2 requirement) and
|
||||
Android NDK. Version r22 is recommended, because it's known that it works
|
||||
without issues. r24 or later is not compatible because it removes Android 4.1
|
||||
support (https://github.com/android/ndk/wiki/Changelog-r23#announcements)
|
||||
|
||||
You need to create proper "android-sdk" and "android-ndk" symlinks in the
|
||||
directory with Android project, so that the compilation script will have access
|
||||
|
||||
@@ -19,7 +19,7 @@ export COMPILE_SDK_VERSION=29
|
||||
|
||||
export APP_NAME_RELEASE="SuperTuxKart"
|
||||
export PACKAGE_NAME_RELEASE="org.supertuxkart.stk"
|
||||
export PACKAGE_CALLBACK_NAME_RELEASE="org_supertuxkart_stk"
|
||||
export PACKAGE_CLASS_NAME_RELEASE="org/supertuxkart/stk"
|
||||
export APP_DIR_NAME_RELEASE="supertuxkart"
|
||||
export APP_ICON_RELEASE="$DIRNAME/icon.png"
|
||||
export APP_ICON_ADAPTIVE_BG_RELEASE="$DIRNAME/icon_adaptive_bg.png"
|
||||
@@ -27,7 +27,7 @@ export APP_ICON_ADAPTIVE_FG_RELEASE="$DIRNAME/icon_adaptive_fg.png"
|
||||
|
||||
export APP_NAME_BETA="SuperTuxKart Beta"
|
||||
export PACKAGE_NAME_BETA="org.supertuxkart.stk_beta"
|
||||
export PACKAGE_CALLBACK_NAME_BETA="org_supertuxkart_stk_1beta"
|
||||
export PACKAGE_CLASS_NAME_BETA="org/supertuxkart/stk_beta"
|
||||
export APP_DIR_NAME_BETA="supertuxkart-beta"
|
||||
export APP_ICON_BETA="$DIRNAME/icon-dbg.png"
|
||||
export APP_ICON_ADAPTIVE_BG_BETA="$DIRNAME/icon_adaptive_bg-dbg.png"
|
||||
@@ -35,7 +35,7 @@ export APP_ICON_ADAPTIVE_FG_BETA="$DIRNAME/icon_adaptive_fg-dbg.png"
|
||||
|
||||
export APP_NAME_DEBUG="SuperTuxKart Debug"
|
||||
export PACKAGE_NAME_DEBUG="org.supertuxkart.stk_dbg"
|
||||
export PACKAGE_CALLBACK_NAME_DEBUG="org_supertuxkart_stk_1dbg"
|
||||
export PACKAGE_CLASS_NAME_DEBUG="org/supertuxkart/stk_dbg"
|
||||
export APP_DIR_NAME_DEBUG="supertuxkart-dbg"
|
||||
export APP_ICON_DEBUG="$DIRNAME/icon-dbg.png"
|
||||
export APP_ICON_ADAPTIVE_BG_DEBUG="$DIRNAME/icon_adaptive_bg-dbg.png"
|
||||
@@ -89,7 +89,7 @@ if [ "$BUILD_TYPE" = "debug" ] || [ "$BUILD_TYPE" = "Debug" ]; then
|
||||
export IS_DEBUG_BUILD=1
|
||||
export APP_NAME="$APP_NAME_DEBUG"
|
||||
export PACKAGE_NAME="$PACKAGE_NAME_DEBUG"
|
||||
export PACKAGE_CALLBACK_NAME="$PACKAGE_CALLBACK_NAME_DEBUG"
|
||||
export PACKAGE_CLASS_NAME="$PACKAGE_CLASS_NAME_DEBUG"
|
||||
export APP_DIR_NAME="$APP_DIR_NAME_DEBUG"
|
||||
export APP_ICON="$APP_ICON_DEBUG"
|
||||
export APP_ICON_ADAPTIVE_BG="$APP_ICON_ADAPTIVE_BG_DEBUG"
|
||||
@@ -99,7 +99,7 @@ elif [ "$BUILD_TYPE" = "release" ] || [ "$BUILD_TYPE" = "Release" ]; then
|
||||
export IS_DEBUG_BUILD=0
|
||||
export APP_NAME="$APP_NAME_RELEASE"
|
||||
export PACKAGE_NAME="$PACKAGE_NAME_RELEASE"
|
||||
export PACKAGE_CALLBACK_NAME="$PACKAGE_CALLBACK_NAME_RELEASE"
|
||||
export PACKAGE_CLASS_NAME="$PACKAGE_CLASS_NAME_RELEASE"
|
||||
export APP_DIR_NAME="$APP_DIR_NAME_RELEASE"
|
||||
export APP_ICON="$APP_ICON_RELEASE"
|
||||
export APP_ICON_ADAPTIVE_BG="$APP_ICON_ADAPTIVE_BG_RELEASE"
|
||||
@@ -109,7 +109,7 @@ elif [ "$BUILD_TYPE" = "beta" ] || [ "$BUILD_TYPE" = "Beta" ]; then
|
||||
export IS_DEBUG_BUILD=0
|
||||
export APP_NAME="$APP_NAME_BETA"
|
||||
export PACKAGE_NAME="$PACKAGE_NAME_BETA"
|
||||
export PACKAGE_CALLBACK_NAME="$PACKAGE_CALLBACK_NAME_BETA"
|
||||
export PACKAGE_CLASS_NAME="$PACKAGE_CLASS_NAME_BETA"
|
||||
export APP_DIR_NAME="$APP_DIR_NAME_BETA"
|
||||
export APP_ICON="$APP_ICON_BETA"
|
||||
export APP_ICON_ADAPTIVE_BG="$APP_ICON_ADAPTIVE_BG_BETA"
|
||||
@@ -437,7 +437,7 @@ export ANDROID_HOME="$SDK_PATH"
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="20.1.5948944" \
|
||||
-Pndk_version="22.1.7171670" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
$GRADLE_BUILD_TYPE
|
||||
@@ -448,7 +448,7 @@ if [ "$GRADLE_BUILD_TYPE" = "assembleRelease" ]; then
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="20.1.5948944" \
|
||||
-Pndk_version="22.1.7171670" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
"bundleRelease"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Tested with NDK 20.1.5948944
|
||||
# Tested with NDK 22.1.7171670
|
||||
|
||||
export DIRNAME=$(realpath "$(dirname "$0")")
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.widget.TextView;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.Set;
|
||||
|
||||
import org.minidns.hla.DnssecResolverApi;
|
||||
@@ -70,6 +71,8 @@ public class SuperTuxKartActivity extends SDLActivity
|
||||
private float m_bottom_padding;
|
||||
private float m_left_padding;
|
||||
private float m_right_padding;
|
||||
private AtomicInteger m_keyboard_height;
|
||||
private AtomicInteger m_moved_height;
|
||||
// ------------------------------------------------------------------------
|
||||
public native static void debugMsg(String msg);
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -186,6 +189,8 @@ public class SuperTuxKartActivity extends SDLActivity
|
||||
public void onCreate(Bundle instance)
|
||||
{
|
||||
super.onCreate(instance);
|
||||
m_keyboard_height = new AtomicInteger();
|
||||
m_moved_height = new AtomicInteger();
|
||||
m_progress_dialog = null;
|
||||
m_progress_bar = null;
|
||||
m_splash_screen = null;
|
||||
@@ -204,12 +209,12 @@ public class SuperTuxKartActivity extends SDLActivity
|
||||
root.getWindowVisibleDisplayFrame(r);
|
||||
int screen_height = root.getRootView().getHeight();
|
||||
int keyboard_height = screen_height - (r.bottom);
|
||||
saveKeyboardHeight(keyboard_height);
|
||||
m_keyboard_height.set(keyboard_height);
|
||||
int moved_height = 0;
|
||||
int margin = screen_height - m_bottom_y;
|
||||
if (keyboard_height > margin)
|
||||
moved_height = -keyboard_height + margin;
|
||||
saveMovedHeight(-moved_height);
|
||||
m_moved_height.set(-moved_height);
|
||||
SDLActivity.moveView(moved_height);
|
||||
}
|
||||
});
|
||||
@@ -266,17 +271,29 @@ public class SuperTuxKartActivity extends SDLActivity
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
super.onStart();
|
||||
m_keyboard_height.set(0);
|
||||
m_moved_height.set(0);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
hideKeyboardNative(false/*clear_text*/);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/* STK statically link SDL2. */
|
||||
/* SDL manually dlopen main to allow unload after main thread exit. */
|
||||
protected String[] getLibraries()
|
||||
{
|
||||
return new String[]{ "main" };
|
||||
return new String[]{ "hidapi", "SDL2" };
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
protected String getMainSharedObject()
|
||||
{
|
||||
return getContext().getApplicationInfo().nativeLibraryDir + "/libmain.so";
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
public void showKeyboard(final int type, final int y)
|
||||
@@ -499,5 +516,9 @@ public class SuperTuxKartActivity extends SDLActivity
|
||||
{
|
||||
handlePadding(isInMultiWindowMode);
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
public int getKeyboardHeight() { return m_keyboard_height.get(); }
|
||||
// ------------------------------------------------------------------------
|
||||
public int getMovedHeight() { return m_moved_height.get(); }
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,13 @@ SET(CMAKE_CXX_COMPILER "${HOST}-clang++")
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${ARCH})
|
||||
|
||||
# Starting NDK21 it enables NEON by default on 32-bit ARM target
|
||||
# Disable it to support more devices
|
||||
if("${ARCH}" STREQUAL "arm")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfpv3-d16")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfpv3-d16")
|
||||
endif()
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH $ENV{NDK_TOOLCHAIN_PATH})
|
||||
|
||||
|
||||
1432
data/cacert.pem
1432
data/cacert.pem
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,6 @@
|
||||
<card os="android" disable="ColorBufferFloat"/>
|
||||
<card os="android" disable="TextureCompressionS3TC"/>
|
||||
<card contains="Adreno" os="android" version="<=19" disable="VertexIdWorking"/>
|
||||
<card os="android" version="<19" disable="SystemScreenKeyboard"/>
|
||||
<card contains="Android Emulator" os="android" disable="ForceLegacyDevice"/>
|
||||
<card contains="Android Emulator" os="android" disable="NpotTextures"/>
|
||||
<card contains="Apple Software Renderer" os="ios" disable="ForceLegacyDevice"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<div width="100%" height="58%" layout="vertical-row">
|
||||
<div width="100%" height="15%" align="center" layout="vertical-row" >
|
||||
<label id="name" width="100%" text_align="center"/>
|
||||
<header id="name" width="100%" text_align="center"/>
|
||||
</div>
|
||||
<!-- This is filled in programmatically -->
|
||||
<div width="100%" height="85%" layout="horizontal-row">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne Suzanne
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne Suzanne
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne Suzanne
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne Suzanne
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: tux ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: sara_the_wizard ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: xue ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: beastie ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: gavroche ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: beastie ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: sara_the_racer ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: emule ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: amanda ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: adiumy ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: tux ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: hexley ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: kiki ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: pidgin ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: suzanne ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: hexley ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: kiki ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: pidgin ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: puffy ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: konqi ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: nolok ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: wilber ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: tux ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
version: 4
|
||||
stk_version: 1.3
|
||||
stk_version: 0.10.0
|
||||
kart: gavroche ☆★STK★☆
|
||||
kart_color: 0.000000
|
||||
kart_list_end
|
||||
|
||||
@@ -18,17 +18,69 @@ using namespace irr;
|
||||
|
||||
// Call when android keyboard is opened or close, and save its height for
|
||||
// moving screen
|
||||
std::atomic<int> g_keyboard_height(0);
|
||||
std::atomic<int> g_moved_height(0);
|
||||
std::atomic<int> g_disable_padding(0);
|
||||
extern "C" int Android_getKeyboardHeight()
|
||||
{
|
||||
return g_keyboard_height.load();
|
||||
JNIEnv* env = NULL;
|
||||
jobject activity = NULL;
|
||||
jclass class_native_activity = NULL;
|
||||
jmethodID method = NULL;
|
||||
jint keyboard_height = 0;
|
||||
|
||||
env = (JNIEnv*)SDL_AndroidGetJNIEnv();
|
||||
if (!env)
|
||||
goto exit;
|
||||
|
||||
activity = (jobject)SDL_AndroidGetActivity();
|
||||
if (!activity)
|
||||
goto exit;
|
||||
|
||||
class_native_activity = env->GetObjectClass(activity);
|
||||
if (class_native_activity == NULL)
|
||||
goto exit;
|
||||
|
||||
method = env->GetMethodID(class_native_activity, "getKeyboardHeight", "()I");
|
||||
if (method == NULL)
|
||||
goto exit;
|
||||
keyboard_height = env->CallIntMethod(activity, method);
|
||||
exit:
|
||||
if (!env)
|
||||
return 0;
|
||||
env->DeleteLocalRef(class_native_activity);
|
||||
env->DeleteLocalRef(activity);
|
||||
return keyboard_height;
|
||||
}
|
||||
|
||||
extern "C" int Android_getMovedHeight()
|
||||
{
|
||||
return g_moved_height.load();
|
||||
JNIEnv* env = NULL;
|
||||
jobject activity = NULL;
|
||||
jclass class_native_activity = NULL;
|
||||
jmethodID method = NULL;
|
||||
jint moved_height = 0;
|
||||
|
||||
env = (JNIEnv*)SDL_AndroidGetJNIEnv();
|
||||
if (!env)
|
||||
goto exit;
|
||||
|
||||
activity = (jobject)SDL_AndroidGetActivity();
|
||||
if (!activity)
|
||||
goto exit;
|
||||
|
||||
class_native_activity = env->GetObjectClass(activity);
|
||||
if (class_native_activity == NULL)
|
||||
goto exit;
|
||||
|
||||
method = env->GetMethodID(class_native_activity, "getMovedHeight", "()I");
|
||||
if (method == NULL)
|
||||
goto exit;
|
||||
moved_height = env->CallIntMethod(activity, method);
|
||||
exit:
|
||||
if (!env)
|
||||
return 0;
|
||||
env->DeleteLocalRef(class_native_activity);
|
||||
env->DeleteLocalRef(activity);
|
||||
return moved_height;
|
||||
}
|
||||
|
||||
extern "C" int Android_disablePadding()
|
||||
@@ -36,11 +88,7 @@ extern "C" int Android_disablePadding()
|
||||
return g_disable_padding.load();
|
||||
}
|
||||
|
||||
#define MAKE_DEBUG_MSG_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_SuperTuxKartActivity_debugMsg(JNIEnv* env, jclass cls, jstring msg)
|
||||
#define ANDROID_DEBUG_MSG_CALLBACK(PKG_NAME) MAKE_DEBUG_MSG_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_DEBUG_MSG_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL debugMsg(JNIEnv* env, jclass cls, jstring msg)
|
||||
{
|
||||
if (msg == NULL)
|
||||
return;
|
||||
@@ -57,29 +105,7 @@ ANDROID_DEBUG_MSG_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
MessageQueue::add(MessageQueue::MT_GENERIC, message);
|
||||
}
|
||||
|
||||
#define MAKE_ANDROID_SAVE_KBD_HEIGHT_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_SuperTuxKartActivity_saveKeyboardHeight(JNIEnv* env, jclass cls, jint height)
|
||||
#define ANDROID_SAVE_KBD_HEIGHT_CALLBACK(PKG_NAME) MAKE_ANDROID_SAVE_KBD_HEIGHT_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_SAVE_KBD_HEIGHT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
{
|
||||
g_keyboard_height.store((int)height);
|
||||
}
|
||||
|
||||
#define MAKE_ANDROID_SAVE_MOVED_HEIGHT_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_SuperTuxKartActivity_saveMovedHeight(JNIEnv* env, jclass cls, jint height)
|
||||
#define ANDROID_SAVE_MOVED_HEIGHT_CALLBACK(PKG_NAME) MAKE_ANDROID_SAVE_MOVED_HEIGHT_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_SAVE_MOVED_HEIGHT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
{
|
||||
g_moved_height.store((int)height);
|
||||
}
|
||||
|
||||
#define MAKE_ANDROID_HANDLE_PADDING_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_SuperTuxKartActivity_handlePadding(JNIEnv* env, jclass cls, jboolean val)
|
||||
#define ANDROID_HANDLE_PADDING_CALLBACK(PKG_NAME) MAKE_ANDROID_HANDLE_PADDING_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_HANDLE_PADDING_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL handlePadding(JNIEnv* env, jclass cls, jboolean val)
|
||||
{
|
||||
g_disable_padding.store((int)val);
|
||||
}
|
||||
|
||||
@@ -672,6 +672,16 @@ bool CIrrDeviceSDL::run()
|
||||
case SDL_APP_DIDENTERFOREGROUND:
|
||||
resume_mainloop();
|
||||
break;
|
||||
#ifdef ANDROID
|
||||
// From https://github.com/libsdl-org/SDL/blob/main/docs/README-android.md
|
||||
// However, there's a chance (on older hardware, or on systems under heavy load),
|
||||
// where the GL context can not be restored. In that case you have to
|
||||
// listen for a specific message (SDL_RENDER_DEVICE_RESET) and restore
|
||||
// your textures manually or quit the app.
|
||||
case SDL_RENDER_DEVICE_RESET:
|
||||
Close = true;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
case SDL_SENSORUPDATE:
|
||||
|
||||
@@ -486,6 +486,9 @@ namespace UserConfigParams
|
||||
PARAM_PREFIX BoolUserConfigParam m_addon_tux_online
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "addon-tux-online",
|
||||
&m_race_setup_group, "Always show online addon karts as tux when live join is on.") );
|
||||
PARAM_PREFIX BoolUserConfigParam m_random_player_pos
|
||||
PARAM_DEFAULT( BoolUserConfigParam(false, "random-player-pos",
|
||||
&m_race_setup_group, "Randomize the position of the players at the start of a race. Doesn't apply to story mode.") );
|
||||
|
||||
// ---- Wiimote data
|
||||
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
|
||||
@@ -802,6 +805,10 @@ namespace UserConfigParams
|
||||
/** True if graphical profiler should be displayed */
|
||||
PARAM_PREFIX bool m_profiler_enabled PARAM_DEFAULT( false );
|
||||
|
||||
PARAM_PREFIX bool m_disable_addon_karts PARAM_DEFAULT( false );
|
||||
|
||||
PARAM_PREFIX bool m_disable_addon_tracks PARAM_DEFAULT( false );
|
||||
|
||||
// ---- Networking
|
||||
PARAM_PREFIX StringToUIntUserConfigParam m_server_bookmarks
|
||||
PARAM_DEFAULT(StringToUIntUserConfigParam("server-bookmarks",
|
||||
|
||||
@@ -262,15 +262,7 @@ EventPropagation TextBoxWidget::leftPressed (const int playerID)
|
||||
#ifdef ANDROID
|
||||
#include "jni.h"
|
||||
|
||||
#if !defined(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
#error
|
||||
#endif
|
||||
|
||||
#define MAKE_EDITTEXT_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_STKEditText_editText2STKEditbox(JNIEnv* env, jclass cls, jint widget_id, jstring text, jint start, jint end, jint composing_start, jint composing_end)
|
||||
#define ANDROID_EDITTEXT_CALLBACK(PKG_NAME) MAKE_EDITTEXT_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_EDITTEXT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL editText2STKEditbox(JNIEnv* env, jclass cls, jint widget_id, jstring text, jint start, jint end, jint composing_start, jint composing_end)
|
||||
{
|
||||
if (text == NULL)
|
||||
return;
|
||||
@@ -342,11 +334,7 @@ ANDROID_EDITTEXT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern void Android_toggleOnScreenKeyboard(bool show, int type, int y);
|
||||
extern bool Android_isHardwareKeyboardConnected();
|
||||
|
||||
#define MAKE_HANDLE_ACTION_NEXT_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_STKEditText_handleActionNext(JNIEnv* env, jclass cls, jint widget_id)
|
||||
#define ANDROID_HANDLE_ACTION_NEXT_CALLBACK(PKG_NAME) MAKE_HANDLE_ACTION_NEXT_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_HANDLE_ACTION_NEXT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL handleActionNext(JNIEnv* env, jclass cls, jint widget_id)
|
||||
{
|
||||
GUIEngine::addGUIFunctionBeforeRendering([widget_id]()
|
||||
{
|
||||
@@ -410,12 +398,7 @@ ANDROID_HANDLE_ACTION_NEXT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#define MAKE_HANDLE_LEFT_RIGHT_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_STKEditText_handleLeftRight(JNIEnv* env, jclass cls, jboolean left, jint widget_id)
|
||||
#define ANDROID_HANDLE_LEFT_RIGHT_CALLBACK(PKG_NAME) MAKE_HANDLE_LEFT_RIGHT_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_HANDLE_LEFT_RIGHT_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL handleLeftRight(JNIEnv* env, jclass cls, jboolean left, jint widget_id)
|
||||
{
|
||||
GUIEngine::addGUIFunctionBeforeRendering([left, widget_id]()
|
||||
{
|
||||
|
||||
@@ -1012,8 +1012,8 @@ void Kart::finishedRace(float time, bool from_server)
|
||||
if (RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
win_position = 2;
|
||||
|
||||
if (getPosition() == (int)win_position &&
|
||||
World::getWorld()->getNumKarts() > win_position)
|
||||
if ((getPosition() == (int)win_position &&
|
||||
World::getWorld()->getNumKarts() > win_position) || RaceManager::get()->getNumberOfKarts() == 1)
|
||||
won_the_race = true;
|
||||
|
||||
if (RaceManager::get()->hasTimeTarget() && m_finish_time > RaceManager::get()->getTimeTarget())
|
||||
|
||||
21
src/main.cpp
21
src/main.cpp
@@ -686,6 +686,8 @@ void cmdLineHelp()
|
||||
" texture filtering.\n"
|
||||
" --shadows=n Set resolution of shadows (0 to disable).\n"
|
||||
" --render-driver=n Render driver to use (gl or directx9).\n"
|
||||
" --disable-addon-karts Disable loading of addon karts.\n"
|
||||
" --disable-addon-tracks Disable loading of addon tracks.\n"
|
||||
" --dump-official-karts Dump official karts for current stk-assets.\n"
|
||||
" --apitrace This will disable buffer storage and\n"
|
||||
" writing gpu query strings to opengl, which\n"
|
||||
@@ -1000,6 +1002,11 @@ int handleCmdLinePreliminary()
|
||||
Log::info("main", "STK using random seed (%d)", n);
|
||||
}
|
||||
|
||||
if (CommandLine::has("--disable-addon-karts"))
|
||||
UserConfigParams::m_disable_addon_karts = true;
|
||||
if (CommandLine::has("--disable-addon-tracks"))
|
||||
UserConfigParams::m_disable_addon_tracks = true;
|
||||
|
||||
return 0;
|
||||
} // handleCmdLinePreliminary
|
||||
|
||||
@@ -1939,10 +1946,16 @@ void initRest()
|
||||
// The maximum texture size can not be set earlier, since
|
||||
// e.g. the background image needs to be loaded in high res.
|
||||
irr_driver->setMaxTextureSize();
|
||||
KartPropertiesManager::addKartSearchDir(
|
||||
file_manager->getAddonsFile("karts/"));
|
||||
track_manager->addTrackSearchDir(
|
||||
file_manager->getAddonsFile("tracks/"));
|
||||
if (!UserConfigParams::m_disable_addon_karts)
|
||||
{
|
||||
KartPropertiesManager::addKartSearchDir(
|
||||
file_manager->getAddonsFile("karts/"));
|
||||
}
|
||||
if (!UserConfigParams::m_disable_addon_tracks)
|
||||
{
|
||||
track_manager->addTrackSearchDir(
|
||||
file_manager->getAddonsFile("tracks/"));
|
||||
}
|
||||
|
||||
{
|
||||
XMLNode characteristicsNode(file_manager->getAsset("kart_characteristics.xml"));
|
||||
|
||||
@@ -23,25 +23,78 @@
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_system.h"
|
||||
#include <jni.h>
|
||||
std::string g_android_main_user_agent;
|
||||
|
||||
extern int android_main(int argc, char *argv[]);
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL debugMsg(JNIEnv* env, jclass cls, jstring msg);
|
||||
extern "C" JNIEXPORT void JNICALL handlePadding(JNIEnv* env, jclass cls, jboolean val);
|
||||
extern "C" JNIEXPORT void JNICALL addDNSSrvRecords(JNIEnv* env, jclass cls, jstring name, jint weight);
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL editText2STKEditbox(JNIEnv* env, jclass cls, jint widget_id, jstring text, jint start, jint end, jint composing_start, jint composing_end);
|
||||
extern "C" JNIEXPORT void JNICALL handleActionNext(JNIEnv* env, jclass cls, jint widget_id);
|
||||
extern "C" JNIEXPORT void JNICALL handleLeftRight(JNIEnv* env, jclass cls, jboolean left, jint widget_id);
|
||||
|
||||
#if !defined(ANDROID_PACKAGE_CLASS_NAME)
|
||||
#error
|
||||
#endif
|
||||
|
||||
void registering_natives()
|
||||
{
|
||||
JNINativeMethod stkactivity_tab[] =
|
||||
{
|
||||
{ "debugMsg", "(Ljava/lang/String;)V", (void*)&debugMsg },
|
||||
{ "handlePadding", "(Z)V", (void*)&handlePadding },
|
||||
{ "addDNSSrvRecords", "(Ljava/lang/String;I)V", (void*)&addDNSSrvRecords }
|
||||
};
|
||||
JNIEnv* env = (JNIEnv*)SDL_AndroidGetJNIEnv();
|
||||
assert(env);
|
||||
const char* stkactivity_class = ANDROID_PACKAGE_CLASS_NAME "/SuperTuxKartActivity";
|
||||
jclass clazz = env->FindClass(stkactivity_class);
|
||||
if (clazz == NULL)
|
||||
{
|
||||
Log::error("MainAndroid", "Failed to find class %s.",
|
||||
stkactivity_class);
|
||||
return;
|
||||
}
|
||||
if (env->RegisterNatives(
|
||||
clazz, stkactivity_tab, (int)SDL_arraysize(stkactivity_tab)) < 0)
|
||||
{
|
||||
Log::error("MainAndroid", "Failed to register methods of %s.",
|
||||
stkactivity_class);
|
||||
}
|
||||
|
||||
JNINativeMethod stkeditbox_tab[] =
|
||||
{
|
||||
{ "editText2STKEditbox", "(ILjava/lang/String;IIII)V", (void*)&editText2STKEditbox },
|
||||
{ "handleActionNext", "(I)V", (void*)&handleActionNext },
|
||||
{ "handleLeftRight", "(ZI)V", (void*)&handleLeftRight }
|
||||
};
|
||||
const char* stkeditbox_class = ANDROID_PACKAGE_CLASS_NAME "/STKEditText";
|
||||
clazz = env->FindClass(stkeditbox_class);
|
||||
if (clazz == NULL)
|
||||
{
|
||||
Log::error("MainAndroid", "Failed to find class %s.",
|
||||
stkeditbox_class);
|
||||
return;
|
||||
}
|
||||
if (env->RegisterNatives(
|
||||
clazz, stkeditbox_tab, (int)SDL_arraysize(stkeditbox_tab)) < 0)
|
||||
{
|
||||
Log::error("MainAndroid", "Failed to register methods of %s.",
|
||||
stkeditbox_class);
|
||||
}
|
||||
}
|
||||
|
||||
void override_default_params_for_mobile();
|
||||
extern "C" int SDL_main(int argc, char *argv[])
|
||||
{
|
||||
registering_natives();
|
||||
override_default_params_for_mobile();
|
||||
int result = android_main(argc, argv);
|
||||
// TODO: Irrlicht device is properly waiting for destroy event, but
|
||||
// some global variables are not initialized/cleared in functions and thus
|
||||
// its state is remembered when the window is restored. We will use exit
|
||||
// call to make sure that all variables are cleared until a proper fix will
|
||||
// be done.
|
||||
fflush(NULL);
|
||||
_exit(0);
|
||||
return 0;
|
||||
return android_main(argc, argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -69,12 +69,7 @@
|
||||
#include "SDL_system.h"
|
||||
|
||||
std::vector<std::pair<std::string, int> >* g_list = NULL;
|
||||
|
||||
#define MAKE_ADD_DNS_SRV_RECORD_CALLBACK(x) JNIEXPORT void JNICALL Java_ ## x##_SuperTuxKartActivity_addDNSSrvRecords(JNIEnv* env, jclass cls, jstring name, jint weight)
|
||||
#define ANDROID_ADD_DNS_SRV_RECORD_CALLBACK(PKG_NAME) MAKE_ADD_DNS_SRV_RECORD_CALLBACK(PKG_NAME)
|
||||
|
||||
extern "C"
|
||||
ANDROID_ADD_DNS_SRV_RECORD_CALLBACK(ANDROID_PACKAGE_CALLBACK_NAME)
|
||||
extern "C" JNIEXPORT void JNICALL addDNSSrvRecords(JNIEnv* env, jclass cls, jstring name, jint weight)
|
||||
{
|
||||
if (!g_list || name == NULL)
|
||||
return;
|
||||
|
||||
@@ -165,8 +165,8 @@ void Highscores::writeEntry(UTFWriter &writer)
|
||||
writer << " number-of-laps=\"" << m_number_of_laps << "\"\n";
|
||||
if (m_highscore_type == "HST_GRANDPRIX")
|
||||
{
|
||||
writer << " reverse-type=\"" << m_gp_reverse_type << "\"\n";
|
||||
writer << " minor-mode=\"" << m_gp_minor_mode << "\">\n";
|
||||
writer << " reverse-type =\"" << m_gp_reverse_type << "\"\n";
|
||||
writer << " minor-mode =\"" << m_gp_minor_mode << "\">\n";
|
||||
}
|
||||
else
|
||||
writer << " reverse =\"" << m_reverse << "\">\n";
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
@@ -550,15 +551,14 @@ void RaceManager::startNextRace()
|
||||
|
||||
m_num_finished_karts = 0;
|
||||
m_num_finished_players = 0;
|
||||
// In follow the leader mode do not change the first kart,
|
||||
// since it's always the leader.
|
||||
int offset = (m_minor_mode==MINOR_MODE_FOLLOW_LEADER) ? 1 : 0;
|
||||
|
||||
// if subsequent race, sort kart status structure
|
||||
// ==============================================
|
||||
if (m_track_number > 0)
|
||||
{
|
||||
// In follow the leader mode do not change the first kart,
|
||||
// since it's always the leader.
|
||||
int offset = (m_minor_mode==MINOR_MODE_FOLLOW_LEADER) ? 1 : 0;
|
||||
|
||||
// Keep players at the end if needed
|
||||
int player_last_offset = 0;
|
||||
if (UserConfigParams::m_gp_player_last)
|
||||
@@ -579,6 +579,23 @@ void RaceManager::startNextRace()
|
||||
m_kart_status.end() - player_last_offset);
|
||||
}
|
||||
} // not first race
|
||||
else
|
||||
{
|
||||
const bool random_pos_available = !NetworkConfig::get()->isNetworking() &&
|
||||
(RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_NORMAL_RACE
|
||||
|| RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL
|
||||
|| RaceManager::get()->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER);
|
||||
|
||||
if (UserConfigParams::m_random_player_pos)
|
||||
{
|
||||
if (random_pos_available)
|
||||
{
|
||||
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
|
||||
std::shuffle(m_kart_status.begin() + offset, m_kart_status.end(),
|
||||
std::default_random_engine(seed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set boosted AI status for AI karts
|
||||
int boosted_ai_count = std::min<int>((int)m_ai_kart_list.size(),
|
||||
|
||||
@@ -262,7 +262,8 @@ void AddonsPack::install(const std::string& name)
|
||||
Addon* addon = addons_manager->getAddon(Addon::createAddonId(name));
|
||||
if (addon)
|
||||
{
|
||||
if (addon->isInstalled())
|
||||
if (addon->isInstalled() &&
|
||||
addon->getRevision() == addon->getInstalledRevision())
|
||||
{
|
||||
if (nl)
|
||||
nl->addMoreServerInfo(L"Addon already installed");
|
||||
|
||||
@@ -64,16 +64,19 @@ HighScoreInfoDialog::HighScoreInfoDialog(Highscores* highscore, bool is_linear,
|
||||
|
||||
if (m_major_mode == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
m_gp = grand_prix_manager->getGrandPrix(m_hs->m_track);
|
||||
track = track_manager->getTrack(m_gp->getTrackId(0));
|
||||
track_name = m_gp->getName();
|
||||
m_gp = *grand_prix_manager->getGrandPrix(m_hs->m_track);
|
||||
m_gp.checkConsistency();
|
||||
track = track_manager->getTrack(m_gp.getTrackId(0));
|
||||
track_name = m_gp.getName();
|
||||
track_type_name = _("Grand Prix");
|
||||
m_minor_mode = (RaceManager::MinorRaceModeType)m_hs->m_gp_minor_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
track = track_manager->getTrack(m_hs->m_track);
|
||||
track_name = track->getName();
|
||||
track_type_name = _("Track");
|
||||
m_minor_mode = HighScoreSelection::getInstance()->getActiveMode();
|
||||
}
|
||||
|
||||
irr::video::ITexture* image = STKTexManager::getInstance()
|
||||
@@ -121,19 +124,17 @@ HighScoreInfoDialog::HighScoreInfoDialog(Highscores* highscore, bool is_linear,
|
||||
m_num_karts_label->setVisible(true);
|
||||
m_num_karts_label->setText(_("Number of karts: %d", m_hs->m_number_of_karts), true);
|
||||
|
||||
if (m_major_mode != RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
m_num_laps_label->setVisible(true);
|
||||
m_num_laps_label->setText(_("Laps: %d", m_hs->m_number_of_laps), true);
|
||||
}
|
||||
stringw is_reverse;
|
||||
if (m_major_mode == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
is_reverse = GrandPrixData::reverseTypeToString((GrandPrixData::GPReverseType)m_hs->m_gp_reverse_type);
|
||||
m_num_laps_label->setText(_("Game mode: %d", RaceManager::getNameOf(m_minor_mode)), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_reverse = m_hs->m_reverse ? _("Yes") : _("No");
|
||||
m_num_laps_label->setText(_("Laps: %d", m_hs->m_number_of_laps), true);
|
||||
|
||||
}
|
||||
m_reverse_label->setVisible(true);
|
||||
m_reverse_label->setText(_("Reverse: %s", is_reverse), true);
|
||||
@@ -147,9 +148,8 @@ HighScoreInfoDialog::HighScoreInfoDialog(Highscores* highscore, bool is_linear,
|
||||
|
||||
m_start_widget = getWidget<IconButtonWidget>("start");
|
||||
|
||||
// Disable starting a grand prix, as there is currently no way to tell the minor mode used
|
||||
if (m_major_mode == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
m_start_widget->setActive(false);
|
||||
m_start_widget->setActive(!PlayerManager::getCurrentPlayer()->isLocked(m_gp.getId()));
|
||||
else
|
||||
m_start_widget->setActive(!PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()));
|
||||
|
||||
@@ -244,13 +244,8 @@ GUIEngine::EventPropagation
|
||||
// Create player and associate player with device
|
||||
StateManager::get()->createActivePlayer(PlayerManager::getCurrentPlayer(), device);
|
||||
|
||||
RaceManager::get()->setMinorMode(HighScoreSelection::getInstance()->getActiveMode());
|
||||
|
||||
bool reverse = m_hs->m_reverse;
|
||||
std::string track_name = m_hs->m_track;
|
||||
int laps = m_hs->m_number_of_laps;
|
||||
|
||||
RaceManager::get()->setDifficulty((RaceManager::Difficulty) m_hs->m_difficulty);
|
||||
RaceManager::get()->setMinorMode(m_minor_mode);
|
||||
RaceManager::get()->setDifficulty((RaceManager::Difficulty)m_hs->m_difficulty);
|
||||
|
||||
RaceManager::get()->setNumKarts(m_hs->m_number_of_karts);
|
||||
RaceManager::get()->setNumPlayers(1);
|
||||
@@ -266,16 +261,30 @@ GUIEngine::EventPropagation
|
||||
// Disable accidentally unlocking of a challenge
|
||||
PlayerManager::getCurrentPlayer()->setCurrentChallenge("");
|
||||
|
||||
RaceManager::get()->setReverseTrack(reverse);
|
||||
|
||||
// ASSIGN should make sure that only input from assigned devices is read
|
||||
input_manager->getDeviceManager()->setAssignMode(ASSIGN);
|
||||
input_manager->getDeviceManager()
|
||||
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
|
||||
|
||||
bool reverse = m_hs->m_reverse;
|
||||
GrandPrixData::GPReverseType gp_reverse = (GrandPrixData::GPReverseType)m_hs->m_gp_reverse_type;
|
||||
std::string track_name = m_hs->m_track;
|
||||
int laps = m_hs->m_number_of_laps;
|
||||
RaceManager::MajorRaceModeType major_mode = m_major_mode;
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
RaceManager::get()->startSingleRace(track_name, laps, false);
|
||||
if (major_mode == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
GrandPrixData gp = *grand_prix_manager->getGrandPrix(track_name);
|
||||
gp.changeReverse(gp_reverse);
|
||||
RaceManager::get()->startGP(gp, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
RaceManager::get()->setReverseTrack(reverse);
|
||||
RaceManager::get()->startSingleRace(track_name, laps, false);
|
||||
}
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (selection == "remove")
|
||||
@@ -309,7 +318,7 @@ void HighScoreInfoDialog::onUpdate(float dt)
|
||||
m_curr_time += dt;
|
||||
int frame_after = (int)(m_curr_time / 1.5f);
|
||||
|
||||
const std::vector<std::string> tracks = m_gp->getTrackNames();
|
||||
const std::vector<std::string> tracks = m_gp.getTrackNames();
|
||||
if (frame_after >= (int)tracks.size())
|
||||
{
|
||||
frame_after = 0;
|
||||
|
||||
@@ -49,10 +49,11 @@ private:
|
||||
void updateHighscoreEntries();
|
||||
|
||||
RaceManager::MajorRaceModeType m_major_mode;
|
||||
RaceManager::MinorRaceModeType m_minor_mode;
|
||||
|
||||
float m_curr_time;
|
||||
|
||||
const GrandPrixData* m_gp;
|
||||
GrandPrixData m_gp;
|
||||
|
||||
public:
|
||||
HighScoreInfoDialog(Highscores* highscore, bool is_linear, RaceManager::MajorRaceModeType major_mode);
|
||||
|
||||
@@ -91,6 +91,7 @@ void RaceResultGUI::init()
|
||||
|
||||
m_timer = 0;
|
||||
|
||||
getWidget("operations")->setActive(false);
|
||||
getWidget("left")->setVisible(false);
|
||||
getWidget("middle")->setVisible(false);
|
||||
getWidget("right")->setVisible(false);
|
||||
@@ -243,6 +244,7 @@ void RaceResultGUI::enableAllButtons()
|
||||
GUIEngine::IconButtonWidget *middle = getWidget<GUIEngine::IconButtonWidget>("middle");
|
||||
GUIEngine::IconButtonWidget *right = getWidget<GUIEngine::IconButtonWidget>("right");
|
||||
GUIEngine::RibbonWidget *operations = getWidget<GUIEngine::RibbonWidget>("operations");
|
||||
operations->setActive(true);
|
||||
operations->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (RaceManager::get()->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
@@ -377,6 +379,7 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
GUIEngine::IconButtonWidget *left = getWidget<GUIEngine::IconButtonWidget>("left");
|
||||
left->setVisible(false);
|
||||
getWidget("operations")->setActive(false);
|
||||
m_all_row_infos = m_all_row_info_waiting;
|
||||
m_animation_state = RR_OLD_GP_RESULTS;
|
||||
m_timer = 0;
|
||||
@@ -1117,6 +1120,7 @@ void RaceResultGUI::unload()
|
||||
m_all_row_infos = prev_infos;
|
||||
GUIEngine::IconButtonWidget *left = getWidget<GUIEngine::IconButtonWidget>("left");
|
||||
GUIEngine::RibbonWidget *operations = getWidget<GUIEngine::RibbonWidget>("operations");
|
||||
operations->setActive(true);
|
||||
operations->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
left->setLabel(_("Continue"));
|
||||
left->setImage("gui/icons/green_check.png");
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace MiniGLM
|
||||
q.z() / length,
|
||||
q.w() / length
|
||||
}};
|
||||
std::array<float, 3> tmp_3;
|
||||
std::array<float, 3> tmp_3 = {};
|
||||
auto ret = std::max_element(tmp_2.begin(), tmp_2.end(),
|
||||
[](float a, float b) { return std::abs(a) < std::abs(b); });
|
||||
int extra_2_bit = int(std::distance(tmp_2.begin(), ret));
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
# STK for your own use, then use android/make.sh script instead.
|
||||
|
||||
export BUILD_TYPE=Beta
|
||||
export PROJECT_VERSION=git20210925
|
||||
export PROJECT_CODE=296
|
||||
export PROJECT_VERSION=git20211004
|
||||
export PROJECT_CODE=299
|
||||
export STK_STOREPASS="xxx"
|
||||
export STK_KEYSTORE="/path/to/stk.keystore"
|
||||
export STK_ALIAS="alias"
|
||||
@@ -169,6 +169,7 @@ fi
|
||||
|
||||
cd ./android
|
||||
./make_deps.sh
|
||||
check_error
|
||||
./make.sh
|
||||
cd -
|
||||
|
||||
|
||||
Reference in New Issue
Block a user