Пример #1
0
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             # Check whether this is a release binary being run from an svn/git
             # working copy or whether this is an svn/git binary not being run
             # from an corresponding working copy.
             currentVcs, buildVcs = None, None
             if VFS.isdir('/gameroot/.git'):
                 currentVcs = 'git'
             elif VFS.isdir('/gameroot/src/.svn'):
                 currentVcs = 'Subversion'
             if 'git' in Version.version():
                 buildVcs = 'git'
             elif 'svn' in Version.version():
                 buildVcs = 'Subversion'
             if currentVcs != buildVcs:
                 if buildVcs is None:
                     msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                           '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                           '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 else:
                     msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                           '\n\nhttp://code.google.com/p/fofix/'
                 Dialogs.showMessage(
                     self.engine, msg % {
                         'buildVcs': buildVcs,
                         'currentVcs': currentVcs
                     })
Пример #2
0
def deletePlayer(player):
    _playerDB.execute('DELETE FROM `players` WHERE `name` = ?', [player])
    VFS.unlink(_makePlayerIniName(player))
    if VFS.isfile('%s/%s.png' % (playerpath, player)):
        VFS.unlink('%s/%s.png' % (playerpath, player))
    savePlayers()
    loadPlayers()
Пример #3
0
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             # Check whether this is a release binary being run from an svn/git
             # working copy or whether this is an svn/git binary not being run
             # from an corresponding working copy.
             currentVcs, buildVcs = None, None
             if VFS.isdir('/gameroot/.git'):
                 currentVcs = 'git'
             elif VFS.isdir('/gameroot/src/.svn'):
                 currentVcs = 'Subversion'
             if 'git' in Version.version():
                 buildVcs = 'git'
             elif 'svn' in Version.version():
                 buildVcs = 'Subversion'
             if currentVcs != buildVcs:
                 if buildVcs is None:
                     msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                           '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                           '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 else:
                     msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                           '\n\nhttp://code.google.com/p/fofix/'
                 Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
Пример #4
0
def deleteControl(control):
    VFS.unlink(_makeControllerIniName(control))
    defaultUsed = -1
    for i in range(4):
        get = Config.get("game", "control%d" % i)
        if get == control:
            if i == 0:
                Config.set("game", "control%d" % i, "defaultg")
                defaultUsed = 0
            else:
                Config.set("game", "control%d" % i, None)
        if get == "defaultg" and defaultUsed > -1:
            Config.set("game", "control%d" % i, None)
    loadControls()
Пример #5
0
    def __init__(self, prototype, fileName = None, type = 0):
        """
        @param prototype:  The configuration prototype mapping
        @param fileName:   The file that holds this configuration registry
        """
        self.prototype = prototype

        # read configuration
        self.config = MyConfigParser()

        if fileName:
            if not os.path.isfile(fileName):
                path = VFS.getWritableResourcePath()
                fileName = os.path.join(path, fileName)
            self.config.read(fileName)

        self.fileName  = fileName
        self.type = type

        # fix the defaults and non-existing keys
        for section, options in prototype.items():
            if not self.config.has_section(section):
                self.config.add_section(section)
            for option in options.keys():
                type    = options[option].type
                default = options[option].default
                if not self.config.has_option(section, option):
                    self.config.set(section, option, str(default))
