Improve android java support
- Use Log.d/Log.w instead of System.printf
- Remove commented code
- Cherry-pick: Manual backport of d698814367
This commit is contained in:
parent
0af3f8e053
commit
88e779cd5e
@ -58,21 +58,6 @@ const char *AudioDriverAndroid::get_name() const {
|
||||
Error AudioDriverAndroid::init() {
|
||||
|
||||
mutex = Mutex::create();
|
||||
/*
|
||||
// TODO: pass in/return a (Java) device ID, also whether we're opening for input or output
|
||||
this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
|
||||
SDL_CalculateAudioSpec(&this->spec);
|
||||
|
||||
if (this->spec.samples == 0) {
|
||||
// Init failed?
|
||||
SDL_SetError("Java-side initialization failed!");
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
// Android_JNI_SetupThread();
|
||||
|
||||
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
int mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
|
||||
@ -84,7 +69,6 @@ Error AudioDriverAndroid::init() {
|
||||
print_line("audio buffer size: " + itos(buffer_size));
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "Initializing audio! params: %i,%i ", mix_rate, buffer_size);
|
||||
audioBuffer = env->CallObjectMethod(io, _init_audio, mix_rate, buffer_size);
|
||||
|
||||
ERR_FAIL_COND_V(audioBuffer == NULL, ERR_INVALID_PARAMETER);
|
||||
@ -111,29 +95,10 @@ void AudioDriverAndroid::setup(jobject p_io) {
|
||||
jclass c = env->GetObjectClass(io);
|
||||
cls = (jclass)env->NewGlobalRef(c);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "starting to attempt get methods");
|
||||
|
||||
_init_audio = env->GetMethodID(cls, "audioInit", "(II)Ljava/lang/Object;");
|
||||
if (_init_audio != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _init_audio ok!!");
|
||||
} else {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "audioinit ok!");
|
||||
}
|
||||
|
||||
_write_buffer = env->GetMethodID(cls, "audioWriteShortBuffer", "([S)V");
|
||||
if (_write_buffer != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _write_buffer ok!!");
|
||||
}
|
||||
|
||||
_quit = env->GetMethodID(cls, "audioQuit", "()V");
|
||||
if (_quit != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _quit ok!!");
|
||||
}
|
||||
|
||||
_pause = env->GetMethodID(cls, "audioPause", "(Z)V");
|
||||
if (_quit != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _pause ok!!");
|
||||
}
|
||||
}
|
||||
|
||||
void AudioDriverAndroid::thread_func(JNIEnv *env) {
|
||||
@ -142,7 +107,6 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
|
||||
if (cls) {
|
||||
|
||||
cls = (jclass)env->NewGlobalRef(cls);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******CLASS FOUND!!!");
|
||||
}
|
||||
jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;");
|
||||
jobject ob = env->GetStaticObjectField(cls, fid);
|
||||
@ -150,9 +114,6 @@ void AudioDriverAndroid::thread_func(JNIEnv *env) {
|
||||
jclass c = env->GetObjectClass(gob);
|
||||
jclass lcls = (jclass)env->NewGlobalRef(c);
|
||||
_write_buffer = env->GetMethodID(lcls, "audioWriteShortBuffer", "([S)V");
|
||||
if (_write_buffer != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _write_buffer ok!!");
|
||||
}
|
||||
|
||||
while (!quit) {
|
||||
|
||||
|
@ -193,8 +193,6 @@ Error AudioDriverOpenSL::init() {
|
||||
ERR_FAIL_V(ERR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
print_line("OpenSL Init OK!");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,6 @@ Error DirAccessJAndroid::change_dir(String p_dir) {
|
||||
else
|
||||
new_dir = current_dir.plus_file(p_dir);
|
||||
|
||||
//print_line("new dir is: "+new_dir);
|
||||
//test if newdir exists
|
||||
new_dir = new_dir.simplify_path();
|
||||
|
||||
@ -225,30 +224,14 @@ void DirAccessJAndroid::setup(jobject p_io) {
|
||||
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
io = p_io;
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP7");
|
||||
|
||||
jclass c = env->GetObjectClass(io);
|
||||
cls = (jclass)env->NewGlobalRef(c);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP8");
|
||||
|
||||
_dir_open = env->GetMethodID(cls, "dir_open", "(Ljava/lang/String;)I");
|
||||
if (_dir_open != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_open ok!!");
|
||||
}
|
||||
_dir_next = env->GetMethodID(cls, "dir_next", "(I)Ljava/lang/String;");
|
||||
if (_dir_next != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_next ok!!");
|
||||
}
|
||||
_dir_close = env->GetMethodID(cls, "dir_close", "(I)V");
|
||||
if (_dir_close != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_close ok!!");
|
||||
}
|
||||
_dir_is_dir = env->GetMethodID(cls, "dir_is_dir", "(I)Z");
|
||||
if (_dir_is_dir != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _dir_is_dir ok!!");
|
||||
}
|
||||
|
||||
// (*env)->CallVoidMethod(env,obj,aMethodID, myvar);
|
||||
}
|
||||
|
||||
DirAccessJAndroid::DirAccessJAndroid() {
|
||||
|
@ -186,43 +186,16 @@ void FileAccessJAndroid::setup(jobject p_io) {
|
||||
io = p_io;
|
||||
JNIEnv *env = ThreadAndroid::get_env();
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP5");
|
||||
|
||||
jclass c = env->GetObjectClass(io);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP6");
|
||||
cls = (jclass)env->NewGlobalRef(c);
|
||||
|
||||
_file_open = env->GetMethodID(cls, "file_open", "(Ljava/lang/String;Z)I");
|
||||
if (_file_open != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_open ok!!");
|
||||
}
|
||||
_file_get_size = env->GetMethodID(cls, "file_get_size", "(I)I");
|
||||
if (_file_get_size != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_get_size ok!!");
|
||||
}
|
||||
_file_tell = env->GetMethodID(cls, "file_tell", "(I)I");
|
||||
if (_file_tell != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_tell ok!!");
|
||||
}
|
||||
_file_eof = env->GetMethodID(cls, "file_eof", "(I)Z");
|
||||
|
||||
if (_file_eof != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_eof ok!!");
|
||||
}
|
||||
_file_seek = env->GetMethodID(cls, "file_seek", "(II)V");
|
||||
if (_file_seek != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_seek ok!!");
|
||||
}
|
||||
_file_read = env->GetMethodID(cls, "file_read", "(II)[B");
|
||||
if (_file_read != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_read ok!!");
|
||||
}
|
||||
_file_close = env->GetMethodID(cls, "file_close", "(I)V");
|
||||
if (_file_close != 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******GOT METHOD _file_close ok!!");
|
||||
}
|
||||
|
||||
// (*env)->CallVoidMethod(env,obj,aMethodID, myvar);
|
||||
}
|
||||
|
||||
FileAccessJAndroid::FileAccessJAndroid() {
|
||||
|
@ -75,14 +75,11 @@ public:
|
||||
|
||||
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
|
||||
|
||||
print_line("attempt to call " + String(p_method));
|
||||
|
||||
r_error.error = Variant::CallError::CALL_OK;
|
||||
|
||||
Map<StringName, MethodData>::Element *E = method_map.find(p_method);
|
||||
if (!E) {
|
||||
|
||||
print_line("no exists");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
return Variant();
|
||||
}
|
||||
@ -90,7 +87,6 @@ public:
|
||||
int ac = E->get().argtypes.size();
|
||||
if (ac < p_argcount) {
|
||||
|
||||
print_line("fewargs");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = ac;
|
||||
return Variant();
|
||||
@ -98,7 +94,6 @@ public:
|
||||
|
||||
if (ac > p_argcount) {
|
||||
|
||||
print_line("manyargs");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = ac;
|
||||
return Variant();
|
||||
@ -180,26 +175,21 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
print_line("calling method!!");
|
||||
|
||||
Variant ret;
|
||||
|
||||
switch (E->get().ret_type) {
|
||||
|
||||
case Variant::NIL: {
|
||||
|
||||
print_line("call void");
|
||||
env->CallVoidMethodA(instance, E->get().method, v);
|
||||
} break;
|
||||
case Variant::BOOL: {
|
||||
|
||||
ret = env->CallBooleanMethodA(instance, E->get().method, v);
|
||||
print_line("call bool");
|
||||
} break;
|
||||
case Variant::INT: {
|
||||
|
||||
ret = env->CallIntMethodA(instance, E->get().method, v);
|
||||
print_line("call int");
|
||||
} break;
|
||||
case Variant::REAL: {
|
||||
|
||||
@ -254,13 +244,10 @@ public:
|
||||
} break;
|
||||
default: {
|
||||
|
||||
print_line("failure..");
|
||||
ERR_FAIL_V(Variant());
|
||||
} break;
|
||||
}
|
||||
|
||||
print_line("success");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -389,7 +376,6 @@ static int engine_init_display(struct engine *engine, bool p_gl2) {
|
||||
|
||||
eglQuerySurface(display, surface, EGL_WIDTH, &w);
|
||||
eglQuerySurface(display, surface, EGL_HEIGHT, &h);
|
||||
print_line("INIT VIDEO MODE: " + itos(w) + "," + itos(h));
|
||||
|
||||
//engine->os->set_egl_extensions(eglQueryString(display,EGL_EXTENSIONS));
|
||||
engine->os->init_video_mode(w, h);
|
||||
@ -570,7 +556,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
|
||||
eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
|
||||
eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
|
||||
engine->os->init_video_mode(w,h);
|
||||
//print_line("RESIZED VIDEO MODE: "+itos(w)+","+itos(h));
|
||||
engine_draw_frame(engine);
|
||||
|
||||
}
|
||||
@ -596,7 +581,6 @@ static void engine_handle_cmd(struct android_app *app, int32_t cmd) {
|
||||
eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
|
||||
eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
|
||||
engine->os->init_video_mode(w,h);
|
||||
//print_line("RESIZED VIDEO MODE: "+itos(w)+","+itos(h));
|
||||
|
||||
}*/
|
||||
|
||||
@ -959,7 +943,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e
|
||||
|
||||
int stringCount = env->GetArrayLength(args);
|
||||
|
||||
print_line("Singl: " + singname + " Method: " + mname + " RetVal: " + retval);
|
||||
for (int i = 0; i < stringCount; i++) {
|
||||
|
||||
jstring string = (jstring)env->GetObjectArrayElement(args, i);
|
||||
@ -971,11 +954,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e
|
||||
cs += ")";
|
||||
cs += get_jni_sig(retval);
|
||||
jclass cls = env->GetObjectClass(s->get_instance());
|
||||
print_line("METHOD: " + mname + " sig: " + cs);
|
||||
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
|
||||
if (!mid) {
|
||||
|
||||
print_line("FAILED GETTING METHOID " + mname);
|
||||
print_line("Failed getting method id: " + mname);
|
||||
}
|
||||
|
||||
s->add_method(mname, mid, types, get_jni_type(retval));
|
||||
|
@ -78,3 +78,4 @@ public class Dictionary extends HashMap<String, Object> {
|
||||
keys_cache = null;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -91,7 +91,7 @@ import android.os.Messenger;
|
||||
import android.os.SystemClock;
|
||||
|
||||
public class Godot extends Activity implements SensorEventListener, IDownloaderClient {
|
||||
|
||||
private static final String TAG = "Godot";
|
||||
static final int MAX_SINGLETONS = 64;
|
||||
private IStub mDownloaderClientStub;
|
||||
private IDownloaderService mRemoteService;
|
||||
@ -149,21 +149,16 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
Method[] methods = clazz.getDeclaredMethods();
|
||||
for (Method method : methods) {
|
||||
boolean found = false;
|
||||
Log.d("XXX", "METHOD: %s\n" + method.getName());
|
||||
|
||||
for (String s : p_methods) {
|
||||
Log.d("XXX", "METHOD CMP WITH: %s\n" + s);
|
||||
if (s.equals(method.getName())) {
|
||||
found = true;
|
||||
Log.d("XXX", "METHOD CMP VALID");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
continue;
|
||||
|
||||
Log.d("XXX", "METHOD FOUND: %s\n" + method.getName());
|
||||
|
||||
List<String> ptr = new ArrayList<String>();
|
||||
|
||||
Class[] paramTypes = method.getParameterTypes();
|
||||
@ -190,21 +185,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
protected void onGLDrawFrame(GL10 gl) {}
|
||||
protected void onGLSurfaceChanged(GL10 gl, int width, int height) {} // singletons will always miss first onGLSurfaceChanged call
|
||||
//protected void onGLSurfaceCreated(GL10 gl, EGLConfig config) {} // singletons won't be ready until first GodotLib.step()
|
||||
|
||||
public void registerMethods() {}
|
||||
}
|
||||
|
||||
/*
|
||||
protected List<SingletonBase> singletons = new ArrayList<SingletonBase>();
|
||||
protected void instanceSingleton(SingletonBase s) {
|
||||
|
||||
s.registerMethods();
|
||||
singletons.add(s);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
private String[] command_line;
|
||||
|
||||
public GodotView mView;
|
||||
@ -222,7 +206,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
static public GodotIO io;
|
||||
|
||||
public static void setWindowTitle(String title) {
|
||||
//setTitle(title);
|
||||
}
|
||||
|
||||
static SingletonBase singletons[] = new SingletonBase[MAX_SINGLETONS];
|
||||
@ -253,9 +236,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
public void onVideoInit(boolean use_gl2) {
|
||||
|
||||
// mView = new GodotView(getApplication(),io,use_gl2);
|
||||
// setContentView(mView);
|
||||
|
||||
layout = new FrameLayout(this);
|
||||
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
setContentView(layout);
|
||||
@ -273,7 +253,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
edittext.setView(mView);
|
||||
io.setEdit(edittext);
|
||||
|
||||
// Ad layout
|
||||
// Add layout
|
||||
adLayout = new RelativeLayout(this);
|
||||
adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
layout.addView(adLayout);
|
||||
@ -323,8 +303,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
byte[] len = new byte[4];
|
||||
int r = is.read(len);
|
||||
if (r < 4) {
|
||||
Log.d("XXX", "**ERROR** Wrong cmdline length.\n");
|
||||
Log.d("GODOT", "**ERROR** Wrong cmdline length.\n");
|
||||
Log.w(TAG, "Wrong cmdline length.\n");
|
||||
return new String[0];
|
||||
}
|
||||
int argc = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
|
||||
@ -334,12 +313,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
r = is.read(len);
|
||||
if (r < 4) {
|
||||
|
||||
Log.d("GODOT", "**ERROR** Wrong cmdline param lenght.\n");
|
||||
Log.w(TAG, "Wrong cmdline param length.\n");
|
||||
return new String[0];
|
||||
}
|
||||
int strlen = ((int)(len[3] & 0xFF) << 24) | ((int)(len[2] & 0xFF) << 16) | ((int)(len[1] & 0xFF) << 8) | ((int)(len[0] & 0xFF));
|
||||
if (strlen > 65535) {
|
||||
Log.d("GODOT", "**ERROR** Wrong command len\n");
|
||||
Log.w(TAG, "Wrong command length\n");
|
||||
return new String[0];
|
||||
}
|
||||
byte[] arg = new byte[strlen];
|
||||
@ -351,7 +330,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
return cmdline;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d("GODOT", "**ERROR** Exception " + e.getClass().getName() + ":" + e.getMessage());
|
||||
Log.w(TAG, "Exception " + e.getClass().getName() + ":" + e.getMessage());
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
@ -365,14 +344,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
String[] new_cmdline;
|
||||
int cll = 0;
|
||||
if (command_line != null) {
|
||||
Log.d("GODOT", "initializeGodot: command_line: is not null");
|
||||
Log.d(TAG, "initializeGodot: command_line: is not null");
|
||||
new_cmdline = new String[command_line.length + 2];
|
||||
cll = command_line.length;
|
||||
for (int i = 0; i < command_line.length; i++) {
|
||||
new_cmdline[i] = command_line[i];
|
||||
}
|
||||
} else {
|
||||
Log.d("GODOT", "initializeGodot: command_line: is null");
|
||||
Log.d(TAG, "initializeGodot: command_line: is null");
|
||||
new_cmdline = new String[2];
|
||||
}
|
||||
|
||||
@ -384,13 +363,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
io = new GodotIO(this);
|
||||
io.unique_id = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
|
||||
GodotLib.io = io;
|
||||
Log.d("GODOT", "command_line is null? " + ((command_line == null) ? "yes" : "no"));
|
||||
/*if(command_line != null){
|
||||
Log.d("GODOT", "Command Line:");
|
||||
for(int w=0;w <command_line.length;w++){
|
||||
Log.d("GODOT"," " + command_line[w]);
|
||||
}
|
||||
}*/
|
||||
Log.d(TAG, "command_line is null? " + ((command_line == null) ? "yes" : "no"));
|
||||
GodotLib.initialize(this, io.needsReloadHooks(), command_line, getAssets());
|
||||
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
|
||||
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||
@ -417,15 +390,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
|
||||
Log.d("GODOT", "** GODOT ACTIVITY CREATED HERE ***\n");
|
||||
Log.d(TAG, "** GODOT ACTIVITY CREATED HERE ***\n");
|
||||
|
||||
super.onCreate(icicle);
|
||||
_self = this;
|
||||
Window window = getWindow();
|
||||
//window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
|
||||
//check for apk expansion API
|
||||
if (true) {
|
||||
boolean md5mismatch = false;
|
||||
command_line = getCommandLine();
|
||||
@ -477,7 +448,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
|
||||
//check that environment is ok!
|
||||
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
Log.d("GODOT", "**ERROR! No media mounted!");
|
||||
Log.d(TAG, "**ERROR! No media mounted!");
|
||||
//show popup and die
|
||||
}
|
||||
|
||||
@ -493,25 +464,25 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
File f = new File(expansion_pack_path);
|
||||
|
||||
boolean pack_valid = true;
|
||||
Log.d("GODOT", "**PACK** - Path " + expansion_pack_path);
|
||||
Log.d(TAG, "**PACK** - Path " + expansion_pack_path);
|
||||
|
||||
if (!f.exists()) {
|
||||
|
||||
pack_valid = false;
|
||||
Log.d("GODOT", "**PACK** - File does not exist");
|
||||
Log.d(TAG, "**PACK** - File does not exist");
|
||||
|
||||
} else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
|
||||
Log.d("GODOT", "**PACK** - Expansion pack (obb) is corrupted");
|
||||
Log.d(TAG, "**PACK** - Expansion pack (obb) is corrupted");
|
||||
pack_valid = false;
|
||||
try {
|
||||
f.delete();
|
||||
} catch (Exception e) {
|
||||
Log.d("GODOT", "**PACK** - Error deleting corrupted expansion pack (obb)");
|
||||
Log.d(TAG, "**PACK** - Error deleting corrupted expansion pack (obb)");
|
||||
}
|
||||
}
|
||||
|
||||
if (!pack_valid) {
|
||||
Log.d("GODOT", "Pack Invalid, try re-downloading.");
|
||||
Log.d(TAG, "Pack Invalid, try re-downloading.");
|
||||
|
||||
Intent notifierIntent = new Intent(this, this.getClass());
|
||||
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
@ -522,15 +493,15 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
int startResult;
|
||||
try {
|
||||
Log.d("GODOT", "INITIALIZING DOWNLOAD");
|
||||
Log.d(TAG, "INITIALIZING DOWNLOAD");
|
||||
startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(
|
||||
getApplicationContext(),
|
||||
pendingIntent,
|
||||
GodotDownloaderService.class);
|
||||
Log.d("GODOT", "DOWNLOAD SERVICE FINISHED:" + startResult);
|
||||
Log.d(TAG, "DOWNLOAD SERVICE FINISHED:" + startResult);
|
||||
|
||||
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
|
||||
Log.d("GODOT", "DOWNLOAD REQUIRED");
|
||||
Log.d(TAG, "DOWNLOAD REQUIRED");
|
||||
// This is where you do set up to display the download
|
||||
// progress (next step)
|
||||
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this,
|
||||
@ -550,11 +521,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
return;
|
||||
} else {
|
||||
Log.d("GODOT", "NO DOWNLOAD REQUIRED");
|
||||
Log.d(TAG, "NO DOWNLOAD REQUIRED");
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
||||
Log.w(TAG, "Error downloading expansion package:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -563,8 +533,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
mCurrentIntent = getIntent();
|
||||
|
||||
initializeGodot();
|
||||
|
||||
// instanceSingleton( new GodotFacebook(this) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -645,11 +613,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
float[] adjustedValues = new float[3];
|
||||
final int axisSwap[][] = {
|
||||
{ 1, -1, 0, 1 }, // ROTATION_0
|
||||
{ 1, -1, 0, 1 }, // ROTATION_0
|
||||
{ -1, -1, 1, 0 }, // ROTATION_90
|
||||
{ -1, 1, 0, 1 }, // ROTATION_180
|
||||
{ 1, 1, 1, 0 }
|
||||
}; // ROTATION_270
|
||||
{ -1, 1, 0, 1 }, // ROTATION_180
|
||||
{ 1, 1, 1, 0 } // ROTATION_270
|
||||
};
|
||||
|
||||
final int[] as = axisSwap[displayRotation];
|
||||
adjustedValues[0] = (float)as[0] * event.values[as[2]];
|
||||
@ -680,22 +648,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
// Do something here if sensor accuracy changes.
|
||||
}
|
||||
|
||||
/*
|
||||
@Override public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
|
||||
if (event.getKeyCode()==KeyEvent.KEYCODE_BACK) {
|
||||
|
||||
System.out.printf("** BACK REQUEST!\n");
|
||||
|
||||
GodotLib.quit();
|
||||
return true;
|
||||
}
|
||||
System.out.printf("** OTHER KEY!\n");
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
boolean shouldQuit = true;
|
||||
@ -751,15 +703,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
}
|
||||
String md5str = hexString.toString();
|
||||
|
||||
//Log.d("GODOT","**PACK** - My MD5: "+hexString+" - APK md5: "+main_pack_md5);
|
||||
if (!md5str.equals(main_pack_md5)) {
|
||||
Log.d("GODOT", "**PACK MD5 MISMATCH???** - MD5 Found: " + md5str + " " + Integer.toString(md5str.length()) + " - MD5 Expected: " + main_pack_md5 + " " + Integer.toString(main_pack_md5.length()));
|
||||
Log.w(TAG, "Pack MD5 Mismatch - actual: " + md5str + " " + Integer.toString(md5str.length()) + " - expected: " + main_pack_md5 + " " + Integer.toString(main_pack_md5.length()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d("GODOT", "**PACK FAIL**");
|
||||
Log.w(TAG, "Pack failed");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -781,36 +732,26 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
arr[i * 3 + 2] = (int)event.getY(i);
|
||||
}
|
||||
|
||||
//System.out.printf("gaction: %d\n",event.getAction());
|
||||
switch (event.getAction() & MotionEvent.ACTION_MASK) {
|
||||
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
GodotLib.touch(0, 0, evcount, arr);
|
||||
//System.out.printf("action down at: %f,%f\n", event.getX(),event.getY());
|
||||
} break;
|
||||
case MotionEvent.ACTION_MOVE: {
|
||||
GodotLib.touch(1, 0, evcount, arr);
|
||||
//for(int i=0;i<event.getPointerCount();i++) {
|
||||
// System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
|
||||
//}
|
||||
} break;
|
||||
case MotionEvent.ACTION_POINTER_UP: {
|
||||
final int indexPointUp = event.getActionIndex();
|
||||
final int pointer_idx = event.getPointerId(indexPointUp);
|
||||
GodotLib.touch(4, pointer_idx, evcount, arr);
|
||||
//System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
|
||||
} break;
|
||||
case MotionEvent.ACTION_POINTER_DOWN: {
|
||||
int pointer_idx = event.getActionIndex();
|
||||
GodotLib.touch(3, pointer_idx, evcount, arr);
|
||||
//System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
|
||||
} break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
case MotionEvent.ACTION_UP: {
|
||||
GodotLib.touch(2, 0, evcount, arr);
|
||||
//for(int i=0;i<event.getPointerCount();i++) {
|
||||
// System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
|
||||
//}
|
||||
} break;
|
||||
}
|
||||
return true;
|
||||
@ -852,10 +793,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
return mPaymentsManager;
|
||||
}
|
||||
|
||||
// public void setPaymentsManager(PaymentsManager mPaymentsManager) {
|
||||
// this.mPaymentsManager = mPaymentsManager;
|
||||
// };
|
||||
|
||||
// Audio
|
||||
|
||||
/**
|
||||
@ -865,7 +802,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
*/
|
||||
@Override
|
||||
public void onDownloadStateChanged(int newState) {
|
||||
Log.d("GODOT", "onDownloadStateChanged:" + newState);
|
||||
Log.d(TAG, "onDownloadStateChanged:" + newState);
|
||||
setState(newState);
|
||||
boolean showDashboard = true;
|
||||
boolean showCellMessage = false;
|
||||
@ -873,7 +810,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
boolean indeterminate;
|
||||
switch (newState) {
|
||||
case IDownloaderClient.STATE_IDLE:
|
||||
Log.d("GODOT", "STATE IDLE");
|
||||
Log.d(TAG, "Download state changed to: STATE IDLE");
|
||||
// STATE_IDLE means the service is listening, so it's
|
||||
// safe to start making calls via mRemoteService.
|
||||
paused = false;
|
||||
@ -881,13 +818,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
break;
|
||||
case IDownloaderClient.STATE_CONNECTING:
|
||||
case IDownloaderClient.STATE_FETCHING_URL:
|
||||
Log.d("GODOT", "STATE CONNECTION / FETCHING URL");
|
||||
Log.d(TAG, "Download state changed to: STATE CONNECTION / FETCHING URL");
|
||||
showDashboard = true;
|
||||
paused = false;
|
||||
indeterminate = true;
|
||||
break;
|
||||
case IDownloaderClient.STATE_DOWNLOADING:
|
||||
Log.d("GODOT", "STATE DOWNLOADING");
|
||||
Log.d(TAG, "Download state changed to: STATE DOWNLOADING");
|
||||
paused = false;
|
||||
showDashboard = true;
|
||||
indeterminate = false;
|
||||
@ -897,14 +834,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
case IDownloaderClient.STATE_FAILED:
|
||||
case IDownloaderClient.STATE_FAILED_FETCHING_URL:
|
||||
case IDownloaderClient.STATE_FAILED_UNLICENSED:
|
||||
Log.d("GODOT", "MANY TYPES OF FAILING");
|
||||
Log.d(TAG, "Download state changed to: MANY TYPES OF FAILING");
|
||||
paused = true;
|
||||
showDashboard = false;
|
||||
indeterminate = false;
|
||||
break;
|
||||
case IDownloaderClient.STATE_PAUSED_NEED_CELLULAR_PERMISSION:
|
||||
case IDownloaderClient.STATE_PAUSED_WIFI_DISABLED_NEED_CELLULAR_PERMISSION:
|
||||
Log.d("GODOT", "PAUSED FOR SOME STUPID REASON");
|
||||
Log.d(TAG, "Download state changed to: PAUSED FOR NETWORK PERMISSION NEEDED");
|
||||
showDashboard = false;
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
@ -912,26 +849,26 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
break;
|
||||
|
||||
case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
|
||||
Log.d("GODOT", "PAUSED BY STUPID USER");
|
||||
Log.d(TAG, "Download state changed to: PAUSED BY USER");
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
break;
|
||||
case IDownloaderClient.STATE_PAUSED_ROAMING:
|
||||
case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
|
||||
Log.d("GODOT", "PAUSED BY ROAMING WTF!?");
|
||||
Log.d(TAG, "Download state changed to: PAUSED BY ROAMING");
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
break;
|
||||
case IDownloaderClient.STATE_COMPLETED:
|
||||
Log.d("GODOT", "COMPLETED");
|
||||
Log.d(TAG, "Download state changed to: COMPLETED");
|
||||
showDashboard = false;
|
||||
paused = false;
|
||||
indeterminate = false;
|
||||
// validateXAPKZipFiles();
|
||||
initializeGodot();
|
||||
return;
|
||||
default:
|
||||
Log.d("GODOT", "DEFAULT ????");
|
||||
Log.w(TAG, "Invalid download state");
|
||||
|
||||
paused = true;
|
||||
indeterminate = true;
|
||||
showDashboard = true;
|
||||
|
@ -45,15 +45,15 @@ import android.util.Log;
|
||||
* <receiver android:name=".GodotDownloaderAlarmReceiver"/>
|
||||
*/
|
||||
public class GodotDownloaderAlarmReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "GodotDownloaderAlarmReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.d("GODOT", "Alarma recivida");
|
||||
try {
|
||||
DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent, GodotDownloaderService.class);
|
||||
} catch (NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
Log.d("GODOT", "Exception: " + e.getClass().getName() + ":" + e.getMessage());
|
||||
Log.d(TAG, "Exception: " + e.getClass().getName() + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ import com.google.android.vending.expansion.downloader.impl.DownloaderService;
|
||||
* DownloaderService from the Downloader library.
|
||||
*/
|
||||
public class GodotDownloaderService extends DownloaderService {
|
||||
private static final String TAG = "GodotDownloaderService";
|
||||
|
||||
// stuff for LVL -- MODIFY FOR YOUR APPLICATION!
|
||||
private static final String BASE64_PUBLIC_KEY = "REPLACE THIS WITH YOUR PUBLIC KEY";
|
||||
// used by the preference obfuscater
|
||||
@ -55,10 +57,8 @@ public class GodotDownloaderService extends DownloaderService {
|
||||
@Override
|
||||
public String getPublicKey() {
|
||||
SharedPreferences prefs = getApplicationContext().getSharedPreferences("app_data_keys", Context.MODE_PRIVATE);
|
||||
Log.d("GODOT", "getting public key:" + prefs.getString("store_public_key", null));
|
||||
Log.d(TAG, "getting public key:" + prefs.getString("store_public_key", null));
|
||||
return prefs.getString("store_public_key", null);
|
||||
|
||||
// return BASE64_PUBLIC_KEY;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ public class GodotDownloaderService extends DownloaderService {
|
||||
*/
|
||||
@Override
|
||||
public String getAlarmReceiverClassName() {
|
||||
Log.d("GODOT", "getAlarmReceiverClassName()");
|
||||
Log.d(TAG, "getAlarmReceiverClassName()");
|
||||
return GodotDownloaderAlarmReceiver.class.getName();
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ import org.godotengine.godot.input.*;
|
||||
|
||||
public class GodotIO {
|
||||
|
||||
private static String TAG = "GodotIO";
|
||||
|
||||
AssetManager am;
|
||||
Godot activity;
|
||||
GodotEditText edit;
|
||||
@ -103,7 +105,7 @@ public class GodotIO {
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
//System.out.printf("Exception on file_open: %s\n",path);
|
||||
// Cannot open file
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -111,7 +113,7 @@ public class GodotIO {
|
||||
ad.len = ad.is.available();
|
||||
} catch (Exception e) {
|
||||
|
||||
System.out.printf("Exception availabling on file_open: %s\n", path);
|
||||
Log.w(TAG, "Exception availabling on file_open: " + path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -125,7 +127,8 @@ public class GodotIO {
|
||||
public int file_get_size(int id) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_get_size: Invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_get_size: Invalid file id: " + id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -134,10 +137,12 @@ public class GodotIO {
|
||||
public void file_seek(int id, int bytes) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_get_size: Invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_get_size: Invalid file id: " + id);
|
||||
return;
|
||||
}
|
||||
//seek sucks
|
||||
|
||||
// More efficient than "seek" built-in function
|
||||
AssetData ad = streams.get(id);
|
||||
if (bytes > ad.len)
|
||||
bytes = ad.len;
|
||||
@ -166,7 +171,7 @@ public class GodotIO {
|
||||
ad.eof = false;
|
||||
} catch (IOException e) {
|
||||
|
||||
System.out.printf("Exception on file_seek: %s\n", e);
|
||||
Log.w(TAG, "Exception on file_seek: " + e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -174,7 +179,8 @@ public class GodotIO {
|
||||
public int file_tell(int id) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_read: Can't tell eof for invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_read: Can't tell eof for invalid file id: " + id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -184,7 +190,8 @@ public class GodotIO {
|
||||
public boolean file_eof(int id) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_read: Can't check eof for invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_read: Can't check eof for invalid file id: " + id);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -195,7 +202,8 @@ public class GodotIO {
|
||||
public byte[] file_read(int id, int bytes) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_read: Can't read invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_read: Can't read invalid file id: " + id);
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@ -218,7 +226,7 @@ public class GodotIO {
|
||||
r = ad.is.read(buf1);
|
||||
} catch (IOException e) {
|
||||
|
||||
System.out.printf("Exception on file_read: %s\n", e);
|
||||
Log.w(TAG, "Exception on file_read: " + e);
|
||||
return new byte[bytes];
|
||||
}
|
||||
|
||||
@ -243,7 +251,8 @@ public class GodotIO {
|
||||
public void file_close(int id) {
|
||||
|
||||
if (!streams.containsKey(id)) {
|
||||
System.out.printf("file_close: Can't close invalid file id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "file_close: Can't close invalid file id: " + id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -280,7 +289,7 @@ public class GodotIO {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
System.out.printf("Exception on dir_open: %s\n", e);
|
||||
Log.w(TAG, "Exception on dir_open: " + e);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -293,7 +302,7 @@ public class GodotIO {
|
||||
|
||||
public boolean dir_is_dir(int id) {
|
||||
if (!dirs.containsKey(id)) {
|
||||
System.out.printf("dir_next: invalid dir id: %d\n", id);
|
||||
Log.w(TAG, "dir_next: invalid dir id: " + id);
|
||||
return false;
|
||||
}
|
||||
AssetDir ad = dirs.get(id);
|
||||
@ -320,7 +329,8 @@ public class GodotIO {
|
||||
public String dir_next(int id) {
|
||||
|
||||
if (!dirs.containsKey(id)) {
|
||||
System.out.printf("dir_next: invalid dir id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "dir_next: invalid dir id: " + id);
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -339,7 +349,8 @@ public class GodotIO {
|
||||
public void dir_close(int id) {
|
||||
|
||||
if (!dirs.containsKey(id)) {
|
||||
System.out.printf("dir_close: invalid dir id: %d\n", id);
|
||||
|
||||
Log.w(TAG, "dir_next: invalid dir id: " + id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -368,9 +379,7 @@ public class GodotIO {
|
||||
int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
|
||||
int frameSize = 4;
|
||||
|
||||
System.out.printf("audioInit: initializing audio:\n");
|
||||
|
||||
//Log.v("Godot", "Godot audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer");
|
||||
Log.d(TAG, "audioInit: initializing audio: ");
|
||||
|
||||
// Let the user pick a larger buffer if they really want -- but ye
|
||||
// gods they probably shouldn't, the minimums are horrifyingly high
|
||||
@ -396,7 +405,7 @@ public class GodotIO {
|
||||
}
|
||||
});
|
||||
|
||||
// I'd take REALTIME if I could get it!
|
||||
// Max priority
|
||||
mAudioThread.setPriority(Thread.MAX_PRIORITY);
|
||||
mAudioThread.start();
|
||||
}
|
||||
@ -410,10 +419,10 @@ public class GodotIO {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
// Nom nom
|
||||
// Action interrupted, nothing to do
|
||||
}
|
||||
} else {
|
||||
Log.w("Godot", "Godot audio: error return from write(short)");
|
||||
Log.w(TAG, "Godot audio: error return from write(short)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -424,11 +433,10 @@ public class GodotIO {
|
||||
try {
|
||||
mAudioThread.join();
|
||||
} catch (Exception e) {
|
||||
Log.v("Godot", "Problem stopping audio thread: " + e);
|
||||
Log.v(TAG, "Problem stopping audio thread: " + e);
|
||||
}
|
||||
mAudioThread = null;
|
||||
|
||||
//Log.v("Godot", "Finished waiting for audio thread");
|
||||
}
|
||||
|
||||
if (mAudioTrack != null) {
|
||||
@ -452,11 +460,11 @@ public class GodotIO {
|
||||
public int openURI(String p_uri) {
|
||||
|
||||
try {
|
||||
Log.v("MyApp", "TRYING TO OPEN URI: " + p_uri);
|
||||
Log.v(TAG, "Trying to open uri: " + p_uri);
|
||||
String path = p_uri;
|
||||
String type = "";
|
||||
if (path.startsWith("/")) {
|
||||
//absolute path to filesystem, prepend file://
|
||||
// Absolute path to filesystem, prepend file://
|
||||
path = "file://" + path;
|
||||
if (p_uri.endsWith(".png") || p_uri.endsWith(".jpg") || p_uri.endsWith(".gif") || p_uri.endsWith(".webp")) {
|
||||
|
||||
@ -508,8 +516,6 @@ public class GodotIO {
|
||||
if (edit != null)
|
||||
edit.showKeyboard(p_existing_text);
|
||||
|
||||
//InputMethodManager inputMgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
//inputMgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
};
|
||||
|
||||
public void hideKeyboard() {
|
||||
@ -567,7 +573,7 @@ public class GodotIO {
|
||||
mediaPlayer.prepare();
|
||||
mediaPlayer.start();
|
||||
} catch (IOException e) {
|
||||
System.out.println("IOError while playing video");
|
||||
Log.w(TAG, "IOError while playing video");
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,7 +611,6 @@ public class GodotIO {
|
||||
String what = "";
|
||||
switch (idx) {
|
||||
case SYSTEM_DIR_DESKTOP: {
|
||||
//what=Environment.DIRECTORY_DOCUMENTS;
|
||||
what = Environment.DIRECTORY_DOWNLOADS;
|
||||
} break;
|
||||
case SYSTEM_DIR_DCIM: {
|
||||
@ -614,7 +619,6 @@ public class GodotIO {
|
||||
} break;
|
||||
case SYSTEM_DIR_DOCUMENTS: {
|
||||
what = Environment.DIRECTORY_DOWNLOADS;
|
||||
//what=Environment.DIRECTORY_DOCUMENTS;
|
||||
} break;
|
||||
case SYSTEM_DIR_DOWNLOADS: {
|
||||
what = Environment.DIRECTORY_DOWNLOADS;
|
||||
|
@ -30,7 +30,6 @@
|
||||
package org.godotengine.godot;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import org.godotengine.godot.payments.PaymentsManager;
|
||||
import org.json.JSONException;
|
||||
@ -92,7 +91,6 @@ public class GodotPaymentV3 extends Godot.SingletonBase {
|
||||
}
|
||||
|
||||
public void callbackSuccessProductMassConsumed(String ticket, String signature, String sku) {
|
||||
Log.d(this.getClass().getName(), "callbackSuccessProductMassConsumed > " + ticket + "," + signature + "," + sku);
|
||||
GodotLib.calldeferred(purchaseCallbackId, "consume_success", new Object[] { ticket, signature, sku });
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
||||
};
|
||||
|
||||
int source = event.getSource();
|
||||
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
|
||||
|
||||
if ((source & InputDevice.SOURCE_JOYSTICK) != 0 || (source & InputDevice.SOURCE_DPAD) != 0 || (source & InputDevice.SOURCE_GAMEPAD) != 0) {
|
||||
|
||||
@ -287,8 +286,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
||||
int button = get_godot_button(keyCode);
|
||||
int device = find_joy_device(event.getDeviceId());
|
||||
|
||||
//Log.e(TAG, String.format("joy button down! button %x, %d, device %d", keyCode, button, device));
|
||||
|
||||
GodotLib.joybutton(device, button, true);
|
||||
return true;
|
||||
|
||||
@ -309,14 +306,12 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
||||
for (int i = 0; i < joy.axes.size(); i++) {
|
||||
InputDevice.MotionRange range = joy.axes.get(i);
|
||||
float value = (event.getAxisValue(range.getAxis()) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
|
||||
//Log.e(TAG, String.format("axis event: %d, value %f", i, value));
|
||||
GodotLib.joyaxis(device_id, i, value);
|
||||
}
|
||||
|
||||
for (int i = 0; i < joy.hats.size(); i += 2) {
|
||||
int hatX = Math.round(event.getAxisValue(joy.hats.get(i).getAxis()));
|
||||
int hatY = Math.round(event.getAxisValue(joy.hats.get(i + 1).getAxis()));
|
||||
//Log.e(TAG, String.format("HAT EVENT %d, %d", hatX, hatY));
|
||||
GodotLib.joyhat(device_id, hatX, hatY);
|
||||
}
|
||||
return true;
|
||||
@ -598,7 +593,6 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
||||
if (egl.eglGetConfigAttrib(display, config, attribute, value)) {
|
||||
Log.w(TAG, String.format(" %s: %d\n", name, value[0]));
|
||||
} else {
|
||||
// Log.w(TAG, String.format(" %s: failed\n", name));
|
||||
while (egl.eglGetError() != EGL10.EGL_SUCCESS)
|
||||
;
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) {
|
||||
//Log.d(TAG, "beforeTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",after: " + after);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
||||
@ -95,7 +94,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
|
||||
@Override
|
||||
public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) {
|
||||
//Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before);
|
||||
|
||||
for (int i = start; i < start + count; i++) {
|
||||
int ch = pCharSequence.charAt(i);
|
||||
@ -111,11 +109,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
for (int i = this.mOriginText.length(); i > 0; i--) {
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, true);
|
||||
GodotLib.key(KeyEvent.KEYCODE_DEL, 0, false);
|
||||
/*
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "deleteBackward");
|
||||
}
|
||||
*/
|
||||
}
|
||||
String text = pTextView.getText().toString();
|
||||
|
||||
@ -133,11 +126,6 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
GodotLib.key(0, ch, true);
|
||||
GodotLib.key(0, ch, false);
|
||||
}
|
||||
/*
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.d(TAG, "insertText(" + insertText + ")");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if (pActionID == EditorInfo.IME_ACTION_DONE) {
|
||||
@ -145,12 +133,4 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================
|
||||
// Methods
|
||||
// ===========================================================
|
||||
|
||||
// ===========================================================
|
||||
// Inner and Anonymous Classes
|
||||
// ===========================================================
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
||||
public class InputManagerV9 implements InputManagerCompat {
|
||||
private static final String LOG_TAG = "InputManagerV9";
|
||||
private static final String TAG = "InputManagerV9";
|
||||
private static final int MESSAGE_TEST_FOR_DISCONNECT = 101;
|
||||
private static final long CHECK_ELAPSED_TIME = 3000L;
|
||||
|
||||
@ -175,7 +175,7 @@ public class InputManagerV9 implements InputManagerCompat {
|
||||
mListener.onInputDeviceRemoved(mId);
|
||||
break;
|
||||
default:
|
||||
Log.e(LOG_TAG, "Unknown Message Type");
|
||||
Log.e(TAG, "Unknown Message Type");
|
||||
break;
|
||||
}
|
||||
// dump this runnable back in the queue
|
||||
|
@ -47,19 +47,15 @@ abstract public class ConsumeTask {
|
||||
}
|
||||
|
||||
public void consume(final String sku) {
|
||||
// Log.d("XXX", "Consuming product " + sku);
|
||||
PaymentsCache pc = new PaymentsCache(context);
|
||||
Boolean isBlocked = pc.getConsumableFlag("block", sku);
|
||||
String _token = pc.getConsumableValue("token", sku);
|
||||
// Log.d("XXX", "token " + _token);
|
||||
if (!isBlocked && _token == null) {
|
||||
// _token = "inapp:"+context.getPackageName()+":android.test.purchased";
|
||||
// Log.d("XXX", "Consuming product " + sku + " with token " + _token);
|
||||
// Consuming product, nothing to do
|
||||
} else if (!isBlocked) {
|
||||
// Log.d("XXX", "It is not blocked ¿?");
|
||||
return;
|
||||
} else if (_token == null) {
|
||||
// Log.d("XXX", "No token available");
|
||||
// Token is not available
|
||||
this.error("No token for sku:" + sku);
|
||||
return;
|
||||
}
|
||||
@ -69,9 +65,8 @@ abstract public class ConsumeTask {
|
||||
@Override
|
||||
protected String doInBackground(String... params) {
|
||||
try {
|
||||
// Log.d("XXX", "Requesting to release item.");
|
||||
// Requesting to release item
|
||||
int response = mService.consumePurchase(3, context.getPackageName(), token);
|
||||
// Log.d("XXX", "release response code: " + response);
|
||||
if (response == 0 || response == 8) {
|
||||
return null;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
abstract public class GenericConsumeTask extends AsyncTask<String, String, String> {
|
||||
|
||||
private static String TAG = "GenericConsumeTask";
|
||||
private Context context;
|
||||
private IInAppBillingService mService;
|
||||
|
||||
@ -58,14 +58,12 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin
|
||||
@Override
|
||||
protected String doInBackground(String... params) {
|
||||
try {
|
||||
// Log.d("godot", "Requesting to consume an item with token ." + token);
|
||||
int response = mService.consumePurchase(3, context.getPackageName(), token);
|
||||
// Log.d("godot", "consumePurchase response: " + response);
|
||||
if (response == 0 || response == 8) {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("godot", "Error " + e.getClass().getName() + ":" + e.getMessage());
|
||||
Log.d(TAG, "Error " + e.getClass().getName() + ":" + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -56,28 +56,16 @@ abstract public class HandlePurchaseTask {
|
||||
}
|
||||
|
||||
public void handlePurchaseRequest(int resultCode, Intent data) {
|
||||
// Log.d("XXX", "Handling purchase response");
|
||||
// int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
|
||||
PaymentsCache pc = new PaymentsCache(context);
|
||||
|
||||
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
|
||||
// Log.d("XXX", "Purchase data:" + purchaseData);
|
||||
String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
|
||||
//Log.d("XXX", "Purchase signature:" + dataSignature);
|
||||
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
||||
try {
|
||||
// Log.d("SARLANGA", purchaseData);
|
||||
|
||||
JSONObject jo = new JSONObject(purchaseData);
|
||||
// String sku = jo.getString("productId");
|
||||
// alert("You have bought the " + sku + ". Excellent choice, aventurer!");
|
||||
// String orderId = jo.getString("orderId");
|
||||
// String packageName = jo.getString("packageName");
|
||||
String productId = jo.getString("productId");
|
||||
// Long purchaseTime = jo.getLong("purchaseTime");
|
||||
// Integer state = jo.getInt("purchaseState");
|
||||
String developerPayload = jo.getString("developerPayload");
|
||||
String purchaseToken = jo.getString("purchaseToken");
|
||||
|
||||
@ -85,7 +73,7 @@ abstract public class HandlePurchaseTask {
|
||||
error("Untrusted callback");
|
||||
return;
|
||||
}
|
||||
// Log.d("XXX", "Este es el product ID:" + productId);
|
||||
|
||||
pc.setConsumableValue("ticket_signautre", productId, dataSignature);
|
||||
pc.setConsumableValue("ticket", productId, purchaseData);
|
||||
pc.setConsumableFlag("block", productId, true);
|
||||
|
@ -58,14 +58,12 @@ public class PaymentsCache {
|
||||
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPref.edit();
|
||||
editor.putString(sku, value);
|
||||
// Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public String getConsumableValue(String set, String sku) {
|
||||
SharedPreferences sharedPref = context.getSharedPreferences(
|
||||
"consumables_" + set, Context.MODE_PRIVATE);
|
||||
// Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
|
||||
return sharedPref.getString(sku, null);
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ import java.util.Arrays;
|
||||
|
||||
public class PaymentsManager {
|
||||
|
||||
private static String TAG = "PaymentsManager";
|
||||
public static final int BILLING_RESPONSE_RESULT_OK = 0;
|
||||
public static final int REQUEST_CODE_FOR_PURCHASE = 0x1001;
|
||||
private static boolean auto_consume = true;
|
||||
@ -146,13 +147,13 @@ public class PaymentsManager {
|
||||
|
||||
@Override
|
||||
protected void error(String message) {
|
||||
Log.d("godot", "consumeUnconsumedPurchases :" + message);
|
||||
Log.d(TAG, "consumeUnconsumedPurchases :" + message);
|
||||
godotPaymentV3.callbackFailConsume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notRequired() {
|
||||
Log.d("godot", "callbackSuccessNoUnconsumedPurchases :");
|
||||
Log.d(TAG, "callbackSuccessNoUnconsumedPurchases :");
|
||||
godotPaymentV3.callbackSuccessNoUnconsumedPurchases();
|
||||
}
|
||||
}
|
||||
@ -198,10 +199,10 @@ public class PaymentsManager {
|
||||
}
|
||||
}
|
||||
continueToken = bundle.getString("INAPP_CONTINUATION_TOKEN");
|
||||
Log.d("godot", "continue token = " + continueToken);
|
||||
Log.d(TAG, "continue token = " + continueToken);
|
||||
} while (!TextUtils.isEmpty(continueToken));
|
||||
} catch (Exception e) {
|
||||
Log.d("godot", "Error requesting purchased products:" + e.getClass().getName() + ":" + e.getMessage());
|
||||
Log.d(TAG, "Error requesting purchased products:" + e.getClass().getName() + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +409,7 @@ public class PaymentsManager {
|
||||
ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
|
||||
|
||||
for (String thisResponse : responseList) {
|
||||
Log.d("godot", "response = " + thisResponse);
|
||||
Log.d(TAG, "response = " + thisResponse);
|
||||
godotPaymentV3.addSkuDetail(thisResponse);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
|
@ -49,6 +49,8 @@ import android.util.Log;
|
||||
|
||||
abstract public class PurchaseTask {
|
||||
|
||||
private static String TAG = "PurchaseTask";
|
||||
|
||||
private Activity context;
|
||||
|
||||
private IInAppBillingService mService;
|
||||
@ -60,21 +62,16 @@ abstract public class PurchaseTask {
|
||||
private boolean isLooping = false;
|
||||
|
||||
public void purchase(final String sku, final String transactionId) {
|
||||
Log.d("XXX", "Starting purchase for: " + sku);
|
||||
Log.d(TAG, "Starting purchase for: " + sku);
|
||||
PaymentsCache pc = new PaymentsCache(context);
|
||||
Boolean isBlocked = pc.getConsumableFlag("block", sku);
|
||||
// if(isBlocked){
|
||||
// Log.d("XXX", "Is awaiting payment confirmation");
|
||||
// error("Awaiting payment confirmation");
|
||||
// return;
|
||||
// }
|
||||
|
||||
final String hash = transactionId;
|
||||
|
||||
Bundle buyIntentBundle;
|
||||
try {
|
||||
buyIntentBundle = mService.getBuyIntent(3, context.getApplicationContext().getPackageName(), sku, "inapp", hash);
|
||||
} catch (RemoteException e) {
|
||||
// Log.d("XXX", "Error: " + e.getMessage());
|
||||
error(e.getMessage());
|
||||
return;
|
||||
}
|
||||
@ -87,7 +84,7 @@ abstract public class PurchaseTask {
|
||||
} else if (rc instanceof Long) {
|
||||
responseCode = (int)((Long)rc).longValue();
|
||||
}
|
||||
// Log.d("XXX", "Buy intent response code: " + responseCode);
|
||||
|
||||
if (responseCode == 1 || responseCode == 3 || responseCode == 4) {
|
||||
canceled();
|
||||
return;
|
||||
@ -100,13 +97,6 @@ abstract public class PurchaseTask {
|
||||
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
|
||||
pc.setConsumableValue("validation_hash", sku, hash);
|
||||
try {
|
||||
if (context == null) {
|
||||
// Log.d("XXX", "No context!");
|
||||
}
|
||||
if (pendingIntent == null) {
|
||||
// Log.d("XXX", "No pending intent");
|
||||
}
|
||||
// Log.d("XXX", "Starting activity for purchase!");
|
||||
context.startIntentSenderForResult(
|
||||
pendingIntent.getIntentSender(),
|
||||
PaymentsManager.REQUEST_CODE_FOR_PURCHASE,
|
||||
|
@ -46,6 +46,7 @@ import android.util.Log;
|
||||
|
||||
abstract public class ReleaseAllConsumablesTask {
|
||||
|
||||
private static final String TAG = "ReleaseAllConsumablesTask";
|
||||
private Context context;
|
||||
private IInAppBillingService mService;
|
||||
|
||||
@ -56,13 +57,12 @@ abstract public class ReleaseAllConsumablesTask {
|
||||
|
||||
public void consumeItAll() {
|
||||
try {
|
||||
// Log.d("godot", "consumeItall for " + context.getPackageName());
|
||||
Bundle bundle = mService.getPurchases(3, context.getPackageName(), "inapp", null);
|
||||
|
||||
// TODO:
|
||||
// Check if this loop is useful and remove it if not
|
||||
for (String key : bundle.keySet()) {
|
||||
Object value = bundle.get(key);
|
||||
// Log.d("godot", String.format("%s %s (%s)", key,
|
||||
// value.toString(), value.getClass().getName()));
|
||||
}
|
||||
|
||||
if (bundle.getInt("RESPONSE_CODE") == 0) {
|
||||
@ -71,12 +71,10 @@ abstract public class ReleaseAllConsumablesTask {
|
||||
final ArrayList<String> mySignatures = bundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
|
||||
|
||||
if (myPurchases == null || myPurchases.size() == 0) {
|
||||
// Log.d("godot", "No purchases!");
|
||||
notRequired();
|
||||
return;
|
||||
}
|
||||
|
||||
// Log.d("godot", "# products to be consumed:" + myPurchases.size());
|
||||
for (int i = 0; i < myPurchases.size(); i++) {
|
||||
|
||||
try {
|
||||
@ -85,7 +83,6 @@ abstract public class ReleaseAllConsumablesTask {
|
||||
String sku = inappPurchaseData.getString("productId");
|
||||
String token = inappPurchaseData.getString("purchaseToken");
|
||||
String signature = mySignatures.get(i);
|
||||
// Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
|
||||
new GenericConsumeTask(context, mService, sku, receipt, signature, token) {
|
||||
|
||||
@Override
|
||||
@ -100,7 +97,7 @@ abstract public class ReleaseAllConsumablesTask {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("godot", "Error releasing products:" + e.getClass().getName() + ":" + e.getMessage());
|
||||
Log.d(TAG, "Error releasing products:" + e.getClass().getName() + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,14 +79,9 @@ abstract public class ValidateTask {
|
||||
param.put("ticket", pc.getConsumableValue("ticket", sku));
|
||||
param.put("purchaseToken", pc.getConsumableValue("token", sku));
|
||||
param.put("sku", sku);
|
||||
// Log.d("XXX", "Haciendo request a " + url);
|
||||
// Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku));
|
||||
// Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku));
|
||||
// Log.d("XXX", "sku: " + sku);
|
||||
param.put("package", context.getApplicationContext().getPackageName());
|
||||
HttpRequester requester = new HttpRequester();
|
||||
String jsonResponse = requester.post(param);
|
||||
// Log.d("XXX", "Validation response:\n"+jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
|
@ -73,17 +73,19 @@ import android.util.Log;
|
||||
*/
|
||||
public class HttpRequester {
|
||||
|
||||
private static String TAG = "HttpRequester";
|
||||
|
||||
private Context context;
|
||||
private static final int TTL = 600000; // 10 minutos
|
||||
private static final int TTL = 600000; // 10 minutes
|
||||
private long cttl = 0;
|
||||
|
||||
public HttpRequester() {
|
||||
// Log.d("XXX", "Creando http request sin contexto");
|
||||
// Creating a HTTP request without context, nothing to do
|
||||
}
|
||||
|
||||
public HttpRequester(Context context) {
|
||||
// Creating a HTTP request with context
|
||||
this.context = context;
|
||||
// Log.d("XXX", "Creando http request con contexto");
|
||||
}
|
||||
|
||||
public String post(RequestParams params) {
|
||||
@ -99,7 +101,7 @@ public class HttpRequester {
|
||||
public String get(RequestParams params) {
|
||||
String response = getResponseFromCache(params.getUrl());
|
||||
if (response == null) {
|
||||
// Log.d("XXX", "Cache miss!");
|
||||
// Cache miss, trying to get data
|
||||
HttpGet httpget = new HttpGet(params.getUrl());
|
||||
long timeInit = new Date().getTime();
|
||||
response = request(httpget);
|
||||
@ -111,14 +113,13 @@ public class HttpRequester {
|
||||
saveResponseIntoCache(params.getUrl(), response);
|
||||
}
|
||||
}
|
||||
Log.d("XXX", "Req: " + params.getUrl());
|
||||
Log.d("XXX", "Resp: " + response);
|
||||
Log.d(TAG, "Req: " + params.getUrl());
|
||||
Log.d(TAG, "Resp: " + response);
|
||||
return response;
|
||||
}
|
||||
|
||||
private String request(HttpUriRequest request) {
|
||||
// Log.d("XXX", "Haciendo request a: " + request.getURI() );
|
||||
Log.d("PPP", "Haciendo request a: " + request.getURI());
|
||||
Log.d(TAG, "Sending request to uri: " + request.getURI());
|
||||
long init = new Date().getTime();
|
||||
HttpClient httpclient = getNewHttpClient();
|
||||
HttpParams httpParameters = httpclient.getParams();
|
||||
@ -127,21 +128,19 @@ public class HttpRequester {
|
||||
HttpConnectionParams.setTcpNoDelay(httpParameters, true);
|
||||
try {
|
||||
HttpResponse response = httpclient.execute(request);
|
||||
Log.d("PPP", "Fin de request (" + (new Date().getTime() - init) + ") a: " + request.getURI());
|
||||
// Log.d("XXX1", "Status:" + response.getStatusLine().toString());
|
||||
Log.d(TAG, "Fin de request (" + (new Date().getTime() - init) + ") a: " + request.getURI());
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
String strResponse = EntityUtils.toString(response.getEntity());
|
||||
// Log.d("XXX2", strResponse);
|
||||
return strResponse;
|
||||
} else {
|
||||
Log.d("XXX3", "Response status code:" + response.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(response.getEntity()));
|
||||
Log.d(TAG, "Response status code:" + response.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(response.getEntity()));
|
||||
return null;
|
||||
}
|
||||
|
||||
} catch (ClientProtocolException e) {
|
||||
Log.d("XXX3", e.getMessage());
|
||||
Log.d(TAG, e.getMessage());
|
||||
} catch (IOException e) {
|
||||
Log.d("XXX4", e.getMessage());
|
||||
Log.d(TAG, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -192,7 +191,6 @@ public class HttpRequester {
|
||||
|
||||
public void saveResponseIntoCache(String request, String response) {
|
||||
if (context == null) {
|
||||
// Log.d("XXX", "No context, cache failed!");
|
||||
return;
|
||||
}
|
||||
SharedPreferences sharedPref = context.getSharedPreferences("http_get_cache", Context.MODE_PRIVATE);
|
||||
@ -204,13 +202,13 @@ public class HttpRequester {
|
||||
|
||||
public String getResponseFromCache(String request) {
|
||||
if (context == null) {
|
||||
Log.d("XXX", "No context, cache miss");
|
||||
Log.d(TAG, "No context, cache miss");
|
||||
return null;
|
||||
}
|
||||
SharedPreferences sharedPref = context.getSharedPreferences("http_get_cache", Context.MODE_PRIVATE);
|
||||
long ttl = getResponseTtl(request);
|
||||
if (ttl == 0l || (new Date().getTime() - ttl) > 0l) {
|
||||
Log.d("XXX", "Cache invalid ttl:" + ttl + " vs now:" + new Date().getTime());
|
||||
Log.d(TAG, "Cache invalid ttl:" + ttl + " vs now:" + new Date().getTime());
|
||||
return null;
|
||||
}
|
||||
return sharedPref.getString("request_" + Crypt.md5(request), null);
|
||||
|
@ -553,7 +553,6 @@ bool JavaClassWrapper::_get_type_sig(JNIEnv *env, jobject obj, uint32_t &sig, St
|
||||
|
||||
jstring name2 = (jstring)env->CallObjectMethod(obj, Class_getName);
|
||||
String str_type = env->GetStringUTFChars(name2, NULL);
|
||||
print_line("name: " + str_type);
|
||||
env->DeleteLocalRef(name2);
|
||||
uint32_t t = 0;
|
||||
|
||||
@ -1116,7 +1115,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
print_line("Method Can't be bound (unsupported arguments): " + p_class + "::" + str_method);
|
||||
print_line("Method can't be bound (unsupported arguments): " + p_class + "::" + str_method);
|
||||
env->DeleteLocalRef(obj);
|
||||
env->DeleteLocalRef(param_types);
|
||||
continue;
|
||||
@ -1129,7 +1128,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
String strsig;
|
||||
uint32_t sig = 0;
|
||||
if (!_get_type_sig(env, return_type, sig, strsig)) {
|
||||
print_line("Method Can't be bound (unsupported return type): " + p_class + "::" + str_method);
|
||||
print_line("Method can't be bound (unsupported return type): " + p_class + "::" + str_method);
|
||||
env->DeleteLocalRef(obj);
|
||||
env->DeleteLocalRef(param_types);
|
||||
env->DeleteLocalRef(return_type);
|
||||
@ -1139,8 +1138,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
signature += strsig;
|
||||
mi.return_type = sig;
|
||||
|
||||
print_line("METHOD: " + str_method + " SIG: " + signature + " static: " + itos(mi._static));
|
||||
|
||||
bool discard = false;
|
||||
|
||||
for (List<JavaClass::MethodInfo>::Element *E = java_class->methods[str_method].front(); E; E = E->next()) {
|
||||
@ -1172,11 +1169,9 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
|
||||
if (new_likeliness > existing_likeliness) {
|
||||
java_class->methods[str_method].erase(E);
|
||||
print_line("replace old");
|
||||
break;
|
||||
} else {
|
||||
discard = true;
|
||||
print_line("old is better");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1194,9 +1189,6 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
env->DeleteLocalRef(obj);
|
||||
env->DeleteLocalRef(param_types);
|
||||
env->DeleteLocalRef(return_type);
|
||||
|
||||
//args[i] = _jobject_to_variant(env, obj);
|
||||
// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
|
||||
};
|
||||
|
||||
env->DeleteLocalRef(methods);
|
||||
@ -1213,7 +1205,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String &p_class) {
|
||||
jstring name = (jstring)env->CallObjectMethod(obj, Field_getName);
|
||||
String str_field = env->GetStringUTFChars(name, NULL);
|
||||
env->DeleteLocalRef(name);
|
||||
print_line("FIELD: " + str_field);
|
||||
|
||||
int mods = env->CallIntMethod(obj, Field_getModifiers);
|
||||
if ((mods & 0x8) && (mods & 0x10) && (mods & 0x1)) { //static final public!
|
||||
|
||||
|
@ -238,9 +238,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
|
||||
jclass c = env->GetObjectClass(obj);
|
||||
bool array;
|
||||
String name = _get_class_name(env, c, &array);
|
||||
//print_line("name is " + name + ", array "+Variant(array));
|
||||
|
||||
print_line("ARGNAME: " + name);
|
||||
if (name == "java.lang.String") {
|
||||
|
||||
return String::utf8(env->GetStringUTFChars((jstring)obj, NULL));
|
||||
@ -249,8 +247,9 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
|
||||
if (name == "[Ljava.lang.String;") {
|
||||
|
||||
jobjectArray arr = (jobjectArray)obj;
|
||||
|
||||
int stringCount = env->GetArrayLength(arr);
|
||||
//print_line("String array! " + String::num(stringCount));
|
||||
|
||||
DVector<String> sarr;
|
||||
|
||||
for (int i = 0; i < stringCount; i++) {
|
||||
@ -379,7 +378,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
|
||||
Array vals = _jobject_to_variant(env, arr);
|
||||
env->DeleteLocalRef(arr);
|
||||
|
||||
//print_line("adding " + String::num(keys.size()) + " to Dictionary!");
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
|
||||
ret[keys[i]] = vals[i];
|
||||
@ -410,7 +408,6 @@ class JNISingleton : public Object {
|
||||
public:
|
||||
virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
|
||||
|
||||
//print_line("attempt to call "+String(p_method));
|
||||
ERR_FAIL_COND_V(!instance, Variant());
|
||||
|
||||
r_error.error = Variant::CallError::CALL_OK;
|
||||
@ -418,7 +415,6 @@ public:
|
||||
Map<StringName, MethodData>::Element *E = method_map.find(p_method);
|
||||
if (!E) {
|
||||
|
||||
print_line("no exists");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
return Variant();
|
||||
}
|
||||
@ -426,7 +422,6 @@ public:
|
||||
int ac = E->get().argtypes.size();
|
||||
if (ac < p_argcount) {
|
||||
|
||||
print_line("fewargs");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
r_error.argument = ac;
|
||||
return Variant();
|
||||
@ -434,7 +429,6 @@ public:
|
||||
|
||||
if (ac > p_argcount) {
|
||||
|
||||
print_line("manyargs");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||
r_error.argument = ac;
|
||||
return Variant();
|
||||
@ -463,7 +457,6 @@ public:
|
||||
|
||||
ERR_FAIL_COND_V(res != 0, Variant());
|
||||
|
||||
//print_line("argcount "+String::num(p_argcount));
|
||||
List<jobject> to_erase;
|
||||
for (int i = 0; i < p_argcount; i++) {
|
||||
|
||||
@ -473,26 +466,21 @@ public:
|
||||
to_erase.push_back(vr.obj);
|
||||
}
|
||||
|
||||
//print_line("calling method!!");
|
||||
|
||||
Variant ret;
|
||||
|
||||
switch (E->get().ret_type) {
|
||||
|
||||
case Variant::NIL: {
|
||||
|
||||
//print_line("call void");
|
||||
env->CallVoidMethodA(instance, E->get().method, v);
|
||||
} break;
|
||||
case Variant::BOOL: {
|
||||
|
||||
ret = env->CallBooleanMethodA(instance, E->get().method, v) == JNI_TRUE;
|
||||
//print_line("call bool");
|
||||
} break;
|
||||
case Variant::INT: {
|
||||
|
||||
ret = env->CallIntMethodA(instance, E->get().method, v);
|
||||
//print_line("call int");
|
||||
} break;
|
||||
case Variant::REAL: {
|
||||
|
||||
@ -543,7 +531,6 @@ public:
|
||||
|
||||
case Variant::DICTIONARY: {
|
||||
|
||||
//print_line("call dictionary");
|
||||
jobject obj = env->CallObjectMethodA(instance, E->get().method, v);
|
||||
ret = _jobject_to_variant(env, obj);
|
||||
env->DeleteLocalRef(obj);
|
||||
@ -551,7 +538,6 @@ public:
|
||||
} break;
|
||||
default: {
|
||||
|
||||
print_line("failure..");
|
||||
env->PopLocalFrame(NULL);
|
||||
ERR_FAIL_V(Variant());
|
||||
} break;
|
||||
@ -563,7 +549,6 @@ public:
|
||||
}
|
||||
|
||||
env->PopLocalFrame(NULL);
|
||||
//print_line("success");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -759,8 +744,6 @@ static void _alert(const String &p_message, const String &p_title) {
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jboolean p_need_reload_hook, jobjectArray p_cmdline, jobject p_asset_manager) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**INIT EVENT! - %p\n", env);
|
||||
|
||||
initialized = true;
|
||||
|
||||
JavaVM *jvm;
|
||||
@ -769,8 +752,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
_godot_instance = env->NewGlobalRef(activity);
|
||||
// _godot_instance=activity;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "***************** HELLO FROM JNI!!!!!!!!");
|
||||
|
||||
{
|
||||
//setup IO Object
|
||||
|
||||
@ -778,17 +759,12 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
if (cls) {
|
||||
|
||||
cls = (jclass)env->NewGlobalRef(cls);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*******CLASS FOUND!!!");
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP2, %p", cls);
|
||||
jfieldID fid = env->GetStaticFieldID(cls, "io", "Lorg/godotengine/godot/GodotIO;");
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP3 %i", fid);
|
||||
jobject ob = env->GetStaticObjectField(cls, fid);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP4, %p", ob);
|
||||
jobject gob = env->NewGlobalRef(ob);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "STEP4.5, %p", gob);
|
||||
godot_io = gob;
|
||||
|
||||
_on_video_init = env->GetMethodID(cls, "onVideoInit", "(Z)V");
|
||||
@ -841,10 +817,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
jstring string = (jstring)env->GetObjectArrayElement(p_cmdline, i);
|
||||
const char *rawString = env->GetStringUTFChars(string, 0);
|
||||
if (!rawString) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "cmdline arg %i is null\n", i);
|
||||
// Nothing to do
|
||||
} else {
|
||||
// __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
|
||||
|
||||
if (strcmp(rawString, "-main_pack") == 0)
|
||||
use_apk_expansion = true;
|
||||
}
|
||||
@ -854,64 +828,40 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
}
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "CMDLINE LEN %i - APK EXPANSION %I\n", cmdlen, int(use_apk_expansion));
|
||||
|
||||
os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _set_screen_orient, _get_unique_id, _get_system_dir, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, use_apk_expansion);
|
||||
os_android->set_need_reload_hooks(p_need_reload_hook);
|
||||
|
||||
char wd[500];
|
||||
getcwd(wd, 500);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "test construction %i\n", tst.a);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "running from dir %s\n", wd);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
|
||||
|
||||
#if 0
|
||||
char *args[]={"-test","render",NULL};
|
||||
__android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
|
||||
Error err = Main::setup("apk",2,args,false);
|
||||
#else
|
||||
Error err = Main::setup("apk", cmdlen, (char **)cmdline, false);
|
||||
#endif
|
||||
|
||||
if (err != OK) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*****UNABLE TO SETUP");
|
||||
|
||||
return; //should exit instead and print the error
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "*****SETUP OK");
|
||||
|
||||
//video driver is determined here, because once initialized, it cant be changed
|
||||
String vd = Globals::get_singleton()->get("display/driver");
|
||||
|
||||
env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean) true);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**START");
|
||||
|
||||
input_mutex = Mutex::create();
|
||||
suspend_mutex = Mutex::create();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, jobject obj, jint width, jint height, jboolean reload) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ resize %lld, %i, %i\n", Thread::get_caller_ID(), width, height);
|
||||
if (os_android)
|
||||
os_android->set_display_size(Size2(width, height));
|
||||
|
||||
/*input_mutex->lock();
|
||||
resized=true;
|
||||
if (reload)
|
||||
resized_reload=true;
|
||||
new_size=Size2(width,height);
|
||||
input_mutex->unlock();*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv *env, jobject obj, bool p_32_bits) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "^_^_^_^_^ newcontext %lld\n", Thread::get_caller_ID());
|
||||
|
||||
if (os_android) {
|
||||
os_android->set_context_is_16_bits(!p_32_bits);
|
||||
}
|
||||
@ -926,7 +876,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_quit(JNIEnv *env, job
|
||||
|
||||
input_mutex->lock();
|
||||
quit_request = true;
|
||||
print_line("BACK PRESSED");
|
||||
input_mutex->unlock();
|
||||
}
|
||||
|
||||
@ -934,8 +883,6 @@ static void _initialize_java_modules() {
|
||||
|
||||
String modules = Globals::get_singleton()->get("android/modules");
|
||||
Vector<String> mods = modules.split(",", false);
|
||||
print_line("ANDROID MODULES : " + modules);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "mod count: %i", mods.size());
|
||||
|
||||
if (mods.size()) {
|
||||
|
||||
@ -958,7 +905,7 @@ static void _initialize_java_modules() {
|
||||
String m = mods[i];
|
||||
//jclass singletonClass = env->FindClass(m.utf8().get_data());
|
||||
|
||||
print_line("LOADING MODULE: " + m);
|
||||
print_line("Loading module: " + m);
|
||||
jstring strClassName = env->NewStringUTF(m.utf8().get_data());
|
||||
jclass singletonClass = (jclass)env->CallObjectMethod(cls, findClass, strClassName);
|
||||
|
||||
@ -969,7 +916,6 @@ static void _initialize_java_modules() {
|
||||
}
|
||||
//singletonClass=(jclass)env->NewGlobalRef(singletonClass);
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "****^*^*?^*^*class data %x", singletonClass);
|
||||
jmethodID initialize = env->GetStaticMethodID(singletonClass, "initialize", "(Landroid/app/Activity;)Lorg/godotengine/godot/Godot$SingletonBase;");
|
||||
|
||||
if (!initialize) {
|
||||
@ -978,7 +924,6 @@ static void _initialize_java_modules() {
|
||||
ERR_CONTINUE(!initialize);
|
||||
}
|
||||
jobject obj = env->CallStaticObjectMethod(singletonClass, initialize, _godot_instance);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "****^*^*?^*^*class instance %x", obj);
|
||||
jobject gob = env->NewGlobalRef(obj);
|
||||
}
|
||||
}
|
||||
@ -988,8 +933,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
|
||||
|
||||
ThreadAndroid::setup_thread();
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_ID());
|
||||
|
||||
suspend_mutex->lock();
|
||||
input_mutex->lock();
|
||||
//first time step happens, initialize
|
||||
@ -1066,7 +1009,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
|
||||
jclass cls = env->FindClass("org/godotengine/godot/Godot");
|
||||
jmethodID _finish = env->GetMethodID(cls, "forceQuit", "()V");
|
||||
env->CallVoidMethod(_godot_instance, _finish);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**FINISH REQUEST!!! - %p-%i\n", env, Thread::get_caller_ID());
|
||||
}
|
||||
|
||||
suspend_mutex->unlock();
|
||||
@ -1074,8 +1016,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv *env, jobject obj, jint ev, jint pointer, jint count, jintArray positions) {
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO,"godot","**TOUCH EVENT! - %p-%i\n",env,Thread::get_caller_ID());
|
||||
|
||||
Vector<OS_Android::TouchPos> points;
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
@ -1347,7 +1287,6 @@ static unsigned int android_get_keysym(unsigned int p_code) {
|
||||
for (int i = 0; _ak_to_keycode[i].keysym != KEY_UNKNOWN; i++) {
|
||||
|
||||
if (_ak_to_keycode[i].keycode == p_code) {
|
||||
//print_line("outcode: " + _ak_to_keycode[i].keysym);
|
||||
|
||||
return _ak_to_keycode[i].keysym;
|
||||
}
|
||||
@ -1617,11 +1556,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, j
|
||||
cs += ")";
|
||||
cs += get_jni_sig(retval);
|
||||
jclass cls = env->GetObjectClass(s->get_instance());
|
||||
print_line("METHOD: " + mname + " sig: " + cs);
|
||||
jmethodID mid = env->GetMethodID(cls, mname.ascii().get_data(), cs.ascii().get_data());
|
||||
if (!mid) {
|
||||
|
||||
print_line("FAILED GETTING METHOID " + mname);
|
||||
print_line("Failed getting method: " + mname);
|
||||
}
|
||||
|
||||
s->add_method(mname, mid, types, get_jni_type(retval));
|
||||
@ -1672,24 +1610,17 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *
|
||||
int count = env->GetArrayLength(params);
|
||||
Variant args[VARIANT_ARG_MAX];
|
||||
|
||||
//print_line("Java->GD call: "+obj->get_type()+"::"+str_method+" argc "+itos(count));
|
||||
|
||||
for (int i = 0; i < MIN(count, VARIANT_ARG_MAX); i++) {
|
||||
|
||||
jobject obj = env->GetObjectArrayElement(params, i);
|
||||
if (obj)
|
||||
args[i] = _jobject_to_variant(env, obj);
|
||||
env->DeleteLocalRef(obj);
|
||||
|
||||
// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
|
||||
};
|
||||
|
||||
obj->call_deferred(str_method, args[0], args[1], args[2], args[3], args[4]);
|
||||
// something
|
||||
|
||||
env->PopLocalFrame(NULL);
|
||||
}
|
||||
|
||||
//Main::cleanup();
|
||||
|
||||
//return os.get_exit_code();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user