Пример #1
0
    def adjustRom():
        guiargs = Namespace()
        guiargs.heartbeep = rom_vars.heartbeepVar.get()
        guiargs.heartcolor = rom_vars.heartcolorVar.get()
        guiargs.fastmenu = rom_vars.fastMenuVar.get()
        guiargs.ow_palettes = rom_vars.owPalettesVar.get()
        guiargs.uw_palettes = rom_vars.uwPalettesVar.get()
        guiargs.hud_palettes = rom_vars.hudPalettesVar.get()
        guiargs.sword_palettes = rom_vars.swordPalettesVar.get()
        guiargs.shield_palettes = rom_vars.shieldPalettesVar.get()
        guiargs.quickswap = bool(rom_vars.quickSwapVar.get())
        guiargs.disablemusic = bool(rom_vars.disableMusicVar.get())
        guiargs.reduceflashing = bool(rom_vars.disableFlashingVar.get())
        guiargs.rom = romVar2.get()
        guiargs.baserom = romVar.get()
        guiargs.sprite = rom_vars.sprite
        if rom_vars.sprite_pool:
            guiargs.world = AdjusterWorld(rom_vars.sprite_pool)

        try:
            guiargs, path = adjust(args=guiargs)
            if rom_vars.sprite_pool:
                guiargs.sprite_pool = rom_vars.sprite_pool
                delattr(guiargs, "world")
        except Exception as e:
            logging.exception(e)
            messagebox.showerror(title="Error while adjusting Rom", message=str(e))
        else:
            messagebox.showinfo(title="Success", message=f"Rom patched successfully to {path}")
            from Utils import persistent_store
            from Rom import Sprite
            if isinstance(guiargs.sprite, Sprite):
                guiargs.sprite = guiargs.sprite.name
            persistent_store("adjuster", "last_settings_3", guiargs)
Пример #2
0
def main():
    parser = argparse.ArgumentParser(
        formatter_class=ArgumentDefaultsHelpFormatter)

    parser.add_argument('--rom',
                        default='ER_base.sfc',
                        help='Path to an ALttP rom to adjust.')
    parser.add_argument(
        '--baserom',
        default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc',
        help='Path to an ALttP JAP(1.0) rom to use as a base.')
    parser.add_argument('--loglevel',
                        default='info',
                        const='info',
                        nargs='?',
                        choices=['error', 'info', 'warning', 'debug'],
                        help='Select level of logging for output.')
    parser.add_argument(
        '--fastmenu',
        default='normal',
        const='normal',
        nargs='?',
        choices=['normal', 'instant', 'double', 'triple', 'quadruple', 'half'],
        help='''\
                             Select the rate at which the menu opens and closes.
                             (default: %(default)s)
                             ''')
    parser.add_argument('--quickswap',
                        help='Enable quick item swapping with L and R.',
                        action='store_true')
    parser.add_argument('--disablemusic',
                        help='Disables game music.',
                        action='store_true')
    parser.add_argument('--heartbeep',
                        default='normal',
                        const='normal',
                        nargs='?',
                        choices=['double', 'normal', 'half', 'quarter', 'off'],
                        help='''\
                             Select the rate at which the heart beep sound is played at
                             low health. (default: %(default)s)
                             ''')
    parser.add_argument(
        '--heartcolor',
        default='red',
        const='red',
        nargs='?',
        choices=['red', 'blue', 'green', 'yellow', 'random'],
        help='Select the color of Link\'s heart meter. (default: %(default)s)')
    parser.add_argument('--ow_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--link_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--shield_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--sword_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--hud_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--uw_palettes',
                        default='default',
                        choices=[
                            'default', 'random', 'blackout', 'puke', 'classic',
                            'grayscale', 'negative', 'dizzy', 'sick'
                        ])
    parser.add_argument('--sprite',
                        help='''\
                             Path to a sprite sheet to use for Link. Needs to be in
                             binary format and have a length of 0x7000 (28672) bytes,
                             or 0x7078 (28792) bytes including palette data.
                             Alternatively, can be a ALttP Rom patched with a Link
                             sprite that will be extracted.
                             ''')
    parser.add_argument('--names', default='', type=str)
    args = parser.parse_args()

    # ToDo: Validate files further than mere existance
    if not os.path.isfile(args.rom):
        input(
            'Could not find valid rom for patching at expected path %s. Please run with -h to see help for further information. \nPress Enter to exit.'
            % args.rom)
        sys.exit(1)
    if args.sprite is not None and not os.path.isfile(
            args.sprite) and not Sprite.get_sprite_from_name(args.sprite):
        input(
            'Could not find link sprite sheet at given location. \nPress Enter to exit.'
        )
        sys.exit(1)

    # set up logger
    loglevel = {
        'error': logging.ERROR,
        'info': logging.INFO,
        'warning': logging.WARNING,
        'debug': logging.DEBUG
    }[args.loglevel]
    logging.basicConfig(format='%(message)s', level=loglevel)
    args, path = adjust(args=args)
    from Utils import persistent_store
    persistent_store("adjuster", "last_settings_2", args)