Пример #6
0
def loadControls():
    global controllerDict
    controllers = []
    allcontrollers = VFS.listdir(controlpath)
    default = ["defaultd.ini", "defaultg.ini", "defaultm.ini"]
    for name in allcontrollers:
        if name.lower().endswith(".ini") and len(name) > 4:
            if name in default:
                continue
            controllers.append(name[0:len(name)-4])

    i = len(controllers)
    controllerDict = dict([(str(controllers[n]),controllers[n]) for n in range(0, i)])
    controllerDict["defaultg"] = _("Default Guitar")
    controllerDict["defaultd"] = _("Default Drum")
    defMic = None
    if Microphone.supported:
        controllerDict["defaultm"] = _("Default Microphone")
        defMic = "defaultm"
    tsControl    = _("Controller %d")
    tsControlTip = _("Select the controller for slot %d")
    i = 1
    Config.define("game", "control0",           str,   "defaultg", text = tsControl % 1,                options = controllerDict, tipText = tsControlTip % 1)

    controllerDict[_("None")] = None

    Config.define("game", "control1",           str,   "defaultd", text = tsControl % 2,                options = controllerDict, tipText = tsControlTip % 2)
    Config.define("game", "control2",           str,   defMic,     text = tsControl % 3,                options = controllerDict, tipText = tsControlTip % 3)
    Config.define("game", "control3",           str,   None,       text = tsControl % 4,                options = controllerDict, tipText = tsControlTip % 4)
Пример #7
0
def updatePlayer(player, pref):
    a = _playerDB.execute('SELECT * FROM `players` WHERE `name` = ?', [player]).fetchone()
    try:
        a = a[0]
    except:
        a = None
    if a is not None:
        _playerDB.execute('UPDATE `players` SET `name` = ?, `lefty` = ?, `drumflip` = ?, `autokick` = ?, `assist` = ?, `twochord` = ?, `necktype` = ?, `neck` = ?, \
                       `part` = 0, `difficulty` = 2, `upname` = ?, `control` = 0, `changed` = 1, `loaded` = 1 WHERE `name` = ?', pref + [player])
        if player != pref[0]:
            VFS.rename(_makePlayerIniName(player), _makePlayerIniName(pref[0]))
    else:
        _playerDB.execute('INSERT INTO `players` VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, 2, ?, 0, 1, 1)', pref)
    _playerDB.commit()
    savePlayers()
    loadPlayers()
Пример #8
0
def loadPlayers():
    global playername, playerpref, playerstat
    playername = []
    playerpref = []
    playerstat = []
    allplayers = VFS.listdir(playerpath)
    for name in allplayers:
        if name == "default.ini":
            continue
        if name.lower().endswith(".ini") and len(name) > 4:
            playername.append(name[0:len(name)-4])
            pref = _playerDB.execute('SELECT * FROM `players` WHERE `name` = ?', [playername[-1]]).fetchone()
            try:
                if len(pref) == 14:
                    playerpref.append((pref[1], pref[2], pref[3], pref[4], pref[5], pref[6], pref[7], pref[8], pref[9], pref[10]))
            except TypeError:
                try:
                    c = Config.load(VFS.resolveRead(_makePlayerIniName(name[:-4])), type = 2)
                    lefty  = c.get("player","leftymode")
                    drumf  = c.get("player","drumflip")
                    autok  = c.get("player","auto_kick")
                    assist = c.get("player","assist_mode")
                    twoch  = c.get("player","two_chord_max")
                    neck   = c.get("player","neck")
                    neckt  = c.get("player","necktype")
                    part   = c.get("player","part")
                    diff   = c.get("player","difficulty")
                    upname = c.get("player","name")
                    control= c.get("player","controller")
                    del c
                    _playerDB.execute('INSERT INTO `players` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, 1)', [playername[-1], lefty, drumf, autok, assist, twoch, neckt, neck, part, diff, upname, control])
                    playerpref.append((lefty, drumf, autok, assist, twoch, neckt, neck, part, diff, upname))
                except IOError:
                    _playerDB.execute('INSERT INTO `players` VALUES (?, 0, 0, 0, 0, 0, 0, ``, 0, 2, ``, 0, 0, 1)', [playername[-1]])
                    playerpref.append((0, 0, 0, 0, 0, 0, '', 0, 2, '', 0))
            _playerDB.execute('UPDATE `players` SET `loaded` = 1 WHERE `name` = ?', [playername[-1]])
            _playerDB.commit()
    return 1
Пример #9
0
def savePlayers():
    for pref in _playerDB.execute('SELECT * FROM `players` WHERE `changed` = 1').fetchall():
        try:
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
        except:
            c = VFS.open(_makePlayerIniName(str(pref[0])), "w")
            c.close()
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
    _playerDB.execute('UPDATE `players` SET `loaded` = 0')
    _playerDB.commit()
Пример #10
0
def _getTagLine():
    from util import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        shortref = None
        headhash = None

        # HEAD is in the form "ref: refs/heads/master\n" if a branch is
        # checked out, or just the hash if HEAD is detached.
        refline = VFS.open('/gameroot/.git/HEAD').read().strip()

        if refline[0:5] == "ref: ":
            headref = refline[5:]
            if VFS.isfile('/gameroot/.git/' + headref):
                # The ref is in the form "sha1-hash\n"
                headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
            else:
                # It's a packed ref.
                for line in VFS.open('/gameroot/.git/packed-refs'):
                    if line.strip().endswith(headref):
                        headhash = line[:40]
                        break
            shortref = re.sub('^refs/(heads/)?', '', headref)
        else:
            shortref = "(detached)"
            headhash = refline

        return 'development (git %s %s)' % (shortref or "(unknown)", headhash
                                            and headhash[:7] or "(unknown)")

    # Look for the svn administrative directory.
    elif VFS.isdir('/gameroot/src/.svn'):
        revision = VFS.open(
            '/gameroot/src/.svn/entries').readlines()[3].strip()
        return 'development (svn r%s)' % revision

    else:
        return None
Пример #11
0
def _getTagLine():
    from util import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        shortref = None
        headhash = None

        # HEAD is in the form "ref: refs/heads/master\n" if a branch is
        # checked out, or just the hash if HEAD is detached.
        refline = VFS.open('/gameroot/.git/HEAD').read().strip()

        if refline[0:5] == "ref: ":
            headref = refline[5:]
            if VFS.isfile('/gameroot/.git/' + headref):
                # The ref is in the form "sha1-hash\n"
                headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
            else:
                # It's a packed ref.
                for line in VFS.open('/gameroot/.git/packed-refs'):
                    if line.strip().endswith(headref):
                        headhash = line[:40]
                        break
            shortref = re.sub('^refs/(heads/)?', '', headref)
        else:
            shortref = "(detached)"
            headhash = refline

        return 'development (git %s %s)' % (shortref or "(unknown)",
                                            headhash and headhash[:7] or "(unknown)")

    # Look for the svn administrative directory.
    elif VFS.isdir('/gameroot/src/.svn'):
        revision = VFS.open('/gameroot/src/.svn/entries').readlines()[3].strip()
        return 'development (svn r%s)' % revision

    else:
        return None
