summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2025-05-01 21:31:21 -0400
committerGitHub <noreply@github.com>2025-05-01 21:31:21 -0400
commit1963305bea7b1d971c9a4c0090d9982d75598be8 (patch)
treef682b49ac35bdf8cc6729c56b81c5cb692271da6 /Source/Android
parent757e6aba46a2d4bdbcbc223903a11a0d90e37496 (diff)
parent7fa92160a27d6f5a93cf0e9048ffa024a0877ed5 (diff)
Merge pull request #13605 from JosJuice/android-cinit-native
Android: Don't call NativeLibrary methods during class init
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt39
1 files changed, 21 insertions, 18 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
index e0aa32e15c..6e2371e7e4 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -1961,7 +1961,7 @@ class SettingsFragmentPresenter(
IntSetting.LOGGER_VERBOSITY,
R.string.log_verbosity,
0,
- logVerbosityEntries, logVerbosityValues
+ getLogVerbosityEntries(), getLogVerbosityValues()
)
)
sl.add(
@@ -1993,7 +1993,7 @@ class SettingsFragmentPresenter(
) { SettingsAdapter.clearLog() })
sl.add(HeaderSetting(context, R.string.log_types, 0))
- for (logType in LOG_TYPE_NAMES) {
+ for (logType in NativeLibrary.GetLogTypeNames()) {
sl.add(LogSwitchSetting(logType.first, logType.second, ""))
}
}
@@ -2543,7 +2543,7 @@ class SettingsFragmentPresenter(
fun setAllLogTypes(value: Boolean) {
val settings = fragmentView.settings
- for (logType in LOG_TYPE_NAMES) {
+ for (logType in NativeLibrary.GetLogTypeNames()) {
AdHocBooleanSetting(
Settings.FILE_LOGGER,
Settings.SECTION_LOGGER_LOGS,
@@ -2604,26 +2604,29 @@ class SettingsFragmentPresenter(
}
companion object {
- private val LOG_TYPE_NAMES = NativeLibrary.GetLogTypeNames()
const val ARG_CONTROLLER_TYPE = "controller_type"
const val ARG_SERIALPORT1_TYPE = "serialport1_type"
// Value obtained from LogLevel in Common/Logging/Log.h
- private val logVerbosityEntries: Int
- get() =
- if (NativeLibrary.GetMaxLogLevel() == 5) {
- R.array.logVerbosityEntriesMaxLevelDebug
- } else {
- R.array.logVerbosityEntriesMaxLevelInfo
- }
+ private fun getLogVerbosityEntries(): Int {
+ // GetMaxLogLevel is effectively a constant, but we can't call it before loading
+ // the native library
+ return if (NativeLibrary.GetMaxLogLevel() == 5) {
+ R.array.logVerbosityEntriesMaxLevelDebug
+ } else {
+ R.array.logVerbosityEntriesMaxLevelInfo
+ }
+ }
// Value obtained from LogLevel in Common/Logging/Log.h
- private val logVerbosityValues: Int
- get() =
- if (NativeLibrary.GetMaxLogLevel() == 5) {
- R.array.logVerbosityValuesMaxLevelDebug
- } else {
- R.array.logVerbosityValuesMaxLevelInfo
- }
+ private fun getLogVerbosityValues(): Int {
+ // GetMaxLogLevel is effectively a constant, but we can't call it before loading
+ // the native library
+ return if (NativeLibrary.GetMaxLogLevel() == 5) {
+ R.array.logVerbosityValuesMaxLevelDebug
+ } else {
+ R.array.logVerbosityValuesMaxLevelInfo
+ }
+ }
}
}