Пример #1
0
    def runFBA(self, quark):
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit("ERROR: make sure ggpofba-ng.exe is in the same folder as FightCade")
            return
        args = []
        fba=self.fba
        if IS_WINDOWS:
            fba=fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        fbaini = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'config', 'ggpofba-ng.ini')
        fbadat = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), 'config', 'ggpofba-ng.roms.dat')
        fbainibkp = os.path.join(os.path.abspath(os.path.expanduser("~")), 'ggpofba-ng.bkp.ini')

        if not os.path.isfile(fbaini):
            self.createFbaIni()

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args, shell=True)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) + "\n" + repr(ex))
Пример #2
0
    def runFBA(self, quark):
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit("Please configure Setting > Locate ggpofba-ng.exe")
            return
        args = []
        fba=self.fba
        if IS_WINDOWS:
            fba=fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) + "\n" + repr(ex))
Пример #3
0
 def GetChallengeSoundFile(name):
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets", name+"-challenge.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "assets", name+"-challenge.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #4
0
 def checkInstallation(self):
     fba = findFba()
     if fba and os.path.isfile(fba):
         self.fba = os.path.abspath(fba)
     if self.fba:
         return True
     else:
         self.sigStatusMessage.emit("ERROR: ggpofba-ng not found in fightcade folder: you will not be able to play or spectate!")
         return False
Пример #5
0
 def notifyfile():
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets", "notify.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "assets", "notify.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #6
0
 def checkInstallation(self):
     fba = findFba()
     if fba and os.path.isfile(fba):
         self.fba = os.path.abspath(fba)
     if self.fba:
         return True
     else:
         self.sigStatusMessage.emit("ERROR: ggpofba-ng.exe not found in fightcade folder: you will not be able to play or spectate! Did you extract FightCade from the zip before running it?")
         return False
Пример #7
0
 def checkInstallation(self):
     fba = findFba()
     if fba and os.path.isfile(fba):
         self.fba = os.path.abspath(fba)
     if self.fba:
         return True
     else:
         self.sigStatusMessage.emit("ERROR: ggpofba-ng.exe not found in fightcade folder: you will not be able to play or spectate! Did you extract FightCade from the zip before running it?")
         return False
Пример #8
0
 def notifyfile():
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets",
                                 "notify.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                             "assets", "notify.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #9
0
 def wavfile():
     filename = Settings.value(Settings.CUSTOM_CHALLENGE_SOUND_LOCATION)
     if filename and os.path.isfile(filename):
         return filename
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets", "challenger-comes.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "assets", "challenger-comes.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #10
0
 def GetChallengeSoundFile(name):
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets",
                                 name + "-challenge.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(
         os.path.abspath(os.path.dirname(sys.argv[0])), "assets",
         name + "-challenge.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #11
0
    def runFBA(self, quark):
        if "served" in quark:
            self.killEmulator()
            self.killPuncher()
            time.sleep(2)
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit(
                "ERROR: make sure ggpofba-ng.exe is in the same folder as FightCade"
            )
            return
        args = []
        fba = self.fba
        if IS_WINDOWS:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        fbaini = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                              'config', 'ggpofba-ng.ini')
        fbadat = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                              'config', 'ggpofba-ng.roms.dat')
        fbainibkp = os.path.join(os.path.abspath(os.path.expanduser("~")),
                                 'ggpofba-ng.bkp.ini')

        if not os.path.isfile(fbaini):
            self.createFbaIni()

        logdebug().info(" ".join(args))

        if Settings.value(Settings.COMPOSITION_DISABLED):
            self.desktopComposition(0)

        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args, shell=True)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) +
                                       "\n" + repr(ex))

        # backup FBA settings
        if os.path.isfile(fbaini) and os.path.isfile(fbadat):
            copyfile(fbaini, fbainibkp)
Пример #12
0
 def wavfile():
     filename = Settings.value(Settings.CUSTOM_CHALLENGE_SOUND_LOCATION)
     if filename and os.path.isfile(filename):
         return filename
     fba = findFba()
     if fba:
         filename = os.path.join(os.path.dirname(fba), "assets",
                                 "sf2-challenge.wav")
         if os.path.isfile(filename):
             return filename
     filename = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                             "assets", "sf2-challenge.wav")
     if filename and os.path.isfile(filename):
         return filename