Пример #12
0
    def __init__(self):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("Controls class init (Player.py)...")
        self.controls = []
        self.controls.append(Config.get("game", "control0"))
        self.controls.append(Config.get("game", "control1"))
        self.controls.append(Config.get("game", "control2"))
        self.controls.append(Config.get("game", "control3"))
        self.config = []
        self.controlList = []
        self.maxplayers = 0
        self.guitars    = 0
        self.drums      = 0
        self.mics       = 0
        self.overlap    = []

        self.p2Nav = Config.get("game", "p2_menu_nav")
        self.drumNav = Config.get("game", "drum_navigation")

        self.keyCheckerMode = Config.get("game","key_checker_mode")

        if VFS.isfile(_makeControllerIniName(self.controls[0])):
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[0])), type = 1))
            if VFS.isfile(_makeControllerIniName(self.controls[1])) and self.controls[1] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[1])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control1", None)
                self.controls[1] = "None"
            if VFS.isfile(_makeControllerIniName(self.controls[2])) and self.controls[2] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[2])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control2", None)
                self.controls[2] = "None"
            if VFS.isfile(_makeControllerIniName(self.controls[3])) and self.controls[3] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[3])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control3", None)
                self.controls[3] = "None"
        else:
            confM = None
            if Microphone.supported:
                confM = Config.load(VFS.resolveRead(_makeControllerIniName("defaultm")), type = 1)
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName("defaultg")), type = 1))
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName("defaultd")), type = 1))
            self.config.append(confM)
            self.config.append(None)
            Config.set("game", "control0", "defaultg")
            Config.set("game", "control1", "defaultd")
            self.controls = ["defaultg", "defaultd"]
            if confM is not None:
                Config.set("game", "control2", "defaultm")
                self.controls.append("defaultm")
            else:
                Config.set("game", "control2", None)
                self.controls.append("None")
            Config.set("game", "control3", None)
            self.controls.append("None")

        self.type       = []
        self.analogKill = []
        self.analogSP   = []
        self.analogSPThresh = []
        self.analogSPSense  = []
        self.analogDrum = [] #FIXME: Analog Drum
        self.analogSlide = []
        self.analogFX   = [] #FIXME: Analog FX
        self.twoChord   = []
        self.micDevice  = []  #stump
        self.micTapSensitivity = []
        self.micPassthroughVolume = []

        self.flags = 0

        for i in self.config:
            if i:
                type = i.get("controller", "type")
                if type == 5:
                    self.mics += 1
                elif type > 1:
                    self.guitars += 1
                else:
                    self.drums += 1
                self.type.append(type)
                self.analogKill.append(i.get("controller", "analog_kill"))
                self.analogSP.append(i.get("controller", "analog_sp"))
                self.analogSPThresh.append(i.get("controller", "analog_sp_threshold"))
                self.analogSPSense.append(i.get("controller", "analog_sp_sensitivity"))
                self.analogDrum.append(i.get("controller", "analog_drum")) #FIXME: Analog Drum
                self.analogSlide.append(i.get("controller", "analog_slide"))
                self.analogFX.append(i.get("controller", "analog_fx")) #FIXME: Analog FX
                self.micDevice.append(i.get("controller", "mic_device"))  #stump
                self.micTapSensitivity.append(i.get("controller", "mic_tap_sensitivity"))
                self.micPassthroughVolume.append(i.get("controller", "mic_passthrough_volume"))
                self.twoChord.append(i.get("controller", "two_chord_max"))
                self.controlList.append(i.get("controller", "name"))
            else:
                self.type.append(None)
                self.analogKill.append(None)
                self.analogSP.append(None)
                self.analogFX.append(None) #FIXME: Analog FX
                self.twoChord.append(None)

        def keycode(name, config):
            if not config:
                return "None"
            k = config.get("controller", name)
            if k == "None":
                return "None"
            try:
                return int(k)
            except:
                return getattr(pygame, k)

        self.controlMapping = {}
        global menuUp, menuDown, menuNext, menuPrev, menuYes, menuNo
        global drum1s, drum2s, drum3s, drum4s, drum5s, bassdrums
        global key1s, key2s, key3s, key4s, key5s, keysolos, action1s, action2s, kills
        menuUp = []
        menuDown = []
        menuNext = []
        menuPrev = []
        menuYes = []
        menuNo = []
        drum1s = []
        drum2s = []
        drum3s = []
        drum4s = []
        drum5s = []
        bassdrums = []
        key1s = []
        key2s = []
        key3s = []
        key4s = []
        key5s = []
        keysolos = []
        action1s = []
        action2s = []
        kills = []

        for i, config in enumerate(self.config):
            if self.type[i] in DRUMTYPES: #drum set
                drum1s.extend([CONTROLS[i][DRUM1], CONTROLS[i][DRUM1A]])
                drum2s.extend([CONTROLS[i][DRUM2], CONTROLS[i][DRUM2A]])
                drum3s.extend([CONTROLS[i][DRUM3], CONTROLS[i][DRUM3A]])
                drum4s.extend([CONTROLS[i][DRUM4], CONTROLS[i][DRUM4A]])
                drum5s.extend([CONTROLS[i][DRUM5], CONTROLS[i][DRUM5A]])
                bassdrums.extend([CONTROLS[i][DRUMBASS], CONTROLS[i][DRUMBASSA]])
                if self.p2Nav == 1 or (self.p2Nav == 0 and i == 0):
                    if self.drumNav:
                        menuUp.extend([CONTROLS[i][DRUM2], CONTROLS[i][DRUM2A]])
                        if self.type[i] == 3:
                            menuDown.extend([CONTROLS[i][DRUM4], CONTROLS[i][DRUM4A]])
                        else:
                            menuDown.extend([CONTROLS[i][DRUM3], CONTROLS[i][DRUM3A]])
                        menuYes.extend([CONTROLS[i][DRUM5], CONTROLS[i][DRUM5A]])
                        menuNo.extend([CONTROLS[i][DRUM1], CONTROLS[i][DRUM1A]])
                    menuYes.append(CONTROLS[i][START])
                    menuNo.append(CONTROLS[i][CANCEL])
                    menuUp.append(CONTROLS[i][UP])
                    menuDown.append(CONTROLS[i][DOWN])
                    menuNext.append(CONTROLS[i][RIGHT])
                    menuPrev.append(CONTROLS[i][LEFT])
            elif self.type[i] in MICTYPES:  #stump: it's a mic
                if self.p2Nav == 1 or (self.p2Nav == 0 and i == 0):
                    menuUp.append(CONTROLS[i][UP])
                    menuDown.append(CONTROLS[i][DOWN])
                    menuNext.append(CONTROLS[i][RIGHT])
                    menuPrev.append(CONTROLS[i][LEFT])
                    menuYes.append(CONTROLS[i][START])
                    menuNo.append(CONTROLS[i][CANCEL])
            elif self.type[i] in GUITARTYPES:
                if self.type[i] == 0:
                    key1s.extend([CONTROLS[i][KEY1], CONTROLS[i][KEY1A]])
                else:
                    key1s.extend([CONTROLS[i][KEY1]])
                key2s.extend([CONTROLS[i][KEY2], CONTROLS[i][KEY2A]])
                key3s.extend([CONTROLS[i][KEY3], CONTROLS[i][KEY3A]])
                key4s.extend([CONTROLS[i][KEY4], CONTROLS[i][KEY4A]])
                key5s.extend([CONTROLS[i][KEY5], CONTROLS[i][KEY5A]])
                keysolos.extend([CONTROLS[i][KEY1A], CONTROLS[i][KEY2A], CONTROLS[i][KEY3A], CONTROLS[i][KEY4A], CONTROLS[i][KEY5A]])
                action1s.extend([CONTROLS[i][ACTION1]])
                action2s.extend([CONTROLS[i][ACTION2]])
                kills.extend([CONTROLS[i][KILL]])
                if self.p2Nav == 1 or (self.p2Nav == 0 and i == 0):
                    menuUp.extend([CONTROLS[i][ACTION1], CONTROLS[i][UP]])
                    menuDown.extend([CONTROLS[i][ACTION2], CONTROLS[i][DOWN]])
                    menuNext.extend([CONTROLS[i][RIGHT], CONTROLS[i][KEY4], CONTROLS[i][KEY4A]])
                    menuPrev.extend([CONTROLS[i][LEFT], CONTROLS[i][KEY3], CONTROLS[i][KEY3A]])
                    menuYes.extend([CONTROLS[i][KEY1], CONTROLS[i][KEY1A], CONTROLS[i][START]])
                    menuNo.extend([CONTROLS[i][KEY2], CONTROLS[i][KEY2A], CONTROLS[i][CANCEL]])

            if self.type[i] == 3:
                controlMapping = { #akedrou - drums do not need special declarations!
                  keycode("key_left", config):          CONTROLS[i][LEFT],
                  keycode("key_right", config):         CONTROLS[i][RIGHT],
                  keycode("key_up", config):            CONTROLS[i][UP],
                  keycode("key_down", config):          CONTROLS[i][DOWN],
                  keycode("key_star", config):          CONTROLS[i][STAR],
                  keycode("key_cancel", config):        CONTROLS[i][CANCEL],
                  keycode("key_1a", config):            CONTROLS[i][DRUM5A], #order is important. This minimizes key conflicts.
                  keycode("key_2a", config):            CONTROLS[i][DRUM1A],
                  keycode("key_3a", config):            CONTROLS[i][DRUM2A],
                  keycode("key_4a", config):            CONTROLS[i][DRUM3A],
                  keycode("key_5a", config):            CONTROLS[i][DRUM4A],
                  keycode("key_action2", config):       CONTROLS[i][DRUMBASSA],
                  keycode("key_1", config):             CONTROLS[i][DRUM5],
                  keycode("key_2", config):             CONTROLS[i][DRUM1],
                  keycode("key_3", config):             CONTROLS[i][DRUM2],
                  keycode("key_4", config):             CONTROLS[i][DRUM3],
                  keycode("key_5", config):             CONTROLS[i][DRUM4],
                  keycode("key_action1", config):       CONTROLS[i][DRUMBASS],
                  keycode("key_start", config):         CONTROLS[i][START],
                }
            elif self.type[i] == 2:
                controlMapping = { #akedrou - drums do not need special declarations!
                  keycode("key_left", config):          CONTROLS[i][LEFT],
                  keycode("key_right", config):         CONTROLS[i][RIGHT],
                  keycode("key_up", config):            CONTROLS[i][UP],
                  keycode("key_down", config):          CONTROLS[i][DOWN],
                  keycode("key_star", config):          CONTROLS[i][STAR],
                  keycode("key_cancel", config):        CONTROLS[i][CANCEL],
                  keycode("key_1a", config):            CONTROLS[i][DRUM5A], #order is important. This minimizes key conflicts.
                  keycode("key_2a", config):            CONTROLS[i][DRUM1A],
                  keycode("key_3a", config):            CONTROLS[i][DRUM2A],
                  keycode("key_4a", config):            CONTROLS[i][DRUM3A],
                  keycode("key_action2", config):       CONTROLS[i][DRUMBASSA],
                  keycode("key_1", config):             CONTROLS[i][DRUM5],
                  keycode("key_2", config):             CONTROLS[i][DRUM1],
                  keycode("key_3", config):             CONTROLS[i][DRUM2],
                  keycode("key_4", config):             CONTROLS[i][DRUM3],
                  keycode("key_action1", config):       CONTROLS[i][DRUMBASS],
                  keycode("key_start", config):         CONTROLS[i][START],
                }
            elif self.type[i] > -1:
                controlMapping = { #akedrou - drums do not need special declarations!
                  keycode("key_left", config):          CONTROLS[i][LEFT],
                  keycode("key_right", config):         CONTROLS[i][RIGHT],
                  keycode("key_up", config):            CONTROLS[i][UP],
                  keycode("key_down", config):          CONTROLS[i][DOWN],
                  keycode("key_cancel", config):        CONTROLS[i][CANCEL],
                  keycode("key_star", config):          CONTROLS[i][STAR],
                  keycode("key_kill", config):          CONTROLS[i][KILL],
                  keycode("key_1a", config):            CONTROLS[i][KEY1A], #order is important. This minimizes key conflicts.
                  keycode("key_2a", config):            CONTROLS[i][KEY2A],
                  keycode("key_3a", config):            CONTROLS[i][KEY3A],
                  keycode("key_4a", config):            CONTROLS[i][KEY4A],
                  keycode("key_5a", config):            CONTROLS[i][KEY5A],
                  keycode("key_1", config):             CONTROLS[i][KEY1],
                  keycode("key_2", config):             CONTROLS[i][KEY2],
                  keycode("key_3", config):             CONTROLS[i][KEY3],
                  keycode("key_4", config):             CONTROLS[i][KEY4],
                  keycode("key_5", config):             CONTROLS[i][KEY5],
                  keycode("key_action2", config):       CONTROLS[i][ACTION2],
                  keycode("key_action1", config):       CONTROLS[i][ACTION1],
                  keycode("key_start", config):         CONTROLS[i][START],
                }
            else:
                controlMapping = {}
            controlMapping = self.checkMapping(controlMapping, i)
            self.controlMapping.update(controlMapping)

        self.reverseControlMapping = dict((value, key) for key, value in self.controlMapping.iteritems() )

        # Multiple key support
        self.heldKeys = {}
