mirror of
https://github.com/Pecusx/Young-lumberjack.git
synced 2026-05-20 22:33:54 +02:00
ex.py - asm generator for additional files
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
def print_lines(
|
||||
dta, line_from: int, line_to: int, skip_left: int = 0, skip_right: int = 0, f=sys.stdout,):
|
||||
for d in dta[line_from:line_to]:
|
||||
print(
|
||||
f' dta ' + ','.join([f'${d[i:i + 2]}' for i in range(0 + skip_right, len(d) - skip_left, 2)]),
|
||||
file=f)
|
||||
|
||||
def write_asm(atrview, out, page, line_from, line_to, skip_left, skip_right):
|
||||
with open(atrview, 'r', encoding='utf-8-sig') as f:
|
||||
s = json.load(f)
|
||||
for p in s['Pages']:
|
||||
|
||||
if (isinstance(page, int) and p['Nr'] == page) or (isinstance(page, str) and p['Name'] == page):
|
||||
dta = p['View']
|
||||
dta = [dta[i * 80:(i + 1) * 80][:64] for i in range(len(dta) // 80)]
|
||||
break
|
||||
|
||||
with open(out, 'wt') as f:
|
||||
print_lines(dta, line_from, line_to, skip_left,skip_right, f)
|
||||
|
||||
|
||||
write_asm(
|
||||
atrview='title_fonts.atrview',
|
||||
out='over_screen.asmx',
|
||||
page=5,
|
||||
line_from=0,
|
||||
line_to=12,
|
||||
skip_left=4,
|
||||
skip_right=4)
|
||||
|
||||
write_asm(
|
||||
atrview="title.atrview",
|
||||
out='title_logo.asmx',
|
||||
page=1,
|
||||
line_from=2,
|
||||
line_to=2+8,
|
||||
skip_left=4,
|
||||
skip_right=4)
|
||||
|
||||
write_asm(
|
||||
atrview="title.atrview",
|
||||
out='title_timber.asmx',
|
||||
page=1,
|
||||
line_from=12,
|
||||
line_to=12+12,
|
||||
skip_left=4,
|
||||
skip_right=4)
|
||||
|
||||
write_asm(
|
||||
atrview="title_fonts.atrview",
|
||||
out='difficulty_texts.asmx',
|
||||
page=4,
|
||||
line_from=0,
|
||||
line_to=0+2,
|
||||
skip_left=0,
|
||||
skip_right=0)
|
||||
|
||||
write_asm(
|
||||
atrview="title_fonts.atrview",
|
||||
out='credits.asmx',
|
||||
page='Credits',
|
||||
line_from=0,
|
||||
line_to=0+10,
|
||||
skip_left=0,
|
||||
skip_right=0)
|
||||
Reference in New Issue
Block a user