getGameVersion android but commented out

This commit is contained in:
qimiko 2024-01-12 19:15:53 -07:00
parent 21caf514c2
commit 9661693e72
No known key found for this signature in database
GPG key ID: D2D404DD810FE0E3

View file

@ -9,6 +9,7 @@ using namespace geode::prelude;
#ifdef GEODE_IS_ANDROID
#include <Geode/cocos/platform/android/jni/JniHelper.h>
#include <android/log.h>
namespace {
@ -25,7 +26,25 @@ namespace {
std::string Loader::Impl::getGameVersion() {
if (m_gdVersion.empty()) {
// TODO: detect gd version
/*
// before uncommenting please note:
// getGameVersion can only run after JNI_OnLoad is called. otherwise it crashes
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "getGameVersion", "()Ljava/lang/String;")) {
jstring str = reinterpret_cast<jstring>(t.env->CallStaticObjectMethod(t.classID, t.methodID));
t.env->DeleteLocalRef(t.classID);
m_gdVersion = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(str);
} else {
auto vm = JniHelper::getJavaVM();
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) == JNI_OK) {
env->ExceptionClear();
}
}
*/
}
return m_gdVersion;
}