Рабочий первый рабочий коммит
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package com.ea.ironmonkey;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
@@ -17,11 +20,11 @@ import android.net.Uri;
|
||||
import android.opengl.GLES20;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.Process;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.media.session.PlaybackStateCompat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -29,24 +32,29 @@ import android.view.KeyEvent;
|
||||
import android.view.OrientationEventListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ComponentActivity;
|
||||
|
||||
import com.ea.EAIO.EAIO;
|
||||
import com.ea.EAMIO.StorageDirectory;
|
||||
import com.ea.nimble.ApplicationLifecycle;
|
||||
import com.ea.nimble.Global;
|
||||
import com.facebook.FacebookSdk;
|
||||
import com.google.android.vending.expansion.downloader.Constants;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -61,7 +69,7 @@ import javax.microedition.khronos.opengles.GL10;
|
||||
import org.fmod.FMODAudioDevice;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
public class GameActivityMain extends AppCompatActivity implements DrawFrameListener {
|
||||
private static final String DOWNLOAD_PROPERTIES = "downloadcontent/config.properties";
|
||||
public static final int LIFECYCLE_CREATED = 1;
|
||||
public static final int LIFECYCLE_DESTROYED = 5;
|
||||
@@ -90,7 +98,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private Accelerometer accelerometer;
|
||||
private GameGLSurfaceView gameGLSurfaceView;
|
||||
private GameRenderer gameRenderer;
|
||||
private GoogleDrm googleDrm;
|
||||
private Handler handler;
|
||||
private int laststate;
|
||||
private int lifecycle;
|
||||
@@ -98,7 +105,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private FMODAudioDevice mFMODAudioDevice;
|
||||
private FrameLayout mFrameLayout;
|
||||
private OrientationEventListener mOrientationListener;
|
||||
private Map<String, Map<String, FSNode>> mResources;
|
||||
private Map mResources;
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
public int naturalOrientation;
|
||||
private RunLoop runLoop;
|
||||
@@ -112,6 +119,14 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private AssetLocationType mAssetLocationType = AssetLocationType.EXTERNAL;
|
||||
private String[] lifecycleNames = {"LIFECYCLE_NONE", "LIFECYCLE_CREATED", "LIFECYCLE_STARTED", "LIFECYCLE_RUNNING", "LIFECYCLE_STOPPED", "LIFECYCLE_DESTROYED"};
|
||||
|
||||
public File getSave() {
|
||||
return save;
|
||||
}
|
||||
|
||||
public void setSave(File save) {
|
||||
this.save = save;
|
||||
}
|
||||
|
||||
enum AssetLocationType {
|
||||
EXTERNAL,
|
||||
ASSETS,
|
||||
@@ -176,6 +191,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
restoreSave();
|
||||
Log.setEnable(true);
|
||||
Log.i(TAG, "onCreate");
|
||||
super.onCreate(bundle);
|
||||
@@ -200,11 +216,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.d(TAG, "It's Amazon dev");
|
||||
isAmazonDev = true;
|
||||
}
|
||||
if (!isAtLeastAPI(18) && getRequestedOrientation() != 6) {
|
||||
setRequestedOrientation(6);
|
||||
if (!isAtLeastAPI(18) && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
}
|
||||
if (isAtLeastAPI(28)) {
|
||||
getWindow().getAttributes().layoutInDisplayCutoutMode = 1;
|
||||
getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
getWindow().addFlags(67108864);
|
||||
}
|
||||
getWindow().setFlags(1024, 1024);
|
||||
@@ -229,7 +245,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
if (this.mOrientationListener.canDetectOrientation()) {
|
||||
this.mOrientationListener.enable();
|
||||
}
|
||||
mAudioManager = (AudioManager) getSystemService("audio");
|
||||
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||
sIsOtherMusicPlaying = mAudioManager.isMusicActive();
|
||||
Log.i(TAG, "onCreate() isMusicActive = " + Boolean.toString(sIsOtherMusicPlaying));
|
||||
this.mFMODAudioDevice = new FMODAudioDevice();
|
||||
@@ -237,7 +253,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
try {
|
||||
Log.d(TAG, "onCreate open resources.json");
|
||||
InputStream open = getAssetManager().open("resources.json");
|
||||
this.mResources = (Map) new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
|
||||
this.mResources = new Gson().fromJson(new InputStreamReader(open), new TypeToken<Map<String, Map<String, FSNode>>>() { // from class: com.ea.ironmonkey.GameActivityMain.2
|
||||
}.getType());
|
||||
Log.d(TAG, "onCreate resources.json contains " + Integer.toString(this.mResources.size()) + " items");
|
||||
open.close();
|
||||
@@ -259,7 +275,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.e(TAG, e2.getMessage());
|
||||
}
|
||||
}
|
||||
SensorManager sensorManager = (SensorManager) getSystemService("sensor");
|
||||
SensorManager sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||
Sensor defaultSensor = sensorManager.getDefaultSensor(1);
|
||||
int rotation = getWindow().getWindowManager().getDefaultDisplay().getRotation();
|
||||
switch (rotation) {
|
||||
@@ -289,13 +305,11 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
this.mFrameLayout = new FrameLayout(this);
|
||||
this.mFrameLayout.addView(this.gameGLSurfaceView);
|
||||
setContentView(this.mFrameLayout);
|
||||
this.googleDrm = new GoogleDrm(this);
|
||||
System.loadLibrary("fmodex");
|
||||
System.loadLibrary("fmodevent");
|
||||
System.loadLibrary("c++_shared");
|
||||
System.loadLibrary(Global.NIMBLE_ID);
|
||||
System.loadLibrary("app");
|
||||
FacebookSdk.sdkInitialize(this);
|
||||
Log.d(TAG, "Init EAIO/EAMIO");
|
||||
EAIO.Startup(this);
|
||||
StorageDirectory.Startup(this);
|
||||
@@ -304,14 +318,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
nativeOnCreate();
|
||||
}
|
||||
|
||||
public String[] forEach(String str) {
|
||||
Log.d(TAG, "forEach path = " + str);
|
||||
if (this.mResources.containsKey(str)) {
|
||||
Log.d(TAG, "forEach mResources contains " + str);
|
||||
return (String[]) this.mResources.get(str).keySet().toArray(new String[0]);
|
||||
}
|
||||
Log.d(TAG, "forEach mResources not contains " + str);
|
||||
return new String[0];
|
||||
public String[] forEach(String input) {
|
||||
return new String[] { input };
|
||||
}
|
||||
|
||||
public int getAssetSize(String str) {
|
||||
@@ -328,7 +336,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Log.d(TAG, "getAssetSize path = " + parent);
|
||||
if (this.mResources.containsKey(parent)) {
|
||||
Log.d(TAG, "getAssetSize mResources contains " + parent);
|
||||
Map<String, FSNode> map = this.mResources.get(parent);
|
||||
Map<String, FSNode> map = (Map<String, FSNode>) this.mResources.get(parent);
|
||||
String name = file.getName();
|
||||
Log.d(TAG, "getAssetSize name = " + name);
|
||||
if (map.containsKey(name)) {
|
||||
@@ -368,6 +376,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
|
||||
public String getObbFullPath() {
|
||||
Log.i(this.getClass().getName(), getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode()));
|
||||
return getObbDir() + "/" + ObbHelper.getObbFileName(this, getVersionCode());
|
||||
}
|
||||
|
||||
@@ -409,13 +418,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void getC2DMRegistrationId() {
|
||||
Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
|
||||
intent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
|
||||
intent.putExtra("sender", C2DMConstants.SENDER_EMAIL);
|
||||
startService(intent);
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onStart() {
|
||||
CallGC();
|
||||
@@ -447,6 +449,62 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
ApplicationLifecycle.onActivityStart(this);
|
||||
}
|
||||
|
||||
// Методы для воостановления сейва и его сохранения чтобы всегда использовать внешний сейв
|
||||
|
||||
private String saveFileName = "nfstr_save.sb";
|
||||
private File save = null;
|
||||
private File externalSave = new File(Environment.getStorageDirectory(),"games/nfsmw/nfstr_save.sb");
|
||||
|
||||
// Сохранить
|
||||
private void storeSave() {
|
||||
try {
|
||||
save = new File(getFilesDir(), "var/nfstr_save.sb");
|
||||
|
||||
// Создаем директории, если они не существуют
|
||||
externalSave.getParentFile().mkdirs();
|
||||
|
||||
// Копируем файл из внутреннего хранилища во внешнее
|
||||
try (InputStream in = new FileInputStream(save);
|
||||
OutputStream out = new FileOutputStream(externalSave)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Обработка ошибки сохранения
|
||||
}
|
||||
}
|
||||
|
||||
// Восстановить
|
||||
private void restoreSave() {
|
||||
try {
|
||||
save = new File(getFilesDir(), "var/nfstr_save.sb");
|
||||
// Проверяем, существует ли внешний файл
|
||||
if (!externalSave.exists()) {
|
||||
return; // ничего не делаем, если файла нет
|
||||
}
|
||||
|
||||
// Создаем директории для внутреннего файла, если нужно
|
||||
save.getParentFile().mkdirs();
|
||||
|
||||
// Копируем файл из внешнего хранилища во внутреннее
|
||||
try (InputStream in = new FileInputStream(externalSave);
|
||||
OutputStream out = new FileOutputStream(save)) {
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
// Обработка ошибки восстановления
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onRestart() {
|
||||
Log.i(TAG, "onRestart");
|
||||
@@ -477,7 +535,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
private void ForceHideVirtualKeyboard() {
|
||||
View currentFocus = getCurrentFocus();
|
||||
if (currentFocus != null) {
|
||||
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
||||
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
|
||||
}
|
||||
getWindow().setSoftInputMode(3);
|
||||
}
|
||||
@@ -529,9 +587,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
return;
|
||||
}
|
||||
setLifecycle(5);
|
||||
if (this.googleDrm.isEnable()) {
|
||||
this.googleDrm.destroy();
|
||||
}
|
||||
storeSave();
|
||||
if (state == 8) {
|
||||
ApplicationLifecycle.onActivityDestroy(this);
|
||||
nativeOnDestroy();
|
||||
@@ -541,12 +597,13 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
public void wakeLockAcquire() {
|
||||
if (this.isSleepModeEnabled) {
|
||||
return;
|
||||
}
|
||||
if (this.mWakeLock == null) {
|
||||
this.mWakeLock = ((PowerManager) getSystemService("power")).newWakeLock(10, TAG);
|
||||
this.mWakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(10, TAG);
|
||||
}
|
||||
if (this.mWakeLock.isHeld()) {
|
||||
return;
|
||||
@@ -621,6 +678,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity
|
||||
public void onBackPressed() {
|
||||
//super.onBackPressed();
|
||||
if (state == 1 || state == 0 || state == 7) {
|
||||
finish();
|
||||
}
|
||||
@@ -763,18 +821,9 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
@Override // android.app.Activity, android.content.ComponentCallbacks
|
||||
public void onLowMemory() {
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService("activity");
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
activityManager.getMemoryInfo(memoryInfo);
|
||||
Log.i(TAG, "Available memory: " + ((memoryInfo.availMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
|
||||
Log.i(TAG, "Threshold: " + ((memoryInfo.threshold / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) + "MB\n");
|
||||
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
|
||||
new TreeMap();
|
||||
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
|
||||
if (runningAppProcessInfo.processName.indexOf("nfs13") != -1) {
|
||||
Log.i(TAG, "Total memory: " + (activityManager.getProcessMemoryInfo(new int[]{runningAppProcessInfo.pid})[0].getTotalPss() / 1024) + "MB\n");
|
||||
}
|
||||
}
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
@@ -866,18 +915,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
case 0:
|
||||
this.splash = new SplashScreen(this);
|
||||
this.splash.init(gl10, this.gameRenderer.getWidth(), this.gameRenderer.getHeight());
|
||||
if (this.googleDrm.isEnable()) {
|
||||
Log.i(TAG, "Begin DRM Check...");
|
||||
this.handler.postDelayed(new Runnable() { // from class: com.ea.ironmonkey.GameActivityMain.7
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
GameActivityMain.this.googleDrm.start();
|
||||
}
|
||||
}, 20L);
|
||||
state = 2;
|
||||
} else {
|
||||
state = 1;
|
||||
}
|
||||
state = 1;
|
||||
this.splashCounter = 3;
|
||||
break;
|
||||
case 1:
|
||||
@@ -961,16 +999,6 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
|
||||
public void onResult(String str, int i) {
|
||||
Log.w(TAG, "onResult(" + str + "," + i + ")");
|
||||
if (str.equals("GOOGL_DRM")) {
|
||||
if (i == -1) {
|
||||
state = 1;
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "No Google account!!!!");
|
||||
finish();
|
||||
Process.killProcess(Process.myPid());
|
||||
return;
|
||||
}
|
||||
if (i == -1) {
|
||||
File file = new File(new File(str).getParent() + "/.nomedia");
|
||||
if (!file.exists()) {
|
||||
@@ -998,116 +1026,8 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
Process.killProcess(Process.myPid());
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:11:0x004a, code lost:
|
||||
|
||||
r3 = r3[1].trim().split(" ");
|
||||
com.ea.ironmonkey.Log.d("mem", r3[0]);
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:13:0x005d, code lost:
|
||||
|
||||
r3 = java.lang.Integer.parseInt(r3[0].trim()) / 1024;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:22:0x006a, code lost:
|
||||
|
||||
r3 = move-exception;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x006b, code lost:
|
||||
|
||||
com.ea.ironmonkey.Log.d("mem", r3.toString());
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public int getTotalMemory() {
|
||||
/*
|
||||
r9 = this;
|
||||
java.io.File r0 = new java.io.File
|
||||
java.lang.String r1 = "/proc/meminfo"
|
||||
r0.<init>(r1)
|
||||
boolean r1 = r0.exists()
|
||||
r2 = 0
|
||||
if (r1 == 0) goto L9c
|
||||
r1 = 1
|
||||
java.io.FileReader r3 = new java.io.FileReader // Catch: java.lang.Exception -> L7f
|
||||
r3.<init>(r0) // Catch: java.lang.Exception -> L7f
|
||||
java.io.BufferedReader r4 = new java.io.BufferedReader // Catch: java.lang.Exception -> L7f
|
||||
r4.<init>(r3) // Catch: java.lang.Exception -> L7f
|
||||
L19:
|
||||
java.lang.String r3 = r4.readLine() // Catch: java.lang.Exception -> L7f
|
||||
if (r3 == 0) goto L74
|
||||
java.lang.String r5 = "mem"
|
||||
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = ":"
|
||||
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r1] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
r5 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = r5.trim() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = r5.toLowerCase() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r6 = "memtotal"
|
||||
boolean r5 = r5.equals(r6) // Catch: java.lang.Exception -> L7f
|
||||
if (r5 == 0) goto L19
|
||||
r3 = r3[r1] // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r3 = r3.trim() // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = " "
|
||||
java.lang.String[] r3 = r3.split(r5) // Catch: java.lang.Exception -> L7f
|
||||
java.lang.String r5 = "mem"
|
||||
r6 = r3[r2] // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r6) // Catch: java.lang.Exception -> L7f
|
||||
r3 = r3[r2] // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
java.lang.String r3 = r3.trim() // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
int r3 = java.lang.Integer.parseInt(r3) // Catch: java.lang.NumberFormatException -> L6a java.lang.Exception -> L7f
|
||||
int r3 = r3 / 1024
|
||||
goto L75
|
||||
L6a:
|
||||
r3 = move-exception
|
||||
java.lang.String r5 = "mem"
|
||||
java.lang.String r3 = r3.toString() // Catch: java.lang.Exception -> L7f
|
||||
com.ea.ironmonkey.Log.d(r5, r3) // Catch: java.lang.Exception -> L7f
|
||||
L74:
|
||||
r3 = 0
|
||||
L75:
|
||||
r4.close() // Catch: java.lang.Exception -> L7a
|
||||
r2 = r3
|
||||
goto L9c
|
||||
L7a:
|
||||
r4 = move-exception
|
||||
r8 = r4
|
||||
r4 = r3
|
||||
r3 = r8
|
||||
goto L81
|
||||
L7f:
|
||||
r3 = move-exception
|
||||
r4 = 0
|
||||
L81:
|
||||
java.lang.String r5 = "GameActivityMain"
|
||||
java.lang.String r6 = "Error reading system file: %s (%s)"
|
||||
r7 = 2
|
||||
java.lang.Object[] r7 = new java.lang.Object[r7]
|
||||
java.lang.String r0 = r0.getAbsolutePath()
|
||||
r7[r2] = r0
|
||||
java.lang.String r0 = r3.getMessage()
|
||||
r7[r1] = r0
|
||||
java.lang.String r0 = java.lang.String.format(r6, r7)
|
||||
com.ea.ironmonkey.Log.e(r5, r0)
|
||||
r2 = r4
|
||||
L9c:
|
||||
java.lang.String r0 = "mem"
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
java.lang.String r3 = "totalmemory="
|
||||
r1.append(r3)
|
||||
r1.append(r2)
|
||||
java.lang.String r1 = r1.toString()
|
||||
com.ea.ironmonkey.Log.d(r0, r1)
|
||||
return r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.getTotalMemory():int");
|
||||
return 40000;
|
||||
}
|
||||
|
||||
public void openURL(String str) {
|
||||
@@ -1125,87 +1045,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
}
|
||||
|
||||
public float getPerformanceScore() {
|
||||
String readCpuFile = readCpuFile("present");
|
||||
int i = 0;
|
||||
float f = 0.0f;
|
||||
if (readCpuFile.length() > 0) {
|
||||
List<Integer> parseCpuList = parseCpuList(readCpuFile);
|
||||
Iterator<Integer> it = parseCpuList.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
if (readCpuFile(String.format("cpu%d/cpufreq/cpuinfo_max_freq", Integer.valueOf(it.next().intValue()))).length() > 0) {
|
||||
try {
|
||||
f = Integer.parseInt(r4) * 0.001f;
|
||||
break;
|
||||
} catch (NumberFormatException unused) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = parseCpuList.size();
|
||||
}
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
return calcPerformanceScore(f, i, displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
}
|
||||
|
||||
public List<Integer> parseCpuList(String str) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (String str2 : str.split(",")) {
|
||||
if (str2.contains(Constants.FILENAME_SEQUENCE_SEPARATOR)) {
|
||||
String[] split = str2.split(Constants.FILENAME_SEQUENCE_SEPARATOR);
|
||||
if (split.length >= 2) {
|
||||
try {
|
||||
int parseInt = Integer.parseInt(split[1]);
|
||||
for (int parseInt2 = Integer.parseInt(split[0]); parseInt2 <= parseInt; parseInt2++) {
|
||||
arrayList.add(Integer.valueOf(parseInt2));
|
||||
}
|
||||
} catch (NumberFormatException unused) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
arrayList.add(Integer.valueOf(Integer.parseInt(str2)));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public String readCpuFile(String str) {
|
||||
File file = new File("/sys/devices/system/cpu", str);
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||
String readLine = bufferedReader.readLine();
|
||||
bufferedReader.close();
|
||||
return readLine;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, String.format("Error reading system file: %s (%s)", file.getAbsolutePath(), e.getMessage()));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public float calcPerformanceScore(float f, int i, int i2, int i3) {
|
||||
Log.i(TAG, "calcPerformanceScore(" + f + ", " + i + ", " + i2 + ", " + i3 + ")");
|
||||
float f2 = f * 0.001f;
|
||||
float f3 = (3.0f * f2) + 0.0f;
|
||||
if (i > 1) {
|
||||
f3 += f2 * (Math.min(i, 4) - 1) * 0.5f;
|
||||
}
|
||||
double d = 0.0f;
|
||||
double sqrt = Math.sqrt(i2 * i3) * 0.0010000000474974513d * 0.5d;
|
||||
Double.isNaN(d);
|
||||
float f4 = (float) (d + sqrt);
|
||||
try {
|
||||
Log.i(TAG, new BufferedReader(new FileReader(new File("/proc/cpuinfo"))).readLine());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.i(TAG, Build.MODEL);
|
||||
return ((f3 + 1.0f) / (f4 + 1.0f)) * 0.33333334f;
|
||||
return 6.6f;
|
||||
}
|
||||
|
||||
public boolean needInstallWallpaper() {
|
||||
@@ -1213,145 +1053,7 @@ public class GameActivityMain extends Activity implements DrawFrameListener {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:15:0x0068, code lost:
|
||||
|
||||
if (r3 != null) goto L13;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x006a, code lost:
|
||||
|
||||
r3.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:27:0x0099, code lost:
|
||||
|
||||
if (r3 != null) goto L13;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void installWallpaper() {
|
||||
/*
|
||||
r12 = this;
|
||||
android.content.Intent r0 = new android.content.Intent
|
||||
java.lang.String r1 = "android.intent.action.VIEW"
|
||||
r0.<init>(r1)
|
||||
java.lang.String r1 = new java.lang.String
|
||||
java.lang.StringBuilder r2 = new java.lang.StringBuilder
|
||||
r2.<init>()
|
||||
java.io.File r3 = android.os.Environment.getExternalStorageDirectory()
|
||||
java.lang.String r3 = r3.getAbsolutePath()
|
||||
r2.append(r3)
|
||||
java.lang.String r3 = "/published/wallpaper/"
|
||||
r2.append(r3)
|
||||
java.lang.String r2 = r2.toString()
|
||||
r1.<init>(r2)
|
||||
r2 = 0
|
||||
java.io.File r3 = new java.io.File // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r3.<init>(r1) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r3.mkdirs() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
android.content.res.Resources r3 = r12.getResources() // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
r4 = 2131427328(0x7f0b0000, float:1.847627E38)
|
||||
android.content.res.AssetFileDescriptor r3 = r3.openRawResourceFd(r4) // Catch: java.lang.Throwable -> L7a java.io.IOException -> L8d
|
||||
java.io.File r4 = new java.io.File // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.lang.String r5 = "wallpaper.apk"
|
||||
r4.<init>(r1, r5) // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
r4.createNewFile() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.io.FileInputStream r5 = r3.createInputStream() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.nio.channels.FileChannel r5 = r5.getChannel() // Catch: java.lang.Throwable -> L75 java.io.IOException -> L78
|
||||
java.io.FileOutputStream r6 = new java.io.FileOutputStream // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
r6.<init>(r4) // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
java.nio.channels.FileChannel r4 = r6.getChannel() // Catch: java.lang.Throwable -> L73 java.io.IOException -> L8f
|
||||
r8 = 0
|
||||
long r10 = r3.getLength() // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
|
||||
r6 = r4
|
||||
r7 = r5
|
||||
r6.transferFrom(r7, r8, r10) // Catch: java.lang.Throwable -> L6e java.io.IOException -> L71
|
||||
if (r4 == 0) goto L63
|
||||
r4.close() // Catch: java.io.IOException -> L9c
|
||||
L63:
|
||||
if (r5 == 0) goto L68
|
||||
r5.close() // Catch: java.io.IOException -> L9c
|
||||
L68:
|
||||
if (r3 == 0) goto L9c
|
||||
L6a:
|
||||
r3.close() // Catch: java.io.IOException -> L9c
|
||||
goto L9c
|
||||
L6e:
|
||||
r0 = move-exception
|
||||
r2 = r4
|
||||
goto L7d
|
||||
L71:
|
||||
r2 = r4
|
||||
goto L8f
|
||||
L73:
|
||||
r0 = move-exception
|
||||
goto L7d
|
||||
L75:
|
||||
r0 = move-exception
|
||||
r5 = r2
|
||||
goto L7d
|
||||
L78:
|
||||
r5 = r2
|
||||
goto L8f
|
||||
L7a:
|
||||
r0 = move-exception
|
||||
r3 = r2
|
||||
r5 = r3
|
||||
L7d:
|
||||
if (r2 == 0) goto L82
|
||||
r2.close() // Catch: java.io.IOException -> L8c
|
||||
L82:
|
||||
if (r5 == 0) goto L87
|
||||
r5.close() // Catch: java.io.IOException -> L8c
|
||||
L87:
|
||||
if (r3 == 0) goto L8c
|
||||
r3.close() // Catch: java.io.IOException -> L8c
|
||||
L8c:
|
||||
throw r0
|
||||
L8d:
|
||||
r3 = r2
|
||||
r5 = r3
|
||||
L8f:
|
||||
if (r2 == 0) goto L94
|
||||
r2.close() // Catch: java.io.IOException -> L9c
|
||||
L94:
|
||||
if (r5 == 0) goto L99
|
||||
r5.close() // Catch: java.io.IOException -> L9c
|
||||
L99:
|
||||
if (r3 == 0) goto L9c
|
||||
goto L6a
|
||||
L9c:
|
||||
java.io.File r2 = new java.io.File
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder
|
||||
r3.<init>()
|
||||
r3.append(r1)
|
||||
java.lang.String r1 = "wallpaper.apk"
|
||||
r3.append(r1)
|
||||
java.lang.String r1 = r3.toString()
|
||||
r2.<init>(r1)
|
||||
android.net.Uri r1 = android.net.Uri.fromFile(r2)
|
||||
java.lang.String r2 = "application/vnd.android.package-archive"
|
||||
r0.setDataAndType(r1, r2)
|
||||
r12.startActivity(r0)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.ea.ironmonkey.GameActivityMain.installWallpaper():void");
|
||||
}
|
||||
|
||||
public void onDownloadEvent(int i) {
|
||||
String str = getApplicationInfo().dataDir + "/files/var1/adcEvents";
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
Log.i(TAG, "GetADCTelemetry: eventId= " + i + " eventTime=" + currentTimeMillis + " fileName=" + str);
|
||||
byte[] bArr = {(byte) ((i >> 24) & 255), (byte) ((i >> 16) & 255), (byte) ((i >> 8) & 255), (byte) (i & 255), (byte) ((int) ((currentTimeMillis >> 56) & 255)), (byte) ((int) ((currentTimeMillis >> 48) & 255)), (byte) ((int) ((currentTimeMillis >> 40) & 255)), (byte) ((int) ((currentTimeMillis >> 32) & 255)), (byte) ((int) ((currentTimeMillis >> 24) & 255)), (byte) ((int) ((currentTimeMillis >> 16) & 255)), (byte) ((int) ((currentTimeMillis >> 8) & 255)), (byte) ((int) (currentTimeMillis & 255))};
|
||||
Log.i(TAG, "Write adcEvents file");
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(new File(str), true);
|
||||
fileOutputStream.write(bArr, 0, 12);
|
||||
fileOutputStream.close();
|
||||
} catch (Exception unused) {
|
||||
Log.i(TAG, "Can't save adcEvents file");
|
||||
}
|
||||
}
|
||||
public void installWallpaper() {}
|
||||
|
||||
public long getUtcTime() {
|
||||
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis());
|
||||
|
||||
Reference in New Issue
Block a user