Skip to content

Commit

Permalink
[Android] Add Android/Bridge to clang checking
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Oct 26, 2023
1 parent ebdef8b commit bf48062
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 112 deletions.
40 changes: 20 additions & 20 deletions Source/Android/Bridge/JavaBridge.cpp
@@ -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)
{
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions Source/Android/Bridge/JavaBridge.h
Expand Up @@ -9,7 +9,7 @@ class JavaBridge :
public RenderWindow
{
public:
JavaBridge(JavaVM* vm);
JavaBridge(JavaVM * vm);

// Render window functions
void GfxThreadInit();
Expand All @@ -31,10 +31,10 @@ class JavaBridge :

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;
};
Expand Down
16 changes: 11 additions & 5 deletions Source/Android/Bridge/Notification.cpp
@@ -1,10 +1,10 @@
#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>
#include <Project64-core/N64System/N64System.h>
#include "Notification.h"
#include "JavaBridge.h"
#if defined(ANDROID)
#include <android/log.h>

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Source/Android/Bridge/Notification.h
Expand Up @@ -7,7 +7,7 @@ class CNotificationImp :
{
public:
CNotificationImp(void);
virtual ~CNotificationImp();
virtual ~CNotificationImp();

// Error messages
void DisplayError(const char * Message) const;
Expand All @@ -34,8 +34,8 @@ class CNotificationImp :
void ChangeFullScreen(void) const;

private:
CNotificationImp(const CNotificationImp&);
CNotificationImp& operator=(const CNotificationImp&);
CNotificationImp(const CNotificationImp &);
CNotificationImp & operator=(const CNotificationImp &);

mutable time_t m_NextMsg;
};
Expand Down
16 changes: 8 additions & 8 deletions Source/Android/Bridge/SyncBridge.h
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Source/Android/Bridge/UISettings.cpp
@@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Android/Bridge/UISettings.h
@@ -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,
Expand Down

0 comments on commit bf48062

Please sign in to comment.