Пример #3
0
def main():
    parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)

    parser.add_argument('--rom', default='ER_base.sfc', help='Path to an ALttP rom to adjust.')
    parser.add_argument('--baserom', default='Zelda no Densetsu - Kamigami no Triforce (Japan).sfc',
                        help='Path to an ALttP JAP(1.0) rom to use as a base.')
    parser.add_argument('--loglevel', default='info', const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
    parser.add_argument('--fastmenu', default='normal', const='normal', nargs='?', choices=['normal', 'instant', 'double', 'triple', 'quadruple', 'half'],
                        help='''\
                             Select the rate at which the menu opens and closes.
                             (default: %(default)s)
                             ''')
    parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
    parser.add_argument('--disablemusic', help='Disables game music.', action='store_true')
    parser.add_argument('--triforcehud', default='hide_goal', const='hide_goal', nargs='?', choices=['normal', 'hide_goal', 'hide_required', 'hide_both'],
                    help='''\
                            Hide the triforce hud in certain circumstances.
                            hide_goal will hide the hud until finding a triforce piece, hide_required will hide the total amount needed to win
                            (Both can be revealed when speaking to Murahalda)
                            (default: %(default)s)
                            ''')
    parser.add_argument('--enableflashing', help='Reenable flashing animations (unfriendly to epilepsy, always disabled in race roms)', action='store_false', dest="reduceflashing")
    parser.add_argument('--heartbeep', default='normal', const='normal', nargs='?', choices=['double', 'normal', 'half', 'quarter', 'off'],
                        help='''\
                             Select the rate at which the heart beep sound is played at
                             low health. (default: %(default)s)
                             ''')
    parser.add_argument('--heartcolor', default='red', const='red', nargs='?', choices=['red', 'blue', 'green', 'yellow', 'random'],
                        help='Select the color of Link\'s heart meter. (default: %(default)s)')
    parser.add_argument('--ow_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--link_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--shield_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--sword_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--hud_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--uw_palettes', default='default', choices=['default', 'random', 'blackout','puke','classic','grayscale','negative','dizzy','sick'])
    parser.add_argument('--sprite', help='''\
                             Path to a sprite sheet to use for Link. Needs to be in
                             binary format and have a length of 0x7000 (28672) bytes,
                             or 0x7078 (28792) bytes including palette data.
                             Alternatively, can be a ALttP Rom patched with a Link
                             sprite that will be extracted.
                             ''')
    parser.add_argument('--names', default='', type=str)
    args = parser.parse_args()

    # set up logger
    loglevel = {'error': logging.ERROR, 'info': logging.INFO, 'warning': logging.WARNING, 'debug': logging.DEBUG}[
        args.loglevel]
    logging.basicConfig(format='%(message)s', level=loglevel)

    if not os.path.isfile(args.rom):
        adjustGUI()
    else:
        if args.sprite is not None and not os.path.isfile(args.sprite) and not Sprite.get_sprite_from_name(args.sprite):
            input('Could not find link sprite sheet at given location. \nPress Enter to exit.')
            sys.exit(1)

        args, path = adjust(args=args)
        from Utils import persistent_store
        if isinstance(args.sprite, Sprite):
            args.sprite = args.sprite.name
        persistent_store("adjuster", "last_settings_3", args)