Android: Convert NativeConfig to Kotlin

This commit is contained in:
Charles Lombardo 2023-03-15 03:25:12 -04:00
parent 7c59640f8e
commit 42f4fb815f
2 changed files with 107 additions and 51 deletions

View File

@ -1,51 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.settings.model;
public class NativeConfig
{
public static final int LAYER_BASE_OR_CURRENT = 0;
public static final int LAYER_BASE = 1;
public static final int LAYER_LOCAL_GAME = 2;
public static final int LAYER_ACTIVE = 3;
public static final int LAYER_CURRENT = 4;
public static native boolean isSettingSaveable(String file, String section, String key);
public static native void loadGameInis(String gameId, int revision);
public static native void unloadGameInis();
public static native void save(int layer);
public static native void deleteAllKeys(int layer);
public static native boolean isOverridden(String file, String section, String key);
public static native boolean deleteKey(int layer, String file, String section, String key);
public static native boolean exists(int layer, String file, String section, String key);
public static native String getString(int layer, String file, String section, String key,
String defaultValue);
public static native boolean getBoolean(int layer, String file, String section, String key,
boolean defaultValue);
public static native int getInt(int layer, String file, String section, String key,
int defaultValue);
public static native float getFloat(int layer, String file, String section, String key,
float defaultValue);
public static native void setString(int layer, String file, String section, String key,
String value);
public static native void setBoolean(int layer, String file, String section, String key,
boolean value);
public static native void setInt(int layer, String file, String section, String key, int value);
public static native void setFloat(int layer, String file, String section, String key,
float value);
}

View File

@ -0,0 +1,107 @@
// SPDX-License-Identifier: GPL-2.0-or-later
package org.dolphinemu.dolphinemu.features.settings.model
object NativeConfig {
const val LAYER_BASE_OR_CURRENT = 0
const val LAYER_BASE = 1
const val LAYER_LOCAL_GAME = 2
const val LAYER_ACTIVE = 3
const val LAYER_CURRENT = 4
@JvmStatic
external fun isSettingSaveable(file: String, section: String, key: String): Boolean
@JvmStatic
external fun loadGameInis(gameId: String, revision: Int)
@JvmStatic
external fun unloadGameInis()
@JvmStatic
external fun save(layer: Int)
@JvmStatic
external fun deleteAllKeys(layer: Int)
@JvmStatic
external fun isOverridden(file: String, section: String, key: String): Boolean
@JvmStatic
external fun deleteKey(layer: Int, file: String, section: String, key: String): Boolean
@JvmStatic
external fun exists(layer: Int, file: String, section: String, key: String): Boolean
@JvmStatic
external fun getString(
layer: Int,
file: String,
section: String,
key: String,
defaultValue: String
): String
@JvmStatic
external fun getBoolean(
layer: Int,
file: String,
section: String,
key: String,
defaultValue: Boolean
): Boolean
@JvmStatic
external fun getInt(
layer: Int,
file: String,
section: String,
key: String,
defaultValue: Int
): Int
@JvmStatic
external fun getFloat(
layer: Int,
file: String,
section: String,
key: String,
defaultValue: Float
): Float
@JvmStatic
external fun setString(
layer: Int,
file: String,
section: String,
key: String,
value: String?
)
@JvmStatic
external fun setBoolean(
layer: Int,
file: String,
section: String,
key: String,
value: Boolean
)
@JvmStatic
external fun setInt(
layer: Int,
file: String,
section: String,
key: String,
value: Int
)
@JvmStatic
external fun setFloat(
layer: Int,
file: String,
section: String,
key: String,
value: Float
)
}