summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2013-03-19 21:53:09 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2013-03-19 21:53:09 -0500
commitd11679a06e6a992216148fd2ce1730c9912c8564 (patch)
tree843eb3b17cf8fe6c72af7e32d5554ce35ce785d6 /Source/Core
parentedd9d0e0ef6898a0528ac6389e93e9fca6132ff6 (diff)
Android mega commit of trash.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/StringUtil.cpp3
-rw-r--r--Source/Core/Core/Src/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/Src/HW/GCPad.cpp11
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface.h2
-rw-r--r--Source/Core/DolphinWX/Src/MainAndroid.cpp66
5 files changed, 75 insertions, 9 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index 43c4aebf12..855a8c2e30 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -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)
diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp
index ab0fef3498..e2f01150b2 100644
--- a/Source/Core/Core/Src/ConfigManager.cpp
+++ b/Source/Core/Core/Src/ConfigManager.cpp
@@ -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
diff --git a/Source/Core/Core/Src/HW/GCPad.cpp b/Source/Core/Core/Src/HW/GCPad.cpp
index c4798b3964..1bc38b111a 100644
--- a/Source/Core/Core/Src/HW/GCPad.cpp
+++ b/Source/Core/Core/Src/HW/GCPad.cpp
@@ -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;
+ }
+
}
// __________________________________________________________________________________________________
diff --git a/Source/Core/DolphinWX/Src/GLInterface.h b/Source/Core/DolphinWX/Src/GLInterface.h
index 2923ff7bf4..c58e0c5ecb 100644
--- a/Source/Core/DolphinWX/Src/GLInterface.h
+++ b/Source/Core/DolphinWX/Src/GLInterface.h
@@ -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"
diff --git a/Source/Core/DolphinWX/Src/MainAndroid.cpp b/Source/Core/DolphinWX/Src/MainAndroid.cpp
index ca2119921d..aa6db56aa1 100644
--- a/Source/Core/DolphinWX/Src/MainAndroid.cpp
+++ b/Source/Core/DolphinWX/Src/MainAndroid.cpp
@@ -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,25 +122,73 @@ 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();
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(""))
- {
+ if ( BootManager::BootCore( File ) )
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();
- }
WiimoteReal::Shutdown();
VideoBackend::ClearList();