From 28b19166d767ad4ebd7c96fbdebb2a866581de19 Mon Sep 17 00:00:00 2001 From: sup39 Date: Wed, 1 Feb 2023 01:44:52 +0900 Subject: [PATCH] [v0.0.8] support ALL as version --- setup.cfg | 2 +- src/supSMSASM/cli.py | 48 +++++++++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/setup.cfg b/setup.cfg index d347cfd..dbc772a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = supSMSASM -version = 0.0.7 +version = 0.0.8 author = sup39 author_email = sms@sup39.dev description = A tool to make Gecko code from ASM for SMS diff --git a/src/supSMSASM/cli.py b/src/supSMSASM/cli.py index 476d961..d94e716 100644 --- a/src/supSMSASM/cli.py +++ b/src/supSMSASM/cli.py @@ -204,26 +204,38 @@ def main(): sys.exit(1) fnIn = argv[1] - dolver = normalize_dolver(argv[2]) if argc > 2 else 'GMSJ01' - if dolver is None: - logger.error('Unknown dol version: %s'%argv[2]) - sys.exit(1) + verIn = argv[2] + if verIn.lower() == 'all': + ans = '' + indent = ' ' + for dolver in ['GMSJ01', 'GMSJ0A', 'GMSP01', 'GMSE01']: + r = asm2gecko(fnIn, dolver) + codes, codeSymbs, asmSymbs, isC2 = r + ans += f'\n' + ans += '\n'.join(indent+line for line in codes) + ans += '\n\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) - if r is not None: - codes, codeSymbs, asmSymbs, isC2 = r - pbcopy('\n'.join(codes)) - # print asm symbols - if not isC2: - for name, addr in asmSymbs.items(): - print(addr.upper(), name) + r = asm2gecko(fnIn, dolver) + if r is not None: + codes, codeSymbs, asmSymbs, isC2 = r + pbcopy('\n'.join(codes)) + # print asm symbols + if not isC2: + for name, addr in asmSymbs.items(): + 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 gecko symbols - for name, ct, src, dst in codeSymbs: - print('%-2s [%08X] @[%08X] %s'%(ct, dst, src, name)) - print() - # code length - print('Code length:', len(codes), 'line(s)') + # code length + print('Code length:', len(codes), 'line(s)') if __name__ == '__main__': main()