Пример #13
0
def renameControl(control, newname):
    VFS.rename(_makeControllerIniName(control), _makeControllerIniName(newname))
    for i in range(4):
        if Config.get("game", "control%d" % i) == control:
            Config.set("game", "control%d" % i, newname)
    loadControls()
Пример #14
0
Config.define("controller", "mic_passthrough_volume", float, 0.0, text = _("Passthrough Volume"), options=dict((n / 100.0, n) for n in range(101)), tipText = _("Sets how loud you hear yourself singing.")) #stump

Config.define("player", "name",          str,  "")
Config.define("player", "difficulty",    int,  Song.MED_DIF)
Config.define("player", "part",          int,  Song.GUITAR_PART)
Config.define("player", "neck",          str,  "")
Config.define("player", "necktype",      str,  2, text = _("Neck Type"),     options = {0: _("Default Neck"), 1: _("Theme Neck"), 2: _("Specific Neck")})
Config.define("player", "leftymode",     int,  0, text = _("Lefty Mode"),    options = {0: _("Off"), 1: _("On")})
Config.define("player", "drumflip",      int,  0, text = _("Drum Flip"),     options = {0: _("Off"), 1: _("On")})
Config.define("player", "two_chord_max", int,  0, text = _("Two-Chord Max"), options = {0: _("Off"), 1: _("On")})
Config.define("player", "assist_mode",   int,  0, text = _("Assist Mode"),   options = {0: _("Off"), 1: _("Easy Assist"), 2: _("Medium Assist")})
Config.define("player", "auto_kick",     int,  0, text = _("Auto Kick"),     options = {0: _("Off"), 1: _("On")})
Config.define("player", "controller",    int,  0)

