Merge branch 'master' into wii-network

This commit is contained in:
Matthew Parlane
2013-04-25 01:13:14 +12:00
150 changed files with 8552 additions and 184 deletions

View File

@ -26,7 +26,13 @@
</intent-filter>
</activity>
<activity
android:name=".NativeListView"
android:name="org.dolphinemu.dolphinemu.GameListView"
android:label="@string/app_name"
android:theme="@android:style/Theme"
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
</activity>
<activity
android:name="org.dolphinemu.dolphinemu.FolderBrowser"
android:label="@string/app_name"
android:theme="@android:style/Theme"
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -12,3 +12,4 @@
# Project target.
target=android-17
android.library.reference.1=../../Externals/android-menudrawer/library

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</LinearLayout>
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="5dip"
android:singleLine="true"
android:text="@+id/TextView01"
android:textStyle="bold" />
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:text="@+id/TextView02" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>

View File

@ -1,26 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="5dip"
android:singleLine="true"
android:text="@+id/TextView01"
android:textStyle="bold" >
</TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:text="@+id/TextView02" >
</TextView>
<ImageView
android:id="@+id/imageView1"
android:layout_width="96dp"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="5dip"
android:singleLine="true"
android:text="@+id/TextView01"
android:textStyle="bold" />
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:text="@+id/TextView02" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="left"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginTop="5dip"
android:singleLine="true"
android:text="@+id/TextView01"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -6,6 +6,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import net.simonvt.menudrawer.MenuDrawer;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
@ -88,7 +90,8 @@ public class DolphinEmulator<MainActivity> extends Activity
super.onCreate(savedInstanceState);
if (savedInstanceState == null)
{
Intent ListIntent = new Intent(this, NativeListView.class);
Intent ListIntent = new Intent(this, GameListView.class);
startActivityForResult(ListIntent, 1);
// Make the assets directory
@ -117,16 +120,13 @@ public class DolphinEmulator<MainActivity> extends Activity
CopyAsset("NoBanner.png",
Environment.getExternalStorageDirectory()+File.separator+
"dolphin-emu" + File.separator + "NoBanner.png");
CopyAsset("Dolphin.png",
Environment.getExternalStorageDirectory()+File.separator+
"dolphin-emu" + File.separator + "Dolphin.png");
CopyAsset("GCPadNew.ini",
Environment.getExternalStorageDirectory()+File.separator+
"dolphin-emu" + File.separator +"Config"+ File.separator +"GCPadNew.ini");
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{

View File

@ -0,0 +1,98 @@
package org.dolphinemu.dolphinemu;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.simonvt.menudrawer.MenuDrawer;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class FolderBrowser extends ListActivity {
private GameListAdapter adapter;
private static File currentDir = null;
private void Fill(File f)
{
File[]dirs = f.listFiles();
this.setTitle("Current Dir: " + f.getName());
List<GameListItem>dir = new ArrayList<GameListItem>();
List<GameListItem>fls = new ArrayList<GameListItem>();
try
{
for(File ff: dirs)
{
if (ff.getName().charAt(0) != '.')
if(ff.isDirectory())
dir.add(new GameListItem(getApplicationContext(), ff.getName(),"Folder",ff.getAbsolutePath()));
else
if (ff.getName().toLowerCase().contains(".gcm") ||
ff.getName().toLowerCase().contains(".iso") ||
ff.getName().toLowerCase().contains(".wbfs") ||
ff.getName().toLowerCase().contains(".gcz") ||
ff.getName().toLowerCase().contains(".dol") ||
ff.getName().toLowerCase().contains(".elf"))
fls.add(new GameListItem(getApplicationContext(), ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
}
}
catch(Exception e)
{
}
Collections.sort(dir);
Collections.sort(fls);
dir.addAll(fls);
if (!f.getName().equalsIgnoreCase("sdcard"))
dir.add(0, new GameListItem(getApplicationContext(), "..", "Parent Directory", f.getParent()));
adapter = new GameListAdapter(this,R.layout.folderbrowser,dir);
this.setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
GameListItem o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
currentDir = new File(o.getPath());
Fill(currentDir);
}
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if(currentDir == null)
currentDir = new File(Environment.getExternalStorageDirectory().getPath());
Fill(currentDir);
}
@Override
public void onBackPressed() {
Intent intent = new Intent();
intent.putExtra("Select", currentDir.getPath());
setResult(Activity.RESULT_OK, intent);
this.finish();
super.onBackPressed();
}
}

View File

@ -7,22 +7,23 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class FileArrayAdapter extends ArrayAdapter<Option>{
public class GameListAdapter extends ArrayAdapter<GameListItem>{
private Context c;
private int id;
private List<Option>items;
private List<GameListItem>items;
public FileArrayAdapter(Context context, int textViewResourceId,
List<Option> objects) {
public GameListAdapter(Context context, int textViewResourceId,
List<GameListItem> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}
public Option getItem(int i)
public GameListItem getItem(int i)
{
return items.get(i);
}
@ -33,15 +34,18 @@ public class FileArrayAdapter extends ArrayAdapter<Option>{
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final Option o = items.get(position);
final GameListItem o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
TextView t2 = (TextView) v.findViewById(R.id.TextView02);
ImageView v1 = (ImageView) v.findViewById(R.id.imageView1);
if(t1!=null)
t1.setText(o.getName());
if(t2!=null)
t2.setText(o.getData());
if(v1!=null)
v1.setImageBitmap(o.getImage());
}
return v;

View File

@ -0,0 +1,84 @@
package org.dolphinemu.dolphinemu;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
public class GameListItem implements Comparable<GameListItem>{
private String name;
private String data;
private String path;
private Bitmap image;
public static native int[] GetBanner(String filename);
public static native String GetTitle(String filename);
static
{
try
{
System.loadLibrary("dolphin-emu-nogui");
}
catch (Exception ex)
{
Log.w("me", ex.toString());
}
}
public GameListItem(Context ctx, String n,String d,String p)
{
name = n;
data = d;
path = p;
File file = new File(path);
if (!file.isDirectory())
{
int[] Banner = GetBanner(path);
if (Banner[0] == 0)
{
try {
InputStream path = ctx.getAssets().open("NoBanner.png");
image = BitmapFactory.decodeStream(path);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888);
name = GetTitle(path);
}
}
public String getName()
{
return name;
}
public String getData()
{
return data;
}
public String getPath()
{
return path;
}
public Bitmap getImage()
{
return image;
}
public int compareTo(GameListItem o)
{
if(this.name != null)
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
else
throw new IllegalArgumentException();
}
}

View File

@ -0,0 +1,181 @@
package org.dolphinemu.dolphinemu;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.simonvt.menudrawer.MenuDrawer;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class GameListView extends ListActivity {
private GameListAdapter adapter;
private static File currentDir = null;
private MenuDrawer mDrawer;
private SideMenuAdapter mAdapter;
private ListView mList;
private static GameListView me;
public static native String GetConfig(String Key, String Value, String Default);
public static native void SetConfig(String Key, String Value, String Default);
private void Fill(File f)
{
File[]dirs = f.listFiles();
this.setTitle("Game List");
List<GameListItem>dir = new ArrayList<GameListItem>();
List<GameListItem>fls = new ArrayList<GameListItem>();
try
{
for(File ff: dirs)
{
if (ff.getName().charAt(0) != '.')
if(!ff.isDirectory())
if (ff.getName().toLowerCase().contains(".gcm") ||
ff.getName().toLowerCase().contains(".iso") ||
ff.getName().toLowerCase().contains(".wbfs") ||
ff.getName().toLowerCase().contains(".gcz") ||
ff.getName().toLowerCase().contains(".dol") ||
ff.getName().toLowerCase().contains(".elf"))
fls.add(new GameListItem(getApplicationContext(), ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
}
}
catch(Exception e)
{
}
Collections.sort(dir);
Collections.sort(fls);
dir.addAll(fls);
adapter = new GameListAdapter(this,R.layout.main,dir);
this.setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
GameListItem o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
}
else
{
onFileClick(o.getPath());
}
}
private void onFileClick(String o)
{
Toast.makeText(this, "File Clicked: " + o, Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("Select", o);
setResult(Activity.RESULT_OK, intent);
this.finish();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK)
{
String FileName = data.getStringExtra("Select");
Toast.makeText(this, "Folder Selected: " + FileName, Toast.LENGTH_SHORT).show();
SetConfig("General", "GCMPathes", "1");
SetConfig("General", "GCMPaths0", FileName);
currentDir = new File(FileName);
Fill(currentDir);
}
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
me = this;
mDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
String BrowseDir = GetConfig("General", "GCMPaths0", "");
if(currentDir == null)
currentDir = new File(BrowseDir);
Fill(currentDir);
List<SideMenuItem>dir = new ArrayList<SideMenuItem>();
dir.add(new SideMenuItem("Browse Folder", 0));
mList = new ListView(this);
mAdapter = new SideMenuAdapter(this,R.layout.sidemenu,dir);
mList.setAdapter(mAdapter);
mList.setOnItemClickListener(mItemClickListener);
mDrawer.setMenuView(mList);
}
private AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
SideMenuItem o = mAdapter.getItem(position);
switch(o.getID())
{
case 0:
Toast.makeText(me, "Loading up the browser", Toast.LENGTH_SHORT).show();
Intent ListIntent = new Intent(me, FolderBrowser.class);
startActivityForResult(ListIntent, 1);
break;
default:
break;
}
mDrawer.closeMenu();
}
};
@Override
public void setContentView(int layoutResID) {
// This override is only needed when using MENU_DRAG_CONTENT.
mDrawer.setContentView(layoutResID);
onContentChanged();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
mDrawer.toggleMenu();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
final int drawerState = mDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
mDrawer.closeMenu();
return;
}
super.onBackPressed();
}
}

View File

@ -1,94 +0,0 @@
package org.dolphinemu.dolphinemu;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;
public class NativeListView extends ListActivity {
private FileArrayAdapter adapter;
private static File currentDir = null;
private void Fill(File f)
{
File[]dirs = f.listFiles();
this.setTitle("Current Dir: " + f.getName());
List<Option>dir = new ArrayList<Option>();
List<Option>fls = new ArrayList<Option>();
try
{
for(File ff: dirs)
{
if (ff.getName().charAt(0) != '.')
if(ff.isDirectory())
dir.add(new Option(ff.getName(),"Folder",ff.getAbsolutePath()));
else
if (ff.getName().toLowerCase().contains(".gcm") ||
ff.getName().toLowerCase().contains(".iso") ||
ff.getName().toLowerCase().contains(".wbfs") ||
ff.getName().toLowerCase().contains(".gcz") ||
ff.getName().toLowerCase().contains(".dol") ||
ff.getName().toLowerCase().contains(".elf"))
fls.add(new Option(ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
}
}
catch(Exception e)
{
}
Collections.sort(dir);
Collections.sort(fls);
dir.addAll(fls);
if(!f.getName().equalsIgnoreCase("sdcard"))
dir.add(0,new Option("..","Parent Directory",f.getParent()));
adapter = new FileArrayAdapter(this,R.layout.main,dir);
this.setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Option o = adapter.getItem(position);
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
currentDir = new File(o.getPath());
Fill(currentDir);
}
else
{
onFileClick(o.getPath());
}
}
private void onFileClick(String o)
{
Toast.makeText(this, "File Clicked: " + o, Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("Select", o);
setResult(Activity.RESULT_OK, intent);
this.finish();
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if(currentDir == null)
currentDir = new File(Environment.getExternalStorageDirectory().getPath());
Fill(currentDir);
}
}

View File

@ -1,38 +0,0 @@
package org.dolphinemu.dolphinemu;
public class Option implements Comparable<Option>{
private String name;
private String data;
private String path;
public Option(String n,String d,String p)
{
name = n;
data = d;
path = p;
}
public String getName()
{
return name;
}
public String getData()
{
return data;
}
public String getPath()
{
return path;
}
public int compareTo(Option o)
{
if(this.name != null)
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
else
throw new IllegalArgumentException();
}
}

View File

@ -0,0 +1,49 @@
package org.dolphinemu.dolphinemu;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class SideMenuAdapter extends ArrayAdapter<SideMenuItem>{
private Context c;
private int id;
private List<SideMenuItem>items;
public SideMenuAdapter(Context context, int textViewResourceId,
List<SideMenuItem> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}
public SideMenuItem getItem(int i)
{
return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final SideMenuItem o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
if(t1!=null)
t1.setText(o.getName());
}
return v;
}
}

View File

@ -0,0 +1,30 @@
package org.dolphinemu.dolphinemu;
public class SideMenuItem implements Comparable<SideMenuItem>{
private String m_name;
private int m_id;
public SideMenuItem(String n, int id)
{
m_name = n;
m_id = id;
}
public String getName()
{
return m_name;
}
public int getID()
{
return m_id;
}
public int compareTo(SideMenuItem o)
{
if(this.m_name != null)
return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
else
throw new IllegalArgumentException();
}
}

View File

@ -791,6 +791,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
std::string tContentFile(m_ContentFile.c_str());
WII_IPC_HLE_Interface::Reset(true);
WII_IPC_HLE_Interface::Init();
s_Usb = GetUsbPointer();
@ -825,7 +826,19 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
ERROR_LOG(WII_IPC_ES, "IOCTL_ES_LAUNCH %016llx %08x %016llx %08x %016llx %04x", TitleID,view,ticketid,devicetype,titleid,access);
// IOCTL_ES_LAUNCH 0001000248414341 00000001 0001c0fef3df2cfa 00000000 0001000248414341 ffff
return true;
//We have to handle the reply ourselves as this handle is not valid anymore
// It seems that the original hardware overwrites the command after it has been
// executed. We write 8 which is not any valid command, and what IOS does
Memory::Write_U32(8, _CommandAddress);
// IOS seems to write back the command that was responded to
Memory::Write_U32(6, _CommandAddress + 8);
// Generate a reply to the IPC command
WII_IPC_HLE_Interface::EnqReply(_CommandAddress, 0);
return false;
}
break;

View File

@ -71,14 +71,14 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_dpy = Platform.EGLGetDisplay();
if (!GLWin.egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
return false;
}
GLWin.platform = Platform.platform;
if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
INFO_LOG(VIDEO, "Error: eglInitialize() failed\n");
return false;
}
@ -89,7 +89,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
#endif
if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
exit(1);
}
@ -97,20 +97,20 @@ bool cInterfaceEGL::Create(void *&window_handle)
return false;
s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
INFO_LOG(VIDEO, "EGL_VENDOR = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
INFO_LOG(VIDEO, "EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", s);
GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
if (!GLWin.egl_ctx) {
printf("Error: eglCreateContext failed\n");
INFO_LOG(VIDEO, "Error: eglCreateContext failed\n");
exit(1);
}
@ -119,20 +119,20 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config,
GLWin.native_window, NULL);
if (!GLWin.egl_surf) {
printf("Error: eglCreateWindowSurface failed\n");
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
exit(1);
}
if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
INFO_LOG(VIDEO, "Error: eglMakeCurrent() failed\n");
return false;
}
printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
INFO_LOG(VIDEO, "GL_VENDOR: %s\n", glGetString(GL_VENDOR));
INFO_LOG(VIDEO, "GL_RENDERER: %s\n", glGetString(GL_RENDERER));
INFO_LOG(VIDEO, "GL_VERSION: %s\n", glGetString(GL_VERSION));
INFO_LOG(VIDEO, "GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
@ -152,9 +152,13 @@ void cInterfaceEGL::Shutdown()
NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (GLWin.egl_ctx)
{
eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx);
eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf);
eglTerminate(GLWin.egl_dpy);
eglMakeCurrent(GLWin.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if(!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx))
NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
if(!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf))
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
if(!eglTerminate(GLWin.egl_dpy))
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
GLWin.egl_ctx = NULL;
}
}

