Merge pull request #9228 from JosJuice/android-jclass

Android: Fix jobject/jclass warnings
This commit is contained in:
LC 2020-11-09 02:15:04 -05:00 committed by GitHub
commit 418f9faa9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 110 deletions

View File

@ -8,8 +8,6 @@
namespace IDCache namespace IDCache
{ {
static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
JNIEnv* GetEnvForThread(); JNIEnv* GetEnvForThread();
jclass GetNativeLibraryClass(); jclass GetNativeLibraryClass();

View File

@ -187,8 +187,7 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerHe
return static_cast<jint>(GetRef(env, obj)->GetBannerImage().height); return static_cast<jint>(GetRef(env, obj)->GetBannerImage().height);
} }
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_parse(JNIEnv* env, JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_parse(JNIEnv* env, jclass,
jobject obj,
jstring path) jstring path)
{ {
auto game_file = std::make_shared<UICommon::GameFile>(GetJString(env, path)); auto game_file = std::make_shared<UICommon::GameFile>(GetJString(env, path));

View File

@ -28,7 +28,7 @@ extern "C" {
#endif #endif
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_newGameFileCache( JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_newGameFileCache(
JNIEnv* env, jobject obj, jstring path) JNIEnv* env, jclass, jstring path)
{ {
return reinterpret_cast<jlong>(new UICommon::GameFileCache(GetJString(env, path))); return reinterpret_cast<jlong>(new UICommon::GameFileCache(GetJString(env, path)));
} }

View File

@ -232,13 +232,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_finalize(JNI
} }
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_newIniFile(JNIEnv* env, JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_newIniFile(JNIEnv* env,
jobject obj) jobject)
{ {
return reinterpret_cast<jlong>(new IniFile); return reinterpret_cast<jlong>(new IniFile);
} }
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_copyIniFile(JNIEnv* env, JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_utils_IniFile_copyIniFile(JNIEnv* env,
jobject obj, jobject,
jobject other) jobject other)
{ {
return reinterpret_cast<jlong>(new IniFile(*GetIniFilePointer(env, other))); return reinterpret_cast<jlong>(new IniFile(*GetIniFilePointer(env, other)));

View File

@ -71,7 +71,6 @@ namespace
constexpr char DOLPHIN_TAG[] = "DolphinEmuNative"; constexpr char DOLPHIN_TAG[] = "DolphinEmuNative";
ANativeWindow* s_surf; ANativeWindow* s_surf;
IniFile s_ini;
// The Core only supports using a single Host thread. // The Core only supports using a single Host thread.
// If multiple threads want to call host functions then they need to queue // If multiple threads want to call host functions then they need to queue
@ -196,22 +195,20 @@ static std::string GetAnalyticValue(const std::string& key)
extern "C" { extern "C" {
#endif #endif
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv*,
jobject obj) jclass)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SetState(Core::State::Running); Core::SetState(Core::State::Running);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv*, jclass)
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SetState(Core::State::Paused); Core::SetState(Core::State::Paused);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv*, jclass)
jobject obj)
{ {
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
@ -226,81 +223,72 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulatio
s_emulation_end_event.Wait(); s_emulation_end_event.Wait();
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsBooting(JNIEnv* env, JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsBooting(JNIEnv*, jclass)
jobject obj)
{ {
return static_cast<jboolean>(Core::IsBooting()); return static_cast<jboolean>(Core::IsBooting());
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WaitUntilDoneBooting(JNIEnv*,
Java_org_dolphinemu_dolphinemu_NativeLibrary_WaitUntilDoneBooting(JNIEnv* env, jobject obj) jclass)
{ {
Core::WaitUntilDoneBooting(); Core::WaitUntilDoneBooting();
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunning(JNIEnv* env, JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsRunning(JNIEnv*, jclass)
jobject obj)
{ {
return Core::IsRunning(); return Core::IsRunning();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env,
jobject obj,
jstring jFile);
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent( JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(
JNIEnv* env, jobject obj, jstring jDevice, jint Button, jint Action) JNIEnv* env, jclass, jstring jDevice, jint Button, jint Action)
{ {
return ButtonManager::GamepadEvent(GetJString(env, jDevice), Button, Action); return ButtonManager::GamepadEvent(GetJString(env, jDevice), Button, Action);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(
JNIEnv* env, jobject obj, jstring jDevice, jint Axis, jfloat Value) JNIEnv* env, jclass, jstring jDevice, jint Axis, jfloat Value)
{ {
ButtonManager::GamepadAxisEvent(GetJString(env, jDevice), Axis, Value); ButtonManager::GamepadAxisEvent(GetJString(env, jDevice), Axis, Value);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetMotionSensorsEnabled( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetMotionSensorsEnabled(
JNIEnv* env, jobject obj, jboolean accelerometer_enabled, jboolean gyroscope_enabled) JNIEnv*, jclass, jboolean accelerometer_enabled, jboolean gyroscope_enabled)
{ {
ciface::Android::SetMotionSensorsEnabled(accelerometer_enabled, gyroscope_enabled); ciface::Android::SetMotionSensorsEnabled(accelerometer_enabled, gyroscope_enabled);
} }
JNIEXPORT double JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetInputRadiusAtAngle( JNIEXPORT double JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetInputRadiusAtAngle(
JNIEnv* env, jobject obj, int emu_pad_id, int stick, double angle) JNIEnv*, jclass, int emu_pad_id, int stick, double angle)
{ {
const auto casted_stick = static_cast<ButtonManager::ButtonType>(stick); const auto casted_stick = static_cast<ButtonManager::ButtonType>(stick);
return ButtonManager::GetInputRadiusAtAngle(emu_pad_id, casted_stick, angle); return ButtonManager::GetInputRadiusAtAngle(emu_pad_id, casted_stick, angle);
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env, JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env,
jobject obj) jclass)
{ {
return ToJString(env, Common::scm_rev_str); return ToJString(env, Common::scm_rev_str);
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGitRevision(JNIEnv* env, JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGitRevision(JNIEnv* env,
jobject obj) jclass)
{ {
return ToJString(env, Common::scm_rev_git_str); return ToJString(env, Common::scm_rev_git_str);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv*, jclass)
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SaveScreenShot(); Core::SaveScreenShot();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv*, jclass,
jobject obj,
jint api) jint api)
{ {
eglBindAPI(api); eglBindAPI(api);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv*, jclass,
jobject obj,
jint slot, jint slot,
jboolean wait) jboolean wait)
{ {
@ -308,8 +296,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JN
State::Save(slot, wait); State::Save(slot, wait);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(JNIEnv* env, jclass,
jobject obj,
jstring path, jstring path,
jboolean wait) jboolean wait)
{ {
@ -317,82 +304,76 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveStateAs(
State::SaveAs(GetJString(env, path), wait); State::SaveAs(GetJString(env, path), wait);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv*, jclass,
jobject obj,
jint slot) jint slot)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
State::Load(slot); State::Load(slot);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadStateAs(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadStateAs(JNIEnv* env, jclass,
jobject obj,
jstring path) jstring path)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
State::LoadAs(GetJString(env, path)); State::LoadAs(GetJString(env, path));
} }
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUnixTimeOfStateSlot( JNIEXPORT jlong JNICALL
JNIEnv* env, jobject obj, jint slot) Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUnixTimeOfStateSlot(JNIEnv*, jclass, jint slot)
{ {
return static_cast<jlong>(State::GetUnixTimeOfSlot(slot)); return static_cast<jlong>(State::GetUnixTimeOfSlot(slot));
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_utils_DirectoryInitialization_SetSysDirectory( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_utils_DirectoryInitialization_SetSysDirectory(
JNIEnv* env, jobject obj, jstring jPath) JNIEnv* env, jclass, jstring jPath)
{ {
const std::string path = GetJString(env, jPath); const std::string path = GetJString(env, jPath);
File::SetSysDirectory(path); File::SetSysDirectory(path);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_utils_DirectoryInitialization_CreateUserDirectories(JNIEnv* env, Java_org_dolphinemu_dolphinemu_utils_DirectoryInitialization_CreateUserDirectories(JNIEnv*, jclass)
jobject obj)
{ {
UICommon::CreateDirectories(); UICommon::CreateDirectories();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(
JNIEnv* env, jobject obj, jstring jDirectory) JNIEnv* env, jclass, jstring jDirectory)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
UICommon::SetUserDirectory(GetJString(env, jDirectory)); UICommon::SetUserDirectory(GetJString(env, jDirectory));
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv* env, JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv* env,
jobject obj) jclass)
{ {
return ToJString(env, File::GetUserPath(D_USER_IDX)); return ToJString(env, File::GetUserPath(D_USER_IDX));
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetCacheDirectory( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetCacheDirectory(
JNIEnv* env, jobject obj, jstring jDirectory) JNIEnv* env, jclass, jstring jDirectory)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
File::SetUserPath(D_CACHE_IDX, GetJString(env, jDirectory) + DIR_SEP); File::SetUserPath(D_CACHE_IDX, GetJString(env, jDirectory) + DIR_SEP);
} }
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_DefaultCPUCore(JNIEnv* env, JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_DefaultCPUCore(JNIEnv*, jclass)
jobject obj)
{ {
return static_cast<jint>(PowerPC::DefaultCPUCore()); return static_cast<jint>(PowerPC::DefaultCPUCore());
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDefaultGraphicsBackendName(JNIEnv* env, jobject obj) Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDefaultGraphicsBackendName(JNIEnv* env, jclass)
{ {
return ToJString(env, VideoBackendBase::GetDefaultBackendName()); return ToJString(env, VideoBackendBase::GetDefaultBackendName());
} }
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetMaxLogLevel(JNIEnv* env, JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetMaxLogLevel(JNIEnv*, jclass)
jobject obj)
{ {
return static_cast<jint>(MAX_LOGLEVEL); return static_cast<jint>(MAX_LOGLEVEL);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv*, jclass,
jobject obj,
jboolean enable) jboolean enable)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
@ -403,8 +384,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling
Core::SetState(Core::State::Running); Core::SetState(Core::State::Running);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv*,
jobject obj) jclass)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt"; std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
@ -414,7 +395,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfile
// Surface Handling // Surface Handling
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
jobject obj, jclass,
jobject surf) jobject surf)
{ {
s_surf = ANativeWindow_fromSurface(env, surf); s_surf = ANativeWindow_fromSurface(env, surf);
@ -425,8 +406,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChang
g_renderer->ChangeSurface(s_surf); g_renderer->ChangeSurface(s_surf);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv*,
jobject obj) jclass)
{ {
if (g_renderer) if (g_renderer)
g_renderer->ChangeSurface(nullptr); g_renderer->ChangeSurface(nullptr);
@ -438,34 +419,32 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestr
} }
} }
JNIEXPORT jfloat JNICALL JNIEXPORT jfloat JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameAspectRatio(JNIEnv*,
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameAspectRatio(JNIEnv* env, jobject obj) jclass)
{ {
return g_renderer->CalculateDrawAspectRatio(); return g_renderer->CalculateDrawAspectRatio();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimotes(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimotes(JNIEnv*, jclass)
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
WiimoteReal::Refresh(); WiimoteReal::Refresh();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadWiimoteConfig(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadWiimoteConfig(JNIEnv*,
jobject obj) jclass)
{ {
WiimoteReal::LoadSettings(); WiimoteReal::LoadSettings();
Wiimote::LoadConfig(); Wiimote::LoadConfig();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadConfig(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadConfig(JNIEnv*, jclass)
jobject obj)
{ {
SConfig::GetInstance().LoadSettings(); SConfig::GetInstance().LoadSettings();
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_UpdateGCAdapterScanThread(JNIEnv* env, jobject obj) Java_org_dolphinemu_dolphinemu_NativeLibrary_UpdateGCAdapterScanThread(JNIEnv*, jclass)
{ {
if (GCAdapter::UseAdapter()) if (GCAdapter::UseAdapter())
{ {
@ -477,8 +456,7 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_UpdateGCAdapterScanThread(JNIEnv* e
} }
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(JNIEnv*, jclass)
jobject obj)
{ {
Common::RegisterMsgAlertHandler(&MsgAlert); Common::RegisterMsgAlertHandler(&MsgAlert);
Common::AndroidSetReportHandler(&ReportSend); Common::AndroidSetReportHandler(&ReportSend);
@ -486,8 +464,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Initialize(J
UICommon::Init(); UICommon::Init();
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReportStartToAnalytics(JNIEnv*,
Java_org_dolphinemu_dolphinemu_NativeLibrary_ReportStartToAnalytics(JNIEnv* env, jobject obj) jclass)
{ {
DolphinAnalytics::Instance().ReportDolphinStart(GetAnalyticValue("DEVICE_TYPE")); DolphinAnalytics::Instance().ReportDolphinStart(GetAnalyticValue("DEVICE_TYPE"));
} }
@ -559,20 +537,19 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths,
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2(
JNIEnv* env, jobject obj, jobjectArray jPaths) JNIEnv* env, jclass, jobjectArray jPaths)
{ {
Run(env, JStringArrayToVector(env, jPaths)); Run(env, JStringArrayToVector(env, jPaths));
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2Ljava_lang_String_2Z( Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2Ljava_lang_String_2Z(
JNIEnv* env, jobject obj, jobjectArray jPaths, jstring jSavestate, jboolean jDeleteSavestate) JNIEnv* env, jclass, jobjectArray jPaths, jstring jSavestate, jboolean jDeleteSavestate)
{ {
Run(env, JStringArrayToVector(env, jPaths), GetJString(env, jSavestate), jDeleteSavestate); Run(env, JStringArrayToVector(env, jPaths), GetJString(env, jSavestate), jDeleteSavestate);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(JNIEnv* env, jclass,
jobject obj,
jstring jFile) jstring jFile)
{ {
const std::string path = GetJString(env, jFile); const std::string path = GetJString(env, jFile);
@ -581,7 +558,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ChangeDisc(J
} }
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetLogTypeNames(JNIEnv* env, JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetLogTypeNames(JNIEnv* env,
jobject obj) jclass)
{ {
std::map<std::string, std::string> map = Common::Log::LogManager::GetInstance()->GetLogTypes(); std::map<std::string, std::string> map = Common::Log::LogManager::GetInstance()->GetLogTypes();
@ -596,14 +573,14 @@ JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetLogTyp
return linked_hash_map; return linked_hash_map;
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadLoggerConfig(JNIEnv* env, JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ReloadLoggerConfig(JNIEnv*,
jobject obj) jclass)
{ {
Common::Log::LogManager::Init(); Common::Log::LogManager::Init();
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallWAD(JNIEnv* env, JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallWAD(JNIEnv* env,
jobject obj, jclass,
jstring jFile) jstring jFile)
{ {
const std::string path = GetJString(env, jFile); const std::string path = GetJString(env, jFile);
@ -611,7 +588,7 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallW
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ConvertDiscImage( JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ConvertDiscImage(
JNIEnv* env, jobject obj, jstring jInPath, jstring jOutPath, jint jPlatform, jint jFormat, JNIEnv* env, jclass, jstring jInPath, jstring jOutPath, jint jPlatform, jint jFormat,
jint jBlockSize, jint jCompression, jint jCompressionLevel, jboolean jScrub, jobject jCallback) jint jBlockSize, jint jCompression, jint jCompressionLevel, jboolean jScrub, jobject jCallback)
{ {
const std::string in_path = GetJString(env, jInPath); const std::string in_path = GetJString(env, jInPath);
@ -670,46 +647,46 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ConvertD
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_FormatSize(JNIEnv* env, JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_FormatSize(JNIEnv* env,
jobject obj, jclass,
jlong bytes, jlong bytes,
jint decimals) jint decimals)
{ {
return ToJString(env, UICommon::FormatSize(bytes, decimals)); return ToJString(env, UICommon::FormatSize(bytes, decimals));
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetObscuredPixelsLeft( JNIEXPORT void JNICALL
JNIEnv* env, jobject obj, jint width) Java_org_dolphinemu_dolphinemu_NativeLibrary_SetObscuredPixelsLeft(JNIEnv*, jclass, jint width)
{ {
OSD::SetObscuredPixelsLeft(width); OSD::SetObscuredPixelsLeft(width);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetObscuredPixelsTop( JNIEXPORT void JNICALL
JNIEnv* env, jobject obj, jint height) Java_org_dolphinemu_dolphinemu_NativeLibrary_SetObscuredPixelsTop(JNIEnv*, jclass, jint height)
{ {
OSD::SetObscuredPixelsTop(height); OSD::SetObscuredPixelsTop(height);
} }
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsGameMetadataValid(JNIEnv*,
Java_org_dolphinemu_dolphinemu_NativeLibrary_IsGameMetadataValid(JNIEnv* env, jobject obj) jclass)
{ {
return s_game_metadata_is_valid; return s_game_metadata_is_valid;
} }
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_IsEmulatingWiiUnchecked(JNIEnv* env, jobject obj) Java_org_dolphinemu_dolphinemu_NativeLibrary_IsEmulatingWiiUnchecked(JNIEnv*, jclass)
{ {
return SConfig::GetInstance().bWii; return SConfig::GetInstance().bWii;
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentGameIDUnchecked(JNIEnv* env, jobject obj) Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentGameIDUnchecked(JNIEnv* env, jclass)
{ {
return ToJString(env, SConfig::GetInstance().GetGameID()); return ToJString(env, SConfig::GetInstance().GetGameID());
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentTitleDescriptionUnchecked(JNIEnv* env, Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentTitleDescriptionUnchecked(JNIEnv* env,
jobject obj) jclass)
{ {
// Prefer showing just the name. If no name is available, show just the game ID. // Prefer showing just the name. If no name is available, show just the game ID.
std::string description = SConfig::GetInstance().GetTitleName(); std::string description = SConfig::GetInstance().GetTitleName();

View File

@ -95,7 +95,7 @@ extern "C" {
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isSettingSaveable( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isSettingSaveable(
JNIEnv* env, jclass obj, jstring file, jstring section, jstring key) JNIEnv* env, jclass, jstring file, jstring section, jstring key)
{ {
const Config::Location location = GetLocation(env, file, section, key); const Config::Location location = GetLocation(env, file, section, key);
return static_cast<jboolean>(ConfigLoaders::IsSettingSaveable(location)); return static_cast<jboolean>(ConfigLoaders::IsSettingSaveable(location));
@ -103,7 +103,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isSettingSav
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_loadGameInis(JNIEnv* env, Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_loadGameInis(JNIEnv* env,
jclass obj, jclass,
jstring jGameId, jstring jGameId,
jint jRevision) jint jRevision)
{ {
@ -114,22 +114,21 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_loadGameInis
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_unloadGameInis(JNIEnv* env, Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_unloadGameInis(JNIEnv*, jclass)
jclass obj)
{ {
Config::RemoveLayer(Config::LayerType::GlobalGame); Config::RemoveLayer(Config::LayerType::GlobalGame);
Config::RemoveLayer(Config::LayerType::LocalGame); Config::RemoveLayer(Config::LayerType::LocalGame);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_save( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_save(
JNIEnv* env, jclass obj, jint layer) JNIEnv*, jclass, jint layer)
{ {
return GetLayer(layer, {})->Save(); return GetLayer(layer, {})->Save();
} }
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isOverridden( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isOverridden(
JNIEnv* env, jclass obj, jstring file, jstring section, jstring key) JNIEnv* env, jclass, jstring file, jstring section, jstring key)
{ {
const Config::Location location = GetLocation(env, file, section, key); const Config::Location location = GetLocation(env, file, section, key);
const bool result = Config::GetActiveLayerForConfig(location) != Config::LayerType::Base; const bool result = Config::GetActiveLayerForConfig(location) != Config::LayerType::Base;
@ -138,7 +137,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_isOverridden
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteKey( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteKey(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key) JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key)
{ {
const Config::Location location = GetLocation(env, file, section, key); const Config::Location location = GetLocation(env, file, section, key);
return static_cast<jboolean>(GetLayer(layer, location)->DeleteKey(location)); return static_cast<jboolean>(GetLayer(layer, location)->DeleteKey(location));
@ -146,7 +145,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_deleteKey(
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getString( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getString(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key,
jstring default_value) jstring default_value)
{ {
const Config::Location location = GetLocation(env, file, section, key); const Config::Location location = GetLocation(env, file, section, key);
@ -155,7 +154,7 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getString(
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getBoolean( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getBoolean(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key,
jboolean default_value) jboolean default_value)
{ {
const Config::Location location = GetLocation(env, file, section, key); const Config::Location location = GetLocation(env, file, section, key);
@ -163,15 +162,14 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getBoolean(
} }
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getInt( JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getInt(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jint default_value)
jint default_value)
{ {
return Get(layer, GetLocation(env, file, section, key), default_value); return Get(layer, GetLocation(env, file, section, key), default_value);
} }
JNIEXPORT jfloat JNICALL JNIEXPORT jfloat JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getFloat( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getFloat(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key,
jfloat default_value) jfloat default_value)
{ {
return Get(layer, GetLocation(env, file, section, key), default_value); return Get(layer, GetLocation(env, file, section, key), default_value);
@ -179,26 +177,26 @@ Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_getFloat(
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setString( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setString(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, jstring value) JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jstring value)
{ {
return Set(layer, GetLocation(env, file, section, key), GetJString(env, value)); return Set(layer, GetLocation(env, file, section, key), GetJString(env, value));
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setBoolean( Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setBoolean(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, jboolean value) JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jboolean value)
{ {
return Set(layer, GetLocation(env, file, section, key), static_cast<bool>(value)); return Set(layer, GetLocation(env, file, section, key), static_cast<bool>(value));
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setInt( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setInt(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, jint value) JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jint value)
{ {
return Set(layer, GetLocation(env, file, section, key), value); return Set(layer, GetLocation(env, file, section, key), value);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setFloat( JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_features_settings_model_NativeConfig_setFloat(
JNIEnv* env, jclass obj, jint layer, jstring file, jstring section, jstring key, jfloat value) JNIEnv* env, jclass, jint layer, jstring file, jstring section, jstring key, jfloat value)
{ {
return Set(layer, GetLocation(env, file, section, key), value); return Set(layer, GetLocation(env, file, section, key), value);
} }