… | |
… | |
23 | -file => "$ENV{PAR_TEMP}/SPLASH.bmp", |
23 | -file => "$ENV{PAR_TEMP}/SPLASH.bmp", |
24 | ); |
24 | ); |
25 | |
25 | |
26 | # initialise the resolver now, as vista forces us back to the desktop |
26 | # initialise the resolver now, as vista forces us back to the desktop |
27 | # when doing this later. |
27 | # when doing this later. |
28 | use AnyEvent::DNS (); |
28 | require AnyEvent::DNS; |
29 | AnyEvent::DNS::resolver; |
29 | AnyEvent::DNS::resolver (); |
30 | |
30 | |
31 | $startup_done = sub { |
31 | $startup_done = sub { |
32 | Win32::GUI::SplashScreen::Done (1); |
32 | Win32::GUI::SplashScreen::Done (1); |
33 | }; |
33 | }; |
34 | } |
34 | } |
… | |
… | |
518 | audio_music_push; |
518 | audio_music_push; |
519 | } |
519 | } |
520 | |
520 | |
521 | sub audio_init { |
521 | sub audio_init { |
522 | if ($CFG->{audio_enable}) { |
522 | if ($CFG->{audio_enable}) { |
|
|
523 | if (length $CFG->{audio_driver}) { |
|
|
524 | local $ENV{SDL_AUDIODRIVER} = $CFG->{audio_driver}; |
|
|
525 | DC::SDL_Init DC::SDL_INIT_AUDIO |
|
|
526 | and die "SDL::Init failed!\n"; |
|
|
527 | } else { |
|
|
528 | DC::SDL_Init DC::SDL_INIT_AUDIO |
|
|
529 | and die "SDL::Init failed!\n"; |
|
|
530 | } |
|
|
531 | |
523 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
532 | $ENV{MIX_EFFECTSMAXSPEED} = 1; |
524 | $SDL_MIXER = !DC::Mix_OpenAudio |
533 | $SDL_MIXER = !DC::Mix_OpenAudio |
525 | $CFG->{audio_hw_frequency}, |
534 | $CFG->{audio_hw_frequency}, |
526 | DC::MIX_DEFAULT_FORMAT, |
535 | DC::MIX_DEFAULT_FORMAT, |
527 | $CFG->{audio_hw_channels}, |
536 | $CFG->{audio_hw_channels}, |
… | |
… | |
557 | %AUDIO_PLAY = (); |
566 | %AUDIO_PLAY = (); |
558 | %AUDIO_CHUNK = (); |
567 | %AUDIO_CHUNK = (); |
559 | |
568 | |
560 | DC::Mix_CloseAudio if $SDL_MIXER; |
569 | DC::Mix_CloseAudio if $SDL_MIXER; |
561 | undef $SDL_MIXER; |
570 | undef $SDL_MIXER; |
|
|
571 | |
|
|
572 | DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO; |
562 | } |
573 | } |
563 | |
574 | |
564 | ############################################################################# |
575 | ############################################################################# |
565 | |
576 | |
566 | sub destroy_query_dialog { |
577 | sub destroy_query_dialog { |
… | |
… | |
1162 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
1173 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
1163 | |
1174 | |
1164 | my $row = 0; |
1175 | my $row = 0; |
1165 | |
1176 | |
1166 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
1177 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
1167 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1178 | $table->add_at (1, $row, new DC::UI::CheckBox |
1168 | state => $CFG->{audio_enable}, |
1179 | state => $CFG->{audio_enable}, |
1169 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
1180 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
1170 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
1181 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
|
|
1182 | ); |
|
|
1183 | $table->add_at (2, $row++, my $driver = new DC::UI::HBox expand => 1); |
|
|
1184 | |
|
|
1185 | $driver->add (new DC::UI::Label align => 1, text => " Audio driver override"); |
|
|
1186 | $driver->add (new DC::UI::Entry |
|
|
1187 | text => $CFG->{audio_driver}, |
|
|
1188 | template => "dsound1234", |
|
|
1189 | tooltip => "You can override the audio driver to use here. Leaving it empty will result " |
|
|
1190 | . "in Deliantra picking one automatically. GNU/Linux users often prefer specific " |
|
|
1191 | . "drivers though, and can experiment with <b>alsa</b>, <b>dsp</b>, <b>esd</b>, <b>pulse</b>, <b>arts</b>, <b>nas</b> " |
|
|
1192 | . "or other system-specific drivers. Selecting the wrong driver here will simply result" |
|
|
1193 | . "in no sound.", |
|
|
1194 | on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 } |
1171 | ); |
1195 | ); |
1172 | |
1196 | |
1173 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
1197 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
1174 | $table->add_at (1, $row, new DC::UI::CheckBox |
1198 | $table->add_at (1, $row, new DC::UI::CheckBox |
1175 | expand => 1, state => $CFG->{effects_enable}, |
1199 | expand => 1, state => $CFG->{effects_enable}, |
… | |
… | |
1209 | c_colspan => 2, expand => 1, |
1233 | c_colspan => 2, expand => 1, |
1210 | value => $CFG->{audio_hw_frequency}, |
1234 | value => $CFG->{audio_hw_frequency}, |
1211 | options => [ |
1235 | options => [ |
1212 | [ 0, "default" , "Use System Default"], |
1236 | [ 0, "default" , "Use System Default"], |
1213 | [11025, "11 kHz" , "11kHz (low quality)"], |
1237 | [11025, "11 kHz" , "11kHz (low quality)"], |
1214 | [22050, "22 kHz" , "22kHz (reduced quality)"], |
1238 | [22050, "22 kHz" , "22kHz (reduced quality, recommended)"], |
1215 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
1239 | [44100, "44.1 kHz", "44.1kHz (cd quality)"], |
1216 | [48000, "48 kHz" , "48kHz (studio quality)"], |
1240 | [48000, "48 kHz" , "48kHz (studio quality, not recommended)"], |
1217 | ], |
1241 | ], |
1218 | tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
1242 | tooltip => "The sampling frequency to use. Higher sounds better, but also more cpu-intensive and might cause stuttering.", |
1219 | on_changed => sub { |
1243 | on_changed => sub { |
1220 | $CFG->{audio_hw_frequency} = $_[1]; |
1244 | $CFG->{audio_hw_frequency} = $_[1]; |
1221 | audio_tab_update; |
1245 | audio_tab_update; |
… | |
… | |
1245 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); |
1269 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); |
1246 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1270 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1247 | c_colspan => 2, expand => 1, |
1271 | c_colspan => 2, expand => 1, |
1248 | value => $CFG->{audio_hw_chunksize}, |
1272 | value => $CFG->{audio_hw_chunksize}, |
1249 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1273 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1250 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
1274 | . "is stuttering, increase this value. Values of 50-150ms are optimal.", |
1251 | on_changed => sub { |
1275 | on_changed => sub { |
1252 | $CFG->{audio_hw_chunksize} = $_[1]; |
1276 | $CFG->{audio_hw_chunksize} = $_[1]; |
1253 | audio_tab_update; |
1277 | audio_tab_update; |
1254 | 1 |
1278 | 1 |
1255 | } |
1279 | } |
… | |
… | |
2437 | }, |
2461 | }, |
2438 | ); |
2462 | ); |
2439 | |
2463 | |
2440 | $dialog->show; |
2464 | $dialog->show; |
2441 | }; |
2465 | }; |
2442 | } |
|
|
2443 | |
|
|
2444 | sub sdl_init { |
|
|
2445 | DC::SDL_Init DC::SDL_INIT_AUDIO #| DC::SDL_NOPARACHUTE |
|
|
2446 | and die "SDL::Init failed!\n"; |
|
|
2447 | } |
2466 | } |
2448 | |
2467 | |
2449 | sub video_init { |
2468 | sub video_init { |
2450 | DC::set_theme $CFG->{uitheme}; |
2469 | DC::set_theme $CFG->{uitheme}; |
2451 | |
2470 | |
… | |
… | |
2813 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2832 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2814 | } |
2833 | } |
2815 | |
2834 | |
2816 | my @args = @ARGV; |
2835 | my @args = @ARGV; |
2817 | |
2836 | |
|
|
2837 | # OS X passes some process serial number of other shit. they |
|
|
2838 | # could have used an env var or any other sane mechanism. but |
|
|
2839 | # would it be os x then? no... |
|
|
2840 | shift @args if $args[0] =~ /^-psn_/; |
|
|
2841 | |
2818 | my $profile = 'default'; |
2842 | my $profile = 'default'; |
2819 | |
2843 | |
2820 | for (my $i = 0; $i < @args; $i++) { |
2844 | for (my $i = 0; $i < @args; $i++) { |
2821 | if ($args[$i] =~ /^--?profile$/) { |
2845 | if ($args[$i] =~ /^--?profile$/) { |
2822 | $profile = $args[$i + 1]; |
2846 | $profile = $args[$i + 1]; |
… | |
… | |
2845 | action => $cmds, |
2869 | action => $cmds, |
2846 | }; |
2870 | }; |
2847 | } |
2871 | } |
2848 | } |
2872 | } |
2849 | } |
2873 | } |
2850 | |
|
|
2851 | sdl_init; |
|
|
2852 | |
2874 | |
2853 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
2875 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
2854 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
2876 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
2855 | |
2877 | |
2856 | { |
2878 | { |