# Overlay the users folder in /data with one in the user data folder.
VFS.mount(VFS.resolveRead('/data/users'), 'users')
VFS.mountWritable(VFS.resolveWrite('/userdata/users'), 'users')
controlpath = '/users/controllers'
playerpath = '/users/players'


def _makeControllerIniName(name):
    '''Turn a controller name into a virtual path to the appropriate ini.'''
    return '%s/%s.ini' % (controlpath, name)

def _makePlayerIniName(name):
    '''Turn a player name into a virtual path to the appropriate ini.'''
    return '%s/%s.ini' % (playerpath, name)

control0 = None
control1 = None
Пример #15
0
        if opt in ["--song", "-s"]:
            playing = arg
        if opt in ["--part", "-p"]:
            part = arg
        if opt in ["--diff", "-d", "-l"]:
            difficulty = arg
        #evilynux - Multiplayer and mode selection support
        if opt in ["--mode", "-m"]:
            mode = int(arg)
        if opt in ["--nbrplayers", "-n"]:
            nbrplayers = int(arg)

    # Load the configuration file.
    if configFile is not None:
        if configFile.lower() == "reset":
            fileName = os.path.join(VFS.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
            os.remove(fileName)
            config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
        else:
            config = Config.load(configFile, setAsDefault = True)
    else:
        config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)

    #Lysdestic - Allow support for manipulating fullscreen via CLI
    if fullscreen is not None:
        Config.set("video", "fullscreen", fullscreen)

    #Lysdestic - Change resolution from CLI
    if resolution is not None:
        Config.set("video", "resolution", resolution)