[Android] Add Android/Bridge to clang checking
This commit is contained in:
parent
ebdef8bbdb
commit
bf480623bd
|
@ -1,13 +1,13 @@
|
|||
#include <Project64-core/TraceModulesProject64.h>
|
||||
#include <Common/Trace.h>
|
||||
#include "JavaBridge.h"
|
||||
#include "jniBridge.h"
|
||||
#include <Common/Trace.h>
|
||||
#include <Project64-core/TraceModulesProject64.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
JavaBridge::JavaBridge(JavaVM* vm) :
|
||||
m_vm(vm)
|
||||
JavaBridge::JavaBridge(JavaVM * vm) :
|
||||
m_vm(vm)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
jclass GalleryActivityClass = env->FindClass("emu/project64/GalleryActivity");
|
||||
if (GalleryActivityClass != NULL)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ m_vm(vm)
|
|||
void JavaBridge::GfxThreadInit()
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (g_GLThread != NULL && env != NULL)
|
||||
{
|
||||
jclass GLThreadClass = env->GetObjectClass(g_GLThread);
|
||||
|
@ -37,7 +37,7 @@ void JavaBridge::GfxThreadInit()
|
|||
void JavaBridge::GfxThreadDone()
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (g_GLThread != NULL && env != NULL)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Calling java GLThread::ThreadExiting");
|
||||
|
@ -51,7 +51,7 @@ void JavaBridge::GfxThreadDone()
|
|||
|
||||
void JavaBridge::SwapWindow()
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (g_GLThread != NULL && env != NULL)
|
||||
{
|
||||
jclass GLThreadClass = env->GetObjectClass(g_GLThread);
|
||||
|
@ -63,7 +63,7 @@ void JavaBridge::SwapWindow()
|
|||
|
||||
void JavaBridge::RomListReset(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jmethodID midRomListReset = env->GetStaticMethodID(m_GalleryActivityClass, "RomListReset", "()V");
|
||||
|
@ -73,7 +73,7 @@ void JavaBridge::RomListReset(void)
|
|||
|
||||
void JavaBridge::RomListAddItem(const char * FullFileName, const char * FileName, const char * GoodName, uint32_t TextColor)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jmethodID midRomListAddItem = env->GetStaticMethodID(m_GalleryActivityClass, "RomListAddItem", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V");
|
||||
|
@ -92,7 +92,7 @@ void JavaBridge::RomListAddItem(const char * FullFileName, const char * FileName
|
|||
|
||||
void JavaBridge::RomListLoaded(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jmethodID midRomListLoadDone = env->GetStaticMethodID(m_GalleryActivityClass, "RomListLoadDone", "()V");
|
||||
|
@ -102,43 +102,43 @@ void JavaBridge::RomListLoaded(void)
|
|||
|
||||
void JavaBridge::DisplayError(const char * Message)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jstring j_Message = env->NewStringUTF(Message);
|
||||
jmethodID midDisplayError = env->GetStaticMethodID(m_NotifierClass, "DisplayError", "(Landroid/app/Activity;Ljava/lang/String;)V");
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midDisplayError,g_Activity,j_Message);
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midDisplayError, g_Activity, j_Message);
|
||||
env->DeleteLocalRef(j_Message);
|
||||
}
|
||||
}
|
||||
|
||||
void JavaBridge::DisplayMessage(const char * Message, int DisplayTime)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jstring j_Message = env->NewStringUTF(Message);
|
||||
jmethodID midshowMessage = env->GetStaticMethodID(m_NotifierClass, "showMessage", "(Landroid/app/Activity;Ljava/lang/String;I)V");
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midshowMessage,g_Activity,j_Message,DisplayTime);
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midshowMessage, g_Activity, j_Message, DisplayTime);
|
||||
env->DeleteLocalRef(j_Message);
|
||||
}
|
||||
}
|
||||
|
||||
void JavaBridge::DisplayMessage2(const char * Message)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jstring j_Message = env->NewStringUTF(Message);
|
||||
jmethodID midshowMessage2 = env->GetStaticMethodID(m_NotifierClass, "showMessage2", "(Landroid/app/Activity;Ljava/lang/String;)V");
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midshowMessage2,g_Activity,j_Message);
|
||||
env->CallStaticVoidMethod(m_NotifierClass, midshowMessage2, g_Activity, j_Message);
|
||||
env->DeleteLocalRef(j_Message);
|
||||
}
|
||||
}
|
||||
|
||||
void JavaBridge::EmulationStopped(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (g_Activity != NULL && env != NULL)
|
||||
{
|
||||
jmethodID midEmulationStopped = env->GetStaticMethodID(m_NotifierClass, "EmulationStopped", "(Landroid/app/Activity;)V");
|
||||
|
@ -148,7 +148,7 @@ void JavaBridge::EmulationStopped(void)
|
|||
|
||||
void JavaBridge::EmulationStarted(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (g_Activity != NULL && env != NULL)
|
||||
{
|
||||
jmethodID midEmulationStarted = env->GetStaticMethodID(m_NotifierClass, "EmulationStarted", "(Landroid/app/Activity;)V");
|
||||
|
@ -158,7 +158,7 @@ void JavaBridge::EmulationStarted(void)
|
|||
|
||||
void JavaBridge::RecentRomsUpdated(void)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (env)
|
||||
{
|
||||
jmethodID midRRecentRomsUpdated = env->GetStaticMethodID(m_GalleryActivityClass, "RecentRomsUpdated", "()V");
|
||||
|
|
|
@ -9,7 +9,7 @@ class JavaBridge :
|
|||
public RenderWindow
|
||||
{
|
||||
public:
|
||||
JavaBridge(JavaVM* vm);
|
||||
JavaBridge(JavaVM * vm);
|
||||
|
||||
// Render window functions
|
||||
void GfxThreadInit();
|
||||
|
@ -31,10 +31,10 @@ public:
|
|||
|
||||
private:
|
||||
JavaBridge(void);
|
||||
JavaBridge(const JavaBridge&);
|
||||
JavaBridge& operator=(const JavaBridge&);
|
||||
JavaBridge(const JavaBridge &);
|
||||
JavaBridge & operator=(const JavaBridge &);
|
||||
|
||||
JavaVM* m_vm;
|
||||
JavaVM * m_vm;
|
||||
jclass m_GalleryActivityClass;
|
||||
jclass m_NotifierClass;
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <Common/StdString.h>
|
||||
#include <Common/Trace.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/Settings.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include "Notification.h"
|
||||
#include "JavaBridge.h"
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/Trace.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/Settings.h>
|
||||
#if defined(ANDROID)
|
||||
#include <android/log.h>
|
||||
|
||||
|
@ -87,7 +87,10 @@ void CNotificationImp::DisplayMessage(int DisplayTime, LanguageStringID StringID
|
|||
void CNotificationImp::DisplayMessage(int DisplayTime, const char * Message) const
|
||||
{
|
||||
#ifdef ANDROID
|
||||
if (g_JavaBridge == NULL) { return; }
|
||||
if (g_JavaBridge == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_JavaBridge->DisplayMessage(Message, DisplayTime);
|
||||
#else
|
||||
// Ignore warning usage
|
||||
|
@ -99,7 +102,10 @@ void CNotificationImp::DisplayMessage(int DisplayTime, const char * Message) con
|
|||
void CNotificationImp::DisplayMessage2(const char * Message) const
|
||||
{
|
||||
#ifdef ANDROID
|
||||
if (g_JavaBridge == NULL) { return; }
|
||||
if (g_JavaBridge == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
g_JavaBridge->DisplayMessage2(Message);
|
||||
#else
|
||||
|
|
|
@ -7,7 +7,7 @@ class CNotificationImp :
|
|||
{
|
||||
public:
|
||||
CNotificationImp(void);
|
||||
virtual ~CNotificationImp();
|
||||
virtual ~CNotificationImp();
|
||||
|
||||
// Error messages
|
||||
void DisplayError(const char * Message) const;
|
||||
|
@ -34,8 +34,8 @@ public:
|
|||
void ChangeFullScreen(void) const;
|
||||
|
||||
private:
|
||||
CNotificationImp(const CNotificationImp&);
|
||||
CNotificationImp& operator=(const CNotificationImp&);
|
||||
CNotificationImp(const CNotificationImp &);
|
||||
CNotificationImp & operator=(const CNotificationImp &);
|
||||
|
||||
mutable time_t m_NextMsg;
|
||||
};
|
||||
|
|
|
@ -4,23 +4,23 @@
|
|||
|
||||
#include "JavaBridge.h"
|
||||
|
||||
class SyncBridge :
|
||||
public RenderWindow
|
||||
class SyncBridge :
|
||||
public RenderWindow
|
||||
{
|
||||
public:
|
||||
SyncBridge (JavaBridge * javaBridge);
|
||||
SyncBridge(JavaBridge * javaBridge);
|
||||
|
||||
// Render window functions
|
||||
void GfxThreadInit();
|
||||
void GfxThreadInit();
|
||||
void GfxThreadDone();
|
||||
void SwapWindow();
|
||||
|
||||
private:
|
||||
SyncBridge(void);
|
||||
SyncBridge(const SyncBridge&);
|
||||
SyncBridge& operator=(const SyncBridge&);
|
||||
SyncBridge(void);
|
||||
SyncBridge(const SyncBridge &);
|
||||
SyncBridge & operator=(const SyncBridge &);
|
||||
|
||||
JavaBridge * m_JavaBridge;
|
||||
JavaBridge * m_JavaBridge;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "UISettings.h"
|
||||
#include <Project64-core/Settings.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Application.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-ApplicationIndex.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-RelativePath.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-GameSetting.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-RelativePath.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-TempNumber.h>
|
||||
#include <Project64-core/Version.h>
|
||||
#include "UISettings.h"
|
||||
|
||||
void RegisterUISettings(void)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <Project64-core\Settings\SettingsID.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
enum UISettingID
|
||||
{
|
||||
StartUISetting = SettingID::FirstUISettings,
|
||||
StartUISetting = SettingID::FirstUISettings,
|
||||
|
||||
AssertsVersion,
|
||||
BuildVersion,
|
||||
|
|
|
@ -2,29 +2,29 @@
|
|||
#ifdef ANDROID
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#include <Project64-core/AppInit.h>
|
||||
#include <Project64-core/Version.h>
|
||||
#include <Project64-core/TraceModulesProject64.h>
|
||||
#include <Project64-core/Settings.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Application.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Common/Trace.h>
|
||||
#include <Common/Thread.h>
|
||||
#include <Common/StdString.h>
|
||||
#include "jniBridge.h"
|
||||
#include "jniBridgeSettings.h"
|
||||
#include "JavaBridge.h"
|
||||
#include "SyncBridge.h"
|
||||
#include "UISettings.h"
|
||||
#include "JavaRomList.h"
|
||||
#include "Notification.h"
|
||||
#include "SyncBridge.h"
|
||||
#include "UISettings.h"
|
||||
#include "jniBridge.h"
|
||||
#include "jniBridgeSettings.h"
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/Thread.h>
|
||||
#include <Common/Trace.h>
|
||||
#include <Project64-core/AppInit.h>
|
||||
#include <Project64-core/N64System/N64System.h>
|
||||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/Settings.h>
|
||||
#include <Project64-core/Settings/SettingType/SettingsType-Application.h>
|
||||
#include <Project64-core/TraceModulesProject64.h>
|
||||
#include <Project64-core/Version.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define EXPORT extern "C" __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
#define EXPORT extern "C" __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
#else
|
||||
#define EXPORT extern "C" __attribute__((visibility("default")))
|
||||
#define EXPORT extern "C" __attribute__((visibility("default")))
|
||||
#define CALL
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ class AndroidLogger : public CTraceModule
|
|||
switch (severity)
|
||||
{
|
||||
case TraceError: __android_log_print(ANDROID_LOG_ERROR, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
case TraceWarning: __android_log_print(ANDROID_LOG_WARN, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
case TraceWarning: __android_log_print(ANDROID_LOG_WARN, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
case TraceNotice: __android_log_print(ANDROID_LOG_INFO, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
case TraceInfo: __android_log_print(ANDROID_LOG_INFO, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
case TraceDebug: __android_log_print(ANDROID_LOG_DEBUG, TraceModule(module), "%05d: %s: %s", CThread::GetCurrentThreadId(), function, Message); break;
|
||||
|
@ -55,21 +55,21 @@ std::unique_ptr<CJniBridegSettings> JniBridegSettings;
|
|||
CJavaRomList * g_JavaRomList = NULL;
|
||||
AndroidLogger * g_Logger = NULL;
|
||||
static pthread_key_t g_ThreadKey;
|
||||
static JavaVM* g_JavaVM = NULL;
|
||||
static JavaVM * g_JavaVM = NULL;
|
||||
JavaBridge * g_JavaBridge = NULL;
|
||||
SyncBridge * g_SyncBridge = NULL;
|
||||
jobject g_Activity = NULL;
|
||||
jobject g_GLThread = NULL;
|
||||
|
||||
static void Android_JNI_ThreadDestroyed(void*);
|
||||
static void Android_JNI_ThreadDestroyed(void *);
|
||||
static void Android_JNI_SetupThread(void);
|
||||
|
||||
EXPORT jint CALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
EXPORT jint CALL JNI_OnLoad(JavaVM * vm, void * reserved)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "jniBridge", "JNI_OnLoad called");
|
||||
g_JavaVM = vm;
|
||||
JNIEnv *env;
|
||||
if (g_JavaVM->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK)
|
||||
JNIEnv * env;
|
||||
if (g_JavaVM->GetEnv((void **)&env, JNI_VERSION_1_4) != JNI_OK)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "jniBridge", "Failed to get the environment using GetEnv()");
|
||||
return -1;
|
||||
|
@ -89,7 +89,10 @@ EXPORT jint CALL JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||
|
||||
void AddRecentRom(const char * ImagePath)
|
||||
{
|
||||
if (ImagePath == NULL) { return; }
|
||||
if (ImagePath == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start (ImagePath: %s)", ImagePath);
|
||||
|
||||
// Get information about the stored ROM list
|
||||
|
@ -141,7 +144,7 @@ void GameCpuRunning(void * /*NotUsed*/)
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
bool Running = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, Running ? "Game started" : "Game stopped");
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
JNIEnv * env = Android_JNI_GetEnv();
|
||||
if (Running)
|
||||
{
|
||||
stdstr FileLoc = g_Settings->LoadStringVal(Game_File);
|
||||
|
@ -206,7 +209,7 @@ void GameCpuRunning(void * /*NotUsed*/)
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, jclass cls, jstring BaseDir)
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv * env, jclass cls, jstring BaseDir)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "Project64", " ____ _ __ _____ __ __");
|
||||
__android_log_print(ANDROID_LOG_INFO, "Project64", " / __ \\_________ (_)__ _____/ /_/ ___// // /");
|
||||
|
@ -230,7 +233,7 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, j
|
|||
return false;
|
||||
}
|
||||
|
||||
const char *baseDir = env->GetStringUTFChars(BaseDir, 0);
|
||||
const char * baseDir = env->GetStringUTFChars(BaseDir, 0);
|
||||
bool res = AppInit(&Notify(), baseDir, 0, NULL);
|
||||
env->ReleaseStringUTFChars(BaseDir, baseDir);
|
||||
if (res)
|
||||
|
@ -251,12 +254,12 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, j
|
|||
return res;
|
||||
}
|
||||
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_appVersion(JNIEnv* env, jclass cls)
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_appVersion(JNIEnv * env, jclass cls)
|
||||
{
|
||||
return env->NewStringUTF(VER_FILE_VERSION_STR);
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveBool(JNIEnv* env, jclass cls, jstring Type, jboolean Value)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveBool(JNIEnv * env, jclass cls, jstring Type, jboolean Value)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Saving %s value: %s", szType, Value ? "true" : "false");
|
||||
|
@ -269,7 +272,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveBool(JNIEnv* e
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Saved");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveDword(JNIEnv* env, jclass cls, jstring Type, int Value)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveDword(JNIEnv * env, jclass cls, jstring Type, int Value)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Saving %s value: 0x%X", szType, Value);
|
||||
|
@ -283,7 +286,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveDword(JNIEnv*
|
|||
env->ReleaseStringUTFChars(Type, szType);
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveString(JNIEnv* env, jclass cls, jstring Type, jstring Buffer)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveString(JNIEnv * env, jclass cls, jstring Type, jstring Buffer)
|
||||
{
|
||||
const char * szBuffer = env->GetStringUTFChars(Buffer, 0);
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
|
@ -299,7 +302,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_SettingsSaveString(JNIEnv*
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Saved");
|
||||
}
|
||||
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_SettingsLoadBool(JNIEnv* env, jclass cls, jstring Type)
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_SettingsLoadBool(JNIEnv * env, jclass cls, jstring Type)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
SettingID Id = JniBridegSettings->TranslateSettingID(szType);
|
||||
|
@ -311,7 +314,7 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_SettingsLoadBool(JNIEn
|
|||
return false;
|
||||
}
|
||||
|
||||
EXPORT jint CALL Java_emu_project64_jni_NativeExports_SettingsLoadDword(JNIEnv* env, jclass cls, jstring Type)
|
||||
EXPORT jint CALL Java_emu_project64_jni_NativeExports_SettingsLoadDword(JNIEnv * env, jclass cls, jstring Type)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
SettingID Id = JniBridegSettings->TranslateSettingID(szType);
|
||||
|
@ -323,7 +326,7 @@ EXPORT jint CALL Java_emu_project64_jni_NativeExports_SettingsLoadDword(JNIEnv*
|
|||
return 0;
|
||||
}
|
||||
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_SettingsLoadString(JNIEnv* env, jclass cls, jstring Type)
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_SettingsLoadString(JNIEnv * env, jclass cls, jstring Type)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
SettingID Id = JniBridegSettings->TranslateSettingID(szType);
|
||||
|
@ -335,19 +338,19 @@ EXPORT jstring CALL Java_emu_project64_jni_NativeExports_SettingsLoadString(JNIE
|
|||
return env->NewStringUTF("");
|
||||
}
|
||||
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_SettingsLoadStringIndex(JNIEnv* env, jclass cls, jstring Type, int32_t Index)
|
||||
EXPORT jstring CALL Java_emu_project64_jni_NativeExports_SettingsLoadStringIndex(JNIEnv * env, jclass cls, jstring Type, int32_t Index)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
SettingID Id = JniBridegSettings->TranslateSettingID(szType);
|
||||
env->ReleaseStringUTFChars(Type, szType);
|
||||
if (Id != Default_None)
|
||||
{
|
||||
return env->NewStringUTF(g_Settings->LoadStringIndex(Id,Index).c_str());
|
||||
return env->NewStringUTF(g_Settings->LoadStringIndex(Id, Index).c_str());
|
||||
}
|
||||
return env->NewStringUTF("");
|
||||
}
|
||||
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_IsSettingSet(JNIEnv* env, jclass cls, jstring Type)
|
||||
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_IsSettingSet(JNIEnv * env, jclass cls, jstring Type)
|
||||
{
|
||||
const char * szType = env->GetStringUTFChars(Type, 0);
|
||||
SettingID Id = JniBridegSettings->TranslateSettingID(szType);
|
||||
|
@ -359,7 +362,7 @@ EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_IsSettingSet(JNIEnv* e
|
|||
return false;
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_LoadRomList(JNIEnv* env, jclass cls)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_LoadRomList(JNIEnv * env, jclass cls)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
if (g_JavaRomList == NULL)
|
||||
|
@ -371,25 +374,25 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_LoadRomList(JNIEnv* env, j
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_LoadGame(JNIEnv* env, jclass cls, jstring FileLoc)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_LoadGame(JNIEnv * env, jclass cls, jstring FileLoc)
|
||||
{
|
||||
const char *fileLoc = env->GetStringUTFChars(FileLoc, 0);
|
||||
const char * fileLoc = env->GetStringUTFChars(FileLoc, 0);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "FileLoc: %s", fileLoc);
|
||||
CN64System::LoadFileImage(fileLoc);
|
||||
env->ReleaseStringUTFChars(FileLoc, fileLoc);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Image loaded");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StartGame(JNIEnv* env, jclass cls, jobject activity, jobject GLThread)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StartGame(JNIEnv * env, jclass cls, jobject activity, jobject GLThread)
|
||||
{
|
||||
g_Activity = env->NewGlobalRef(activity);
|
||||
g_GLThread = env->NewGlobalRef(GLThread);
|
||||
CN64System::RunLoadedImage();
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_RefreshRomDir(JNIEnv* env, jclass cls, jstring RomDir, jboolean Recursive)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_RefreshRomDir(JNIEnv * env, jclass cls, jstring RomDir, jboolean Recursive)
|
||||
{
|
||||
const char *romDir = env->GetStringUTFChars(RomDir, 0);
|
||||
const char * romDir = env->GetStringUTFChars(RomDir, 0);
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "romDir = %s Recursive = %s", romDir, Recursive ? "true" : "false");
|
||||
g_Settings->SaveString(RomList_GameDir, romDir);
|
||||
g_Settings->SaveBool(RomList_GameDirRecursive, Recursive);
|
||||
|
@ -404,7 +407,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_RefreshRomDir(JNIEnv* env,
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_ExternalEvent(JNIEnv* env, jclass cls, int Type)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_ExternalEvent(JNIEnv * env, jclass cls, int Type)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start (Type: %d)", Type);
|
||||
if (g_BaseSystem)
|
||||
|
@ -418,14 +421,14 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_ExternalEvent(JNIEnv* env,
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_ResetApplicationSettings(JNIEnv* env, jclass cls)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_ResetApplicationSettings(JNIEnv * env, jclass cls)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
CSettingTypeApplication::ResetAll();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT jbyteArray CALL Java_emu_project64_jni_NativeExports_GetString(JNIEnv* env, jclass cls, int StringID)
|
||||
EXPORT jbyteArray CALL Java_emu_project64_jni_NativeExports_GetString(JNIEnv * env, jclass cls, int StringID)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start (StringID: %d)", StringID);
|
||||
jbyteArray result = NULL;
|
||||
|
@ -446,7 +449,7 @@ EXPORT jbyteArray CALL Java_emu_project64_jni_NativeExports_GetString(JNIEnv* en
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SetSpeed(JNIEnv* env, jclass cls, int Speed)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_SetSpeed(JNIEnv * env, jclass cls, int Speed)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start (Speed: %d)", Speed);
|
||||
if (g_BaseSystem)
|
||||
|
@ -456,7 +459,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_SetSpeed(JNIEnv* env, jcla
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT int CALL Java_emu_project64_jni_NativeExports_GetSpeed(JNIEnv* env, jclass cls)
|
||||
EXPORT int CALL Java_emu_project64_jni_NativeExports_GetSpeed(JNIEnv * env, jclass cls)
|
||||
{
|
||||
int speed = 0;
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
|
@ -468,7 +471,7 @@ EXPORT int CALL Java_emu_project64_jni_NativeExports_GetSpeed(JNIEnv* env, jclas
|
|||
return speed;
|
||||
}
|
||||
|
||||
EXPORT int CALL Java_emu_project64_jni_NativeExports_GetBaseSpeed(JNIEnv* env, jclass cls)
|
||||
EXPORT int CALL Java_emu_project64_jni_NativeExports_GetBaseSpeed(JNIEnv * env, jclass cls)
|
||||
{
|
||||
int speed = 0;
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
|
@ -524,7 +527,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_onSurfaceChanged(JNIEnv *
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StopEmulation(JNIEnv* env, jclass cls)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StopEmulation(JNIEnv * env, jclass cls)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
if (g_BaseSystem)
|
||||
|
@ -534,7 +537,7 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_StopEmulation(JNIEnv* env,
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StartEmulation(JNIEnv* env, jclass cls)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_StartEmulation(JNIEnv * env, jclass cls)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
if (g_BaseSystem)
|
||||
|
@ -544,19 +547,19 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_StartEmulation(JNIEnv* env
|
|||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_CloseSystem(JNIEnv* env, jclass cls)
|
||||
EXPORT void CALL Java_emu_project64_jni_NativeExports_CloseSystem(JNIEnv * env, jclass cls)
|
||||
{
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Start");
|
||||
g_BaseSystem->EndEmulation();
|
||||
WriteTrace(TraceUserInterface, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
static void Android_JNI_ThreadDestroyed(void* value)
|
||||
static void Android_JNI_ThreadDestroyed(void * value)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Android_JNI_ThreadDestroyed", "start");
|
||||
|
||||
// The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required
|
||||
JNIEnv *env = (JNIEnv*)value;
|
||||
JNIEnv * env = (JNIEnv *)value;
|
||||
if (env != NULL)
|
||||
{
|
||||
g_JavaVM->DetachCurrentThread();
|
||||
|
@ -565,7 +568,7 @@ static void Android_JNI_ThreadDestroyed(void* value)
|
|||
__android_log_print(ANDROID_LOG_ERROR, "Android_JNI_ThreadDestroyed", "Done");
|
||||
}
|
||||
|
||||
JNIEnv* Android_JNI_GetEnv(void)
|
||||
JNIEnv * Android_JNI_GetEnv(void)
|
||||
{
|
||||
/*
|
||||
* From http://developer.android.com/guide/practices/jni.html
|
||||
|
@ -580,7 +583,7 @@ JNIEnv* Android_JNI_GetEnv(void)
|
|||
* Note: You can call this function any number of times for the same thread, there's no harm in it
|
||||
*/
|
||||
|
||||
JNIEnv *env;
|
||||
JNIEnv * env;
|
||||
int status = g_JavaVM->AttachCurrentThread(&env, NULL);
|
||||
if (status < 0)
|
||||
{
|
||||
|
@ -597,7 +600,7 @@ JNIEnv* Android_JNI_GetEnv(void)
|
|||
* Note: You can call this function any number of times for the same thread, there's no harm in it
|
||||
* (except for some lost CPU cycles)
|
||||
*/
|
||||
pthread_setspecific(g_ThreadKey, (void*)env);
|
||||
pthread_setspecific(g_ThreadKey, (void *)env);
|
||||
return env;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#ifdef ANDROID
|
||||
#include <jni.h>
|
||||
|
||||
JNIEnv* Android_JNI_GetEnv(void);
|
||||
JNIEnv * Android_JNI_GetEnv(void);
|
||||
|
||||
extern jobject g_Activity;
|
||||
extern jobject g_GLThread;
|
||||
|
|
|
@ -14,13 +14,13 @@ CJniBridegSettings::CJniBridegSettings()
|
|||
m_RefCount += 1;
|
||||
if (m_RefCount == 1)
|
||||
{
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->RegisterChangeCB(GameRunning_CPU_Running, NULL, RefreshSettings);
|
||||
RefreshSettings(NULL);
|
||||
}
|
||||
|
||||
#define ADD_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("Core." #ID,ID));
|
||||
#define ADD_UI_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("UISettingID." #ID,(SettingID)ID));
|
||||
#define ADD_VIDEO_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("VideoSettingID." #ID,(SettingID)(FirstGfxSettings + ID)));
|
||||
#define ADD_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("Core." #ID, ID));
|
||||
#define ADD_UI_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("UISettingID." #ID, (SettingID)ID));
|
||||
#define ADD_VIDEO_SETTING(ID) m_SettingNameList.insert(SettingNameList::value_type("VideoSettingID." #ID, (SettingID)(FirstGfxSettings + ID)));
|
||||
|
||||
ADD_SETTING(Cmd_BaseDirectory);
|
||||
ADD_SETTING(Cmd_RomFile);
|
||||
|
@ -472,13 +472,13 @@ CJniBridegSettings::~CJniBridegSettings()
|
|||
m_RefCount -= 1;
|
||||
if (m_RefCount == 0)
|
||||
{
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running,NULL,RefreshSettings);
|
||||
g_Settings->UnregisterChangeCB(GameRunning_CPU_Running, NULL, RefreshSettings);
|
||||
}
|
||||
}
|
||||
|
||||
void CJniBridegSettings::RefreshSettings(void *)
|
||||
{
|
||||
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
m_bCPURunning = g_Settings->LoadBool(GameRunning_CPU_Running);
|
||||
}
|
||||
|
||||
SettingID CJniBridegSettings::TranslateSettingID(const char * SettingName)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include <Project64-core\Settings\SettingsID.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class CJniBridegSettings
|
||||
{
|
||||
|
@ -12,12 +12,15 @@ public:
|
|||
~CJniBridegSettings();
|
||||
|
||||
SettingID TranslateSettingID(const char * SettingName);
|
||||
static inline bool bCPURunning ( void) { return m_bCPURunning; }
|
||||
static inline bool bCPURunning(void)
|
||||
{
|
||||
return m_bCPURunning;
|
||||
}
|
||||
|
||||
private:
|
||||
SettingNameList m_SettingNameList;
|
||||
|
||||
static void RefreshSettings (void *);
|
||||
static void RefreshSettings(void *);
|
||||
|
||||
static bool m_bCPURunning;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ set ScanDir[1]="%base_dir%\Source\Project64"
|
|||
set ScanDir[2]="%base_dir%\Source\Project64-core"
|
||||
set ScanDir[3]="%base_dir%\Source\Project64-rsp"
|
||||
set ScanDir[4]="%base_dir%\Source\Project64-rsp-core"
|
||||
set ScanDir[5]="%base_dir%\Source\Android\Bridge"
|
||||
|
||||
set ScanFiles[0]="*.cpp"
|
||||
set ScanFiles[1]="*.h"
|
||||
|
|
Loading…
Reference in New Issue