Пример #13
0
    def runFBA(self, quark):
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit("ERROR: make sure ggpofba-ng.exe is in the same folder as FightCade")
            return
        args = []
        fba=self.fba
        if IS_WINDOWS:
            fba=fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        # if dat file doesn't exist, restore FBA settings from backup
        fbaini = os.path.join(os.path.dirname(self.fba), 'config', 'ggpofba-ng.ini')
        fbadat = os.path.join(os.path.dirname(self.fba), 'config', 'ggpofba-ng.roms.dat')
        fbainibkp = os.path.join(os.path.abspath(os.path.expanduser("~")), 'ggpofba-ng.bkp.ini')
        if not os.path.isfile(fbadat) and os.path.isfile(fbainibkp):
            self.sigStatusMessage.emit("Restoring emulator settings")
            copyfile(fbainibkp, fbaini)

            #on linux & MAC, symlink the ROMs folder to avoid configuring FBA
            if not IS_WINDOWS:
                romdir=Settings.value(Settings.ROMS_DIR)
                if romdir:
                    fbaRomPath = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "ROMs")
                    # remove it if it's a link or an empty dir
                    if os.path.islink(fbaRomPath):
                        os.remove(fbaRomPath)
                    if os.path.isdir(fbaRomPath) and not os.listdir(fbaRomPath):
                        os.rmdir(fbaRomPath)
                    if not os.path.exists(fbaRomPath):
                        os.symlink(romdir, fbaRomPath)

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args, shell=True)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) + "\n" + repr(ex))
Пример #14
0
    def runFBA(self, quark):
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit(
                "ERROR: make sure ggpofba-ng.exe is in the same folder as FightCade"
            )
            return
        args = []
        fba = self.fba
        if IS_WINDOWS:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        fbaini = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                              'config', 'ggpofba-ng.ini')
        fbadat = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
                              'config', 'ggpofba-ng.roms.dat')
        fbainibkp = os.path.join(os.path.abspath(os.path.expanduser("~")),
                                 'ggpofba-ng.bkp.ini')

        if not os.path.isfile(fbaini):
            self.createFbaIni()

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args, shell=True)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) +
                                       "\n" + repr(ex))
Пример #15
0
    def runFBA(self, quark):
        self.checkRom()
        self.fba = findFba()
        if not self.fba:
            self.sigStatusMessage.emit(
                "ERROR: make sure ggpofba-ng.exe is in the same folder as FightCade"
            )
            return
        args = []
        fba = self.fba
        if IS_WINDOWS:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.exe')
        else:
            fba = fba.replace('ggpofba-ng.exe', 'ggpofba.sh')
        args = [fba, quark, '-w']

        fbaini = os.path.join(os.path.dirname(self.fba), 'config',
                              'ggpofba-ng.ini')
        fbadat = os.path.join(os.path.dirname(self.fba), 'config',
                              'ggpofba-ng.roms.dat')
        fbainibkp = os.path.join(os.path.abspath(os.path.expanduser("~")),
                                 'ggpofba-ng.bkp.ini')
        fbainidef = os.path.join(os.path.dirname(self.fba), 'config',
                                 'ggpofba-ng.default.ini')
        # if dat file doesn't exist, restore FBA settings from backup
        if not os.path.isfile(fbadat) and os.path.isfile(fbainibkp):
            self.sigStatusMessage.emit(
                "Trying to restore emulator config. If game doesn't start do Settings -> Locate ROMs folder."
            )
            copyfile(fbainibkp, fbaini)

        # if dat file doesn't exist and there was no backup, use the default FBA config
        if not os.path.isfile(fbadat) and not os.path.isfile(
                fbaini) and not os.path.isfile(fbainibkp) and os.path.isfile(
                    fbainidef):
            copyfile(fbainidef, fbaini)

            #on linux & MAC, symlink the ROMs folder to avoid configuring FBA
            if not IS_WINDOWS:
                romdir = Settings.value(Settings.ROMS_DIR)
                if romdir:
                    fbaRomPath = os.path.join(
                        os.path.abspath(os.path.dirname(sys.argv[0])), "ROMs")
                    # remove it if it's a link or an empty dir
                    if os.path.islink(fbaRomPath):
                        os.remove(fbaRomPath)
                    if os.path.isdir(
                            fbaRomPath) and not os.listdir(fbaRomPath):
                        os.rmdir(fbaRomPath)
                    if not os.path.exists(fbaRomPath):
                        os.symlink(romdir, fbaRomPath)

        logdebug().info(" ".join(args))
        try:
            # starting python from cmd.exe and redirect stderr and we got
            # python WindowsError(6, 'The handle is invalid')
            # apparently it's still not fixed
            if IS_WINDOWS:
                Popen(args, shell=True)
            else:
                devnull = open(os.devnull, 'w')
                Popen(args, stdout=devnull, stderr=devnull)
                devnull.close()
        except OSError, ex:
            self.sigStatusMessage.emit("Error executing " + " ".join(args) +
                                       "\n" + repr(ex))