From bf237c8d2c270014a95c40b7567db80ed787a67a Mon Sep 17 00:00:00 2001 From: dhewg Date: Sun, 6 Feb 2011 19:37:17 +0100 Subject: ANDROID: Unify log prefix adb logcat ScummVM:\* \*:S --- .../org/inodes/gus/scummvm/PluginProvider.java | 4 +++- .../android/org/inodes/gus/scummvm/ScummVM.java | 19 +++++++-------- .../org/inodes/gus/scummvm/ScummVMActivity.java | 13 +++++------ .../android/org/inodes/gus/scummvm/Unpacker.java | 27 +++++++++++----------- 4 files changed, 31 insertions(+), 32 deletions(-) (limited to 'backends/platform/android/org/inodes/gus/scummvm') diff --git a/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java index 840f3440d5..c94ab0a3ff 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java +++ b/backends/platform/android/org/inodes/gus/scummvm/PluginProvider.java @@ -13,6 +13,8 @@ import android.util.Log; import java.util.ArrayList; public class PluginProvider extends BroadcastReceiver { + private final static String LOG_TAG = "ScummVM"; + public final static String META_UNPACK_LIB = "org.inodes.gus.scummvm.meta.UNPACK_LIB"; @@ -28,7 +30,7 @@ public class PluginProvider extends BroadcastReceiver { .getReceiverInfo(new ComponentName(context, this.getClass()), PackageManager.GET_META_DATA); } catch (PackageManager.NameNotFoundException e) { - Log.e(this.toString(), "Error finding my own info?", e); + Log.e(LOG_TAG, "Error finding my own info?", e); return; } diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index 6986f3988d..bb4a3dd061 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -33,7 +33,7 @@ import java.util.LinkedHashMap; // use the Java versions of most EGL functions :( public class ScummVM implements SurfaceHolder.Callback { - private final static String LOG_TAG = "ScummVM.java"; + protected final static String LOG_TAG = "ScummVM"; private final int AUDIO_FRAME_SIZE = 2 * 2; // bytes. 16bit audio * stereo public static class AudioSetupException extends Exception {} @@ -106,8 +106,7 @@ public class ScummVM implements SurfaceHolder.Callback { try { surfaceLock.acquire(); } catch (InterruptedException e) { - Log.e(this.toString(), - "Interrupted while waiting for surface lock", e); + Log.e(LOG_TAG, "Interrupted while waiting for surface lock", e); } } @@ -151,8 +150,7 @@ public class ScummVM implements SurfaceHolder.Callback { if (value[0] == EGL10.EGL_NONE) Log.d(LOG_TAG, entry.getKey() + ": NONE"); else - Log.d(LOG_TAG, String.format("%s: %d", - entry.getKey(), value[0])); + Log.d(LOG_TAG, String.format("%s: %d", entry.getKey(), value[0])); } } @@ -174,8 +172,7 @@ public class ScummVM implements SurfaceHolder.Callback { num_config); if (false) { - Log.d(LOG_TAG, - String.format("Found %d EGL configurations.", numConfigs)); + Log.d(LOG_TAG, String.format("Found %d EGL configurations.", numConfigs)); for (EGLConfig config : configs) dumpEglConfig(config); } @@ -184,8 +181,7 @@ public class ScummVM implements SurfaceHolder.Callback { // devices so we have to filter/rank the configs again ourselves. eglConfig = chooseEglConfig(configs); if (false) { - Log.d(LOG_TAG, - String.format("Chose EGL config from %d possibilities.", numConfigs)); + Log.d(LOG_TAG, String.format("Chose EGL config from %d possibilities.", numConfigs)); dumpEglConfig(eglConfig); } @@ -199,6 +195,7 @@ public class ScummVM implements SurfaceHolder.Callback { int best = 0; int bestScore = -1; int[] value = new int[1]; + for (int i = 0; i < configs.length; i++) { EGLConfig config = configs[i]; int score = 10000; @@ -255,7 +252,7 @@ public class ScummVM implements SurfaceHolder.Callback { eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, nativeSurface, null); if (eglSurface == EGL10.EGL_NO_SURFACE) - Log.e(LOG_TAG, "CreateWindowSurface failed!"); + Log.e(LOG_TAG, "CreateWindowSurface failed!"); egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); GL10 gl = (GL10)eglContext.getGL(); @@ -396,7 +393,7 @@ public class ScummVM implements SurfaceHolder.Callback { offset += ret; } } catch (InterruptedException e) { - Log.e(this.toString(), "Audio thread interrupted", e); + Log.e(LOG_TAG, "Audio thread interrupted", e); } } } diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java index b37b2b8a52..fae35b6695 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java @@ -73,7 +73,7 @@ public class ScummVMActivity extends Activity { @Override protected void displayMessageOnOSD(String msg) { - Log.i(this.toString(), "OSD: " + msg); + Log.i(LOG_TAG, "OSD: " + msg); Toast.makeText(ScummVMActivity.this, msg, Toast.LENGTH_LONG).show(); } @@ -137,6 +137,7 @@ public class ScummVMActivity extends Activity { } SurfaceView main_surface = (SurfaceView)findViewById(R.id.main_surface); + main_surface.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return onTouchEvent(event); @@ -156,7 +157,7 @@ public class ScummVMActivity extends Activity { try { runScummVM(); } catch (Exception e) { - Log.e("ScummVM", "Fatal error in ScummVM thread", e); + Log.e(ScummVM.LOG_TAG, "Fatal error in ScummVM thread", e); new AlertDialog.Builder(ScummVMActivity.this) .setTitle("Error") .setMessage(e.toString()) @@ -174,8 +175,7 @@ public class ScummVMActivity extends Activity { try { scummvm.waitUntilRunning(); } catch (InterruptedException e) { - Log.e(this.toString(), - "Interrupted while waiting for ScummVM.initBackend", e); + Log.e(ScummVM.LOG_TAG, "Interrupted while waiting for ScummVM.initBackend", e); finish(); } @@ -190,7 +190,7 @@ public class ScummVMActivity extends Activity { "--config=" + getFileStreamPath("scummvmrc").getPath(), "--path=" + Environment.getExternalStorageDirectory().getPath(), "--gui-theme=scummmodern", - "--savepath=" + getDir("saves", 0).getPath(), + "--savepath=" + getDir("saves", 0).getPath() }; int ret = scummvm.scummVMMain(args); @@ -226,8 +226,7 @@ public class ScummVMActivity extends Activity { try { scummvm_thread.join(1000); // 1s timeout } catch (InterruptedException e) { - Log.i(this.toString(), - "Error while joining ScummVM thread", e); + Log.i(ScummVM.LOG_TAG, "Error while joining ScummVM thread", e); } } super.onStop(); diff --git a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java index f1489c4958..8811b1f3ae 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java +++ b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java @@ -34,6 +34,7 @@ import java.util.zip.ZipFile; import java.util.zip.ZipEntry; public class Unpacker extends Activity { + protected final static String LOG_TAG = "ScummVM"; // TODO don't hardcode this private final static boolean PLUGINS_ENABLED = false; private final static String META_NEXT_ACTIVITY = @@ -89,11 +90,11 @@ public class Unpacker extends Activity { origIntent.getType()); //intent.fillIn(getIntent(), 0); intent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); - Log.i(this.toString(), + Log.i(LOG_TAG, "Starting next activity with intent " + intent); startActivity(intent); } else { - Log.w(this.toString(), + Log.w(LOG_TAG, "Unable to extract a component name from " + nextActivity); } } @@ -129,12 +130,12 @@ public class Unpacker extends Activity { new ZipFile(context.getPackageResourcePath()); job = new UnpackJob(zipfile, new HashSet(1)); } catch (PackageManager.NameNotFoundException e) { - Log.e(this.toString(), "Package " + pkg + + Log.e(LOG_TAG, "Package " + pkg + " not found", e); continue; } catch (IOException e) { // FIXME: show some sort of GUI error dialog - Log.e(this.toString(), + Log.e(LOG_TAG, "Error opening ZIP for package " + pkg, e); continue; } @@ -146,7 +147,7 @@ public class Unpacker extends Activity { // Delete stale filenames from mUnpackDest for (File file: mUnpackDest.listFiles()) { if (!all_files.contains(file.getName())) { - Log.i(this.toString(), + Log.i(LOG_TAG, "Deleting stale cached file " + file); file.delete(); } @@ -178,14 +179,14 @@ public class Unpacker extends Activity { progress += zipentry.getSize(); } else { if (dest.exists()) - Log.d(this.toString(), + Log.d(LOG_TAG, "Replacing " + dest.getPath() + " old.mtime=" + dest.lastModified() + " new.mtime=" + zipentry.getTime() + " old.size=" + dest.length() + " new.size=" + zipentry.getSize()); else - Log.i(this.toString(), + Log.i(LOG_TAG, "Extracting " + zipentry.getName() + " from " + zipfile.getName() + " to " + dest.getPath()); @@ -216,12 +217,12 @@ public class Unpacker extends Activity { zipfile.close(); } catch (IOException e) { // FIXME: show some sort of GUI error dialog - Log.e(this.toString(), "Error unpacking plugin", e); + Log.e(LOG_TAG, "Error unpacking plugin", e); } } if (progress != total_size) - Log.d(this.toString(), "Ended with progress " + progress + + Log.d(LOG_TAG, "Ended with progress " + progress + " != total size " + total_size); setResult(RESULT_OK); @@ -235,7 +236,7 @@ public class Unpacker extends Activity { public void onReceive(Context context, Intent intent) { if (!intent.getAction() .equals(ScummVMApplication.ACTION_PLUGIN_QUERY)) { - Log.e(this.toString(), + Log.e(LOG_TAG, "Received unexpected action " + intent.getAction()); return; } @@ -324,7 +325,7 @@ public class Unpacker extends Activity { startActivityForResult(market_intent, REQUEST_MARKET); } catch (ActivityNotFoundException e) { - Log.e(this.toString(), + Log.e(LOG_TAG, "Error starting market", e); } } @@ -352,7 +353,7 @@ public class Unpacker extends Activity { switch (requestCode) { case REQUEST_MARKET: if (resultCode != RESULT_OK) - Log.w(this.toString(), "Market returned " + resultCode); + Log.w(LOG_TAG, "Market returned " + resultCode); tryUnpack(); break; } @@ -364,7 +365,7 @@ public class Unpacker extends Activity { .getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); return ai.metaData; } catch (PackageManager.NameNotFoundException e) { - Log.w(this.toString(), "Unable to find my own meta-data", e); + Log.w(LOG_TAG, "Unable to find my own meta-data", e); return new Bundle(); } } -- cgit v1.2.3