OpenMFOR/MFOR.py

86 lines
3.6 KiB
Python

# OpenMFOR
# credits manually reinstated due to the comments being lost from the object code decompilation
# Original release is Copyright (C) 2022 Kazuto88
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Source Generated with Decompyle++
# File: MFOR.pyc (Python 3.8)
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('-seed', help='Seed value, optional')
parser.add_argument('-race', default=False, action='store_true', help='Generate race rom (no spoiler log)')
parser.add_argument('-patch', default=False, action='store_true', help='Generate BPS patch with seed (for easy sharing)')
parser.add_argument('-diff', help='Trick difficulty level (0-5, default 0)')
parser.add_argument('-limit', default=False, action='store_true', help='Major/minor item pool')
parser.add_argument('-missiles', default=False, action='store_true', help='Missile upgrades enable the missile launcher (default off)')
parser.add_argument('-pbs', default=False, action='store_true', help='Enable Power Bombs without normal Bombs (default off)')
parser.add_argument('-damage-runs', default=False, action='store_true', help='Allow logical damage runs (default off)')
parser.add_argument('-split-security', default=False, action='store_true', help='Separated Security levels (default off)')
parser.add_argument('-sector-shuffle', default=False, action='store_true', help='Randomly shuffle the arrangement of the Sectors')
parser.add_argument('-rom', help='Base rom (Metroid Fusion (U).gba)')
parser.add_argument('-nogui', default=False, action='store_true', help='Termnial based seed generation (this)')
parser.add_argument('-num', help='Number of seeds to generate (default 1)')
parser.add_argument('-hideitems', default=False, action='store_true', help='All items use ? tank graphics')
parser.add_argument('-debug', default=False, action='store_true', help='Debugging, for my own use')
args = parser.parse_args()
if not os.path.exists(os.path.join('.', 'data')):
os.mkdir('data')
if not os.path.exists(os.path.join('.', 'seeds')):
os.mkdir('seeds')
if not os.path.exists(os.path.join('.', 'spoilers')):
os.mkdir('spoilers')
if not args.debug:
args.debug = False
if args.nogui:
settings = dict()
settings.update({
'Seed': None })
if args.seed:
settings.update({
'Seed': args.seed })
settings.update({
'Debug': args.debug })
settings.update({
'Patch': args.patch })
if not args.diff:
args.diff = 0
if int(args.diff) <= 0:
args.diff = 0
elif int(args.diff) >= 5:
args.diff = 5
settings.update({
'Difficulty': args.diff })
settings.update({
'MajorMinor': args.limit })
settings.update({
'MissilesWithoutMainData': args.missiles })
settings.update({
'PowerBombsWithoutBombs': args.pbs })
settings.update({
'DamageRuns': args.damage_runs })
settings.update({
'SplitSecurity': args.split_security })
settings.update({
'SectorShuffle': args.sector_shuffle })
settings.update({
'HideItems': args.hideitems })
settings.update({
'RaceSeed': args.race })
settings.update({
'Num': None })
if args.num:
settings.update({
'Num': int(args.num) })
from Randomizer import start_randomizer
start_randomizer(args.rom, settings)
else:
import GUI as gui
gui.main_window(args.debug)