mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-29 08:16:11 +00:00
fix_bss.py: Fix infinite loop after linker errors (#2297)
This commit is contained in:
parent
8ce69c3ac9
commit
c55a1dab57
1 changed files with 10 additions and 4 deletions
|
@ -183,11 +183,11 @@ base = None
|
||||||
build = None
|
build = None
|
||||||
|
|
||||||
|
|
||||||
def get_file_pointers_worker_init(version: str):
|
def get_file_pointers_worker_init(base_path: Path, build_path: Path):
|
||||||
global base
|
global base
|
||||||
global build
|
global build
|
||||||
base = open(f"baseroms/{version}/baserom-decompressed.z64", "rb")
|
base = open(base_path, "rb")
|
||||||
build = open(f"build/{version}/oot-{version}.z64", "rb")
|
build = open(build_path, "rb")
|
||||||
|
|
||||||
|
|
||||||
def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer]:
|
def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer]:
|
||||||
|
@ -200,8 +200,14 @@ def get_file_pointers_worker(file: mapfile_parser.mapfile.File) -> list[Pointer]
|
||||||
# C files to a list of pointers into their BSS sections
|
# C files to a list of pointers into their BSS sections
|
||||||
def compare_pointers(version: str) -> dict[Path, BssSection]:
|
def compare_pointers(version: str) -> dict[Path, BssSection]:
|
||||||
mapfile_path = Path(f"build/{version}/oot-{version}.map")
|
mapfile_path = Path(f"build/{version}/oot-{version}.map")
|
||||||
|
base_path = Path(f"baseroms/{version}/baserom-decompressed.z64")
|
||||||
|
build_path = Path(f"build/{version}/oot-{version}.z64")
|
||||||
if not mapfile_path.exists():
|
if not mapfile_path.exists():
|
||||||
raise FixBssException(f"Could not open {mapfile_path}")
|
raise FixBssException(f"Could not open {mapfile_path}")
|
||||||
|
if not base_path.exists():
|
||||||
|
raise FixBssException(f"Could not open {base_path}")
|
||||||
|
if not build_path.exists():
|
||||||
|
raise FixBssException(f"Could not open {build_path}")
|
||||||
|
|
||||||
mapfile = mapfile_parser.mapfile.MapFile()
|
mapfile = mapfile_parser.mapfile.MapFile()
|
||||||
mapfile.readMapFile(mapfile_path)
|
mapfile.readMapFile(mapfile_path)
|
||||||
|
@ -225,7 +231,7 @@ def compare_pointers(version: str) -> dict[Path, BssSection]:
|
||||||
file_results = []
|
file_results = []
|
||||||
with multiprocessing.Pool(
|
with multiprocessing.Pool(
|
||||||
initializer=get_file_pointers_worker_init,
|
initializer=get_file_pointers_worker_init,
|
||||||
initargs=(version,),
|
initargs=(base_path, build_path),
|
||||||
) as p:
|
) as p:
|
||||||
for mapfile_segment in source_code_segments:
|
for mapfile_segment in source_code_segments:
|
||||||
for file in mapfile_segment:
|
for file in mapfile_segment:
|
||||||
|
|
Loading…
Reference in a new issue