From a9dc04c394a3ecc14a6c3e2704cd2cebd318ce19 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 17 Jun 2008 16:02:45 +0000 Subject: [PATCH 01/15] [[Split portion of a mixed commit.]] --- BUG | 1 - ChangeLog | 3 + INSTALL | 12 +- gfceu | 596 ++++++++++++++------------- gfceu.glade | 234 +++++------ gfceu.xml | 1117 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 7 files changed, 1538 insertions(+), 427 deletions(-) create mode 100644 gfceu.xml diff --git a/BUG b/BUG index ac514cf1..e69de29b 100644 --- a/BUG +++ b/BUG @@ -1 +0,0 @@ -* Too much shit when trying to run with no display diff --git a/ChangeLog b/ChangeLog index ccb3902c..e2dac599 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +* Major code cleanup +* Now requires pygtk >= 2.12 +* Transitioned from gtk.glade to gtk.Builder. * Changed some strings to reflect new email and website * Fixed and cleaned some stuff with the glade loading ========================== version 0.6.0 ======================== diff --git a/INSTALL b/INSTALL index 8446979a..eb210c0a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,11 +1,13 @@ You can install gfceu with setup.py: -$ sudo ./setup.py install +$ sudo ./setup.py install --prefix=/usr/local + +You can change the prefix to whatever you like. Requirements: -Python (tested with 2.4) (Ubuntu package name: python) -PyGTK, GTK, and PyGlade (tested with 2.8) (Ubuntu package name: (python-gtk2 libgtk2.0-0 python-glade) -FCE Ultra (Ubuntu package name: fceu) +Python (tested with 2.5); (Ubuntu package name: python) +PyGTK, and GTK; (Ubuntu package name: (python-gtk2 libgtk2.0-0) +FCE UltraX - You're going to need the latest fceux for gfceu .7 to work Optional: -GnomeVFS 2 (tested with 2.14.1) (Ubuntu package name libgnomevfs2-0 python-gtk2)alsa-oss (tested with 1.0.11 +GnomeVFS 2 (tested with 2.14.1) (Ubuntu package name libgnomevfs2-0 ) diff --git a/gfceu b/gfceu index ba3ef5e0..bd492a6a 100644 --- a/gfceu +++ b/gfceu @@ -1,7 +1,7 @@ #!/usr/bin/python # gfceu - Graphical launcher for FCE Ultra. # Designed on Ubuntu, with platfrom independence in mind. -version = "0.6.1svn" +version = "0.7svn" title = "gfceux" # Copyright (C) 2006 Lukas Sabota ## @@ -31,78 +31,28 @@ import shutil from optparse import OptionParser from subprocess import Popen - # # # # # # # # -# Messaging Functions -def gfceu_message(message, use_gtk=False): - """ - gqfceu_message() - - This function prints messages to the user. This is generally used for status - messages. However, it can be used for important messages as well. If a - GTK message_box is requried, the use_gtk flag can be enabled - """ - print title + ' message: '+message - if use_gtk: - msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO, - buttons=gtk.BUTTONS_CLOSE) - msgbox.set_markup(message) - msgbox.run() - msgbox.destroy() - -def gfceu_error(message, code, use_gtk=True, fatal=True): - """ - gfceu_error() - - TODO: This can be reworked to use the raise/except methods already defined - in the standard python language. One of these days... - """ - print '# # # #' - print title + ' ERROR code '+str(code)+':' - print message - print '# # # #' - if use_gtk: - msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_ERROR, - buttons=gtk.BUTTONS_CLOSE) - msgbox.set_markup(title + ' ERROR Code '+str(code)+':\n'+message) - msgbox.run() - msgbox.destroy() - if fatal: - sys.exit(code) - - - # # # # # # # # -# Import libraries -try: - import pytgtk - pygtk.require("2.6") -except: - pass try: + import pygtk + pygtk.require("2.0") import gtk except ImportError: - gfceu_error('The PyGTK libraries cannot be found.\n\ - Ensure that PyGTK (>=2.0) is installed on this system.\n\ + print "The PyGTK libraries cannot be found.\n\ + Ensure that PyGTK (>=2.12) is installed on this system.\n\ On Debian based systems (like Ubuntu), try this command:\n\ - sudo apt-get install python-gtk2 libgtk2.0-0', 1, False) - -try: - import gtk.glade -except ImportError: - gfceu_error('The glade libraries cannot be found.\n\ - Ensure that libglade is installed on this system.\n\ - On Debian based systems (like Ubuntu), try this command:\n\ - sudo apt-get install libglade2-0 python-gtk2', 2, False) + sudo apt-get install python-gtk2 libgtk2.0-0" try: import gnomevfs have_gnomevfs = True except ImportError: - gfceu_error('The gnomevfs libraries cannot be found.\n\ + print "The gnomevfs libraries cannot be found.\n\ To enable ROM loading over the network, ensure that gnomevfs is installed on\ this system.\n\ On Debian based systems (like Ubuntu), try this command:\n\ - sudo apt-get install python-gtk2 libgnomevfs2-0', 5, False, False) + sudo apt-get install python-gtk2 libgnomevfs2-0" have_gnomevfs = False + + # # # # # # # # @@ -122,6 +72,8 @@ class game_options: extra_entry = '' romfile = '' opengl_check = False + + # network join_radio = False join_add = '' join_port = 4046 @@ -156,62 +108,39 @@ def give_widgets(): This function takes data from the options struct and relays it to the GTK window """ - global xml, options + global options, widgets try: - widgets['rom_entry'].set_text(options.romfile) + widgets.get_object("rom_entry").set_text(options.romfile) # sound - widgets['sound_check'].set_active(options.sound_check) - widgets['soundq_check'].set_active(options.soundq_check) - widgets['soundrate_entry'].set_text(options.soundrate_entry) + widgets.get_object("sound_check").set_active(options.sound_check) + widgets.get_object("soundq_check").set_active(options.soundq_check) + widgets.get_object("soundrate_entry").set_text(options.soundrate_entry) - widgets['fullscreen_check'].set_active(options.fullscreen_check) - widgets['opengl_check'].set_active(options.opengl_check) - widgets['xscale_spin'].set_value(options.xscale_spin) - widgets['yscale_spin'].set_value(options.yscale_spin) + widgets.get_object("fullscreen_check").set_active(options.fullscreen_check) + widgets.get_object("opengl_check").set_active(options.opengl_check) + widgets.get_object("xscale_spin").set_value(options.xscale_spin) + widgets.get_object("yscale_spin").set_value(options.yscale_spin) - widgets['extra_entry'].set_text(options.extra_entry) + widgets.get_object("extra_entry").set_text(options.extra_entry) # Usability point: # Users will probably not want to remember their previous network setting. # Users may accidently be connecting to a remote server/hosting a game when # they were unaware. # No network is being set by default - widgets['no_network_radio'].set_active(True) - widgets['join_add'].set_text(options.join_add) - widgets['join_port'].set_value(float(options.join_port)) - widgets['join_pass'].set_text(options.join_pass) - widgets['host_port'].set_value(float(options.host_port)) - widgets['host_pass'].set_text(options.host_pass) + widgets.get_object("no_network_radio").set_active(True) + widgets.get_object("join_add").set_text(options.join_add) + widgets.get_object("join_port").set_value(float(options.join_port)) + widgets.get_object("join_pass").set_text(options.join_pass) + widgets.get_object("host_port").set_value(float(options.host_port)) + widgets.get_object("host_pass").set_text(options.host_pass) except AttributeError: # When new widgets are added, old pickle files might break. options = game_options() give_widgets() -def setup_environment (): - """ - Configures the environment if this is the first time the application - has been run. For instance, it checks for the options file and creates - it if it doesn't exist. It also converts between the old version and - the new version of this application, which stores the options file in - a separate directory. - """ - - global appconfigdir, old_optionsfile, optionsfile - - - if not os.path.exists(appconfigdir): - # this is the first time the application is run. - # create the directory - gfceu_message("Creating application settings directory") - os.mkdir(appconfigdir) - - if os.path.exists(old_optionsfile): - # for full backwards compatibility, this file is processed, but moved - # to the new directory and filename for future compatibility - gfceu_message("Old version of options file found, converting to new version") - shutil.move(old_optionsfile,optionsfile) def set_options(): """ @@ -220,126 +149,34 @@ def set_options(): This function grabs all of the data from the GTK widgets and stores it in the options object. """ - global xml - options.romfile = widgets['rom_entry'].get_text() + options.romfile = widgets.get_object("rom_entry").get_text() # sound - options.sound_check = widgets['sound_check'].get_active() - options.soundq_check = widgets['soundq_check'].get_active() - options.soundrate_entry = widgets['soundrate_entry'].get_text() + options.sound_check = widgets.get_object("sound_check").get_active() + options.soundq_check = widgets.get_object("soundq_check").get_active() + options.soundrate_entry = widgets.get_object("soundrate_entry").get_text() # video - options.fullscreen_check = widgets['fullscreen_check'].get_active() - options.opengl_check = widgets['opengl_check'].get_active() - options.xscale_spin = widgets['xscale_spin'].get_value() - options.yscale_spin = widgets['yscale_spin'].get_value() + options.fullscreen_check = widgets.get_object("fullscreen_check").get_active() + options.opengl_check = widgets.get_object("opengl_check").get_active() + options.xscale_spin = widgets.get_object("xscale_spin").get_value() + options.yscale_spin = widgets.get_object("yscale_spin").get_value() - options.extra_entry = widgets['extra_entry'].get_text() + options.extra_entry = widgets.get_object("extra_entry").get_text() - options.join_radio = widgets['join_radio'].get_active() - options.host_radio = widgets['host_radio'].get_active() - options.no_network_radio = widgets['no_network_radio'].get_active() - options.join_add = widgets['join_add'].get_text() - options.join_port = widgets['join_port'].get_value() - options.join_pass = widgets['join_pass'].get_text() - options.host_port = widgets['host_port'].get_value() - options.host_pass = widgets['host_pass'].get_text() + options.join_radio = widgets.get_object("join_radio").get_active() + options.host_radio = widgets.get_object("host_radio").get_active() + options.no_network_radio = widgets.get_object("no_network_radio").get_active() + options.join_add = widgets.get_object("join_add").get_text() + options.join_port = widgets.get_object("join_port").get_value() + options.join_pass = widgets.get_object("join_pass").get_text() + options.host_port = widgets.get_object("host_port").get_value() + options.host_pass = widgets.get_object("host_pass").get_text() -def launch(rom_name, local=False): - global xml, options, fceu_server_binary, fceux_binary - set_options() - - sound_options = '' - - if options.sound_check: - sound_options += '--sound 1 ' - else: - sound_options += '--sound 0 ' - - if options.soundq_check: - sound_options += '--soundq 1 ' - else: - sound_options += '--soundq 0 ' - - if options.soundrate_entry: - sound_options += '--soundrate ' + options.soundrate_entry + ' ' - else: - soundrate = ' ' - - # video - video_options = '' - if options.fullscreen_check: - video_options += '--fullscreen 1 ' - else: - video_options += '--fullscreen 0 ' - - if options.opengl_check: - video_options += '--opengl 1 ' - else: - video_options += '--opengl 0 ' - - video_options += ' --xscale ' + str(options.xscale_spin) - video_options += ' --yscale ' + str(options.yscale_spin) - video_options += ' ' - - - if options.join_radio: - if options.join_pass == '': - netpass = '' - else: - netpass = '--pass ' + '"' + options.join_pass + '" ' - network = '-net "' + options.join_add + '"'\ - ' --port '+ str(options.join_port) + ' ' + netpass - else: - network = '' - - if options.host_radio: - if options.host_pass == '': - netpass = ' ' - else: - netpass = ' --pass ' + '"' + options.host_pass + '" ' - network = '--net localhost --port '+\ - str(options.host_port) + netpass + ' ' - - - if local: - network = '' - - - - command = fceux_binary + ' ' + sound_options + video_options +\ - network + options.extra_entry + ' '+ rom_name - gfceu_message('Command: ' + command) - if options.host_radio: - xterm_binary = find_binary("xterm") - if xterm_binary == None: - gfceu_error("Cannot find xterm on this system. You will not \n\ - be informed of server output.", 102, True, False) - args = [fceu_server_binary] - else: - args = [xterm_binary, "-e", fceu_server_binary] - args.append('--port') - args.append(str(options.host_port)) - if options.host_pass: - args.append("--password") - args.append(options.host_pass) - pid = Popen(args).pid - - widgets['main_window'].hide() - - # os.system() is a blocker, so we must force - # gtk to process our events. - while gtk.events_pending(): - gtk.main_iteration_do() - - os.system(command) - if options.host_radio: - os.kill(pid, 9) - widgets['main_window'].show() def find_binary(file): @@ -363,15 +200,220 @@ def find_binary(file): return None - # # # # # # # # -# GTK Signal Handlers -class GladeHandlers: - def launch_button_clicked(arg1): - global xml + +############################################################################## +# Globals +options = None +appconfigdir = os.getenv('HOME') + '/.'+ title +optionsfile = appconfigdir + 'gfceu_options.dat' +widgets = None + +class GfceuApp: + def __init__(self): + self.fceux_binary = self.find_fceu() + self.load_ui() + self.setup_environment() + + options = game_options() + load_options() + give_widgets() + try: + gtk.main() + except KeyboardInterrupt: + sys.exit(0) + + def msg(self, text, use_gtk=False): + """ + GfceuApp.msg() + + This function prints messages to the user. This is generally used for status + messages. If a GTK message_box is requried, the use_gtk flag can be enabled. + """ + print text + if use_gtk: + msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO, + buttons=gtk.BUTTONS_CLOSE) + msgbox.set_markup(text) + msgbox.run() + msgbox.destroy() + + def print_error(self, message, code, use_gtk=True, fatal=True): + """ + GfceuApp.error() + + Presents the user with an error message and optionally quits the program. + """ + print title + ' error code '+str(code)+': ' + message + if use_gtk: + msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_ERROR, + buttons=gtk.BUTTONS_CLOSE) + msgbox.set_markup(title + ' ERROR Code '+str(code)+':\n'+message) + msgbox.run() + msgbox.destroy() + if fatal: + sys.exit(code) + + def setup_environment (self): + """ + Configures the environment if this is the first time the application + has been run. For instance, it checks for the options file and creates + it if it doesn't exist. It also converts between the old version and + the new version of this application, which stores the options file in + a separate directory. + """ + + global appconfigdir, optionsfile + + if not os.path.exists(appconfigdir): + # this is the first time the application is run. + # create the directory + self.msg("Creating application settings directory") + os.mkdir(appconfigdir) + + def find_fceu(self): + bin = find_binary('fceux') + if bin == None: + gfceu_error('Could not find the fceu binary.\n\ + Ensure that FCE Ultra is installed and in the $PATH.\n\ + On Debian based systems (like Ubuntu), try the following command:\n\ + sudo apt-get install fceu', 4, True) + else: + self.msg('Using: ' + bin) + + return bin + + def load_ui(self): + global widgets + """ Search for the glade XML file and load it """ + # Check first in the directory of this script. + if os.path.isfile('gfceu.xml'): + glade_file = 'gfceu.xml' + # Then check to see if its installed on a *nix system + elif os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceu/gfceu.xml')): + glade_file = os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceu/gfceu.xml') + else: + print 'ERROR.' + print 'Could not find the glade interface file.' + print 'Try reinstalling the application.' + sys.exit(1) + + try: + print "Using: " + glade_file + widgets = gtk.Builder() + widgets.add_from_file(glade_file) + widgets.connect_signals(self) + except: + self.print_error("Couldn't load the glade UI file", 24) + + widgets.get_object("main_window").show_all() + + def launch(self, rom_name, local=False): global options - options.romfile = widgets['rom_entry'].get_text() - if widgets['rom_entry'].get_text() == '': - gfceu_message('Please specify a ROM to open in the main tab.', True) + set_options() + + sound_options = '' + + if options.sound_check: + sound_options += '--sound 1 ' + else: + sound_options += '--sound 0 ' + + if options.soundq_check: + sound_options += '--soundq 1 ' + else: + sound_options += '--soundq 0 ' + + if options.soundrate_entry: + sound_options += '--soundrate ' + options.soundrate_entry + ' ' + else: + soundrate = ' ' + + # video + video_options = '' + if options.fullscreen_check: + video_options += '--fullscreen 1 ' + else: + video_options += '--fullscreen 0 ' + + if options.opengl_check: + video_options += '--opengl 1 ' + else: + video_options += '--opengl 0 ' + + video_options += ' --xscale ' + str(options.xscale_spin) + video_options += ' --yscale ' + str(options.yscale_spin) + video_options += ' ' + + + # Netplay is fucked right now + """ + if options.join_radio: + if options.join_pass == '': + netpass = '' + else: + netpass = '--pass ' + '"' + options.join_pass + '" ' + network = '-net "' + options.join_add + '"'\ + ' --port '+ str(options.join_port) + ' ' + netpass + else: + network = '' + + if options.host_radio: + if options.host_pass == '': + netpass = ' ' + else: + netpass = ' --pass ' + '"' + options.host_pass + '" ' + network = '--net localhost --port '+\ + str(options.host_port) + netpass + ' ' + + if local: + network = '' + """ + network = '' + + command = self.fceux_binary + ' ' + sound_options + video_options +\ + network + options.extra_entry + ' '+ rom_name + self.msg('Command: ' + command) + + # more code to disable because netplay is fucked + """ + if options.host_radio: + xterm_binary = find_binary("xterm") + if xterm_binary == None: + gfceu_error("Cannot find xterm on this system. You will not \n\ + be informed of server output.", 102, True, False) + args = [self.server_binary] + else: + args = [xterm_binary, "-e", self.server_binary] + args.append('--port') + args.append(str(options.host_port)) + if options.host_pass: + args.append("--password") + args.append(options.host_pass) + pid = Popen(args).pid + """ + widgets.get_object("main_window").hide() + + # os.system() is a blocker, so we must force + # gtk to process our events. + while gtk.events_pending(): + gtk.main_iteration_do() + + os.system(command) + widgets.get_object("main_window").show() + + # another part of netplay code + """ + if options.host_radio: + os.kill(pid, 9) + """ + + ### Callbacks + def launch_button_clicked(self, arg1): + + global options + options.romfile = widgets.get_object("rom_entry").get_text() + if widgets.get_object("rom_entry").get_text() == '': + self.msg('Please specify a ROM to open in the main tab.', True) return if options.network_rom: try: @@ -400,17 +442,15 @@ class GladeHandlers: else: romfile = options.romfile - launch('"'+romfile+'"') + self.launch('"'+romfile+'"') + + def about_button_clicked(self, menuitem, data=None): + widgets.get_object("about_dialog").set_name('GNOME FCE Ultra '+version) + widgets.get_object("about_dialog").run() + widgets.get_object("about_dialog").hide() - - def about_button_clicked(arg1): - global xml - widgets['about_dialog'].set_name('GNOME FCE Ultra '+version) - widgets['about_dialog'].run() - widgets['about_dialog'].hide() - - def browse_button_clicked(widget): - global xml,options + def browse_button_clicked(self, menuitem, data=None): + global options set_options() chooser = gtk.FileChooserDialog("Open...", None, gtk.FILE_CHOOSER_ACTION_OPEN, @@ -451,17 +491,17 @@ class GladeHandlers: if response == gtk.RESPONSE_OK: if chooser.get_filename(): x = chooser.get_filename() - widgets['rom_entry'].set_text(x) + widgets.get_object("rom_entry").set_text(x) options.romfile = x options.network_rom = False elif chooser.get_uri(): x = chooser.get_uri() - widgets['rom_entry'].set_text(x) + widgets.get_object("rom_entry").set_text(x) options.romfile = x options.network_rom = True - def gamepad_clicked(widget): - print widget.name + def gamepad_clicked(self, widget, data=None): + d = {'gp1_button' : '1', 'gp2_button' : '2', 'gp3_button' : '3', @@ -469,7 +509,7 @@ class GladeHandlers: command = '-inputcfg gamepad' + d[widget.name] + ' /dev/null' launch(command, True) - def config_help_button_clicked(arg1): + def config_help_button_clicked(self, menuitem, data=None): msgbox = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE) msgbox.set_markup("Once a gamepad is seleceted, a titlebar will be displayed\ @@ -480,19 +520,19 @@ class GladeHandlers: msgbox.hide() - def join_radio_clicked(arg1): + def join_radio_clicked(self, menuitem, data=None): global options - widgets['join_frame'].set_sensitive(True) - widgets['host_frame'].set_sensitive(False) + widgets.get_object("join_frame").set_sensitive(True) + widgets.get_object("host_frame").set_sensitive(False) options.join_radio = True options.host_radio = False options.no_network_radio = False - def host_radio_clicked(arg1): - global fceu_server_binary - if widgets['host_radio'].get_active(): - fceu_server_binary = find_binary('fceu-server') - if fceu_server_binary == None: + def host_radio_clicked(self, menuitem, data=None): + if widgets.get_object("host_radio").get_active(): + self.server_binary = find_binary('fceu-server') + + if self.server_binary == None: if os.name == 'nt': gfceu_error("The fceu server software cannot be found. \n\ Ensure that it is installed in the same directory as \n\ @@ -501,89 +541,39 @@ class GladeHandlers: gfceu_error("The fceu server software cannot be found on \n\ this system. Ensure that it is installed and in your path.", 101, True, False) - widgets['no_network_radio'].set_active(True) + widgets.get_object("no_network_radio").set_active(True) options.no_network_radio = True return False - gfceu_message("Using: "+fceu_server_binary) - widgets['join_frame'].set_sensitive(False) - widgets['host_frame'].set_sensitive(True) + widgets.get_object("join_frame").set_sensitive(False) + widgets.get_object("host_frame").set_sensitive(True) options.join_radio = False options.host_radio = True options.no_network_radio = False - def no_network_radio_clicked(arg1): - widgets['join_frame'].set_sensitive(False) - widgets['host_frame'].set_sensitive(False) + def no_network_radio_clicked(self, menuitem, data=None): + widgets.get_object("join_frame").set_sensitive(False) + widgets.get_object("host_frame").set_sensitive(False) options.join_radio = False options.host_radio = False options.no_network_radio = True - def end(widget,arg=0): - global xml, options, optionsfile + def end(self, menuitem, data=None): + global options, optionsfile set_options() save_options() gtk.main_quit() - -############################################################################## -# Globals -options = None -appconfigdir = os.getenv('HOME') + '/.'+ title -old_optionsfile = os.getenv('HOME')+'/.' + title + '_options' -optionsfile = appconfigdir + 'gfceu_options.dat' -fceux_binary = None -fceu_server_binary = None -#version is defined earlier in the code -#have_vfs is defined earlier in the code - -class WidgetsWrapper: - def __init__(self): - # Search for the glade file - # Check first in the directory of this script. - if os.path.isfile('gfceu.glade'): - glade_file = 'gfceu.glade' - # Then check to see if its installed on a *nix system - elif os.path.isfile(os.path.join(os.path.dirname(sys.executable), '../share/gfceu/gfceu.glade')): - glade_file = os.path.join(os.path.dirname(sys.executable), '../share/gfceu/gfceu.glade') - else: - print 'ERROR.' - print 'Could not find the glade interface file.' - print 'Try reinstalling the application.' - sys.exit(1) - - self.widgets = gtk.glade.XML(glade_file) - self.widgets.signal_autoconnect(GladeHandlers.__dict__) - - def __getitem__(self, key): - return self.widgets.get_widget(key) - # # # # # # # # -# main + if __name__ == '__main__': - # Parse options - fceux_binary = find_binary('fceux') + + parser = OptionParser(version='%prog '+ version) - parser.add_option('-b', '--binary', action="store", type="string", dest="fceux_binary") parser.parse_args() - if fceux_binary == None: - gfceu_error('Could not find the fceu binary.\n\ - Ensure that FCE Ultra is installed and in the $PATH.\n\ - On Debian based systems (like Ubuntu), try the following command:\n\ - sudo apt-get install fceu', 4, True) - else: - gfceu_message('Using: '+fceux_binary) - - widgets = WidgetsWrapper() - widgets['main_window'].show_all() - setup_environment() - options = game_options() - load_options() - give_widgets() - try: - gtk.main() - except KeyboardInterrupt: - sys.exit(0) + + app = GfceuApp() + diff --git a/gfceu.glade b/gfceu.glade index 80cb8cf5..57d03c28 100644 --- a/gfceu.glade +++ b/gfceu.glade @@ -124,30 +124,17 @@ 5 5 - + True True - Gamepad _1 + Gamepad _3 True 0 - - - - - - True - True - Gamepad _2 - True - 0 - - - - 1 - 2 + 1 + 2 @@ -169,17 +156,30 @@ - + True True - Gamepad _3 + Gamepad _2 + True + 0 + + + + 1 + 2 + + + + + + True + True + Gamepad _1 True 0 - 1 - 2 @@ -582,26 +582,15 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 5 5 - + True - 0 - Port: - - - GTK_FILL - - - - - - True - 0 - Password: + True + 1 + 2 1 2 - GTK_FILL @@ -619,15 +608,26 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - + True - True + 0 + Password: - 1 - 2 1 2 + GTK_FILL + + + + + + True + 0 + Port: + + + GTK_FILL @@ -678,13 +678,54 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 3 5 - + True True + 4046 1 65536 1 10 10 + 1 1 2 + 1 + 2 + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Server Address: + + + GTK_FILL @@ -704,54 +745,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - - True - 0 - Server Address: - - - GTK_FILL - - - - - - True - 0 - Server Port: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - + True True - 4046 1 65536 1 10 10 - 1 1 2 - 1 - 2 @@ -941,16 +941,42 @@ Artwork for old versions (< 0.2.7): 3 3 - + + + + + + + + + + + + + + + + True True True - Right + Up + 0 + + + 1 + 2 + + + + + True + True + True + Left 0 - 2 - 3 1 2 @@ -971,46 +997,20 @@ Artwork for old versions (< 0.2.7): - + True True True - Left + Right 0 + 2 + 3 1 2 - - - True - True - True - Up - 0 - - - 1 - 2 - - - - - - - - - - - - - - - - - diff --git a/gfceu.xml b/gfceu.xml new file mode 100644 index 00000000..1a090d39 --- /dev/null +++ b/gfceu.xml @@ -0,0 +1,1117 @@ + + + + + 10 + 1 + 1 + 0.5 + 10 + 2 + + + 10 + 1 + 1 + 0.5 + 10 + 2 + + + 65536 + 1 + 10 + 1 + 10 + 4046 + + + 65536 + 1 + 10 + 1 + 10 + 4046 + + + True + GFCE Ultra + 442 + gfceu.png + + + + True + 1 + + + True + True + 3 + + + True + 5 + 5 + + + True + 5 + + + True + 5 + ROM Filename: + + + False + False + + + + + True + True + + + 1 + + + + + True + True + _Browse... + True + + + + False + False + 2 + + + + + False + False + + + + + + + True + Main + + + False + + + + + True + 5 + 5 + + + True + + + True + gtk-dialog-info + + + False + False + + + + + True + Select an NES gamepad to configure. + True + + + False + False + 7 + 1 + + + + + False + False + + + + + True + 2 + 2 + 5 + 5 + + + True + True + Gamepad _3 + True + + + + 1 + 2 + + + + + + True + True + Gamepad _4 + True + + + + 1 + 2 + 1 + 2 + + + + + + True + True + Gamepad _2 + True + + + + 1 + 2 + + + + + + True + True + Gamepad _1 + True + + + + + + + + + False + False + 1 + + + + + True + True + gtk-help + True + + + + False + False + 5 + GTK_PACK_END + 2 + + + + + + + True + Input + + + 1 + False + + + + + True + 5 + 5 + + + True + True + Enable _OpenGL Rendering + True + True + + + False + False + + + + + True + True + Enable _Full Screen + True + True + + + False + False + 1 + + + + + True + + + True + X scale: + + + False + 5 + + + + + True + True + adjustment1 + 1 + True + + + False + 1 + + + + + False + 2 + + + + + True + + + True + Y scale: + + + False + 5 + + + + + True + True + adjustment2 + 1 + True + GTK_UPDATE_IF_VALID + + + False + 1 + + + + + False + 3 + + + + + True + + + True + Bits per pixel: + + + False + 5 + + + + + + + + False + 4 + + + + + True + <small><i>(Press Alt+Enter to toggle fullscreen in-game.)</i></small> + True + True + + + False + False + 5 + + + + + + + True + Video + + + 2 + False + + + + + True + 5 + 5 + + + True + + + True + gtk-dialog-info + + + False + False + + + + + True + If you would like to specify any command line options to FCE Ultra, specify them below. For a complete option reference, consult the official FCE Ultra documentation. + +Invalid options may cause GFCE Ultra to perform incorrectly. + + True + + + False + False + 1 + + + + + False + False + 5 + + + + + True + + + True + Extra Parameters: + + + False + False + 5 + + + + + True + True + + + 5 + 1 + + + + + False + 1 + + + + + + + True + Advanced + + + 3 + False + + + + + True + 5 + + + True + True + Enable _Sound + True + True + True + + + False + 5 + + + + + True + True + Extra _Quaility + True + True + True + + + False + 5 + 1 + + + + + True + + + True + Sample rate: + + + False + False + 5 + + + + + True + True + 11000 + + + False + False + 1 + + + + + False + 5 + 2 + + + + + 4 + False + + + + + True + Sound + + + 4 + False + + + + + True + False + 5 + 5 + + + True + True + _Host Game + True + True + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 19 + + + True + 2 + 2 + 5 + 5 + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + True + True + adjustment3 + 1 + + + 1 + 2 + + + + + + True + 0 + Password: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Port: + + + GTK_FILL + + + + + + + + + + False + False + 1 + + + + + True + True + _Join Game + True + True + host_radio + + + + False + False + 2 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 0 + 19 + + + True + 5 + 3 + 2 + 3 + 5 + + + True + True + adjustment4 + 1 + + + 1 + 2 + 1 + 2 + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Server Address: + + + GTK_FILL + + + + + + True + True + False + * + + + 1 + 2 + 2 + 3 + + + + + + True + True + + + 1 + 2 + + + + + + + + + + False + False + 3 + + + + + True + True + _No Network + True + True + True + host_radio + + + + False + False + 4 + + + + + + + True + False + Network + + + 5 + False + + + + + 10 + + + + + True + True + + + True + 3 + + + True + True + True + True + True + gtk-execute + True + + + + False + + + + + True + True + gtk-about + True + + + + False + False + 1 + + + + + True + True + gtk-quit + True + + + + False + 2 + + + + + + + False + False + 1 + + + + + + + GDK_WINDOW_TYPE_HINT_NORMAL + (C) Copyright 2006 + A GNOME front-end end for the FCE Ultra Nintendo Entertainment System emulator + http://dietschnitzel.com/gfceu/ + This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Lukas Sabota +<ltsmooth42@gmail.comt> + +Patch writers: +Scott Brown + translator-credits + Sketching: + J. Sammer +Digital Manipulation: + C. Kontros + +Artwork for old versions (< 0.2.7): + Jimmy Angelakos + <vyruss000@gmail.com> + gfceu_big.png + + + True + + + + + + True + + + False + GTK_PACK_END + + + + + + + + + True + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + 3 + 3 + + + + + + + + + + + + + + + + + + True + True + True + Up + + + 1 + 2 + + + + + True + True + True + Left + + + 1 + 2 + + + + + True + True + True + Down + + + 1 + 2 + 2 + 3 + + + + + True + True + True + Right + + + 2 + 3 + 1 + 2 + + + + + + + + + True + <b>D-Pad</b> + True + + + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + + + True + True + True + Select + + + + + True + True + True + Start + + + 1 + + + + + + + + + True + <b>Essentials</b> + True + + + + + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + + + True + True + True + B + + + + + True + True + True + A + + + 1 + + + + + + + + + True + <b>Alpha and Beta</b> + True + + + + + 2 + + + + + + diff --git a/setup.py b/setup.py index 9dbf60e1..24b04f49 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from distutils.core import setup setup(name="gfceu", - version="0.6.0", + version="0.7svn", scripts = ['gfceu'], data_files=[('share/gfceu/',['gfceu.glade', 'gfceu_big.png', 'gfceu.png']), ('share/pixmaps/', ['gfceu.png']), From 763a886c745f3147681bc5c119a7e6694e7fa758 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 17 Jun 2008 16:04:14 +0000 Subject: [PATCH 02/15] ocd --- gfceu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfceu b/gfceu index bd492a6a..88cc72c5 100644 --- a/gfceu +++ b/gfceu @@ -2,7 +2,7 @@ # gfceu - Graphical launcher for FCE Ultra. # Designed on Ubuntu, with platfrom independence in mind. version = "0.7svn" -title = "gfceux" +title = "gfceu" # Copyright (C) 2006 Lukas Sabota ## """ From a5d1f30977e5636b1f305b7e21fe221d4b894fa5 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 17 Jun 2008 17:33:48 +0000 Subject: [PATCH 03/15] updated setup files to reflect glade->builder change --- MANIFEST | 2 +- gfceu | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MANIFEST b/MANIFEST index 493dbe58..15a8e5c0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4,7 +4,7 @@ COPYING ChangeLog INSTALL TODO -gfceu.glade +gfceu.xml gfceu.desktop gfceu.png gfceu_big.png diff --git a/gfceu b/gfceu index 88cc72c5..69da9b8e 100644 --- a/gfceu +++ b/gfceu @@ -293,7 +293,7 @@ class GfceuApp: glade_file = os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceu/gfceu.xml') else: print 'ERROR.' - print 'Could not find the glade interface file.' + print 'Could not find the glade.xml file.' print 'Try reinstalling the application.' sys.exit(1) diff --git a/setup.py b/setup.py index 24b04f49..19cd503e 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup(name="gfceu", version="0.7svn", scripts = ['gfceu'], - data_files=[('share/gfceu/',['gfceu.glade', 'gfceu_big.png', 'gfceu.png']), + data_files=[('share/gfceu/',['gfceu.xml', 'gfceu_big.png', 'gfceu.png']), ('share/pixmaps/', ['gfceu.png']), ('share/man/man1/', ['gfceu.1']), ('share/applications/', ['gfceu.desktop'])], From 427c7ad721d9a0c3d45ad4d6803ac4b0b7ee53cf Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 17 Jun 2008 17:36:01 +0000 Subject: [PATCH 04/15] fixed gamepad config issue --- gfceu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfceu b/gfceu index 69da9b8e..c0c2e35c 100644 --- a/gfceu +++ b/gfceu @@ -507,7 +507,7 @@ class GfceuApp: 'gp3_button' : '3', 'gp4_button' : '4'} command = '-inputcfg gamepad' + d[widget.name] + ' /dev/null' - launch(command, True) + self.launch(command, True) def config_help_button_clicked(self, menuitem, data=None): msgbox = gtk.MessageDialog(parent=None, flags=0, From 8cd90d3352bb057dcaef6213749a5ea0506cbed5 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 18 Jun 2008 01:46:02 +0000 Subject: [PATCH 05/15] added support for sound buffer size also created a script to generate the gfceu.xml file --- generate_ui.sh | 3 +++ gfceu | 51 +++++++++++++++++++++++++++++--------------------- gfceu.glade | 32 +++++++++++++++++++++++++++++++ gfceu.xml | 32 +++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 21 deletions(-) create mode 100644 generate_ui.sh diff --git a/generate_ui.sh b/generate_ui.sh new file mode 100644 index 00000000..fe4862e8 --- /dev/null +++ b/generate_ui.sh @@ -0,0 +1,3 @@ +#!/bin/sh +gtk-builder-convert gfceu.glade gfceu.xml + diff --git a/gfceu b/gfceu index c0c2e35c..5df29922 100644 --- a/gfceu +++ b/gfceu @@ -63,6 +63,7 @@ class game_options: sound_check = True soundq_check = True soundrate_entry = "11000" + soundbufsize_entry = "48" # video fullscreen_check = False @@ -116,7 +117,9 @@ def give_widgets(): widgets.get_object("sound_check").set_active(options.sound_check) widgets.get_object("soundq_check").set_active(options.soundq_check) widgets.get_object("soundrate_entry").set_text(options.soundrate_entry) + widgets.get_object("soundbufsize_entry").set_text(options.soundbufsize_entry) + # video widgets.get_object("fullscreen_check").set_active(options.fullscreen_check) widgets.get_object("opengl_check").set_active(options.opengl_check) widgets.get_object("xscale_spin").set_value(options.xscale_spin) @@ -137,10 +140,11 @@ def give_widgets(): widgets.get_object("host_pass").set_text(options.host_pass) except AttributeError: - # When new widgets are added, old pickle files might break. + # When new widgets are added, old pickle files might break. options = game_options() give_widgets() - + except RuntimeError: + print "shit" def set_options(): """ @@ -155,6 +159,7 @@ def set_options(): options.sound_check = widgets.get_object("sound_check").get_active() options.soundq_check = widgets.get_object("soundq_check").get_active() options.soundrate_entry = widgets.get_object("soundrate_entry").get_text() + options.soundbufsize_entry = widgets.get_object("soundbufsize_entry").get_text() # video options.fullscreen_check = widgets.get_object("fullscreen_check").get_active() @@ -168,7 +173,7 @@ def set_options(): options.host_radio = widgets.get_object("host_radio").get_active() options.no_network_radio = widgets.get_object("no_network_radio").get_active() options.join_add = widgets.get_object("join_add").get_text() - options.join_port = widgets.get_object("join_port").get_value() + options.join_port = int(widgets.get_object("join_port").get_value()) options.join_pass = widgets.get_object("join_pass").get_text() options.host_port = widgets.get_object("host_port").get_value() options.host_pass = widgets.get_object("host_pass").get_text() @@ -297,13 +302,13 @@ class GfceuApp: print 'Try reinstalling the application.' sys.exit(1) - try: - print "Using: " + glade_file - widgets = gtk.Builder() - widgets.add_from_file(glade_file) - widgets.connect_signals(self) - except: - self.print_error("Couldn't load the glade UI file", 24) + #try: + print "Using: " + glade_file + widgets = gtk.Builder() + widgets.add_from_file(glade_file) + widgets.connect_signals(self) + #except: + # self.print_error("Couldn't load the glade UI file", 24) widgets.get_object("main_window").show_all() @@ -325,8 +330,9 @@ class GfceuApp: if options.soundrate_entry: sound_options += '--soundrate ' + options.soundrate_entry + ' ' - else: - soundrate = ' ' + + if options.soundbufsize_entry: + sound_options += '--soundbufsize ' + options.soundbufsize_entry + ' ' # video video_options = '' @@ -346,36 +352,39 @@ class GfceuApp: # Netplay is fucked right now - """ + if options.join_radio: if options.join_pass == '': netpass = '' else: - netpass = '--pass ' + '"' + options.join_pass + '" ' - network = '-net "' + options.join_add + '"'\ + netpass = '--pass ' + options.join_pass + network = '--net ' + options.join_add +\ ' --port '+ str(options.join_port) + ' ' + netpass else: network = '' - + if options.host_radio: + """ if options.host_pass == '': netpass = ' ' else: - netpass = ' --pass ' + '"' + options.host_pass + '" ' +# netpass = ' --pass ' + '"' + options.host_pass + '" ' + netpass = ' --pass ' + options.host_pass network = '--net localhost --port '+\ str(options.host_port) + netpass + ' ' + """ + network = '' if local: network = '' - """ - network = '' + command = self.fceux_binary + ' ' + sound_options + video_options +\ network + options.extra_entry + ' '+ rom_name self.msg('Command: ' + command) # more code to disable because netplay is fucked - """ + """ if options.host_radio: xterm_binary = find_binary("xterm") if xterm_binary == None: @@ -406,7 +415,7 @@ class GfceuApp: if options.host_radio: os.kill(pid, 9) """ - + ### Callbacks def launch_button_clicked(self, arg1): diff --git a/gfceu.glade b/gfceu.glade index 57d03c28..a3d8e35b 100644 --- a/gfceu.glade +++ b/gfceu.glade @@ -527,6 +527,38 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 2 + + + True + + + True + Buffer size (ms): + + + False + False + 5 + + + + + True + True + 48 + + + False + False + 1 + + + + + False + 3 + + 4 diff --git a/gfceu.xml b/gfceu.xml index 1a090d39..5f64bb63 100644 --- a/gfceu.xml +++ b/gfceu.xml @@ -535,6 +535,38 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 2 + + + True + + + True + Buffer size (ms): + + + False + False + 5 + + + + + True + True + 48 + + + False + False + 1 + + + + + False + 3 + + 4 From 0c521a6327fa2472465294a02a2b686074c7180e Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 24 Jun 2008 04:41:05 +0000 Subject: [PATCH 06/15] No longer requires gnome-vfs to play games over the network --- ChangeLog | 1 + INSTALL | 2 -- gfceu | 45 ++------------------------------------------- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2dac599..877407c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* No longer requires GnomeVFS * Major code cleanup * Now requires pygtk >= 2.12 * Transitioned from gtk.glade to gtk.Builder. diff --git a/INSTALL b/INSTALL index eb210c0a..86a50427 100644 --- a/INSTALL +++ b/INSTALL @@ -9,5 +9,3 @@ Python (tested with 2.5); (Ubuntu package name: python) PyGTK, and GTK; (Ubuntu package name: (python-gtk2 libgtk2.0-0) FCE UltraX - You're going to need the latest fceux for gfceu .7 to work -Optional: -GnomeVFS 2 (tested with 2.14.1) (Ubuntu package name libgnomevfs2-0 ) diff --git a/gfceu b/gfceu index 5df29922..b8e7df9c 100644 --- a/gfceu +++ b/gfceu @@ -41,17 +41,6 @@ except ImportError: On Debian based systems (like Ubuntu), try this command:\n\ sudo apt-get install python-gtk2 libgtk2.0-0" -try: - import gnomevfs - have_gnomevfs = True -except ImportError: - print "The gnomevfs libraries cannot be found.\n\ - To enable ROM loading over the network, ensure that gnomevfs is installed on\ - this system.\n\ - On Debian based systems (like Ubuntu), try this command:\n\ - sudo apt-get install python-gtk2 libgnomevfs2-0" - have_gnomevfs = False - @@ -424,34 +413,8 @@ class GfceuApp: if widgets.get_object("rom_entry").get_text() == '': self.msg('Please specify a ROM to open in the main tab.', True) return - if options.network_rom: - try: - myvfs = gnomevfs.Handle(options.romfile) - # FIXME - # Smarter way of handling this? Copying direct error information? - except gnomevfs.HostNotFoundError: - gfceu_error("Remote ROM host not found.", 7, True, False) - return - except: - gfceu_error("Failed to open the network ROM.", 6, True, False) - return - myfile = file('/tmp/gfceu.nes', 'wb') - while 1: - try: - myfile.write(myvfs.read(1024)) - except gnomevfs.EOFError: - break - except: - gfceu_error("Failed to open the network ROM.", 10, True, False) - return - myvfs.close() - myfile.close() - romfile = '/tmp/gfceu.nes' - else: - romfile = options.romfile - - self.launch('"'+romfile+'"') + self.launch('"'+ options.romfile +'"') def about_button_clicked(self, menuitem, data=None): widgets.get_object("about_dialog").set_name('GNOME FCE Ultra '+version) @@ -465,11 +428,7 @@ class GfceuApp: gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - if have_gnomevfs: - chooser.set_property("local-only", False) - else: - chooser.set_property("local-only", True) - + chooser.set_property("local-only", False) chooser.set_default_response(gtk.RESPONSE_OK) filter=gtk.FileFilter() From 656d98c45bfb1195c22dc1fbdeae5be9ad15b510 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 24 Jun 2008 04:43:47 +0000 Subject: [PATCH 07/15] code cleanup --- gfceu | 1 - 1 file changed, 1 deletion(-) diff --git a/gfceu b/gfceu index b8e7df9c..13b02259 100644 --- a/gfceu +++ b/gfceu @@ -72,7 +72,6 @@ class game_options: host_port = 4046 host_pass = '' no_network_radio = True - network_rom = False def load_options(): From b2ef9985fb8743c8226ac4a16e07d972f5a3ff34 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Tue, 24 Jun 2008 16:43:26 +0000 Subject: [PATCH 08/15] code cleanup --- gfceu | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/gfceu b/gfceu index 13b02259..d53d179a 100644 --- a/gfceu +++ b/gfceu @@ -29,7 +29,7 @@ import os import pickle import shutil from optparse import OptionParser -from subprocess import Popen +#from subprocess import Popen try: import pygtk @@ -44,9 +44,6 @@ except ImportError: - # # # # # # # # -# GFCEU Functions - class game_options: # sound sound_check = True @@ -194,7 +191,7 @@ def find_binary(file): return None -############################################################################## +# # # # # # # # # # # # # # # # # # Globals options = None appconfigdir = os.getenv('HOME') + '/.'+ title @@ -290,13 +287,13 @@ class GfceuApp: print 'Try reinstalling the application.' sys.exit(1) - #try: - print "Using: " + glade_file - widgets = gtk.Builder() - widgets.add_from_file(glade_file) - widgets.connect_signals(self) - #except: - # self.print_error("Couldn't load the glade UI file", 24) + try: + print "Using: " + glade_file + widgets = gtk.Builder() + widgets.add_from_file(glade_file) + widgets.connect_signals(self) + except: + self.print_error("Couldn't load the UI data.", 24) widgets.get_object("main_window").show_all() @@ -534,13 +531,8 @@ class GfceuApp: if __name__ == '__main__': - - parser = OptionParser(version='%prog '+ version) parser.parse_args() - - - app = GfceuApp() From 9bc3055053337fe81d2c04a2057fa36c77b606df Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 25 Jun 2008 16:34:39 +0000 Subject: [PATCH 09/15] updated ui --- gfceu.glade | 1953 ++++++++++++++++++++++++++------------------------- gfceu.xml | 674 +++++++++--------- 2 files changed, 1319 insertions(+), 1308 deletions(-) diff --git a/gfceu.glade b/gfceu.glade index a3d8e35b..c3478d33 100644 --- a/gfceu.glade +++ b/gfceu.glade @@ -1,959 +1,6 @@ - - - + - - True - GFCE Ultra - 442 - gfceu.png - - - - True - 1 - - - True - True - 3 - - - True - 5 - 5 - - - True - 5 - - - True - 5 - ROM Filename: - - - False - False - - - - - True - True - - - 1 - - - - - True - True - _Browse... - True - 0 - - - - False - False - 2 - - - - - False - False - - - - - - - True - Main - - - tab - False - - - - - True - 5 - 5 - - - True - - - True - gtk-dialog-info - - - False - False - - - - - True - Select an NES gamepad to configure. - True - - - False - False - 7 - 1 - - - - - False - False - - - - - True - 2 - 2 - 5 - 5 - - - True - True - Gamepad _3 - True - 0 - - - - 1 - 2 - - - - - - True - True - Gamepad _4 - True - 0 - - - - 1 - 2 - 1 - 2 - - - - - - True - True - Gamepad _2 - True - 0 - - - - 1 - 2 - - - - - - True - True - Gamepad _1 - True - 0 - - - - - - - - - False - False - 1 - - - - - True - True - gtk-help - True - 0 - - - - False - False - 5 - GTK_PACK_END - 2 - - - - - 1 - - - - - True - Input - - - tab - 1 - False - - - - - True - 5 - 5 - - - True - True - Enable _OpenGL Rendering - True - 0 - True - - - False - False - - - - - True - True - Enable _Full Screen - True - 0 - True - - - False - False - 1 - - - - - True - - - True - X scale: - - - False - 5 - - - - - True - True - 2 1 10 0.5 1 10 - 1 - True - - - False - 1 - - - - - False - 2 - - - - - True - - - True - Y scale: - - - False - 5 - - - - - True - True - 2 1 10 0.5 1 10 - 1 - True - GTK_UPDATE_IF_VALID - - - False - 1 - - - - - False - 3 - - - - - True - - - True - Bits per pixel: - - - False - 5 - - - - - - - - False - 4 - - - - - True - <small><i>(Press Alt+Enter to toggle fullscreen in-game.)</i></small> - True - True - - - False - False - 5 - - - - - 2 - - - - - True - Video - - - tab - 2 - False - - - - - True - 5 - 5 - - - True - - - True - gtk-dialog-info - - - False - False - - - - - True - If you would like to specify any command line options to FCE Ultra, specify them below. For a complete option reference, consult the official FCE Ultra documentation. - -Invalid options may cause GFCE Ultra to perform incorrectly. - - True - - - False - False - 1 - - - - - False - False - 5 - - - - - True - - - True - Extra Parameters: - - - False - False - 5 - - - - - True - True - - - 5 - 1 - - - - - False - 1 - - - - - 3 - - - - - True - Advanced - - - tab - 3 - False - - - - - True - 5 - - - True - True - Enable _Sound - True - 0 - True - True - - - False - 5 - - - - - True - True - Extra _Quaility - True - 0 - True - True - - - False - 5 - 1 - - - - - True - - - True - Sample rate: - - - False - False - 5 - - - - - True - True - 11000 - - - False - False - 1 - - - - - False - 5 - 2 - - - - - True - - - True - Buffer size (ms): - - - False - False - 5 - - - - - True - True - 48 - - - False - False - 1 - - - - - False - 3 - - - - - 4 - False - - - - - True - Sound - - - tab - 4 - False - - - - - True - False - 5 - 5 - - - True - True - _Host Game - True - 0 - True - - - - False - False - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 19 - - - True - 2 - 2 - 5 - 5 - - - True - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - 4046 1 65536 1 10 10 - 1 - - - 1 - 2 - - - - - - True - 0 - Password: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Port: - - - GTK_FILL - - - - - - - - - - False - False - 1 - - - - - True - True - _Join Game - True - 0 - True - host_radio - - - - False - False - 2 - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 0 - 19 - - - True - 5 - 3 - 2 - 3 - 5 - - - True - True - 4046 1 65536 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - Server Port: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Server Address: - - - GTK_FILL - - - - - - True - True - False - * - - - 1 - 2 - 2 - 3 - - - - - - True - True - - - 1 - 2 - - - - - - - - - - False - False - 3 - - - - - True - True - _No Network - True - 0 - True - True - host_radio - - - - False - False - 4 - - - - - 5 - - - - - True - False - Network - - - tab - 5 - False - - - - - 10 - - - - - True - True - - - True - 3 - - - True - True - True - True - True - gtk-execute - True - 0 - - - - False - - - - - True - True - gtk-about - True - 0 - - - - False - False - 1 - - - - - True - True - gtk-quit - True - 0 - - - - False - 2 - - - - - - - False - False - 1 - - - - - - - GDK_WINDOW_TYPE_HINT_NORMAL - (C) Copyright 2006 - A GNOME front-end end for the FCE Ultra Nintendo Entertainment System emulator - http://dietschnitzel.com/gfceu/ - This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Lukas Sabota -<ltsmooth42@gmail.comt> - -Patch writers: -Scott Brown - translator-credits - Sketching: - J. Sammer -Digital Manipulation: - C. Kontros - -Artwork for old versions (< 0.2.7): - Jimmy Angelakos - <vyruss000@gmail.com> - gfceu_big.png - - - True - - - - - - True - - - False - GTK_PACK_END - - - - - + @@ -988,27 +35,16 @@ Artwork for old versions (< 0.2.7): - + True True True - Up - 0 - - - 1 - 2 - - - - - True - True - True - Left + Right 0 + 2 + 3 1 2 @@ -1029,20 +65,31 @@ Artwork for old versions (< 0.2.7): - + True True True - Right + Left 0 - 2 - 3 1 2 + + + True + True + True + Up + 0 + + + 1 + 2 + + @@ -1166,4 +213,962 @@ Artwork for old versions (< 0.2.7): + + GDK_WINDOW_TYPE_HINT_NORMAL + (C) Copyright 2006 + A GNOME front-end end for the FCE Ultra Nintendo Entertainment System emulator + http://dietschnitzel.com/gfceu/ + This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Lukas Sabota +<ltsmooth42@gmail.comt> + +Patch writers: +Scott Brown + translator-credits + Sketching: + J. Sammer +Digital Manipulation: + C. Kontros + +Artwork for old versions (< 0.2.7): + Jimmy Angelakos + <vyruss000@gmail.com> + gfceu_big.png + + + True + + + + + + True + + + False + GTK_PACK_END + + + + + + + True + GFCE Ultra + 442 + gfceu.png + + + + True + 1 + + + True + True + 3 + + + True + 5 + 5 + + + True + 5 + + + True + 5 + ROM Filename: + + + False + False + + + + + True + True + + + 1 + + + + + True + True + _Browse... + True + 0 + + + + False + False + 2 + + + + + False + False + + + + + + + True + Main + + + False + tab + + + + + True + 5 + 5 + + + True + + + True + gtk-dialog-info + + + False + False + + + + + True + Select an NES gamepad to configure. + True + + + False + False + 7 + 1 + + + + + False + False + + + + + True + 2 + 2 + 5 + 5 + + + True + True + Gamepad _1 + True + 0 + + + + + + + + + True + True + Gamepad _2 + True + 0 + + + + 1 + 2 + + + + + + True + True + Gamepad _4 + True + 0 + + + + 1 + 2 + 1 + 2 + + + + + + True + True + Gamepad _3 + True + 0 + + + + 1 + 2 + + + + + + False + False + 1 + + + + + True + True + gtk-help + True + 0 + + + + False + False + 5 + GTK_PACK_END + 2 + + + + + 1 + + + + + True + Input + + + 1 + False + tab + + + + + True + 5 + 5 + + + True + True + Enable _OpenGL Rendering + True + 0 + True + + + False + False + + + + + True + True + Enable _Full Screen + True + 0 + True + + + False + False + 1 + + + + + True + + + True + X scale: + + + False + 5 + + + + + True + True + 2 1 10 0.5 1 10 + 1 + True + + + False + 1 + + + + + False + 2 + + + + + True + + + True + Y scale: + + + False + 5 + + + + + True + True + 2 1 10 0.5 1 10 + 1 + True + GTK_UPDATE_IF_VALID + + + False + 1 + + + + + False + 3 + + + + + True + + + True + Bits per pixel: + + + False + 5 + + + + + True + True + + + 1 + + + + + False + 4 + + + + + True + <small><i>(Press Alt+Enter to toggle fullscreen in-game.)</i></small> + True + True + + + False + False + 5 + + + + + 2 + + + + + True + Video + + + 2 + False + tab + + + + + True + 5 + 5 + + + True + + + True + gtk-dialog-info + + + False + False + + + + + True + If you would like to specify any command line options to FCE Ultra, specify them below. For a complete option reference, consult the official FCE Ultra documentation. + +Invalid options may cause GFCE Ultra to perform incorrectly. + + True + + + False + False + 1 + + + + + False + False + 5 + + + + + True + + + True + Extra Parameters: + + + False + False + 5 + + + + + True + True + + + 5 + 1 + + + + + False + 1 + + + + + 3 + + + + + True + Advanced + + + 3 + False + tab + + + + + True + 5 + + + True + True + Enable _Sound + True + 0 + True + True + + + False + 5 + + + + + True + True + Extra _Quaility + True + 0 + True + True + + + False + 5 + 1 + + + + + True + + + True + Sample rate: + + + False + False + 5 + + + + + True + True + 11000 + + + False + False + 1 + + + + + False + 5 + 2 + + + + + True + + + True + Buffer size (ms): + + + False + False + 5 + + + + + True + True + 48 + + + False + False + 1 + + + + + False + 3 + + + + + 4 + False + + + + + True + Sound + + + 4 + False + tab + + + + + True + False + 5 + 5 + + + True + True + _Host Game + True + 0 + True + + + + False + False + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 19 + + + True + 2 + 2 + 5 + 5 + + + True + 0 + Port: + + + GTK_FILL + + + + + + True + 0 + Password: + + + 1 + 2 + GTK_FILL + + + + + + True + True + 4046 1 65536 1 10 10 + 1 + + + 1 + 2 + + + + + + True + True + + + 1 + 2 + 1 + 2 + + + + + + + + + + False + False + 1 + + + + + True + True + _Join Game + True + 0 + True + host_radio + + + + False + False + 2 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 0 + 19 + + + True + 5 + 3 + 2 + 3 + 5 + + + True + True + + + 1 + 2 + + + + + + True + True + False + * + + + 1 + 2 + 2 + 3 + + + + + + True + 0 + Server Address: + + + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + True + 4046 1 65536 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + + + + + + + + + + False + False + 3 + + + + + True + True + _No Network + True + 0 + True + True + host_radio + + + + False + False + 4 + + + + + 5 + + + + + True + False + Network + + + 5 + False + tab + + + + + 10 + + + + + True + True + + + True + 3 + + + True + True + True + True + True + gtk-execute + True + 0 + + + + False + + + + + True + True + gtk-about + True + 0 + + + + False + False + 1 + + + + + True + True + gtk-quit + True + 0 + + + + False + 2 + + + + + + + False + False + 1 + + + + + diff --git a/gfceu.xml b/gfceu.xml index 5f64bb63..13e40e52 100644 --- a/gfceu.xml +++ b/gfceu.xml @@ -1,5 +1,4 @@ - 10 @@ -33,6 +32,253 @@ 10 4046 + + + + + True + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + 3 + 3 + + + + + + + + + + + + + + + + + + True + True + True + Right + + + 2 + 3 + 1 + 2 + + + + + True + True + True + Down + + + 1 + 2 + 2 + 3 + + + + + True + True + True + Left + + + 1 + 2 + + + + + True + True + True + Up + + + 1 + 2 + + + + + + + + + True + <b>D-Pad</b> + True + + + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + + + True + True + True + Select + + + + + True + True + True + Start + + + 1 + + + + + + + + + True + <b>Essentials</b> + True + + + + + 1 + + + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + + + True + True + True + B + + + + + True + True + True + A + + + 1 + + + + + + + + + True + <b>Alpha and Beta</b> + True + + + + + 2 + + + + + + + GDK_WINDOW_TYPE_HINT_NORMAL + (C) Copyright 2006 + A GNOME front-end end for the FCE Ultra Nintendo Entertainment System emulator + http://dietschnitzel.com/gfceu/ + This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + Lukas Sabota +<ltsmooth42@gmail.comt> + +Patch writers: +Scott Brown + translator-credits + Sketching: + J. Sammer +Digital Manipulation: + C. Kontros + +Artwork for old versions (< 0.2.7): + Jimmy Angelakos + <vyruss000@gmail.com> + gfceu_big.png + + + True + + + + + + True + + + False + GTK_PACK_END + + + + + True GFCE Ultra @@ -153,16 +399,28 @@ 5 5 - + True True - Gamepad _3 + Gamepad _1 True - 1 - 2 + + + + + + True + True + Gamepad _2 + True + + + + 1 + 2 @@ -183,28 +441,16 @@ - + True True - Gamepad _2 - True - - - - 1 - 2 - - - - - - True - True - Gamepad _1 + Gamepad _3 True + 1 + 2 @@ -354,7 +600,13 @@ - + + True + True + + + 1 + @@ -620,28 +872,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 5 5 - + True - True + 0 + Port: - 1 - 2 - 1 - 2 - - - - - - True - True - adjustment3 - 1 - - - 1 - 2 + GTK_FILL @@ -659,13 +896,28 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - + True - 0 - Port: + True + adjustment3 + 1 - GTK_FILL + 1 + 2 + + + + + + True + True + + + 1 + 2 + 1 + 2 @@ -715,54 +967,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 3 5 - + True True - adjustment4 - 1 1 2 - 1 - 2 - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - - True - 0 - Server Port: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Server Address: - - - GTK_FILL @@ -782,13 +993,54 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - + + True + 0 + Server Address: + + + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + True True + adjustment4 + 1 1 2 + 1 + 2 @@ -900,250 +1152,4 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - - GDK_WINDOW_TYPE_HINT_NORMAL - (C) Copyright 2006 - A GNOME front-end end for the FCE Ultra Nintendo Entertainment System emulator - http://dietschnitzel.com/gfceu/ - This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Lukas Sabota -<ltsmooth42@gmail.comt> - -Patch writers: -Scott Brown - translator-credits - Sketching: - J. Sammer -Digital Manipulation: - C. Kontros - -Artwork for old versions (< 0.2.7): - Jimmy Angelakos - <vyruss000@gmail.com> - gfceu_big.png - - - True - - - - - - True - - - False - GTK_PACK_END - - - - - - - - - True - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - True - 3 - 3 - - - - - - - - - - - - - - - - - - True - True - True - Up - - - 1 - 2 - - - - - True - True - True - Left - - - 1 - 2 - - - - - True - True - True - Down - - - 1 - 2 - 2 - 3 - - - - - True - True - True - Right - - - 2 - 3 - 1 - 2 - - - - - - - - - True - <b>D-Pad</b> - True - - - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - True - - - True - True - True - Select - - - - - True - True - True - Start - - - 1 - - - - - - - - - True - <b>Essentials</b> - True - - - - - 1 - - - - - True - 0 - GTK_SHADOW_NONE - - - True - 12 - - - True - - - True - True - True - B - - - - - True - True - True - A - - - 1 - - - - - - - - - True - <b>Alpha and Beta</b> - True - - - - - 2 - - - - - From ac2abd91f101930ea8da1b2d19d3c97e07a9b5ea Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 28 Jun 2008 01:56:25 +0000 Subject: [PATCH 10/15] code cleanup --- gfceu | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gfceu b/gfceu index d53d179a..89213a72 100644 --- a/gfceu +++ b/gfceu @@ -457,12 +457,6 @@ class GfceuApp: x = chooser.get_filename() widgets.get_object("rom_entry").set_text(x) options.romfile = x - options.network_rom = False - elif chooser.get_uri(): - x = chooser.get_uri() - widgets.get_object("rom_entry").set_text(x) - options.romfile = x - options.network_rom = True def gamepad_clicked(self, widget, data=None): From 2db6590fbd1058e6cd7db3a0968e48b165e380a6 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 28 Jun 2008 19:13:37 +0000 Subject: [PATCH 11/15] added a new module that creates a sdl window and gets a key from the user this can be used so that hotkeys and input can be controlled from the GUI directly this module however adds an additional depenency to the program: pygame i might just rewrite this in c so gfceu doesn't have another dependency --- get_key.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 get_key.py diff --git a/get_key.py b/get_key.py new file mode 100755 index 00000000..268964bb --- /dev/null +++ b/get_key.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +import pygame +import sys +from pygame.locals import * + +pygame.init() +width = 300 +height = 100 +screen = pygame.display.set_mode((width, height)) +pygame.display.set_caption("Press any key. . .") + +while 1: + for event in pygame.event.get(): + if event.type == KEYDOWN: + print event.key + sys.exit(event.key) + From 508734aee6b18ab27ac621734cac8627309f3234 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 28 Jun 2008 19:19:06 +0000 Subject: [PATCH 12/15] Modularized the sdl KeyGrabber --- get_key.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/get_key.py b/get_key.py index 268964bb..efbbb593 100755 --- a/get_key.py +++ b/get_key.py @@ -3,15 +3,23 @@ import pygame import sys from pygame.locals import * -pygame.init() -width = 300 -height = 100 -screen = pygame.display.set_mode((width, height)) -pygame.display.set_caption("Press any key. . .") -while 1: - for event in pygame.event.get(): - if event.type == KEYDOWN: - print event.key - sys.exit(event.key) +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. . .") + + 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 + +if __name__ == "__main__": + kg = KeyGrabber() + print kg.get_key() From e560984671c8f3af1b98a98168cf5ff54902f880 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 29 Jun 2008 01:12:28 +0000 Subject: [PATCH 13/15] code cleanup fixed some stupid bugs with the saving of options --- gfceu | 40 ++++++++++------------------------------ gfceu.xml | 2 -- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/gfceu b/gfceu index 89213a72..b1ba0ab9 100644 --- a/gfceu +++ b/gfceu @@ -82,7 +82,7 @@ def load_options(): ifile.close() def save_options(): - global options, optionsfile, appconfigdir + global options, optionsfile ofile = file(optionsfile, 'w') pickle.dump(options, ofile) ofile.close() @@ -194,15 +194,13 @@ def find_binary(file): # # # # # # # # # # # # # # # # # # Globals options = None -appconfigdir = os.getenv('HOME') + '/.'+ title -optionsfile = appconfigdir + 'gfceu_options.dat' +optionsfile = os.getenv('HOME') + '/gfceu_options.dat' widgets = None class GfceuApp: def __init__(self): self.fceux_binary = self.find_fceu() self.load_ui() - self.setup_environment() options = game_options() load_options() @@ -242,24 +240,7 @@ class GfceuApp: msgbox.destroy() if fatal: sys.exit(code) - - def setup_environment (self): - """ - Configures the environment if this is the first time the application - has been run. For instance, it checks for the options file and creates - it if it doesn't exist. It also converts between the old version and - the new version of this application, which stores the options file in - a separate directory. - """ - - global appconfigdir, optionsfile - - if not os.path.exists(appconfigdir): - # this is the first time the application is run. - # create the directory - self.msg("Creating application settings directory") - os.mkdir(appconfigdir) - + def find_fceu(self): bin = find_binary('fceux') if bin == None: @@ -287,13 +268,13 @@ class GfceuApp: print 'Try reinstalling the application.' sys.exit(1) - try: - print "Using: " + glade_file - widgets = gtk.Builder() - widgets.add_from_file(glade_file) - widgets.connect_signals(self) - except: - self.print_error("Couldn't load the UI data.", 24) + #try: + print "Using: " + glade_file + widgets = gtk.Builder() + widgets.add_from_file(glade_file) + widgets.connect_signals(self) + #except: + # self.print_error("Couldn't load the UI data.", 24) widgets.get_object("main_window").show_all() @@ -517,7 +498,6 @@ class GfceuApp: options.no_network_radio = True def end(self, menuitem, data=None): - global options, optionsfile set_options() save_options() gtk.main_quit() diff --git a/gfceu.xml b/gfceu.xml index 13e40e52..671b14b8 100644 --- a/gfceu.xml +++ b/gfceu.xml @@ -1,4 +1,3 @@ - 10 @@ -32,7 +31,6 @@ 10 4046 - From 2ebe9a8a46f40606ea8dbc257d875ac4095a3b5b Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 29 Jun 2008 01:13:50 +0000 Subject: [PATCH 14/15] oops --- gfceu | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gfceu b/gfceu index b1ba0ab9..8ab336d0 100644 --- a/gfceu +++ b/gfceu @@ -268,13 +268,13 @@ class GfceuApp: print 'Try reinstalling the application.' sys.exit(1) - #try: - print "Using: " + glade_file - widgets = gtk.Builder() - widgets.add_from_file(glade_file) - widgets.connect_signals(self) - #except: - # self.print_error("Couldn't load the UI data.", 24) + try: + print "Using: " + glade_file + widgets = gtk.Builder() + widgets.add_from_file(glade_file) + widgets.connect_signals(self) + except: + self.print_error("Couldn't load the UI data.", 24) widgets.get_object("main_window").show_all() From ebadaa21a7b1c528bbd8886ed952ae5f49ff5b38 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 2 Jul 2008 05:58:29 +0000 Subject: [PATCH 15/15] gfceu now supports autoscaling --- gfceu | 21 +++-- gfceu.glade | 243 ++++++++++++++++++++++++++++------------------------ gfceu.xml | 223 +++++++++++++++++++++++++---------------------- 3 files changed, 262 insertions(+), 225 deletions(-) diff --git a/gfceu b/gfceu index 8ab336d0..abfc1b54 100644 --- a/gfceu +++ b/gfceu @@ -44,7 +44,7 @@ except ImportError: -class game_options: +class GameOptions: # sound sound_check = True soundq_check = True @@ -59,6 +59,7 @@ class game_options: extra_entry = '' romfile = '' opengl_check = False + autoscale_check = True # network join_radio = False @@ -107,6 +108,7 @@ def give_widgets(): # video widgets.get_object("fullscreen_check").set_active(options.fullscreen_check) widgets.get_object("opengl_check").set_active(options.opengl_check) + widgets.get_object("autoscale_check").set_active(options.autoscale_check) widgets.get_object("xscale_spin").set_value(options.xscale_spin) widgets.get_object("yscale_spin").set_value(options.yscale_spin) @@ -126,10 +128,8 @@ def give_widgets(): except AttributeError: # When new widgets are added, old pickle files might break. - options = game_options() - give_widgets() - except RuntimeError: - print "shit" + options = GameOptions() + give_widgets() def set_options(): """ @@ -149,6 +149,8 @@ def set_options(): # video options.fullscreen_check = widgets.get_object("fullscreen_check").get_active() options.opengl_check = widgets.get_object("opengl_check").get_active() + options.autoscale_check = widgets.get_object("autoscale_check").get_active() + options.xscale_spin = widgets.get_object("xscale_spin").get_value() options.yscale_spin = widgets.get_object("yscale_spin").get_value() @@ -194,7 +196,7 @@ def find_binary(file): # # # # # # # # # # # # # # # # # # Globals options = None -optionsfile = os.getenv('HOME') + '/gfceu_options.dat' +optionsfile = os.getenv('HOME') + '/.gfceu_options.dat' widgets = None class GfceuApp: @@ -202,7 +204,7 @@ class GfceuApp: self.fceux_binary = self.find_fceu() self.load_ui() - options = game_options() + options = GameOptions() load_options() give_widgets() try: @@ -311,6 +313,11 @@ class GfceuApp: video_options += '--opengl 1 ' else: video_options += '--opengl 0 ' + + if options.autoscale_check: + video_options += '--autoscale 1 ' + else: + video_options += '--autoscale 0 ' video_options += ' --xscale ' + str(options.xscale_spin) video_options += ' --yscale ' + str(options.yscale_spin) diff --git a/gfceu.glade b/gfceu.glade index c3478d33..d2a3582a 100644 --- a/gfceu.glade +++ b/gfceu.glade @@ -1,6 +1,7 @@ - + + + - @@ -35,16 +36,27 @@ - + True True True - Right + Up + 0 + + + 1 + 2 + + + + + True + True + True + Left 0 - 2 - 3 1 2 @@ -65,31 +77,20 @@ - + True True True - Left + Right 0 + 2 + 3 1 2 - - - True - True - True - Up - 0 - - - 1 - 2 - - @@ -337,8 +338,8 @@ Artwork for old versions (< 0.2.7): Main - False tab + False @@ -386,30 +387,17 @@ Artwork for old versions (< 0.2.7): 5 5 - + True True - Gamepad _1 + Gamepad _3 True 0 - - - - - - True - True - Gamepad _2 - True - 0 - - - - 1 - 2 + 1 + 2 @@ -431,17 +419,30 @@ Artwork for old versions (< 0.2.7): - + True True - Gamepad _3 + Gamepad _2 + True + 0 + + + + 1 + 2 + + + + + + True + True + Gamepad _1 True 0 - 1 - 2 @@ -480,9 +481,9 @@ Artwork for old versions (< 0.2.7): Input + tab 1 False - tab @@ -519,6 +520,20 @@ Artwork for old versions (< 0.2.7): 1 + + + True + True + _Autoscale Fullscreen + True + 0 + True + + + False + 2 + + True @@ -548,7 +563,7 @@ Artwork for old versions (< 0.2.7): False - 2 + 3 @@ -581,7 +596,7 @@ Artwork for old versions (< 0.2.7): False - 3 + 4 @@ -609,7 +624,7 @@ Artwork for old versions (< 0.2.7): False - 4 + 5 @@ -622,7 +637,7 @@ Artwork for old versions (< 0.2.7): False False - 5 + 6 @@ -636,9 +651,9 @@ Artwork for old versions (< 0.2.7): Video + tab 2 False - tab @@ -722,9 +737,9 @@ Invalid options may cause GFCE Ultra to perform incorrectly. Advanced + tab 3 False - tab @@ -839,9 +854,9 @@ Invalid options may cause GFCE Ultra to perform incorrectly. Sound + tab 4 False - tab @@ -882,26 +897,15 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 5 5 - + True - 0 - Port: - - - GTK_FILL - - - - - - True - 0 - Password: + True + 1 + 2 1 2 - GTK_FILL @@ -919,15 +923,26 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - + True - True + 0 + Password: - 1 - 2 1 2 + GTK_FILL + + + + + + True + 0 + Port: + + + GTK_FILL @@ -978,13 +993,54 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 3 5 - + True True + 4046 1 65536 1 10 10 + 1 1 2 + 1 + 2 + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Server Address: + + + GTK_FILL @@ -1004,54 +1060,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - - True - 0 - Server Address: - - - GTK_FILL - - - - - - True - 0 - Server Port: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - + True True - 4046 1 65536 1 10 10 - 1 1 2 - 1 - 2 @@ -1096,9 +1111,9 @@ Invalid options may cause GFCE Ultra to perform incorrectly. Network + tab 5 False - tab diff --git a/gfceu.xml b/gfceu.xml index 671b14b8..496f7fbe 100644 --- a/gfceu.xml +++ b/gfceu.xml @@ -1,3 +1,5 @@ + + 10 @@ -65,15 +67,25 @@ - + True True True - Right + Up + + + 1 + 2 + + + + + True + True + True + Left - 2 - 3 1 2 @@ -93,29 +105,19 @@ - + True True True - Left + Right + 2 + 3 1 2 - - - True - True - True - Up - - - 1 - 2 - - @@ -397,28 +399,16 @@ Artwork for old versions (< 0.2.7): 5 5 - + True True - Gamepad _1 + Gamepad _3 True - - - - - - True - True - Gamepad _2 - True - - - - 1 - 2 + 1 + 2 @@ -439,16 +429,28 @@ Artwork for old versions (< 0.2.7): - + True True - Gamepad _3 + Gamepad _2 + True + + + + 1 + 2 + + + + + + True + True + Gamepad _1 True - 1 - 2 @@ -519,6 +521,19 @@ Artwork for old versions (< 0.2.7): 1 + + + True + True + _Autoscale Fullscreen + True + True + + + False + 2 + + True @@ -548,7 +563,7 @@ Artwork for old versions (< 0.2.7): False - 2 + 3 @@ -581,7 +596,7 @@ Artwork for old versions (< 0.2.7): False - 3 + 4 @@ -609,7 +624,7 @@ Artwork for old versions (< 0.2.7): False - 4 + 5 @@ -622,7 +637,7 @@ Artwork for old versions (< 0.2.7): False False - 5 + 6 @@ -870,26 +885,15 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 5 5 - + True - 0 - Port: - - - GTK_FILL - - - - - - True - 0 - Password: + True + 1 + 2 1 2 - GTK_FILL @@ -907,15 +911,26 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - + True - True + 0 + Password: - 1 - 2 1 2 + GTK_FILL + + + + + + True + 0 + Port: + + + GTK_FILL @@ -965,13 +980,54 @@ Invalid options may cause GFCE Ultra to perform incorrectly. 3 5 - + True True + adjustment4 + 1 1 2 + 1 + 2 + + + + + + True + 0 + Password: + + + 2 + 3 + GTK_FILL + + + + + + True + 0 + Server Port: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Server Address: + + + GTK_FILL @@ -991,54 +1047,13 @@ Invalid options may cause GFCE Ultra to perform incorrectly. - - True - 0 - Server Address: - - - GTK_FILL - - - - - - True - 0 - Server Port: - - - 1 - 2 - GTK_FILL - - - - - - True - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - + True True - adjustment4 - 1 1 2 - 1 - 2