debug menu improvements

This commit is contained in:
minjaesong
2023-01-22 16:58:04 +09:00
parent 1dbe7af8df
commit e53aa7e98d
3 changed files with 20 additions and 12 deletions

View File

@@ -33,8 +33,10 @@ class AudioMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : EmuMe
private val COL_SOUNDSCOPE_FORE = Color(0x80f782ff.toInt())
private val STR_PLAY = "\u00D2\u00D3"
override fun render(batch: SpriteBatch) {
val adev = parent.getCurrentlySelectedVM()?.vm?.peripheralTable?.getOrNull(cardIndex ?: -1)?.peripheral as? AudioAdapter
val adev = parent.currentlyPersistentVM?.vm?.peripheralTable?.getOrNull(cardIndex ?: -1)?.peripheral as? AudioAdapter
if (adev != null) {
batch.inUse {

View File

@@ -24,27 +24,27 @@ class MMUMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : EmuMenu
override fun update() {
}
private var vmInfo: VMEmuExecutable.VMRunnerInfo? = null // to remember previous selection as `parent.getCurrentlySelectedVM()` will return null when MMU menu is clicked
override fun render(batch: SpriteBatch) {
batch.color = Color.WHITE
vmInfo = parent.getCurrentlySelectedVM() ?: vmInfo
parent.currentlyPersistentVM.let { vmInfo ->
if (vmInfo == null) {
batch.inUse {
FONT.draw(batch, "Please select a VM", 12f, 11f + 0* FONT.H)
if (vmInfo == null) {
batch.inUse {
FONT.draw(batch, "Please select a VM", 12f, 11f + 0* FONT.H)
}
}
}
else vmInfo!!.let { (vm, vmName) ->
batch.inUse {
FONT.draw(batch, "Allocated size: ${vm.allocatedBlockCount * vm.MALLOC_UNIT}", 12f, 11f + 0* FONT.H)
else vmInfo.let { (vm, vmName) ->
batch.inUse {
FONT.draw(batch, "Allocated size: ${vm.allocatedBlockCount * vm.MALLOC_UNIT}", 12f, 11f + 0* FONT.H)
}
drawAllocMap(batch, vm, 62f, 2f * FONT.H)
}
drawAllocMap(batch, vm, 62f, 2f * FONT.H)
}
}

View File

@@ -122,6 +122,12 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
}
internal fun getCurrentlySelectedVM(): VMRunnerInfo? = if (currentVMselection == null) null else vms[currentVMselection!!]
internal var currentlyPersistentVM: VMRunnerInfo? = null
get() {
if (currentVMselection != null) { field = vms[currentVMselection!!] }
return field
}
private set
private fun writeProfilesToFile(outFile: FileHandle) {
val out = StringBuilder()