From 49f17b46d5f5d8052875d4dcf42b3230b90e484e Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 30 Apr 2022 22:42:51 -0700 Subject: [PATCH] Allow drag and drop --- OTRExporter/extract_assets.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/OTRExporter/extract_assets.py b/OTRExporter/extract_assets.py index e33b65f0e..e224606ff 100755 --- a/OTRExporter/extract_assets.py +++ b/OTRExporter/extract_assets.py @@ -4,7 +4,7 @@ # Place a rom in this directory then run the script. # If you are using multiple roms, the script will let you choose one. # To choose with a commandline argument: -# Python3 extract_assets.py +# Python3 extract_assets.py # Invalid input results in the first rom being selected import json, os, signal, time, sys, shutil, glob @@ -93,16 +93,9 @@ def main(): # If commandline args exist if (len(sys.argv) > 1): try: - if ((int(sys.argv[1]) - 1) < 1): - romToUse = roms[0] - - elif ((int(sys.argv[1]) - 1) > len(roms)): - romToUse = roms[len(roms) - 1] - - else: - romToUse = roms[int(sys.argv[1]) - 1] + romToUse = sys.argv[1] except: - romToUse = roms[0] + print("Error with rom inputted via argument") # No commandline args, select rom using user input else: @@ -132,13 +125,12 @@ def main(): else: romToUse = roms[0] - match checkChecksum(romToUse): - case Checksums.OOT_PAL_GC: - xmlVer = "GC_NMQ_PAL_F" - case Checksums.OOT_PAL_GC_DBG1: - xmlVer = "GC_NMQ_D" - case _: # default case - xmlVer = "GC_MQ_D" + if checkChecksum(romToUse) == Checksums.OOT_PAL_GC: + xmlVer = "GC_NMQ_PAL_F" + elif checkChecksum(romToUse) == Checksums.OOT_PAL_GC_DBG1: + xmlVer = "GC_NMQ_D" + else: # default selection + xmlVer = "GC_MQ_D" if (os.path.exists("Extract")): shutil.rmtree("Extract")