|
|
@ -181,7 +181,7 @@ Lock event queue and return pointer to next event. |
|
|
|
Caller must do Android_PushEvent() to unlock queue after setting parameters. |
|
|
|
Caller must do Android_PushEvent() to unlock queue after setting parameters. |
|
|
|
======================== |
|
|
|
======================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
event_t *Android_AllocEvent() |
|
|
|
event_t *Android_AllocEvent( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Android_Lock(); |
|
|
|
Android_Lock(); |
|
|
|
if( events.count == ANDROID_MAX_EVENTS ) |
|
|
|
if( events.count == ANDROID_MAX_EVENTS ) |
|
|
@ -418,6 +418,7 @@ DECLARE_JNI_INTERFACE( void, nativeBall, jint id, jbyte ball, jshort xrel, jshor |
|
|
|
|
|
|
|
|
|
|
|
DECLARE_JNI_INTERFACE( void, nativeHat, jint id, jbyte hat, jbyte key, jboolean down ) |
|
|
|
DECLARE_JNI_INTERFACE( void, nativeHat, jint id, jbyte hat, jbyte key, jboolean down ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
event_t *event = Android_AllocEvent(); |
|
|
|
static byte engineKeys; |
|
|
|
static byte engineKeys; |
|
|
|
|
|
|
|
|
|
|
|
if( !key ) |
|
|
|
if( !key ) |
|
|
@ -428,7 +429,6 @@ DECLARE_JNI_INTERFACE( void, nativeHat, jint id, jbyte hat, jbyte key, jboolean |
|
|
|
else |
|
|
|
else |
|
|
|
engineKeys &= ~key; |
|
|
|
engineKeys &= ~key; |
|
|
|
|
|
|
|
|
|
|
|
event_t *event = Android_AllocEvent(); |
|
|
|
|
|
|
|
event->type = event_joyhat; |
|
|
|
event->type = event_joyhat; |
|
|
|
event->arg = id; |
|
|
|
event->arg = id; |
|
|
|
event->hat.hat = hat; |
|
|
|
event->hat.hat = hat; |
|
|
@ -584,7 +584,7 @@ Android_Init |
|
|
|
Initialize android-related cvars |
|
|
|
Initialize android-related cvars |
|
|
|
======================== |
|
|
|
======================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void Android_Init() |
|
|
|
void Android_Init( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
android_sleep = Cvar_Get( "android_sleep", "1", FCVAR_ARCHIVE, "Enable sleep in background" ); |
|
|
|
android_sleep = Cvar_Get( "android_sleep", "1", FCVAR_ARCHIVE, "Enable sleep in background" ); |
|
|
|
} |
|
|
|
} |
|
|
@ -658,12 +658,14 @@ Android_GetAndroidID |
|
|
|
const char *Android_GetAndroidID( void ) |
|
|
|
const char *Android_GetAndroidID( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
static char id[65]; |
|
|
|
static char id[65]; |
|
|
|
|
|
|
|
const char *resultCStr; |
|
|
|
|
|
|
|
jstring resultJNIStr; |
|
|
|
|
|
|
|
|
|
|
|
if( id[0] ) |
|
|
|
if( id[0] ) |
|
|
|
return id; |
|
|
|
return id; |
|
|
|
|
|
|
|
|
|
|
|
jstring resultJNIStr = (jstring)(*jni.env)->CallStaticObjectMethod( jni.env, jni.actcls, jni.getAndroidId ); |
|
|
|
resultJNIStr = (jstring)(*jni.env)->CallStaticObjectMethod( jni.env, jni.actcls, jni.getAndroidId ); |
|
|
|
const char *resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL ); |
|
|
|
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL ); |
|
|
|
Q_strncpy( id, resultCStr, 64 ); |
|
|
|
Q_strncpy( id, resultCStr, 64 ); |
|
|
|
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr ); |
|
|
|
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr ); |
|
|
|
|
|
|
|
|
|
|
@ -795,7 +797,7 @@ Android_RunEvents |
|
|
|
Execute all events from queue |
|
|
|
Execute all events from queue |
|
|
|
======================== |
|
|
|
======================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void Platform_RunEvents() |
|
|
|
void Platform_RunEvents( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|