- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
332 lines
15 KiB
Java
332 lines
15 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.opengl.GLSurfaceView;
|
|
import android.util.Log;
|
|
import android.view.MotionEvent;
|
|
import javax.microedition.khronos.egl.EGL10;
|
|
import javax.microedition.khronos.egl.EGLConfig;
|
|
import javax.microedition.khronos.egl.EGLContext;
|
|
import javax.microedition.khronos.egl.EGLDisplay;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class GLView extends GLSurfaceView {
|
|
private static final int EGL_CONTEXT_CLIENT_VERSION = 12440;
|
|
private static final int EGL_COVERAGE_BUFFERS_NV = 12512;
|
|
private static final int EGL_COVERAGE_SAMPLES_NV = 12513;
|
|
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
|
|
private static final int EGL_DEPTH_ENCODING_NV = 12514;
|
|
private static final int EGL_OPENGL_ES2_BIT = 4;
|
|
private EGLContext m_glContext;
|
|
|
|
public EGLContext getGLContext() {
|
|
return this.m_glContext;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@TargetApi(11)
|
|
public GLView(Context context) {
|
|
super(context);
|
|
this.m_glContext = null;
|
|
setImportantForAccessibility(2);
|
|
setPreserveEGLContextOnPause(true);
|
|
setFocusable(true);
|
|
setFocusableInTouchMode(true);
|
|
setEGLConfigChooser(new ConfigChooser());
|
|
setEGLContextFactory(new ContextFactory());
|
|
setRenderer(new GLRenderer());
|
|
}
|
|
|
|
public class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
|
static final /* synthetic */ boolean $assertionsDisabled = false;
|
|
|
|
private ConfigChooser() {
|
|
}
|
|
|
|
@Override // android.opengl.GLSurfaceView.EGLConfigChooser
|
|
public EGLConfig chooseConfig(EGL10 egl10, EGLDisplay eGLDisplay) {
|
|
ConfigAttribs configAttribs = GLView.this.new ConfigAttribs();
|
|
configAttribs.redBits = 8;
|
|
configAttribs.greenBits = 8;
|
|
configAttribs.blueBits = 8;
|
|
configAttribs.alphaBits = 0;
|
|
configAttribs.stencilBits = 8;
|
|
configAttribs.depthBits = 24;
|
|
configAttribs.samples = 0;
|
|
configAttribs.nvSamples = 0;
|
|
int[] iArr = new int[1];
|
|
egl10.eglGetConfigs(eGLDisplay, null, 0, iArr);
|
|
int i = iArr[0];
|
|
if (i > 0) {
|
|
EGLConfig[] eGLConfigArr = new EGLConfig[i];
|
|
egl10.eglGetConfigs(eGLDisplay, eGLConfigArr, i, iArr);
|
|
int i2 = -1;
|
|
int i3 = -1;
|
|
for (int i4 = 0; i4 < i; i4++) {
|
|
ConfigAttribs configAttribs2 = GLView.this.new ConfigAttribs(egl10, eGLDisplay, eGLConfigArr[i4]);
|
|
configAttribs2.print(false);
|
|
int scoreConfig = scoreConfig(configAttribs2, configAttribs);
|
|
if (scoreConfig != -1 && (scoreConfig < i3 || i3 == -1)) {
|
|
i2 = i4;
|
|
i3 = scoreConfig;
|
|
}
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("found config = ");
|
|
sb.append(i2);
|
|
if (i2 == -1) {
|
|
configAttribs.depthBits = 16;
|
|
for (int i5 = 0; i5 < i; i5++) {
|
|
ConfigAttribs configAttribs3 = GLView.this.new ConfigAttribs(egl10, eGLDisplay, eGLConfigArr[i5]);
|
|
configAttribs3.print(false);
|
|
int scoreConfig2 = scoreConfig(configAttribs3, configAttribs);
|
|
if (scoreConfig2 != -1 && (scoreConfig2 < i3 || i3 == -1)) {
|
|
i2 = i5;
|
|
i3 = scoreConfig2;
|
|
}
|
|
}
|
|
}
|
|
GLView.this.new ConfigAttribs(egl10, eGLDisplay, eGLConfigArr[i2]).print(true);
|
|
return eGLConfigArr[i2];
|
|
}
|
|
Log.e("GLView", "Failed to find acceptable EGLConfig!");
|
|
return null;
|
|
}
|
|
|
|
private int scoreConfig(ConfigAttribs configAttribs, ConfigAttribs configAttribs2) {
|
|
int i;
|
|
int i2;
|
|
if ((configAttribs.surfaceType & 4) == 0 || (configAttribs.renderableType & 4) == 0 || configAttribs.redBits < configAttribs2.redBits || configAttribs.greenBits < configAttribs2.greenBits || configAttribs.blueBits < configAttribs2.blueBits || configAttribs.stencilBits < configAttribs2.stencilBits || (i = configAttribs.depthBits) < (i2 = configAttribs2.depthBits)) {
|
|
return -1;
|
|
}
|
|
int abs = Math.abs(i - i2);
|
|
int abs2 = Math.abs(configAttribs.redBits - configAttribs2.redBits);
|
|
int i3 = (abs * abs) + (abs2 * abs2);
|
|
int abs3 = Math.abs(configAttribs.greenBits - configAttribs2.greenBits);
|
|
int i4 = i3 + (abs3 * abs3);
|
|
int abs4 = Math.abs(configAttribs.blueBits - configAttribs2.blueBits);
|
|
int i5 = i4 + (abs4 * abs4);
|
|
int abs5 = Math.abs(configAttribs.alphaBits - configAttribs2.alphaBits);
|
|
int i6 = i5 + (abs5 * abs5);
|
|
int abs6 = Math.abs(configAttribs.stencilBits - configAttribs2.stencilBits);
|
|
int i7 = i6 + (abs6 * abs6);
|
|
int abs7 = Math.abs(configAttribs.samples - configAttribs2.samples);
|
|
int i8 = i7 + (abs7 * abs7);
|
|
int abs8 = Math.abs(configAttribs.nvSamples - configAttribs2.nvSamples);
|
|
int i9 = i8 + (abs8 * abs8);
|
|
if (configAttribs.nv_depthEncoding != GLView.EGL_DEPTH_ENCODING_NONLINEAR_NV) {
|
|
i9++;
|
|
}
|
|
return (configAttribs2.nvSamples <= 0 || configAttribs.nvSamples <= 0) ? i9 : i9 + 1;
|
|
}
|
|
}
|
|
|
|
public class ConfigAttribs {
|
|
int alphaBits;
|
|
int blueBits;
|
|
int caveat;
|
|
int depthBits;
|
|
int greenBits;
|
|
int level;
|
|
int nvSamples;
|
|
int nv_depthEncoding;
|
|
int redBits;
|
|
int renderableType;
|
|
int samples;
|
|
int stencilBits;
|
|
int surfaceType;
|
|
int transparentType;
|
|
|
|
public ConfigAttribs() {
|
|
this.redBits = 0;
|
|
this.greenBits = 0;
|
|
this.blueBits = 0;
|
|
this.alphaBits = 0;
|
|
this.depthBits = 0;
|
|
this.stencilBits = 0;
|
|
this.samples = 0;
|
|
this.nvSamples = 0;
|
|
this.level = 0;
|
|
this.caveat = 0;
|
|
this.surfaceType = 0;
|
|
this.renderableType = 0;
|
|
this.transparentType = 0;
|
|
this.nv_depthEncoding = 0;
|
|
}
|
|
|
|
public ConfigAttribs(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig) {
|
|
this.redBits = 0;
|
|
this.greenBits = 0;
|
|
this.blueBits = 0;
|
|
this.alphaBits = 0;
|
|
this.depthBits = 0;
|
|
this.stencilBits = 0;
|
|
this.samples = 0;
|
|
this.nvSamples = 0;
|
|
this.level = 0;
|
|
this.caveat = 0;
|
|
this.surfaceType = 0;
|
|
this.renderableType = 0;
|
|
this.transparentType = 0;
|
|
this.nv_depthEncoding = 0;
|
|
this.redBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12324);
|
|
this.greenBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12323);
|
|
this.blueBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12322);
|
|
this.alphaBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12321);
|
|
this.depthBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12325);
|
|
this.stencilBits = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12326);
|
|
this.samples = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12337);
|
|
this.nvSamples = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, GLView.EGL_COVERAGE_SAMPLES_NV);
|
|
this.level = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12329);
|
|
this.caveat = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12327);
|
|
this.surfaceType = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12339);
|
|
this.renderableType = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12352);
|
|
this.transparentType = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, 12340);
|
|
this.nv_depthEncoding = getEGLConfigAttrib(egl10, eGLDisplay, eGLConfig, GLView.EGL_DEPTH_ENCODING_NV);
|
|
}
|
|
|
|
private int getEGLConfigAttrib(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig, int i) {
|
|
int[] iArr = {0};
|
|
egl10.eglGetConfigAttrib(eGLDisplay, eGLConfig, i, iArr);
|
|
return iArr[0];
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void print(boolean z) {
|
|
String str = (this.surfaceType & 4) != 0 ? "true" : "false";
|
|
String str2 = (this.renderableType & 4) != 0 ? "true" : "false";
|
|
int i = this.caveat;
|
|
String str3 = i != 12368 ? i != 12369 ? "none" : "bad" : "slow";
|
|
String str4 = this.nv_depthEncoding == GLView.EGL_DEPTH_ENCODING_NONLINEAR_NV ? "nonlinear" : "none";
|
|
String str5 = this.transparentType == 12370 ? "rgb" : "none";
|
|
if (z) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("EGL_RED_SIZE: ");
|
|
sb.append(this.redBits);
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("EGL_GREEN_SIZE: ");
|
|
sb2.append(this.greenBits);
|
|
StringBuilder sb3 = new StringBuilder();
|
|
sb3.append("EGL_BLUE_SIZE: ");
|
|
sb3.append(this.blueBits);
|
|
StringBuilder sb4 = new StringBuilder();
|
|
sb4.append("EGL_ALPHA_SIZE: ");
|
|
sb4.append(this.alphaBits);
|
|
StringBuilder sb5 = new StringBuilder();
|
|
sb5.append("EGL_DEPTH_SIZE: ");
|
|
sb5.append(this.depthBits);
|
|
StringBuilder sb6 = new StringBuilder();
|
|
sb6.append("EGL_STENCIL_SIZE: ");
|
|
sb6.append(this.stencilBits);
|
|
StringBuilder sb7 = new StringBuilder();
|
|
sb7.append("EGL_SAMPLES: ");
|
|
sb7.append(this.samples);
|
|
StringBuilder sb8 = new StringBuilder();
|
|
sb8.append("EGL_COVERAGE_SAMPLES_NV: ");
|
|
sb8.append(this.nvSamples);
|
|
StringBuilder sb9 = new StringBuilder();
|
|
sb9.append("EGL_LEVEL: ");
|
|
sb9.append(this.level);
|
|
StringBuilder sb10 = new StringBuilder();
|
|
sb10.append("EGL_TRANSPARENT_TYPE: ");
|
|
sb10.append(str5);
|
|
StringBuilder sb11 = new StringBuilder();
|
|
sb11.append("EGL_WINDOW_BIT: ");
|
|
sb11.append(str);
|
|
StringBuilder sb12 = new StringBuilder();
|
|
sb12.append("EGL_OPENGL_ES2_BIT: ");
|
|
sb12.append(str2);
|
|
StringBuilder sb13 = new StringBuilder();
|
|
sb13.append("EGL_CONFIG_CAVEAT: ");
|
|
sb13.append(str3);
|
|
StringBuilder sb14 = new StringBuilder();
|
|
sb14.append("EGL_DEPTH_ENCODING_NV: ");
|
|
sb14.append(str4);
|
|
return;
|
|
}
|
|
String.format("EGLConfig r:%d g:%d b:%d a:%d d:%d s:%d aa:%d nvaa:%d level:%d trans:%s gles2:%s window:%s caveat:%s nvDepthEnc:%s", Integer.valueOf(this.redBits), Integer.valueOf(this.greenBits), Integer.valueOf(this.blueBits), Integer.valueOf(this.alphaBits), Integer.valueOf(this.depthBits), Integer.valueOf(this.stencilBits), Integer.valueOf(this.samples), Integer.valueOf(this.nvSamples), Integer.valueOf(this.level), str5, str2, str, str3, str4);
|
|
}
|
|
}
|
|
|
|
public class ContextFactory implements GLSurfaceView.EGLContextFactory {
|
|
private ContextFactory() {
|
|
}
|
|
|
|
@Override // android.opengl.GLSurfaceView.EGLContextFactory
|
|
public EGLContext createContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLConfig eGLConfig) {
|
|
Log.w("RealRacing3", "creating OpenGL ES 2.0 context");
|
|
int[] iArr = {GLView.EGL_CONTEXT_CLIENT_VERSION, 2, 12344};
|
|
GLView.this.m_glContext = egl10.eglCreateContext(eGLDisplay, eGLConfig, EGL10.EGL_NO_CONTEXT, iArr);
|
|
GLView.this.new ConfigAttribs(egl10, eGLDisplay, eGLConfig).print(true);
|
|
return GLView.this.m_glContext;
|
|
}
|
|
|
|
@Override // android.opengl.GLSurfaceView.EGLContextFactory
|
|
public void destroyContext(EGL10 egl10, EGLDisplay eGLDisplay, EGLContext eGLContext) {
|
|
egl10.eglDestroyContext(eGLDisplay, eGLContext);
|
|
GLView.this.m_glContext = null;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
if (MainActivity.instance.getPaused()) {
|
|
return true;
|
|
}
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0 || actionMasked == 5) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
queueEvent(new TouchEvent(actionMasked, motionEvent.getPointerId(actionIndex), motionEvent.getX(actionIndex), motionEvent.getY(actionIndex), false));
|
|
} else if (actionMasked == 2) {
|
|
for (int i = 0; i < motionEvent.getPointerCount(); i++) {
|
|
queueEvent(new TouchEvent(actionMasked, motionEvent.getPointerId(i), motionEvent.getX(i), motionEvent.getY(i), false));
|
|
}
|
|
} else if (actionMasked == 1 || actionMasked == 6) {
|
|
int actionIndex2 = motionEvent.getActionIndex();
|
|
queueEvent(new TouchEvent(actionMasked, motionEvent.getPointerId(actionIndex2), motionEvent.getX(actionIndex2), motionEvent.getY(actionIndex2), motionEvent.getActionMasked() == 1));
|
|
} else if (actionMasked == 3) {
|
|
queueEvent(new TouchEvent(actionMasked, 0, 0.0f, 0.0f, false));
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public class TouchEvent implements Runnable {
|
|
int m_action;
|
|
int m_id;
|
|
boolean m_last;
|
|
float m_x;
|
|
float m_y;
|
|
|
|
public TouchEvent(int i, int i2, float f, float f2, boolean z) {
|
|
this.m_action = i;
|
|
this.m_id = i2;
|
|
this.m_x = f;
|
|
this.m_y = f2;
|
|
this.m_last = z;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
int i = this.m_action;
|
|
if (i != 0 && i != 5) {
|
|
if (i == 2) {
|
|
MainActivity.instance.onTouchMoveJNI(this.m_id, this.m_x, this.m_y);
|
|
} else {
|
|
if (i != 1 && i != 6) {
|
|
if (i == 3) {
|
|
MainActivity.instance.onTouchCancelJNI();
|
|
}
|
|
}
|
|
MainActivity.instance.onTouchEndJNI(this.m_id, this.m_x, this.m_y, this.m_last);
|
|
}
|
|
}
|
|
MainActivity.instance.onTouchBeginJNI(this.m_id, this.m_x, this.m_y);
|
|
} catch (UnsatisfiedLinkError e) {
|
|
Log.e("RealRacing3", "UnsatisfiedLinkError when processing touch input: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|