add (disabled) code for case where game ptr wrapper is passed instead

of the ptr itself.
This commit is contained in:
Eric House 2016-01-31 20:06:45 -08:00
parent 9455c0ef26
commit 45224a75fa

View file

@ -62,6 +62,13 @@ typedef struct _JNIGlobalState {
MPSLOT MPSLOT
} JNIGlobalState; } JNIGlobalState;
// #define GAMEPTR_IS_OBJECT 1
#ifdef GAMEPTR_IS_OBJECT
typedef jobject GamePtrType;
#else
typedef int GamePtrType;
#endif
static void static void
map_thread( EnvThreadInfo* ti, JNIEnv* env ) map_thread( EnvThreadInfo* ti, JNIEnv* env )
{ {
@ -176,6 +183,22 @@ envForMe( EnvThreadInfo* ti, const char* caller )
return result; return result;
} }
#ifdef GAMEPTR_IS_OBJECT
static JNIState*
getState( JNIEnv* env, GamePtrType gamePtr )
{
XP_ASSERT( NULL != gamePtr );
jmethodID mid = getMethodID( env, gamePtr, "ptr", "()I" );
XP_ASSERT( !!mid );
JNIState* state = (JNIState*)(*env)->CallIntMethod( env, gamePtr, mid );
LOG_RETURNF( "%p", state );
return state;
}
#else
# define getState( env, gamePtr ) ((JNIState*)(gamePtr))
#endif
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_initGlobals Java_org_eehouse_android_xw4_jni_XwJNI_initGlobals
( JNIEnv* env, jclass C ) ( JNIEnv* env, jclass C )
@ -676,8 +699,7 @@ struct _JNIState {
}; };
#define XWJNI_START() { \ #define XWJNI_START() { \
XP_ASSERT( 0 != gamePtr ); \ JNIState* state = getState( env, gamePtr ); \
JNIState* state = (JNIState*)gamePtr; \
MPSLOT; \ MPSLOT; \
MPASSIGN( mpool, state->mpool); \ MPASSIGN( mpool, state->mpool); \
XP_ASSERT( !!state->globalJNI ); \ XP_ASSERT( !!state->globalJNI ); \
@ -715,6 +737,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_initJNI
XP_LOGF( "%s: initing srand with %d", __func__, seed ); XP_LOGF( "%s: initing srand with %d", __func__, seed );
srandom( seed ); srandom( seed );
LOG_RETURNF( "%p", state );
return (jint) state; return (jint) state;
} }
@ -728,7 +751,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_envDone
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame
( JNIEnv* env, jclass C, jint gamePtr, jobject j_gi, jobject j_util, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject j_gi, jobject j_util,
jobject jniu, jobject j_draw, jobject j_cp, jobject j_procs, jobject jniu, jobject j_draw, jobject j_cp, jobject j_procs,
jobjectArray j_names, jobjectArray j_dicts, jobjectArray j_paths, jobjectArray j_names, jobjectArray j_dicts, jobjectArray j_paths,
jstring j_lang ) jstring j_lang )
@ -773,9 +796,11 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame
} /* makeNewGame */ } /* makeNewGame */
JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_game_1dispose JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_game_1dispose
( JNIEnv* env, jclass claz, jint gamePtr ) ( JNIEnv* env, jclass claz, GamePtrType gamePtr )
{ {
JNIState* state = (JNIState*)gamePtr; JNIState* state = getState( env, gamePtr );
LOG_FUNC();
#ifdef MEM_DEBUG #ifdef MEM_DEBUG
MemPoolCtx* mpool = state->mpool; MemPoolCtx* mpool = state->mpool;
#endif #endif
@ -800,7 +825,7 @@ JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_game_1dispose
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeFromStream Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeFromStream
( JNIEnv* env, jclass C, jint gamePtr, jbyteArray jstream, jobject /*out*/jgi, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jbyteArray jstream, jobject /*out*/jgi,
jobjectArray jdictNames, jobjectArray jdicts, jobjectArray jpaths, jobjectArray jdictNames, jobjectArray jdicts, jobjectArray jpaths,
jstring jlang, jobject jutil, jobject jniu, jobject jdraw, jobject jcp, jstring jlang, jobject jutil, jobject jniu, jobject jdraw, jobject jcp,
jobject jprocs ) jobject jprocs )
@ -854,7 +879,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeFromStream
JNIEXPORT jbyteArray JNICALL JNIEXPORT jbyteArray JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveToStream Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveToStream
( JNIEnv* env, jclass C, jint gamePtr, jobject jgi ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jgi )
{ {
jbyteArray result; jbyteArray result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -884,7 +909,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveToStream
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveSucceeded Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveSucceeded
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
game_saveSucceeded( &state->game, state->curSaveCount ); game_saveSucceeded( &state->game, state->curSaveCount );
@ -893,7 +918,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveSucceeded
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setDraw Java_org_eehouse_android_xw4_jni_XwJNI_board_1setDraw
( JNIEnv* env, jclass C, jint gamePtr, jobject jdraw ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jdraw )
{ {
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -908,7 +933,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1setDraw
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1invalAll Java_org_eehouse_android_xw4_jni_XwJNI_board_1invalAll
( JNIEnv *env, jclass C, jint gamePtr ) ( JNIEnv *env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
board_invalAll( state->game.board ); board_invalAll( state->game.board );
@ -917,7 +942,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1invalAll
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw
( JNIEnv *env, jclass C, jint gamePtr ) ( JNIEnv *env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -929,7 +954,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw
#ifdef COMMON_LAYOUT #ifdef COMMON_LAYOUT
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
( JNIEnv* env, jclass C, jint gamePtr, jobject jgi, jint left, jint top, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jgi, jint left, jint top,
jint width, jint height, jint scorePct, jint trayPct, jint scoreWidth, jint width, jint height, jint scorePct, jint trayPct, jint scoreWidth,
jint fontWidth, jint fontHt, jboolean squareTiles, jobject jdims ) jint fontWidth, jint fontHt, jboolean squareTiles, jobject jdims )
{ {
@ -952,7 +977,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1applyLayout Java_org_eehouse_android_xw4_jni_XwJNI_board_1applyLayout
( JNIEnv* env, jclass C, jint gamePtr, jobject jdims ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jdims )
{ {
XWJNI_START(); XWJNI_START();
BoardDims dims; BoardDims dims;
@ -965,7 +990,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1applyLayout
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setPos Java_org_eehouse_android_xw4_jni_XwJNI_board_1setPos
(JNIEnv *env, jclass C, jint gamePtr, jint left, jint top, jint width, (JNIEnv *env, jclass C, GamePtrType gamePtr, jint left, jint top, jint width,
jint height, jint maxCellSize, jboolean lefty ) jint height, jint maxCellSize, jboolean lefty )
{ {
XWJNI_START(); XWJNI_START();
@ -976,7 +1001,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1setPos
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setScoreboardLoc Java_org_eehouse_android_xw4_jni_XwJNI_board_1setScoreboardLoc
( JNIEnv *env, jclass C, jint gamePtr, jint left, jint top, ( JNIEnv *env, jclass C, GamePtrType gamePtr, jint left, jint top,
jint width, jint height, jboolean divideHorizontally ) jint width, jint height, jboolean divideHorizontally )
{ {
XWJNI_START(); XWJNI_START();
@ -987,7 +1012,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1setScoreboardLoc
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTimerLoc Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTimerLoc
( JNIEnv* env, jclass C, jint gamePtr, jint timerLeft, jint timerTop, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint timerLeft, jint timerTop,
jint timerWidth, jint timerHeight ) jint timerWidth, jint timerHeight )
{ {
XWJNI_START(); XWJNI_START();
@ -1000,7 +1025,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTimerLoc
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTrayLoc Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTrayLoc
( JNIEnv *env, jclass C, jint gamePtr, jint left, jint top, ( JNIEnv *env, jclass C, GamePtrType gamePtr, jint left, jint top,
jint width, jint height, jint minDividerWidth ) jint width, jint height, jint minDividerWidth )
{ {
XWJNI_START(); XWJNI_START();
@ -1012,7 +1037,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1setTrayLoc
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1zoom Java_org_eehouse_android_xw4_jni_XwJNI_board_1zoom
( JNIEnv* env, jclass C, jint gamePtr, jint zoomBy, jbooleanArray jCanZoom ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint zoomBy, jbooleanArray jCanZoom )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1027,7 +1052,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1zoom
#ifdef XWFEATURE_ACTIVERECT #ifdef XWFEATURE_ACTIVERECT
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1getActiveRect Java_org_eehouse_android_xw4_jni_XwJNI_board_1getActiveRect
( JNIEnv* env, jclass C, jint gamePtr, jobject jrect, jintArray dims ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jrect, jintArray dims )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1051,7 +1076,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1getActiveRect
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenDown Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenDown
(JNIEnv *env, jclass C, jint gamePtr, jint xx, jint yy, jbooleanArray barray ) (JNIEnv *env, jclass C, GamePtrType gamePtr, jint xx, jint yy, jbooleanArray barray )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1063,7 +1088,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenDown
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenMove Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenMove
( JNIEnv *env, jclass C, jint gamePtr, jint xx, jint yy ) ( JNIEnv *env, jclass C, GamePtrType gamePtr, jint xx, jint yy )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1074,7 +1099,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenMove
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenUp Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenUp
( JNIEnv *env, jclass C, jint gamePtr, jint xx, jint yy ) ( JNIEnv *env, jclass C, GamePtrType gamePtr, jint xx, jint yy )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1085,7 +1110,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1handlePenUp
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1juggleTray Java_org_eehouse_android_xw4_jni_XwJNI_board_1juggleTray
(JNIEnv* env, jclass C, jint gamePtr ) (JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1096,7 +1121,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1juggleTray
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1getTrayVisState Java_org_eehouse_android_xw4_jni_XwJNI_board_1getTrayVisState
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1107,7 +1132,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1getTrayVisState
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1hideTray Java_org_eehouse_android_xw4_jni_XwJNI_board_1hideTray
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1118,7 +1143,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1hideTray
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1showTray Java_org_eehouse_android_xw4_jni_XwJNI_board_1showTray
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1129,7 +1154,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1showTray
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1beginTrade Java_org_eehouse_android_xw4_jni_XwJNI_board_1beginTrade
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1140,7 +1165,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1beginTrade
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1endTrade Java_org_eehouse_android_xw4_jni_XwJNI_board_1endTrade
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1151,7 +1176,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1endTrade
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1162,7 +1187,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1toggle_1showValues
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1commitTurn Java_org_eehouse_android_xw4_jni_XwJNI_board_1commitTurn
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1173,7 +1198,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1commitTurn
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1flip Java_org_eehouse_android_xw4_jni_XwJNI_board_1flip
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1184,7 +1209,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1flip
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1replaceTiles Java_org_eehouse_android_xw4_jni_XwJNI_board_1replaceTiles
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1195,7 +1220,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1replaceTiles
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1redoReplacedTiles Java_org_eehouse_android_xw4_jni_XwJNI_board_1redoReplacedTiles
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1206,7 +1231,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1redoReplacedTiles
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1reset Java_org_eehouse_android_xw4_jni_XwJNI_server_1reset
(JNIEnv* env, jclass C, jint gamePtr ) (JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
server_reset( state->game.server, state->game.comms ); server_reset( state->game.server, state->game.comms );
@ -1215,7 +1240,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1reset
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1handleUndo Java_org_eehouse_android_xw4_jni_XwJNI_server_1handleUndo
(JNIEnv* env, jclass C, jint gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)
{ {
XWJNI_START(); XWJNI_START();
server_handleUndo( state->game.server, 0 ); server_handleUndo( state->game.server, 0 );
@ -1224,7 +1249,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1handleUndo
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1do Java_org_eehouse_android_xw4_jni_XwJNI_server_1do
(JNIEnv* env, jclass C, jint gamePtr ) (JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1235,7 +1260,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1do
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1resetEngine Java_org_eehouse_android_xw4_jni_XwJNI_board_1resetEngine
(JNIEnv* env, jclass C, jint gamePtr ) (JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
board_resetEngine( state->game.board ); board_resetEngine( state->game.board );
@ -1244,7 +1269,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1resetEngine
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1requestHint Java_org_eehouse_android_xw4_jni_XwJNI_board_1requestHint
( JNIEnv* env, jclass C, jint gamePtr, jboolean useLimits, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jboolean useLimits,
jboolean goBack, jbooleanArray workRemains ) jboolean goBack, jbooleanArray workRemains )
{ {
jboolean result; jboolean result;
@ -1266,7 +1291,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1requestHint
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_timerFired Java_org_eehouse_android_xw4_jni_XwJNI_timerFired
( JNIEnv* env, jclass C, jint gamePtr, jint why, jint when, jint handle ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint why, jint when, jint handle )
{ {
jboolean result; jboolean result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1278,7 +1303,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_timerFired
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1formatRemainingTiles Java_org_eehouse_android_xw4_jni_XwJNI_board_1formatRemainingTiles
(JNIEnv* env, jclass C, jint gamePtr ) (JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jstring result; jstring result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1294,7 +1319,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1formatRemainingTiles
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1formatDictCounts Java_org_eehouse_android_xw4_jni_XwJNI_server_1formatDictCounts
( JNIEnv* env, jclass C, jint gamePtr, jint nCols ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint nCols )
{ {
jstring result; jstring result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1308,7 +1333,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1formatDictCounts
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1getGameIsOver Java_org_eehouse_android_xw4_jni_XwJNI_server_1getGameIsOver
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1319,7 +1344,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1getGameIsOver
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_model_1writeGameHistory Java_org_eehouse_android_xw4_jni_XwJNI_model_1writeGameHistory
( JNIEnv* env, jclass C, jint gamePtr, jboolean gameOver ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jboolean gameOver )
{ {
jstring result; jstring result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1334,7 +1359,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1writeGameHistory
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNMoves Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNMoves
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jint result; jint result;
XWJNI_START(); XWJNI_START();
@ -1347,7 +1372,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNMoves
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNumTilesInTray Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNumTilesInTray
( JNIEnv* env, jclass C, jint gamePtr, jint player ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint player )
{ {
jint result; jint result;
XWJNI_START(); XWJNI_START();
@ -1359,7 +1384,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1getNumTilesInTray
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_model_1getPlayersLastScore Java_org_eehouse_android_xw4_jni_XwJNI_model_1getPlayersLastScore
( JNIEnv* env, jclass C, jint gamePtr, jint player, jobject jlmi ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint player, jobject jlmi )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( !!state->game.model ); XP_ASSERT( !!state->game.model );
@ -1379,7 +1404,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1getPlayersLastScore
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1writeFinalScores Java_org_eehouse_android_xw4_jni_XwJNI_server_1writeFinalScores
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jstring result; jstring result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1403,7 +1428,7 @@ and_send_on_close( XWStreamCtxt* stream, void* closure )
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
LOG_FUNC(); LOG_FUNC();
@ -1418,7 +1443,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1start Java_org_eehouse_android_xw4_jni_XwJNI_comms_1start
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
CommsCtxt* comms = state->game.comms; CommsCtxt* comms = state->game.comms;
@ -1430,7 +1455,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1start
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1stop Java_org_eehouse_android_xw4_jni_XwJNI_comms_1stop
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
CommsCtxt* comms = state->game.comms; CommsCtxt* comms = state->game.comms;
@ -1442,7 +1467,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1stop
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resetSame Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resetSame
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
if ( !!state->game.comms ) { if ( !!state->game.comms ) {
@ -1453,7 +1478,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resetSame
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddr Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddr
(JNIEnv* env, jclass C, jint gamePtr, jobject jaddr ) (JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jaddr )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( state->game.comms ); XP_ASSERT( state->game.comms );
@ -1465,7 +1490,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddr
JNIEXPORT jobjectArray JNICALL JNIEXPORT jobjectArray JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddrs Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddrs
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jobjectArray result = NULL; jobjectArray result = NULL;
XWJNI_START(); XWJNI_START();
@ -1492,7 +1517,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getAddrs
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1setAddr Java_org_eehouse_android_xw4_jni_XwJNI_comms_1setAddr
( JNIEnv* env, jclass C, jint gamePtr, jobject jaddr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jaddr )
{ {
XWJNI_START(); XWJNI_START();
if ( state->game.comms ) { if ( state->game.comms ) {
@ -1507,7 +1532,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1setAddr
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage
( JNIEnv* env, jclass C, jint gamePtr, jbyteArray jstream, jobject jaddr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jbyteArray jstream, jobject jaddr )
{ {
jboolean result; jboolean result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1558,7 +1583,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
( JNIEnv* env, jclass C, jint gamePtr, jobject jsummary ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jsummary )
{ {
XWJNI_START(); XWJNI_START();
ModelCtxt* model = state->game.model; ModelCtxt* model = state->game.model;
@ -1645,7 +1670,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1server_1prefsChanged Java_org_eehouse_android_xw4_jni_XwJNI_board_1server_1prefsChanged
( JNIEnv* env, jclass C, jint gamePtr, jobject jcp ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jcp )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1663,7 +1688,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1server_1prefsChanged
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1getFocusOwner Java_org_eehouse_android_xw4_jni_XwJNI_board_1getFocusOwner
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jint result; jint result;
XWJNI_START(); XWJNI_START();
@ -1674,7 +1699,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1getFocusOwner
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1focusChanged Java_org_eehouse_android_xw4_jni_XwJNI_board_1focusChanged
( JNIEnv* env, jclass C, jint gamePtr, jint typ ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint typ )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1687,7 +1712,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1focusChanged
#ifdef KEYBOARD_NAV #ifdef KEYBOARD_NAV
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1handleKey Java_org_eehouse_android_xw4_jni_XwJNI_board_1handleKey
( JNIEnv* env, jclass C, jint gamePtr, jobject jkey, jboolean jup, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jkey, jboolean jup,
jbooleanArray jhandled ) jbooleanArray jhandled )
{ {
jboolean result; jboolean result;
@ -1709,7 +1734,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1handleKey
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1getGi Java_org_eehouse_android_xw4_jni_XwJNI_game_1getGi
( JNIEnv* env, jclass C, jint gamePtr, jobject jgi ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jgi )
{ {
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
setJGI( env, jgi, globals->gi ); setJGI( env, jgi, globals->gi );
@ -1736,7 +1761,7 @@ static const SetInfo gsi_bools[] = {
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1getState Java_org_eehouse_android_xw4_jni_XwJNI_game_1getState
( JNIEnv* env, jclass C, jint gamePtr, jobject jgsi ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jgsi )
{ {
XWJNI_START(); XWJNI_START();
GameStateInfo info; GameStateInfo info;
@ -1750,7 +1775,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1getState
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1hasComms Java_org_eehouse_android_xw4_jni_XwJNI_game_1hasComms
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1762,7 +1787,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1hasComms
#ifdef XWFEATURE_CHANGEDICT #ifdef XWFEATURE_CHANGEDICT
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_game_1changeDict Java_org_eehouse_android_xw4_jni_XwJNI_game_1changeDict
( JNIEnv* env, jclass C, jint gamePtr, jobject jgi, jstring jname, ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jgi, jstring jname,
jbyteArray jDictBytes, jstring jpath ) jbyteArray jDictBytes, jstring jpath )
{ {
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
@ -1780,7 +1805,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1changeDict
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll
( JNIEnv* env, jclass C, jint gamePtr, jboolean force, jboolean thenAck ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jboolean force, jboolean thenAck )
{ {
jint result; jint result;
XWJNI_START(); XWJNI_START();
@ -1799,7 +1824,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll
#ifdef XWFEATURE_COMMSACK #ifdef XWFEATURE_COMMSACK
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1ackAny Java_org_eehouse_android_xw4_jni_XwJNI_comms_1ackAny
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( !!state->game.comms ); XP_ASSERT( !!state->game.comms );
@ -1810,7 +1835,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1ackAny
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1transportFailed Java_org_eehouse_android_xw4_jni_XwJNI_comms_1transportFailed
( JNIEnv* env, jclass C, jint gamePtr, jobject failedTyp ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject failedTyp )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( !!state->game.comms ); XP_ASSERT( !!state->game.comms );
@ -1822,7 +1847,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1transportFailed
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1isConnected Java_org_eehouse_android_xw4_jni_XwJNI_comms_1isConnected
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jboolean result; jboolean result;
XWJNI_START(); XWJNI_START();
@ -1833,7 +1858,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1isConnected
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID
( JNIEnv* env, jclass C, jint gamePtr, jint indx ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jint indx )
{ {
jstring result = NULL; jstring result = NULL;
XWJNI_START(); XWJNI_START();
@ -1852,7 +1877,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1formatRelayID
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getStats Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getStats
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
jstring result = NULL; jstring result = NULL;
#ifdef DEBUG #ifdef DEBUG
@ -1871,7 +1896,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getStats
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame
( JNIEnv* env, jclass C, jint gamePtr ) ( JNIEnv* env, jclass C, GamePtrType gamePtr )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( !!state->game.server ); XP_ASSERT( !!state->game.server );
@ -1882,7 +1907,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame
#ifdef XWFEATURE_CHAT #ifdef XWFEATURE_CHAT
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1sendChat Java_org_eehouse_android_xw4_jni_XwJNI_board_1sendChat
( JNIEnv* env, jclass C, jint gamePtr, jstring jmsg ) ( JNIEnv* env, jclass C, GamePtrType gamePtr, jstring jmsg )
{ {
XWJNI_START(); XWJNI_START();
XP_ASSERT( !!state->game.server ); XP_ASSERT( !!state->game.server );