Add a configuration option to enable forced software render
This commit is contained in:
parent
b728b0dfb5
commit
66d0312f37
|
@ -317,6 +317,34 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/software_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:ems="10"
|
||||
android:gravity="center_vertical|left"
|
||||
android:text="@string/select_software" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<de.ankri.views.Switch
|
||||
android:id="@+id/software_option"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<string name="select_stretch">Widescreen Mode</string>
|
||||
<string name="set_frameskip">Frameskip Value</string>
|
||||
<string name="select_render">PVR Rendering (does nothing for now)</string>
|
||||
<string name="select_software">Force Software Rendering</string>
|
||||
<string name="select_force_gpu">Force v6 GPU Config</string>
|
||||
<string name="default_disk">Set Default Disk</string>
|
||||
<string name="show_profiling_tools">Show BIOS Debug Tools</string>
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ConfigureFragment extends Fragment {
|
|||
getCurrentConfiguration(home_directory);
|
||||
|
||||
// Generate the menu options and fill in existing settings
|
||||
Switch force_gpu_opt = (Switch) getView().findViewById(
|
||||
final Switch force_gpu_opt = (Switch) getView().findViewById(
|
||||
R.id.force_gpu_option);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
OnCheckedChangeListener force_gpu_options = new OnCheckedChangeListener() {
|
||||
|
@ -108,6 +108,32 @@ public class ConfigureFragment extends Fragment {
|
|||
force_gpu_opt.setEnabled(false);
|
||||
}
|
||||
|
||||
Switch force_software_opt = (Switch) getView().findViewById(
|
||||
R.id.software_option);
|
||||
OnCheckedChangeListener force_software = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
mPrefs.edit().putInt("render_type", isChecked ? 1 : 2).commit();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
if (isChecked) {
|
||||
force_gpu_opt.setEnabled(false);
|
||||
mPrefs.edit().putBoolean("force_gpu", false).commit();
|
||||
MainActivity.force_gpu = false;
|
||||
} else {
|
||||
force_gpu_opt.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
int software = mPrefs.getInt("render_type", GL2JNIView.LAYER_TYPE_HARDWARE);
|
||||
if (software == GL2JNIView.LAYER_TYPE_SOFTWARE) {
|
||||
force_software_opt.setChecked(true);
|
||||
} else {
|
||||
force_software_opt.setChecked(false);
|
||||
}
|
||||
force_software_opt.setOnCheckedChangeListener(force_software);
|
||||
|
||||
OnCheckedChangeListener dynarec_options = new OnCheckedChangeListener() {
|
||||
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.reicast.emulator;
|
||||
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
|
@ -10,6 +13,7 @@ import javax.microedition.khronos.opengles.GL10;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioManager;
|
||||
|
@ -61,6 +65,9 @@ class GL2JNIView extends GLSurfaceView
|
|||
private static final int key_CONT_Y = 0x0200;
|
||||
private static final int key_CONT_X = 0x0400;
|
||||
|
||||
public static final int LAYER_TYPE_SOFTWARE = 1;
|
||||
public static final int LAYER_TYPE_HARDWARE = 2;
|
||||
|
||||
Vibrator vib;
|
||||
|
||||
private boolean editVjoyMode = false;
|
||||
|
@ -215,10 +222,24 @@ class GL2JNIView extends GLSurfaceView
|
|||
|
||||
Runtime.getRuntime().freeMemory();
|
||||
System.gc();
|
||||
|
||||
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
||||
|
||||
int rederType = prefs.getInt("render_type", LAYER_TYPE_HARDWARE);
|
||||
try {
|
||||
Method setLayerType = this.getClass().getMethod(
|
||||
"setLayerType", new Class[] { int.class, Paint.class });
|
||||
if (setLayerType != null)
|
||||
setLayerType.invoke(this, new Object[] { rederType, null });
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
}
|
||||
|
||||
vjoy_d_custom = readCustomVjoyValues(context);
|
||||
|
||||
scaleGestureDetector = new ScaleGestureDetector(context, new OscOnScaleGestureListener());
|
||||
|
|
|
@ -217,6 +217,8 @@ class GL2JNIViewV6 extends GLSurfaceView
|
|||
|
||||
Runtime.getRuntime().freeMemory();
|
||||
System.gc();
|
||||
|
||||
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
touchVibrationEnabled = prefs.getBoolean("touch_vibration_enabled", true);
|
||||
|
|
Loading…
Reference in New Issue