mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 21:34:16 +01:00
Make log level setting changes immediately active
This commit is contained in:
parent
bb4937121f
commit
f734c4d145
@ -237,3 +237,7 @@ extern "C" JNIEXPORT void JNICALL Java_emu_skyline_utils_SettingsValues_updateNa
|
|||||||
return; // We don't mind if we miss settings updates while settings haven't been initialized
|
return; // We don't mind if we miss settings updates while settings haven't been initialized
|
||||||
settings->Update();
|
settings->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL Java_emu_skyline_utils_SettingsValues_00024Companion_setLogLevel(JNIEnv *, jobject, jint logLevel) {
|
||||||
|
skyline::Logger::configLevel = static_cast<skyline::Logger::LogLevel>(logLevel);
|
||||||
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MPL-2.0
|
||||||
|
* Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
*/
|
||||||
|
|
||||||
|
package emu.skyline.preference
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.preference.R
|
||||||
|
import emu.skyline.utils.SettingsValues
|
||||||
|
|
||||||
|
class LogLevelPreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.dialogPreferenceStyle) : IntegerListPreference(context, attrs, defStyleAttr) {
|
||||||
|
init {
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
SettingsValues.setLogLevel(newValue as Int)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,4 +18,11 @@ class SettingsValues(pref: PreferenceSettings) : Serializable {
|
|||||||
* Updates settings in libskyline during emulation
|
* Updates settings in libskyline during emulation
|
||||||
*/
|
*/
|
||||||
external fun updateNative()
|
external fun updateNative()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* Setter for native log level
|
||||||
|
*/
|
||||||
|
external fun setLogLevel(logLevel : Int)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
android:summaryOn="@string/perf_stats_desc_on"
|
android:summaryOn="@string/perf_stats_desc_on"
|
||||||
app:key="perf_stats"
|
app:key="perf_stats"
|
||||||
app:title="@string/perf_stats" />
|
app:title="@string/perf_stats" />
|
||||||
<emu.skyline.preference.IntegerListPreference
|
<emu.skyline.preference.LogLevelPreference
|
||||||
android:defaultValue="2"
|
android:defaultValue="2"
|
||||||
android:entries="@array/log_level"
|
android:entries="@array/log_level"
|
||||||
app:key="log_level"
|
app:key="log_level"
|
||||||
|
Loading…
Reference in New Issue
Block a user