예제 #1
0
파일: Player.py 프로젝트: HugoLnx/fofix
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()
예제 #2
0
파일: MainMenu.py 프로젝트: cherbib/fofix
 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})
예제 #3
0
파일: MainMenu.py 프로젝트: maggotgdv/fofix
 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
파일: Player.py 프로젝트: HugoLnx/fofix
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
파일: Player.py 프로젝트: HugoLnx/fofix
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()
예제 #6
0
파일: Player.py 프로젝트: HugoLnx/fofix
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
파일: Version.py 프로젝트: west2554/fofix
def _getTagLine():
    import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir("/gameroot/.git"):
        # HEAD is in the form "ref: refs/heads/master\n"
        headref = VFS.open("/gameroot/.git/HEAD").read()[5:].strip()
        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)
        return "development (git %s %s)" % (shortref, headhash[:7])

    # 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
예제 #8
0
파일: Version.py 프로젝트: Gamer125/fofix
def _getTagLine():
  import VFS  # can't be done at top level due to circular import issues...

  # Look for a git repository.
  if VFS.isdir('/gameroot/.git'):
    # HEAD is in the form "ref: refs/heads/master\n"
    headref = VFS.open('/gameroot/.git/HEAD').read()[5:].strip()
    # The ref is in the form "sha1-hash\n"
    headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
    shortref = re.sub('^refs/(heads/)?', '', headref)
    return 'development (git %s %s)' % (shortref, headhash[:7])

  # 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
예제 #9
0
파일: Version.py 프로젝트: Gamer125/fofix
def _getTagLine():
    import VFS  # can't be done at top level due to circular import issues...

    # Look for a git repository.
    if VFS.isdir('/gameroot/.git'):
        # HEAD is in the form "ref: refs/heads/master\n"
        headref = VFS.open('/gameroot/.git/HEAD').read()[5:].strip()
        # The ref is in the form "sha1-hash\n"
        headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
        shortref = re.sub('^refs/(heads/)?', '', headref)
        return 'development (git %s %s)' % (shortref, headhash[:7])

    # 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
예제 #10
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def open(self, path, flags, mode=None):
   if path in self._openFiles:
     return -errno.EAGAIN
   access = flags & (os.O_RDONLY | os.O_RDWR | os.O_WRONLY)
   if access == os.O_RDONLY:
     omode = 'rb'
   elif flags & os.O_TRUNC:
     omode = 'w+b'
   elif flags & os.O_APPEND:
     omode = 'a+b'
   else:
     omode = 'r+b'
   self._openFiles[path] = VFS.open(path, omode)
예제 #11
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def open(self, path, flags, mode=None):
     if path in self._openFiles:
         return -errno.EAGAIN
     access = flags & (os.O_RDONLY | os.O_RDWR | os.O_WRONLY)
     if access == os.O_RDONLY:
         omode = 'rb'
     elif flags & os.O_TRUNC:
         omode = 'w+b'
     elif flags & os.O_APPEND:
         omode = 'a+b'
     else:
         omode = 'r+b'
     self._openFiles[path] = VFS.open(path, omode)
