mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
Android: Convert some files to LF
I wonder why lint didn't catch this...
This commit is contained in:
parent
0dbe8fb2ea
commit
c89828b22e
@ -1,39 +1,39 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
std::string GetJString(JNIEnv* env, jstring jstr)
|
std::string GetJString(JNIEnv* env, jstring jstr)
|
||||||
{
|
{
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (!jstr)
|
if (!jstr)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
const char* s = env->GetStringUTFChars(jstr, nullptr);
|
const char* s = env->GetStringUTFChars(jstr, nullptr);
|
||||||
result = s;
|
result = s;
|
||||||
env->ReleaseStringUTFChars(jstr, s);
|
env->ReleaseStringUTFChars(jstr, s);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring ToJString(JNIEnv* env, const std::string& str)
|
jstring ToJString(JNIEnv* env, const std::string& str)
|
||||||
{
|
{
|
||||||
return env->NewStringUTF(str.c_str());
|
return env->NewStringUTF(str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array)
|
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array)
|
||||||
{
|
{
|
||||||
const jsize size = env->GetArrayLength(array);
|
const jsize size = env->GetArrayLength(array);
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
result.reserve(size);
|
result.reserve(size);
|
||||||
|
|
||||||
for (jsize i = 0; i < size; ++i)
|
for (jsize i = 0; i < size; ++i)
|
||||||
result.push_back(GetJString(env, (jstring)env->GetObjectArrayElement(array, i)));
|
result.push_back(GetJString(env, (jstring)env->GetObjectArrayElement(array, i)));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
std::string GetJString(JNIEnv* env, jstring jstr);
|
std::string GetJString(JNIEnv* env, jstring jstr);
|
||||||
jstring ToJString(JNIEnv* env, const std::string& str);
|
jstring ToJString(JNIEnv* env, const std::string& str);
|
||||||
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
|
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
|
||||||
|
@ -1,170 +1,170 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "jni/AndroidCommon/IDCache.h"
|
#include "jni/AndroidCommon/IDCache.h"
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
|
static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
|
||||||
|
|
||||||
static JavaVM* s_java_vm;
|
static JavaVM* s_java_vm;
|
||||||
|
|
||||||
static jclass s_native_library_class;
|
static jclass s_native_library_class;
|
||||||
static jmethodID s_display_alert_msg;
|
static jmethodID s_display_alert_msg;
|
||||||
static jmethodID s_get_update_touch_pointer;
|
static jmethodID s_get_update_touch_pointer;
|
||||||
|
|
||||||
static jclass s_game_file_class;
|
static jclass s_game_file_class;
|
||||||
static jfieldID s_game_file_pointer;
|
static jfieldID s_game_file_pointer;
|
||||||
static jmethodID s_game_file_constructor;
|
static jmethodID s_game_file_constructor;
|
||||||
|
|
||||||
static jclass s_game_file_cache_class;
|
static jclass s_game_file_cache_class;
|
||||||
static jfieldID s_game_file_cache_pointer;
|
static jfieldID s_game_file_cache_pointer;
|
||||||
|
|
||||||
static jclass s_analytics_class;
|
static jclass s_analytics_class;
|
||||||
static jmethodID s_send_analytics_report;
|
static jmethodID s_send_analytics_report;
|
||||||
static jmethodID s_get_analytics_value;
|
static jmethodID s_get_analytics_value;
|
||||||
|
|
||||||
static jmethodID s_do_rumble;
|
static jmethodID s_do_rumble;
|
||||||
|
|
||||||
namespace IDCache
|
namespace IDCache
|
||||||
{
|
{
|
||||||
JNIEnv* GetEnvForThread()
|
JNIEnv* GetEnvForThread()
|
||||||
{
|
{
|
||||||
thread_local static struct OwnedEnv
|
thread_local static struct OwnedEnv
|
||||||
{
|
{
|
||||||
OwnedEnv()
|
OwnedEnv()
|
||||||
{
|
{
|
||||||
status = s_java_vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
|
status = s_java_vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
|
||||||
if (status == JNI_EDETACHED)
|
if (status == JNI_EDETACHED)
|
||||||
s_java_vm->AttachCurrentThread(&env, nullptr);
|
s_java_vm->AttachCurrentThread(&env, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
~OwnedEnv()
|
~OwnedEnv()
|
||||||
{
|
{
|
||||||
if (status == JNI_EDETACHED)
|
if (status == JNI_EDETACHED)
|
||||||
s_java_vm->DetachCurrentThread();
|
s_java_vm->DetachCurrentThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
JNIEnv* env = nullptr;
|
JNIEnv* env = nullptr;
|
||||||
} owned;
|
} owned;
|
||||||
return owned.env;
|
return owned.env;
|
||||||
}
|
}
|
||||||
|
|
||||||
jclass GetNativeLibraryClass()
|
jclass GetNativeLibraryClass()
|
||||||
{
|
{
|
||||||
return s_native_library_class;
|
return s_native_library_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetDisplayAlertMsg()
|
jmethodID GetDisplayAlertMsg()
|
||||||
{
|
{
|
||||||
return s_display_alert_msg;
|
return s_display_alert_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetUpdateTouchPointer()
|
jmethodID GetUpdateTouchPointer()
|
||||||
{
|
{
|
||||||
return s_get_update_touch_pointer;
|
return s_get_update_touch_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
jclass GetAnalyticsClass()
|
jclass GetAnalyticsClass()
|
||||||
{
|
{
|
||||||
return s_analytics_class;
|
return s_analytics_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetSendAnalyticsReport()
|
jmethodID GetSendAnalyticsReport()
|
||||||
{
|
{
|
||||||
return s_send_analytics_report;
|
return s_send_analytics_report;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetAnalyticsValue()
|
jmethodID GetAnalyticsValue()
|
||||||
{
|
{
|
||||||
return s_get_analytics_value;
|
return s_get_analytics_value;
|
||||||
}
|
}
|
||||||
jclass GetGameFileClass()
|
jclass GetGameFileClass()
|
||||||
{
|
{
|
||||||
return s_game_file_class;
|
return s_game_file_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
jfieldID GetGameFilePointer()
|
jfieldID GetGameFilePointer()
|
||||||
{
|
{
|
||||||
return s_game_file_pointer;
|
return s_game_file_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetGameFileConstructor()
|
jmethodID GetGameFileConstructor()
|
||||||
{
|
{
|
||||||
return s_game_file_constructor;
|
return s_game_file_constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
jclass GetGameFileCacheClass()
|
jclass GetGameFileCacheClass()
|
||||||
{
|
{
|
||||||
return s_game_file_cache_class;
|
return s_game_file_cache_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
jfieldID GetGameFileCachePointer()
|
jfieldID GetGameFileCachePointer()
|
||||||
{
|
{
|
||||||
return s_game_file_cache_pointer;
|
return s_game_file_cache_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
jmethodID GetDoRumble()
|
jmethodID GetDoRumble()
|
||||||
{
|
{
|
||||||
return s_do_rumble;
|
return s_do_rumble;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace IDCache
|
} // namespace IDCache
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||||
{
|
{
|
||||||
s_java_vm = vm;
|
s_java_vm = vm;
|
||||||
|
|
||||||
JNIEnv* env;
|
JNIEnv* env;
|
||||||
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK)
|
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK)
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
|
|
||||||
const jclass native_library_class = env->FindClass("org/dolphinemu/dolphinemu/NativeLibrary");
|
const jclass native_library_class = env->FindClass("org/dolphinemu/dolphinemu/NativeLibrary");
|
||||||
s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class));
|
s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class));
|
||||||
s_display_alert_msg = env->GetStaticMethodID(s_native_library_class, "displayAlertMsg",
|
s_display_alert_msg = env->GetStaticMethodID(s_native_library_class, "displayAlertMsg",
|
||||||
"(Ljava/lang/String;Ljava/lang/String;Z)Z");
|
"(Ljava/lang/String;Ljava/lang/String;Z)Z");
|
||||||
s_do_rumble = env->GetStaticMethodID(s_native_library_class, "rumble", "(ID)V");
|
s_do_rumble = env->GetStaticMethodID(s_native_library_class, "rumble", "(ID)V");
|
||||||
s_get_update_touch_pointer =
|
s_get_update_touch_pointer =
|
||||||
env->GetStaticMethodID(s_native_library_class, "updateTouchPointer", "()V");
|
env->GetStaticMethodID(s_native_library_class, "updateTouchPointer", "()V");
|
||||||
|
|
||||||
const jclass game_file_class = env->FindClass("org/dolphinemu/dolphinemu/model/GameFile");
|
const jclass game_file_class = env->FindClass("org/dolphinemu/dolphinemu/model/GameFile");
|
||||||
s_game_file_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_file_class));
|
s_game_file_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_file_class));
|
||||||
s_game_file_pointer = env->GetFieldID(game_file_class, "mPointer", "J");
|
s_game_file_pointer = env->GetFieldID(game_file_class, "mPointer", "J");
|
||||||
s_game_file_constructor = env->GetMethodID(game_file_class, "<init>", "(J)V");
|
s_game_file_constructor = env->GetMethodID(game_file_class, "<init>", "(J)V");
|
||||||
|
|
||||||
const jclass game_file_cache_class =
|
const jclass game_file_cache_class =
|
||||||
env->FindClass("org/dolphinemu/dolphinemu/model/GameFileCache");
|
env->FindClass("org/dolphinemu/dolphinemu/model/GameFileCache");
|
||||||
s_game_file_cache_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_file_cache_class));
|
s_game_file_cache_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_file_cache_class));
|
||||||
s_game_file_cache_pointer = env->GetFieldID(game_file_cache_class, "mPointer", "J");
|
s_game_file_cache_pointer = env->GetFieldID(game_file_cache_class, "mPointer", "J");
|
||||||
|
|
||||||
const jclass analytics_class = env->FindClass("org/dolphinemu/dolphinemu/utils/Analytics");
|
const jclass analytics_class = env->FindClass("org/dolphinemu/dolphinemu/utils/Analytics");
|
||||||
s_analytics_class = reinterpret_cast<jclass>(env->NewGlobalRef(analytics_class));
|
s_analytics_class = reinterpret_cast<jclass>(env->NewGlobalRef(analytics_class));
|
||||||
s_send_analytics_report =
|
s_send_analytics_report =
|
||||||
env->GetStaticMethodID(s_analytics_class, "sendReport", "(Ljava/lang/String;[B)V");
|
env->GetStaticMethodID(s_analytics_class, "sendReport", "(Ljava/lang/String;[B)V");
|
||||||
s_get_analytics_value = env->GetStaticMethodID(s_analytics_class, "getValue",
|
s_get_analytics_value = env->GetStaticMethodID(s_analytics_class, "getValue",
|
||||||
"(Ljava/lang/String;)Ljava/lang/String;");
|
"(Ljava/lang/String;)Ljava/lang/String;");
|
||||||
|
|
||||||
return JNI_VERSION;
|
return JNI_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JNI_OnUnload(JavaVM* vm, void* reserved)
|
void JNI_OnUnload(JavaVM* vm, void* reserved)
|
||||||
{
|
{
|
||||||
JNIEnv* env;
|
JNIEnv* env;
|
||||||
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK)
|
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION) != JNI_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
env->DeleteGlobalRef(s_native_library_class);
|
env->DeleteGlobalRef(s_native_library_class);
|
||||||
env->DeleteGlobalRef(s_game_file_class);
|
env->DeleteGlobalRef(s_game_file_class);
|
||||||
env->DeleteGlobalRef(s_game_file_cache_class);
|
env->DeleteGlobalRef(s_game_file_cache_class);
|
||||||
env->DeleteGlobalRef(s_analytics_class);
|
env->DeleteGlobalRef(s_analytics_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
namespace IDCache
|
namespace IDCache
|
||||||
{
|
{
|
||||||
static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
|
static constexpr jint JNI_VERSION = JNI_VERSION_1_6;
|
||||||
|
|
||||||
JNIEnv* GetEnvForThread();
|
JNIEnv* GetEnvForThread();
|
||||||
|
|
||||||
jclass GetNativeLibraryClass();
|
jclass GetNativeLibraryClass();
|
||||||
jmethodID GetDisplayAlertMsg();
|
jmethodID GetDisplayAlertMsg();
|
||||||
jmethodID GetDoRumble();
|
jmethodID GetDoRumble();
|
||||||
jmethodID GetUpdateTouchPointer();
|
jmethodID GetUpdateTouchPointer();
|
||||||
|
|
||||||
jclass GetAnalyticsClass();
|
jclass GetAnalyticsClass();
|
||||||
jmethodID GetSendAnalyticsReport();
|
jmethodID GetSendAnalyticsReport();
|
||||||
jmethodID GetAnalyticsValue();
|
jmethodID GetAnalyticsValue();
|
||||||
|
|
||||||
jclass GetGameFileClass();
|
jclass GetGameFileClass();
|
||||||
jfieldID GetGameFilePointer();
|
jfieldID GetGameFilePointer();
|
||||||
jmethodID GetGameFileConstructor();
|
jmethodID GetGameFileConstructor();
|
||||||
|
|
||||||
jclass GetGameFileCacheClass();
|
jclass GetGameFileCacheClass();
|
||||||
jfieldID GetGameFileCachePointer();
|
jfieldID GetGameFileCachePointer();
|
||||||
|
|
||||||
} // namespace IDCache
|
} // namespace IDCache
|
||||||
|
@ -1,224 +1,224 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "jni/GameList/GameFile.h"
|
#include "jni/GameList/GameFile.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include "DiscIO/Blob.h"
|
#include "DiscIO/Blob.h"
|
||||||
#include "DiscIO/Enums.h"
|
#include "DiscIO/Enums.h"
|
||||||
#include "UICommon/GameFile.h"
|
#include "UICommon/GameFile.h"
|
||||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||||
#include "jni/AndroidCommon/IDCache.h"
|
#include "jni/AndroidCommon/IDCache.h"
|
||||||
|
|
||||||
static std::shared_ptr<const UICommon::GameFile>* GetPointer(JNIEnv* env, jobject obj)
|
static std::shared_ptr<const UICommon::GameFile>* GetPointer(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<std::shared_ptr<const UICommon::GameFile>*>(
|
return reinterpret_cast<std::shared_ptr<const UICommon::GameFile>*>(
|
||||||
env->GetLongField(obj, IDCache::GetGameFilePointer()));
|
env->GetLongField(obj, IDCache::GetGameFilePointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::shared_ptr<const UICommon::GameFile>& GetRef(JNIEnv* env, jobject obj)
|
static std::shared_ptr<const UICommon::GameFile>& GetRef(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return *GetPointer(env, obj);
|
return *GetPointer(env, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
jobject GameFileToJava(JNIEnv* env, std::shared_ptr<const UICommon::GameFile> game_file)
|
jobject GameFileToJava(JNIEnv* env, std::shared_ptr<const UICommon::GameFile> game_file)
|
||||||
{
|
{
|
||||||
if (!game_file)
|
if (!game_file)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return env->NewObject(
|
return env->NewObject(
|
||||||
IDCache::GetGameFileClass(), IDCache::GetGameFileConstructor(),
|
IDCache::GetGameFileClass(), IDCache::GetGameFileConstructor(),
|
||||||
reinterpret_cast<jlong>(new std::shared_ptr<const UICommon::GameFile>(std::move(game_file))));
|
reinterpret_cast<jlong>(new std::shared_ptr<const UICommon::GameFile>(std::move(game_file))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_finalize(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_finalize(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPlatform(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPlatform(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getTitle(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getTitle(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDescription(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDescription(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCompany(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCompany(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCountry(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCountry(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRegion(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRegion(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPath(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPath(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameId(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameId(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDiscNumber(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDiscNumber(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
|
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerWidth(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerWidth(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerHeight(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerHeight(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_finalize(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_finalize(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
delete GetPointer(env, obj);
|
delete GetPointer(env, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPlatform(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPlatform(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return static_cast<jint>(GetRef(env, obj)->GetPlatform());
|
return static_cast<jint>(GetRef(env, obj)->GetPlatform());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getTitle(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getTitle(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env,
|
return ToJString(env,
|
||||||
GetRef(env, obj)->GetName(UICommon::GameFile::Variant::LongAndPossiblyCustom));
|
GetRef(env, obj)->GetName(UICommon::GameFile::Variant::LongAndPossiblyCustom));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDescription(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDescription(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(
|
return ToJString(
|
||||||
env, GetRef(env, obj)->GetDescription(UICommon::GameFile::Variant::LongAndPossiblyCustom));
|
env, GetRef(env, obj)->GetDescription(UICommon::GameFile::Variant::LongAndPossiblyCustom));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCompany(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCompany(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, DiscIO::GetCompanyFromID(GetRef(env, obj)->GetMakerID()));
|
return ToJString(env, DiscIO::GetCompanyFromID(GetRef(env, obj)->GetMakerID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCountry(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getCountry(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return static_cast<jint>(GetRef(env, obj)->GetCountry());
|
return static_cast<jint>(GetRef(env, obj)->GetCountry());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRegion(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRegion(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return static_cast<jint>(GetRef(env, obj)->GetRegion());
|
return static_cast<jint>(GetRef(env, obj)->GetRegion());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPath(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getPath(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, GetRef(env, obj)->GetFilePath());
|
return ToJString(env, GetRef(env, obj)->GetFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameId(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameId(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, GetRef(env, obj)->GetGameID());
|
return ToJString(env, GetRef(env, obj)->GetGameID());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameTdbId(JNIEnv* env,
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getGameTdbId(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, GetRef(env, obj)->GetGameTDBID());
|
return ToJString(env, GetRef(env, obj)->GetGameTDBID());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDiscNumber(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDiscNumber(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetRef(env, obj)->GetDiscNumber();
|
return GetRef(env, obj)->GetDiscNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetRef(env, obj)->GetRevision();
|
return GetRef(env, obj)->GetRevision();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj)
|
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, DiscIO::GetName(GetRef(env, obj)->GetBlobType(), true));
|
return ToJString(env, DiscIO::GetName(GetRef(env, obj)->GetBlobType(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
|
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetRef(env, obj)->GetBlockSize();
|
return GetRef(env, obj)->GetBlockSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env, jobject obj)
|
Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return ToJString(env, GetRef(env, obj)->GetCompressionMethod());
|
return ToJString(env, GetRef(env, obj)->GetCompressionMethod());
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj)
|
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return GetRef(env, obj)->ShouldShowFileFormatDetails();
|
return GetRef(env, obj)->ShouldShowFileFormatDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetRef(env, obj)->GetFileSize();
|
return GetRef(env, obj)->GetFileSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
const std::vector<u32>& buffer = GetRef(env, obj)->GetBannerImage().buffer;
|
const std::vector<u32>& buffer = GetRef(env, obj)->GetBannerImage().buffer;
|
||||||
const jsize size = static_cast<jsize>(buffer.size());
|
const jsize size = static_cast<jsize>(buffer.size());
|
||||||
const jintArray out_array = env->NewIntArray(size);
|
const jintArray out_array = env->NewIntArray(size);
|
||||||
if (!out_array)
|
if (!out_array)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
env->SetIntArrayRegion(out_array, 0, size, reinterpret_cast<const jint*>(buffer.data()));
|
env->SetIntArrayRegion(out_array, 0, size, reinterpret_cast<const jint*>(buffer.data()));
|
||||||
return out_array;
|
return out_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerWidth(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerWidth(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return static_cast<jint>(GetRef(env, obj)->GetBannerImage().width);
|
return static_cast<jint>(GetRef(env, obj)->GetBannerImage().width);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerHeight(JNIEnv* env,
|
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerHeight(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
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,
|
||||||
jobject obj,
|
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));
|
||||||
if (!game_file->IsValid())
|
if (!game_file->IsValid())
|
||||||
game_file.reset();
|
game_file.reset();
|
||||||
|
|
||||||
return GameFileToJava(env, game_file);
|
return GameFileToJava(env, game_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
namespace UICommon
|
namespace UICommon
|
||||||
{
|
{
|
||||||
class GameFile;
|
class GameFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
jobject GameFileToJava(JNIEnv* env, std::shared_ptr<const UICommon::GameFile> game_file);
|
jobject GameFileToJava(JNIEnv* env, std::shared_ptr<const UICommon::GameFile> game_file);
|
||||||
|
@ -1,122 +1,122 @@
|
|||||||
// Copyright 2018 Dolphin Emulator Project
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
#include "UICommon/GameFileCache.h"
|
#include "UICommon/GameFileCache.h"
|
||||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||||
#include "jni/AndroidCommon/IDCache.h"
|
#include "jni/AndroidCommon/IDCache.h"
|
||||||
#include "jni/GameList/GameFile.h"
|
#include "jni/GameList/GameFile.h"
|
||||||
|
|
||||||
namespace UICommon
|
namespace UICommon
|
||||||
{
|
{
|
||||||
class GameFile;
|
class GameFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UICommon::GameFileCache* GetPointer(JNIEnv* env, jobject obj)
|
static UICommon::GameFileCache* GetPointer(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<UICommon::GameFileCache*>(
|
return reinterpret_cast<UICommon::GameFileCache*>(
|
||||||
env->GetLongField(obj, IDCache::GetGameFileCachePointer()));
|
env->GetLongField(obj, IDCache::GetGameFileCachePointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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, jobject obj, jstring path);
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finalize(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finalize(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGames(JNIEnv* env, jobject obj);
|
Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGames(JNIEnv* env, jobject obj);
|
||||||
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_addOrGet(JNIEnv* env,
|
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_addOrGet(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jstring path);
|
jstring path);
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
||||||
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan);
|
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan);
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_updateAdditionalMetadata(JNIEnv* env,
|
Java_org_dolphinemu_dolphinemu_model_GameFileCache_updateAdditionalMetadata(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_load(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_load(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_save(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_save(JNIEnv* env,
|
||||||
jobject obj);
|
jobject obj);
|
||||||
|
|
||||||
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, jobject obj, jstring path)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<jlong>(new UICommon::GameFileCache(GetJString(env, path)));
|
return reinterpret_cast<jlong>(new UICommon::GameFileCache(GetJString(env, path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finalize(JNIEnv* env,
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_finalize(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
delete GetPointer(env, obj);
|
delete GetPointer(env, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobjectArray JNICALL
|
JNIEXPORT jobjectArray JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGames(JNIEnv* env, jobject obj)
|
Java_org_dolphinemu_dolphinemu_model_GameFileCache_getAllGames(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
const UICommon::GameFileCache* ptr = GetPointer(env, obj);
|
const UICommon::GameFileCache* ptr = GetPointer(env, obj);
|
||||||
const jobjectArray array =
|
const jobjectArray array =
|
||||||
env->NewObjectArray(static_cast<jsize>(ptr->GetSize()), IDCache::GetGameFileClass(), nullptr);
|
env->NewObjectArray(static_cast<jsize>(ptr->GetSize()), IDCache::GetGameFileClass(), nullptr);
|
||||||
jsize i = 0;
|
jsize i = 0;
|
||||||
GetPointer(env, obj)->ForEach([env, array, &i](const auto& game_file) {
|
GetPointer(env, obj)->ForEach([env, array, &i](const auto& game_file) {
|
||||||
env->SetObjectArrayElement(array, i++, GameFileToJava(env, game_file));
|
env->SetObjectArrayElement(array, i++, GameFileToJava(env, game_file));
|
||||||
});
|
});
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_addOrGet(JNIEnv* env,
|
JNIEXPORT jobject JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_addOrGet(JNIEnv* env,
|
||||||
jobject obj,
|
jobject obj,
|
||||||
jstring path)
|
jstring path)
|
||||||
{
|
{
|
||||||
bool cache_changed = false;
|
bool cache_changed = false;
|
||||||
return GameFileToJava(env, GetPointer(env, obj)->AddOrGet(GetJString(env, path), &cache_changed));
|
return GameFileToJava(env, GetPointer(env, obj)->AddOrGet(GetJString(env, path), &cache_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_update(
|
||||||
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan)
|
JNIEnv* env, jobject obj, jobjectArray folder_paths, jboolean recursive_scan)
|
||||||
{
|
{
|
||||||
jsize size = env->GetArrayLength(folder_paths);
|
jsize size = env->GetArrayLength(folder_paths);
|
||||||
|
|
||||||
std::vector<std::string> folder_paths_vector;
|
std::vector<std::string> folder_paths_vector;
|
||||||
folder_paths_vector.reserve(size);
|
folder_paths_vector.reserve(size);
|
||||||
|
|
||||||
for (jsize i = 0; i < size; ++i)
|
for (jsize i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
const jstring path = reinterpret_cast<jstring>(env->GetObjectArrayElement(folder_paths, i));
|
const jstring path = reinterpret_cast<jstring>(env->GetObjectArrayElement(folder_paths, i));
|
||||||
folder_paths_vector.push_back(GetJString(env, path));
|
folder_paths_vector.push_back(GetJString(env, path));
|
||||||
env->DeleteLocalRef(path);
|
env->DeleteLocalRef(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetPointer(env, obj)->Update(
|
return GetPointer(env, obj)->Update(
|
||||||
UICommon::FindAllGamePaths(folder_paths_vector, recursive_scan));
|
UICommon::FindAllGamePaths(folder_paths_vector, recursive_scan));
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_model_GameFileCache_updateAdditionalMetadata(JNIEnv* env,
|
Java_org_dolphinemu_dolphinemu_model_GameFileCache_updateAdditionalMetadata(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetPointer(env, obj)->UpdateAdditionalMetadata();
|
return GetPointer(env, obj)->UpdateAdditionalMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_load(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_load(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetPointer(env, obj)->Load();
|
return GetPointer(env, obj)->Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_save(JNIEnv* env,
|
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFileCache_save(JNIEnv* env,
|
||||||
jobject obj)
|
jobject obj)
|
||||||
{
|
{
|
||||||
return GetPointer(env, obj)->Save();
|
return GetPointer(env, obj)->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user