Host: Kill off GetRenderWindowSize

This commit is contained in:
Lioncash
2014-11-15 00:11:09 -05:00
parent aa2fc1f66b
commit b94dbca160
13 changed files with 12 additions and 141 deletions

View File

@ -110,14 +110,6 @@ public final class NativeLibrary
*/
public static native void SetFilename(String filename);
/**
* Sets the dimensions of the rendering window.
*
* @param width The new width of the rendering window (in pixels).
* @param height The new height of the rendering window (in pixels).
*/
public static native void SetDimensions(int width, int height);
/**
* Gets the embedded banner within the given ISO/ROM.
*

View File

@ -15,19 +15,22 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.view.*;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.settings.input.InputConfigFragment;
import org.dolphinemu.dolphinemu.utils.EGLHelper;
import java.util.List;
import javax.microedition.khronos.opengles.GL10;
/**
* This is the activity where all of the emulation handling happens.
* This activity is responsible for displaying the SurfaceView that we render to.
@ -36,8 +39,6 @@ public final class EmulationActivity extends Activity
{
private boolean Running;
private boolean IsActionBarHidden = false;
private float screenWidth;
private float screenHeight;
private SharedPreferences sharedPrefs;
@Override
@ -45,10 +46,7 @@ public final class EmulationActivity extends Activity
{
super.onCreate(savedInstanceState);
// Retrieve screen dimensions.
DisplayMetrics dm = getResources().getDisplayMetrics();
this.screenHeight = dm.heightPixels;
this.screenWidth = dm.widthPixels;
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
// Request window features for the emulation view.
getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -60,18 +58,6 @@ public final class EmulationActivity extends Activity
actionBarBackground.setAlpha(175);
getActionBar().setBackgroundDrawable(actionBarBackground);
// Set the native rendering screen width/height.
//
// Due to a bug in Adreno, it renders the screen rotated 90 degrees when using OpenGL
// Flip the width and height when on Adreno to work around this.
// This bug is fixed in Qualcomm driver v53
// Mali isn't affected by this bug.
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
if (hasBuggedDriverDimensions())
NativeLibrary.SetDimensions((int)screenHeight, (int)screenWidth);
else
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
// Get the intent passed from the GameList when the game
// was selected. This is so the path of the game can be retrieved
// and set on the native side of the code so the emulator can actually
@ -327,39 +313,4 @@ public final class EmulationActivity extends Activity
return true;
}
// For handling bugged driver dimensions (applies mainly to Qualcomm devices)
private boolean hasBuggedDriverDimensions()
{
final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
final String vendor = eglHelper.getGL().glGetString(GL10.GL_VENDOR);
final String version = eglHelper.getGL().glGetString(GL10.GL_VERSION);
final String renderer = eglHelper.getGL().glGetString(GL10.GL_RENDERER);
if (sharedPrefs.getString("gpuPref", "Software Rendering").equals("OGL")
&& eglHelper.supportsGLES3()
&& vendor.equals("Qualcomm")
&& renderer.equals("Adreno (TM) 3"))
{
final int start = version.indexOf("V@") + 2;
final StringBuilder versionBuilder = new StringBuilder();
for (int i = start; i < version.length(); i++)
{
char c = version.charAt(i);
// End of numeric portion of version string.
if (c == ' ')
break;
versionBuilder.append(c);
}
if (Float.parseFloat(versionBuilder.toString()) < 53.0f)
return true;
}
return false;
}
}