Commit 24390b82 authored by kenan's avatar kenan

适配arm64,根据abi分包

parent cd618ca4
......@@ -32,21 +32,31 @@
#include <sys/epoll.h>
#include <unistd.h>
//http://androidxref.com/9.0.0_r3/xref/bionic/libc/bionic/sys_epoll.cpp
int
epoll_create(int size)
{
return (syscall(__NR_epoll_create, size));
#ifdef __LP64__
return (int)(syscall(__NR_epoll_create1, size));
#else
return (int)(syscall(__NR_epoll_create, size));
#endif
}
int
epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
{
return (syscall(__NR_epoll_ctl, epfd, op, fd, event));
return (int)(syscall(__NR_epoll_ctl, epfd, op, fd, event));
}
int
epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
{
return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
#ifdef __LP64__
return (int)(syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0));
#else
return (int)(syscall(__NR_epoll_wait, epfd, events, maxevents, timeout));
#endif
}
......@@ -14,3 +14,4 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
android.injected.testOnly=false
\ No newline at end of file
......@@ -188,7 +188,7 @@ void TouchEventTransferAndroid::set_long_click_handler(int mode) {
}
void TouchEventTransferAndroid::long_press_handler(sigval_t info) {
int mode = (int)info.sival_ptr;
int mode = (int)(long)info.sival_ptr;
char log[256];
sprintf(log, "receve long click %d", mode);
os::Printer::log(log);
......
......@@ -749,8 +749,8 @@ core::position2di initJavaBridge(ANDROID_APP app, void* handle) {
jobject lNativeActivity = app->activity->clazz;
jclass ClassNativeActivity = jni->GetObjectClass(lNativeActivity);
jmethodID MethodSetHandle = jni->GetMethodID(ClassNativeActivity,
"setNativeHandle", "(I)V");
jint code = (int) handle;
"setNativeHandle", "(J)V");
jlong code = (jlong) handle;
jni->CallVoidMethod(lNativeActivity, MethodSetHandle, code);
......
APP_ABI := armeabi-v7a x86
#APP_ABI := arm64-v8a
APP_ABI := armeabi-v7a x86 arm64-v8a
APP_PLATFORM := android-21
#APP_MODULES := YGOMobile
#NDK_TOOLCHAIN_VERSION=4.8
......
......@@ -24,7 +24,7 @@ const static char secret_key[] = "O2zMfI3gqJYYJSAuCeUkH9J_vm5S_A4Yn8fhrjU3";
* Method: nativeInsertText
* Signature: (ILjava/lang/String;)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeInsertText(
JNIEnv* env, jclass clazz, jint handle, jstring textString) {
JNIEnv* env, jclass clazz, jlong handle, jstring textString) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
IGUIEnvironment* irrenv = device->getGUIEnvironment();
......@@ -112,7 +112,7 @@ JNIEXPORT jbyteArray JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_native
* Method: nativeSetComboBoxSelection
* Signature: (II)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSetComboBoxSelection(
JNIEnv* env, jclass clazz, jint handle, jint idx) {
JNIEnv* env, jclass clazz, jlong handle, jint idx) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
IGUIEnvironment* irrenv = device->getGUIEnvironment();
......@@ -147,7 +147,7 @@ JNIEXPORT jbyteArray JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_native
* Method: nativeSetCheckBoxesSelection
* Signature: (II)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSetCheckBoxesSelection(
JNIEnv* env, jclass clazz, jint handle, jint idx) {
JNIEnv* env, jclass clazz, jlong handle, jint idx) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
IGUIEnvironment* irrenv = device->getGUIEnvironment();
......@@ -232,7 +232,7 @@ static void* join_game_thread(void* param) {
* Method: nativeRefreshTexture
* Signature: (I)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeRefreshTexture(
JNIEnv* env, jclass clazz, jint handle) {
JNIEnv* env, jclass clazz, jlong handle) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
......@@ -255,7 +255,7 @@ static void* join_game_thread(void* param) {
* Method: nativeIgnoreChain
* Signature: (IZ)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeIgnoreChain(
JNIEnv* env, jclass clazz, jint handle, jboolean begin) {
JNIEnv* env, jclass clazz, jlong handle, jboolean begin) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
if (device->isWindowFocused()) {
......@@ -277,7 +277,7 @@ static void* join_game_thread(void* param) {
* Method: nativeReactChain
* Signature: (IZ)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeReactChain(
JNIEnv* env, jclass clazz, jint handle, jboolean begin) {
JNIEnv* env, jclass clazz, jlong handle, jboolean begin) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
if (device->isWindowFocused()) {
......@@ -295,7 +295,7 @@ static void* join_game_thread(void* param) {
}
JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSetInputFix(
JNIEnv* env, jclass clazz, jint handle, jint x, jint y) {
JNIEnv* env, jclass clazz, jlong handle, jint x, jint y) {
if(ygo::mainGame) {
__android_log_print(ANDROID_LOG_INFO, "ygo", "setInputFix posX=%d, posY=%d", x, y);
ygo::mainGame->setPositionFix(core::position2di(x, y));
......@@ -324,7 +324,7 @@ static void* cancel_chain_thread(void* param) {
* Method: nativeCancelChain
* Signature: (I)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeCancelChain(
JNIEnv* env, jclass clazz, jint handle) {
JNIEnv* env, jclass clazz, jlong handle) {
if (handle) {
IrrlichtDevice* device = (IrrlichtDevice*) handle;
if (device->isWindowFocused()) {
......@@ -344,7 +344,7 @@ static void* cancel_chain_thread(void* param) {
* Method: nativeJoinGame
* Signature: (ILjava/nio/ByteBuffer;I)V
*/JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeJoinGame(
JNIEnv* env, jclass clazz, jint handle, jobject buffer, jint length) {
JNIEnv* env, jclass clazz, jlong handle, jobject buffer, jint length) {
void* data = env->GetDirectBufferAddress(buffer);
s_init_param_buffer = malloc(length);
memcpy(s_init_param_buffer, data, length);
......
......@@ -470,7 +470,7 @@ public class YGOMobileActivity extends NativeActivity implements
}
@Override
public void setNativeHandle(int nativeHandle) {
public void setNativeHandle(long nativeHandle) {
IrrlichtBridge.sNativeHandle = nativeHandle;
}
......
......@@ -39,27 +39,27 @@ public final class IrrlichtBridge {
}
public static int sNativeHandle;
public static long sNativeHandle;
//显示卡图
public static native byte[] nativeBpgImage(byte[] data);
//插入文本(大概是发送消息)
private static native void nativeInsertText(int handle, String text);
private static native void nativeInsertText(long handle, String text);
//刷新文字
private static native void nativeRefreshTexture(int handle);
private static native void nativeRefreshTexture(long handle);
//忽略时点
private static native void nativeIgnoreChain(int handle, boolean begin);
private static native void nativeIgnoreChain(long handle, boolean begin);
//强制时点
private static native void nativeReactChain(int handle, boolean begin);
private static native void nativeReactChain(long handle, boolean begin);
//取消连锁
private static native void nativeCancelChain(int handle);
private static native void nativeCancelChain(long handle);
private static native void nativeSetCheckBoxesSelection(int handle, int idx);
private static native void nativeSetCheckBoxesSelection(long handle, int idx);
private static native void nativeSetComboBoxSelection(int handle, int idx);
private static native void nativeSetComboBoxSelection(long handle, int idx);
private static native void nativeJoinGame(int handle, ByteBuffer buffer, int length);
private static native void nativeJoinGame(long handle, ByteBuffer buffer, int length);
private static native void nativeSetInputFix(int handle, int x, int y);
private static native void nativeSetInputFix(long handle, int x, int y);
private static final boolean DEBUG = false;
private static final String TAG = IrrlichtBridge.class.getSimpleName();
......@@ -205,7 +205,7 @@ public final class IrrlichtBridge {
int getLocalAddress();
void setNativeHandle(int nativeHandle);
void setNativeHandle(long nativeHandle);
int getPositionX();
......
......@@ -18,27 +18,49 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'abi', 'lang'
productFlavors {
cn {
dimension 'lang'
manifestPlaceholders = [APP_ID: "0b6f110306"]
}
en {
dimension 'lang'
applicationIdSuffix ".EN"
manifestPlaceholders = [APP_ID: "9c66525dfa"]
}
ko {
dimension 'lang'
applicationIdSuffix ".KO"
manifestPlaceholders = [APP_ID: "0488398d8a"]
}
x86 {
dimension 'abi'
ndk {
abiFilters "x86"
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'arm64-v8a'
universalApk true
}
arm {
dimension 'abi'
ndk {
abiFilters "armeabi-v7a"
}
}
arm64 {
dimension 'abi'
ndk {
abiFilters "arm64-v8a"
}
}
}
// splits {
// abi {
// enable true
// reset()
// include 'x86', 'armeabi-v7a', 'arm64-v8a'
// universalApk true
// }
// }
buildTypes {
release {
shrinkResources false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment