Android mega commit of trash.

This commit is contained in:
Ryan Houdek 2013-03-19 21:53:09 -05:00
parent edd9d0e0ef
commit d11679a06e
33 changed files with 2311 additions and 33 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

7
Source/Android/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
gen
obj
#ui_atlas.zim
ui_atlas.zim.png
#assets/ui_atlas.zim
#jni/ui_atlas.cpp
#jni/ui_atlas.h

33
Source/Android/.project Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ppsspp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dolphinemu.dolphinemu"
android:versionCode="1"
android:versionName="0.1" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
<uses-feature android:name="android.hardware.screen.landscape" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:icon="@drawable/launcher"
android:label="@string/app_name">
<activity
android:name=".DolphinEmulator"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

92
Source/Android/build.xml Normal file
View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dolphin Emulator" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dolphin" default="help">
<property name="ndkbuildopt" value=""/>
<target name="-pre-build">
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
<arg line="-j4 ${ndkbuildopt}"/>
<env key="NDK_MODULE_PATH" path="..:../native/ext"/>
</exec>
</target>
<target name="clean" depends="android_rules.clean">
<exec executable="${ndk.dir}/ndk-build" failonerror="true">
<arg value="clean"/>
<env key="NDK_MODULE_PATH" path="..:../native/ext"/>
</exec>
</target>
</project>

View file

@ -0,0 +1,189 @@
LOCAL_PATH := $(call my-dir)
# BEGIN Native Audio Separate Library - copy paste this section to your Android.mk
include $(CLEAR_VARS)
LOCAL_MODULE := native_audio
LOCAL_CFLAGS := -O2 -fsigned-char -ffast-math -Wall -Wno-multichar -Wno-psabi -std=gnu++0x
NATIVE := ../../native
LOCAL_SRC_FILES := \
$(NATIVE)/android/native-audio-so.cpp
LOCAL_LDLIBS := -lOpenSLES -llog
include $(BUILD_SHARED_LIBRARY)
# END Native Audio Separate Library - copy paste this section to your Android.mk
include $(CLEAR_VARS)
#TARGET_PLATFORM := android-8
LOCAL_MODULE := ppsspp_jni
NATIVE := ../../native
SRC := ../..
LOCAL_CFLAGS := -DUSE_PROFILER -DARM -DGL_GLEXT_PROTOTYPES -DUSING_GLES2 -O2 -fsigned-char -Wall -Wno-multichar -Wno-psabi -Wno-unused-variable -fno-strict-aliasing -ffast-math
LOCAL_CXXFLAGS := -std=gnu++0x
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../Common \
$(LOCAL_PATH)/../.. \
$(LOCAL_PATH)/$(NATIVE)/base \
$(LOCAL_PATH)/$(NATIVE)/ext/libzip \
$(LOCAL_PATH)/$(NATIVE) \
$(LOCAL_PATH) \
LOCAL_STATIC_LIBRARIES := native libzip
LOCAL_LDLIBS := -lz -lGLESv2 -ldl -llog
# $(SRC)/Core/EmuThread.cpp \
LOCAL_SRC_FILES := \
NativeApp.cpp \
EmuScreen.cpp \
MenuScreens.cpp \
UIShader.cpp \
GamepadEmu.cpp \
ArmEmitterTest.cpp \
ui_atlas.cpp \
$(SRC)/native/android/app-android.cpp \
$(SRC)/ext/disarm.cpp \
$(SRC)/ext/libkirk/AES.c \
$(SRC)/ext/libkirk/SHA1.c \
$(SRC)/ext/libkirk/bn.c \
$(SRC)/ext/libkirk/ec.c \
$(SRC)/ext/libkirk/kirk_engine.c \
$(SRC)/ext/snappy/snappy-c.cpp \
$(SRC)/ext/snappy/snappy.cpp \
$(SRC)/Common/ArmEmitter.cpp \
$(SRC)/Common/ArmCPUDetect.cpp \
$(SRC)/Common/ArmThunk.cpp \
$(SRC)/Common/LogManager.cpp \
$(SRC)/Common/MemArena.cpp \
$(SRC)/Common/MemoryUtil.cpp \
$(SRC)/Common/MsgHandler.cpp \
$(SRC)/Common/IniFile.cpp \
$(SRC)/Common/FileUtil.cpp \
$(SRC)/Common/StringUtil.cpp \
$(SRC)/Common/Thread.cpp \
$(SRC)/Common/Timer.cpp \
$(SRC)/Common/Misc.cpp \
$(SRC)/Common/MathUtil.cpp \
$(SRC)/GPU/Math3D.cpp \
$(SRC)/GPU/GPUCommon.cpp \
$(SRC)/GPU/GPUState.cpp \
$(SRC)/GPU/GeDisasm.cpp \
$(SRC)/GPU/GLES/Framebuffer.cpp \
$(SRC)/GPU/GLES/DisplayListInterpreter.cpp \
$(SRC)/GPU/GLES/TextureCache.cpp \
$(SRC)/GPU/GLES/IndexGenerator.cpp \
$(SRC)/GPU/GLES/TransformPipeline.cpp \
$(SRC)/GPU/GLES/StateMapping.cpp \
$(SRC)/GPU/GLES/VertexDecoder.cpp \
$(SRC)/GPU/GLES/ShaderManager.cpp \
$(SRC)/GPU/GLES/VertexShaderGenerator.cpp \
$(SRC)/GPU/GLES/FragmentShaderGenerator.cpp \
$(SRC)/GPU/Null/NullGpu.cpp \
$(SRC)/Core/ELF/ElfReader.cpp \
$(SRC)/Core/ELF/PrxDecrypter.cpp \
$(SRC)/Core/ELF/ParamSFO.cpp \
$(SRC)/Core/HW/MemoryStick.cpp \
$(SRC)/Core/HW/MediaEngine.cpp \
$(SRC)/Core/HW/SasAudio.cpp \
$(SRC)/Core/Core.cpp \
$(SRC)/Core/Config.cpp \
$(SRC)/Core/CoreTiming.cpp \
$(SRC)/Core/CPU.cpp \
$(SRC)/Core/Host.cpp \
$(SRC)/Core/Loaders.cpp \
$(SRC)/Core/PSPLoaders.cpp \
$(SRC)/Core/MemMap.cpp \
$(SRC)/Core/MemMapFunctions.cpp \
$(SRC)/Core/SaveState.cpp \
$(SRC)/Core/System.cpp \
$(SRC)/Core/PSPMixer.cpp \
$(SRC)/Core/Debugger/Breakpoints.cpp \
$(SRC)/Core/Debugger/SymbolMap.cpp \
$(SRC)/Core/Dialog/PSPDialog.cpp \
$(SRC)/Core/Dialog/PSPMsgDialog.cpp \
$(SRC)/Core/Dialog/PSPOskDialog.cpp \
$(SRC)/Core/Dialog/PSPPlaceholderDialog.cpp \
$(SRC)/Core/Dialog/PSPSaveDialog.cpp \
$(SRC)/Core/Dialog/SavedataParam.cpp \
$(SRC)/Core/HLE/HLETables.cpp \
$(SRC)/Core/HLE/HLE.cpp \
$(SRC)/Core/HLE/sceAtrac.cpp \
$(SRC)/Core/HLE/__sceAudio.cpp \
$(SRC)/Core/HLE/sceAudio.cpp \
$(SRC)/Core/HLE/sceCtrl.cpp \
$(SRC)/Core/HLE/sceDisplay.cpp \
$(SRC)/Core/HLE/sceDmac.cpp \
$(SRC)/Core/HLE/sceGe.cpp \
$(SRC)/Core/HLE/sceFont.cpp \
$(SRC)/Core/HLE/sceHprm.cpp \
$(SRC)/Core/HLE/sceHttp.cpp \
$(SRC)/Core/HLE/sceImpose.cpp \
$(SRC)/Core/HLE/sceIo.cpp \
$(SRC)/Core/HLE/sceKernel.cpp \
$(SRC)/Core/HLE/sceKernelAlarm.cpp \
$(SRC)/Core/HLE/sceKernelEventFlag.cpp \
$(SRC)/Core/HLE/sceKernelInterrupt.cpp \
$(SRC)/Core/HLE/sceKernelMemory.cpp \
$(SRC)/Core/HLE/sceKernelModule.cpp \
$(SRC)/Core/HLE/sceKernelMutex.cpp \
$(SRC)/Core/HLE/sceKernelMbx.cpp \
$(SRC)/Core/HLE/sceKernelMsgPipe.cpp \
$(SRC)/Core/HLE/sceKernelSemaphore.cpp \
$(SRC)/Core/HLE/sceKernelThread.cpp \
$(SRC)/Core/HLE/sceKernelTime.cpp \
$(SRC)/Core/HLE/sceKernelVTimer.cpp \
$(SRC)/Core/HLE/sceMpeg.cpp \
$(SRC)/Core/HLE/sceNet.cpp \
$(SRC)/Core/HLE/sceOpenPSID.cpp \
$(SRC)/Core/HLE/sceParseHttp.cpp \
$(SRC)/Core/HLE/sceParseUri.cpp \
$(SRC)/Core/HLE/scePower.cpp \
$(SRC)/Core/HLE/sceRtc.cpp \
$(SRC)/Core/HLE/scePsmf.cpp \
$(SRC)/Core/HLE/sceSas.cpp \
$(SRC)/Core/HLE/sceSsl.cpp \
$(SRC)/Core/HLE/sceUmd.cpp \
$(SRC)/Core/HLE/sceUsb.cpp \
$(SRC)/Core/HLE/sceUtility.cpp \
$(SRC)/Core/HLE/sceVaudio.cpp \
$(SRC)/Core/FileSystems/BlockDevices.cpp \
$(SRC)/Core/FileSystems/ISOFileSystem.cpp \
$(SRC)/Core/FileSystems/MetaFileSystem.cpp \
$(SRC)/Core/FileSystems/DirectoryFileSystem.cpp \
$(SRC)/Core/MIPS/MIPS.cpp.arm \
$(SRC)/Core/MIPS/MIPSAnalyst.cpp \
$(SRC)/Core/MIPS/MIPSDis.cpp \
$(SRC)/Core/MIPS/MIPSDisVFPU.cpp \
$(SRC)/Core/MIPS/MIPSInt.cpp.arm \
$(SRC)/Core/MIPS/MIPSIntVFPU.cpp.arm \
$(SRC)/Core/MIPS/MIPSTables.cpp.arm \
$(SRC)/Core/MIPS/MIPSVFPUUtils.cpp \
$(SRC)/Core/MIPS/MIPSCodeUtils.cpp \
$(SRC)/Core/MIPS/MIPSDebugInterface.cpp \
$(SRC)/Core/MIPS/JitCommon/JitCommon.cpp \
$(SRC)/Core/MIPS/ARM/ArmJitCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompLoadStore.cpp \
$(SRC)/Core/MIPS/ARM/ArmCompVFPU.cpp \
$(SRC)/Core/MIPS/ARM/ArmAsm.cpp \
$(SRC)/Core/MIPS/ARM/ArmJit.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCache.cpp \
$(SRC)/Core/MIPS/ARM/ArmRegCacheFPU.cpp \
$(SRC)/Core/Util/BlockAllocator.cpp \
$(SRC)/Core/Util/ppge_atlas.cpp \
$(SRC)/Core/Util/PPGeDraw.cpp
include $(BUILD_SHARED_LIBRARY)
$(call import-module,libzip)
$(call import-module,native)

View file

@ -0,0 +1,4 @@
APP_STL := stlport_static
APP_ABI := armeabi-v7a armeabi
#APP_ABI := armeabi-v7a

View file

@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View file

@ -0,0 +1,26 @@
<?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: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>
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:text="@+id/TextView02" >
</TextView>
</LinearLayout>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Dolphin Emulator</string>
</resources>

View file

@ -0,0 +1,33 @@
package org.dolphinemu.dolphinemu;
public class Button {
private String ButtonID;
private float _x;
private float _y;
private float _ex;
private float _ey;
public Button(String Button, float[] Coords)
{
ButtonID = Button;
_x = Coords[0];
_y = Coords[1];
_ex = Coords[4];
_ey = Coords[5];
}
public float X()
{
return _x;
}
public float Y()
{
return _y;
}
public float EX()
{
return _ex;
}
public float EY()
{
return _ey;
}
}

View file

@ -0,0 +1,43 @@
package org.dolphinemu.dolphinemu;
public class ButtonManager {
private final int NUMBUTTONS = 15;
Button[] Buttons;
float[][] ButtonCoords =
{ // X, Y, X, EY, EX, EY, EX, Y
{0.75f, -1.0f, 0.75f, -0.75f, 1.0f, -0.75f, 1.0f, -1.0f},
{0.50f, -1.0f, 0.50f, -0.75f, 0.75f, -0.75f, 0.75f, -1.0f},
};
public ButtonManager()
{
Buttons = new Button[NUMBUTTONS];
Buttons[0] = new Button("A", ButtonCoords[0]);
Buttons[1] = new Button("B", ButtonCoords[1]);
}
Button GetButton(int ID)
{
return Buttons[ID];
}
float[][] GetButtonCoords()
{
return ButtonCoords;
}
public int ButtonPressed(int action, float x, float y)
{
for (int a = 0; a < 2; ++a)
{
if (x >= Buttons[a].X() &&
x <= Buttons[a].EX() &&
-y >= Buttons[a].Y() &&
-y <= Buttons[a].EY())
{
return a;
}
}
return -1;
}
}

View file

@ -0,0 +1,124 @@
package org.dolphinemu.dolphinemu;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.WindowManager;
public class DolphinEmulator<MainActivity> extends Activity {
static private NativeGLSurfaceView GLview = null;
static private NativeRenderer Renderer = null;
static private boolean Running = false;
private float screenWidth;
private float screenHeight;
public static native void SetKey(int Value, int Key);
static
{
try
{
System.loadLibrary("dolphin-emu-nogui");
}
catch (Exception ex)
{
Log.w("me", ex.toString());
}
}
@Override
public void onStop()
{
super.onStop();
if (Running)
Renderer.StopEmulation();
}
@Override
public void onPause()
{
super.onPause();
if (Running)
Renderer.PauseEmulation();
}
@Override
public void onResume()
{
super.onResume();
if (Running)
Renderer.UnPauseEmulation();
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null)
{
Intent ListIntent = new Intent(this, NativeListView.class);
startActivityForResult(ListIntent, 1);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK)
{
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(getApplicationContext().WINDOW_SERVICE); // the results will be higher than using the activity context object or the getWindowManager() shortcut
wm.getDefaultDisplay().getMetrics(displayMetrics);
screenWidth = displayMetrics.widthPixels;
screenHeight = displayMetrics.heightPixels;
String FileName = data.getStringExtra("Select");
Renderer = new NativeRenderer();
Renderer.setContext(getApplicationContext());
GLview = new NativeGLSurfaceView(this);
GLview.setEGLContextClientVersion(2);
GLview.setRenderer(Renderer);
GLview.SetFileName(FileName);
setContentView(GLview);
Running = true;
}
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
float X, Y;
int Action;
X = event.getX();
Y = event.getY();
Action = event.getActionMasked();
int Button = Renderer.ButtonPressed(Action, ((X / screenWidth) * 2.0f) - 1.0f, ((Y / screenHeight) * 2.0f) - 1.0f);
if (Button != -1)
SetKey(Action, Button);
return false;
}
public boolean overrideKeys()
{
return false;
}
}

View file

@ -0,0 +1,53 @@
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 FileArrayAdapter extends ArrayAdapter<Option>{
private Context c;
private int id;
private List<Option>items;
public FileArrayAdapter(Context context, int textViewResourceId,
List<Option> objects) {
super(context, textViewResourceId, objects);
c = context;
id = textViewResourceId;
items = objects;
}
public Option 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 Option o = items.get(position);
if (o != null) {
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
TextView t2 = (TextView) v.findViewById(R.id.TextView02);
if(t1!=null)
t1.setText(o.getName());
if(t2!=null)
t2.setText(o.getData());
}
return v;
}
}

View file

@ -0,0 +1,61 @@
package org.dolphinemu.dolphinemu;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
public class NativeGLSurfaceView extends GLSurfaceView {
static private String FileName;
static private Thread myRun;
static private boolean Running = false;
static private boolean Created = false;
public static native void main(String File, Surface surf);
static
{
try
{
System.loadLibrary("dolphin-emu-nogui");
}
catch (Exception ex)
{
Log.w("me", ex.toString());
}
}
public NativeGLSurfaceView(Context context) {
super(context);
if (!Created)
{
myRun = new Thread()
{
@Override
public void run() {
main(FileName, getHolder().getSurface());
}
};
Created = true;
}
}
public void surfaceCreated(SurfaceHolder holder)
{
super.surfaceCreated(holder);
if (!Running)
{
myRun.start();
Running = true;
}
}
public void SetFileName(String file)
{
FileName = file;
}
}

View file

@ -0,0 +1,94 @@
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;
static private 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().indexOf(".gcm") >= 0 ||
ff.getName().toLowerCase().indexOf(".iso") >= 0 ||
ff.getName().toLowerCase().indexOf(".wbfs") >= 0 ||
ff.getName().toLowerCase().indexOf(".gcz") >= 0 ||
ff.getName().toLowerCase().indexOf(".dol") >= 0 ||
ff.getName().toLowerCase().indexOf(".elf") >= 0)
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

@ -0,0 +1,168 @@
package org.dolphinemu.dolphinemu;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.GLUtils;
import android.util.Log;
public class NativeRenderer implements GLSurfaceView.Renderer {
// Button Manager
private static ButtonManager Buttons;
private static boolean Running = false;
// Context
private static Context _gContext;
// Native
public static native void DrawME();
public static native void DrawButton(int GLTex, int ID);
public static native void SetButtonCoords(float[] Coords);
public static native void PrepareME();
public static native void UnPauseEmulation();
public static native void PauseEmulation();
public static native void StopEmulation();
// Texture loading
private static int buttonA = -1;
private static int buttonB = -1;
// Get a new texture id:
private static int newTextureID(GL10 gl)
{
int[] temp = new int[1];
gl.glGenTextures(1, temp, 0);
return temp[0];
}
// Will load a texture out of a drawable resource file, and return an OpenGL texture ID:
private int loadTexture(GL10 gl, String resource)
{
// In which ID will we be storing this texture?
int id = newTextureID(gl);
// Load up, and flip the texture:
InputStream File = null;
try {
File = _gContext.getAssets().open(resource);
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return 0;
}
Bitmap bmp = BitmapFactory.decodeStream(File);
gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
// Set all of our texture parameters:
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);
// Generate, and load up all of the mipmaps:
for(int level=0, height = bmp.getHeight(), width = bmp.getWidth(); true; level++)
{
// Push the bitmap onto the GPU:
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, level, bmp, 0);
// We need to stop when the texture is 1x1:
if(height==1 && width==1) break;
// Resize, and let's go again:
width >>= 1; height >>= 1;
if(width<1) width = 1;
if(height<1) height = 1;
Bitmap bmp2 = Bitmap.createScaledBitmap(bmp, width, height, true);
bmp.recycle();
bmp = bmp2;
}
bmp.recycle();
return id;
}
static
{
try
{
System.loadLibrary("dolphin-emu-nogui");
}
catch (Exception ex)
{
Log.w("me", ex.toString());
}
if (!Running)
Buttons = new ButtonManager();
}
public void onSurfaceChanged(GL10 gl, int width, int height)
{
gl.glViewport(0, 0, width, height);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
if (!Running)
{
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
buttonA = loadTexture(gl, "ButtonA.png");
buttonB = loadTexture(gl, "ButtonB.png");
SetButtonCoords(Flatten(Buttons.GetButtonCoords()));
PrepareME();
Running = true;
}
}
public static float[] Flatten(float[][] data) {
float[] list = new float[data.length * data[0].length];
for(int y = 0; y < data.length; ++y)
for (int x = 0; x < data[y].length; ++x)
list[y * data[0].length + x] = data[y][x];
return list;
}
public void onDrawFrame(GL10 gl)
{
if (Running)
{
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
DrawME();
// -1 is left
// -1 is bottom
DrawButton(buttonA, 0);
DrawButton(buttonB, 1);
}
}
public void setContext(Context ctx)
{
_gContext = ctx;
}
public int ButtonPressed(int action, float x, float y)
{
return Buttons.ButtonPressed(action, x, y);
}
}

