Skip to content

Commit

Permalink
Large commit, Update FoFiX to use version 0.1.1 of fretwork. Plus rem…
Browse files Browse the repository at this point in the history
…oves code that was moved into fretwork.
  • Loading branch information
mdsitton committed Sep 21, 2015
1 parent d21b0cc commit 20ad762
Show file tree
Hide file tree
Showing 49 changed files with 488 additions and 1,902 deletions.
39 changes: 28 additions & 11 deletions FoFiX.py
Expand Up @@ -110,12 +110,29 @@ def cmd_args():

import pygame


from fretwork import log

from fofix.core import Version
from fofix.core import VFS

# setup the logfile
# 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')

log.setLogfile(logFile)

from fofix.core.VideoPlayer import VideoLayer, VideoPlayerError
from fofix.core.GameEngine import GameEngine
from fofix.game.MainMenu import MainMenu
from fofix.core.Language import _
from fofix.core import Version
from fofix.core import Log, VFS
from fofix.core import Config

class Main():
Expand Down Expand Up @@ -183,7 +200,7 @@ def init_oneshot(self):

# Check for a valid invocation of one-shot mode.
if self.playing is not None:
Log.debug('Validating song directory for one-shot mode.')
log.debug('Validating song directory for one-shot mode.')

library = Config.get("setlist","base_library")
basefolder = os.path.join(Version.dataPath(),library,"songs",self.playing)
Expand All @@ -197,12 +214,12 @@ def init_oneshot(self):
if not (os.path.exists(os.path.join(basefolder, "song.ogg")) or
os.path.exists(os.path.join(basefolder, "guitar.ogg"))):

Log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % self.playing)
log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % self.playing)
self.engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % self.playing)
return

# Set up one-shot mode
Log.debug('Entering one-shot mode.')
log.debug('Entering one-shot mode.')
Config.set("setlist", "selected_song", playing)

self.engine.cmdPlay = 1
Expand All @@ -218,7 +235,7 @@ def init_oneshot(self):
self.engine.cmdMode = players, 0, mode

def restart(self):
Log.notice("Restarting.")
log.notice("Restarting.")
self.engine.audio.close()
self.restartRequested = True

Expand All @@ -234,7 +251,7 @@ def run(self):
try:
vidPlayer = VideoLayer(self.engine, vidSource, cancellable=True)
except (IOError, VideoPlayerError):
Log.error("Error loading intro video:")
log.error("Error loading intro video:")
else:
vidPlayer.play()
self.engine.view.pushLayer(vidPlayer)
Expand All @@ -253,7 +270,7 @@ def run(self):
while self.engine.run():
pass
except KeyboardInterrupt:
Log.notice("Left mainloop due to KeyboardInterrupt.")
log.notice("Left mainloop due to KeyboardInterrupt.")
# don't reraise

# Restart the program if the engine is asking that we do so.
Expand All @@ -275,8 +292,8 @@ def run(self):
except (KeyboardInterrupt, SystemExit):
raise
except:
Log.error("Terminating due to unhandled exception: ")
_logname = os.path.abspath(Log.logFile.name)
log.error("Terminating due to unhandled exception: ")
_logname = os.path.abspath(log.logFile.name)
_errmsg = "%s\n\n%s\n%s\n%s\n%s" % (
_("Terminating due to unhandled exception:"),
traceback.format_exc(),
Expand All @@ -289,7 +306,7 @@ def run(self):
import win32api
import win32con
if win32api.MessageBox(0, "%s\n\n%s" % (_errmsg, _("Open the logfile now?")), "%s %s" % (Version.PROGRAM_NAME, Version.version()), win32con.MB_YESNO|win32con.MB_ICONSTOP) == win32con.IDYES:
Log.logFile.close()
log.logFile.close()
os.startfile(_logname)
if hasattr(sys, 'frozen'):
sys.exit(1) # don't reraise if py2exe'd so the "Errors occurred" box won't appear after this and confuse the user as to which logfile we actually want
Expand Down
24 changes: 23 additions & 1 deletion README.md
Expand Up @@ -198,6 +198,18 @@ a subdirectory of the `win32/` directory.) Now you are ready to compile
the native modules.


#### Installing fretwork
Fretwork is our new initiative to share some code with a fork of FoF called Frets on Fire: Reborn.
Some code from this repo has been move out into fretwork. To install fretwork download the following wheel: ([direct link to 0.1.1](https://github.com/fofix/fretwork/releases/download/0.1.1/fretwork-0.1.1-cp27-none-win32.whl))
Then install it using the following command:
```pip install fretwork-0.1.1-cp27-none-win32.whl```

#### Upgrading fretwork
If you have previously installed fretwork make sure you download the latest release from above then following command:

```pip install fretwork-0.1.1-cp27-none-win32.whl --upgrade```


### Mac OS X

Someone with a Mac will have to expand this section.
Expand Down Expand Up @@ -234,6 +246,7 @@ The following are required:
* Cython
* pkg-config
* cerealizer
* fretwork
* The OpenGL, GLU, GLib, SDL, SDL_mixer, libogg, libvorbisfile,
libtheora, libsoundtouch, and libswscale (part of ffmpeg) development headers

Expand All @@ -248,7 +261,16 @@ following packages: `python-pygame`, `python-opengl`, `python-numpy`,
`python-imaging`, `python-dev`, `build-essential`, `cython`, `pkg-config`,
`libgl1-mesa-dev`, `libglu1-mesa-dev`, `libglib2.0-dev`, `libsdl1.2-dev`,
`libsdl-mixer1.2-dev`, `libogg-dev`, `libvorbisfile-dev`, `libtheora-dev`,
`libswscale-dev`, `libsoundtouch-dev`, `python-cerealizer`, and if you want translations, `gettext`.
`libswscale-dev`, `libsoundtouch-dev`, and if you want translations, `gettext`.

Cerealizer should be installed via pip

For Fretwork you should download the sourcecode of the latest release ([over here](https://github.com/fofix/fretwork/releases/)), extract the files and run the following command:

```pip2 install fretwork-0.1.1.tar.gz```

This command may depend on how your distribution provides pip, and what python versions you have installed.


Some packages can be troublesome, so we have notes below about certain
packages.
Expand Down
232 changes: 0 additions & 232 deletions fofix/core/Audio.py

This file was deleted.

0 comments on commit 20ad762

Please sign in to comment.