예제 #1
0
            def getGamePathsHandler(requestData):
                id = requestData['id']
                selectedSubMods = [
                    self.idToSubMod[id]
                ] if id is not None else self.allSubModConfigs
                fullInstallConfigs, partiallyUninstalledPaths = gameScanner.scanForFullInstallConfigs(
                    selectedSubMods)
                fullInstallConfigHandles = []
                for fullConfig in fullInstallConfigs:
                    fullInstallConfigHandles.append({
                        'id':
                        fullConfig.subModConfig.id,
                        'modName':
                        fullConfig.subModConfig.modName,
                        'subModName':
                        fullConfig.subModConfig.subModName,
                        'path':
                        fullConfig.installPath,
                        'isSteam':
                        fullConfig.isSteam,
                    })

                return {
                    'fullInstallConfigHandles': fullInstallConfigHandles,
                    'partiallyUninstalledPaths':
                    partiallyUninstalledPaths,  # Game installs which have been partially uninstalled via Steam, but where some mod files still exist on disk
                }
예제 #2
0
def tryGetFullInstallConfig(subMod, installPath):
	# type: (SubModConfig, str) -> List[FullInstallConfiguration]
	fullInstallConfigs = None
	if os.path.isdir(installPath):
		fullInstallConfigs = gameScanner.scanForFullInstallConfigs([subMod], possiblePaths=[installPath])

	# If normal scan fails, then scan the path using the more in-depth 'scanUserSelectedPath(...)' function
	if not fullInstallConfigs:
		fullInstallConfigs, errorMessage = gameScanner.scanUserSelectedPath([subMod], installPath)
		print(errorMessage)

	return fullInstallConfigs
예제 #3
0
def askUserInstallPathGetFullInstallConfig():
    # type: () -> FullInstallConfiguration
    manualPathMarker = "Choose Path Manually"
    fullInstallConfigs, partiallyUninstalledPaths = gameScanner.scanForFullInstallConfigs(
        [subModToInstall])

    if partiallyUninstalledPaths:
        print(
            "-----------------------------------------------------------------"
        )
        print(
            "WARNING: The following games were uninstalled via Steam, but the mod files still remain on disk:"
        )
        for path in partiallyUninstalledPaths:
            print(" - {}".format(path))
        print(
            "Please manually delete these folders to free disk space and avoid problems with the installer."
        )
        print(
            "-----------------------------------------------------------------"
        )

    userAskYesNo("Have you read the above message?")

    _, installConfigIndex = userPickFromList(
        [x.installPath for x in fullInstallConfigs] + [manualPathMarker],
        "Please choose the game path to install to")

    if installConfigIndex < len(fullInstallConfigs):
        return fullInstallConfigs[installConfigIndex]
    else:
        # Ask the user where they want to install the game
        while True:
            installPath = input(
                "\n---- Please copy and paste the game path below ----\nIt should contain one of {}\nDO NOT include the quotation characters [\"] or ['] in your path!\nExample: C:\\Program Files\\Steam\\steamapps\\common\\Umineko (for Umineko Question Arcs)\n>>"
                .format(subModToInstall.identifiers))

            print("Validating [{}]".format(installPath))
            fullInstallConfigList = tryGetFullInstallConfig(
                subModToInstall, installPath)
            if fullInstallConfigList:
                return fullInstallConfigList[
                    0]  # type: FullInstallConfiguration
            else:
                print("---- Invalid game path, please try again ----")
예제 #4
0
 def getGamePathsHandler(requestData):
     id = requestData['id']
     selectedSubMods = [
         self.idToSubMod[id]
     ] if id is not None else self.allSubModConfigs
     fullInstallConfigs = gameScanner.scanForFullInstallConfigs(
         selectedSubMods)
     fullInstallConfigHandles = []
     for fullConfig in fullInstallConfigs:
         fullInstallConfigHandles.append({
             'id':
             fullConfig.subModConfig.id,
             'modName':
             fullConfig.subModConfig.modName,
             'subModName':
             fullConfig.subModConfig.subModName,
             'path':
             fullConfig.installPath,
             'isSteam':
             fullConfig.isSteam,
         })
     return fullInstallConfigHandles
예제 #5
0
    def try_start_install(self, subMod, installPath, validateOnly):
        #type: (installConfiguration.SubModConfig, str, bool) -> (bool, installConfiguration.FullInstallConfiguration)
        import higurashiInstaller
        import uminekoInstaller
        import uminekoNScripterInstaller

        fullInstallConfigs = None
        if os.path.isdir(installPath):
            fullInstallConfigs = gameScanner.scanForFullInstallConfigs(
                [subMod], possiblePaths=[installPath])

        # If normal scan fails, then scan the path using the more in-depth 'scanUserSelectedPath(...)' function
        if not fullInstallConfigs:
            fullInstallConfigs, errorMessage = gameScanner.scanUserSelectedPath(
                [subMod], installPath)
            print(errorMessage)

        if validateOnly:
            return (True,
                    fullInstallConfigs[0]) if fullInstallConfigs else (False,
                                                                       '')
        else:
            if not fullInstallConfigs:
                raise Exception(
                    "Can't start install - No game found for mod [{}] at [{}]".
                    format(subMod.modName, installPath))

        fullInstallSettings = fullInstallConfigs[0]

        installerFunction = {
            "higurashi": higurashiInstaller.main,
            "umineko": uminekoInstaller.mainUmineko,
            "umineko_nscripter": uminekoNScripterInstaller.main
        }.get(fullInstallSettings.subModConfig.family, None)

        if not installerFunction:
            raise Exception(
                "Error - Unknown Game Family - I don't know how to install [{}] family of games. Please notify 07th-mod developers."
                .format(fullInstallSettings.subModConfig.family))

        # Prevent accidentally starting two installations at once
        if self.installAlreadyInProgress():
            raise Exception("Can't start install - installer already running.")

        def errorPrintingInstaller(args):
            try:
                installerFunction(args)
            except Exception as e:
                print('{}{}'.format(
                    common.Globals().INSTALLER_MESSAGE_ERROR_PREFIX, e))
                raise
            common.tryDeleteLockFile()

        # This lock file allows the installer to detect if there is already an install in progress in a different instance of the program
        # This lock file method is not foolproof, but should handle most cases
        # It is cleaned up when the install finishes (even if the install was unsuccessful), but is NOT cleaned up
        # if the program was force closed.
        common.tryCreateLockFile()

        self.threadHandle = threading.Thread(target=errorPrintingInstaller,
                                             args=(fullInstallSettings, ))
        self.threadHandle.setDaemon(
            True)  # Use setter for compatability with Python 2
        self.threadHandle.start()

        return (True, fullInstallSettings)