From ceff1cde8bf3dc26694e2b819110f18fc8838764 Mon Sep 17 00:00:00 2001 From: eehouse Date: Fri, 23 Apr 2010 08:34:58 +0000 Subject: [PATCH] pass dict name into jni along with its bytes --- .../src/org/eehouse/android/xw4/BoardActivity.java | 9 +++++---- .../src/org/eehouse/android/xw4/GameConfig.java | 5 +++-- .../XWords4/src/org/eehouse/android/xw4/Utils.java | 8 ++++---- .../src/org/eehouse/android/xw4/jni/XwJNI.java | 14 ++++++++------ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 21e645ec5..6aed51194 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -589,11 +589,12 @@ public class BoardActivity extends Activity implements UtilCtxt { CommonPrefs cp = CommonPrefs.get(); if ( null == stream || ! XwJNI.game_makeFromStream( m_jniGamePtr, stream, - m_gi, dictBytes, this, - m_jniu, m_view, cp, - m_xport ) ) { + m_gi, dictBytes, + m_gi.dictName,this, m_jniu, + m_view, cp, m_xport ) ) { XwJNI.game_makeNewGame( m_jniGamePtr, m_gi, this, m_jniu, - m_view, cp, m_xport, dictBytes ); + m_view, cp, m_xport, + dictBytes, m_gi.dictName ); } m_jniThread = new diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java index ed7cef81e..0999ff244 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java @@ -776,14 +776,15 @@ public class GameConfig extends Activity implements View.OnClickListener { madeGame = XwJNI.game_makeFromStream( gamePtr, stream, JNIUtilsImpl.get(), new CurGameInfo(this), - dictBytes, m_cp ); + dictBytes, m_gi.dictName, + m_cp ); } if ( forceNew || !madeGame ) { m_gi.setInProgress( false ); m_gi.fixup(); XwJNI.game_makeNewGame( gamePtr, m_gi, JNIUtilsImpl.get(), - m_cp, dictBytes ); + m_cp, dictBytes, m_gi.dictName ); } if ( null != m_car ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java index 1440da7ce..c74076591 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java @@ -151,7 +151,7 @@ public class Utils { gamePtr = XwJNI.initJNI(); XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(), - CommonPrefs.get(), dictBytes ); + CommonPrefs.get(), dictBytes, gi.dictName ); if ( null != addr ) { XwJNI.comms_setAddr( gamePtr, addr ); } @@ -185,12 +185,12 @@ public class Utils { byte[] dictBytes = Utils.openDict( context, gi.dictName ); boolean madeGame = XwJNI.game_makeFromStream( gamePtr, stream, - JNIUtilsImpl.get(), - gi, dictBytes, + JNIUtilsImpl.get(), gi, + dictBytes, gi.dictName, CommonPrefs.get() ); if ( !madeGame ) { XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(), - CommonPrefs.get(), dictBytes ); + CommonPrefs.get(), dictBytes, gi.dictName ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java index 6653d0c3f..e6f4ab48e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java @@ -50,12 +50,13 @@ public class XwJNI { JNIUtils jniu, DrawCtx draw, CommonPrefs cp, TransportProcs procs, - byte[] dict ); + byte[] dict, String dictName ); public static native boolean game_makeFromStream( int gamePtr, byte[] stream, CurGameInfo gi, byte[] dict, + String dictName, UtilCtxt util, JNIUtils jniu, DrawCtx draw, @@ -66,19 +67,20 @@ public class XwJNI { // played public static void game_makeNewGame( int gamePtr, CurGameInfo gi, JNIUtils jniu, CommonPrefs cp, - byte[] dict ) { + byte[] dict, String dictName ) { game_makeNewGame( gamePtr, gi, (UtilCtxt)null, jniu, - (DrawCtx)null, cp, (TransportProcs)null, dict ); + (DrawCtx)null, cp, (TransportProcs)null, + dict, dictName ); } public static boolean game_makeFromStream( int gamePtr, byte[] stream, JNIUtils jniu, CurGameInfo gi, - byte[] dict, + byte[] dict, String dictName, CommonPrefs cp ) { - return game_makeFromStream( gamePtr, stream, gi, dict, (UtilCtxt)null, - jniu, (DrawCtx)null, cp, + return game_makeFromStream( gamePtr, stream, gi, dict, dictName, + (UtilCtxt)null, jniu, (DrawCtx)null, cp, (TransportProcs)null ); }