Browse Source

added functions to enable access to debug knobs from kotlin side + docs

pull/3265/head
xbzk 1 month ago
parent
commit
324b637e69
  1. 9
      docs/user/AddingDebugKnobs.md
  2. 2
      src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt
  3. 4
      src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt
  4. 4
      src/android/app/src/main/jni/native.cpp

9
docs/user/AddingDebugKnobs.md

@ -38,6 +38,7 @@ Common advantages recap:
Use the `Settings::getDebugKnobAt(u8 i)` function to check if a specific bit is set:
```cpp
//cpp side
#include "common/settings.h"
// Check if bit 0 is set
@ -47,6 +48,14 @@ bool feature_enabled = Settings::getDebugKnobAt(0);
bool another_feature = Settings::getDebugKnobAt(15);
```
```kotlin
//kotlin side
import org.yuzu.yuzu_emu.features.settings.model.Settings
// Check if bit x is set
bool feature_enabled = Settings.getDebugKnobAt(x); //x as integer from 0 to 15
``
The function returns `true` if the specified bit (0-15) is set in the `debug_knobs` value, `false` otherwise.
### Setting Debug Knobs (user side)

2
src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt

@ -200,6 +200,8 @@ object NativeLibrary {
external fun logSettings()
external fun getDebugKnobAt(index: Int): Boolean
/**
* Returns Vulkan driver version / API version / GPU model
*/

4
src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/Settings.kt

@ -33,6 +33,10 @@ object Settings {
fun getPlayerString(player: Int): String =
YuzuApplication.appContext.getString(R.string.preferences_player, player)
fun getDebugKnobAt(index: Int): Boolean {
return org.yuzu.yuzu_emu.NativeLibrary.getDebugKnobAt(index)
}
const val PREF_FIRST_APP_LAUNCH = "FirstApplicationLaunch"
const val PREF_SHOULD_SHOW_DRIVER_WARNING = "ShouldShowDriverWarning"
const val PREF_MEMORY_WARNING_SHOWN = "MemoryWarningShown"

4
src/android/app/src/main/jni/native.cpp

@ -1113,6 +1113,10 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_logSettings(JNIEnv* env, jobject jobj
Settings::LogSettings();
}
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_getDebugKnobAt(JNIEnv* env, jobject jobj, jint index) {
return static_cast<jboolean>(Settings::getDebugKnobAt(static_cast<u8>(index)));
}
void Java_org_yuzu_yuzu_1emu_NativeLibrary_run(JNIEnv* env, jobject jobj, jstring j_path,
jint j_program_index,
jboolean j_frontend_initiated) {

Loading…
Cancel
Save