From aa0878f381f2395794e859ca9ee12f91dd189f01 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 17 Oct 2023 14:25:34 +0300 Subject: [PATCH] remove some trash --- .../bda/controller/BaseServiceConnection.java | 23 +- .../bda/controller/IControllerService.java | 3 +- .../java/com/ea/ironmonkey/ComposeMain.kt | 4 +- .../java/com/ea/ironmonkey/GameActivity.kt | 206 ++++++++---------- .../com/ea/ironmonkey/GameGLSurfaceView.java | 1 + .../java/com/ea/ironmonkey/GameRenderer.kt | 2 +- app/src/main/java/com/ea/ironmonkey/Log.java | 45 ---- .../java/com/ea/ironmonkey/MogaController.kt | 40 ++-- .../main/java/com/ea/ironmonkey/RunLoop.kt | 1 + .../java/com/ea/ironmonkey/SplashScreen.java | 177 --------------- .../ea/nimble/tracking/TrackingWrangler.java | 7 - 11 files changed, 117 insertions(+), 392 deletions(-) delete mode 100644 app/src/main/java/com/ea/ironmonkey/Log.java delete mode 100644 app/src/main/java/com/ea/ironmonkey/SplashScreen.java diff --git a/app/src/main/java/com/bda/controller/BaseServiceConnection.java b/app/src/main/java/com/bda/controller/BaseServiceConnection.java index 17dbf79..194009b 100644 --- a/app/src/main/java/com/bda/controller/BaseServiceConnection.java +++ b/app/src/main/java/com/bda/controller/BaseServiceConnection.java @@ -1,13 +1,3 @@ -/* - * Decompiled with CFR 0.152. - * - * Could not load the following classes: - * android.content.ComponentName - * android.content.Context - * android.content.Intent - * android.content.ServiceConnection - * android.os.IBinder - */ package com.bda.controller; import android.content.ComponentName; @@ -15,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; +import android.util.Log; abstract class BaseServiceConnection implements ServiceConnection { final Context mContext; @@ -36,13 +27,11 @@ abstract class BaseServiceConnection implements ServiceConnection { abstract TService getServiceInterface(IBinder var1); public boolean init() { - if (this.mIsBound) return this.mIsBound; - Intent intent = new Intent(this.getServiceIntentName()); - //TODO работает только при родной версии target sdk - //this.mContext.startService(intent); - //this.mIsBound = this.mContext.bindService(intent, (ServiceConnection)this, 1); - //return this.mIsBound; - return true; + if (this.mIsBound) return true; + Intent intent = new Intent(mContext, IControllerService.class); + this.mContext.startService(intent); + this.mIsBound = this.mContext.bindService(intent, (ServiceConnection)this, 1); + return this.mIsBound; } public void onServiceConnected(ComponentName componentName, IBinder iBinder) { diff --git a/app/src/main/java/com/bda/controller/IControllerService.java b/app/src/main/java/com/bda/controller/IControllerService.java index 1bd7539..0cdf963 100644 --- a/app/src/main/java/com/bda/controller/IControllerService.java +++ b/app/src/main/java/com/bda/controller/IControllerService.java @@ -6,8 +6,7 @@ import android.os.IInterface; import android.os.Parcel; import android.os.RemoteException; -interface IControllerService -extends IInterface { +interface IControllerService extends IInterface { float getAxisValue(int var1, int var2) throws RemoteException; int getInfo(int var1) throws RemoteException; diff --git a/app/src/main/java/com/ea/ironmonkey/ComposeMain.kt b/app/src/main/java/com/ea/ironmonkey/ComposeMain.kt index 18aeabf..1fbe32e 100644 --- a/app/src/main/java/com/ea/ironmonkey/ComposeMain.kt +++ b/app/src/main/java/com/ea/ironmonkey/ComposeMain.kt @@ -23,10 +23,12 @@ import androidx.lifecycle.LifecycleRegistry class ComposeFrameLayout @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0 + defStyleAttr: Int = 0, + gameGLSurfaceView: GameGLSurfaceView ) : FrameLayout(context, attrs, defStyleAttr) { init { + addView(gameGLSurfaceView) addView( ComposeView(context).apply { setContent { diff --git a/app/src/main/java/com/ea/ironmonkey/GameActivity.kt b/app/src/main/java/com/ea/ironmonkey/GameActivity.kt index 4323054..1d0cdcb 100644 --- a/app/src/main/java/com/ea/ironmonkey/GameActivity.kt +++ b/app/src/main/java/com/ea/ironmonkey/GameActivity.kt @@ -4,26 +4,26 @@ import android.app.AlertDialog import android.content.DialogInterface import android.content.Intent import android.content.pm.ActivityInfo +import android.graphics.BitmapFactory import android.hardware.SensorManager import android.media.AudioManager import android.opengl.GLES20 +import android.opengl.GLUtils import android.os.Build import android.os.Bundle -import android.os.Handler import android.os.PowerManager import android.os.PowerManager.WakeLock -import android.os.Process import android.util.DisplayMetrics +import android.util.Log import android.view.KeyEvent -import android.view.ViewParent import android.view.inputmethod.InputMethodManager -import android.widget.FrameLayout import androidx.activity.ComponentActivity import androidx.lifecycle.Lifecycle import com.ea.EAIO.EAIO import com.ea.EAMIO.StorageDirectory import com.ea.easp.EASPHandler import com.ea.games.nfs13_na.BuildConfig +import com.ea.games.nfs13_na.R import com.ea.nimble.ApplicationLifecycle import java.io.BufferedReader import java.io.File @@ -36,6 +36,7 @@ import kotlin.math.min import kotlin.math.sqrt import kotlin.system.exitProcess + //TODO при заходе в магазин - вылет class GameActivity : ComponentActivity(), DrawFrameListener { @@ -44,20 +45,17 @@ class GameActivity : ComponentActivity(), DrawFrameListener { System.loadLibrary("app") } - private var laststate = 0 - private var lifecycleOldSystem = 0 - private var easpHandler: EASPHandler? = null - private var splash: SplashScreen? = null - private var gameRenderer: GameRenderer? = null - var runLoop: RunLoop? = null - var gameGLSurfaceView: GameGLSurfaceView? = null - var accelerometer: Accelerometer? = null - private var handler: Handler? = null - private var mFrameLayout: FrameLayout? = null - private var mWakeLock: WakeLock? = null private var splashDelay: Long = 0 private var splashTimer: Long = 0 + private lateinit var easpHandler: EASPHandler + private lateinit var gameRenderer: GameRenderer + lateinit var runLoop: RunLoop + private lateinit var gameGLSurfaceView: GameGLSurfaceView + private lateinit var accelerometer: Accelerometer + private lateinit var mWakeLock: WakeLock + private lateinit var mAudioManager: AudioManager + companion object { const val STATE_RESTORE_CONTEXT = 7 @@ -67,8 +65,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener { @JvmField var state = 0 - private var mAudioManager: AudioManager? = null - //В нативном коде эти методы помечны как статические @JvmStatic fun GetDeviceName() = Build.MODEL @@ -83,17 +79,20 @@ class GameActivity : ComponentActivity(), DrawFrameListener { val osVersion = Build.VERSION.RELEASE } - //Метод вызвывется из нативного кода поэтому нужно его существование + //Метод вызвывется из нативного кода поэтому нужно их существование fun installWallpaper() {} fun needInstallWallpaper() = false - fun openURL(str: String?) = Log.d("OpenURL", str) - fun openURLinBrowser(str: String?) = Log.d("OpenURLinBrowser", str) + fun openURL(str: String) = Log.d("OpenURL", str) + fun openURLinBrowser(str: String) = Log.d("OpenURLinBrowser", str) fun getDisplayMetrics() = resources.displayMetrics fun GetViewRoot() = window.decorView.getRootView().parent fun CallGC() { Log.d(this.localClassName, "Call garbage collector") System.gc() } + fun getGameGLSurfaceView() = gameGLSurfaceView + fun getAccelerometer() = accelerometer + private fun ForceHideVirtualKeyboard() { val currentFocus = currentFocus @@ -109,13 +108,10 @@ class GameActivity : ComponentActivity(), DrawFrameListener { private fun wakeLockAcquire() { val powerManager = getSystemService(POWER_SERVICE) as PowerManager - if (mWakeLock == null) { - mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, this.localClassName) - } - - if (!mWakeLock!!.isHeld) { + mWakeLock = powerManager.newWakeLock(10, localClassName) + if (!mWakeLock.isHeld) { try { - mWakeLock!!.acquire(10*60*1000L /*10 minutes*/) + mWakeLock.acquire(10*60*1000L /*10 minutes*/) } catch (e: SecurityException) { Log.w(this.localClassName, "Missing WAKE_LOCK permission.") } @@ -145,7 +141,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { finish() } } - handler!!.postDelayed({ dialog.show() }, 20) + dialog.show() } fun calcPerformanceScore( @@ -294,70 +290,64 @@ class GameActivity : ComponentActivity(), DrawFrameListener { } public override fun onCreate(bundle: Bundle?) { - Log.i("Debug", "onCreate") - Log.setEnable(true) - Log.i(this.localClassName, "onCreate") - Log.i(this.localClassName, "GameActivity.state = $state") super.onCreate(bundle) - //instance = this - if (lifecycle.currentState == Lifecycle.State.DESTROYED) { - Log.w(this.localClassName, "onCreate called on destroyed app, finishing") + + val className = this.localClassName + val currentState = lifecycle.currentState + + Log.i(className, "onCreate") + Log.i(className, "GameActivity.state = $state") + + if (currentState == Lifecycle.State.DESTROYED) { + Log.w(className, "onCreate called on destroyed app, finishing") finish() - } else if (lifecycle.currentState >= Lifecycle.State.CREATED) { - Log.w( - this.localClassName, - "onCreate ignored, lifecycle is already ${lifecycle.currentState}" - ) - } else { - handler = Handler() - val window = window - //window.setFlags(1024, 1024) - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE - requestWindowFeature(1) - Log.d("Model", Build.MODEL) - mAudioManager = getSystemService(AUDIO_SERVICE) as AudioManager - val sensorManager = getSystemService(SENSOR_SERVICE) as SensorManager - val defaultSensor = sensorManager.getDefaultSensor(1) - val rotation = getWindow().windowManager.defaultDisplay.rotation - if (defaultSensor != null) { - accelerometer = Accelerometer(sensorManager, defaultSensor, rotation) - } - gameGLSurfaceView = GameGLSurfaceView(this) - gameRenderer = GameRenderer(this) - gameRenderer!!.setDrawFrameListener(this) - gameGLSurfaceView!!.setRenderer(gameRenderer) - runLoop = RunLoop(gameGLSurfaceView!!) - mFrameLayout = FrameLayout(this) - mFrameLayout!!.addView(gameGLSurfaceView) - val view = ComposeFrameLayout(this) - mFrameLayout!!.addView(view) - setContentView(mFrameLayout!!) - Log.d(this.localClassName, "Init EAIO/EAMIO") - EAIO.Startup(this) - StorageDirectory.Startup() - if (easpHandler == null) { - Log.d(this.localClassName, "Init EASPHandler") - easpHandler = EASPHandler(this, mFrameLayout!!, gameGLSurfaceView!!) - easpHandler!!.onCreate() - } - ApplicationLifecycle.onActivityCreate(bundle, this) - Log.d(this.localClassName, "nativeOnCreate") - nativeOnCreate() + return } + + if (currentState >= Lifecycle.State.CREATED) { + Log.w(className, "onCreate ignored, lifecycle is already $currentState") + return + } + + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + requestWindowFeature(1) + Log.d("Model", Build.MODEL) + mAudioManager = getSystemService(AUDIO_SERVICE) as AudioManager + + val sensorManager = getSystemService(SENSOR_SERVICE) as SensorManager + val defaultSensor = sensorManager.getDefaultSensor(1) + val rotation = window.windowManager.defaultDisplay.rotation + + accelerometer = Accelerometer(sensorManager, defaultSensor, rotation) + + gameGLSurfaceView = GameGLSurfaceView(this) + gameRenderer = GameRenderer(this) + gameRenderer.setDrawFrameListener(this) + gameGLSurfaceView.setRenderer(gameRenderer) + runLoop = RunLoop(gameGLSurfaceView) + + val frameLayout = ComposeFrameLayout(this, gameGLSurfaceView = gameGLSurfaceView) + setContentView(frameLayout) + + Log.d(className, "Init EAIO/EAMIO") + EAIO.Startup(this) + StorageDirectory.Startup() + + Log.d(className, "Init EASPHandler") + easpHandler = EASPHandler(this, frameLayout, gameGLSurfaceView) + easpHandler.onCreate() + + ApplicationLifecycle.onActivityCreate(bundle, this) + Log.d(className, "nativeOnCreate") + nativeOnCreate() } + public override fun onDestroy() { Log.i("Debug", "onDestroy") Log.i(this.localClassName, "onDestroy") super.onDestroy() - if (lifecycleOldSystem >= 5) { - Log.w( - this.localClassName, - "onDestroy ignored, lifecycle is already ${lifecycle.currentState}" - ) - return - } - easpHandler!!.onDestroy() + easpHandler.onDestroy() if (state == 8) { ApplicationLifecycle.onActivityDestroy(this) nativeOnDestroy() @@ -368,17 +358,13 @@ class GameActivity : ComponentActivity(), DrawFrameListener { } override fun onDrawFrame(gl10: GL10) { - Log.i("state_in", "state = $state") - if (state != laststate) { - Log.d(this.localClassName, "onDrawFrame state=$state") - laststate = state - } + Log.d(this.localClassName, "onDrawFrame state=$state") var isStarted = false when (state) { STATE_RESTORE_CONTEXT -> { run { - Log.i("state_in splash is null", (this.splash == null).toString() + "") - if (this.splash == null) { + //Log.i("state_in splash is null", (this.splash == null).toString() + "") + /*if (this.splash == null) { this.splash = SplashScreen(this) this.splash!!.init( gl10, @@ -386,7 +372,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { this.gameRenderer!!.height ) this.splashDelay = System.currentTimeMillis() + 2000 - } + }*/ if (this.splashDelay < System.currentTimeMillis() /*&& hasWindowFocus()*/) { if (oldState != 8) { state = oldState @@ -410,20 +396,21 @@ class GameActivity : ComponentActivity(), DrawFrameListener { if (splashTimer < System.currentTimeMillis() && nativeRestoreContext()) { nativeOnStart() nativeOnResume() - gameRenderer!!.setDrawFrameListener(null) + gameRenderer.setDrawFrameListener(null) isStarted = true } } } - GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f) + //GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f) + GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT or GLES20.GL_DEPTH_BUFFER_BIT) GLES20.glClear(16640) - if (splash != null) { + /* if (splash != null) { splash!!.draw(gl10, gameRenderer!!.width, gameRenderer!!.height) } if (isStarted && splash != null) { splash!!.destroy(gl10) splash = null - } + }*/ } override fun onKeyDown(i: Int, keyEvent: KeyEvent): Boolean { @@ -435,7 +422,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { return true } val scanCode = keyEvent.scanCode - gameGLSurfaceView!!.queueEvent { nativeOnPhysicalKeyDown(i, scanCode) } + gameGLSurfaceView.queueEvent { nativeOnPhysicalKeyDown(i, scanCode) } return IsSystemKey(i) } @@ -445,7 +432,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { return true } val scanCode = keyEvent.scanCode - gameGLSurfaceView!!.queueEvent { nativeOnPhysicalKeyUp(i, scanCode) } + gameGLSurfaceView.queueEvent { nativeOnPhysicalKeyUp(i, scanCode) } return IsSystemKey(i) } @@ -454,18 +441,10 @@ class GameActivity : ComponentActivity(), DrawFrameListener { Log.i("Debug", "onPause") Log.i(this.localClassName, "onPause state=$state") mAudioManager!!.setStreamMute(3, true) - if (lifecycleOldSystem != 3) { - Log.w( - this.localClassName, - "onPause ignored, lifecycle is currently ${lifecycle.currentState}" - ) - return - } - gameGLSurfaceView!!.onPause() - + gameGLSurfaceView.onPause() + onWindowFocusChanged(false) ApplicationLifecycle.onActivityPause(this) nativeOnPause() - splash = null } public override fun onRestart() { @@ -485,16 +464,9 @@ class GameActivity : ComponentActivity(), DrawFrameListener { if (state != 7) { oldState = state state = 8 - gameRenderer!!.setDrawFrameListener(this) + gameRenderer.setDrawFrameListener(this) } - if (lifecycleOldSystem == 3) { - Log.w( - this.localClassName, - "onResume ignored, lifecycle is currently ${lifecycle.currentState}" - ) - return - } - gameGLSurfaceView!!.onResume() + gameGLSurfaceView.onResume() ApplicationLifecycle.onActivityResume(this) nativeOnResume() } @@ -512,7 +484,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { Log.i(this.localClassName, "onStart 1") wakeLockAcquire() Log.i(this.localClassName, "onStart 2") - if (lifecycleOldSystem < 2 || lifecycleOldSystem >= 4) { + if (lifecycle.currentState < Lifecycle.State.STARTED || lifecycle.currentState == Lifecycle.State.DESTROYED) { Log.i(this.localClassName, "onStart 3") Log.i(this.localClassName, "nativeOnStart") nativeOnStart() @@ -560,7 +532,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener { mAudioManager!!.setStreamMute(3, true) oldState = state state = 7 - gameRenderer!!.setDrawFrameListener(this) + gameRenderer.setDrawFrameListener(this) } } ApplicationLifecycle.onActivityWindowFocusChanged(hasFocus, this) diff --git a/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java b/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java index 9ddf60d..654551f 100644 --- a/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java +++ b/app/src/main/java/com/ea/ironmonkey/GameGLSurfaceView.java @@ -2,6 +2,7 @@ package com.ea.ironmonkey; import android.opengl.GLSurfaceView; import android.os.Build; +import android.util.Log; import android.view.MotionEvent; import javax.microedition.khronos.egl.EGL10; diff --git a/app/src/main/java/com/ea/ironmonkey/GameRenderer.kt b/app/src/main/java/com/ea/ironmonkey/GameRenderer.kt index 10732bb..0a1fe18 100644 --- a/app/src/main/java/com/ea/ironmonkey/GameRenderer.kt +++ b/app/src/main/java/com/ea/ironmonkey/GameRenderer.kt @@ -15,7 +15,7 @@ class GameRenderer(private val activity: GameActivity) : GLSurfaceView.Renderer if (drawFrameListener != null) { drawFrameListener!!.onDrawFrame(gl10) } else { - activity.runLoop!!.onRunLoopTick() + activity.runLoop.onRunLoopTick() } } diff --git a/app/src/main/java/com/ea/ironmonkey/Log.java b/app/src/main/java/com/ea/ironmonkey/Log.java deleted file mode 100644 index 753ace0..0000000 --- a/app/src/main/java/com/ea/ironmonkey/Log.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ea.ironmonkey; - -public class Log { - private static boolean enable = false; - - public static void d(String str, String str2) { - if (enable) { - android.util.Log.d(str, str2); - } - } - - public static void e(String str, String str2) { - if (enable) { - android.util.Log.e(str, str2); - } - } - - public static void e(String str, String str2, Exception exc) { - if (enable) { - android.util.Log.e(str, str2, exc); - } - } - - public static void i(String str, String str2) { - if (enable) { - android.util.Log.i(str, str2); - } - } - - public static void setEnable(boolean z) { - enable = z; - } - - public static void v(String str, String str2) { - if (enable) { - android.util.Log.v(str, str2); - } - } - - public static void w(String str, String str2) { - if (enable) { - android.util.Log.w(str, str2); - } - } -} diff --git a/app/src/main/java/com/ea/ironmonkey/MogaController.kt b/app/src/main/java/com/ea/ironmonkey/MogaController.kt index 8693386..ca39b51 100644 --- a/app/src/main/java/com/ea/ironmonkey/MogaController.kt +++ b/app/src/main/java/com/ea/ironmonkey/MogaController.kt @@ -1,32 +1,22 @@ -package com.ea.ironmonkey; +package com.ea.ironmonkey -import com.bda.controller.ControllerListener; -import com.bda.controller.KeyEvent; -import com.bda.controller.MotionEvent; -import com.bda.controller.StateEvent; - -public class MogaController implements ControllerListener { - /* access modifiers changed from: package-private */ - public native void nativeOnKeyEvent(KeyEvent keyEvent); - - /* access modifiers changed from: package-private */ - public native void nativeOnMotionEvent(MotionEvent motionEvent); - - /* access modifiers changed from: package-private */ - public native void nativeOnStateEvent(StateEvent stateEvent); - - @Override // com.bda.controller.ControllerListener - public void onKeyEvent(KeyEvent keyEvent) { - nativeOnKeyEvent(keyEvent); +import com.bda.controller.ControllerListener +import com.bda.controller.KeyEvent +import com.bda.controller.MotionEvent +import com.bda.controller.StateEvent +object MogaController : ControllerListener { + external fun nativeOnKeyEvent(keyEvent: KeyEvent?) + external fun nativeOnMotionEvent(motionEvent: MotionEvent?) + external fun nativeOnStateEvent(stateEvent: StateEvent?) + override fun onKeyEvent(keyEvent: KeyEvent) { + nativeOnKeyEvent(keyEvent) } - @Override // com.bda.controller.ControllerListener - public void onMotionEvent(MotionEvent motionEvent) { - nativeOnMotionEvent(motionEvent); + override fun onMotionEvent(motionEvent: MotionEvent) { + nativeOnMotionEvent(motionEvent) } - @Override // com.bda.controller.ControllerListener - public void onStateEvent(StateEvent stateEvent) { - nativeOnStateEvent(stateEvent); + override fun onStateEvent(stateEvent: StateEvent) { + nativeOnStateEvent(stateEvent) } } diff --git a/app/src/main/java/com/ea/ironmonkey/RunLoop.kt b/app/src/main/java/com/ea/ironmonkey/RunLoop.kt index 47d5d46..2dd03f6 100644 --- a/app/src/main/java/com/ea/ironmonkey/RunLoop.kt +++ b/app/src/main/java/com/ea/ironmonkey/RunLoop.kt @@ -1,6 +1,7 @@ package com.ea.ironmonkey import android.opengl.GLSurfaceView +import android.util.Log class RunLoop(private val glSurfaceView: GLSurfaceView) { private var state = 0 diff --git a/app/src/main/java/com/ea/ironmonkey/SplashScreen.java b/app/src/main/java/com/ea/ironmonkey/SplashScreen.java deleted file mode 100644 index 991ce51..0000000 --- a/app/src/main/java/com/ea/ironmonkey/SplashScreen.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.ea.ironmonkey; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.opengl.GLES20; -import android.opengl.GLUtils; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import javax.microedition.khronos.opengles.GL10; - -public class SplashScreen { - private static final String TAG = "SplashScreen"; - private static final int floatSize = 4; - private Activity _activity; - private int _attPosition; - private int _attSampler; - private int _attTexCoord; - private int _fragmentShader; - private int _program; - private int[] _textureId; - private int _vertexShader; - - private final String fShaderStr = - "precision highp float; " + - "varying vec2 v_texCoord;" + - "uniform sampler2D s_texture;"+ - "void main(){" + - " gl_FragColor = texture2D( s_texture, v_texCoord );" + - "}"; - - private FloatBuffer vBuffer; - private final String vShaderStr = "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n"; - - public SplashScreen(Activity activity) { - this._activity = activity; - this._textureId = new int[1]; - } - - private int LoadShader(int i, String str) { - int glCreateShader = GLES20.glCreateShader(i); - if (glCreateShader == 0) { - Log.e(TAG, "LoadShader(" + i + ", " + str + " - create shader fail\n"); - return 0; - } - GLES20.glShaderSource(glCreateShader, str); - GLES20.glCompileShader(glCreateShader); - int[] iArr = new int[1]; - GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0); - if (iArr[0] != 0) { - return glCreateShader; - } - Log.e(TAG, "LoadShader(" + i + ", " + str + ") - compile shader fail\n"); - GLES20.glDeleteShader(glCreateShader); - Log.e(TAG, GLES20.glGetShaderInfoLog(glCreateShader)); - return 0; - } - - private boolean initRenderer() { - this._vertexShader = LoadShader(35633, "attribute vec4 a_position; \nattribute vec4 a_texCoord; \nvarying vec2 v_texCoord; \nvoid main() \n{ \n gl_Position = a_position; \n v_texCoord = a_texCoord.xy; \n} \n"); - this._fragmentShader = LoadShader(35632, "precision highp float; \nvarying vec2 v_texCoord; \nuniform sampler2D s_texture; \nvoid main() \n{ \n gl_FragColor = texture2D( s_texture, v_texCoord );\n} \n"); - this._program = GLES20.glCreateProgram(); - if (this._program == 0 || this._vertexShader == 0 || this._fragmentShader == 0) { - Log.e(TAG, "InitRender() - fail\n"); - return false; - } - GLES20.glAttachShader(this._program, this._vertexShader); - GLES20.glAttachShader(this._program, this._fragmentShader); - GLES20.glLinkProgram(this._program); - int[] iArr = new int[1]; - GLES20.glGetProgramiv(this._program, 35714, iArr, 0); - if (iArr[0] == 0) { - Log.e(TAG, "InitRender() - fail link program"); - Log.e(TAG, GLES20.glGetProgramInfoLog(this._program)); - GLES20.glDeleteProgram(this._program); - this._program = 0; - return false; - } - this._attPosition = GLES20.glGetAttribLocation(this._program, "a_position"); - this._attTexCoord = GLES20.glGetAttribLocation(this._program, "a_texCoord"); - this._attSampler = GLES20.glGetAttribLocation(this._program, "s_texture"); - return true; - } - - public void destroy(GL10 gl10) { - if (this._textureId[0] != 0) { - GLES20.glDeleteTextures(1, this._textureId, 0); - this._textureId[0] = 0; - } - if (this._program != 0) { - GLES20.glDeleteProgram(this._program); - this._program = 0; - } - if (this._vertexShader != 0) { - GLES20.glDeleteShader(this._vertexShader); - this._vertexShader = 0; - } - if (this._fragmentShader != 0) { - GLES20.glDeleteShader(this._fragmentShader); - this._fragmentShader = 0; - } - if (this.vBuffer != null) { - this.vBuffer.clear(); - this.vBuffer = null; - } - } - - public boolean draw(GL10 gl10, int i, int i2) { - float f; - if (this._textureId[0] == 0) { - return false; - } - float f2 = 0.8f; - if (i > i2) { - f = (((float) i2) / ((float) i)) * 0.8f; - } else { - f2 = 0.8f * (((float) i) / ((float) i2)); - f = 0.8f; - } - float[][] fArr = {new float[]{-f, -f2, 0.0f, 1.0f, f, -f2, 1.0f, 1.0f, -f, f2, 0.0f, 0.0f, f, f2, 1.0f, 0.0f}, new float[]{-f, -f2, 1.0f, 1.0f, f, -f2, 1.0f, 0.0f, -f, f2, 0.0f, 1.0f, f, f2, 0.0f, 0.0f}}; - this.vBuffer = ByteBuffer.allocateDirect(fArr[0].length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - if (i < i2) { - this.vBuffer.put(fArr[1]); - } else { - this.vBuffer.put(fArr[0]); - } - GLES20.glViewport(0, 0, i, i2); - GLES20.glUseProgram(this._program); - GLES20.glEnable(GLES20.GL_TEXTURE_2D); - GLES20.glActiveTexture(33984); - GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, this._textureId[0]); - GLES20.glUniform1i(this._attSampler, 0); - this.vBuffer.position(0); - GLES20.glVertexAttribPointer(this._attPosition, 2, 5126, false, 16, (Buffer) this.vBuffer); - GLES20.glEnableVertexAttribArray(this._attPosition); - this.vBuffer.position(2); - GLES20.glVertexAttribPointer(this._attTexCoord, 2, 5126, false, 16, (Buffer) this.vBuffer); - GLES20.glEnableVertexAttribArray(this._attTexCoord); - GLES20.glDrawArrays(5, 0, 4); - GLES20.glDisableVertexAttribArray(this._attPosition); - GLES20.glDisableVertexAttribArray(this._attTexCoord); - GLES20.glUseProgram(0); - return true; - } - - public void init(GL10 gl10, int i, int i2) { - if (!initRenderer()) { - destroy(gl10); - return; - } - GLES20.glGetError(); - GLES20.glGenTextures(1, this._textureId, 0); - GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, this._textureId[0]); - - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inPreferredConfig = Bitmap.Config.ARGB_4444; - Bitmap bitmap = null; - try { - bitmap = BitmapFactory.decodeStream(this._activity.getAssets().open("splash.png"), null, options); - } catch (Exception e) { - Log.e(TAG, "loadBitmap ", e); - } - GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); - GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); - GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); - GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); - GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); - bitmap.recycle(); - int glGetError = GLES20.glGetError(); - if (glGetError != 0) { - Log.e(TAG, "Texture Load GLError: " + glGetError); - destroy(gl10); - } - } -} diff --git a/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java b/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java index 33c39b2..88ea339 100644 --- a/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java +++ b/app/src/main/java/com/ea/nimble/tracking/TrackingWrangler.java @@ -1,9 +1,5 @@ -/* - * Decompiled with CFR 0.152. - */ package com.ea.nimble.tracking; -import com.ea.ironmonkey.devmenu.util.Observer; import com.ea.nimble.ApplicationEnvironment; import com.ea.nimble.Base; import com.ea.nimble.Component; @@ -90,9 +86,6 @@ public class TrackingWrangler extends Component implements LogSource, ITracking @Override public void logEvent(String string2, Map map) { Log.Helper.LOGD(this, "Logging event, " + string2); - if(m_trackingComponents != null) - for(ITracking tracking : m_trackingComponents) - tracking.logEvent(string2, map); } @Override