Update VMEmuExecutable.kt

This commit is contained in:
CuriousTorvald
2022-12-12 20:01:08 +09:00
committed by GitHub
parent 6fedbef541
commit e605f9ddc8

View File

@@ -96,7 +96,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
private val currentlyLoadedProfiles = HashMap<String, VM>() private val currentlyLoadedProfiles = HashMap<String, VM>()
fun getVMbyProfileName(name: String): VM? { fun getVMbyProfileName(name: String): VM? {
if (profiles.containsKey(name)) { if (profiles.containsKey(name)) {
return currentlyLoadedProfiles.getOrPut(name) { _makeVMfromJson(profiles[name]!!) } return currentlyLoadedProfiles.getOrPut(name) { _makeVMfromJson(profiles[name]!!, name) }
} }
else else
return null return null
@@ -464,7 +464,9 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
* } * }
* ``` * ```
*/ */
private fun _makeVMfromJson(json: JsonValue): VM { private fun _makeVMfromJson(json: JsonValue, profileName: String): VM {
println("Processing profile '$profileName'")
val assetsDir = json.getString("assetsdir") val assetsDir = json.getString("assetsdir")
val ramsize = json.getLong("ramsize") val ramsize = json.getLong("ramsize")
val cardslots = json.getInt("cardslots") val cardslots = json.getInt("cardslots")
@@ -507,7 +509,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
} }
} }
if (!successful) { if (!successful) {
throw RuntimeException("Invalid or insufficient arguments for ${className}") throw RuntimeException("Invalid or insufficient arguments for $className in the profile $profileName")
} }
} }