diff --git a/ChangeLog b/ChangeLog index 541dfe17..fb511563 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* Cleaned up glade file to silence warnings +* Pygame is no longer required for gfceux to run, just for the input GUI * Turbo A and Turbo B support for gamepad GUI * Added initial support for a graphical UI for configuring gamepads * Moved gfceu options data file into .fceux instead of .fceultra diff --git a/INSTALL b/INSTALL index 54241d0b..1cffdc61 100644 --- a/INSTALL +++ b/INSTALL @@ -2,12 +2,21 @@ You can install gfceux with setup.py: $ sudo python setup.py install --prefix=/usr/local +TODO: 12/5/2008 - Work out build system with new modules. + You can change the prefix to whatever you like. Requirements: -Python (tested with 2.5); (Ubuntu package name: python) -PyGTK, and GTK; (Ubuntu package name: (python-gtk2 libgtk2.0-0) -FceuX 2.0 +Python (tested with 2.5); (Ubuntu package name: python) + NOTE: gfceux is not yet compatible with python 3.x +PyGTK and GTK; (Ubuntu package name: (python-gtk2 libgtk2.0-0) +Fceux 2.x + +Recommended dependencies +Pygame (Ubuntu package name: python-pygame) - This will allow graphical conifguraion of input + +NOTE: fceu 1.x is no longer supported in the gfceu 2.x series. + If you still want/need a front-end for gfceu use gfceu 0.x + -NOTE: fceu 1.x is no longer supported in the gfceu 2.x series. if you still want/need a front-end for gfceu use gfceu .7 diff --git a/get_key.py b/get_key.py index efbbb593..2f204d6e 100755 --- a/get_key.py +++ b/get_key.py @@ -1,25 +1,27 @@ -#!/usr/bin/env python -import pygame +#!/usr/bin/env python import sys -from pygame.locals import * - +try: + import pygame + from pygame.locals import * + has_pygame = True +except ImportError: + self.has_pygame = False class KeyGrabber: - """ KeyGrabber is a wrapper that gets an SDL key from the user using pygame """ - def __init__(self, width=300, height=100): - pygame.init() - screen = pygame.display.set_mode((width, height)) - pygame.display.set_caption("Press any key. . .") + """ KeyGrabber is a wrapper that gets an SDL key from the user using pygame """ + def __init__(self, width=300, height=100): + pygame.init() + screen = pygame.display.set_mode((width, height)) + pygame.display.set_caption("Press any key. . .") - def get_key(self): - while 1: - for event in pygame.event.get(): - if event.type == KEYDOWN: - #print event.key - pygame.display.quit() - return event.key + def get_key(self): + while 1: + for event in pygame.event.get(): + if event.type == KEYDOWN: + pygame.display.quit() + return event.key if __name__ == "__main__": - kg = KeyGrabber() - print kg.get_key() + kg = KeyGrabber() + print kg.get_key() diff --git a/gfceux b/gfceux index 281c82c6..158dc046 100755 --- a/gfceux +++ b/gfceux @@ -30,7 +30,7 @@ import pickle import shutil from optparse import OptionParser from config_parse import FceuxConfigParser -from get_key import KeyGrabber +import get_key #from subprocess import Popen try: @@ -551,20 +551,21 @@ class GfceuxApp: options.romfile = x # fix this global its ugly - gamepad_config = "0" + # specifies which NES gamepad we are configuring + gamepad_config_no = "0" def gamepad_clicked(self, widget, data=None): widgets.get_object("gamepad_config_window").show_all() - d = {'gp1_button' : "0", - 'gp2_button' : "1", - 'gp3_button' : "2", - 'gp4_button' : "3"} - self.gamepad_config = d[widget.name] + d = {'gp1_button' : "1", + 'gp2_button' : "2", + 'gp3_button' : "3", + 'gp4_button' : "4"} + self.gamepad_config_no = d[widget.name] def button_clicked(self, widget, data=None): - prefix = "SDL.Input.GamePad" + self.gamepad_config + prefix = "SDL.Input.GamePad" + self.gamepad_config_no d = {'right_button' : prefix + "Right", 'left_button' : prefix + "Left", 'up_button' : prefix + "Up", @@ -575,17 +576,18 @@ class GfceuxApp: 'b_button' : prefix + "B", 'turbo_a_button' : prefix + "TurboA", 'turbo_b_button' : prefix + "TurboB"} - kg = KeyGrabber() - key = kg.get_key() - cp = FceuxConfigParser(configfile) - cp.writeKey(d[widget.name], key) + + if get_key.has_pygame == False: + self.msg("Pygame could not be found on this system. Gfceux will revert to the old configuration routine.", True) + self.gamepad_clicked_old(widget) + else: + kg = get_key.KeyGrabber() + key = kg.get_key() + cp = FceuxConfigParser(configfile) + cp.writeKey(d[widget.name], key) def gamepad_clicked_old(self, widget, data=None): - d = {'gp1_button' : '1', - 'gp2_button' : '2', - 'gp3_button' : '3', - 'gp4_button' : '4'} - command = '-inputcfg gamepad' + d[widget.name] + ' /dev/null' + command = '--inputcfg gamepad' + self.gamepad_config_no self.launch(command, True) def gamepad_window_close(self, widget, data=None): diff --git a/gfceux.glade b/gfceux.glade index f06176aa..d1b10182 100644 --- a/gfceux.glade +++ b/gfceux.glade @@ -1,6 +1,6 @@ - + @@ -676,7 +676,8 @@ True True - 2 1 5 0.5 1 10 + 2 1 5 0.5 1 0 + 0.099999999776482579 1 True @@ -707,7 +708,8 @@ True True - 2 1 10 0.5 1 10 + 2 1 10 0.5 1 0 + 0.10000000000000001 1 True GTK_UPDATE_IF_VALID @@ -1050,7 +1052,7 @@ Invalid options may cause GFCE UltraX to behave incorrectly. True True - 4046 1 65536 1 10 10 + 4046 1 65536 1 10 0 1 @@ -1133,7 +1135,7 @@ Invalid options may cause GFCE UltraX to behave incorrectly. True True - 4046 1 65536 1 10 10 + 4046 1 65536 1 10 0 1 diff --git a/gfceux.xml b/gfceux.xml index ccf2ffcf..a558d860 100644 --- a/gfceux.xml +++ b/gfceux.xml @@ -1,12 +1,12 @@ - + 5 1 1 0.5 - 10 + 0 2 @@ -14,7 +14,7 @@ 1 1 0.5 - 10 + 0 2 @@ -22,7 +22,7 @@ 1 10 1 - 10 + 0 4046 @@ -30,7 +30,7 @@ 1 10 1 - 10 + 0 4046 @@ -673,6 +673,7 @@ True True adjustment1 + 0.099999999776482579 1 True @@ -704,6 +705,7 @@ True True adjustment2 + 0.10000000000000001 1 True GTK_UPDATE_IF_VALID