GraphicsMod.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright 2022 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include <string>
  4. #include <jni.h>
  5. #include "VideoCommon/GraphicsModSystem/Config/GraphicsMod.h"
  6. #include "jni/AndroidCommon/AndroidCommon.h"
  7. #include "jni/AndroidCommon/IDCache.h"
  8. static GraphicsModConfig* GetPointer(JNIEnv* env, jobject obj)
  9. {
  10. return reinterpret_cast<GraphicsModConfig*>(
  11. env->GetLongField(obj, IDCache::GetGraphicsModPointer()));
  12. }
  13. extern "C" {
  14. JNIEXPORT jstring JNICALL
  15. Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsMod_getName(JNIEnv* env, jobject obj)
  16. {
  17. return ToJString(env, GetPointer(env, obj)->m_title);
  18. }
  19. JNIEXPORT jstring JNICALL
  20. Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsMod_getCreator(JNIEnv* env,
  21. jobject obj)
  22. {
  23. return ToJString(env, GetPointer(env, obj)->m_author);
  24. }
  25. JNIEXPORT jstring JNICALL
  26. Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsMod_getNotes(JNIEnv* env, jobject obj)
  27. {
  28. return ToJString(env, GetPointer(env, obj)->m_description);
  29. }
  30. JNIEXPORT jboolean JNICALL
  31. Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsMod_getEnabled(JNIEnv* env,
  32. jobject obj)
  33. {
  34. return static_cast<jboolean>(GetPointer(env, obj)->m_enabled);
  35. }
  36. JNIEXPORT void JNICALL
  37. Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsMod_setEnabledImpl(JNIEnv* env,
  38. jobject obj,
  39. jboolean enabled)
  40. {
  41. GetPointer(env, obj)->m_enabled = static_cast<bool>(enabled);
  42. }
  43. }