5 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,12 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
18
18
name = OpenPython .NAME ,
19
19
version = OpenPython .VERSION ,
20
20
dependencies = " required-after:forgelin;required-after:opencomputers;" ,
21
- modLanguageAdapter = " net.shadowfacts.forgelin.KotlinAdapter" )
21
+ modLanguageAdapter = " net.shadowfacts.forgelin.KotlinAdapter"
22
+ /* @MCVERSIONDEP@*/ )
22
23
object OpenPython {
23
24
const val MODID = " openpython"
24
25
const val NAME = " OpenPython"
25
- const val VERSION = " 1.0.0 "
26
+ const val VERSION = " 1.0.1 "
26
27
27
28
@Mod.EventHandler
28
29
fun preInit (event : FMLPreInitializationEvent ) {
@@ -41,7 +42,7 @@ object OpenPython {
41
42
42
43
Items .registerEEPROM(
43
44
" EEPROM (OpenPython BIOS)" ,
44
- OpenPythonFirmware .v1_0_0 .loadEEPROM(),
45
+ OpenPythonFirmware .v1_0_1 .loadEEPROM(),
45
46
byteArrayOf(),
46
47
false
47
48
)
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ open class OpenPythonArchitecture(val machine: Machine) : Architecture {
23
23
close()
24
24
25
25
try {
26
- val firmware = OpenPythonFirmware ( " v1.0.0 " ) // TODO: OpenPythonFirmware mapping
26
+ val firmware = OpenPythonFirmware .v1_0_1
27
27
recomputeMemory(machine.host().internalComponents())
28
28
vm = OpenPythonVirtualMachine (machine, totalMemory, firmware)
29
29
} catch (e: Exception ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class OpenPythonFirmware(val name: String) {
11
11
private val path: String = " /assets/${OpenPython .MODID } /firmwares/$name "
12
12
13
13
companion object {
14
- val v1_0_0 = OpenPythonFirmware (" v1.0.0 " )
14
+ val v1_0_1 = OpenPythonFirmware (" v1.0.1 " )
15
15
}
16
16
17
17
init {
Original file line number Diff line number Diff line change @@ -68,8 +68,18 @@ class OpenPythonVirtualMachine internal constructor(val machine: Machine, val me
68
68
// firmware
69
69
val firmwareTag = rootTag.getCompoundTag(" firmware" )
70
70
val firmwareName = firmwareTag.getString(" name" )
71
- if (firmware.name != firmwareName)
72
- firmware = OpenPythonFirmware (firmwareName)
71
+ if (firmware.name != firmwareName) {
72
+ try {
73
+ firmware = OpenPythonFirmware (firmwareName)
74
+ } catch (e: Exception ) {
75
+ if (firmwareName.startsWith(" v1.0." )) {
76
+ e.printStackTrace()
77
+ firmware = OpenPythonFirmware .v1_0_1
78
+ } else {
79
+ throw e;
80
+ }
81
+ }
82
+ }
73
83
74
84
75
85
// cpu
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ object OpenPythonBenchmark {
17
17
@JvmStatic
18
18
fun main (args : Array <String >) {
19
19
val cpu = CPU ()
20
- val firmware = OpenPythonFirmware .v1_0_0
20
+ val firmware = OpenPythonFirmware .v1_0_1
21
21
cpu.memory.apply {
22
22
flash(FLASH .address, FLASH .size, firmware.loadFirmware())
23
23
map(SRAM .address, SRAM .size, MemoryFlag .RW ) // ram
0 commit comments