View file

@ -0,0 +1,38 @@
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

@ -437,8 +437,7 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
std::string result;
#if defined(ANDROID)
result = "Not implemented on Android!";
result = (char*)input.c_str();
#else
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
if ((iconv_t)-1 == conv_desc)

View file

@ -426,6 +426,8 @@ void SConfig::LoadSettings()
ini.Get("DSP", "Backend", &sBackend, BACKEND_COREAUDIO);
#elif defined _WIN32
ini.Get("DSP", "Backend", &sBackend, BACKEND_DIRECTSOUND);
#elif defined ANDROID
ini.Get("DSP", "Backend", &sBackend, BACKEND_OPENSLES);
#else
ini.Get("DSP", "Backend", &sBackend, BACKEND_NULLSOUND);
#endif

View file

@ -23,6 +23,7 @@
#include "../ConfigManager.h"
#include "../../InputCommon/Src/InputConfig.h"
#include "Host.h"
namespace Pad
{
@ -86,6 +87,16 @@ void GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// get input
((GCPad*)g_plugin.controllers[_numPAD])->GetInput(_pPADStatus);
if (Host_GetKeyState(0))
{
_pPADStatus->button |= PAD_BUTTON_A;
_pPADStatus->analogA = 255;
}
if (Host_GetKeyState(1))
{
_pPADStatus->button |= PAD_BUTTON_START;
}
}
// __________________________________________________________________________________________________

View file

@ -20,6 +20,8 @@
#include "Thread.h"
#ifdef ANDROID
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include <GLInterface/InterfaceBase.h>
#elif defined(USE_EGL) && USE_EGL
#include "GLInterface/EGL_X11.h"

View file

