2013-02-26 12:49:00 -07:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
|
|
|
|
|
|
|
// This program 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 Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2014-02-18 18:56:29 -07:00
|
|
|
#include <cstdarg>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <jni.h>
|
|
|
|
#include <android/log.h>
|
|
|
|
#include <android/native_window_jni.h>
|
2014-02-10 23:16:21 -07:00
|
|
|
#include <EGL/egl.h>
|
2013-02-26 12:49:00 -07:00
|
|
|
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "Android/ButtonManager.h"
|
|
|
|
#include "Common/Common.h"
|
2014-02-22 15:36:30 -07:00
|
|
|
#include "Common/CommonPaths.h"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "Common/CPUDetect.h"
|
2014-04-13 17:15:23 -06:00
|
|
|
#include "Common/Event.h"
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/LogManager.h"
|
|
|
|
#include "Core/BootManager.h"
|
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "Core/Host.h"
|
|
|
|
#include "Core/State.h"
|
|
|
|
#include "Core/HW/Wiimote.h"
|
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2013-04-14 19:39:56 -06:00
|
|
|
|
2013-04-23 13:21:48 -06:00
|
|
|
// Banner loading
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "DiscIO/BannerLoader.h"
|
|
|
|
#include "DiscIO/Filesystem.h"
|
|
|
|
#include "DiscIO/VolumeCreator.h"
|
2013-04-23 13:21:48 -06:00
|
|
|
|
2014-02-18 18:56:29 -07:00
|
|
|
#include "VideoCommon/OnScreenDisplay.h"
|
|
|
|
#include "VideoCommon/VideoBackendBase.h"
|
2013-02-26 12:49:00 -07:00
|
|
|
|
2013-03-19 20:53:09 -06:00
|
|
|
ANativeWindow* surf;
|
2013-03-24 20:06:34 -06:00
|
|
|
int g_width, g_height;
|
2013-07-27 14:09:18 -06:00
|
|
|
std::string g_filename;
|
|
|
|
static std::thread g_run_thread;
|
|
|
|
|
2014-03-17 17:17:12 -06:00
|
|
|
#define DOLPHIN_TAG "Dolphinemu"
|
2013-02-26 12:49:00 -07:00
|
|
|
|
|
|
|
void Host_NotifyMapLoaded() {}
|
|
|
|
void Host_RefreshDSPDebuggerWindow() {}
|
|
|
|
|
|
|
|
void Host_ShowJitResults(unsigned int address){}
|
|
|
|
|
|
|
|
Common::Event updateMainFrameEvent;
|
|
|
|
void Host_Message(int Id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void* Host_GetRenderHandle()
|
|
|
|
{
|
2013-03-19 20:53:09 -06:00
|
|
|
return surf;
|
2013-02-26 12:49:00 -07:00
|
|
|
}
|
|
|
|
|
2014-03-09 14:14:26 -06:00
|
|
|
void* Host_GetInstance() { return nullptr; }
|
2013-02-26 12:49:00 -07:00
|
|
|
|
2014-03-12 13:33:41 -06:00
|
|
|
void Host_UpdateTitle(const std::string& title)
|
2013-07-27 14:09:18 -06:00
|
|
|
{
|
2014-03-17 17:17:12 -06:00
|
|
|
__android_log_write(ANDROID_LOG_INFO, DOLPHIN_TAG, title.c_str());
|
|
|
|
}
|
2013-02-26 12:49:00 -07:00
|
|
|
|
|
|
|
void Host_UpdateLogDisplay(){}
|
|
|
|
|
|
|
|
void Host_UpdateDisasmDialog(){}
|
|
|
|
|
|
|
|
void Host_UpdateMainFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Host_UpdateBreakPointView(){}
|
|
|
|
|
|
|
|
bool Host_GetKeyState(int keycode)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
|
|
|
|
{
|
|
|
|
x = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos;
|
|
|
|
y = SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos;
|
2013-10-28 23:23:17 -06:00
|
|
|
width = g_width;
|
|
|
|
height = g_height;
|
2013-02-26 12:49:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_RequestRenderWindowSize(int width, int height) {}
|
|
|
|
void Host_SetStartupDebuggingParameters()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Host_RendererHasFocus()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Host_ConnectWiimote(int wm_idx, bool connect) {}
|
|
|
|
|
|
|
|
void Host_SetWaitCursor(bool enable){}
|
|
|
|
|
2014-03-12 13:33:41 -06:00
|
|
|
void Host_UpdateStatusBar(const std::string& text, int filed){}
|
2013-02-26 12:49:00 -07:00
|
|
|
|
|
|
|
void Host_SysMessage(const char *fmt, ...)
|
|
|
|
{
|
2014-03-17 17:17:12 -06:00
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
2014-03-29 04:05:44 -06:00
|
|
|
__android_log_vprint(ANDROID_LOG_INFO, DOLPHIN_TAG, fmt, args);
|
2014-03-17 17:17:12 -06:00
|
|
|
va_end(args);
|
2013-02-26 12:49:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_SetWiiMoteConnectionState(int _State) {}
|
|
|
|
|
2013-04-23 13:21:48 -06:00
|
|
|
#define DVD_BANNER_WIDTH 96
|
|
|
|
#define DVD_BANNER_HEIGHT 32
|
|
|
|
std::vector<std::string> m_volume_names;
|
|
|
|
std::vector<std::string> m_names;
|
|
|
|
|
2013-09-25 01:05:36 -06:00
|
|
|
static inline u32 Average32(u32 a, u32 b) {
|
|
|
|
return ((a >> 1) & 0x7f7f7f7f) + ((b >> 1) & 0x7f7f7f7f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 GetPixel(u32 *buffer, unsigned int x, unsigned int y) {
|
|
|
|
// thanks to unsignedness, these also check for <0 automatically.
|
|
|
|
if (x > 191) return 0;
|
|
|
|
if (y > 63) return 0;
|
|
|
|
return buffer[y * 192 + x];
|
|
|
|
}
|
|
|
|
|
2013-04-23 13:21:48 -06:00
|
|
|
bool LoadBanner(std::string filename, u32 *Banner)
|
|
|
|
{
|
|
|
|
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename);
|
|
|
|
|
2014-03-09 14:14:26 -06:00
|
|
|
if (pVolume != nullptr)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2014-03-09 14:14:26 -06:00
|
|
|
if (pFileSystem != nullptr || bIsWad)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
|
|
|
DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume);
|
|
|
|
|
2014-03-09 14:14:26 -06:00
|
|
|
if (pBannerLoader != nullptr)
|
2013-04-23 13:21:48 -06:00
|
|
|
if (pBannerLoader->IsValid())
|
|
|
|
{
|
|
|
|
m_names = pBannerLoader->GetNames();
|
2013-09-25 01:05:36 -06:00
|
|
|
int Width, Height;
|
|
|
|
std::vector<u32> BannerVec = pBannerLoader->GetBanner(&Width, &Height);
|
|
|
|
// This code (along with above inlines) is moved from
|
|
|
|
// elsewhere. Someone who knows anything about Android
|
|
|
|
// please get rid of it and use proper high-resolution
|
|
|
|
// images.
|
|
|
|
if (Height == 64)
|
|
|
|
{
|
|
|
|
u32* Buffer = &BannerVec[0];
|
|
|
|
for (int y = 0; y < 32; y++)
|
|
|
|
{
|
|
|
|
for (int x = 0; x < 96; x++)
|
|
|
|
{
|
|
|
|
// simplified plus-shaped "gaussian"
|
|
|
|
u32 surround = Average32(
|
|
|
|
Average32(GetPixel(Buffer, x*2 - 1, y*2), GetPixel(Buffer, x*2 + 1, y*2)),
|
|
|
|
Average32(GetPixel(Buffer, x*2, y*2 - 1), GetPixel(Buffer, x*2, y*2 + 1)));
|
|
|
|
Banner[y * 96 + x] = Average32(GetPixel(Buffer, x*2, y*2), surround);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
memcpy(Banner, &BannerVec[0], 96 * 32 * 4);
|
|
|
|
}
|
|
|
|
return true;
|
2013-04-23 13:21:48 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2014-03-09 14:14:26 -06:00
|
|
|
SplitPath(filename, nullptr, &name, nullptr);
|
2013-04-23 13:21:48 -06:00
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
std::string GetJString(JNIEnv *env, jstring jstr)
|
|
|
|
{
|
|
|
|
std::string result = "";
|
|
|
|
if (!jstr)
|
|
|
|
return result;
|
2014-03-29 04:05:44 -06:00
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
const char *s = env->GetStringUTFChars(jstr, nullptr);
|
|
|
|
result = s;
|
|
|
|
env->ReleaseStringUTFChars(jstr, s);
|
|
|
|
return result;
|
|
|
|
}
|
2013-04-23 13:21:48 -06:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
2014-03-14 15:20:44 -06:00
|
|
|
|
2013-06-18 06:09:20 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj)
|
2013-03-19 20:53:09 -06:00
|
|
|
{
|
|
|
|
PowerPC::Start();
|
|
|
|
}
|
2013-10-28 23:23:17 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv *env, jobject obj)
|
2013-03-19 20:53:09 -06:00
|
|
|
{
|
|
|
|
PowerPC::Pause();
|
|
|
|
}
|
|
|
|
|
2013-10-28 23:23:17 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv *env, jobject obj)
|
2013-03-19 20:53:09 -06:00
|
|
|
{
|
2013-09-23 00:43:18 -06:00
|
|
|
Core::Stop();
|
2013-09-01 00:10:12 -06:00
|
|
|
updateMainFrameEvent.Set(); // Kick the waiting event
|
2013-03-19 20:53:09 -06:00
|
|
|
}
|
2013-11-24 14:04:53 -07:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchEvent(JNIEnv *env, jobject obj, jint padID, jint Button, jint Action)
|
2013-03-19 20:53:09 -06:00
|
|
|
{
|
2013-11-29 17:37:33 -07:00
|
|
|
ButtonManager::TouchEvent(padID, (ButtonManager::ButtonType)Button, Action);
|
2013-03-19 20:53:09 -06:00
|
|
|
}
|
2013-11-24 14:04:53 -07:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchAxisEvent(JNIEnv *env, jobject obj, jint padID, jint Button, jfloat Action)
|
2013-11-14 14:17:51 -07:00
|
|
|
{
|
2013-11-29 17:37:33 -07:00
|
|
|
ButtonManager::TouchAxisEvent(padID, (ButtonManager::ButtonType)Button, Action);
|
2013-11-14 14:17:51 -07:00
|
|
|
}
|
2013-06-18 06:09:20 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Button, jint Action)
|
|
|
|
{
|
2014-03-14 15:20:44 -06:00
|
|
|
ButtonManager::GamepadEvent(GetJString(env, jDevice), Button, Action);
|
2013-06-18 06:09:20 -06:00
|
|
|
}
|
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Axis, jfloat Value)
|
|
|
|
{
|
2014-03-14 15:20:44 -06:00
|
|
|
ButtonManager::GamepadAxisEvent(GetJString(env, jDevice), Axis, Value);
|
2013-06-18 06:09:20 -06:00
|
|
|
}
|
2013-03-19 20:53:09 -06:00
|
|
|
|
2013-06-18 06:09:20 -06:00
|
|
|
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv *env, jobject obj, jstring jFile)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
2014-03-14 15:20:44 -06:00
|
|
|
std::string file = GetJString(env, jFile);
|
2013-04-23 13:21:48 -06:00
|
|
|
u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
|
2014-03-14 15:20:44 -06:00
|
|
|
jintArray Banner = env->NewIntArray(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT);
|
|
|
|
|
|
|
|
if (LoadBanner(file, uBanner))
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
|
|
|
env->SetIntArrayRegion(Banner, 0, DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT, (jint*)uBanner);
|
|
|
|
}
|
|
|
|
return Banner;
|
|
|
|
}
|
2013-06-18 06:09:20 -06:00
|
|
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv *env, jobject obj, jstring jFile)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
2014-03-14 15:20:44 -06:00
|
|
|
std::string file = GetJString(env, jFile);
|
|
|
|
std::string name = GetName(file);
|
2013-04-23 13:21:48 -06:00
|
|
|
m_names.clear();
|
|
|
|
m_volume_names.clear();
|
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
return env->NewStringUTF(name.c_str());
|
2013-04-23 13:21:48 -06:00
|
|
|
}
|
2013-11-15 16:32:50 -07:00
|
|
|
|
2013-06-22 21:54:28 -06:00
|
|
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj)
|
|
|
|
{
|
|
|
|
return env->NewStringUTF(scm_rev_str);
|
|
|
|
}
|
2013-11-15 13:17:47 -07:00
|
|
|
|
|
|
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj)
|
|
|
|
{
|
|
|
|
return cpu_info.bNEON;
|
|
|
|
}
|
|
|
|
|
2013-11-15 16:32:50 -07:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv *env, jobject obj)
|
|
|
|
{
|
|
|
|
Core::SaveScreenShot();
|
|
|
|
}
|
|
|
|
|
2014-02-10 23:16:21 -07:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv *env, jobject obj, jint api)
|
|
|
|
{
|
|
|
|
eglBindAPI(api);
|
|
|
|
}
|
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
|
|
|
IniFile ini;
|
2014-03-14 15:20:44 -06:00
|
|
|
std::string file = GetJString(env, jFile);
|
|
|
|
std::string section = GetJString(env, jSection);
|
|
|
|
std::string key = GetJString(env, jKey);
|
|
|
|
std::string defaultValue = GetJString(env, jDefault);
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string(file));
|
2013-04-23 13:21:48 -06:00
|
|
|
std::string value;
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
ini.Get(section, key, &value, defaultValue);
|
2013-04-23 13:21:48 -06:00
|
|
|
|
|
|
|
return env->NewStringUTF(value.c_str());
|
|
|
|
}
|
2014-03-14 15:20:44 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey,
|
|
|
|
jstring jValue)
|
2013-04-23 13:21:48 -06:00
|
|
|
{
|
|
|
|
IniFile ini;
|
2014-03-14 15:20:44 -06:00
|
|
|
std::string file = GetJString(env, jFile);
|
|
|
|
std::string section = GetJString(env, jSection);
|
|
|
|
std::string key = GetJString(env, jKey);
|
|
|
|
std::string value = GetJString(env, jValue);
|
2013-06-18 06:09:20 -06:00
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string(file));
|
2013-04-23 13:21:48 -06:00
|
|
|
|
2014-03-14 15:20:44 -06:00
|
|
|
ini.Set(section, key, value);
|
|
|
|
ini.Save(File::GetUserPath(D_CONFIG_IDX) + std::string(file));
|
2013-04-23 13:21:48 -06:00
|
|
|
}
|
|
|
|
|
2013-07-27 14:09:18 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv *env, jobject obj, jstring jFile)
|
|
|
|
{
|
2014-03-14 15:20:44 -06:00
|
|
|
g_filename = GetJString(env, jFile);
|
2013-07-27 14:09:18 -06:00
|
|
|
}
|
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetDimensions(JNIEnv *env, jobject obj, jint _width, jint _height)
|
2013-02-26 12:49:00 -07:00
|
|
|
{
|
2013-03-24 20:06:34 -06:00
|
|
|
g_width = (int)_width;
|
|
|
|
g_height = (int)_height;
|
2013-07-27 14:09:18 -06:00
|
|
|
}
|
2013-04-14 19:39:56 -06:00
|
|
|
|
2013-08-29 16:47:50 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv *env, jobject obj, jint slot)
|
|
|
|
{
|
|
|
|
State::Save(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv *env, jobject obj, jint slot)
|
|
|
|
{
|
|
|
|
State::Load(slot);
|
|
|
|
}
|
|
|
|
|
2013-08-29 17:07:32 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv *env, jobject obj)
|
|
|
|
{
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_WIIUSER_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + USA_DIR DIR_SEP);
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + EUR_DIR DIR_SEP);
|
|
|
|
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
|
|
|
|
}
|
|
|
|
|
2013-07-27 14:09:18 -06:00
|
|
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj, jobject _surf)
|
|
|
|
{
|
|
|
|
surf = ANativeWindow_fromSurface(env, _surf);
|
2013-04-14 19:39:56 -06:00
|
|
|
// Install our callbacks
|
2013-08-23 18:13:54 -06:00
|
|
|
OSD::AddCallback(OSD::OSD_INIT, ButtonManager::Init);
|
|
|
|
OSD::AddCallback(OSD::OSD_SHUTDOWN, ButtonManager::Shutdown);
|
2013-04-14 19:39:56 -06:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
LogManager::Init();
|
|
|
|
SConfig::Init();
|
|
|
|
VideoBackend::PopulateList();
|
2013-04-14 19:39:56 -06:00
|
|
|
VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend);
|
2013-02-26 12:49:00 -07:00
|
|
|
WiimoteReal::LoadSettings();
|
2013-04-23 13:21:48 -06:00
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
// No use running the loop when booting fails
|
2013-07-27 14:09:18 -06:00
|
|
|
if ( BootManager::BootCore( g_filename.c_str() ) )
|
2013-02-26 12:49:00 -07:00
|
|
|
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
|
|
|
updateMainFrameEvent.Wait();
|
|
|
|
|
|
|
|
WiimoteReal::Shutdown();
|
|
|
|
VideoBackend::ClearList();
|
|
|
|
SConfig::Shutdown();
|
|
|
|
LogManager::Shutdown();
|
2013-09-23 00:43:18 -06:00
|
|
|
ANativeWindow_release(surf);
|
2013-02-26 12:49:00 -07:00
|
|
|
}
|
2013-07-27 14:09:18 -06:00
|
|
|
|
|
|
|
|
2013-02-26 12:49:00 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|