aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfcdrom
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dfcdrom')
-rw-r--r--plugins/dfcdrom/Makefile.am35
-rw-r--r--plugins/dfcdrom/Makefile.in665
-rw-r--r--plugins/dfcdrom/cdr-libcdio.c257
-rw-r--r--plugins/dfcdrom/cdr-linux.c407
-rw-r--r--plugins/dfcdrom/cdr-null.c72
-rw-r--r--plugins/dfcdrom/cdr.c515
-rw-r--r--plugins/dfcdrom/cdr.h215
-rw-r--r--plugins/dfcdrom/cdrcfg-0.1df/dfcdrom.glade2324
-rw-r--r--plugins/dfcdrom/cdrcfg-0.1df/main.c290
-rw-r--r--plugins/dfcdrom/cfg.c99
-rw-r--r--plugins/dfcdrom/util.c95
11 files changed, 2974 insertions, 0 deletions
diff --git a/plugins/dfcdrom/Makefile.am b/plugins/dfcdrom/Makefile.am
new file mode 100644
index 0000000..6edf16b
--- /dev/null
+++ b/plugins/dfcdrom/Makefile.am
@@ -0,0 +1,35 @@
+bindir = @libdir@/games/psemu/
+libdir = @libdir@/games/psemu/
+
+lib_LTLIBRARIES = libDFCdrom.la
+
+libDFCdrom_la_SOURCES = \
+ cdr.c \
+ cdr.h \
+ cfg.c \
+ cdr-linux.c \
+ cdr-null.c \
+ cdr-libcdio.c \
+ util.c
+
+libDFCdrom_la_CFLAGS =
+libDFCdrom_la_LDFLAGS = -module -avoid-version -lpthread
+
+if USE_LIBCDIO
+libDFCdrom_la_CFLAGS += -DUSE_LIBCDIO=1 $(LIBCDIO_CFLAGS)
+libDFCdrom_la_LDFLAGS += $(LIBCDIO_LIBS)
+endif
+
+INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
+ -DLOCALE_DIR=\"${datadir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK2_CFLAGS) $(GLADE2_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+
+bin_PROGRAMS = cfgDFCdrom
+cfgDFCdrom_SOURCES = cdrcfg-0.1df/main.c
+cfgDFCdrom_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS)
+
+glade_DATA = cdrcfg-0.1df/dfcdrom.glade2
+gladedir = $(datadir)/psemu/
+EXTRA_DIST = $(glade_DATA)
diff --git a/plugins/dfcdrom/Makefile.in b/plugins/dfcdrom/Makefile.in
new file mode 100644
index 0000000..3654481
--- /dev/null
+++ b/plugins/dfcdrom/Makefile.in
@@ -0,0 +1,665 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@USE_LIBCDIO_TRUE@am__append_1 = -DUSE_LIBCDIO=1 $(LIBCDIO_CFLAGS)
+@USE_LIBCDIO_TRUE@am__append_2 = $(LIBCDIO_LIBS)
+bin_PROGRAMS = cfgDFCdrom$(EXEEXT)
+subdir = plugins/dfcdrom
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(gladedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libDFCdrom_la_LIBADD =
+am_libDFCdrom_la_OBJECTS = libDFCdrom_la-cdr.lo libDFCdrom_la-cfg.lo \
+ libDFCdrom_la-cdr-linux.lo libDFCdrom_la-cdr-null.lo \
+ libDFCdrom_la-cdr-libcdio.lo libDFCdrom_la-util.lo
+libDFCdrom_la_OBJECTS = $(am_libDFCdrom_la_OBJECTS)
+libDFCdrom_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libDFCdrom_la_CFLAGS) \
+ $(CFLAGS) $(libDFCdrom_la_LDFLAGS) $(LDFLAGS) -o $@
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_cfgDFCdrom_OBJECTS = main.$(OBJEXT)
+cfgDFCdrom_OBJECTS = $(am_cfgDFCdrom_OBJECTS)
+am__DEPENDENCIES_1 =
+cfgDFCdrom_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libDFCdrom_la_SOURCES) $(cfgDFCdrom_SOURCES)
+DIST_SOURCES = $(libDFCdrom_la_SOURCES) $(cfgDFCdrom_SOURCES)
+gladeDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(glade_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALSA_CFLAGS = @ALSA_CFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLADE2_CFLAGS = @GLADE2_CFLAGS@
+GLADE2_LIBS = @GLADE2_LIBS@
+GLIB2_CFLAGS = @GLIB2_CFLAGS@
+GLIB2_LIBS = @GLIB2_LIBS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+GTK2_CFLAGS = @GTK2_CFLAGS@
+GTK2_LIBS = @GTK2_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBCDIO_CFLAGS = @LIBCDIO_CFLAGS@
+LIBCDIO_LIBS = @LIBCDIO_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NASM = @NASM@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PEOPSXGL = @PEOPSXGL@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+PULSEAUDIO_CFLAGS = @PULSEAUDIO_CFLAGS@
+PULSEAUDIO_LIBS = @PULSEAUDIO_LIBS@
+RANLIB = @RANLIB@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_CONFIG = @SDL_CONFIG@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @libdir@/games/psemu/
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@/games/psemu/
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+lib_LTLIBRARIES = libDFCdrom.la
+libDFCdrom_la_SOURCES = \
+ cdr.c \
+ cdr.h \
+ cfg.c \
+ cdr-linux.c \
+ cdr-null.c \
+ cdr-libcdio.c \
+ util.c
+
+libDFCdrom_la_CFLAGS = $(am__append_1)
+libDFCdrom_la_LDFLAGS = -module -avoid-version -lpthread \
+ $(am__append_2)
+INCLUDES = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
+ -DLOCALE_DIR=\"${datadir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK2_CFLAGS) $(GLADE2_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+
+cfgDFCdrom_SOURCES = cdrcfg-0.1df/main.c
+cfgDFCdrom_LDADD = $(GTK2_LIBS) $(GLADE2_LIBS)
+glade_DATA = cdrcfg-0.1df/dfcdrom.glade2
+gladedir = $(datadir)/psemu/
+EXTRA_DIST = $(glade_DATA)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/dfcdrom/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plugins/dfcdrom/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libDFCdrom.la: $(libDFCdrom_la_OBJECTS) $(libDFCdrom_la_DEPENDENCIES)
+ $(libDFCdrom_la_LINK) -rpath $(libdir) $(libDFCdrom_la_OBJECTS) $(libDFCdrom_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+cfgDFCdrom$(EXEEXT): $(cfgDFCdrom_OBJECTS) $(cfgDFCdrom_DEPENDENCIES)
+ @rm -f cfgDFCdrom$(EXEEXT)
+ $(LINK) $(cfgDFCdrom_OBJECTS) $(cfgDFCdrom_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-cdr-libcdio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-cdr-linux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-cdr-null.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-cdr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-cfg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libDFCdrom_la-util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libDFCdrom_la-cdr.lo: cdr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-cdr.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-cdr.Tpo -c -o libDFCdrom_la-cdr.lo `test -f 'cdr.c' || echo '$(srcdir)/'`cdr.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-cdr.Tpo $(DEPDIR)/libDFCdrom_la-cdr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdr.c' object='libDFCdrom_la-cdr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-cdr.lo `test -f 'cdr.c' || echo '$(srcdir)/'`cdr.c
+
+libDFCdrom_la-cfg.lo: cfg.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-cfg.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-cfg.Tpo -c -o libDFCdrom_la-cfg.lo `test -f 'cfg.c' || echo '$(srcdir)/'`cfg.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-cfg.Tpo $(DEPDIR)/libDFCdrom_la-cfg.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cfg.c' object='libDFCdrom_la-cfg.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-cfg.lo `test -f 'cfg.c' || echo '$(srcdir)/'`cfg.c
+
+libDFCdrom_la-cdr-linux.lo: cdr-linux.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-cdr-linux.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-cdr-linux.Tpo -c -o libDFCdrom_la-cdr-linux.lo `test -f 'cdr-linux.c' || echo '$(srcdir)/'`cdr-linux.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-cdr-linux.Tpo $(DEPDIR)/libDFCdrom_la-cdr-linux.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdr-linux.c' object='libDFCdrom_la-cdr-linux.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-cdr-linux.lo `test -f 'cdr-linux.c' || echo '$(srcdir)/'`cdr-linux.c
+
+libDFCdrom_la-cdr-null.lo: cdr-null.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-cdr-null.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-cdr-null.Tpo -c -o libDFCdrom_la-cdr-null.lo `test -f 'cdr-null.c' || echo '$(srcdir)/'`cdr-null.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-cdr-null.Tpo $(DEPDIR)/libDFCdrom_la-cdr-null.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdr-null.c' object='libDFCdrom_la-cdr-null.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-cdr-null.lo `test -f 'cdr-null.c' || echo '$(srcdir)/'`cdr-null.c
+
+libDFCdrom_la-cdr-libcdio.lo: cdr-libcdio.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-cdr-libcdio.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-cdr-libcdio.Tpo -c -o libDFCdrom_la-cdr-libcdio.lo `test -f 'cdr-libcdio.c' || echo '$(srcdir)/'`cdr-libcdio.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-cdr-libcdio.Tpo $(DEPDIR)/libDFCdrom_la-cdr-libcdio.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdr-libcdio.c' object='libDFCdrom_la-cdr-libcdio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-cdr-libcdio.lo `test -f 'cdr-libcdio.c' || echo '$(srcdir)/'`cdr-libcdio.c
+
+libDFCdrom_la-util.lo: util.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -MT libDFCdrom_la-util.lo -MD -MP -MF $(DEPDIR)/libDFCdrom_la-util.Tpo -c -o libDFCdrom_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libDFCdrom_la-util.Tpo $(DEPDIR)/libDFCdrom_la-util.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libDFCdrom_la-util.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libDFCdrom_la_CFLAGS) $(CFLAGS) -c -o libDFCdrom_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c
+
+main.o: cdrcfg-0.1df/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main.o -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.o `test -f 'cdrcfg-0.1df/main.c' || echo '$(srcdir)/'`cdrcfg-0.1df/main.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrcfg-0.1df/main.c' object='main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main.o `test -f 'cdrcfg-0.1df/main.c' || echo '$(srcdir)/'`cdrcfg-0.1df/main.c
+
+main.obj: cdrcfg-0.1df/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main.obj -MD -MP -MF $(DEPDIR)/main.Tpo -c -o main.obj `if test -f 'cdrcfg-0.1df/main.c'; then $(CYGPATH_W) 'cdrcfg-0.1df/main.c'; else $(CYGPATH_W) '$(srcdir)/cdrcfg-0.1df/main.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/main.Tpo $(DEPDIR)/main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cdrcfg-0.1df/main.c' object='main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main.obj `if test -f 'cdrcfg-0.1df/main.c'; then $(CYGPATH_W) 'cdrcfg-0.1df/main.c'; else $(CYGPATH_W) '$(srcdir)/cdrcfg-0.1df/main.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-gladeDATA: $(glade_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(gladedir)" || $(MKDIR_P) "$(DESTDIR)$(gladedir)"
+ @list='$(glade_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(gladeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gladedir)/$$f'"; \
+ $(gladeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gladedir)/$$f"; \
+ done
+
+uninstall-gladeDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(glade_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(gladedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(gladedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(gladedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-gladeDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-gladeDATA \
+ uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libLTLIBRARIES clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-gladeDATA install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-gladeDATA uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plugins/dfcdrom/cdr-libcdio.c b/plugins/dfcdrom/cdr-libcdio.c
new file mode 100644
index 0000000..738d203
--- /dev/null
+++ b/plugins/dfcdrom/cdr-libcdio.c
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#ifdef USE_LIBCDIO
+
+#include <cdio/cdio.h>
+#include <cdio/mmc.h>
+
+#include "cdr.h"
+
+static CdIo_t *cdHandle = NULL;
+
+static void SetSpeed(int speed) {
+ speed *= 176;
+ if (speed == 0) speed = 0xFFFF;
+
+ cdio_set_speed(cdHandle, speed);
+}
+
+static void SetSpinDown(unsigned char spindown) {
+ mmc_cdb_t cdb;
+ char buf[16];
+
+ memset(&cdb, 0, sizeof(cdb));
+
+ cdb.field[0] = 0x5A;
+ cdb.field[2] = 0x0D;
+ cdb.field[8] = sizeof(buf);
+
+ if (mmc_run_cmd(cdHandle, 10000, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf) != DRIVER_OP_SUCCESS)
+ return;
+
+ buf[11] = (buf[11] & 0xF0) | (spindown & 0x0F);
+
+ memset(&cdb, 0, sizeof(cdb));
+ memset(buf, 0, 2);
+
+ cdb.field[0] = 0x55;
+ cdb.field[1] = 0x10;
+ cdb.field[8] = sizeof(buf);
+
+ mmc_run_cmd(cdHandle, 10000, &cdb, SCSI_MMC_DATA_WRITE, sizeof(buf), buf);
+}
+
+static void UnlockDoor() {
+ mmc_cdb_t cdb;
+
+ memset(&cdb, 0, sizeof(cdb));
+
+ cdb.field[0] = 0x1E;
+ cdb.field[4] = 0;
+
+ mmc_run_cmd(cdHandle, 10000, &cdb, SCSI_MMC_DATA_WRITE, 0, NULL);
+}
+
+int OpenCdHandle(const char *dev) {
+ if (dev == NULL || dev[0] == '\0') {
+ if ((dev = cdio_get_default_device(NULL)) == NULL) {
+ return -1;
+ }
+ }
+
+#ifdef __FreeBSD__
+ cdHandle = cdio_open_am_cd(dev, "CAM");
+#else
+ cdHandle = cdio_open_cd(dev);
+#endif
+
+ if (cdHandle != NULL) {
+ SetSpeed(CdrSpeed);
+ SetSpinDown(SpinDown);
+ UnlockDoor();
+
+ return 0;
+ }
+
+ return -1;
+}
+
+void CloseCdHandle() {
+ if (cdHandle != NULL) {
+ cdio_set_speed(cdHandle, 0xFFFF);
+ SetSpinDown(SPINDOWN_VENDOR_SPECIFIC);
+
+ cdio_destroy(cdHandle);
+ }
+
+ cdHandle = NULL;
+}
+
+int IsCdHandleOpen() {
+ return (cdHandle != NULL);
+}
+
+long GetTN(unsigned char *buffer) {
+ buffer[0] = cdio_get_first_track_num(cdHandle);
+ buffer[1] = cdio_get_last_track_num(cdHandle);
+
+ return 0;
+}
+
+long GetTD(unsigned char track, unsigned char *buffer) {
+ msf_t msf;
+
+ if (track == 0) track = CDIO_CDROM_LEADOUT_TRACK;
+
+ if (!cdio_get_track_msf(cdHandle, track, &msf)) {
+ memset(buffer + 1, 0, 3);
+ return 0;
+ }
+
+ buffer[0] = btoi(msf.f);
+ buffer[1] = btoi(msf.s);
+ buffer[2] = btoi(msf.m);
+
+ return 0;
+}
+
+long GetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f) {
+ unsigned char msf[3];
+
+ lba_to_msf(cdio_get_track_lba(cdHandle, track + 1) - CD_MSF_OFFSET, msf);
+
+ *m = msf[0];
+ *s = msf[1];
+ *f = msf[2];
+
+ return 0;
+}
+
+long ReadSector(crdata *cr) {
+ int lba;
+ MMC_READ_CD cdb;
+
+ lba = msf_to_lba(cr->msf.cdmsf_min0, cr->msf.cdmsf_sec0, cr->msf.cdmsf_frame0);
+ memset(&cdb, 0, sizeof(cdb));
+
+ cdb.Code = 0xBE;
+ cdb.IncludeEDC = 1;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.SubChannelSelection = 0;
+ cdb.StartingLBA[1] = lba >> 16;
+ cdb.StartingLBA[2] = lba >> 8;
+ cdb.StartingLBA[3] = lba;
+ cdb.TransferBlocks[2] = 1;
+
+ if (mmc_run_cmd(cdHandle, 10000, (mmc_cdb_t *)&cdb, SCSI_MMC_DATA_READ, sizeof(*cr), cr) != DRIVER_OP_SUCCESS)
+ return -1;
+
+ return 0;
+}
+
+long PlayCDDA(unsigned char *sector) {
+ msf_t start, end;
+
+ if (!cdio_get_track_msf(cdHandle, CDIO_CDROM_LEADOUT_TRACK, &end))
+ return -1;
+
+ start.m = itob(sector[0]);
+ start.s = itob(sector[1]);
+ start.f = itob(sector[2]);
+
+ if (cdio_audio_play_msf(cdHandle, &start, &end) != DRIVER_OP_SUCCESS)
+ return -1;
+
+ return 0;
+}
+
+long StopCDDA() {
+ cdio_subchannel_t subchnl;
+
+ if (cdio_audio_read_subchannel(cdHandle, &subchnl) != DRIVER_OP_SUCCESS)
+ return -1;
+
+ switch (subchnl.audio_status) {
+ case CDIO_MMC_READ_SUB_ST_PLAY:
+ case CDIO_MMC_READ_SUB_ST_PAUSED:
+ cdio_audio_stop(cdHandle);
+ }
+
+ return 0;
+}
+
+long GetStatus(int playing, struct CdrStat *stat) {
+ cdio_subchannel_t subchnl;
+
+ memset(stat, 0, sizeof(struct CdrStat));
+
+ if (playing) {
+ if (cdio_audio_read_subchannel(cdHandle, &subchnl) == DRIVER_OP_SUCCESS) {
+ stat->Time[0] = btoi(subchnl.abs_addr.m);
+ stat->Time[1] = btoi(subchnl.abs_addr.s);
+ stat->Time[2] = btoi(subchnl.abs_addr.f);
+ }
+ }
+
+ stat->Type = 0x01;
+
+ if (mmc_get_tray_status(cdHandle)) {
+ stat->Type = 0xff;
+ stat->Status |= 0x10;
+ } else {
+ SetSpeed(CdrSpeed);
+ SetSpinDown(SpinDown);
+ UnlockDoor();
+ }
+
+ return 0;
+}
+
+unsigned char *ReadSub(const unsigned char *time) {
+ int lba = msf_to_lba(btoi(time[0]), btoi(time[1]), btoi(time[2]));
+ static unsigned char buf[CD_FRAMESIZE_RAW + 96];
+
+ MMC_READ_CD cdb;
+
+ memset(&cdb, 0, sizeof(cdb));
+
+ cdb.Code = 0xBE;
+ cdb.IncludeEDC = 1;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.StartingLBA[1] = lba >> 16;
+ cdb.StartingLBA[2] = lba >> 8;
+ cdb.StartingLBA[3] = lba;
+ cdb.TransferBlocks[2] = 1;
+ cdb.SubChannelSelection = 1;
+
+ if (mmc_run_cmd(cdHandle, 10000, (mmc_cdb_t *)&cdb, SCSI_MMC_DATA_READ, sizeof(buf), buf) != DRIVER_OP_SUCCESS)
+ return NULL;
+
+ DecodeRawSubData(buf + CD_FRAMESIZE_RAW);
+ return buf + CD_FRAMESIZE_RAW;
+}
+
+#endif
diff --git a/plugins/dfcdrom/cdr-linux.c b/plugins/dfcdrom/cdr-linux.c
new file mode 100644
index 0000000..a814962
--- /dev/null
+++ b/plugins/dfcdrom/cdr-linux.c
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * Portions based on: cdrdao - write audio CD-Rs in disc-at-once mode
+ * Copyright (C) 2007 Denis Leroy <denis@poolshark.org>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#if defined (__linux__) && !defined (USE_LIBCDIO)
+
+#include "cdr.h"
+
+static int cdHandle = -1;
+static int ReadMMC = 0, SubQMMC = 0;
+
+static int SendMMCCmd(const unsigned char *cmd, int cmdLen, const unsigned char *dataOut,
+ int dataOutLen, unsigned char *dataIn, int dataInLen)
+{
+ sg_io_hdr_t io_hdr;
+
+ memset(&io_hdr, 0, sizeof(io_hdr));
+
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = cmdLen;
+ io_hdr.cmdp = (unsigned char *)cmd;
+ io_hdr.timeout = 10000;
+ io_hdr.sbp = NULL;
+ io_hdr.mx_sb_len = 0;
+ io_hdr.flags = 1;
+
+ if (dataOut != NULL) {
+ io_hdr.dxferp = (void *)dataOut;
+ io_hdr.dxfer_len = dataOutLen;
+ io_hdr.dxfer_direction = SG_DXFER_TO_DEV;
+ } else if (dataIn != NULL) {
+ io_hdr.dxferp = (void *)dataIn;
+ io_hdr.dxfer_len = dataInLen;
+ io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+ }
+
+ if (ioctl(cdHandle, SG_IO, &io_hdr) < 0) {
+ return -1;
+ }
+
+ return io_hdr.status;
+}
+
+static int CheckReadMMC() {
+ MMC_READ_CD cdb;
+ unsigned char buf[CD_FRAMESIZE_RAW];
+
+ memset(&cdb, 0, sizeof(cdb));
+ memset(buf, 0xAA, sizeof(buf));
+
+ cdb.Code = GPCMD_READ_CD;
+ cdb.IncludeEDC = 0;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.TransferBlocks[2] = 1;
+
+ if (SendMMCCmd((unsigned char *)&cdb, sizeof(cdb), NULL, 0, buf, sizeof(buf)) == 0) {
+ if (buf[0] != 0xAA) {
+ PRINTF("Using MMC for data\n");
+ return 1; // supported
+ }
+ }
+
+ return 0; // NOT supported
+}
+
+static int CheckSubQMMC() {
+ MMC_READ_CD cdb;
+ unsigned char buf[CD_FRAMESIZE_RAW + 96];
+
+ memset(&cdb, 0, sizeof(cdb));
+ memset(buf, 0xAA, sizeof(buf));
+
+ cdb.Code = GPCMD_READ_CD;
+ cdb.IncludeEDC = 1;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.SubChannelSelection = 1;
+ cdb.TransferBlocks[2] = 1;
+
+ if (SendMMCCmd((unsigned char *)&cdb, sizeof(cdb), NULL, 0, buf, sizeof(buf)) == 0) {
+ if (buf[0] != 0xAA && (buf[2352] != 0xAA || buf[2353] != 0xAA)) {
+ PRINTF("Using MMC for subchannel\n");
+ return 1; // supported
+ }
+ }
+
+ return 0; // NOT supported
+}
+
+int OpenCdHandle(const char *dev) {
+ char spindown;
+
+ cdHandle = open(dev, O_RDONLY);
+
+ if (cdHandle != -1) {
+ ioctl(cdHandle, CDROM_LOCKDOOR, 0);
+
+ spindown = (char)SpinDown;
+ ioctl(cdHandle, CDROMSETSPINDOWN, &spindown);
+
+ ioctl(cdHandle, CDROM_SELECT_SPEED, CdrSpeed);
+
+ ReadMMC = CheckReadMMC();
+ SubQMMC = CheckSubQMMC();
+
+ return 0;
+ }
+
+ return -1;
+}
+
+void CloseCdHandle() {
+ char spindown = SPINDOWN_VENDOR_SPECIFIC;
+ ioctl(cdHandle, CDROMSETSPINDOWN, &spindown);
+
+ close(cdHandle);
+
+ cdHandle = -1;
+}
+
+int IsCdHandleOpen() {
+ return (cdHandle != -1);
+}
+
+long GetTN(unsigned char *buffer) {
+ struct cdrom_tochdr toc;
+
+ if (ioctl(cdHandle, CDROMREADTOCHDR, &toc) == -1)
+ return -1;
+
+ buffer[0] = toc.cdth_trk0; // start track
+ buffer[1] = toc.cdth_trk1; // end track
+
+ return 0;
+}
+
+long GetTD(unsigned char track, unsigned char *buffer) {
+ struct cdrom_tocentry entry;
+
+ if (track == 0)
+ track = 0xAA; // total time (leadout)
+ entry.cdte_track = track;
+ entry.cdte_format = CDROM_MSF;
+
+ if (ioctl(cdHandle, CDROMREADTOCENTRY, &entry) == -1)
+ return -1;
+
+ buffer[0] = entry.cdte_addr.msf.frame;
+ buffer[1] = entry.cdte_addr.msf.second;
+ buffer[2] = entry.cdte_addr.msf.minute;
+
+ return 0;
+}
+
+long GetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f) {
+ struct cdrom_tocentry entry;
+ unsigned char msf[3];
+
+ if (GetTN(msf) == -1) return -1;
+
+ entry.cdte_track = track + 1;
+ if (entry.cdte_track > msf[1]) entry.cdte_track = 0xaa;
+
+ entry.cdte_format = CDROM_MSF;
+
+ if (ioctl(cdHandle, CDROMREADTOCENTRY, &entry) == -1)
+ return -1;
+
+ lba_to_msf(msf_to_lba(entry.cdte_addr.msf.minute, entry.cdte_addr.msf.second, entry.cdte_addr.msf.frame) - CD_MSF_OFFSET, msf);
+
+ *m = msf[0];
+ *s = msf[1];
+ *f = msf[2];
+
+ return 0;
+}
+
+long ReadSector(crdata *cr) {
+ if (ReadMMC) {
+ MMC_READ_CD cdb;
+ int lba;
+
+ memset(&cdb, 0, sizeof(cdb));
+
+ lba = msf_to_lba(cr->msf.cdmsf_min0, cr->msf.cdmsf_sec0, cr->msf.cdmsf_frame0);
+
+ cdb.Code = GPCMD_READ_CD;
+ cdb.IncludeEDC = 1;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.SubChannelSelection = 0;
+ cdb.StartingLBA[1] = lba >> 16;
+ cdb.StartingLBA[2] = lba >> 8;
+ cdb.StartingLBA[3] = lba;
+ cdb.TransferBlocks[2] = 1;
+
+ if (SendMMCCmd((unsigned char *)&cdb, sizeof(cdb), NULL, 0, (unsigned char *)cr, sizeof(*cr)) != 0)
+ return -1;
+ } else {
+ if (ioctl(cdHandle, CDROMREADRAW, cr) == -1)
+ return -1;
+ }
+
+ return 0;
+}
+
+long PlayCDDA(unsigned char *sector) {
+ struct cdrom_msf addr;
+ unsigned char ptmp[4];
+
+ // 0 is the last track of every cdrom, so play up to there
+ if (GetTD(0, ptmp) == -1)
+ return -1;
+
+ addr.cdmsf_min0 = sector[0];
+ addr.cdmsf_sec0 = sector[1];
+ addr.cdmsf_frame0 = sector[2];
+ addr.cdmsf_min1 = ptmp[2];
+ addr.cdmsf_sec1 = ptmp[1];
+ addr.cdmsf_frame1 = ptmp[0];
+
+ if (ioctl(cdHandle, CDROMPLAYMSF, &addr) == -1)
+ return -1;
+
+ return 0;
+}
+
+long StopCDDA() {
+ struct cdrom_subchnl sc;
+
+ sc.cdsc_format = CDROM_MSF;
+ if (ioctl(cdHandle, CDROMSUBCHNL, &sc) == -1)
+ return -1;
+
+ switch (sc.cdsc_audiostatus) {
+ case CDROM_AUDIO_PAUSED:
+ case CDROM_AUDIO_PLAY:
+ ioctl(cdHandle, CDROMSTOP);
+ break;
+ }
+
+ return 0;
+}
+
+long GetStatus(int playing, struct CdrStat *stat) {
+ struct cdrom_subchnl sc;
+ int ret;
+ char spindown;
+
+ memset(stat, 0, sizeof(struct CdrStat));
+
+ if (playing) { // return Time only if playing
+ sc.cdsc_format = CDROM_MSF;
+ if (ioctl(cdHandle, CDROMSUBCHNL, &sc) != -1)
+ memcpy(stat->Time, &sc.cdsc_absaddr.msf, 3);
+ }
+
+ ret = ioctl(cdHandle, CDROM_DISC_STATUS);
+ switch (ret) {
+ case CDS_AUDIO:
+ stat->Type = 0x02;
+ break;
+ case CDS_DATA_1:
+ case CDS_DATA_2:
+ case CDS_XA_2_1:
+ case CDS_XA_2_2:
+ stat->Type = 0x01;
+ break;
+ }
+ ret = ioctl(cdHandle, CDROM_DRIVE_STATUS);
+ switch (ret) {
+ case CDS_NO_DISC:
+ case CDS_TRAY_OPEN:
+ stat->Type = 0xff;
+ stat->Status |= 0x10;
+ break;
+ default:
+ spindown = (char)SpinDown;
+ ioctl(cdHandle, CDROMSETSPINDOWN, &spindown);
+ ioctl(cdHandle, CDROM_SELECT_SPEED, CdrSpeed);
+ ioctl(cdHandle, CDROM_LOCKDOOR, 0);
+ break;
+ }
+
+ switch (sc.cdsc_audiostatus) {
+ case CDROM_AUDIO_PLAY:
+ stat->Status |= 0x80;
+ break;
+ }
+
+ return 0;
+}
+
+static unsigned char *ReadSubMMC(const unsigned char *time) {
+ static unsigned char buf[CD_FRAMESIZE_RAW + 96];
+ int lba = msf_to_lba(btoi(time[0]), btoi(time[1]), btoi(time[2]));
+ MMC_READ_CD cdb;
+
+ memset(&cdb, 0, sizeof(cdb));
+
+ cdb.Code = GPCMD_READ_CD;
+ cdb.IncludeEDC = 1;
+ cdb.IncludeUserData = 1;
+ cdb.HeaderCode = 3;
+ cdb.IncludeSyncData = 1;
+ cdb.StartingLBA[1] = lba >> 16;
+ cdb.StartingLBA[2] = lba >> 8;
+ cdb.StartingLBA[3] = lba;
+ cdb.TransferBlocks[2] = 1;
+ cdb.SubChannelSelection = 1;
+
+ if (SendMMCCmd((unsigned char *)&cdb, sizeof(cdb), NULL, 0, buf, sizeof(buf)) != 0)
+ return NULL;
+
+ DecodeRawSubData(buf + CD_FRAMESIZE_RAW);
+ return buf + CD_FRAMESIZE_RAW;
+}
+
+static unsigned char *ReadSubIOCTL(const unsigned char *time) {
+ static struct SubQ subq;
+ struct cdrom_subchnl subchnl;
+ int r;
+ crdata cr;
+ unsigned short crc;
+
+ cr.msf.cdmsf_min0 = btoi(time[0]);
+ cr.msf.cdmsf_sec0 = btoi(time[1]);
+ cr.msf.cdmsf_frame0 = btoi(time[2]);
+
+ if (ioctl(cdHandle, CDROMSEEK, &cr.msf) == -1) {
+ // will be slower, but there's no other way to make it accurate
+ if (ioctl(cdHandle, CDROMREADRAW, &cr) == -1) {
+ return NULL;
+ }
+ }
+
+ subchnl.cdsc_format = CDROM_MSF;
+ r = ioctl(cdHandle, CDROMSUBCHNL, &subchnl);
+
+ if (r == -1) return NULL;
+
+ subq.ControlAndADR = 0x41;
+ subq.TrackNumber = subchnl.cdsc_trk;
+ subq.IndexNumber = subchnl.cdsc_ind;
+ subq.TrackRelativeAddress[0] = itob(subchnl.cdsc_reladdr.msf.minute);
+ subq.TrackRelativeAddress[1] = itob(subchnl.cdsc_reladdr.msf.second);
+ subq.TrackRelativeAddress[2] = itob(subchnl.cdsc_reladdr.msf.frame);
+ subq.AbsoluteAddress[0] = itob(subchnl.cdsc_absaddr.msf.minute);
+ subq.AbsoluteAddress[1] = itob(subchnl.cdsc_absaddr.msf.second);
+ subq.AbsoluteAddress[2] = itob(subchnl.cdsc_absaddr.msf.frame);
+
+ // CRC is not supported with IOCTL, fake it.
+ crc = calcCrc((unsigned char *)&subq + 12, 10);
+ subq.CRC[0] = (crc >> 8);
+ subq.CRC[1] = (crc & 0xFF);
+
+ r = msf_to_lba(btoi(time[0]), btoi(time[1]), btoi(time[2]));
+
+ if (GetTE(1, &cr.msf.cdmsf_min0, &cr.msf.cdmsf_sec0, &cr.msf.cdmsf_frame0) == -1) {
+ cr.msf.cdmsf_min0 = 80;
+ cr.msf.cdmsf_sec0 = 0;
+ cr.msf.cdmsf_frame0 = 0;
+ }
+
+ if (msf_to_lba(cr.msf.cdmsf_min0, cr.msf.cdmsf_sec0, cr.msf.cdmsf_frame0) >= r &&
+ (msf_to_lba(subchnl.cdsc_absaddr.msf.minute, subchnl.cdsc_absaddr.msf.second, subchnl.cdsc_absaddr.msf.frame) != r ||
+ msf_to_lba(subchnl.cdsc_reladdr.msf.minute, subchnl.cdsc_reladdr.msf.second, subchnl.cdsc_reladdr.msf.frame) != r - CD_MSF_OFFSET))
+ subq.CRC[1] ^= 1; // time mismatch; report wrong CRC
+
+ PRINTF("subq : %x,%x : %x,%x,%x : %x,%x,%x\n",
+ subchnl.cdsc_trk, subchnl.cdsc_ind,
+ itob(subchnl.cdsc_reladdr.msf.minute), itob(subchnl.cdsc_reladdr.msf.second), itob(subchnl.cdsc_reladdr.msf.frame),
+ itob(subchnl.cdsc_absaddr.msf.minute), itob(subchnl.cdsc_absaddr.msf.second), itob(subchnl.cdsc_absaddr.msf.frame));
+
+ return (unsigned char *)&subq;
+}
+
+unsigned char *ReadSub(const unsigned char *time) {
+ if (SubQMMC) return ReadSubMMC(time);
+ else return ReadSubIOCTL(time);
+}
+
+#endif
diff --git a/plugins/dfcdrom/cdr-null.c b/plugins/dfcdrom/cdr-null.c
new file mode 100644
index 0000000..c6aa396
--- /dev/null
+++ b/plugins/dfcdrom/cdr-null.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#include "cdr.h"
+
+#ifdef USE_NULL
+
+int OpenCdHandle(const char *dev) {
+ return -1;
+}
+
+void CloseCdHandle() {
+}
+
+int IsCdHandleOpen() {
+ return 0;
+}
+
+long GetTN(unsigned char *buffer) {
+ buffer[0] = 0;
+ buffer[1] = 0;
+ return 0;
+}
+
+long GetTD(unsigned char track, unsigned char *buffer) {
+ memset(buffer + 1, 0, 3);
+ return 0;
+}
+
+long GetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f) {
+ return -1;
+}
+
+long ReadSector(crdata *cr) {
+ return -1;
+}
+
+long PlayCDDA(unsigned char *sector) {
+ return 0;
+}
+
+long StopCDDA() {
+ return 0;
+}
+
+long GetStatus(int playing, struct CdrStat *stat) {
+ return -1;
+}
+
+unsigned char *ReadSub(const unsigned char *time) {
+ return NULL;
+}
+
+#endif
diff --git a/plugins/dfcdrom/cdr.c b/plugins/dfcdrom/cdr.c
new file mode 100644
index 0000000..f011684
--- /dev/null
+++ b/plugins/dfcdrom/cdr.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#include "cdr.h"
+
+#ifndef USE_NULL
+static char *LibName = N_("CD-ROM Drive Reader");
+#else
+static char *LibName = N_("CDR NULL Plugin");
+#endif
+
+int initial_time = 0;
+
+pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+CacheData *cdcache;
+unsigned char *cdbuffer;
+int cacheaddr;
+
+crdata cr;
+
+unsigned char lastTime[3];
+pthread_t thread;
+int subqread;
+volatile int stopth, found, locked, playing;
+
+long (*ReadTrackT[])() = {
+ ReadNormal,
+ ReadThreaded,
+};
+
+unsigned char* (*GetBufferT[])() = {
+ GetBNormal,
+ GetBThreaded,
+};
+
+long (*fReadTrack)();
+unsigned char* (*fGetBuffer)();
+
+void *CdrThread(void *arg);
+
+long CDRinit(void) {
+ thread = (pthread_t)-1;
+ return 0;
+}
+
+long CDRshutdown(void) {
+ return 0;
+}
+
+long CDRopen(void) {
+ LoadConf();
+
+#ifndef _MACOSX
+ if (IsCdHandleOpen())
+ return 0; // it's already open
+#endif
+
+ if (OpenCdHandle(CdromDev) == -1) { // if we can't open the cdrom we'll works as a null plugin
+ fprintf(stderr, "CDR: Could not open %s\n", CdromDev);
+ }
+
+ fReadTrack = ReadTrackT[ReadMode];
+ fGetBuffer = GetBufferT[ReadMode];
+
+ if (ReadMode == THREADED) {
+ cdcache = (CacheData *)malloc(CacheSize * sizeof(CacheData));
+ if (cdcache == NULL) return -1;
+ memset(cdcache, 0, CacheSize * sizeof(CacheData));
+
+ found = 0;
+ } else {
+ cdbuffer = cr.buf + 12; /* skip sync data */
+ }
+
+ if (ReadMode == THREADED) {
+ pthread_attr_t attr;
+
+ pthread_mutex_init(&mut, NULL);
+ pthread_cond_init(&cond, NULL);
+ locked = 0;
+
+ pthread_attr_init(&attr);
+ pthread_create(&thread, &attr, CdrThread, NULL);
+
+ cacheaddr = -1;
+ } else thread = (pthread_t)-1;
+
+ playing = 0;
+ stopth = 0;
+ initial_time = 0;
+
+ return 0;
+}
+
+long CDRclose(void) {
+ if (!IsCdHandleOpen()) return 0;
+
+ if (playing) CDRstop();
+
+ CloseCdHandle();
+
+ if (thread != (pthread_t)-1) {
+ if (locked == 0) {
+ stopth = 1;
+ while (locked == 0) usleep(5000);
+ }
+
+ stopth = 2;
+ pthread_mutex_lock(&mut);
+ pthread_cond_signal(&cond);
+ pthread_mutex_unlock(&mut);
+
+ pthread_join(thread, NULL);
+ pthread_mutex_destroy(&mut);
+ pthread_cond_destroy(&cond);
+ }
+
+ if (ReadMode == THREADED) {
+ free(cdcache);
+ }
+
+ return 0;
+}
+
+// return Starting and Ending Track
+// buffer:
+// byte 0 - start track
+// byte 1 - end track
+long CDRgetTN(unsigned char *buffer) {
+ long ret;
+
+ if (!IsCdHandleOpen()) {
+ buffer[0] = 1;
+ buffer[1] = 1;
+ return 0;
+ }
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = GetTN(buffer);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ return ret;
+}
+
+// return Track Time
+// buffer:
+// byte 0 - frame
+// byte 1 - second
+// byte 2 - minute
+long CDRgetTD(unsigned char track, unsigned char *buffer) {
+ long ret;
+
+ if (!IsCdHandleOpen()) {
+ memset(buffer + 1, 0, 3);
+ return 0;
+ }
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = GetTD(track, buffer);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ return ret;
+}
+
+// normal reading
+long ReadNormal() {
+ if (ReadSector(&cr) == -1)
+ return -1;
+
+ return 0;
+}
+
+unsigned char* GetBNormal() {
+ return cdbuffer;
+}
+
+// threaded reading (with cache)
+long ReadThreaded() {
+ int addr = msf_to_lba(cr.msf.cdmsf_min0, cr.msf.cdmsf_sec0, cr.msf.cdmsf_frame0);
+ int i;
+
+ if (addr >= cacheaddr && addr < (cacheaddr + CacheSize) && cacheaddr != -1) {
+ i = addr - cacheaddr;
+ PRINTF("found %d\n", (addr - cacheaddr));
+ cdbuffer = cdcache[i].cr.buf + 12;
+ while (btoi(cdbuffer[0]) != cr.msf.cdmsf_min0 ||
+ btoi(cdbuffer[1]) != cr.msf.cdmsf_sec0 ||
+ btoi(cdbuffer[2]) != cr.msf.cdmsf_frame0) {
+ if (locked == 1) {
+ if (cdcache[i].ret == 0) break;
+ return -1;
+ }
+ usleep(5000);
+ }
+ PRINTF("%x:%x:%x, %p, %p\n", cdbuffer[0], cdbuffer[1], cdbuffer[2], cdbuffer, cdcache);
+ found = 1;
+
+ return 0;
+ } else found = 0;
+
+ if (locked == 0) {
+ stopth = 1;
+ while (locked == 0) { usleep(5000); }
+ stopth = 0;
+ }
+
+ // not found in cache
+ locked = 0;
+ pthread_mutex_lock(&mut);
+ pthread_cond_signal(&cond);
+ pthread_mutex_unlock(&mut);
+
+ return 0;
+}
+
+unsigned char* GetBThreaded() {
+ PRINTF("threadc %d\n", found);
+
+ if (found == 1) return cdbuffer;
+ cdbuffer = cdcache[0].cr.buf + 12;
+ while (btoi(cdbuffer[0]) != cr.msf.cdmsf_min0 ||
+ btoi(cdbuffer[1]) != cr.msf.cdmsf_sec0 ||
+ btoi(cdbuffer[2]) != cr.msf.cdmsf_frame0) {
+ if (locked == 1) return NULL;
+ usleep(5000);
+ }
+ if (cdcache[0].ret == -1) return NULL;
+
+ return cdbuffer;
+}
+
+void *CdrThread(void *arg) {
+ unsigned char curTime[3];
+ int i;
+
+ for (;;) {
+ locked = 1;
+ pthread_mutex_lock(&mut);
+ pthread_cond_wait(&cond, &mut);
+
+ if (stopth == 2) pthread_exit(NULL);
+ // refill the buffer
+ cacheaddr = msf_to_lba(cr.msf.cdmsf_min0, cr.msf.cdmsf_sec0, cr.msf.cdmsf_frame0);
+
+ memcpy(curTime, &cr.msf, 3);
+
+ PRINTF("start thc %d:%d:%d\n", curTime[0], curTime[1], curTime[2]);
+
+ for (i = 0; i < CacheSize; i++) {
+ memcpy(&cdcache[i].cr.msf, curTime, 3);
+ PRINTF("reading %d:%d:%d\n", curTime[0], curTime[1], curTime[2]);
+ cdcache[i].ret = ReadSector(&cdcache[i].cr);
+
+ PRINTF("readed %x:%x:%x\n", cdcache[i].cr.buf[12], cdcache[i].cr.buf[13], cdcache[i].cr.buf[14]);
+ if (cdcache[i].ret == -1) break;
+
+ curTime[2]++;
+ if (curTime[2] == 75) {
+ curTime[2] = 0;
+ curTime[1]++;
+ if (curTime[1] == 60) {
+ curTime[1] = 0;
+ curTime[0]++;
+ }
+ }
+
+ if (stopth) break;
+ }
+
+ pthread_mutex_unlock(&mut);
+ }
+
+ return NULL;
+}
+
+// read track
+// time:
+// byte 0 - minute
+// byte 1 - second
+// byte 2 - frame
+// uses bcd format
+long CDRreadTrack(unsigned char *time) {
+ if (!IsCdHandleOpen()) {
+ memset(cr.buf, 0, DATA_SIZE);
+ return 0;
+ }
+
+ PRINTF("CDRreadTrack %d:%d:%d\n", btoi(time[0]), btoi(time[1]), btoi(time[2]));
+
+ if (UseSubQ) memcpy(lastTime, time, 3);
+ subqread = 0;
+
+ cr.msf.cdmsf_min0 = btoi(time[0]);
+ cr.msf.cdmsf_sec0 = btoi(time[1]);
+ cr.msf.cdmsf_frame0 = btoi(time[2]);
+
+ return fReadTrack();
+}
+
+// return readed track
+unsigned char *CDRgetBuffer(void) {
+ return fGetBuffer();
+}
+
+// plays cdda audio
+// sector:
+// byte 0 - minute
+// byte 1 - second
+// byte 2 - frame
+// does NOT uses bcd format
+long CDRplay(unsigned char *sector) {
+ long ret;
+
+ if (!IsCdHandleOpen())
+ return 0;
+
+ // If play was called with the same time as the previous call,
+ // don't restart it. Of course, if play is called with a different
+ // track, stop playing the current stream.
+ if (playing) {
+ if (msf_to_lba(sector[0], sector[1], sector[2]) == initial_time)
+ return 0;
+ else
+ CDRstop();
+ }
+
+ initial_time = msf_to_lba(sector[0], sector[1], sector[2]);
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = PlayCDDA(sector);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ if (ret == 0) {
+ playing = 1;
+ return 0;
+ }
+
+ return -1;
+}
+
+// stops cdda audio
+long CDRstop(void) {
+ long ret;
+
+ if (!IsCdHandleOpen())
+ return 0;
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = StopCDDA();
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ if (ret == 0) {
+ playing = 0;
+ initial_time = 0;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+// reads cdr status
+// type:
+// 0x00 - unknown
+// 0x01 - data
+// 0x02 - audio
+// 0xff - no cdrom
+// status: (only shell open supported)
+// 0x00 - unknown
+// 0x01 - error
+// 0x04 - seek error
+// 0x10 - shell open
+// 0x20 - reading
+// 0x40 - seeking
+// 0x80 - playing
+// time:
+// byte 0 - minute
+// byte 1 - second
+// byte 2 - frame
+
+long CDRgetStatus(struct CdrStat *stat) {
+ long ret;
+
+ if (!IsCdHandleOpen())
+ return -1;
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = GetStatus(playing, stat);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ return ret;
+}
+
+unsigned char *CDRgetBufferSub(void) {
+ static unsigned char *p = NULL;
+
+ if (!UseSubQ) return NULL;
+ if (subqread) return p;
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ p = ReadSub(lastTime);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ if (p != NULL) subqread = 1;
+
+ return p;
+}
+
+// read CDDA sector into buffer
+long CDRreadCDDA(unsigned char m, unsigned char s, unsigned char f, unsigned char *buffer) {
+ unsigned char msf[3] = {m, s, f};
+ unsigned char *p;
+
+ if (CDRreadTrack(msf) != 0) return -1;
+
+ p = CDRgetBuffer();
+ if (p == NULL) return -1;
+
+ memcpy(buffer, p - 12, CD_FRAMESIZE_RAW); // copy from the beginning of the sector
+ return 0;
+}
+
+// get Track End Time
+long CDRgetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f) {
+ long ret;
+
+ if (!IsCdHandleOpen()) return -1;
+
+ if (ReadMode == THREADED) pthread_mutex_lock(&mut);
+ ret = GetTE(track, m, s, f);
+ if (ReadMode == THREADED) pthread_mutex_unlock(&mut);
+
+ return ret;
+}
+
+#ifndef _MACOSX
+
+void ExecCfg(char *arg) {
+ char cfg[256];
+ struct stat buf;
+
+ strcpy(cfg, "./cfgDFCdrom");
+ if (stat(cfg, &buf) != -1) {
+ if (fork() == 0) {
+ execl(cfg, "cfgDFCdrom", arg, NULL);
+ exit(0);
+ }
+ return;
+ }
+
+ strcpy(cfg, "./cfg/DFCdrom");
+ if (stat(cfg, &buf) != -1) {
+ if (fork() == 0) {
+ execl(cfg, "cfgDFCdrom", arg, NULL);
+ exit(0);
+ }
+ return;
+ }
+
+ fprintf(stderr, "cfgDFCdrom file not found!\n");
+}
+
+long CDRconfigure() {
+#ifndef USE_NULL
+ ExecCfg("configure");
+#endif
+ return 0;
+}
+
+void CDRabout() {
+ ExecCfg("about");
+}
+
+#endif
+
+long CDRtest(void) {
+#ifndef USE_NULL
+ if (OpenCdHandle(CdromDev) == -1)
+ return -1;
+ CloseCdHandle();
+#endif
+ return 0;
+}
+
+char *PSEgetLibName(void) {
+ return _(LibName);
+}
+
+unsigned long PSEgetLibType(void) {
+ return PSE_LT_CDR;
+}
+
+unsigned long PSEgetLibVersion(void) {
+ return 1 << 16;
+}
diff --git a/plugins/dfcdrom/cdr.h b/plugins/dfcdrom/cdr.h
new file mode 100644
index 0000000..0ae2c68
--- /dev/null
+++ b/plugins/dfcdrom/cdr.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#ifndef __CDR_H__
+#define __CDR_H__
+
+//#define DEBUG 1
+
+#include "config.h"
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#include <locale.h>
+#define _(x) gettext(x)
+#define N_(x) (x)
+#else
+#define _(x) (x)
+#define N_(x) (x)
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <time.h>
+#include <string.h>
+
+#include "psemu_plugin_defs.h"
+
+#if defined (__linux__)
+
+#include <linux/cdrom.h>
+#include <scsi/scsi.h>
+#include <scsi/sg.h>
+
+#ifndef CDROMSETSPINDOWN
+#define CDROMSETSPINDOWN 0x531e
+#endif
+
+#define DEV_DEF "/dev/cdrom"
+
+#else
+
+struct cdrom_msf {
+ unsigned char cdmsf_min0; /* start minute */
+ unsigned char cdmsf_sec0; /* start second */
+ unsigned char cdmsf_frame0; /* start frame */
+ unsigned char cdmsf_min1; /* end minute */
+ unsigned char cdmsf_sec1; /* end second */
+ unsigned char cdmsf_frame1; /* end frame */
+};
+
+#define CD_SECS 60
+#define CD_FRAMES 75
+#define CD_MSF_OFFSET 150
+#define CD_FRAMESIZE_SUB 96
+
+#if defined (__FreeBSD__)
+#define DEV_DEF "/dev/cd0"
+#else
+#define DEV_DEF ""
+#endif
+
+#if !defined (USE_LIBCDIO) && !defined (_MACOSX)
+#define USE_NULL 1
+#endif
+
+#endif
+
+extern char CdromDev[256];
+extern long ReadMode;
+extern long UseSubQ;
+extern long CacheSize;
+extern long CdrSpeed;
+extern long SpinDown;
+
+#define NORMAL 0
+#define THREADED 1
+#define READ_MODES 2
+
+#ifndef CD_FRAMESIZE_RAW
+#define CD_FRAMESIZE_RAW 2352
+#endif
+
+#define DATA_SIZE (CD_FRAMESIZE_RAW - 12)
+
+// spindown codes
+#define SPINDOWN_VENDOR_SPECIFIC 0x00
+#define SPINDOWN_125MS 0x01
+#define SPINDOWN_250MS 0x02
+#define SPINDOWN_500MS 0x03
+#define SPINDOWN_1S 0x04
+#define SPINDOWN_2S 0x05
+#define SPINDOWN_4S 0x06
+#define SPINDOWN_8S 0x07
+#define SPINDOWN_16S 0x08
+#define SPINDOWN_32S 0x09
+#define SPINDOWN_1MIN 0x0A
+#define SPINDOWN_2MIN 0x0B
+#define SPINDOWN_4MIN 0x0C
+#define SPINDOWN_8MIN 0x0D
+#define SPINDOWN_16MIN 0x0E
+#define SPINDOWN_32MIN 0x0F
+
+typedef struct _MMC_READ_CD {
+ unsigned char Code; // 0xBE
+
+ unsigned char RelativeAddress : 1;
+ unsigned char : 1;
+ unsigned char ExpectedSectorType : 3;
+ unsigned char Lun : 3;
+
+ unsigned char StartingLBA[4];
+ unsigned char TransferBlocks[3];
+
+ unsigned char : 1;
+ unsigned char ErrorFlags : 2;
+ unsigned char IncludeEDC : 1;
+ unsigned char IncludeUserData : 1;
+ unsigned char HeaderCode : 2;
+ unsigned char IncludeSyncData : 1;
+
+ unsigned char SubChannelSelection : 3;
+ unsigned char : 5;
+
+ unsigned char Ctrl;
+} MMC_READ_CD;
+
+#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
+#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
+
+struct CdrStat {
+ unsigned long Type;
+ unsigned long Status;
+ unsigned char Time[3]; // current playing time
+};
+
+struct SubQ {
+ char res0[12];
+ unsigned char ControlAndADR;
+ unsigned char TrackNumber;
+ unsigned char IndexNumber;
+ unsigned char TrackRelativeAddress[3];
+ unsigned char Filler;
+ unsigned char AbsoluteAddress[3];
+ unsigned char CRC[2];
+ char res1[72];
+};
+
+typedef union {
+ struct cdrom_msf msf;
+ unsigned char buf[CD_FRAMESIZE_RAW];
+} crdata;
+
+typedef struct {
+ crdata cr;
+ int ret;
+} CacheData;
+
+long ReadNormal();
+long ReadThreaded();
+unsigned char* GetBNormal();
+unsigned char* GetBThreaded();
+
+long CDRstop(void);
+
+void LoadConf();
+void SaveConf();
+
+#ifdef DEBUG
+#define PRINTF printf
+#else
+#define PRINTF(...) /* */
+#endif
+
+unsigned int msf_to_lba(char m, char s, char f);
+void lba_to_msf(unsigned int s, unsigned char *msf);
+void DecodeRawSubData(unsigned char *subbuffer);
+unsigned short calcCrc(unsigned char *d, int len);
+
+int OpenCdHandle();
+void CloseCdHandle();
+int IsCdHandleOpen();
+long GetTN(unsigned char *buffer);
+long GetTD(unsigned char track, unsigned char *buffer);
+long GetTE(unsigned char track, unsigned char *m, unsigned char *s, unsigned char *f);
+long ReadSector(crdata *cr);
+long PlayCDDA(unsigned char *sector);
+long StopCDDA();
+long GetStatus(int playing, struct CdrStat *stat);
+unsigned char *ReadSub(const unsigned char *time);
+
+#endif
diff --git a/plugins/dfcdrom/cdrcfg-0.1df/dfcdrom.glade2 b/plugins/dfcdrom/cdrcfg-0.1df/dfcdrom.glade2
new file mode 100644
index 0000000..25610e2
--- /dev/null
+++ b/plugins/dfcdrom/cdrcfg-0.1df/dfcdrom.glade2
@@ -0,0 +1,324 @@
+<?xml version="1.0"?>
+<glade-interface>
+ <!-- interface-requires gtk+ 2.6 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <widget class="GtkDialog" id="CfgWnd">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">CDR configuration</property>
+ <property name="modal">True</property>
+ <property name="window_position">center</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <signal name="show" handler="on_cfg_dialog_show"/>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <child>
+ <widget class="GtkComboBoxEntry" id="cddev_comboboxentry">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Choose your CD-ROM device or type its path if it's not listed</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="cdr_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select CD-ROM device</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <child>
+ <widget class="GtkLabel" id="readmode_label">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="ypad">5</property>
+ <property name="label" translatable="yes">Select read mode:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="readmode_combobox">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Normal (No Cache)
+Threaded - Faster (With Cache)</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Cache Size (Def. 64):</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinCacheSize">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">32 32 2048 1 16 0</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator2">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Spindown Time:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="comboSpinDown">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Default
+125ms
+250ms
+500ms
+1s
+2s
+4s
+8s
+16s
+32s
+1min
+2min
+4min
+8min
+16min
+32min</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator3">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Cdrom Speed (Def. 0 = MAX):</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinCdrSpeed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">0 0 100 1 4 0</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="cfg_hseparator">
+ <property name="visible">True</property>
+ <accessibility>
+ <atkproperty name="AtkObject::accessible-name" translatable="yes">hseparator</atkproperty>
+ </accessibility>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="subQ_button">
+ <property name="label" translatable="yes">Enable subchannel read</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="border_width">10</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">8</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="options_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Options</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="cfg_dialog-action_area">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <widget class="GtkButton" id="cfg_closebutton">
+ <property name="label">gtk-close</property>
+ <property name="response_id">-6</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_cfg_cancelbutton_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
diff --git a/plugins/dfcdrom/cdrcfg-0.1df/main.c b/plugins/dfcdrom/cdrcfg-0.1df/main.c
new file mode 100644
index 0000000..c611120
--- /dev/null
+++ b/plugins/dfcdrom/cdrcfg-0.1df/main.c
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#include "../cfg.c"
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+GtkWidget *MainWindow;
+
+// function to check if the device is a cdrom
+int is_cdrom(const char *device) {
+ struct stat st;
+ int fd = -1;
+
+ // check if the file exist
+ if (stat(device, &st) < 0) return 0;
+
+ // check if is a block or char device
+ if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)) return 0;
+
+ // try to open the device file descriptor
+ if ((fd = open(device, O_RDONLY | O_NONBLOCK)) < 0) return 0;
+
+#ifdef __linux__
+ // I need a method to check is a device is really a CD-ROM.
+ // some problems/ideas are:
+ // - different protocls (ide, scsi, old proprietary...)
+ // - maybe we can use major number (see linux/major.h) to do some check.
+ // major number can be retrieved with (st.st_rdev>>8)
+ // scsi has SCSI_CDROM_MAJOR but does this cover all scsi drives?
+ // beside IDE major is the same for hard disks and cdroms...
+ // and DVDs?
+ // - another idea is to parse /proc, but again IDE, scsi etc have
+ // different files... I've not found a way to query "which CD drives
+ // are available?"
+ //
+ // Now I use this ioctl which works also if the drive is empty,
+ // I hope that is implemented for all the drives... here works
+ // fine: at least doesn't let me to select my HD as CDs ;)
+
+ // try a ioctl to see if it's a CD-ROM device
+ if (ioctl(fd, CDROM_GET_CAPABILITY, NULL) < 0) {
+ close(fd);
+ return 0;
+ }
+#endif
+
+ close(fd);
+
+ // yes, it seems a CD drive!
+ return 1;
+}
+
+// fill_drives_list: retrieves available cd drives. At the moment it use a quite
+// ugly "brute force" method: we check for the most common location for cdrom
+// in /dev and chech if they are cdrom devices.
+// If your cdrom path is not listed here you'll have to type it in the dialog
+// entry yourself (or add it here and recompile).
+// Are there any other common entry to add to the list? (especially scsi, I
+// deliberately ignored old non standard cdroms... )
+// If you come up with a better method let me know!!
+void fill_drives_list(GtkWidget *widget) {
+ int i;
+ GtkListStore *store;
+ GtkTreeIter iter;
+
+#if defined (__linux__)
+ static const char *cdrom_devices[] = {
+ "/dev/cdrom",
+ "/dev/cdrom0",
+ "/dev/cdrom1",
+ "/dev/cdrom2",
+ "/dev/cdrom3",
+ "/dev/cdroms/cdrom0",
+ "/dev/cdroms/cdrom1",
+ "/dev/cdroms/cdrom2",
+ "/dev/cdroms/cdrom3",
+ "/dev/hda",
+ "/dev/hdb",
+ "/dev/hdc",
+ "/dev/hdd",
+ "/dev/sda",
+ "/dev/sdb",
+ "/dev/sdc",
+ "/dev/sdd",
+ "/dev/scd0",
+ "/dev/scd1",
+ "/dev/scd2",
+ "/dev/scd3",
+ "/dev/optcd",
+ ""};
+#elif defined (__FreeBSD__)
+ static const char *cdrom_devices[] = {
+ "/dev/cd0",
+ "/dev/cd1",
+ "/dev/cd2",
+ "/dev/cd3",
+ ""};
+#elif defined (__sun)
+ char cdrom_devices[256][256];
+ FILE *fp;
+ char buf[256], *devname, *nick;
+
+ memset(cdrom_devices, 0, sizeof(cdrom_devices));
+
+ i = 0;
+
+ fp = popen("eject -l", "r");
+
+ if (fp != NULL) {
+ while (!feof(fp) && i < 256) {
+ fgets(buf, 256, fp);
+
+ devname = strtok(buf, " ");
+ nick = strtok(NULL, " ");
+
+ if (devname == NULL || nick == NULL) continue;
+
+ if (strstr(nick, "cdrom") != NULL) {
+ strcpy(cdrom_devices[i++], devname);
+ }
+ }
+
+ pclose(fp);
+ }
+#else
+ static const char *cdrom_devices[] = { "" };
+#endif
+
+ store = gtk_list_store_new(1, G_TYPE_STRING);
+
+ // first we put our current drive
+ if (CdromDev[0] != '\0') {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, CdromDev, -1);
+ }
+
+ i = 0;
+
+ // scan cdrom_devices for real cdrom and add them to list
+ while (cdrom_devices[i][0] != '\0') {
+ // check that is not our current dev (already in list)
+ if (strcmp(cdrom_devices[i], CdromDev) != 0) {
+ // check that is a cdrom device
+ if (is_cdrom(cdrom_devices[i])) {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, cdrom_devices[i], -1);
+ }
+ }
+ ++i;
+ }
+
+ gtk_combo_box_set_model(GTK_COMBO_BOX(widget), GTK_TREE_MODEL(store));
+ gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(widget), 0);
+}
+
+static void OnConfigExit(GtkWidget *widget, gpointer user_data) {
+ GladeXML *xml;
+
+ xml = glade_get_widget_tree(MainWindow);
+
+ widget = glade_xml_get_widget(xml, "cddev_comboboxentry");
+ strncpy(CdromDev, gtk_entry_get_text(GTK_ENTRY(GTK_BIN(widget)->child)), 255);
+ CdromDev[255] = '\0';
+
+ widget = glade_xml_get_widget(xml, "readmode_combobox");
+ ReadMode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+
+ widget = glade_xml_get_widget(xml, "subQ_button");
+ UseSubQ = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+ widget = glade_xml_get_widget(xml, "spinCacheSize");
+ CacheSize = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+ widget = glade_xml_get_widget(xml, "spinCdrSpeed");
+ CdrSpeed = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+ widget = glade_xml_get_widget(xml, "comboSpinDown");
+ SpinDown = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+
+ SaveConf();
+
+ gtk_widget_destroy(widget);
+ gtk_exit(0);
+}
+
+long CDRconfigure() {
+ GladeXML *xml;
+ GtkWidget *widget;
+
+ LoadConf();
+
+ xml = glade_xml_new(DATADIR "dfcdrom.glade2", "CfgWnd", NULL);
+ if (xml == NULL) {
+ g_warning("We could not load the interface!");
+ return -1;
+ }
+
+ MainWindow = glade_xml_get_widget(xml, "CfgWnd");
+ gtk_window_set_title(GTK_WINDOW(MainWindow), _("CDR configuration"));
+
+ widget = glade_xml_get_widget(xml, "CfgWnd");
+ g_signal_connect_data(GTK_OBJECT(widget), "delete_event",
+ GTK_SIGNAL_FUNC(OnConfigExit), NULL, NULL, G_CONNECT_AFTER);
+
+ widget = glade_xml_get_widget(xml, "cfg_closebutton");
+ g_signal_connect_data(GTK_OBJECT(widget), "clicked",
+ GTK_SIGNAL_FUNC(OnConfigExit), NULL, NULL, G_CONNECT_AFTER);
+
+ widget = glade_xml_get_widget(xml, "cddev_comboboxentry");
+ fill_drives_list(widget);
+ gtk_entry_set_text(GTK_ENTRY(GTK_BIN(widget)->child), CdromDev);
+
+ widget = glade_xml_get_widget(xml, "readmode_combobox");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(widget), ReadMode);
+
+ widget = glade_xml_get_widget(xml, "subQ_button");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), UseSubQ);
+
+ widget = glade_xml_get_widget(xml, "spinCacheSize");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (float)CacheSize);
+
+ widget = glade_xml_get_widget(xml, "spinCdrSpeed");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (float)CdrSpeed);
+
+ widget = glade_xml_get_widget(xml, "comboSpinDown");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(widget), SpinDown);
+
+ gtk_widget_show(MainWindow);
+ gtk_main();
+
+ return 0;
+}
+
+void CDRabout() {
+ GtkWidget *widget;
+ const char *authors[]= {"linuzappz <linuzappz@hotmail.com>",
+ "xobro <_xobro_@tin.it>",
+ "Wei Mingzhi <whistler_wmz@users.sf.net>", NULL};
+
+ widget = gtk_about_dialog_new();
+ gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(widget), "CD-ROM Device Reader");
+ gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), "1.0");
+ gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(widget), authors);
+ gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget), "http://pcsxr.codeplex.com/");
+
+ gtk_dialog_run(GTK_DIALOG(widget));
+ gtk_widget_destroy(widget);
+}
+
+int main(int argc, char *argv[]) {
+#ifdef ENABLE_NLS
+ setlocale(LC_ALL, "");
+ bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+#endif
+
+ gtk_set_locale();
+ gtk_init(&argc, &argv);
+
+ if (argc != 2) return 0;
+
+ if (strcmp(argv[1], "configure") == 0) {
+ CDRconfigure();
+ } else {
+ CDRabout();
+ }
+
+ return 0;
+}
diff --git a/plugins/dfcdrom/cfg.c b/plugins/dfcdrom/cfg.c
new file mode 100644
index 0000000..2bbc844
--- /dev/null
+++ b/plugins/dfcdrom/cfg.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#include "cdr.h"
+
+char CdromDev[256];
+long ReadMode;
+long UseSubQ;
+long CacheSize;
+long CdrSpeed;
+long SpinDown;
+
+void LoadConf() {
+ FILE *f;
+
+#if defined (__sun)
+ char buf[256], *devname, *nick;
+
+ CdromDev[0] = '\0';
+ f = popen("eject -l", "r");
+
+ if (f != NULL) {
+ while (!feof(f)) {
+ fgets(buf, 256, f);
+
+ devname = strtok(buf, " ");
+ nick = strtok(NULL, " ");
+
+ if (devname == NULL || nick == NULL) continue;
+
+ if (strstr(nick, "cdrom") != NULL) {
+ strcpy(CdromDev, devname);
+ break;
+ }
+ }
+
+ pclose(f);
+ }
+#else
+ strcpy(CdromDev, DEV_DEF);
+#endif
+
+ ReadMode = THREADED;
+ UseSubQ = 0;
+ CacheSize = 64;
+ CdrSpeed = 0;
+ SpinDown = SPINDOWN_VENDOR_SPECIFIC;
+
+ f = fopen("dfcdrom.cfg", "r");
+ if (f == NULL) return;
+
+ fscanf(f, "CdromDev = %s\n", CdromDev);
+ fscanf(f, "ReadMode = %ld\n", &ReadMode);
+ fscanf(f, "UseSubQ = %ld\n", &UseSubQ);
+ fscanf(f, "CacheSize = %ld\n", &CacheSize);
+ fscanf(f, "CdrSpeed = %ld\n", &CdrSpeed);
+ fscanf(f, "SpinDown = %ld\n", &SpinDown);
+ fclose(f);
+
+ if (ReadMode >= READ_MODES) ReadMode = THREADED;
+ if (CacheSize <= 0) CacheSize = 32;
+ if (CacheSize > 2048) CacheSize = 2048;
+ if (SpinDown <= 0) SpinDown = SPINDOWN_VENDOR_SPECIFIC;
+ if (SpinDown > SPINDOWN_32MIN) SpinDown = SPINDOWN_32MIN;
+}
+
+void SaveConf() {
+ FILE *f;
+
+ f = fopen("dfcdrom.cfg", "w");
+ if (f == NULL)
+ return;
+
+ fprintf(f, "CdromDev = %s\n", CdromDev);
+ fprintf(f, "ReadMode = %ld\n", ReadMode);
+ fprintf(f, "UseSubQ = %ld\n", UseSubQ);
+ fprintf(f, "CacheSize = %ld\n", CacheSize);
+ fprintf(f, "CdrSpeed = %ld\n", CdrSpeed);
+ fprintf(f, "SpinDown = %ld\n", SpinDown);
+ fclose(f);
+}
diff --git a/plugins/dfcdrom/util.c b/plugins/dfcdrom/util.c
new file mode 100644
index 0000000..c80c872
--- /dev/null
+++ b/plugins/dfcdrom/util.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010, Wei Mingzhi <whistler@openoffice.org>.
+ * All Rights Reserved.
+ *
+ * Based on: Cdrom for Psemu Pro like Emulators
+ * By: linuzappz <linuzappz@hotmail.com>
+ *
+ * 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, see <http://www.gnu.org/licenses>.
+ */
+
+#include "cdr.h"
+
+unsigned int msf_to_lba(char m, char s, char f) {
+ return (m * CD_SECS + s) * CD_FRAMES + f - CD_MSF_OFFSET;
+}
+
+void lba_to_msf(unsigned int s, unsigned char *msf) {
+ s += CD_MSF_OFFSET;
+
+ msf[0] = s / CD_FRAMES / CD_SECS;
+ s = s - msf[0] * CD_FRAMES * CD_SECS;
+ msf[1] = s / CD_FRAMES;
+ s = s - msf[1] * CD_FRAMES;
+ msf[2] = s;
+}
+
+void DecodeRawSubData(unsigned char *subbuffer) {
+ unsigned char subQData[12];
+ int i;
+
+ memset(subQData, 0, sizeof(subQData));
+
+ for (i = 0; i < 8 * 12; i++) {
+ if (subbuffer[i] & (1 << 6)) { // only subchannel Q is needed
+ subQData[i >> 3] |= (1 << (7 - (i & 7)));
+ }
+ }
+
+ memcpy(&subbuffer[12], subQData, 12);
+}
+
+// lookup table for crc calculation
+static unsigned short crctab[256] = {
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108,
+ 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210,
+ 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B,
+ 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401,
+ 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE,
+ 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6,
+ 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D,
+ 0xC7BC, 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5,
+ 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC,
+ 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 0x6CA6, 0x7C87, 0x4CE4,
+ 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD,
+ 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13,
+ 0x2E32, 0x1E51, 0x0E70, 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A,
+ 0x9F59, 0x8F78, 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E,
+ 0xE16F, 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 0x02B1,
+ 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 0xB5EA, 0xA5CB,
+ 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 0x34E2, 0x24C3, 0x14A0,
+ 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xA7DB, 0xB7FA, 0x8799, 0x97B8,
+ 0xE75F, 0xF77E, 0xC71D, 0xD73C, 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657,
+ 0x7676, 0x4615, 0x5634, 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9,
+ 0xB98A, 0xA9AB, 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882,
+ 0x28A3, 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
+ 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 0xFD2E,
+ 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07,
+ 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D,
+ 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74,
+ 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
+};
+
+unsigned short calcCrc(unsigned char *d, int len) {
+ unsigned short crc = 0;
+ int i;
+
+ for (i = 0; i < len; i++) {
+ crc = crctab[(crc >> 8) ^ d[i]] ^ (crc << 8);
+ }
+
+ return ~crc;
+}