--- deliantra/Deliantra-Client/bin/deliantra 2010/04/22 11:18:04 1.112 +++ deliantra/Deliantra-Client/bin/deliantra 2010/08/31 14:31:50 1.117 @@ -19,15 +19,15 @@ require Win32::GUI::SplashScreen; - # initialise the resolver now, as vista forces us back to the desktop - # when doing this. - use AnyEvent::DNS (); - AnyEvent::DNS::resolver; - Win32::GUI::SplashScreen::Show ( -file => "$ENV{PAR_TEMP}/SPLASH.bmp", ); + # initialise the resolver now, as vista forces us back to the desktop + # when doing this later. + require AnyEvent::DNS; + AnyEvent::DNS::resolver (); + $startup_done = sub { Win32::GUI::SplashScreen::Done (1); }; @@ -520,6 +520,15 @@ sub audio_init { if ($CFG->{audio_enable}) { + if (length $CFG->{audio_driver}) { + local $ENV{SDL_AUDIODRIVER} = $CFG->{audio_driver}; + DC::SDL_Init DC::SDL_INIT_AUDIO + and die "SDL::Init failed!\n"; + } else { + DC::SDL_Init DC::SDL_INIT_AUDIO + and die "SDL::Init failed!\n"; + } + $ENV{MIX_EFFECTSMAXSPEED} = 1; $SDL_MIXER = !DC::Mix_OpenAudio $CFG->{audio_hw_frequency}, @@ -559,6 +568,8 @@ DC::Mix_CloseAudio if $SDL_MIXER; undef $SDL_MIXER; + + DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO; } ############################################################################# @@ -1164,11 +1175,24 @@ my $row = 0; $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); - $table->add_at (1, $row++, new DC::UI::CheckBox + $table->add_at (1, $row, new DC::UI::CheckBox state => $CFG->{audio_enable}, tooltip => "Master Audio Enable. If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } ); + $table->add_at (2, $row++, my $driver = new DC::UI::HBox expand => 1); + + $driver->add (new DC::UI::Label align => 1, text => " Audio driver override"); + $driver->add (new DC::UI::Entry + text => $CFG->{audio_driver}, + template => "dsound1234", + tooltip => "You can override the audio driver to use here. Leaving it empty will result " + . "in Deliantra picking one automatically. GNU/Linux users often prefer specific " + . "drivers though, and can experiment with alsa, dsp, esd, pulse, arts, nas " + . "or other system-specific drivers. Selecting the wrong driver here will simply result" + . "in no sound.", + on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 } + ); $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); $table->add_at (1, $row, new DC::UI::CheckBox @@ -1211,9 +1235,9 @@ options => [ [ 0, "default" , "Use System Default"], [11025, "11 kHz" , "11kHz (low quality)"], - [22050, "22 kHz" , "22kHz (reduced quality)"], + [22050, "22 kHz" , "22kHz (reduced quality, recommended)"], [44100, "44.1 kHz", "44.1kHz (cd quality)"], - [48000, "48 kHz" , "48kHz (studio quality)"], + [48000, "48 kHz" , "48kHz (studio quality, not recommended)"], ], tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", on_changed => sub { @@ -1247,7 +1271,7 @@ c_colspan => 2, expand => 1, value => $CFG->{audio_hw_chunksize}, tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " - . "is stuttering, increase this value. Values of 50-100ms are optimal.", + . "is stuttering, increase this value. Values of 50-150ms are optimal.", on_changed => sub { $CFG->{audio_hw_chunksize} = $_[1]; audio_tab_update; @@ -1500,7 +1524,7 @@ deat => ["Death", "Death (resistance against death spells)"], phys => ["Physical", - "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed in the 'Arm' field on the left.)"], + "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed as the 'Arm' secondary stat.)"], blind => ["Blind", "Blind (blind resistance affects the chance of a successful blinding attack)"], fear => ["Fear", @@ -2441,11 +2465,6 @@ }; } -sub sdl_init { - DC::SDL_Init DC::SDL_INIT_AUDIO #| DC::SDL_NOPARACHUTE - and die "SDL::Init failed!\n"; -} - sub video_init { DC::set_theme $CFG->{uitheme}; @@ -2815,6 +2834,11 @@ my @args = @ARGV; + # OS X passes some process serial number of other shit. they + # could have used an env var or any other sane mechanism. but + # would it be os x then? no... + shift @args if $args[0] =~ /^-psn_/; + my $profile = 'default'; for (my $i = 0; $i < @args; $i++) { @@ -2848,8 +2872,6 @@ } } - sdl_init; - $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; @@ -2889,6 +2911,7 @@ # warn $t2-$t1; # } + DC::IMG_Init; video_init; audio_init; }