Archived
1
0
Fork 0

[v0.0.8] support ALL as version

This commit is contained in:
sup39 2023-02-01 01:44:52 +09:00
parent 3da33e9d7e
commit 28b19166d7
2 changed files with 31 additions and 19 deletions

View file

@ -1,6 +1,6 @@
[metadata] [metadata]
name = supSMSASM name = supSMSASM
version = 0.0.7 version = 0.0.8
author = sup39 author = sup39
author_email = sms@sup39.dev author_email = sms@sup39.dev
description = A tool to make Gecko code from ASM for SMS description = A tool to make Gecko code from ASM for SMS

View file

@ -204,26 +204,38 @@ def main():
sys.exit(1) sys.exit(1)
fnIn = argv[1] fnIn = argv[1]
dolver = normalize_dolver(argv[2]) if argc > 2 else 'GMSJ01' verIn = argv[2]
if dolver is None: if verIn.lower() == 'all':
logger.error('Unknown dol version: %s'%argv[2]) ans = ''
sys.exit(1) indent = ' '
for dolver in ['GMSJ01', 'GMSJ0A', 'GMSP01', 'GMSE01']:
r = asm2gecko(fnIn, dolver)
codes, codeSymbs, asmSymbs, isC2 = r
ans += f'<source version="{dolver}">\n'
ans += '\n'.join(indent+line for line in codes)
ans += '\n</source>\n'
pbcopy(ans)
else:
dolver = normalize_dolver(verIn) if argc > 2 else 'GMSJ01'
if dolver is None:
logger.error('Unknown dol version: %s'%argv[2])
sys.exit(1)
r = asm2gecko(fnIn, dolver) r = asm2gecko(fnIn, dolver)
if r is not None: if r is not None:
codes, codeSymbs, asmSymbs, isC2 = r codes, codeSymbs, asmSymbs, isC2 = r
pbcopy('\n'.join(codes)) pbcopy('\n'.join(codes))
# print asm symbols # print asm symbols
if not isC2: if not isC2:
for name, addr in asmSymbs.items(): for name, addr in asmSymbs.items():
print(addr.upper(), name) print(addr.upper(), name)
print()
# print gecko symbols
for name, ct, src, dst in codeSymbs:
print('%-2s [%08X] @[%08X] %s'%(ct, dst, src, name))
print() print()
# print gecko symbols # code length
for name, ct, src, dst in codeSymbs: print('Code length:', len(codes), 'line(s)')
print('%-2s [%08X] @[%08X] %s'%(ct, dst, src, name))
print()
# code length
print('Code length:', len(codes), 'line(s)')
if __name__ == '__main__': if __name__ == '__main__':
main() main()