mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 16:44:26 +01:00
android: Remove ini4j
This commit is contained in:
parent
ac522db857
commit
e744c06f61
@ -219,7 +219,6 @@ dependencies {
|
|||||||
implementation("io.coil-kt:coil:2.2.2")
|
implementation("io.coil-kt:coil:2.2.2")
|
||||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||||
implementation("androidx.window:window:1.2.0-beta03")
|
implementation("androidx.window:window:1.2.0-beta03")
|
||||||
implementation("org.ini4j:ini4j:0.5.4")
|
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.4")
|
implementation("androidx.navigation:navigation-fragment-ktx:2.7.4")
|
||||||
|
@ -3,15 +3,8 @@
|
|||||||
|
|
||||||
package org.yuzu.yuzu_emu.features.settings.utils
|
package org.yuzu.yuzu_emu.features.settings.utils
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import org.ini4j.Wini
|
|
||||||
import org.yuzu.yuzu_emu.R
|
|
||||||
import org.yuzu.yuzu_emu.YuzuApplication
|
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.*
|
|
||||||
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
import org.yuzu.yuzu_emu.utils.DirectoryInitialization
|
||||||
import org.yuzu.yuzu_emu.utils.Log
|
|
||||||
import org.yuzu.yuzu_emu.utils.NativeConfig
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains static methods for interacting with .ini files in which settings are stored.
|
* Contains static methods for interacting with .ini files in which settings are stored.
|
||||||
@ -19,41 +12,6 @@ import org.yuzu.yuzu_emu.utils.NativeConfig
|
|||||||
object SettingsFile {
|
object SettingsFile {
|
||||||
const val FILE_NAME_CONFIG = "config"
|
const val FILE_NAME_CONFIG = "config"
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves a Settings HashMap to a given .ini file on disk. If unsuccessful, outputs an error
|
|
||||||
* telling why it failed.
|
|
||||||
*
|
|
||||||
* @param fileName The target filename without a path or extension.
|
|
||||||
*/
|
|
||||||
fun saveFile(fileName: String) {
|
|
||||||
val ini = getSettingsFile(fileName)
|
|
||||||
try {
|
|
||||||
val wini = Wini(ini)
|
|
||||||
for (specificCategory in Settings.Category.values()) {
|
|
||||||
val categoryHeader = NativeConfig.getConfigHeader(specificCategory.ordinal)
|
|
||||||
for (setting in Settings.settingsList) {
|
|
||||||
if (setting.key!!.isEmpty()) continue
|
|
||||||
|
|
||||||
val settingCategoryHeader =
|
|
||||||
NativeConfig.getConfigHeader(setting.category.ordinal)
|
|
||||||
val iniSetting: String? = wini.get(categoryHeader, setting.key)
|
|
||||||
if (iniSetting != null || settingCategoryHeader == categoryHeader) {
|
|
||||||
wini.put(settingCategoryHeader, setting.key, setting.valueAsString)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wini.store()
|
|
||||||
} catch (e: IOException) {
|
|
||||||
Log.error("[SettingsFile] File not found: " + fileName + ".ini: " + e.message)
|
|
||||||
val context = YuzuApplication.appContext
|
|
||||||
Toast.makeText(
|
|
||||||
context,
|
|
||||||
context.getString(R.string.error_saving, fileName, e.message),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getSettingsFile(fileName: String): File =
|
fun getSettingsFile(fileName: String): File =
|
||||||
File(DirectoryInitialization.userDirectory + "/config/" + fileName + ".ini")
|
File(DirectoryInitialization.userDirectory + "/config/" + fileName + ".ini")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user