/
tidlrun
executable file
·60 lines (46 loc) · 1.95 KB
/
tidlrun
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/data/data/com.termux/files/usr/bin/python
# Script that downloads given URL
# unzips and loads 83p files to AndieGraph
import glob
import os
import sys
os.system('mkdir -p /sdcard/a-ti-den/downloads')
os.chdir('/sdcard/a-ti-den/downloads/')
os.system('rm -rf *')
shell = sys.argv[1].split('/')[-2]
shells = {'ashell83' : 'https://www.ticalc.org/pub/83/asm/shells/ashell.zip',
'doorscs' : 'https://www.ticalc.org/pub/83/asm/shells/dcs7.zip',
'ion' : 'https://www.ticalc.org/pub/83/asm/shells/ion16u.zip',
'sos' : 'https://www.ticalc.org/pub/83/asm/shells/sos.zip',
'venus' : 'https://www.ticalc.org/pub/83/asm/shells/venus.zip'}
if shell in shells:
os.system('curl --output shell.zip ' + shells[shell])
os.system('unzip shell.zip')
os.system('curl --output dl.zip ' + sys.argv[1])
os.system('unzip dl.zip')
group_files = glob.glob(os.getcwd() + '/**/*.83g', recursive=True)
group_files.extend(glob.glob(os.getcwd() + '/**/*.83G', recursive=True))
for group_file in group_files:
os.system('split83g ' + group_file)
prog_files = glob.glob(os.getcwd() + '/**/*.83p', recursive=True)
prog_files.extend(glob.glob(os.getcwd() + '/**/*.83P', recursive=True))
assert prog_files != [], "No 83p-files available"
if shell == 'sos':
used_libs = set()
# List below can be dynamically generated per shell from ticalc instead.
sos_libs = [b'ZLIB', b'ZGFXL', b'ZINPT', b'ZLMATH']
for prog in prog_files:
progdata = open(prog, 'rb').read()
for lib in sos_libs:
if progdata.find(lib) > 0:
used_libs.add(lib)
for lib in used_libs:
prog_files.append('/sdcard/a-ti-den/soslibs/' + lib.decode() + '.83p')
if shell == 'ion':
parent = '/sdcard/a-ti-den/ion.ram'
else:
parent = '/sdcard/a-ti-den/clean.ram'
command = 'almosttx --parent ' + parent + ' --child /sdcard/a-ti-den/Ti83.RAM "' + '" "'.join(prog_files) + '"'
print(command)
os.system(command)
os.system('startTI')