added support for sound buffer size

also created a script to generate the gfceu.xml file
This commit is contained in:
punkrockguy318 2008-06-18 01:46:02 +00:00
parent 427c7ad721
commit 8cd90d3352
4 changed files with 97 additions and 21 deletions

3
generate_ui.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
gtk-builder-convert gfceu.glade gfceu.xml

51
gfceu
View File

@ -63,6 +63,7 @@ class game_options:
sound_check = True sound_check = True
soundq_check = True soundq_check = True
soundrate_entry = "11000" soundrate_entry = "11000"
soundbufsize_entry = "48"
# video # video
fullscreen_check = False fullscreen_check = False
@ -116,7 +117,9 @@ def give_widgets():
widgets.get_object("sound_check").set_active(options.sound_check) widgets.get_object("sound_check").set_active(options.sound_check)
widgets.get_object("soundq_check").set_active(options.soundq_check) widgets.get_object("soundq_check").set_active(options.soundq_check)
widgets.get_object("soundrate_entry").set_text(options.soundrate_entry) 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("fullscreen_check").set_active(options.fullscreen_check)
widgets.get_object("opengl_check").set_active(options.opengl_check) widgets.get_object("opengl_check").set_active(options.opengl_check)
widgets.get_object("xscale_spin").set_value(options.xscale_spin) 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) widgets.get_object("host_pass").set_text(options.host_pass)
except AttributeError: 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() options = game_options()
give_widgets() give_widgets()
except RuntimeError:
print "shit"
def set_options(): def set_options():
""" """
@ -155,6 +159,7 @@ def set_options():
options.sound_check = widgets.get_object("sound_check").get_active() options.sound_check = widgets.get_object("sound_check").get_active()
options.soundq_check = widgets.get_object("soundq_check").get_active() options.soundq_check = widgets.get_object("soundq_check").get_active()
options.soundrate_entry = widgets.get_object("soundrate_entry").get_text() options.soundrate_entry = widgets.get_object("soundrate_entry").get_text()
options.soundbufsize_entry = widgets.get_object("soundbufsize_entry").get_text()
# video # video
options.fullscreen_check = widgets.get_object("fullscreen_check").get_active() 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.host_radio = widgets.get_object("host_radio").get_active()
options.no_network_radio = widgets.get_object("no_network_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_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.join_pass = widgets.get_object("join_pass").get_text()
options.host_port = widgets.get_object("host_port").get_value() options.host_port = widgets.get_object("host_port").get_value()
options.host_pass = widgets.get_object("host_pass").get_text() options.host_pass = widgets.get_object("host_pass").get_text()
@ -297,13 +302,13 @@ class GfceuApp:
print 'Try reinstalling the application.' print 'Try reinstalling the application.'
sys.exit(1) sys.exit(1)
try: #try:
print "Using: " + glade_file print "Using: " + glade_file
widgets = gtk.Builder() widgets = gtk.Builder()
widgets.add_from_file(glade_file) widgets.add_from_file(glade_file)
widgets.connect_signals(self) widgets.connect_signals(self)
except: #except:
self.print_error("Couldn't load the glade UI file", 24) # self.print_error("Couldn't load the glade UI file", 24)
widgets.get_object("main_window").show_all() widgets.get_object("main_window").show_all()
@ -325,8 +330,9 @@ class GfceuApp:
if options.soundrate_entry: if options.soundrate_entry:
sound_options += '--soundrate ' + options.soundrate_entry + ' ' sound_options += '--soundrate ' + options.soundrate_entry + ' '
else:
soundrate = ' ' if options.soundbufsize_entry:
sound_options += '--soundbufsize ' + options.soundbufsize_entry + ' '
# video # video
video_options = '' video_options = ''
@ -346,36 +352,39 @@ class GfceuApp:
# Netplay is fucked right now # Netplay is fucked right now
"""
if options.join_radio: if options.join_radio:
if options.join_pass == '': if options.join_pass == '':
netpass = '' netpass = ''
else: else:
netpass = '--pass ' + '"' + options.join_pass + '" ' netpass = '--pass ' + options.join_pass
network = '-net "' + options.join_add + '"'\ network = '--net ' + options.join_add +\
' --port '+ str(options.join_port) + ' ' + netpass ' --port '+ str(options.join_port) + ' ' + netpass
else: else:
network = '' network = ''
if options.host_radio: if options.host_radio:
"""
if options.host_pass == '': if options.host_pass == '':
netpass = ' ' netpass = ' '
else: else:
netpass = ' --pass ' + '"' + options.host_pass + '" ' # netpass = ' --pass ' + '"' + options.host_pass + '" '
netpass = ' --pass ' + options.host_pass
network = '--net localhost --port '+\ network = '--net localhost --port '+\
str(options.host_port) + netpass + ' ' str(options.host_port) + netpass + ' '
"""
network = ''
if local: if local:
network = '' network = ''
"""
network = ''
command = self.fceux_binary + ' ' + sound_options + video_options +\ command = self.fceux_binary + ' ' + sound_options + video_options +\
network + options.extra_entry + ' '+ rom_name network + options.extra_entry + ' '+ rom_name
self.msg('Command: ' + command) self.msg('Command: ' + command)
# more code to disable because netplay is fucked # more code to disable because netplay is fucked
""" """
if options.host_radio: if options.host_radio:
xterm_binary = find_binary("xterm") xterm_binary = find_binary("xterm")
if xterm_binary == None: if xterm_binary == None:
@ -406,7 +415,7 @@ class GfceuApp:
if options.host_radio: if options.host_radio:
os.kill(pid, 9) os.kill(pid, 9)
""" """
### Callbacks ### Callbacks
def launch_button_clicked(self, arg1): def launch_button_clicked(self, arg1):

View File

@ -527,6 +527,38 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">Buffer size (ms):</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="soundbufsize_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">48</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="position">4</property> <property name="position">4</property>

View File

@ -535,6 +535,38 @@ Invalid options may cause GFCE Ultra to perform incorrectly.
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">Buffer size (ms):</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="soundbufsize_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">48</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="position">4</property> <property name="position">4</property>