예제 #12
0
파일: Player.py 프로젝트: HugoLnx/fofix
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
예제 #13
0
    def GetInfoMedia(self, source):
        # Download file input file, if needed
        local_in = VFS.local_reference(source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        infor = converters.VideoInfo()
        dict_info = infor.get(local_in)

        # Check the information retrieved
        if not dict_info:
            return "failed"

        return ("ok", dict_info)
예제 #14
0
파일: Worker.py 프로젝트: manolodd/activae
    def GetInfoMedia (self, source):
        # Download file input file, if needed
        local_in = VFS.local_reference (source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        infor = converters.VideoInfo()
        dict_info = infor.get (local_in)

        # Check the information retrieved
        if not dict_info:
            return "failed"

        return ("ok", dict_info)
예제 #15
0
파일: Player.py 프로젝트: cherbib/fofix
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('DELETE FROM `players` WHERE `loaded` = 0')
  _playerDB.execute('UPDATE `players` SET `loaded` = 0')
  _playerDB.commit()
예제 #16
0
파일: Worker.py 프로젝트: manolodd/activae
    def BuildThumbnailMedia (self, source, target):
        # Download file input file, if needed
        local_in = VFS.local_reference (source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        thumbnailer = converters.VideoThumbnail()
        thumbnailer.generate (local_in, target)

        # Check the new file
        if not os.path.exists (target):
            return "failed"
        if os.path.getsize (target) < 1:
            return "failed"

        return "ok"
예제 #17
0
파일: Worker.py 프로젝트: manolodd/activae
    def ConvertMedia (self, source, target, format):
        # Download file input file, if needed
        local_in = VFS.local_reference (source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        vc = converters.VideoConverter()
        args = (local_in, target, format)

        task_id = (int(time.time()*10**6)) & 0xFFFFFFF
        callback = processors.FileCallback (task_id)

        self.jobs.put ((vc.convert, args, callback, task_id))
        status.status[task_id] = -1

        return task_id
예제 #18
0
    def ConvertMedia(self, source, target, format):
        # Download file input file, if needed
        local_in = VFS.local_reference(source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        vc = converters.VideoConverter()
        args = (local_in, target, format)

        task_id = (int(time.time() * 10**6)) & 0xFFFFFFF
        callback = processors.FileCallback(task_id)

        self.jobs.put((vc.convert, args, callback, task_id))
        status.status[task_id] = -1

        return task_id
예제 #19
0
    def BuildThumbnailMedia(self, source, target):
        # Download file input file, if needed
        local_in = VFS.local_reference(source)
        assert local_in[0] == '/', "A local copy of the file is required"

        # Video Converter
        thumbnailer = converters.VideoThumbnail()
        thumbnailer.generate(local_in, target)

        # Check the new file
        if not os.path.exists(target):
            return "failed"
        if os.path.getsize(target) < 1:
            return "failed"

        return "ok"
예제 #20
0
def _getTagLine():
    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
예제 #21
0
def _getTagLine():
    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
예제 #22
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def mkdir(self, path, mode):
     VFS.mkdir(path)
예제 #23
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def rmdir(self, path):
     VFS.rmdir(path)
예제 #24
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def mknod(self, path, mode, devno):
     if not stat.S_ISREG(mode):
         return -errno.EINVAL
     VFS.open(path, 'ab').close()
예제 #25
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def utime(self, path, times):
     # We don't want to bloat the VFS code with support for this,
     # but we want to be able to use touch(1) in the test fs without
     # it complaining and still have it do the right thing.
     os.utime(VFS.resolveWrite(path), times)
예제 #26
0
파일: Player.py 프로젝트: HugoLnx/fofix
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()
예제 #27
0
파일: VFSTest.py 프로젝트: ycaihua/fofix
 def rename(self, src, dest):
     VFS.rename(src, dest)
예제 #28
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def readdir(self, path, offset):
     for e in (['.', '..'] + list(VFS.listdir(path)))[offset:]:
         yield fuse.Direntry(e)
예제 #29
0
파일: Log.py 프로젝트: Archangelgray/fofix
import Version
import traceback
import time
import warnings
from util.Unicode import utf8

# Whether to output log entries to stdout in addition to the logfile.
quiet = True

# File object representing the logfile.
if os.name == "posix": # evilynux - logfile in ~/.fofix/ for GNU/Linux and MacOS X
    # evilynux - Under MacOS X, put the logs in ~/Library/Logs
    if os.uname()[0] == "Darwin":
        logFile = open(os.path.expanduser('~/Library/Logs/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME), 'w')
    else: # GNU/Linux et al.
        logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')
else:
    logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME, 'w')

if "-v" in sys.argv or "--verbose" in sys.argv:
    quiet = False

# Labels for different priorities, as output to the logfile.
labels = {
  "warn":   "(W)",
  "debug":  "(D)",
  "notice": "(N)",
  "error":  "(E)",
}

# Labels for different priorities, as output to stdout.
예제 #30
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def utime(self, path, times):
   # We don't want to bloat the VFS code with support for this,
   # but we want to be able to use touch(1) in the test fs without
   # it complaining and still have it do the right thing.
   os.utime(VFS.resolveWrite(path), times)
예제 #31
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def mknod(self, path, mode, devno):
   if not stat.S_ISREG(mode):
     return -errno.EINVAL
   VFS.open(path, 'ab').close()
예제 #32
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def rename(self, src, dest):
   VFS.rename(src, dest)
예제 #33
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def rmdir(self, path):
   VFS.rmdir(path)
예제 #34
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def mkdir(self, path, mode):
   VFS.mkdir(path)
예제 #35
0
import time
import warnings
from util.Unicode import utf8

# Whether to output log entries to stdout in addition to the logfile.
quiet = True

# File object representing the logfile.
if os.name == "posix":  # evilynux - logfile in ~/.fofix/ for GNU/Linux and MacOS X
    # evilynux - Under MacOS X, put the logs in ~/Library/Logs
    if os.uname()[0] == "Darwin":
        logFile = open(
            os.path.expanduser('~/Library/Logs/%s.log' %
                               Version.PROGRAM_UNIXSTYLE_NAME), 'w')
    else:  # GNU/Linux et al.
        logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME,
                           'w')
else:
    logFile = VFS.open('/userdata/%s.log' % Version.PROGRAM_UNIXSTYLE_NAME,
                       'w')

if "-v" in sys.argv or "--verbose" in sys.argv:
    quiet = False

# Labels for different priorities, as output to the logfile.
labels = {
    "warn": "(W)",
    "debug": "(D)",
    "notice": "(N)",
    "error": "(E)",
}
예제 #36
0
파일: Player.py 프로젝트: HugoLnx/fofix
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
예제 #37
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def unlink(self, path):
     VFS.unlink(path)
예제 #38
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def truncate(self, path, offset):
   f = VFS.open(path, 'ab')
   f.truncate(offset)
   f.close()
예제 #39
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def getattr(self, path):
     return VFS.stat(path)
예제 #40
0
파일: VFSTest.py 프로젝트: Gamer125/fofix
 def truncate(self, path, offset):
     f = VFS.open(path, 'ab')
     f.truncate(offset)
     f.close()
예제 #41
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def readdir(self, path, offset):
   for e in (['.', '..'] + list(VFS.listdir(path)))[offset:]:
     yield fuse.Direntry(e)
예제 #42
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def getattr(self, path):
   return VFS.stat(path)
예제 #43
0
파일: Player.py 프로젝트: HugoLnx/fofix
  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 = {}
예제 #44
0
파일: VFSTest.py 프로젝트: HugoLnx/fofix
 def unlink(self, path):
   VFS.unlink(path)