From 0e0e858ee609c121f5683f8a17301a5c6e4eb6f0 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 12 Dec 2022 16:09:41 +0900 Subject: [PATCH] vmemu: updating default profiles --- .../src/net/torvald/tsvm/AppLoader.java | 2 +- .../src/net/torvald/tsvm/ProfilesMenu.kt | 24 +++++++++++++++---- .../src/net/torvald/tsvm/VMEmuExecutable.kt | 11 ++------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java index 966231b..af8884a 100644 --- a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java +++ b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java @@ -43,7 +43,7 @@ public class AppLoader { // VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8); vm.getIO().getBlockTransferPorts()[0].attachDevice(new TestDiskDrive(vm, 0, diskPath)); - vm.getIO().getBlockTransferPorts()[1].attachDevice(new HttpModem(vm)); + vm.getIO().getBlockTransferPorts()[1].attachDevice(new HttpModem(vm, 1024, -1)); diff --git a/tsvm_executable/src/net/torvald/tsvm/ProfilesMenu.kt b/tsvm_executable/src/net/torvald/tsvm/ProfilesMenu.kt index f8ccb8f..e2020ef 100644 --- a/tsvm_executable/src/net/torvald/tsvm/ProfilesMenu.kt +++ b/tsvm_executable/src/net/torvald/tsvm/ProfilesMenu.kt @@ -20,6 +20,9 @@ class ProfilesMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : Em private var selectedProfileIndex: Int? = null + private val viewportRows = parent.panelsY + private val viewportColumns = parent.panelsX + private fun resetState() { profilesScroll = 0 } @@ -90,12 +93,15 @@ class ProfilesMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : Em } // draw profile detals view - batch.color = EmulatorGuiToolkit.Theme.COL_WELL2 - batch.fillRect(251, 11, 375, 403) - batch.fillRect(251, 427, 375, 26) - if (selectedProfileIndex != null) profileNames[selectedProfileIndex!!].let { profileName -> + batch.color = EmulatorGuiToolkit.Theme.COL_WELL2 + batch.fillRect(251, 11, 375, 390) + batch.fillRect(251, 427, 375, 26) + val profile = parent.profiles[profileName]!! + val theVM = parent.getVMbyProfileName(profileName) + val vmViewport = parent.getViewportForTheVM(theVM) + val ramsize = profile.getLong("ramsize") val cardslots = profile.getInt("cardslots") @@ -118,6 +124,16 @@ class ProfilesMenu(parent: VMEmuExecutable, x: Int, y: Int, w: Int, h: Int) : Em for (i in 2 until cardslots) { FONT.draw(batch, "$i) ${cards[i-1]?.let { it.substring(it.lastIndexOf('.')+1) } ?: ""}", 253f, 11f + (10+i)*FONT.H) } + + // draw panel chooser + FONT.draw(batch, "Show on viewport:", 253f, 414f) + for (i in 1 until viewportRows * viewportColumns) { + batch.color = if (vmViewport != null && i == vmViewport + 1) + EmulatorGuiToolkit.Theme.COL_ACTIVE2 + else + Color.WHITE + FONT.draw(batch, "$i", 239f + (i * 14f) + (if (i < 10) 7f else 0f), 434f) + } } } } diff --git a/tsvm_executable/src/net/torvald/tsvm/VMEmuExecutable.kt b/tsvm_executable/src/net/torvald/tsvm/VMEmuExecutable.kt index 5cbda4b..a9f89e5 100644 --- a/tsvm_executable/src/net/torvald/tsvm/VMEmuExecutable.kt +++ b/tsvm_executable/src/net/torvald/tsvm/VMEmuExecutable.kt @@ -157,17 +157,10 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX: initVMenv(vm) vms[0] = VMRunnerInfo(vm, "Initial VM")*/ - val testJson = JsonReader().parse("{$defaultProfile}") val vm1 = getVMbyProfileName("Initial VM")!! initVMenv(vm1) vms[0] = VMRunnerInfo(vm1, "Initial VM") - - val vm2 = VM("./assets", 64 shl 10, TheRealWorld(), arrayOf(TsvmBios), 8) - vm2.getIO().blockTransferPorts[0].attachDevice(TestDiskDrive(vm2, 0, "assets/disk0")) - initVMenv(vm2) - vms[1] = VMRunnerInfo(vm2, "Initial VM2") - init() } @@ -373,7 +366,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX: coroutineJobs.values.forEach { it.cancel() } vms.forEach { it?.vm?.dispose() } - writeProfilesToFile(Gdx.files.absolute("$APPDATADIR/profiles_new.json")) + writeProfilesToFile(Gdx.files.absolute("$APPDATADIR/profiles.json")) } private val menuTabW = windowWidth - 4 @@ -455,7 +448,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX: "cardslots":8, "roms":["./assets/bios/tsvmbios.js"], "com1":{"cls":"net.torvald.tsvm.peripheral.TestDiskDrive", "args":[0, "./assets/disk0/"]}, - "com2":{"cls":"net.torvald.tsvm.peripheral.HttpModem", "args":[]}, + "com2":{"cls":"net.torvald.tsvm.peripheral.HttpModem", "args":[1024, -1]}, "card4":{"cls":"net.torvald.tsvm.peripheral.RamBank", "args":[256]} } """.trimIndent()