Android: Add Hashmap to IDCache
This commit is contained in:
parent
f8abc2c0e6
commit
cf3e8714eb
|
@ -32,6 +32,10 @@ static jclass s_linked_hash_map_class;
|
||||||
static jmethodID s_linked_hash_map_init;
|
static jmethodID s_linked_hash_map_init;
|
||||||
static jmethodID s_linked_hash_map_put;
|
static jmethodID s_linked_hash_map_put;
|
||||||
|
|
||||||
|
static jclass s_hash_map_class;
|
||||||
|
static jmethodID s_hash_map_init;
|
||||||
|
static jmethodID s_hash_map_put;
|
||||||
|
|
||||||
static jclass s_ini_file_class;
|
static jclass s_ini_file_class;
|
||||||
static jfieldID s_ini_file_pointer;
|
static jfieldID s_ini_file_pointer;
|
||||||
static jclass s_ini_file_section_class;
|
static jclass s_ini_file_section_class;
|
||||||
|
@ -221,6 +225,21 @@ jmethodID GetLinkedHashMapPut()
|
||||||
return s_linked_hash_map_put;
|
return s_linked_hash_map_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jclass GetHashMapClass()
|
||||||
|
{
|
||||||
|
return s_hash_map_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
jmethodID GetHashMapInit()
|
||||||
|
{
|
||||||
|
return s_hash_map_init;
|
||||||
|
}
|
||||||
|
|
||||||
|
jmethodID GetHashMapPut()
|
||||||
|
{
|
||||||
|
return s_hash_map_put;
|
||||||
|
}
|
||||||
|
|
||||||
jclass GetIniFileClass()
|
jclass GetIniFileClass()
|
||||||
{
|
{
|
||||||
return s_ini_file_class;
|
return s_ini_file_class;
|
||||||
|
@ -575,12 +594,19 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||||
ini_file_section_class, "<init>", "(Lorg/dolphinemu/dolphinemu/utils/IniFile;J)V");
|
ini_file_section_class, "<init>", "(Lorg/dolphinemu/dolphinemu/utils/IniFile;J)V");
|
||||||
env->DeleteLocalRef(ini_file_section_class);
|
env->DeleteLocalRef(ini_file_section_class);
|
||||||
|
|
||||||
const jclass map_class = env->FindClass("java/util/LinkedHashMap");
|
const jclass linked_hash_map_class = env->FindClass("java/util/LinkedHashMap");
|
||||||
s_linked_hash_map_class = reinterpret_cast<jclass>(env->NewGlobalRef(map_class));
|
s_linked_hash_map_class = reinterpret_cast<jclass>(env->NewGlobalRef(linked_hash_map_class));
|
||||||
s_linked_hash_map_init = env->GetMethodID(s_linked_hash_map_class, "<init>", "(I)V");
|
s_linked_hash_map_init = env->GetMethodID(s_linked_hash_map_class, "<init>", "(I)V");
|
||||||
s_linked_hash_map_put = env->GetMethodID(
|
s_linked_hash_map_put = env->GetMethodID(
|
||||||
s_linked_hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
s_linked_hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||||
env->DeleteLocalRef(map_class);
|
env->DeleteLocalRef(linked_hash_map_class);
|
||||||
|
|
||||||
|
const jclass hash_map_class = env->FindClass("java/util/HashMap");
|
||||||
|
s_hash_map_class = reinterpret_cast<jclass>(env->NewGlobalRef(hash_map_class));
|
||||||
|
s_hash_map_init = env->GetMethodID(s_hash_map_class, "<init>", "(I)V");
|
||||||
|
s_hash_map_put = env->GetMethodID(s_hash_map_class, "put",
|
||||||
|
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
||||||
|
env->DeleteLocalRef(hash_map_class);
|
||||||
|
|
||||||
const jclass compress_cb_class =
|
const jclass compress_cb_class =
|
||||||
env->FindClass("org/dolphinemu/dolphinemu/utils/CompressCallback");
|
env->FindClass("org/dolphinemu/dolphinemu/utils/CompressCallback");
|
||||||
|
@ -741,6 +767,7 @@ JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved)
|
||||||
env->DeleteGlobalRef(s_game_file_cache_class);
|
env->DeleteGlobalRef(s_game_file_cache_class);
|
||||||
env->DeleteGlobalRef(s_analytics_class);
|
env->DeleteGlobalRef(s_analytics_class);
|
||||||
env->DeleteGlobalRef(s_linked_hash_map_class);
|
env->DeleteGlobalRef(s_linked_hash_map_class);
|
||||||
|
env->DeleteGlobalRef(s_hash_map_class);
|
||||||
env->DeleteGlobalRef(s_ini_file_class);
|
env->DeleteGlobalRef(s_ini_file_class);
|
||||||
env->DeleteGlobalRef(s_ini_file_section_class);
|
env->DeleteGlobalRef(s_ini_file_section_class);
|
||||||
env->DeleteGlobalRef(s_compress_cb_class);
|
env->DeleteGlobalRef(s_compress_cb_class);
|
||||||
|
|
|
@ -32,6 +32,10 @@ jclass GetLinkedHashMapClass();
|
||||||
jmethodID GetLinkedHashMapInit();
|
jmethodID GetLinkedHashMapInit();
|
||||||
jmethodID GetLinkedHashMapPut();
|
jmethodID GetLinkedHashMapPut();
|
||||||
|
|
||||||
|
jclass GetHashMapClass();
|
||||||
|
jmethodID GetHashMapInit();
|
||||||
|
jmethodID GetHashMapPut();
|
||||||
|
|
||||||
jclass GetIniFileClass();
|
jclass GetIniFileClass();
|
||||||
jfieldID GetIniFilePointer();
|
jfieldID GetIniFilePointer();
|
||||||
jclass GetIniFileSectionClass();
|
jclass GetIniFileSectionClass();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "AndroidCommon/AndroidCommon.h"
|
#include "AndroidCommon/AndroidCommon.h"
|
||||||
|
#include "AndroidCommon/IDCache.h"
|
||||||
#include "Core/IOS/USB/Emulated/Infinity.h"
|
#include "Core/IOS/USB/Emulated/Infinity.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
|
@ -20,9 +21,6 @@ Java_org_dolphinemu_dolphinemu_features_infinitybase_InfinityConfig_getFigureMap
|
||||||
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
||||||
system.GetInfinityBase().GetFigureList().size());
|
system.GetInfinityBase().GetFigureList().size());
|
||||||
|
|
||||||
jmethodID hash_map_put = env->GetMethodID(
|
|
||||||
hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
|
||||||
|
|
||||||
jclass long_class = env->FindClass("java/lang/Long");
|
jclass long_class = env->FindClass("java/lang/Long");
|
||||||
jmethodID long_init = env->GetMethodID(long_class, "<init>", "(J)V");
|
jmethodID long_init = env->GetMethodID(long_class, "<init>", "(J)V");
|
||||||
|
|
||||||
|
@ -47,9 +45,6 @@ Java_org_dolphinemu_dolphinemu_features_infinitybase_InfinityConfig_getInverseFi
|
||||||
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
||||||
system.GetInfinityBase().GetFigureList().size());
|
system.GetInfinityBase().GetFigureList().size());
|
||||||
|
|
||||||
jmethodID hash_map_put = env->GetMethodID(
|
|
||||||
hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
|
||||||
|
|
||||||
jclass long_class = env->FindClass("java/lang/Long");
|
jclass long_class = env->FindClass("java/lang/Long");
|
||||||
jmethodID long_init = env->GetMethodID(long_class, "<init>", "(J)V");
|
jmethodID long_init = env->GetMethodID(long_class, "<init>", "(J)V");
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "AndroidCommon/AndroidCommon.h"
|
#include "AndroidCommon/AndroidCommon.h"
|
||||||
|
#include "AndroidCommon/IDCache.h"
|
||||||
#include "Core/IOS/USB/Emulated/Skylander.h"
|
#include "Core/IOS/USB/Emulated/Skylander.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
|
@ -15,12 +16,8 @@ JNIEXPORT jobject JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getSkylanderMap(JNIEnv* env,
|
Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getSkylanderMap(JNIEnv* env,
|
||||||
jclass clazz)
|
jclass clazz)
|
||||||
{
|
{
|
||||||
jclass hash_map_class = env->FindClass("java/util/HashMap");
|
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
||||||
jmethodID hash_map_init = env->GetMethodID(hash_map_class, "<init>", "(I)V");
|
|
||||||
jobject hash_map_obj = env->NewObject(hash_map_class, hash_map_init,
|
|
||||||
static_cast<u16>(IOS::HLE::USB::list_skylanders.size()));
|
static_cast<u16>(IOS::HLE::USB::list_skylanders.size()));
|
||||||
jmethodID hash_map_put = env->GetMethodID(
|
|
||||||
hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
|
||||||
|
|
||||||
jclass skylander_class =
|
jclass skylander_class =
|
||||||
env->FindClass("org/dolphinemu/dolphinemu/features/skylanders/model/SkylanderPair");
|
env->FindClass("org/dolphinemu/dolphinemu/features/skylanders/model/SkylanderPair");
|
||||||
|
@ -32,7 +29,8 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getSkylanderM
|
||||||
const std::string& name = it.second;
|
const std::string& name = it.second;
|
||||||
jobject skylander_obj =
|
jobject skylander_obj =
|
||||||
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
||||||
env->CallObjectMethod(hash_map_obj, hash_map_put, skylander_obj, ToJString(env, name));
|
env->CallObjectMethod(hash_map_obj, IDCache::GetHashMapPut(), skylander_obj,
|
||||||
|
ToJString(env, name));
|
||||||
env->DeleteLocalRef(skylander_obj);
|
env->DeleteLocalRef(skylander_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,12 +41,8 @@ JNIEXPORT jobject JNICALL
|
||||||
Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getInverseSkylanderMap(
|
Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getInverseSkylanderMap(
|
||||||
JNIEnv* env, jclass clazz)
|
JNIEnv* env, jclass clazz)
|
||||||
{
|
{
|
||||||
jclass hash_map_class = env->FindClass("java/util/HashMap");
|
jobject hash_map_obj = env->NewObject(IDCache::GetHashMapClass(), IDCache::GetHashMapInit(),
|
||||||
jmethodID hash_map_init = env->GetMethodID(hash_map_class, "<init>", "(I)V");
|
|
||||||
jobject hash_map_obj = env->NewObject(hash_map_class, hash_map_init,
|
|
||||||
static_cast<u16>(IOS::HLE::USB::list_skylanders.size()));
|
static_cast<u16>(IOS::HLE::USB::list_skylanders.size()));
|
||||||
jmethodID hash_map_put = env->GetMethodID(
|
|
||||||
hash_map_class, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
|
||||||
|
|
||||||
jclass skylander_class =
|
jclass skylander_class =
|
||||||
env->FindClass("org/dolphinemu/dolphinemu/features/skylanders/model/SkylanderPair");
|
env->FindClass("org/dolphinemu/dolphinemu/features/skylanders/model/SkylanderPair");
|
||||||
|
@ -60,7 +54,8 @@ Java_org_dolphinemu_dolphinemu_features_skylanders_SkylanderConfig_getInverseSky
|
||||||
const std::string& name = it.second;
|
const std::string& name = it.second;
|
||||||
jobject skylander_obj =
|
jobject skylander_obj =
|
||||||
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
env->NewObject(skylander_class, skylander_init, it.first.first, it.first.second);
|
||||||
env->CallObjectMethod(hash_map_obj, hash_map_put, ToJString(env, name), skylander_obj);
|
env->CallObjectMethod(hash_map_obj, IDCache::GetHashMapPut(), ToJString(env, name),
|
||||||
|
skylander_obj);
|
||||||
env->DeleteLocalRef(skylander_obj);
|
env->DeleteLocalRef(skylander_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue