remove some trash

This commit is contained in:
2023-10-17 14:25:34 +03:00
parent 02b1a89208
commit aa0878f381
11 changed files with 117 additions and 392 deletions
@@ -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; package com.bda.controller;
import android.content.ComponentName; import android.content.ComponentName;
@@ -15,6 +5,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.IBinder; import android.os.IBinder;
import android.util.Log;
abstract class BaseServiceConnection<TService> implements ServiceConnection { abstract class BaseServiceConnection<TService> implements ServiceConnection {
final Context mContext; final Context mContext;
@@ -36,13 +27,11 @@ abstract class BaseServiceConnection<TService> implements ServiceConnection {
abstract TService getServiceInterface(IBinder var1); abstract TService getServiceInterface(IBinder var1);
public boolean init() { public boolean init() {
if (this.mIsBound) return this.mIsBound; if (this.mIsBound) return true;
Intent intent = new Intent(this.getServiceIntentName()); Intent intent = new Intent(mContext, IControllerService.class);
//TODO работает только при родной версии target sdk this.mContext.startService(intent);
//this.mContext.startService(intent); this.mIsBound = this.mContext.bindService(intent, (ServiceConnection)this, 1);
//this.mIsBound = this.mContext.bindService(intent, (ServiceConnection)this, 1); return this.mIsBound;
//return this.mIsBound;
return true;
} }
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
@@ -6,8 +6,7 @@ import android.os.IInterface;
import android.os.Parcel; import android.os.Parcel;
import android.os.RemoteException; import android.os.RemoteException;
interface IControllerService interface IControllerService extends IInterface {
extends IInterface {
float getAxisValue(int var1, int var2) throws RemoteException; float getAxisValue(int var1, int var2) throws RemoteException;
int getInfo(int var1) throws RemoteException; int getInfo(int var1) throws RemoteException;
@@ -23,10 +23,12 @@ import androidx.lifecycle.LifecycleRegistry
class ComposeFrameLayout @JvmOverloads constructor( class ComposeFrameLayout @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, context: Context, attrs: AttributeSet? = null,
defStyleAttr: Int = 0 defStyleAttr: Int = 0,
gameGLSurfaceView: GameGLSurfaceView
) : FrameLayout(context, attrs, defStyleAttr) { ) : FrameLayout(context, attrs, defStyleAttr) {
init { init {
addView(gameGLSurfaceView)
addView( addView(
ComposeView(context).apply { ComposeView(context).apply {
setContent { setContent {
@@ -4,26 +4,26 @@ import android.app.AlertDialog
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.graphics.BitmapFactory
import android.hardware.SensorManager import android.hardware.SensorManager
import android.media.AudioManager import android.media.AudioManager
import android.opengl.GLES20 import android.opengl.GLES20
import android.opengl.GLUtils
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.PowerManager import android.os.PowerManager
import android.os.PowerManager.WakeLock import android.os.PowerManager.WakeLock
import android.os.Process
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.util.Log
import android.view.KeyEvent import android.view.KeyEvent
import android.view.ViewParent
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.FrameLayout
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import com.ea.EAIO.EAIO import com.ea.EAIO.EAIO
import com.ea.EAMIO.StorageDirectory import com.ea.EAMIO.StorageDirectory
import com.ea.easp.EASPHandler import com.ea.easp.EASPHandler
import com.ea.games.nfs13_na.BuildConfig import com.ea.games.nfs13_na.BuildConfig
import com.ea.games.nfs13_na.R
import com.ea.nimble.ApplicationLifecycle import com.ea.nimble.ApplicationLifecycle
import java.io.BufferedReader import java.io.BufferedReader
import java.io.File import java.io.File
@@ -36,6 +36,7 @@ import kotlin.math.min
import kotlin.math.sqrt import kotlin.math.sqrt
import kotlin.system.exitProcess import kotlin.system.exitProcess
//TODO при заходе в магазин - вылет //TODO при заходе в магазин - вылет
class GameActivity : ComponentActivity(), DrawFrameListener { class GameActivity : ComponentActivity(), DrawFrameListener {
@@ -44,20 +45,17 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
System.loadLibrary("app") 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 splashDelay: Long = 0
private var splashTimer: 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 { companion object {
const val STATE_RESTORE_CONTEXT = 7 const val STATE_RESTORE_CONTEXT = 7
@@ -67,8 +65,6 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
@JvmField @JvmField
var state = 0 var state = 0
private var mAudioManager: AudioManager? = null
//В нативном коде эти методы помечны как статические //В нативном коде эти методы помечны как статические
@JvmStatic @JvmStatic
fun GetDeviceName() = Build.MODEL fun GetDeviceName() = Build.MODEL
@@ -83,17 +79,20 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
val osVersion = Build.VERSION.RELEASE val osVersion = Build.VERSION.RELEASE
} }
//Метод вызвывется из нативного кода поэтому нужно его существование //Метод вызвывется из нативного кода поэтому нужно их существование
fun installWallpaper() {} fun installWallpaper() {}
fun needInstallWallpaper() = false fun needInstallWallpaper() = false
fun openURL(str: String?) = Log.d("OpenURL", str) fun openURL(str: String) = Log.d("OpenURL", str)
fun openURLinBrowser(str: String?) = Log.d("OpenURLinBrowser", str) fun openURLinBrowser(str: String) = Log.d("OpenURLinBrowser", str)
fun getDisplayMetrics() = resources.displayMetrics fun getDisplayMetrics() = resources.displayMetrics
fun GetViewRoot() = window.decorView.getRootView().parent fun GetViewRoot() = window.decorView.getRootView().parent
fun CallGC() { fun CallGC() {
Log.d(this.localClassName, "Call garbage collector") Log.d(this.localClassName, "Call garbage collector")
System.gc() System.gc()
} }
fun getGameGLSurfaceView() = gameGLSurfaceView
fun getAccelerometer() = accelerometer
private fun ForceHideVirtualKeyboard() { private fun ForceHideVirtualKeyboard() {
val currentFocus = currentFocus val currentFocus = currentFocus
@@ -109,13 +108,10 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
private fun wakeLockAcquire() { private fun wakeLockAcquire() {
val powerManager = getSystemService(POWER_SERVICE) as PowerManager val powerManager = getSystemService(POWER_SERVICE) as PowerManager
if (mWakeLock == null) { mWakeLock = powerManager.newWakeLock(10, localClassName)
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, this.localClassName) if (!mWakeLock.isHeld) {
}
if (!mWakeLock!!.isHeld) {
try { try {
mWakeLock!!.acquire(10*60*1000L /*10 minutes*/) mWakeLock.acquire(10*60*1000L /*10 minutes*/)
} catch (e: SecurityException) { } catch (e: SecurityException) {
Log.w(this.localClassName, "Missing WAKE_LOCK permission.") Log.w(this.localClassName, "Missing WAKE_LOCK permission.")
} }
@@ -145,7 +141,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
finish() finish()
} }
} }
handler!!.postDelayed({ dialog.show() }, 20) dialog.show()
} }
fun calcPerformanceScore( fun calcPerformanceScore(
@@ -294,70 +290,64 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
} }
public override fun onCreate(bundle: Bundle?) { 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) super.onCreate(bundle)
//instance = this
if (lifecycle.currentState == Lifecycle.State.DESTROYED) { val className = this.localClassName
Log.w(this.localClassName, "onCreate called on destroyed app, finishing") 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() finish()
} else if (lifecycle.currentState >= Lifecycle.State.CREATED) { return
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()
} }
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() { public override fun onDestroy() {
Log.i("Debug", "onDestroy") Log.i("Debug", "onDestroy")
Log.i(this.localClassName, "onDestroy") Log.i(this.localClassName, "onDestroy")
super.onDestroy() super.onDestroy()
if (lifecycleOldSystem >= 5) { easpHandler.onDestroy()
Log.w(
this.localClassName,
"onDestroy ignored, lifecycle is already ${lifecycle.currentState}"
)
return
}
easpHandler!!.onDestroy()
if (state == 8) { if (state == 8) {
ApplicationLifecycle.onActivityDestroy(this) ApplicationLifecycle.onActivityDestroy(this)
nativeOnDestroy() nativeOnDestroy()
@@ -368,17 +358,13 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
} }
override fun onDrawFrame(gl10: GL10) { override fun onDrawFrame(gl10: GL10) {
Log.i("state_in", "state = $state") Log.d(this.localClassName, "onDrawFrame state=$state")
if (state != laststate) {
Log.d(this.localClassName, "onDrawFrame state=$state")
laststate = state
}
var isStarted = false var isStarted = false
when (state) { when (state) {
STATE_RESTORE_CONTEXT -> { STATE_RESTORE_CONTEXT -> {
run { run {
Log.i("state_in splash is null", (this.splash == null).toString() + "") //Log.i("state_in splash is null", (this.splash == null).toString() + "")
if (this.splash == null) { /*if (this.splash == null) {
this.splash = SplashScreen(this) this.splash = SplashScreen(this)
this.splash!!.init( this.splash!!.init(
gl10, gl10,
@@ -386,7 +372,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
this.gameRenderer!!.height this.gameRenderer!!.height
) )
this.splashDelay = System.currentTimeMillis() + 2000 this.splashDelay = System.currentTimeMillis() + 2000
} }*/
if (this.splashDelay < System.currentTimeMillis() /*&& hasWindowFocus()*/) { if (this.splashDelay < System.currentTimeMillis() /*&& hasWindowFocus()*/) {
if (oldState != 8) { if (oldState != 8) {
state = oldState state = oldState
@@ -410,20 +396,21 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
if (splashTimer < System.currentTimeMillis() && nativeRestoreContext()) { if (splashTimer < System.currentTimeMillis() && nativeRestoreContext()) {
nativeOnStart() nativeOnStart()
nativeOnResume() nativeOnResume()
gameRenderer!!.setDrawFrameListener(null) gameRenderer.setDrawFrameListener(null)
isStarted = true 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) GLES20.glClear(16640)
if (splash != null) { /* if (splash != null) {
splash!!.draw(gl10, gameRenderer!!.width, gameRenderer!!.height) splash!!.draw(gl10, gameRenderer!!.width, gameRenderer!!.height)
} }
if (isStarted && splash != null) { if (isStarted && splash != null) {
splash!!.destroy(gl10) splash!!.destroy(gl10)
splash = null splash = null
} }*/
} }
override fun onKeyDown(i: Int, keyEvent: KeyEvent): Boolean { override fun onKeyDown(i: Int, keyEvent: KeyEvent): Boolean {
@@ -435,7 +422,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
return true return true
} }
val scanCode = keyEvent.scanCode val scanCode = keyEvent.scanCode
gameGLSurfaceView!!.queueEvent { nativeOnPhysicalKeyDown(i, scanCode) } gameGLSurfaceView.queueEvent { nativeOnPhysicalKeyDown(i, scanCode) }
return IsSystemKey(i) return IsSystemKey(i)
} }
@@ -445,7 +432,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
return true return true
} }
val scanCode = keyEvent.scanCode val scanCode = keyEvent.scanCode
gameGLSurfaceView!!.queueEvent { nativeOnPhysicalKeyUp(i, scanCode) } gameGLSurfaceView.queueEvent { nativeOnPhysicalKeyUp(i, scanCode) }
return IsSystemKey(i) return IsSystemKey(i)
} }
@@ -454,18 +441,10 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
Log.i("Debug", "onPause") Log.i("Debug", "onPause")
Log.i(this.localClassName, "onPause state=$state") Log.i(this.localClassName, "onPause state=$state")
mAudioManager!!.setStreamMute(3, true) mAudioManager!!.setStreamMute(3, true)
if (lifecycleOldSystem != 3) { gameGLSurfaceView.onPause()
Log.w( onWindowFocusChanged(false)
this.localClassName,
"onPause ignored, lifecycle is currently ${lifecycle.currentState}"
)
return
}
gameGLSurfaceView!!.onPause()
ApplicationLifecycle.onActivityPause(this) ApplicationLifecycle.onActivityPause(this)
nativeOnPause() nativeOnPause()
splash = null
} }
public override fun onRestart() { public override fun onRestart() {
@@ -485,16 +464,9 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
if (state != 7) { if (state != 7) {
oldState = state oldState = state
state = 8 state = 8
gameRenderer!!.setDrawFrameListener(this) gameRenderer.setDrawFrameListener(this)
} }
if (lifecycleOldSystem == 3) { gameGLSurfaceView.onResume()
Log.w(
this.localClassName,
"onResume ignored, lifecycle is currently ${lifecycle.currentState}"
)
return
}
gameGLSurfaceView!!.onResume()
ApplicationLifecycle.onActivityResume(this) ApplicationLifecycle.onActivityResume(this)
nativeOnResume() nativeOnResume()
} }
@@ -512,7 +484,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
Log.i(this.localClassName, "onStart 1") Log.i(this.localClassName, "onStart 1")
wakeLockAcquire() wakeLockAcquire()
Log.i(this.localClassName, "onStart 2") 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, "onStart 3")
Log.i(this.localClassName, "nativeOnStart") Log.i(this.localClassName, "nativeOnStart")
nativeOnStart() nativeOnStart()
@@ -560,7 +532,7 @@ class GameActivity : ComponentActivity(), DrawFrameListener {
mAudioManager!!.setStreamMute(3, true) mAudioManager!!.setStreamMute(3, true)
oldState = state oldState = state
state = 7 state = 7
gameRenderer!!.setDrawFrameListener(this) gameRenderer.setDrawFrameListener(this)
} }
} }
ApplicationLifecycle.onActivityWindowFocusChanged(hasFocus, this) ApplicationLifecycle.onActivityWindowFocusChanged(hasFocus, this)
@@ -2,6 +2,7 @@ package com.ea.ironmonkey;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.os.Build; import android.os.Build;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGL10;
@@ -15,7 +15,7 @@ class GameRenderer(private val activity: GameActivity) : GLSurfaceView.Renderer
if (drawFrameListener != null) { if (drawFrameListener != null) {
drawFrameListener!!.onDrawFrame(gl10) drawFrameListener!!.onDrawFrame(gl10)
} else { } else {
activity.runLoop!!.onRunLoopTick() activity.runLoop.onRunLoopTick()
} }
} }
@@ -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);
}
}
}
@@ -1,32 +1,22 @@
package com.ea.ironmonkey; package com.ea.ironmonkey
import com.bda.controller.ControllerListener; import com.bda.controller.ControllerListener
import com.bda.controller.KeyEvent; import com.bda.controller.KeyEvent
import com.bda.controller.MotionEvent; import com.bda.controller.MotionEvent
import com.bda.controller.StateEvent; import com.bda.controller.StateEvent
object MogaController : ControllerListener {
public class MogaController implements ControllerListener { external fun nativeOnKeyEvent(keyEvent: KeyEvent?)
/* access modifiers changed from: package-private */ external fun nativeOnMotionEvent(motionEvent: MotionEvent?)
public native void nativeOnKeyEvent(KeyEvent keyEvent); external fun nativeOnStateEvent(stateEvent: StateEvent?)
override fun onKeyEvent(keyEvent: KeyEvent) {
/* access modifiers changed from: package-private */ nativeOnKeyEvent(keyEvent)
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);
} }
@Override // com.bda.controller.ControllerListener override fun onMotionEvent(motionEvent: MotionEvent) {
public void onMotionEvent(MotionEvent motionEvent) { nativeOnMotionEvent(motionEvent)
nativeOnMotionEvent(motionEvent);
} }
@Override // com.bda.controller.ControllerListener override fun onStateEvent(stateEvent: StateEvent) {
public void onStateEvent(StateEvent stateEvent) { nativeOnStateEvent(stateEvent)
nativeOnStateEvent(stateEvent);
} }
} }
@@ -1,6 +1,7 @@
package com.ea.ironmonkey package com.ea.ironmonkey
import android.opengl.GLSurfaceView import android.opengl.GLSurfaceView
import android.util.Log
class RunLoop(private val glSurfaceView: GLSurfaceView) { class RunLoop(private val glSurfaceView: GLSurfaceView) {
private var state = 0 private var state = 0
@@ -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);
}
}
}
@@ -1,9 +1,5 @@
/*
* Decompiled with CFR 0.152.
*/
package com.ea.nimble.tracking; package com.ea.nimble.tracking;
import com.ea.ironmonkey.devmenu.util.Observer;
import com.ea.nimble.ApplicationEnvironment; import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Base; import com.ea.nimble.Base;
import com.ea.nimble.Component; import com.ea.nimble.Component;
@@ -90,9 +86,6 @@ public class TrackingWrangler extends Component implements LogSource, ITracking
@Override @Override
public void logEvent(String string2, Map<String, String> map) { public void logEvent(String string2, Map<String, String> map) {
Log.Helper.LOGD(this, "Logging event, " + string2); Log.Helper.LOGD(this, "Logging event, " + string2);
if(m_trackingComponents != null)
for(ITracking tracking : m_trackingComponents)
tracking.logEvent(string2, map);
} }
@Override @Override