Files
Grinch-AP/AdjusterMain.py
pepperpow fca64f1177 Removes Flashing instances in game (#168)
* Added reduced flashing, triforce hud and cutscene options

* Corrected parameters and replacement order

* Mixed up rom byte

* Removed triforce hud, smoothed cutscene speed and reset tables

* Removed triforcehud line and added bird cutscene speedup

* Added options to yaml

* Added check for race rom generation (is not internal asm)

* Added options to GUI (check sprite adjust crash)

* Fixed inconsistency in setting weight

* A "slow" setting for the cutscenespeed (#1)

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Slow wall setting

* Update playerSettings.yaml

* Remove instances of cutscene speed modification

* Changed command to remove to mitigate frame advantage

* Antiepilepsy enabled for default/race roms, param change, RTL byte

* Found a frame independent antiflashing patch for real

* Further ASM patching style

* Reduce these changes to just two bytes

* Added patches for Dark Mountain and Ether Flashing palette reveal

Co-authored-by: StructuralMike <66819228+StructuralMike@users.noreply.github.com>
2021-02-19 17:45:54 +01:00

42 lines
1.5 KiB
Python

import os
import time
import logging
from Utils import output_path
from Rom import LocalRom, apply_rom_settings
def adjust(args):
start = time.perf_counter()
logger = logging.getLogger('Adjuster')
logger.info('Patching ROM.')
vanillaRom = args.baserom
if os.path.splitext(args.rom)[-1].lower() == '.bmbp':
import Patch
meta, args.rom = Patch.create_rom_file(args.rom)
if os.stat(args.rom).st_size in (0x200000, 0x400000) and os.path.splitext(args.rom)[-1].lower() == '.sfc':
rom = LocalRom(args.rom, patch=False, vanillaRom=vanillaRom)
else:
raise RuntimeError(
'Provided Rom is not a valid Link to the Past Randomizer Rom. Please provide one for adjusting.')
palettes_options={}
palettes_options['dungeon']=args.uw_palettes
palettes_options['overworld']=args.ow_palettes
palettes_options['hud']=args.hud_palettes
palettes_options['sword']=args.sword_palettes
palettes_options['shield']=args.shield_palettes
# palettes_options['link']=args.link_palettesvera
racerom = rom.read_byte(0x180213) > 0
apply_rom_settings(rom, args.heartbeep, args.heartcolor, args.quickswap, args.fastmenu, args.disablemusic,
args.sprite, palettes_options, reduceflashing=args.reduceflashing if not racerom else True)
path = output_path(f'{os.path.basename(args.rom)[:-4]}_adjusted.sfc')
rom.write_to_file(path)
logger.info('Done. Enjoy.')
logger.debug('Total Time: %s', time.perf_counter() - start)
return args, path