diff --git a/tools/csdis.py b/tools/csdis.py index cfc266719e..6088cfede2 100755 --- a/tools/csdis.py +++ b/tools/csdis.py @@ -2,8 +2,7 @@ from overlayhelpers import filemap -import argparse -import struct +import argparse, os, struct """ Enumerations @@ -472,8 +471,9 @@ def main(): print(file_result) print() + script_dir = os.path.dirname(os.path.realpath(__file__)) cs_data = None - with open("baserom/" + file_result.name, "rb") as ovl_file: + with open(script_dir + "/../baserom/" + file_result.name, "rb") as ovl_file: ovl_file.seek(file_result.offset) cs_data = [i[0] for i in struct.iter_unpack(">I", bytearray(ovl_file.read()))] if cs_data is not None: diff --git a/tools/overlayhelpers/colliderinit.py b/tools/overlayhelpers/colliderinit.py index b35a4b34e4..9d958405f9 100755 --- a/tools/overlayhelpers/colliderinit.py +++ b/tools/overlayhelpers/colliderinit.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import struct import argparse from filemap import FileResult, GetFromVRam, GetFromRom @@ -223,7 +224,9 @@ else: print("ItemInit type must specify number of elements") exit() -ovlFile = open("../../baserom/" + fileResult.name, "rb") +script_dir = os.path.dirname(os.path.realpath(__file__)) + +ovlFile = open(script_dir + "/../../baserom/" + fileResult.name, "rb") ovlData = bytearray(ovlFile.read()) ovlFile.close()