View File

@ -35,6 +35,11 @@
#include "BootManager.h"
#include "OnScreenDisplay.h"
// Banner loading
#include "Filesystem.h"
#include "BannerLoader.h"
#include "VolumeCreator.h"
#include "Android/ButtonManager.h"
#include <jni.h>
@ -140,6 +145,57 @@ void OSDCallbacks(u32 UserData)
}
}
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
std::vector<std::string> m_volume_names;
std::vector<std::string> m_names;
bool LoadBanner(std::string filename, u32 *Banner)
{
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename);
if (pVolume != NULL)
{
bool bIsWad = false;
if (DiscIO::IsVolumeWadFile(pVolume))
bIsWad = true;
m_volume_names = pVolume->GetNames();
// check if we can get some info from the banner file too
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
if (pFileSystem != NULL || bIsWad)
{
DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume);
if (pBannerLoader != NULL)
if (pBannerLoader->IsValid())
{
m_names = pBannerLoader->GetNames();
if (pBannerLoader->GetBanner(Banner))
return true;
}
}
}
return false;
}
std::string GetName(std::string filename)
{
if (!m_names.empty())
return m_names[0];
if (!m_volume_names.empty())
return m_volume_names[0];
// No usable name, return filename (better than nothing)
std::string name;
SplitPath(filename, NULL, &name, NULL);
return name;
}
#ifdef __cplusplus
extern "C"
{
@ -162,6 +218,63 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_DolphinEmulator_onTouchEve
ButtonManager::TouchEvent(Action, X, Y);
}
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_GameListItem_GetBanner(JNIEnv *env, jobject obj, jstring jFile)
{
const char *File = env->GetStringUTFChars(jFile, NULL);
jintArray Banner = env->NewIntArray(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT);
u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
if (LoadBanner(File, uBanner))
{
env->SetIntArrayRegion(Banner, 0, DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT, (jint*)uBanner);
}
env->ReleaseStringUTFChars(jFile, File);
return Banner;
}
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_GameListItem_GetTitle(JNIEnv *env, jobject obj, jstring jFile)
{
const char *File = env->GetStringUTFChars(jFile, NULL);
std::string Name = GetName(File);
m_names.clear();
m_volume_names.clear();
env->ReleaseStringUTFChars(jFile, File);
return env->NewStringUTF(Name.c_str());
}
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_GameListView_GetConfig(JNIEnv *env, jobject obj, jstring jKey, jstring jValue, jstring jDefault)
{
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
const char *Key = env->GetStringUTFChars(jKey, NULL);
const char *Value = env->GetStringUTFChars(jValue, NULL);
const char *Default = env->GetStringUTFChars(jDefault, NULL);
std::string value;
ini.Get(Key, Value, &value, Default);
env->ReleaseStringUTFChars(jKey, Key);
env->ReleaseStringUTFChars(jValue, Value);
env->ReleaseStringUTFChars(jDefault, Default);
return env->NewStringUTF(value.c_str());
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_GameListView_SetConfig(JNIEnv *env, jobject obj, jstring jKey, jstring jValue, jstring jDefault)
{
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
const char *Key = env->GetStringUTFChars(jKey, NULL);
const char *Value = env->GetStringUTFChars(jValue, NULL);
const char *Default = env->GetStringUTFChars(jDefault, NULL);
ini.Set(Key, Value, Default);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
env->ReleaseStringUTFChars(jKey, Key);
env->ReleaseStringUTFChars(jValue, Value);
env->ReleaseStringUTFChars(jDefault, Default);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeGLSurfaceView_main(JNIEnv *env, jobject obj, jstring jFile, jobject _surf, jint _width, jint _height)
{
surf = ANativeWindow_fromSurface(env, _surf);
@ -178,7 +291,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeGLSurfaceView_main(J
VideoBackend::PopulateList();
VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend);
WiimoteReal::LoadSettings();
const char *File = env->GetStringUTFChars(jFile, NULL);
// No use running the loop when booting fails
if ( BootManager::BootCore( File ) )

View File

@ -199,7 +199,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
{
WRITE(p, "ATTRIN float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
if (components & VB_HAS_POSMTXIDX)
WRITE(p, "ATTRIN int posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
WRITE(p, "ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
if (components & VB_HAS_NRM0)
WRITE(p, "ATTRIN float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
if (components & VB_HAS_NRM1)
@ -296,6 +296,10 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
{
WRITE(p, "int posmtx = blend_indices.x * 255.0f;\n");
}
else
{
WRITE(p, "int posmtx = int(fposmtx);\n");
}
WRITE(p, "float4 pos = float4(dot(" I_TRANSFORMMATRICES"[posmtx], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+1], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+2], rawpos), 1);\n");

View File

@ -87,7 +87,7 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)
if (vtx_decl.posmtx_offset != -1) {
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
glVertexAttribIPointer(SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, vtx_decl.stride, (u8*)NULL + vtx_decl.posmtx_offset);
glVertexAttribPointer(SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, vtx_decl.stride, (u8*)NULL + vtx_decl.posmtx_offset);
}
vm->m_last_vao = VAO;