@ -36,10 +36,14 @@
#include <jni.h>
#include <android/log.h>
#include <android/native_window_jni.h>
JNIEnv *g_env = NULL;
ANativeWindow* surf;
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "Dolphinemu", __VA_ARGS__))
bool rendererHasFocus = true;
bool running = true;
bool KeyStates[15];
void Host_NotifyMapLoaded() {}
void Host_RefreshDSPDebuggerWindow() {}
@ -53,7 +57,7 @@ void Host_Message(int Id)
void* Host_GetRenderHandle()
{
return NULL;
return surf;
}
void* Host_GetInstance() { return NULL; }
@ -72,7 +76,7 @@ void Host_UpdateBreakPointView(){}
bool Host_GetKeyState(int keycode)
{
return false;
return KeyStates[keycode];
}
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
@ -118,12 +122,61 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {}
extern void DrawReal();
extern void PrepareShit();
extern void DrawButton(int tex, int ID);
extern void SetButtonCoords(float *Coords);
#ifdef __cplusplus
extern "C"
{
#endif
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_dolphinemuactivity_main(JNIEnv *env, jobject obj)
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_PrepareME(JNIEnv *env, jobject obj)
{
PrepareShit();
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_SetButtonCoords(JNIEnv *env, jobject obj, jfloatArray Coords)
{
jfloat* flt1 = env->GetFloatArrayElements(Coords, 0);
SetButtonCoords((float*)flt1);
env->ReleaseFloatArrayElements(Coords, flt1, 0);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_DrawButton(JNIEnv *env, jobject obj,
jint GLTex, jint ID
)
{
DrawButton((int)GLTex, (int)ID);
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_UnPauseEmulation(JNIEnv *env, jobject obj)
{
PowerPC::Start();
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_PauseEmulation(JNIEnv *env, jobject obj)
{
PowerPC::Pause();
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_StopEmulation(JNIEnv *env, jobject obj)
{
PowerPC::Stop();
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeRenderer_DrawME(JNIEnv *env, jobject obj)
{
DrawReal();
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_DolphinEmulator_SetKey(JNIEnv *env, jobject obj, jint Value, jint Key)
{
WARN_LOG(COMMON, "Key %d with action %d\n", (int)Key, (int)Value);
KeyStates[(int)Key] = (int)Value == 0 ? true : false;
}
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeGLSurfaceView_main(JNIEnv *env, jobject obj, jstring jFile, jobject _surf)
{
surf = ANativeWindow_fromSurface(env, _surf);
g_env = env;
LogManager::Init();
SConfig::Init();
VideoBackend::PopulateList();
@ -131,12 +184,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_dolphinemuactivity_main(JN
m_LocalCoreStartupParameter.m_strVideoBackend);
WiimoteReal::LoadSettings();
const char *File = env->GetStringUTFChars(jFile, NULL);
// No use running the loop when booting fails
if (BootManager::BootCore(""))
{
if ( BootManager::BootCore( File ) )
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();
}
WiimoteReal::Shutdown();
VideoBackend::ClearList();

View file

@ -77,13 +77,10 @@ void CreateShaders()
uni_tex = glGetUniformLocation(program, "Texture");
attr_pos = glGetAttribLocation(program, "pos");
attr_tex = glGetAttribLocation(program, "TexCoordIn");
}
void SWRenderer::Prepare()
#include <EGL/egl.h>
void PrepareShit()
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment
glGenTextures(1, &s_RenderTarget);
@ -97,6 +94,9 @@ void SWRenderer::Prepare()
#endif
GL_REPORT_ERRORD();
}
void SWRenderer::Prepare()
{
}
void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color)
{
@ -141,19 +141,65 @@ void SWRenderer::DrawDebugText()
SWRenderer::RenderText(debugtext_buffer, 21, 21, 0xDD000000);
SWRenderer::RenderText(debugtext_buffer, 20, 20, 0xFFFFFF00);
}
void SWRenderer::DrawTexture(u8 *texture, int width, int height)
u8 image[1024*1024*4];
float ButtonCoords[8 * 2];
int gW, gH;
bool once = false;
std::recursive_mutex section;
void SetButtonCoords(float *Coords)
{
GLsizei glWidth = (GLsizei)GLInterface->GetBackBufferWidth();
GLsizei glHeight = (GLsizei)GLInterface->GetBackBufferHeight();
memcpy(ButtonCoords, Coords, sizeof(float) * 8 * 2);
}
void DrawButton(int tex, int ID)
{
//Texture rectangle uses pixel coordinates
#ifndef USE_GLES
GLfloat u_max = (GLfloat)width;
GLfloat v_max = (GLfloat)height;
// Update GLViewPort
glViewport(0, 0, glWidth, glHeight);
glScissor(0, 0, glWidth, glHeight);
static const GLfloat texverts[4][2] = {
{0, v_max},
{0, 0},
{u_max, 0},
{u_max, v_max}
};
#else
static const GLfloat texverts[4][2] = {
{0, 1},
{0, 0},
{1, 0},
{1, 1}
};
#endif
glBindTexture(TEX2D, tex);
glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, &ButtonCoords[ID * 8]);
glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts);
glEnableVertexAttribArray(attr_pos);
glEnableVertexAttribArray(attr_tex);
glActiveTexture(GL_TEXTURE0);
glUniform1i(uni_tex, 0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableVertexAttribArray(attr_pos);
glDisableVertexAttribArray(attr_tex);
glBindTexture(TEX2D, 0);
}
void DrawReal()
{
section.lock();
if (!once)
{
section.unlock();
return;
}
int width = gW;
int height = gH;
glBindTexture(GL_TEXTURE_2D, s_RenderTarget);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -182,20 +228,19 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height)
glDisableVertexAttribArray(attr_tex);
glBindTexture(GL_TEXTURE_2D, 0);
section.unlock();
GL_REPORT_ERRORD();
}
void SWRenderer::DrawTexture(u8 *texture, int width, int height)
{
section.lock();
memcpy(image, texture, width * height * 4);
gW = width;
gH = height;
once = true;
section.unlock();
}
void SWRenderer::SwapBuffer()
{
DrawDebugText();
glFlush();
GLInterface->Swap();
swstats.ResetFrame();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
GL_REPORT_ERRORD();
}