Search
lxdream.org :: lxdream :: r700:4650d0c7f6f9
lxdream 0.9.1
released Jun 29
Download Now
changeset700:4650d0c7f6f9
parent699:d9ba9a9e5d14
child701:1ff36bb68c79
authornkeynes
dateSun Jun 22 06:49:00 2008 +0000 (11 years ago)
Big cleanup of the command-line options
Add an actual manpage (*gasp*)
Makefile.am
Makefile.in
configure
configure.in
lxdream.pod
src/Makefile.in
src/aica/audio.c
src/aica/audio.h
src/display.c
src/display.h
src/drivers/audio_alsa.c
src/drivers/audio_esd.c
src/drivers/audio_null.c
src/drivers/audio_osx.c
src/drivers/audio_pulse.c
src/drivers/video_gtk.c
src/drivers/video_null.c
src/drivers/video_osx.c
src/main.c
src/pvr2/glutil.c
1.1 --- a/Makefile.am Sun Jun 22 06:21:57 2008 +0000
1.2 +++ b/Makefile.am Sun Jun 22 06:49:00 2008 +0000
1.3 @@ -1,5 +1,7 @@
1.4 ## Process this file with automake to produce Makefile.in
1.5
1.6 +POD2MAN=@POD2MAN@
1.7 +
1.8 if BUILD_SYSTEST
1.9 TEST_SUBDIR = test
1.10 endif
1.11 @@ -7,6 +9,11 @@
1.12
1.13 EXTRA_DIST = autogen.sh
1.14
1.15 +man_MANS = lxdream.1
1.16 +
1.17 +lxdream.1: lxdream.pod
1.18 + $(POD2MAN) $< $@
1.19 +
1.20 install-data-local:
1.21 @$(NORMAL_INSTALL)
1.22 if test -d $(srcdir)/pixmaps; then \
2.1 --- a/Makefile.in Sun Jun 22 06:21:57 2008 +0000
2.2 +++ b/Makefile.in Sun Jun 22 06:49:00 2008 +0000
2.3 @@ -58,6 +58,10 @@
2.4 install-recursive installcheck-recursive installdirs-recursive \
2.5 pdf-recursive ps-recursive uninstall-info-recursive \
2.6 uninstall-recursive
2.7 +man1dir = $(mandir)/man1
2.8 +am__installdirs = "$(DESTDIR)$(man1dir)"
2.9 +NROFF = nroff
2.10 +MANS = $(man_MANS)
2.11 ETAGS = etags
2.12 CTAGS = ctags
2.13 DIST_SUBDIRS = src po test
2.14 @@ -165,6 +169,8 @@
2.15 PACKAGE_VERSION = @PACKAGE_VERSION@
2.16 PATH_SEPARATOR = @PATH_SEPARATOR@
2.17 PKG_CONFIG = @PKG_CONFIG@
2.18 +POD2HTML = @POD2HTML@
2.19 +POD2MAN = @POD2MAN@
2.20 POFILES = @POFILES@
2.21 POSUB = @POSUB@
2.22 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
2.23 @@ -232,6 +238,7 @@
2.24 @BUILD_SYSTEST_TRUE@TEST_SUBDIR = test
2.25 SUBDIRS = src po $(TEST_SUBDIR)
2.26 EXTRA_DIST = autogen.sh
2.27 +man_MANS = lxdream.1
2.28 all: config.h
2.29 $(MAKE) $(AM_MAKEFLAGS) all-recursive
2.30
2.31 @@ -289,6 +296,51 @@
2.32 test/Makefile: $(top_builddir)/config.status $(top_srcdir)/test/Makefile.in
2.33 cd $(top_builddir) && $(SHELL) ./config.status $@
2.34 uninstall-info-am:
2.35 +install-man1: $(man1_MANS) $(man_MANS)
2.36 + @$(NORMAL_INSTALL)
2.37 + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
2.38 + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
2.39 + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
2.40 + for i in $$l2; do \
2.41 + case "$$i" in \
2.42 + *.1*) list="$$list $$i" ;; \
2.43 + esac; \
2.44 + done; \
2.45 + for i in $$list; do \
2.46 + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
2.47 + else file=$$i; fi; \
2.48 + ext=`echo $$i | sed -e 's/^.*\\.//'`; \
2.49 + case "$$ext" in \
2.50 + 1*) ;; \
2.51 + *) ext='1' ;; \
2.52 + esac; \
2.53 + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
2.54 + inst=`echo $$inst | sed -e 's/^.*\///'`; \
2.55 + inst=`echo $$inst | sed '$(transform)'`.$$ext; \
2.56 + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
2.57 + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
2.58 + done
2.59 +uninstall-man1:
2.60 + @$(NORMAL_UNINSTALL)
2.61 + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
2.62 + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
2.63 + for i in $$l2; do \
2.64 + case "$$i" in \
2.65 + *.1*) list="$$list $$i" ;; \
2.66 + esac; \
2.67 + done; \
2.68 + for i in $$list; do \
2.69 + ext=`echo $$i | sed -e 's/^.*\\.//'`; \
2.70 + case "$$ext" in \
2.71 + 1*) ;; \
2.72 + *) ext='1' ;; \
2.73 + esac; \
2.74 + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
2.75 + inst=`echo $$inst | sed -e 's/^.*\///'`; \
2.76 + inst=`echo $$inst | sed '$(transform)'`.$$ext; \
2.77 + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
2.78 + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
2.79 + done
2.80
2.81 # This directory's subdirectories are mostly independent; you can cd
2.82 # into them and run `make' without going through this Makefile.
2.83 @@ -570,9 +622,12 @@
2.84 check-am: all-am
2.85 check: check-recursive
2.86 @GUI_COCOA_FALSE@all-local:
2.87 -all-am: Makefile config.h all-local
2.88 +all-am: Makefile $(MANS) config.h all-local
2.89 installdirs: installdirs-recursive
2.90 installdirs-am:
2.91 + for dir in "$(DESTDIR)$(man1dir)"; do \
2.92 + test -z "$$dir" || $(mkdir_p) "$$dir"; \
2.93 + done
2.94 install: install-recursive
2.95 install-exec: install-exec-recursive
2.96 install-data: install-data-recursive
2.97 @@ -616,13 +671,13 @@
2.98
2.99 info-am:
2.100
2.101 -install-data-am: install-data-local
2.102 +install-data-am: install-data-local install-man
2.103
2.104 install-exec-am:
2.105
2.106 install-info: install-info-recursive
2.107
2.108 -install-man:
2.109 +install-man: install-man1
2.110
2.111 installcheck-am:
2.112
2.113 @@ -644,10 +699,12 @@
2.114
2.115 ps-am:
2.116
2.117 -uninstall-am: uninstall-info-am
2.118 +uninstall-am: uninstall-info-am uninstall-man
2.119
2.120 uninstall-info: uninstall-info-recursive
2.121
2.122 +uninstall-man: uninstall-man1
2.123 +
2.124 .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local \
2.125 am--refresh check check-am clean clean-generic clean-recursive \
2.126 ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
2.127 @@ -657,13 +714,17 @@
2.128 dvi-am html html-am info info-am install install-am \
2.129 install-data install-data-am install-data-local install-exec \
2.130 install-exec-am install-info install-info-am install-man \
2.131 - install-strip installcheck installcheck-am installdirs \
2.132 - installdirs-am maintainer-clean maintainer-clean-generic \
2.133 - maintainer-clean-recursive mostlyclean mostlyclean-generic \
2.134 - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
2.135 - uninstall uninstall-am uninstall-info-am
2.136 + install-man1 install-strip installcheck installcheck-am \
2.137 + installdirs installdirs-am maintainer-clean \
2.138 + maintainer-clean-generic maintainer-clean-recursive \
2.139 + mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
2.140 + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
2.141 + uninstall-info-am uninstall-man uninstall-man1
2.142
2.143
2.144 +lxdream.1: lxdream.pod
2.145 + $(POD2MAN) $< $@
2.146 +
2.147 install-data-local:
2.148 @$(NORMAL_INSTALL)
2.149 if test -d $(srcdir)/pixmaps; then \
2.150 @@ -695,6 +756,8 @@
2.151 @GUI_COCOA_TRUE@ cp src/lxdream lxdream.app/Contents/MacOS
2.152 @GUI_COCOA_TRUE@ cp -R pixmaps/* lxdream.app/Contents/Resources
2.153 @GUI_COCOA_TRUE@ @echo --- Done ---
2.154 +
2.155 +bundle: all
2.156 # Tell versions [3.59,3.63) of GNU make to not export all variables.
2.157 # Otherwise a system limit (for SysV at least) may be exceeded.
2.158 .NOEXPORT:
3.1 --- a/configure Sun Jun 22 06:21:57 2008 +0000
3.2 +++ b/configure Sun Jun 22 06:49:00 2008 +0000
3.3 @@ -725,6 +725,8 @@
3.4 host_cpu
3.5 host_vendor
3.6 host_os
3.7 +POD2MAN
3.8 +POD2HTML
3.9 GUI_COCOA_TRUE
3.10 GUI_COCOA_FALSE
3.11 PKG_CONFIG
3.12 @@ -6458,6 +6460,89 @@
3.13 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
3.14
3.15
3.16 +
3.17 +# Extract the first word of "pod2man", so it can be a program name with args.
3.18 +set dummy pod2man; ac_word=$2
3.19 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
3.20 +$as_echo_n "checking for $ac_word... " >&6; }
3.21 +if test "${ac_cv_path_POD2MAN+set}" = set; then
3.22 + $as_echo_n "(cached) " >&6
3.23 +else
3.24 + case $POD2MAN in
3.25 + [\\/]* | ?:[\\/]*)
3.26 + ac_cv_path_POD2MAN="$POD2MAN" # Let the user override the test with a path.
3.27 + ;;
3.28 + *)
3.29 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3.30 +for as_dir in $PATH
3.31 +do
3.32 + IFS=$as_save_IFS
3.33 + test -z "$as_dir" && as_dir=.
3.34 + for ac_exec_ext in '' $ac_executable_extensions; do
3.35 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3.36 + ac_cv_path_POD2MAN="$as_dir/$ac_word$ac_exec_ext"
3.37 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3.38 + break 2
3.39 + fi
3.40 +done
3.41 +done
3.42 +IFS=$as_save_IFS
3.43 +
3.44 + ;;
3.45 +esac
3.46 +fi
3.47 +POD2MAN=$ac_cv_path_POD2MAN
3.48 +if test -n "$POD2MAN"; then
3.49 + { $as_echo "$as_me:$LINENO: result: $POD2MAN" >&5
3.50 +$as_echo "$POD2MAN" >&6; }
3.51 +else
3.52 + { $as_echo "$as_me:$LINENO: result: no" >&5
3.53 +$as_echo "no" >&6; }
3.54 +fi
3.55 +
3.56 +
3.57 +# Extract the first word of "pod2html", so it can be a program name with args.
3.58 +set dummy pod2html; ac_word=$2
3.59 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
3.60 +$as_echo_n "checking for $ac_word... " >&6; }
3.61 +if test "${ac_cv_path_POD2HTML+set}" = set; then
3.62 + $as_echo_n "(cached) " >&6
3.63 +else
3.64 + case $POD2HTML in
3.65 + [\\/]* | ?:[\\/]*)
3.66 + ac_cv_path_POD2HTML="$POD2HTML" # Let the user override the test with a path.
3.67 + ;;
3.68 + *)
3.69 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3.70 +for as_dir in $PATH
3.71 +do
3.72 + IFS=$as_save_IFS
3.73 + test -z "$as_dir" && as_dir=.
3.74 + for ac_exec_ext in '' $ac_executable_extensions; do
3.75 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
3.76 + ac_cv_path_POD2HTML="$as_dir/$ac_word$ac_exec_ext"
3.77 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3.78 + break 2
3.79 + fi
3.80 +done
3.81 +done
3.82 +IFS=$as_save_IFS
3.83 +
3.84 + ;;
3.85 +esac
3.86 +fi
3.87 +POD2HTML=$ac_cv_path_POD2HTML
3.88 +if test -n "$POD2HTML"; then
3.89 + { $as_echo "$as_me:$LINENO: result: $POD2HTML" >&5
3.90 +$as_echo "$POD2HTML" >&6; }
3.91 +else
3.92 + { $as_echo "$as_me:$LINENO: result: no" >&5
3.93 +$as_echo "no" >&6; }
3.94 +fi
3.95 +
3.96 +
3.97 +
3.98 +
3.99 # Check whether --enable-trace was given.
3.100 if test "${enable_trace+set}" = set; then
3.101 enableval=$enable_trace; if test "$enableval" == "yes"; then
4.1 --- a/configure.in Sun Jun 22 06:21:57 2008 +0000
4.2 +++ b/configure.in Sun Jun 22 06:49:00 2008 +0000
4.3 @@ -13,6 +13,12 @@
4.4 AC_HEADER_STDC
4.5 AC_CANONICAL_BUILD
4.6 AC_CANONICAL_HOST
4.7 +
4.8 +AC_PATH_PROG(POD2MAN, [pod2man])
4.9 +AC_PATH_PROG(POD2HTML, [pod2html])
4.10 +
4.11 +dnl ---------------- enable/with flags ------------------
4.12 +
4.13 AC_ARG_ENABLE( trace,
4.14 AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),
4.15 [if test "$enableval" == "yes"; then
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/lxdream.pod Sun Jun 22 06:49:00 2008 +0000
5.3 @@ -0,0 +1,118 @@
5.4 +=head1 NAME
5.5 +
5.6 +lxdream - A dreamcast emulator
5.7 +
5.8 +=head1 SYNOPSIS
5.9 +
5.10 +lxdream [options] [disc-image-file] [program-file]
5.11 +
5.12 +=head1 DESCRIPTION
5.13 +
5.14 +=head1 OPTIONS
5.15 +
5.16 +=over
5.17 +
5.18 +=item B<-A>, B<--audio>=I<audio-driver>
5.19 +
5.20 +Set the preferred audio driver. If the specified audio driver cannot start, the system
5.21 +will try all other available drivers in the standard order. To see which drivers are
5.22 +supported, run lxdream -A ?
5.23 +
5.24 +=item B<-c>, B<--config>=F<config-filename>
5.25 +
5.26 +Load configuration information from F<config-filename> instead of the system default
5.27 +
5.28 +=item B<-d>, B<--debugger>
5.29 +
5.30 +Launch the debugger on startup (GTK platforms only).
5.31 +
5.32 +=item B<-h>, B<--help>
5.33 +
5.34 +Print command line usage information
5.35 +
5.36 +=item B<-H>, B<--headless>
5.37 +
5.38 +Run in headless mode (no GUI or video output). This is mainly useful for testing CPU
5.39 +functions and performance. Equivalent to -V null.
5.40 +
5.41 +=item B<-l>, B<--log>=I<log-level>
5.42 +
5.43 +Set the system log level to the specified level of verbosity, which must be one of the following options:
5.44 +FATAL, ERROR, WARN, INFO, DEBUG, TRACE (non-case-sensitive, and only the first letter is required). The
5.45 +default level is WARN.
5.46 +
5.47 +=item B<-m> B<--multiplier>=I<scale>
5.48 +
5.49 +Change the SH4 core clock speed using the supplied floating-point multiplier, where 1.0
5.50 +is full speed, 0.5 is half speed, and so on. The default is 0.5.
5.51 +
5.52 +=item B<-n>
5.53 +
5.54 +Don't start running on startup, even if a disc or program file was supplied. By default
5.55 +the system will start automatically if a disc or program was given on the command line.
5.56 +
5.57 +=item B<-p>
5.58 +
5.59 +Start running on startup, even if no disc or program file was supplied. By default
5.60 +the system will only start automatically if a disc or program was given on the command
5.61 +line.
5.62 +
5.63 +=item B<-t>, B<--run-time>=I<seconds>
5.64 +
5.65 +Run the dreamcast for exactly the specified amount of time, and then terminate, ie
5.66 +lxdream -pt 5.2 will exit after 5.2 seconds of emulated runtime. Useful for performance
5.67 +measurements of arbitrary sections of code.
5.68 +
5.69 +=item B<-T>, B<--trace>=I<trace-list>
5.70 +
5.71 +Activate I/O region tracing for the specified list of MMIO regions. This option is only
5.72 +available if lxdream was configured with --enable-trace. If enabled, trace-list may be
5.73 +a comma-separated list of 1 or more of the following: ALL, ASIC, AICA0, AICA1, AICA2, AICARTC,
5.74 +EXTDMA, PVR2, MMU, UBC, BSC, DMAC, CPG, RTC, INTC, TMU, SCI, and SCIF.
5.75 +
5.76 +Warning: this option implicitly sets the verbosity level to 'trace', and will generate a huge
5.77 +amount of output.
5.78 +
5.79 +=item B<-u>, B<--unsafe>
5.80 +
5.81 +Allow unsafe dcload syscalls. Without this option, the only permitted calls are reads, writes, and
5.82 +seeks on stdin, stdout and stderr. If you're writing your own code that uses the other syscalls, you
5.83 +probably want to enable this. Otherwise it's safer to leave it off.
5.84 +
5.85 +=item B<-v>, B<--version>
5.86 +
5.87 +Print the lxdream version string.
5.88 +
5.89 +=item B<-V> I<video-driver>
5.90 +
5.91 +Set the preferred video driver. If the specified video driver cannot start, the system
5.92 +will exit with an error. To see the available video drivers, run lxdream -V ?
5.93 +
5.94 +=item B<-x>
5.95 +
5.96 +Disable the SH4 translator and run in pure emulation mode. Generally you only want to do this for testing
5.97 +purposes (ie if you think you've found a translator bug) as it's much slower this way.
5.98 +
5.99 +=back
5.100 +
5.101 +=head1 FILES
5.102 +
5.103 +=over
5.104 +
5.105 +=item B<$HOME/.lxdreamrc>
5.106 +
5.107 +Default user configuration file. This will be created at startup if it doesn't
5.108 +already exist, unless an alternative file is specified with -c.
5.109 +
5.110 +=back
5.111 +
5.112 +=head1 COPYRIGHT
5.113 +
5.114 +Copyright 2005-2008 Nathan Keynes <nkeynes@lxdream.org>
5.115 +
5.116 +This program is free software; you can redistribute it and/or modify
5.117 +it under the terms of the GNU General Public License as published by
5.118 +the Free Software Foundation; either version 2 of the License, or
5.119 +(at your option) any later version.
5.120 +
5.121 +=cut
6.1 --- a/src/Makefile.in Sun Jun 22 06:21:57 2008 +0000
6.2 +++ b/src/Makefile.in Sun Jun 22 06:49:00 2008 +0000
6.3 @@ -290,6 +290,8 @@
6.4 PACKAGE_VERSION = @PACKAGE_VERSION@
6.5 PATH_SEPARATOR = @PATH_SEPARATOR@
6.6 PKG_CONFIG = @PKG_CONFIG@
6.7 +POD2HTML = @POD2HTML@
6.8 +POD2MAN = @POD2MAN@
6.9 POFILES = @POFILES@
6.10 POSUB = @POSUB@
6.11 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
7.1 --- a/src/aica/audio.c Sun Jun 22 06:21:57 2008 +0000
7.2 +++ b/src/aica/audio.c Sun Jun 22 06:49:00 2008 +0000
7.3 @@ -19,7 +19,7 @@
7.4
7.5 #include "aica/aica.h"
7.6 #include "aica/audio.h"
7.7 -#include "glib/gmem.h"
7.8 +#include <glib/gmem.h>
7.9 #include "dream.h"
7.10 #include <assert.h>
7.11 #include <string.h>
7.12 @@ -48,7 +48,7 @@
7.13 NULL };
7.14
7.15 #define NUM_BUFFERS 3
7.16 -#define MS_PER_BUFFER 1000
7.17 +#define MS_PER_BUFFER 100
7.18
7.19 #define BUFFER_EMPTY 0
7.20 #define BUFFER_WRITING 1
7.21 @@ -99,6 +99,16 @@
7.22 return NULL;
7.23 }
7.24
7.25 +void print_audio_drivers( FILE * out )
7.26 +{
7.27 + int i;
7.28 + fprintf( out, "Available audio drivers:\n" );
7.29 + for( i=0; audio_driver_list[i] != NULL; i++ ) {
7.30 + fprintf( out, " %-8s %s\n", audio_driver_list[i]->name,
7.31 + gettext(audio_driver_list[i]->description) );
7.32 + }
7.33 +}
7.34 +
7.35 audio_driver_t audio_init_driver( const char *preferred_driver )
7.36 {
7.37 audio_driver_t audio_driver = get_audio_driver_by_name(preferred_driver);
7.38 @@ -407,7 +417,7 @@
7.39 break;
7.40 }
7.41 case AUDIO_FMT_8BIT: {
7.42 - int8_t *data = (uint8_t *)&buf->data[buf->posn];
7.43 + int8_t *data = (int8_t *)&buf->data[buf->posn];
7.44 for( j=0; j < num_samples; j++ ) {
7.45 *data++ = (int8_t)(result_buf[j][0] >> 16);
7.46 *data++ = (int8_t)(result_buf[j][1] >> 16);
7.47 @@ -419,7 +429,7 @@
7.48 break;
7.49 }
7.50 buf = audio.output_buffers[audio.write_buffer];
7.51 - data = (uint8_t *)&buf->data[0];
7.52 + data = (int8_t *)&buf->data[0];
7.53 }
7.54 }
7.55 break;
8.1 --- a/src/aica/audio.h Sun Jun 22 06:21:57 2008 +0000
8.2 +++ b/src/aica/audio.h Sun Jun 22 06:49:00 2008 +0000
8.3 @@ -21,6 +21,8 @@
8.4 #include <stdint.h>
8.5 #include <stdio.h>
8.6 #include <glib/gtypes.h>
8.7 +#include <glib/gi18n.h>
8.8 +
8.9
8.10 #ifdef __cplusplus
8.11 extern "C" {
8.12 @@ -75,6 +77,7 @@
8.13
8.14 typedef struct audio_driver {
8.15 char *name;
8.16 + char *description;
8.17 uint32_t sample_rate;
8.18 uint32_t sample_format;
8.19 gboolean (*init)( );
8.20 @@ -84,6 +87,12 @@
8.21 gboolean (*shutdown)( );
8.22 } *audio_driver_t;
8.23
8.24 +
8.25 +/**
8.26 + * Print the configured audio drivers to the output stream, one to a line.
8.27 + */
8.28 +void print_audio_drivers( FILE *out );
8.29 +
8.30 audio_driver_t get_audio_driver_by_name( const char *name );
8.31
8.32 /**
9.1 --- a/src/display.c Sun Jun 22 06:21:57 2008 +0000
9.2 +++ b/src/display.c Sun Jun 22 06:49:00 2008 +0000
9.3 @@ -415,6 +415,16 @@
9.4 return display_driver->convert_to_dckeysym(keycode);
9.5 }
9.6
9.7 +void print_display_drivers( FILE *out )
9.8 +{
9.9 + int i;
9.10 + fprintf( out, "Available video drivers:\n" );
9.11 + for( i=0; display_driver_list[i] != NULL; i++ ) {
9.12 + fprintf( out, " %-8s %s\n", display_driver_list[i]->name,
9.13 + gettext(display_driver_list[i]->description) );
9.14 + }
9.15 +}
9.16 +
9.17 display_driver_t get_display_driver_by_name( const char *name )
9.18 {
9.19 int i;
10.1 --- a/src/display.h Sun Jun 22 06:21:57 2008 +0000
10.2 +++ b/src/display.h Sun Jun 22 06:49:00 2008 +0000
10.3 @@ -23,7 +23,9 @@
10.4 #define GL_GLEXT_PROTOTYPES 1
10.5
10.6 #include <stdint.h>
10.7 +#include <stdio.h>
10.8 #include <glib.h>
10.9 +#include <glib/gi18n.h>
10.10 #include "lxdream.h"
10.11 #ifdef APPLE_BUILD
10.12 #include <OpenGL/gl.h>
10.13 @@ -98,6 +100,11 @@
10.14 typedef struct display_driver {
10.15 char *name;
10.16 /**
10.17 + * Short (<60 chars) description of the driver. This should be marked for
10.18 + * localization.
10.19 + */
10.20 + char *description;
10.21 + /**
10.22 * Initialize the driver. This is called only once at startup time, and
10.23 * is guaranteed to be called before any other methods.
10.24 * @return TRUE if the driver was successfully initialized, otherwise
10.25 @@ -178,6 +185,10 @@
10.26
10.27 } *display_driver_t;
10.28
10.29 +/**
10.30 + * Print the configured video drivers to the output stream, one to a line.
10.31 + */
10.32 +void print_display_drivers( FILE *out );
10.33 display_driver_t get_display_driver_by_name( const char *name );
10.34 gboolean display_set_driver( display_driver_t driver );
10.35
11.1 --- a/src/drivers/audio_alsa.c Sun Jun 22 06:21:57 2008 +0000
11.2 +++ b/src/drivers/audio_alsa.c Sun Jun 22 06:49:00 2008 +0000
11.3 @@ -184,6 +184,7 @@
11.4
11.5 struct audio_driver audio_alsa_driver = {
11.6 "alsa",
11.7 + N_("Linux ALSA system driver"),
11.8 DEFAULT_SAMPLE_RATE,
11.9 DEFAULT_SAMPLE_FORMAT,
11.10 audio_alsa_init,
12.1 --- a/src/drivers/audio_esd.c Sun Jun 22 06:21:57 2008 +0000
12.2 +++ b/src/drivers/audio_esd.c Sun Jun 22 06:49:00 2008 +0000
12.3 @@ -69,7 +69,9 @@
12.4 return TRUE;
12.5 }
12.6
12.7 -struct audio_driver audio_esd_driver = { "esd",
12.8 +struct audio_driver audio_esd_driver = {
12.9 + "esd",
12.10 + N_("Enlightened Sound Daemon driver"),
12.11 DEFAULT_SAMPLE_RATE,
12.12 DEFAULT_SAMPLE_FORMAT,
12.13 audio_esd_init,
13.1 --- a/src/drivers/audio_null.c Sun Jun 22 06:21:57 2008 +0000
13.2 +++ b/src/drivers/audio_null.c Sun Jun 22 06:49:00 2008 +0000
13.3 @@ -33,7 +33,9 @@
13.4 return TRUE;
13.5 }
13.6
13.7 -struct audio_driver audio_null_driver = { "null",
13.8 +struct audio_driver audio_null_driver = {
13.9 + "null",
13.10 + N_("Null (no audio) driver"),
13.11 DEFAULT_SAMPLE_RATE,
13.12 DEFAULT_SAMPLE_FORMAT,
13.13 audio_null_init,
14.1 --- a/src/drivers/audio_osx.c Sun Jun 22 06:21:57 2008 +0000
14.2 +++ b/src/drivers/audio_osx.c Sun Jun 22 06:49:00 2008 +0000
14.3 @@ -131,7 +131,9 @@
14.4 }
14.5
14.6
14.7 -struct audio_driver audio_osx_driver = { "osx",
14.8 +struct audio_driver audio_osx_driver = {
14.9 + "osx",
14.10 + N_("OS X CoreAudio system driver"),
14.11 DEFAULT_SAMPLE_RATE,
14.12 AUDIO_FMT_FLOATST,
14.13 audio_osx_init,
15.1 --- a/src/drivers/audio_pulse.c Sun Jun 22 06:21:57 2008 +0000
15.2 +++ b/src/drivers/audio_pulse.c Sun Jun 22 06:49:00 2008 +0000
15.3 @@ -74,7 +74,9 @@
15.4 return TRUE;
15.5 }
15.6
15.7 -struct audio_driver audio_pulse_driver = { "pulse",
15.8 +struct audio_driver audio_pulse_driver = {
15.9 + "pulse",
15.10 + N_("PulseAudio sound server driver"),
15.11 DEFAULT_SAMPLE_RATE,
15.12 DEFAULT_SAMPLE_FORMAT,
15.13 audio_pulse_init,
16.1 --- a/src/drivers/video_gtk.c Sun Jun 22 06:21:57 2008 +0000
16.2 +++ b/src/drivers/video_gtk.c Sun Jun 22 06:49:00 2008 +0000
16.3 @@ -126,13 +126,17 @@
16.4 uint16_t video_gtk_resolve_keysym( const gchar *keysym );
16.5 uint16_t video_gtk_keycode_to_dckeysym(uint16_t keycode);
16.6
16.7 -struct display_driver display_gtk_driver = { "gtk", video_gtk_init, video_gtk_shutdown,
16.8 - video_gtk_resolve_keysym,
16.9 - video_gtk_keycode_to_dckeysym,
16.10 - NULL,
16.11 - NULL, NULL, NULL, NULL, NULL,
16.12 - video_gtk_display_blank, NULL };
16.13 -
16.14 +struct display_driver display_gtk_driver = {
16.15 + "gtk",
16.16 + N_("GTK-based OpenGL driver"),
16.17 + video_gtk_init,
16.18 + video_gtk_shutdown,
16.19 + video_gtk_resolve_keysym,
16.20 + video_gtk_keycode_to_dckeysym,
16.21 + NULL,
16.22 + NULL, NULL, NULL, NULL, NULL,
16.23 + video_gtk_display_blank, NULL };
16.24 +
16.25 uint16_t video_gtk_resolve_keysym( const gchar *keysym )
16.26 {
16.27 int val = gdk_keyval_from_name( keysym );
17.1 --- a/src/drivers/video_null.c Sun Jun 22 06:21:57 2008 +0000
17.2 +++ b/src/drivers/video_null.c Sun Jun 22 06:49:00 2008 +0000
17.3 @@ -56,16 +56,18 @@
17.4 }
17.5
17.6
17.7 -struct display_driver display_null_driver = { "null",
17.8 - NULL,
17.9 - NULL,
17.10 - NULL,
17.11 - NULL,
17.12 - NULL,
17.13 - video_null_create_render_buffer,
17.14 - video_null_destroy_render_buffer,
17.15 - video_null_set_render_target,
17.16 - video_null_load_frame_buffer,
17.17 - video_null_display_render_buffer,
17.18 - video_null_display_blank,
17.19 - video_null_read_render_buffer };
17.20 +struct display_driver display_null_driver = {
17.21 + "null",
17.22 + N_("Null (no video) driver"),
17.23 + NULL,
17.24 + NULL,
17.25 + NULL,
17.26 + NULL,
17.27 + NULL,
17.28 + video_null_create_render_buffer,
17.29 + video_null_destroy_render_buffer,
17.30 + video_null_set_render_target,
17.31 + video_null_load_frame_buffer,
17.32 + video_null_display_render_buffer,
17.33 + video_null_display_blank,
17.34 + video_null_read_render_buffer };
18.1 --- a/src/drivers/video_osx.c Sun Jun 22 06:21:57 2008 +0000
18.2 +++ b/src/drivers/video_osx.c Sun Jun 22 06:49:00 2008 +0000
18.3 @@ -36,12 +36,15 @@
18.4 static uint16_t video_osx_resolve_keysym( const gchar *keysym );
18.5 static uint16_t video_osx_keycode_to_dckeysym(uint16_t keycode);
18.6
18.7 -struct display_driver display_osx_driver = { "osx", video_osx_init, video_osx_shutdown,
18.8 - video_osx_resolve_keysym,
18.9 - video_osx_keycode_to_dckeysym,
18.10 - NULL,
18.11 - NULL, NULL, NULL, NULL, NULL,
18.12 - video_osx_display_blank, NULL };
18.13 +struct display_driver display_osx_driver = {
18.14 + "osx",
18.15 + N_("OS X Cocoa GUI-based OpenGL driver"),
18.16 + video_osx_init, video_osx_shutdown,
18.17 + video_osx_resolve_keysym,
18.18 + video_osx_keycode_to_dckeysym,
18.19 + NULL,
18.20 + NULL, NULL, NULL, NULL, NULL,
18.21 + video_osx_display_blank, NULL };
18.22
18.23
18.24 static NSView *video_view = NULL;
19.1 --- a/src/main.c Sun Jun 22 06:21:57 2008 +0000
19.2 +++ b/src/main.c Sun Jun 22 06:49:00 2008 +0000
19.3 @@ -33,24 +33,62 @@
19.4 #include "maple/maple.h"
19.5 #include "sh4/sh4.h"
19.6
19.7 -#define S3M_PLAYER "s3mplay.bin"
19.8 -
19.9 -char *option_list = "a:m:s:A:V:v:puhbd:c:t:T:xDn";
19.10 -struct option longopts[1] = { { NULL, 0, 0, 0 } };
19.11 +char *option_list = "a:A:c:dhHl:m:npt:T:uvV:x?";
19.12 +struct option longopts[] = {
19.13 + { "aica", required_argument, NULL, 'a' },
19.14 + { "audio", required_argument, NULL, 'A' },
19.15 + { "config", required_argument, NULL, 'c' },
19.16 + { "debugger", no_argument, NULL, 'D' },
19.17 + { "help", no_argument, NULL, 'h' },
19.18 + { "headless", no_argument, NULL, 'H' },
19.19 + { "log", required_argument, NULL,'l' },
19.20 + { "multiplier", required_argument, NULL, 'm' },
19.21 + { "run-time", required_argument, NULL, 't' },
19.22 + { "trace", required_argument, NULL, 'T' },
19.23 + { "unsafe", no_argument, NULL, 'u' },
19.24 + { "video", no_argument, NULL, 'V' },
19.25 + { "version", no_argument, NULL, 'v' },
19.26 + { NULL, 0, 0, 0 } };
19.27 char *aica_program = NULL;
19.28 -char *s3m_file = NULL;
19.29 -const char *disc_file = NULL;
19.30 char *display_driver_name = NULL;
19.31 char *audio_driver_name = NULL;
19.32 char *trace_regions = NULL;
19.33 gboolean start_immediately = FALSE;
19.34 gboolean no_start = FALSE;
19.35 gboolean headless = FALSE;
19.36 -gboolean without_bios = FALSE;
19.37 gboolean use_xlat = TRUE;
19.38 gboolean show_debugger = FALSE;
19.39 extern uint32_t sh4_cpu_multiplier;
19.40
19.41 +void print_version()
19.42 +{
19.43 + printf( "lxdream " APP_VERSION "\n" );
19.44 +}
19.45 +
19.46 +void print_usage()
19.47 +{
19.48 + print_version();
19.49 + printf( "Usage: lxdream [options] [disc-file] [program-file]\n\n" );
19.50 +
19.51 + printf( "Options:\n" );
19.52 + printf( " -a, --aica=PROGFILE %s\n", _("Run the AICA SPU only, with the supplied program") );
19.53 + printf( " -A, --audio=DRIVER %s\n", _("Use the specified audio driver (? to list)") );
19.54 + printf( " -c, --config=CONFFILE %s\n", _("Load configuration from CONFFILE") );
19.55 + printf( " -d, --debugger %s\n", _("Start in debugger mode") );
19.56 + printf( " -h, --help %s\n", _("Display this usage information") );
19.57 + printf( " -H, --headless %s\n", _("Run in headless (no video) mode") );
19.58 + printf( " -l, --log=LEVEL %s\n", _("Set the output log level") );
19.59 + printf( " -m, --multiplier=SCALE %s\n", _("Set the SH4 multiplier (1.0 = fullspeed)") );
19.60 + printf( " -n %s\n", _("Don't start running immediately") );
19.61 + printf( " -p %s\n", _("Start running immediately on startup") );
19.62 + printf( " -t, --run-time=SECONDS %s\n", _("Run for the specified number of seconds") );
19.63 + printf( " -T, --trace=REGIONS %s\n", _("Output trace information for the named regions") );
19.64 + printf( " -u, --unsafe %s\n", _("Allow unsafe dcload syscalls") );
19.65 + printf( " -v, --version %s\n", _("Print the lxdream version string") );
19.66 + printf( " -V, --video=DRIVER %s\n", _("Use the specified video driver (? to list)") );
19.67 + printf( " -x %s\n", _("Disable the SH4 translator") );
19.68 +}
19.69 +
19.70 int main (int argc, char *argv[])
19.71 {
19.72 int opt;
19.73 @@ -71,15 +109,33 @@
19.74 case 'a': /* AICA only mode - argument is an AICA program */
19.75 aica_program = optarg;
19.76 break;
19.77 + case 'A': /* Audio driver */
19.78 + audio_driver_name = optarg;
19.79 + if( strcmp(audio_driver_name, "?") == 0 ) {
19.80 + print_version();
19.81 + print_audio_drivers(stdout);
19.82 + exit(0);
19.83 + }
19.84 + break;
19.85 case 'c': /* Config file */
19.86 lxdream_set_config_filename(optarg);
19.87 break;
19.88 - case 'd': /* Mount disc */
19.89 - disc_file = optarg;
19.90 - break;
19.91 - case 'D': /* Launch w/ debugger */
19.92 + case 'd': /* Launch w/ debugger */
19.93 show_debugger = TRUE;
19.94 break;
19.95 + case 'h': /* help */
19.96 + case '?':
19.97 + print_usage();
19.98 + exit(0);
19.99 + break;
19.100 + case 'H': /* Headless - shorthand for -V null */
19.101 + display_driver_name = "null";
19.102 + break;
19.103 + case 'l': /* Log verbosity */
19.104 + if( !set_global_log_level(optarg) ) {
19.105 + ERROR( "Unrecognized log level '%s'", optarg );
19.106 + }
19.107 + break;
19.108 case 'm': /* Set SH4 CPU clock multiplier (default 0.5) */
19.109 t = strtod(optarg, NULL);
19.110 sh4_cpu_multiplier = (int)(1000.0/t);
19.111 @@ -88,29 +144,10 @@
19.112 no_start = TRUE;
19.113 start_immediately = FALSE;
19.114 break;
19.115 - case 's': /* AICA-only w/ S3M player */
19.116 - aica_program = S3M_PLAYER;
19.117 - s3m_file = optarg;
19.118 - break;
19.119 - case 'A': /* Audio driver */
19.120 - audio_driver_name = optarg;
19.121 - break;
19.122 - case 'V': /* Video driver */
19.123 - display_driver_name = optarg;
19.124 - break;
19.125 case 'p': /* Start immediately */
19.126 start_immediately = TRUE;
19.127 no_start = FALSE;
19.128 - break;
19.129 - case 'u': /* Allow unsafe dcload syscalls */
19.130 - dcload_set_allow_unsafe(TRUE);
19.131 break;
19.132 - case 'b': /* No BIOS */
19.133 - without_bios = TRUE;
19.134 - break;
19.135 - case 'h': /* Headless */
19.136 - headless = TRUE;
19.137 - break;
19.138 case 't': /* Time limit + auto quit */
19.139 t = strtod(optarg, NULL);
19.140 time_secs = (uint32_t)t;
19.141 @@ -122,11 +159,21 @@
19.142 trace_regions = optarg;
19.143 set_global_log_level("trace");
19.144 break;
19.145 - case 'v': /* Log verbosity */
19.146 - if( !set_global_log_level(optarg) ) {
19.147 - ERROR( "Unrecognized log level '%s'", optarg );
19.148 - }
19.149 + case 'u': /* Allow unsafe dcload syscalls */
19.150 + dcload_set_allow_unsafe(TRUE);
19.151 + break;
19.152 + case 'v':
19.153 + print_version();
19.154 + exit(0);
19.155 break;
19.156 + case 'V': /* Video driver */
19.157 + display_driver_name = optarg;
19.158 + if( strcmp(display_driver_name,"?") == 0 ) {
19.159 + print_version();
19.160 + print_display_drivers(stdout);
19.161 + exit(0);
19.162 + }
19.163 + break;
19.164 case 'x': /* Disable translator */
19.165 use_xlat = FALSE;
19.166 break;
19.167 @@ -137,61 +184,50 @@
19.168 gdrom_list_init();
19.169
19.170 if( aica_program == NULL ) {
19.171 - dreamcast_init();
19.172 + dreamcast_init();
19.173 } else {
19.174 - dreamcast_configure_aica_only();
19.175 - mem_load_block( aica_program, 0x00800000, 2048*1024 );
19.176 - if( s3m_file != NULL ) {
19.177 - mem_load_block( s3m_file, 0x00810000, 2048*1024 - 0x10000 );
19.178 - }
19.179 + dreamcast_configure_aica_only();
19.180 + mem_load_block( aica_program, 0x00800000, 2048*1024 );
19.181 }
19.182 mem_set_trace( trace_regions, TRUE );
19.183
19.184 - if( without_bios ) {
19.185 - bios_install();
19.186 - dcload_install();
19.187 - }
19.188 -
19.189 audio_init_driver( audio_driver_name, 44100, AUDIO_FMT_16ST );
19.190
19.191 + headless = display_driver_name != NULL && strcasecmp( display_driver_name, "null" ) == 0;
19.192 if( headless ) {
19.193 - display_set_driver( &display_null_driver );
19.194 + display_set_driver( &display_null_driver );
19.195 } else {
19.196 - gui_init(show_debugger);
19.197 + gui_init(show_debugger);
19.198
19.199 - display_driver_t display_driver = get_display_driver_by_name(display_driver_name);
19.200 - if( display_driver == NULL ) {
19.201 - ERROR( "Video driver '%s' not found, aborting.", display_driver_name );
19.202 - exit(2);
19.203 - } else if( display_set_driver( display_driver ) == FALSE ) {
19.204 - ERROR( "Video driver '%s' failed to initialize (could not connect to display?)",
19.205 - display_driver->name );
19.206 - exit(2);
19.207 - }
19.208 + display_driver_t display_driver = get_display_driver_by_name(display_driver_name);
19.209 + if( display_driver == NULL ) {
19.210 + ERROR( "Video driver '%s' not found, aborting.", display_driver_name );
19.211 + exit(2);
19.212 + } else if( display_set_driver( display_driver ) == FALSE ) {
19.213 + ERROR( "Video driver '%s' failed to initialize (could not connect to display?)",
19.214 + display_driver->name );
19.215 + exit(2);
19.216 + }
19.217 }
19.218
19.219 maple_reattach_all();
19.220 INFO( "%s! ready...", APP_NAME );
19.221
19.222 for( ; optind < argc; optind++ ) {
19.223 - gboolean ok = gdrom_mount_image(argv[optind]);
19.224 - if( !ok ) {
19.225 - ok = file_load_magic( argv[optind] );
19.226 - }
19.227 - if( !ok ) {
19.228 - ERROR( "Unrecognized file '%s'", argv[optind] );
19.229 - }
19.230 - if( !no_start ) {
19.231 - start_immediately = ok;
19.232 - }
19.233 - }
19.234 -
19.235 - if( disc_file != NULL ) {
19.236 - gdrom_mount_image( disc_file );
19.237 + gboolean ok = gdrom_mount_image(argv[optind]);
19.238 + if( !ok ) {
19.239 + ok = file_load_magic( argv[optind] );
19.240 + }
19.241 + if( !ok ) {
19.242 + ERROR( "Unrecognized file '%s'", argv[optind] );
19.243 + }
19.244 + if( !no_start ) {
19.245 + start_immediately = ok;
19.246 + }
19.247 }
19.248
19.249 if( gdrom_get_current_disc() == NULL ) {
19.250 - disc_file = lxdream_get_config_value( CONFIG_GDROM );
19.251 + const gchar *disc_file = lxdream_get_config_value( CONFIG_GDROM );
19.252 if( disc_file != NULL ) {
19.253 gdrom_mount_image( disc_file );
19.254 }
20.1 --- a/src/pvr2/glutil.c Sun Jun 22 06:21:57 2008 +0000
20.2 +++ b/src/pvr2/glutil.c Sun Jun 22 06:49:00 2008 +0000
20.3 @@ -79,7 +79,7 @@
20.4
20.5 void glPrintInfo( FILE *out )
20.6 {
20.7 - const GLubyte *extensions = glGetString(GL_EXTENSIONS);
20.8 + const gchar *extensions = (const gchar *)glGetString(GL_EXTENSIONS);
20.9 gchar **ext_split = g_strsplit(extensions, " ", 0);
20.10 unsigned int i;
20.11
.