mirror of
https://github.com/Virtual-World-RE/NeoGF.git
synced 2024-11-15 09:45:33 +01:00
Update gcmtest.py
This commit is contained in:
parent
37f28f0175
commit
ae15654732
27
gcmtest.py
27
gcmtest.py
|
@ -5,7 +5,7 @@ import os
|
|||
import shutil
|
||||
|
||||
|
||||
__version__ = "0.0.3"
|
||||
__version__ = "0.0.4"
|
||||
__author__ = "rigodron, algoflash, GGLinnk"
|
||||
__license__ = "MIT"
|
||||
__status__ = "developpement"
|
||||
|
@ -13,11 +13,13 @@ __status__ = "developpement"
|
|||
|
||||
##################################################
|
||||
# Set roms_path with your ROMs (at the root of the ROM folder)
|
||||
# Extract all files from file system using dolphin emu - put it in gcm_dolphin/root/
|
||||
# Extract boot.dol and apploader.img using dolphin emu - put it in gcm_dolphin/sys/
|
||||
# Extract all files from file system using dolphin emu - put it in f"{dolphin_unpack_path}/root/"
|
||||
# Extract boot.dol and apploader.img using dolphin emu - put it in f"{dolphin_unpack_path}/sys/"
|
||||
##################################################
|
||||
roms_path = Path("../ROM")
|
||||
dolphin_unpack_path = Path("dolphin_unpack")
|
||||
|
||||
# Created tmp paths
|
||||
unpack_path = Path("unpack")
|
||||
unpack2_path = Path("unpack2")
|
||||
repack_path = Path("repack")
|
||||
|
@ -48,7 +50,11 @@ def compare_sha256(file1_path:Path, file2_path:Path):
|
|||
# compare two GCM
|
||||
# -> raise an exception if there is a difference
|
||||
def verify_GCM_sha256(folder1: Path, folder2: Path):
|
||||
print(f"compare \"{folder1}\" - \"{folder2}\"")
|
||||
folder1_file_count = len(list(folder1.glob("**/*")))
|
||||
print(f"compare \"{folder1}\" - \"{folder2}\" ({folder1_file_count} files)")
|
||||
if folder1_file_count == 0:
|
||||
raise Exception(f"ERROR - EMPTY FOLDER: {folder1}")
|
||||
|
||||
len1 = len(folder1.parts)
|
||||
len2 = len(folder2.parts)
|
||||
# 1. Compare names of filesystems
|
||||
|
@ -75,10 +81,11 @@ print("# Checking tests folder")
|
|||
print("###############################################################################")
|
||||
# Check if tests folders exist
|
||||
if unpack_path.is_dir() or unpack2_path.is_dir() or repack_path.is_dir():
|
||||
raise Exception(f"Error - Please remove:\n-{unpack_path}\n-{unpack2_path}\n{repack_path}")
|
||||
raise Exception(f"Error - Please remove:\n-{unpack_path}\n-{unpack2_path}\n-{repack_path}")
|
||||
|
||||
print("###############################################################################")
|
||||
print("# Comparing unpacked ROMs with dolphin extracts")
|
||||
print("# TEST 1/3")
|
||||
print("# Comparing roms_path->unpack->[unpack_path] ROMs with [dolphin_unpack_path]")
|
||||
print("###############################################################################")
|
||||
# unpack ROM in unpack_path
|
||||
unpack_path.mkdir(parents=True)
|
||||
|
@ -92,7 +99,8 @@ for folder_path in unpack_path.glob("*"):
|
|||
verify_GCM_sha256(folder_path, dolphin_unpack_path / folder_path.name)
|
||||
|
||||
print("###############################################################################")
|
||||
print("# Comparing iso->[1:unpacked]->repacked->[2:unpacked]")
|
||||
print("# TEST 2/3")
|
||||
print("# Comparing [unpack_path]->pack->unpack->[unpack2_path]")
|
||||
print("###############################################################################")
|
||||
# repack unpack_path repack_path
|
||||
repack_path.mkdir()
|
||||
|
@ -117,7 +125,8 @@ for folder_path in unpack_path.glob("*"):
|
|||
shutil.rmtree(unpack2_path)
|
||||
|
||||
print("###############################################################################")
|
||||
print("# Comparing iso->[1:unpacked]->rebuild_fst->repack->[2:unpacked]")
|
||||
print("# TEST 3/3")
|
||||
print("# Comparing [unpack_path]->rebuild_fst->repack->unpack->[unpack2_path]")
|
||||
print("###############################################################################")
|
||||
# rebuild unpack_path FSTs
|
||||
for folder_path in unpack_path.glob("*"):
|
||||
|
@ -143,7 +152,7 @@ shutil.rmtree(repack_path)
|
|||
for folder_path in unpack_path.glob("*"):
|
||||
verify_GCM_sha256(folder_path, unpack2_path / folder_path.name)
|
||||
|
||||
# remove unpack_path unpack2_path
|
||||
# Remove tests folders
|
||||
print("###############################################################################")
|
||||
print(f"# Cleaning test folders.")
|
||||
print("###############################################################################")
|
||||
|
|
Loading…
Reference in New Issue
Block a user