mirror of
https://github.com/godotengine/godot.git
synced 2024-12-03 09:52:18 +08:00
Merge pull request #16785 from Calinou/remove-android-debugging-prints
Remove some debugging prints on Android
This commit is contained in:
commit
bbd8f2c1b4
@ -86,7 +86,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);
|
||||
@ -113,29 +112,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) {
|
||||
@ -144,7 +124,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);
|
||||
@ -152,9 +131,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) {
|
||||
|
||||
|
@ -117,8 +117,6 @@ Error AudioDriverOpenSL::init() {
|
||||
ERR_FAIL_V(ERR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
print_line("OpenSL Init OK!");
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,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();
|
||||
|
||||
@ -226,28 +225,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);
|
||||
}
|
||||
|
@ -190,43 +190,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() {
|
||||
|
@ -76,14 +76,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();
|
||||
}
|
||||
@ -91,7 +88,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();
|
||||
@ -99,7 +95,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();
|
||||
@ -181,26 +176,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: {
|
||||
|
||||
@ -255,13 +245,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);
|
||||
@ -942,7 +928,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerMethod(JNIEnv *e
|
||||
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));
|
||||
|
@ -150,21 +150,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();
|
||||
@ -281,7 +276,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
godot.mView.getWindowVisibleDisplayFrame(gameSize);
|
||||
|
||||
final int keyboardHeight = fullSize.y - gameSize.bottom;
|
||||
Log.d("GODOT", "setVirtualKeyboardHeight: " + keyboardHeight);
|
||||
GodotLib.setVirtualKeyboardHeight(keyboardHeight);
|
||||
}
|
||||
});
|
||||
@ -351,8 +345,6 @@ 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");
|
||||
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));
|
||||
@ -362,12 +354,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
r = is.read(len);
|
||||
if (r < 4) {
|
||||
|
||||
Log.d("GODOT", "**ERROR** 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");
|
||||
return new String[0];
|
||||
}
|
||||
byte[] arg = new byte[strlen];
|
||||
@ -379,7 +369,6 @@ 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());
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
@ -393,14 +382,12 @@ 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");
|
||||
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");
|
||||
new_cmdline = new String[2];
|
||||
}
|
||||
|
||||
@ -412,13 +399,6 @@ 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]);
|
||||
}
|
||||
}*/
|
||||
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
|
||||
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
|
||||
@ -447,8 +427,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
|
||||
Log.d("GODOT", "** GODOT ACTIVITY CREATED HERE ***\n");
|
||||
|
||||
super.onCreate(icicle);
|
||||
_self = this;
|
||||
Window window = getWindow();
|
||||
@ -509,7 +487,6 @@ 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!");
|
||||
//show popup and die
|
||||
}
|
||||
|
||||
@ -524,25 +501,20 @@ 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);
|
||||
|
||||
if (!f.exists()) {
|
||||
|
||||
pack_valid = false;
|
||||
Log.d("GODOT", "**PACK** - File does not exist");
|
||||
|
||||
} else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
|
||||
Log.d("GODOT", "**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)");
|
||||
}
|
||||
}
|
||||
|
||||
if (!pack_valid) {
|
||||
Log.d("GODOT", "Pack Invalid, try re-downloading.");
|
||||
|
||||
Intent notifierIntent = new Intent(this, this.getClass());
|
||||
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
@ -553,15 +525,12 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
int startResult;
|
||||
try {
|
||||
Log.d("GODOT", "INITIALIZING DOWNLOAD");
|
||||
startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(
|
||||
getApplicationContext(),
|
||||
pendingIntent,
|
||||
GodotDownloaderService.class);
|
||||
Log.d("GODOT", "DOWNLOAD SERVICE FINISHED:" + startResult);
|
||||
|
||||
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
|
||||
Log.d("GODOT", "DOWNLOAD REQUIRED");
|
||||
// This is where you do set up to display the download
|
||||
// progress (next step)
|
||||
mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this,
|
||||
@ -581,11 +550,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
|
||||
return;
|
||||
} else {
|
||||
Log.d("GODOT", "NO DOWNLOAD REQUIRED");
|
||||
}
|
||||
} catch (NameNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Log.d("GODOT", "Error downloading expansion package:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -763,7 +730,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
}
|
||||
}
|
||||
|
||||
System.out.printf("** BACK REQUEST!\n");
|
||||
if (shouldQuit && mView != null) {
|
||||
mView.queueEvent(new Runnable() {
|
||||
@Override
|
||||
@ -812,15 +778,12 @@ 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()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d("GODOT", "**PACK FAIL**");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -936,7 +899,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
*/
|
||||
@Override
|
||||
public void onDownloadStateChanged(int newState) {
|
||||
Log.d("GODOT", "onDownloadStateChanged:" + newState);
|
||||
setState(newState);
|
||||
boolean showDashboard = true;
|
||||
boolean showCellMessage = false;
|
||||
@ -944,7 +906,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
boolean indeterminate;
|
||||
switch (newState) {
|
||||
case IDownloaderClient.STATE_IDLE:
|
||||
Log.d("GODOT", "DOWNLOAD STATE IDLE");
|
||||
// STATE_IDLE means the service is listening, so it's
|
||||
// safe to start making calls via mRemoteService.
|
||||
paused = false;
|
||||
@ -952,13 +913,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
break;
|
||||
case IDownloaderClient.STATE_CONNECTING:
|
||||
case IDownloaderClient.STATE_FETCHING_URL:
|
||||
Log.d("GODOT", "DOWNLOAD STATE CONNECTION / FETCHING URL");
|
||||
showDashboard = true;
|
||||
paused = false;
|
||||
indeterminate = true;
|
||||
break;
|
||||
case IDownloaderClient.STATE_DOWNLOADING:
|
||||
Log.d("GODOT", "DOWNLOAD STATE DOWNLOADING");
|
||||
paused = false;
|
||||
showDashboard = true;
|
||||
indeterminate = false;
|
||||
@ -968,14 +927,12 @@ 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", "DOWNLOAD STATE: FAILED, CANCELLED, UNLICENSED OR FAILED TO FETCH URL");
|
||||
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", "DOWNLOAD STATE: PAUSED BY MISSING CELLULAR PERMISSION");
|
||||
showDashboard = false;
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
@ -983,26 +940,21 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
break;
|
||||
|
||||
case IDownloaderClient.STATE_PAUSED_BY_REQUEST:
|
||||
Log.d("GODOT", "DOWNLOAD STATE: PAUSED BY USER");
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
break;
|
||||
case IDownloaderClient.STATE_PAUSED_ROAMING:
|
||||
case IDownloaderClient.STATE_PAUSED_SDCARD_UNAVAILABLE:
|
||||
Log.d("GODOT", "DOWNLOAD STATE: PAUSED BY ROAMING OR SDCARD UNAVAILABLE");
|
||||
paused = true;
|
||||
indeterminate = false;
|
||||
break;
|
||||
case IDownloaderClient.STATE_COMPLETED:
|
||||
Log.d("GODOT", "DOWNLOAD STATE: COMPLETED");
|
||||
showDashboard = false;
|
||||
paused = false;
|
||||
indeterminate = false;
|
||||
// validateXAPKZipFiles();
|
||||
initializeGodot();
|
||||
return;
|
||||
default:
|
||||
Log.d("GODOT", "DOWNLOAD STATE: DEFAULT");
|
||||
paused = true;
|
||||
indeterminate = true;
|
||||
showDashboard = true;
|
||||
|
@ -1117,7 +1117,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;
|
||||
@ -1130,7 +1130,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);
|
||||
@ -1140,8 +1140,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()) {
|
||||
@ -1173,11 +1171,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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,6 @@ 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));
|
||||
|
||||
if (name == "java.lang.String") {
|
||||
|
||||
@ -251,7 +250,6 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) {
|
||||
|
||||
jobjectArray arr = (jobjectArray)obj;
|
||||
int stringCount = env->GetArrayLength(arr);
|
||||
//print_line("String array! " + String::num(stringCount));
|
||||
PoolVector<String> sarr;
|
||||
|
||||
for (int i = 0; i < stringCount; i++) {
|
||||
@ -380,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];
|
||||
@ -411,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;
|
||||
@ -419,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();
|
||||
}
|
||||
@ -427,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();
|
||||
@ -435,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();
|
||||
@ -464,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++) {
|
||||
|
||||
@ -474,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: {
|
||||
|
||||
@ -544,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);
|
||||
@ -552,7 +538,6 @@ public:
|
||||
} break;
|
||||
default: {
|
||||
|
||||
print_line("failure..");
|
||||
env->PopLocalFrame(NULL);
|
||||
ERR_FAIL_V(Variant());
|
||||
} break;
|
||||
@ -564,7 +549,6 @@ public:
|
||||
}
|
||||
|
||||
env->PopLocalFrame(NULL);
|
||||
//print_line("success");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -757,8 +741,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setVirtualKeyboardHei
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *env, jobject obj, jobject activity, jboolean p_need_reload_hook, jobject p_asset_manager, jboolean p_use_apk_expansion) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**INIT EVENT! - %p\n", env);
|
||||
|
||||
initialized = true;
|
||||
|
||||
JavaVM *jvm;
|
||||
@ -767,8 +749,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
|
||||
|
||||
@ -776,17 +756,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");
|
||||
@ -831,9 +806,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
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);
|
||||
|
||||
//video driver is determined here, because once initialized, it can't be changed
|
||||
// String vd = ProjectSettings::get_singleton()->get("display/driver");
|
||||
|
||||
@ -843,7 +815,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en
|
||||
static void _initialize_java_modules() {
|
||||
|
||||
if (!ProjectSettings::get_singleton()->has_setting("android/modules")) {
|
||||
print_line("ANDROID MODULES: Nothing to load, aborting");
|
||||
print_line("Android modules: Nothing to load, aborting");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -853,8 +825,6 @@ static void _initialize_java_modules() {
|
||||
return;
|
||||
}
|
||||
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()) {
|
||||
|
||||
@ -877,7 +847,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);
|
||||
|
||||
@ -888,7 +858,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) {
|
||||
@ -897,7 +866,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);
|
||||
}
|
||||
}
|
||||
@ -906,8 +874,6 @@ static void _initialize_java_modules() {
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jobject obj, jobjectArray p_cmdline) {
|
||||
ThreadAndroid::setup_thread();
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**SETUP");
|
||||
|
||||
const char **cmdline = NULL;
|
||||
int cmdlen = 0;
|
||||
bool use_apk_expansion = false;
|
||||
@ -921,20 +887,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
|
||||
|
||||
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);
|
||||
} 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;
|
||||
if (rawString && strcmp(rawString, "--main-pack") == 0) {
|
||||
use_apk_expansion = true;
|
||||
}
|
||||
|
||||
cmdline[i] = rawString;
|
||||
}
|
||||
}
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "CMDLINE LEN %i - APK EXPANSION %i\n", cmdlen, int(use_apk_expansion));
|
||||
|
||||
Error err = Main::setup("apk", cmdlen, (char **)cmdline, false);
|
||||
if (cmdline) {
|
||||
@ -942,10 +902,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
java_class_wrapper = memnew(JavaClassWrapper(_godot_instance));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("JavaClassWrapper", java_class_wrapper));
|
||||
@ -954,7 +912,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
|
||||
|
||||
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));
|
||||
|
||||
@ -968,8 +925,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_resize(JNIEnv *env, j
|
||||
|
||||
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);
|
||||
}
|
||||
@ -986,7 +941,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, job
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, jobject obj) {
|
||||
if (step == 0) {
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "**FIRST_STEP");
|
||||
|
||||
// Since Godot is initialized on the UI thread, _main_thread_id was set to that thread's id,
|
||||
// but for Godot purposes, the main thread is the one running the game loop
|
||||
@ -1004,8 +958,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env, job
|
||||
++step;
|
||||
}
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO,"godot","**STEP EVENT! - %p-%i\n",env,Thread::get_caller_id());
|
||||
|
||||
os_android->process_accelerometer(accelerometer);
|
||||
|
||||
os_android->process_gravity(gravity);
|
||||
@ -1019,14 +971,11 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
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++) {
|
||||
|
||||
@ -1292,7 +1241,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;
|
||||
}
|
||||
@ -1362,8 +1310,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv *env, jobj
|
||||
ievent->set_unicode(val);
|
||||
ievent->set_pressed(p_pressed);
|
||||
|
||||
print_line("Scancode: " + String::num(p_scancode) + ":" + String::num(ievent->get_scancode()) + " Unicode: " + String::num(val));
|
||||
|
||||
if (val == '\n') {
|
||||
ievent->set_scancode(KEY_ENTER);
|
||||
} else if (val == 61448) {
|
||||
@ -1527,7 +1473,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_method(JNIEnv *env, j
|
||||
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));
|
||||
@ -1578,16 +1524,12 @@ 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]);
|
||||
|
Loading…
Reference in New Issue
Block a user