jsonout parameter now dumps to stdout instead of file.

This commit is contained in:
LLCoolDave
2017-07-16 23:20:54 +02:00
parent a6ab6cdcf1
commit 132a264d8a
2 changed files with 14 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ from Items import ItemFactory
import random
import time
import logging
import json
__version__ = '0.4.2-dev'
@@ -92,9 +93,12 @@ def main(args, seed=None):
else:
rom = LocalRom(args.rom)
patch_rom(world, rom, bytearray(logic_hash), args.quickswap, args.heartbeep, sprite)
rom.write_to_file(args.jsonout or '%s.sfc' % outfilebase)
if args.jsonout:
print(json.dumps({'patch': rom.patches, 'spoiler': world.spoiler}))
else:
rom.write_to_file(args.jsonout or '%s.sfc' % outfilebase)
if args.create_spoiler:
if args.create_spoiler and not args.jsonout:
with open('%s_Spoiler.txt' % outfilebase, 'w') as outfile:
outfile.write(world.spoiler)