-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLoadROM.py
executable file
·31 lines (23 loc) · 1 KB
/
LoadROM.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Loads EOS Roms and populates memory map
# @category MagicLantern
from mlLib.MemoryMap import *
from mlLib.ProgramTree import createProgramTree
from mlLib.toolbox import createNewProgram, createFileBytes
from mlLib.gui.FilesLoader import loadFiles, loadFilesError
from mlLib.gui.FirmwareSelector import selectFirmware
from cfg.memory import devices
device, fw = selectFirmware(devices)
files = loadFiles(device, fw)
if not files or len(files) < len(fw.roms):
# not all files loaded successfully, abort
loadFilesError()
exit(1)
memoryMap = createMemoryMap(device, fw)
newProgram = createNewProgram("{}_{}".format(device.model, fw.version),
device.cpu.arch, device.cpu.lang, device.cpu.compiler)
# create file bytes in program
for name, provider in files.items():
createFileBytes(name, provider, program=newProgram)
# we need to explicitly pass new program downsteram as scripts are confused
applyMemoryMap(memoryMap, program=newProgram)
createProgramTree("EOS", memoryMap, program=newProgram)