mirror of
https://github.com/libretro/RetroArch
synced 2025-01-18 13:23:40 +00:00
Revert "(Android) Cleanup - remove android java audio driver / remove android java video"
This reverts commit ba99f83aa5d1481876530747dbbae7d445415634.
This commit is contained in:
parent
ba99f83aa5
commit
254239849a
146
android/src/com/retroarch/audio_android.java
Normal file
146
android/src/com/retroarch/audio_android.java
Normal file
@ -0,0 +1,146 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.retroarch;
|
||||
|
||||
import android.media.AudioFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioTrack;
|
||||
|
||||
public class audio_android
|
||||
{
|
||||
private static AudioTrack _track;
|
||||
private static int _minSamples;
|
||||
private static float _volume = AudioTrack.getMaxVolume();
|
||||
|
||||
private static int _rate;
|
||||
private static int _bits;
|
||||
private static int _channels;
|
||||
|
||||
|
||||
private audio_android()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void pause()
|
||||
{
|
||||
if (_track != null && _track.getPlayState() != AudioTrack.PLAYSTATE_PAUSED)
|
||||
_track.pause();
|
||||
}
|
||||
|
||||
|
||||
public static void resume()
|
||||
{
|
||||
if (_track != null && _track.getPlayState() != AudioTrack.PLAYSTATE_PLAYING)
|
||||
_track.play();
|
||||
}
|
||||
|
||||
public int getMinSamples()
|
||||
{
|
||||
return _minSamples;
|
||||
}
|
||||
|
||||
|
||||
public static int write(short[] data, int size)
|
||||
{
|
||||
int retVal = 0;
|
||||
if (_track == null)
|
||||
return retVal;
|
||||
|
||||
retVal = _track.write(data, 0, size);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
void set_volume(int vol)
|
||||
{
|
||||
final float min = AudioTrack.getMinVolume();
|
||||
final float max = AudioTrack.getMaxVolume();
|
||||
_volume = min + (max - min) * vol / 100;
|
||||
|
||||
if (_track != null)
|
||||
_track.setStereoVolume(_volume, _volume);
|
||||
}
|
||||
|
||||
|
||||
public static void free()
|
||||
{
|
||||
if (_track != null)
|
||||
{
|
||||
_track.pause();
|
||||
_track.release();
|
||||
_track = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean init(int rate, int bits, int channels)
|
||||
{
|
||||
_track = null;
|
||||
_rate = rate;
|
||||
_bits = bits;
|
||||
_channels = channels;
|
||||
|
||||
// generate format
|
||||
int format = (_bits == 16
|
||||
? AudioFormat.ENCODING_PCM_16BIT
|
||||
: AudioFormat.ENCODING_PCM_8BIT);
|
||||
|
||||
// determine channel config
|
||||
int channelConfig = (_channels == 2
|
||||
? AudioFormat.CHANNEL_OUT_STEREO
|
||||
: AudioFormat.CHANNEL_OUT_MONO);
|
||||
|
||||
int bufferSize = AudioTrack.getMinBufferSize(_rate, channelConfig,
|
||||
format);
|
||||
|
||||
_minSamples = bufferSize;
|
||||
|
||||
try
|
||||
{
|
||||
_track = new AudioTrack(
|
||||
AudioManager.STREAM_MUSIC,
|
||||
_rate,
|
||||
channelConfig,
|
||||
format,
|
||||
bufferSize,
|
||||
AudioTrack.MODE_STREAM);
|
||||
|
||||
if (_track.getState() == AudioTrack.STATE_UNINITIALIZED)
|
||||
_track = null;
|
||||
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
_track = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// set max volume
|
||||
_track.setStereoVolume(_volume, _volume);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static int getMaxBufferSize()
|
||||
{
|
||||
return _minSamples;
|
||||
}
|
||||
}
|
@ -25,18 +25,22 @@ public class FileArrayAdapter extends ArrayAdapter<Option> implements SectionInd
|
||||
private int id;
|
||||
private List<Option>items;
|
||||
|
||||
public FileArrayAdapter(Context context, int textViewResourceId, List<Option> objects)
|
||||
{
|
||||
public FileArrayAdapter(Context context, int textViewResourceId,
|
||||
List<Option> objects) {
|
||||
super(context, textViewResourceId, objects);
|
||||
c = context;
|
||||
id = textViewResourceId;
|
||||
items = objects;
|
||||
|
||||
initAlphaIndexer();
|
||||
}
|
||||
|
||||
private void initAlphaIndexer()
|
||||
{
|
||||
alphaIndexer = new HashMap<String, Integer>();
|
||||
int size = items.size();
|
||||
|
||||
for (int x = 0; x < size; x++)
|
||||
{
|
||||
for (int x = 0; x < size; x++) {
|
||||
Option o = items.get(x);
|
||||
|
||||
String ch = o.getName().substring(0, 1);
|
||||
@ -44,7 +48,9 @@ public class FileArrayAdapter extends ArrayAdapter<Option> implements SectionInd
|
||||
ch = ch.toUpperCase();
|
||||
|
||||
if (!alphaIndexer.containsKey(ch))
|
||||
{
|
||||
alphaIndexer.put(ch, x);
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> sectionLetters = alphaIndexer.keySet();
|
||||
@ -55,34 +61,34 @@ public class FileArrayAdapter extends ArrayAdapter<Option> implements SectionInd
|
||||
|
||||
sections = new String[sectionList.size()];
|
||||
|
||||
sectionList.toArray(sections);
|
||||
sectionList.toArray(sections);
|
||||
}
|
||||
|
||||
public Option getItem(int i)
|
||||
{
|
||||
return items.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null)
|
||||
{
|
||||
if (v == null) {
|
||||
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = vi.inflate(id, null);
|
||||
}
|
||||
final Option o = items.get(position);
|
||||
if (o != null)
|
||||
{
|
||||
if (o != null) {
|
||||
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
|
||||
TextView t2 = (TextView) v.findViewById(R.id.TextView02);
|
||||
|
||||
if(t1 != null)
|
||||
if(t1!=null)
|
||||
{
|
||||
t1.setText(o.getName());
|
||||
}
|
||||
if(t2!=null)
|
||||
{
|
||||
t2.setText(o.getData());
|
||||
}
|
||||
|
||||
if(t2 != null)
|
||||
t2.setText(o.getData());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
@ -91,7 +97,9 @@ public class FileArrayAdapter extends ArrayAdapter<Option> implements SectionInd
|
||||
{
|
||||
// FIXME
|
||||
if (section >= sections.length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return alphaIndexer.get(sections[section]);
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,15 @@ import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.retroarch.R;
|
||||
import com.retroarch.R.layout;
|
||||
|
||||
import com.retroarch.rruntime;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.KeyEvent;
|
||||
@ -18,6 +24,7 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.net.Uri;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.Button;
|
||||
@ -60,9 +67,13 @@ public class FileChooser extends Activity
|
||||
|
||||
// clamp start dir and remove the /
|
||||
if (_startDir == null)
|
||||
{
|
||||
_startDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
else if (_startDir.endsWith("/"))
|
||||
{
|
||||
_startDir = _startDir.substring(0, _startDir.length() - 1);
|
||||
}
|
||||
|
||||
// push the start dir onto the stack
|
||||
_dirStack = new Stack<String>();
|
||||
@ -70,11 +81,15 @@ public class FileChooser extends Activity
|
||||
|
||||
// clamp extentions to all or extra specified
|
||||
if (_extensions == null)
|
||||
{
|
||||
_extensions = ".*";
|
||||
}
|
||||
|
||||
// clamp temp dir
|
||||
if (_tempDir == null)
|
||||
{
|
||||
_tempDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
}
|
||||
|
||||
// regular filesystem dir
|
||||
currentDir = new File(_startDir);
|
||||
@ -146,7 +161,9 @@ public class FileChooser extends Activity
|
||||
for(File ff: dirs)
|
||||
{
|
||||
if(ff.isDirectory())
|
||||
{
|
||||
dir.add(new Option(ff.getName() + "/","Folder",ff.getAbsolutePath()));
|
||||
}
|
||||
else
|
||||
{
|
||||
int dotIndex = ff.getName().lastIndexOf('.');
|
||||
@ -154,7 +171,9 @@ public class FileChooser extends Activity
|
||||
{
|
||||
String extension = ff.getName().substring(dotIndex+1).toLowerCase();
|
||||
if (extension.matches(_extensions))
|
||||
{
|
||||
fls.add(new Option(ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,7 +211,6 @@ public class FileChooser extends Activity
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
String path = o.getPath();
|
||||
int dotIndex = path.lastIndexOf('.');
|
||||
String ext = null;
|
||||
@ -200,8 +218,8 @@ public class FileChooser extends Activity
|
||||
{
|
||||
ext = path.substring(dotIndex+1).toLowerCase();
|
||||
}
|
||||
*/
|
||||
onFileClick(o);
|
||||
|
||||
onFileClick(o);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,8 +239,7 @@ public class FileChooser extends Activity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
if (_dirStack.size() > 1)
|
||||
|
@ -16,19 +16,16 @@ public class Option implements Comparable<Option>
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
public int compareTo(Option o)
|
||||
{
|
||||
public int compareTo(Option o) {
|
||||
if(this.name != null)
|
||||
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
|
||||
else
|
||||
|
@ -21,23 +21,29 @@ import com.retroarch.fileio.FileChooser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
import android.net.Uri;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class main extends Activity
|
||||
{
|
||||
static private final int ACTIVITY_LOAD_ROM = 0;
|
||||
|
||||
private GLSurfaceView ctx_gl;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
this.setTitle("RetroArch | Main");
|
||||
ctx_gl = new rgl_context(this);
|
||||
setContentView(ctx_gl);
|
||||
}
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
@ -86,11 +92,23 @@ public class main extends Activity
|
||||
protected void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
ctx_gl.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
ctx_gl.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
class rgl_context extends GLSurfaceView
|
||||
{
|
||||
public rgl_context(Context context)
|
||||
{
|
||||
super(context);
|
||||
setEGLContextClientVersion(2);
|
||||
setRenderer(new rgl());
|
||||
}
|
||||
}
|
||||
|
111
android/src/com/retroarch/rgl.java
Normal file
111
android/src/com/retroarch/rgl.java
Normal file
@ -0,0 +1,111 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.retroarch;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
|
||||
public class rgl implements GLSurfaceView.Renderer
|
||||
{
|
||||
private int cprg;
|
||||
private int v_position_handle;
|
||||
private FloatBuffer triangle_vbo;
|
||||
|
||||
private void triangles_init()
|
||||
{
|
||||
float triangle_coords[] = {
|
||||
// X, Y, Z
|
||||
-0.5f, -0.25f, 0,
|
||||
0.5f, -0.25f, 0,
|
||||
0.0f, 0.559016994f, 0
|
||||
};
|
||||
|
||||
ByteBuffer vbb = ByteBuffer.allocateDirect(triangle_coords.length * 4);
|
||||
vbb.order(ByteOrder.nativeOrder());
|
||||
triangle_vbo = vbb.asFloatBuffer();
|
||||
triangle_vbo.put(triangle_coords);
|
||||
triangle_vbo.position(0);
|
||||
}
|
||||
|
||||
private void shader_init()
|
||||
{
|
||||
final String vprg =
|
||||
"attribute vec4 vPosition; \n" +
|
||||
"void main(){ \n" +
|
||||
" gl_Position = vPosition; \n" +
|
||||
"} \n";
|
||||
final String fprg =
|
||||
"precision mediump float; \n" +
|
||||
"void main(){ \n" +
|
||||
" gl_FragColor = vec4 (0.63671875, 0.76953125, 0.22265625, 1.0); \n" +
|
||||
"} \n";
|
||||
|
||||
int vertex_shader, fragment_shader;
|
||||
|
||||
vertex_shader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
|
||||
|
||||
GLES20.glShaderSource(vertex_shader, vprg);
|
||||
GLES20.glCompileShader(vertex_shader);
|
||||
|
||||
fragment_shader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
|
||||
|
||||
GLES20.glShaderSource(fragment_shader, fprg);
|
||||
GLES20.glCompileShader(fragment_shader);
|
||||
|
||||
cprg = GLES20.glCreateProgram();
|
||||
GLES20.glAttachShader(cprg, vertex_shader);
|
||||
GLES20.glAttachShader(cprg, fragment_shader);
|
||||
GLES20.glLinkProgram(cprg);
|
||||
|
||||
//get handle to the vertex shader's vPosition member
|
||||
v_position_handle = GLES20.glGetAttribLocation(cprg, "vPosition");
|
||||
; }
|
||||
|
||||
public void onSurfaceCreated(GL10 unused, EGLConfig config)
|
||||
{
|
||||
//background color
|
||||
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
|
||||
triangles_init();
|
||||
shader_init();
|
||||
}
|
||||
|
||||
public void onDrawFrame(GL10 unused)
|
||||
{
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
GLES20.glUseProgram(cprg);
|
||||
|
||||
// Triangle
|
||||
GLES20.glVertexAttribPointer(v_position_handle, 3, GLES20.GL_FLOAT, false, 12, triangle_vbo);
|
||||
GLES20.glEnableVertexAttribArray(v_position_handle);
|
||||
|
||||
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 unused, int width, int height)
|
||||
{
|
||||
GLES20.glViewport(0, 0, width, height);
|
||||
}
|
||||
}
|
@ -16,6 +16,10 @@
|
||||
|
||||
package com.retroarch;
|
||||
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.SurfaceHolder;
|
||||
|
||||
public class rruntime
|
||||
{
|
||||
static
|
||||
@ -23,7 +27,10 @@ public class rruntime
|
||||
System.loadLibrary("retroarch");
|
||||
}
|
||||
|
||||
private rruntime() { }
|
||||
private rruntime()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static native void load_game(final String j_path, final int j_extract_zip_mode);
|
||||
|
||||
@ -40,4 +47,8 @@ public class rruntime
|
||||
public static native void settings_change(final int j_setting);
|
||||
|
||||
public static native void settings_set_defaults();
|
||||
|
||||
public static native void set_window(SurfaceHolder surface);
|
||||
|
||||
public static native void free_window(SurfaceHolder surface);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ static EGLConfig g_config;
|
||||
|
||||
int _width;
|
||||
int _height;
|
||||
GLfloat _angle;
|
||||
|
||||
static enum gfx_ctx_api g_api;
|
||||
|
||||
@ -107,46 +108,79 @@ static bool gfx_ctx_init(void)
|
||||
|
||||
RARCH_LOG("Initializing context\n");
|
||||
|
||||
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY)
|
||||
goto error;
|
||||
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY) {
|
||||
RARCH_ERR("eglGetDisplay() returned error %d.\n", eglGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
EGLint egl_major, egl_minor;
|
||||
if (!eglInitialize(g_egl_dpy, &egl_major, &egl_minor))
|
||||
goto error;
|
||||
if (!eglInitialize(g_egl_dpy, &egl_major, &egl_minor)) {
|
||||
RARCH_ERR("eglInitialize() returned error %d.\n", eglGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("[ANDROID/EGL]: EGL version: %d.%d\n", egl_major, egl_minor);
|
||||
|
||||
EGLint num_configs;
|
||||
if (!eglChooseConfig(g_egl_dpy, attribs, &g_config, 1, &numConfigs))
|
||||
goto error;
|
||||
if (!eglChooseConfig(g_egl_dpy, attribs, &g_config, 1, &numConfigs)) {
|
||||
RARCH_ERR("eglChooseConfig() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglGetConfigAttrib(g_egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format))
|
||||
goto error;
|
||||
if (!eglGetConfigAttrib(g_egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format)) {
|
||||
RARCH_ERR("eglGetConfigAttrib() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
ANativeWindow_setBuffersGeometry(window, 0, 0, format);
|
||||
|
||||
if (!(g_egl_surf = eglCreateWindowSurface(g_egl_dpy, config, window, 0)))
|
||||
goto error;
|
||||
if (!(g_egl_surf = eglCreateWindowSurface(g_egl_dpy, config, window, 0))) {
|
||||
RARCH_ERR("eglCreateWindowSurface() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(g_egl_ctx = eglCreateContext(g_egl_dpy, config, 0, 0)))
|
||||
goto error;
|
||||
if (!(g_egl_ctx = eglCreateContext(g_egl_dpy, config, 0, 0))) {
|
||||
RARCH_ERR("eglCreateContext() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx))
|
||||
goto error;
|
||||
if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx)) {
|
||||
RARCH_ERR("eglMakeCurrent() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &width) ||
|
||||
!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height))
|
||||
goto error;
|
||||
!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height)) {
|
||||
RARCH_ERR("eglQuerySurface() returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
_width = width;
|
||||
_height = height;
|
||||
|
||||
return true;
|
||||
/*
|
||||
glDisable(GL_DITHER);
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
error:
|
||||
RARCH_ERR("Returned error %d.\n", eglGetError());
|
||||
gfx_ctx_destroy();
|
||||
return false;
|
||||
ratio = (GLfloat) width / height;
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustumf(-ratio, ratio, -1, 1, 1, 10);
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void gfx_ctx_check_window(bool *quit,
|
||||
|
Loading…
x
Reference in New Issue
Block a user