Exemplo n.º 1
0
 def createDiff(meleeIsoConfigKey: str, isoMinorVersion: int):
     # Get the path and make sure it exists
     meleeIsoPath = build_config.getConfigValue(meleeIsoConfigKey, paths)
     if not meleeIsoPath:
         print("ISO for v1.0{} not specified, skipping patch for this file".
               format(isoMinorVersion))
         return True  # don't error, consider it successful
     if not path.exists(meleeIsoPath):
         print(
             "ISO for v1.0{} doesn't exist. Run configure again to specify. Skipping patch for this"
             .format(isoMinorVersion))
         return True  # don't error, consider it successful
     # Get patch destination path
     patchFileName = "SDR from 1.0{}.xdelta".format(isoMinorVersion)
     patchFilePath = build.getBuildPath(patchFileName)
     # Only create the patch if the ISO is newer than the last patch created
     if path.exists(patchFilePath) and path.getmtime(
             sdrIsoPath) <= path.getmtime(patchFilePath):
         print("Patch for ISO for v1.0{} already up to date".format(
             isoMinorVersion))
         return True  # This would create the same patch as before, so we're done
     else:
         print("Starting patching for v1.0{}...".format(isoMinorVersion))
         cliStr = '"{}" -e -s "{}" "{}" "{}"'.format(
             xdeltaPath, meleeIsoPath, sdrIsoPath, patchFilePath)
         result = subprocess.call(cliStr)
         if result > 0:
             print("Something went wrong making patch for ISO for v1.0{}".
                   format(isoMinorVersion))
             return False
         else:
             print("Patch for v1.0{} created at {}".format(
                 isoMinorVersion, patchFilePath))
             return True
Exemplo n.º 2
0
"""
Script that takes the configured Dolphin executable and runs the built SDR ISO, if it has been built.
exits with error if Dolphin path unspecified or invalid
exits with error if iso not built
"""

import build
import build_config
import subprocess

from os import path

# =============== #
# "MAIN FUNCTION" #
# =============== #
if __name__ == "__main__":
    paths = build_config.getOrCreatePathsConfigSection()
    dolphinPath = build_config.getConfigValue(build_config.DOLPHIN_PATH_KEY,
                                              paths)
    build_config.validatePath(dolphinPath, "Dolphin")

    sdrIsoPath = build.getBuildPath(build.ISO_FILENAME)
    if not path.exists(sdrIsoPath):
        print("SDR ISO has not been built. Run \"build iso\" to build an ISO")
        exit(1)

    subprocess.Popen([dolphinPath, "-b", "-e" + sdrIsoPath])
# =============== #
if __name__ == "__main__":
    # Get basic data
    buildTracker = build.BuildTracker()
    metadata, filesStructure, configFilePath = getAndValidateGameConfigSections(
    )
    shouldRebuild = buildTracker.hasFileChangedSinceLastBuild(configFilePath)

    # Setup/Verify build directories
    buildSystemDir = build.validateOrCreateBuildPath(build.SDR_FILES_DIR,
                                                     build.SYSDATA_FOLDER)
    buildFilesDir = path.normpath(path.join(buildSystemDir, ".."))
    tocPath = path.join(buildSystemDir,
                        GAME_TOC_FILENAME)  # Path of TOC to build to

    origSystemDataPath = path.join(build.getBuildPath(),
                                   build.ORIG_SYSDATA_FOLDER)
    if not path.isdir(origSystemDataPath):
        print("Melee ISO extraction corrupted. Clean and build again.")
        exit(1)

    # ======================== #
    # Build Game.toc (the FST) #
    # ======================== #
    fst = FileSystemTable(path.join(origSystemDataPath, GAME_TOC_FILENAME))

    # Get filenames in SDR that oren't in Melee
    sdrOnlyFilenames = []  # Running list of files unique to SDR
    for filename in listdir(buildFilesDir):  # All files SDR replaces
        if path.isdir(path.join(buildFilesDir,
                                filename)):  # Only deal with files, not dirs
Exemplo n.º 4
0
                if copyDirectory(sourceFilePath, destFilePath):
                    copied = True
        else:
            if not path.exists(destFilePath) or path.getmtime(
                    sourceFilePath) != path.getmtime(destFilePath):
                shutil.copy2(sourceFilePath, destFilePath)
                copied = True
    return copied


# =============== #
# "MAIN FUNCTION" #
# =============== #
if __name__ == "__main__":
    # Get and validate directories
    meleeFilesDir = build.getBuildPath(build.MELEE_FILES_DIR)
    build.validateDirectory(meleeFilesDir)
    sdrFilesDir = build.getBuildPath(build.SDR_FILES_DIR)
    build.validateDirectory(sdrFilesDir)
    buildIsoPath = build.getBuildPath(build.ISO_FILENAME)

    # Go through all the SDR Files, copy any changed files
    print("Attempting to copy SDR files...")
    if not copyDirectory(sdrFilesDir,
                         meleeFilesDir) and path.exists(buildIsoPath):
        print("No files change, no need to rebuild")
        exit(0)  # Considered success
    print("Files copied successfully")

    # Build the ISO
    paths = Config.getOrCreatePathsConfigSection()