Search
lxdream.org :: lxdream :: r1099:566cdeb157ec
lxdream 0.9.1
released Jun 29
Download Now
changeset1099:566cdeb157ec
parent1098:4f2750753a6c
child1100:50e702af9373
authornkeynes
dateWed Feb 10 18:16:19 2010 +1000 (10 years ago)
First draft of basic ISO9660 filesystem reader
src/Makefile.am
src/Makefile.in
src/bios.c
src/bootstrap.c
src/bootstrap.h
src/drivers/cdrom/cdrom.c
src/drivers/cdrom/cdrom.h
src/drivers/cdrom/drive.c
src/drivers/cdrom/iso_impl.h
src/drivers/cdrom/isoread.c
src/drivers/cdrom/isoread.h
src/drivers/cdrom/sector.c
src/test/testisoread.c
1.1 --- a/src/Makefile.am Sun Jan 31 18:36:06 2010 +1000
1.2 +++ b/src/Makefile.am Wed Feb 10 18:16:19 2010 +1000
1.3 @@ -13,7 +13,7 @@
1.4 PLUGINLDFLAGS = @PLUGINLDFLAGS@
1.5 bin_PROGRAMS = lxdream
1.6 noinst_PROGRAMS = gendec genglsl
1.7 -check_PROGRAMS = test/testxlt
1.8 +check_PROGRAMS = test/testxlt test/testisoread
1.9
1.10 pkglib_PROGRAMS=
1.11 EXTRA_DIST=drivers/genkeymap.pl checkver.pl drivers/dummy.c
1.12 @@ -73,6 +73,7 @@
1.13 drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h drivers/cdrom/drive.c \
1.14 drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
1.15 drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \
1.16 + drivers/cdrom/isoread.h drivers/cdrom/isoread.c drivers/cdrom/iso_impl.h \
1.17 sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \
1.18 hotkeys.c hotkeys.h
1.19 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@
1.20 @@ -238,6 +239,15 @@
1.21
1.22
1.23 test_testxlt_SOURCES = test/testxlt.c xlat/xltcache.c xlat/xltcache.h
1.24 +test_testisoread_SOURCES = test/testisoread.c drivers/cdrom/isoread.c \
1.25 + drivers/cdrom/isoread.h drivers/cdrom/isofs_impl.h drivers/cdrom/ecc.h \
1.26 + drivers/cdrom/cdrom.c drivers/cdrom/cdrom.h drivers/cdrom/sector.h \
1.27 + drivers/cdrom/sector.c drivers/cdrom/cdimpl.h drivers/cdrom/edc_ecc.c \
1.28 + drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
1.29 + drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \
1.30 + drivers/cdrom/defs.h drivers/cdrom/drive.h drivers/cdrom/drive.c \
1.31 + drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c
1.32 +test_testisoread_LDADD = @GLIB_LIBS@ $(INTLLIBS)
1.33
1.34 sh4/sh4core.c: gendec sh4/sh4.def sh4/sh4core.in
1.35 $(mkdir_p) `dirname $@`
2.1 --- a/src/Makefile.in Sun Jan 31 18:36:06 2010 +1000
2.2 +++ b/src/Makefile.in Wed Feb 10 18:16:19 2010 +1000
2.3 @@ -38,7 +38,8 @@
2.4 host_triplet = @host@
2.5 bin_PROGRAMS = lxdream$(EXEEXT)
2.6 noinst_PROGRAMS = gendec$(EXEEXT) genglsl$(EXEEXT)
2.7 -check_PROGRAMS = test/testxlt$(EXEEXT) $(am__EXEEXT_1)
2.8 +check_PROGRAMS = test/testxlt$(EXEEXT) test/testisoread$(EXEEXT) \
2.9 + $(am__EXEEXT_1)
2.10 pkglib_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
2.11 $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7)
2.12 @BUILD_SHARED_TRUE@am__append_1 = plugin.c plugin.h
2.13 @@ -171,11 +172,12 @@
2.14 drivers/cdrom/ecc.h drivers/cdrom/drive.c \
2.15 drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
2.16 drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \
2.17 - drivers/cdrom/cd_mmc.c sh4/sh4.def sh4/sh4core.in \
2.18 - sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c \
2.19 - hotkeys.h plugin.c plugin.h sh4/sh4x86.c xlat/x86/x86op.h \
2.20 - xlat/x86/ia32abi.h xlat/x86/amd64abi.h sh4/sh4trans.c \
2.21 - sh4/sh4trans.h sh4/mmux86.c x86dasm/x86dasm.c \
2.22 + drivers/cdrom/cd_mmc.c drivers/cdrom/isoread.h \
2.23 + drivers/cdrom/isoread.c drivers/cdrom/iso_impl.h sh4/sh4.def \
2.24 + sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \
2.25 + hotkeys.c hotkeys.h plugin.c plugin.h sh4/sh4x86.c \
2.26 + xlat/x86/x86op.h xlat/x86/ia32abi.h xlat/x86/amd64abi.h \
2.27 + sh4/sh4trans.c sh4/sh4trans.h sh4/mmux86.c x86dasm/x86dasm.c \
2.28 x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
2.29 x86dasm/dis-buf.c x86dasm/ansidecl.h x86dasm/bfd.h \
2.30 x86dasm/dis-asm.h x86dasm/symcat.h x86dasm/sysdep.h \
2.31 @@ -275,13 +277,14 @@
2.32 lxdream-sector.$(OBJEXT) lxdream-cd_nrg.$(OBJEXT) \
2.33 lxdream-cd_cdi.$(OBJEXT) lxdream-cd_gdi.$(OBJEXT) \
2.34 lxdream-edc_ecc.$(OBJEXT) lxdream-drive.$(OBJEXT) \
2.35 - lxdream-cd_mmc.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \
2.36 - $(am__objects_1) $(am__objects_2) $(am__objects_3) \
2.37 - $(am__objects_4) $(am__objects_5) $(am__objects_6) \
2.38 - $(am__objects_7) $(am__objects_8) $(am__objects_9) \
2.39 - $(am__objects_10) $(am__objects_11) $(am__objects_12) \
2.40 - $(am__objects_13) $(am__objects_14) $(am__objects_15) \
2.41 - $(am__objects_16) $(am__objects_17) $(am__objects_18)
2.42 + lxdream-cd_mmc.$(OBJEXT) lxdream-isoread.$(OBJEXT) \
2.43 + lxdream-hotkeys.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
2.44 + $(am__objects_3) $(am__objects_4) $(am__objects_5) \
2.45 + $(am__objects_6) $(am__objects_7) $(am__objects_8) \
2.46 + $(am__objects_9) $(am__objects_10) $(am__objects_11) \
2.47 + $(am__objects_12) $(am__objects_13) $(am__objects_14) \
2.48 + $(am__objects_15) $(am__objects_16) $(am__objects_17) \
2.49 + $(am__objects_18)
2.50 lxdream_OBJECTS = $(am_lxdream_OBJECTS)
2.51 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.52 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.53 @@ -290,6 +293,13 @@
2.54 lxdream_dummy_@SOEXT@_OBJECTS = $(am_lxdream_dummy_@SOEXT@_OBJECTS)
2.55 @BUILD_SHARED_TRUE@lxdream_dummy_@SOEXT@_DEPENDENCIES = \
2.56 @BUILD_SHARED_TRUE@ lxdream_dummy.lo
2.57 +am_test_testisoread_OBJECTS = testisoread.$(OBJEXT) isoread.$(OBJEXT) \
2.58 + cdrom.$(OBJEXT) sector.$(OBJEXT) edc_ecc.$(OBJEXT) \
2.59 + drive.$(OBJEXT) cd_nrg.$(OBJEXT) cd_cdi.$(OBJEXT) \
2.60 + cd_gdi.$(OBJEXT)
2.61 +test_testisoread_OBJECTS = $(am_test_testisoread_OBJECTS)
2.62 +test_testisoread_DEPENDENCIES = $(am__DEPENDENCIES_1)
2.63 +am__dirstamp = $(am__leading_dot)dirstamp
2.64 am__test_testsh4x86_SOURCES_DIST = test/testsh4x86.c x86dasm/x86dasm.c \
2.65 x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
2.66 x86dasm/dis-buf.c sh4/sh4trans.c sh4/sh4x86.c xlat/xltcache.c \
2.67 @@ -309,7 +319,6 @@
2.68 @BUILD_SH4X86_TRUE@ test_testsh4x86-cpu.$(OBJEXT)
2.69 test_testsh4x86_OBJECTS = $(am_test_testsh4x86_OBJECTS)
2.70 test_testsh4x86_DEPENDENCIES =
2.71 -am__dirstamp = $(am__leading_dot)dirstamp
2.72 am_test_testxlt_OBJECTS = testxlt.$(OBJEXT) xltcache.$(OBJEXT)
2.73 test_testxlt_OBJECTS = $(am_test_testxlt_OBJECTS)
2.74 test_testxlt_LDADD = $(LDADD)
2.75 @@ -329,13 +338,14 @@
2.76 $(audio_pulse_@SOEXT@_SOURCES) $(audio_sdl_@SOEXT@_SOURCES) \
2.77 $(gendec_SOURCES) $(genglsl_SOURCES) \
2.78 $(input_lirc_@SOEXT@_SOURCES) $(lxdream_SOURCES) \
2.79 - $(lxdream_dummy_@SOEXT@_SOURCES) $(test_testsh4x86_SOURCES) \
2.80 - $(test_testxlt_SOURCES)
2.81 + $(lxdream_dummy_@SOEXT@_SOURCES) $(test_testisoread_SOURCES) \
2.82 + $(test_testsh4x86_SOURCES) $(test_testxlt_SOURCES)
2.83 DIST_SOURCES = $(audio_alsa_@SOEXT@_SOURCES) \
2.84 $(audio_esd_@SOEXT@_SOURCES) $(audio_pulse_@SOEXT@_SOURCES) \
2.85 $(audio_sdl_@SOEXT@_SOURCES) $(gendec_SOURCES) \
2.86 $(genglsl_SOURCES) $(input_lirc_@SOEXT@_SOURCES) \
2.87 $(am__lxdream_SOURCES_DIST) $(lxdream_dummy_@SOEXT@_SOURCES) \
2.88 + $(test_testisoread_SOURCES) \
2.89 $(am__test_testsh4x86_SOURCES_DIST) $(test_testxlt_SOURCES)
2.90 ETAGS = etags
2.91 CTAGS = ctags
2.92 @@ -583,14 +593,15 @@
2.93 drivers/cdrom/drive.c drivers/cdrom/edc_crctable.h \
2.94 drivers/cdrom/edc_encoder.h drivers/cdrom/edc_l2sq.h \
2.95 drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \
2.96 - sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in \
2.97 - sh4/sh4stat.in hotkeys.c hotkeys.h $(am__append_1) \
2.98 - $(am__append_2) $(am__append_4) $(am__append_5) \
2.99 - $(am__append_6) $(am__append_7) $(am__append_8) \
2.100 - $(am__append_9) $(am__append_10) $(am__append_17) \
2.101 - $(am__append_19) $(am__append_21) $(am__append_23) \
2.102 - $(am__append_25) $(am__append_27) $(am__append_28) \
2.103 - $(am__append_29) $(am__append_30)
2.104 + drivers/cdrom/isoread.h drivers/cdrom/isoread.c \
2.105 + drivers/cdrom/iso_impl.h sh4/sh4.def sh4/sh4core.in \
2.106 + sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c \
2.107 + hotkeys.h $(am__append_1) $(am__append_2) $(am__append_4) \
2.108 + $(am__append_5) $(am__append_6) $(am__append_7) \
2.109 + $(am__append_8) $(am__append_9) $(am__append_10) \
2.110 + $(am__append_17) $(am__append_19) $(am__append_21) \
2.111 + $(am__append_23) $(am__append_25) $(am__append_27) \
2.112 + $(am__append_28) $(am__append_29) $(am__append_30)
2.113 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@
2.114 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@
2.115 @BUILD_SH4X86_TRUE@test_testsh4x86_CPPFLAGS = @LXDREAMCPPFLAGS@
2.116 @@ -621,6 +632,16 @@
2.117 gendec_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)
2.118 genglsl_LDADD = @GLIB_LIBS@ @GTK_LIBS@ $(INTLLIBS)
2.119 test_testxlt_SOURCES = test/testxlt.c xlat/xltcache.c xlat/xltcache.h
2.120 +test_testisoread_SOURCES = test/testisoread.c drivers/cdrom/isoread.c \
2.121 + drivers/cdrom/isoread.h drivers/cdrom/isofs_impl.h drivers/cdrom/ecc.h \
2.122 + drivers/cdrom/cdrom.c drivers/cdrom/cdrom.h drivers/cdrom/sector.h \
2.123 + drivers/cdrom/sector.c drivers/cdrom/cdimpl.h drivers/cdrom/edc_ecc.c \
2.124 + drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
2.125 + drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \
2.126 + drivers/cdrom/defs.h drivers/cdrom/drive.h drivers/cdrom/drive.c \
2.127 + drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c
2.128 +
2.129 +test_testisoread_LDADD = @GLIB_LIBS@ $(INTLLIBS)
2.130 all: $(BUILT_SOURCES)
2.131 $(MAKE) $(AM_MAKEFLAGS) all-am
2.132
2.133 @@ -737,6 +758,9 @@
2.134 test/$(am__dirstamp):
2.135 @$(mkdir_p) test
2.136 @: > test/$(am__dirstamp)
2.137 +test/testisoread$(EXEEXT): $(test_testisoread_OBJECTS) $(test_testisoread_DEPENDENCIES) test/$(am__dirstamp)
2.138 + @rm -f test/testisoread$(EXEEXT)
2.139 + $(LINK) $(test_testisoread_LDFLAGS) $(test_testisoread_OBJECTS) $(test_testisoread_LDADD) $(LIBS)
2.140 test/testsh4x86$(EXEEXT): $(test_testsh4x86_OBJECTS) $(test_testsh4x86_DEPENDENCIES) test/$(am__dirstamp)
2.141 @rm -f test/testsh4x86$(EXEEXT)
2.142 $(LINK) $(test_testsh4x86_LDFLAGS) $(test_testsh4x86_OBJECTS) $(test_testsh4x86_LDADD) $(LIBS)
2.143 @@ -751,9 +775,16 @@
2.144 -rm -f *.tab.c
2.145
2.146 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/actparse.Po@am__quote@
2.147 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd_cdi.Po@am__quote@
2.148 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd_gdi.Po@am__quote@
2.149 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cd_nrg.Po@am__quote@
2.150 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom.Po@am__quote@
2.151 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive.Po@am__quote@
2.152 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edc_ecc.Po@am__quote@
2.153 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gendec.Po@am__quote@
2.154 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genglsl.Po@am__quote@
2.155 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insparse.Po@am__quote@
2.156 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isoread.Po@am__quote@
2.157 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-aica.Po@am__quote@
2.158 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-armcore.Po@am__quote@
2.159 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-armdasm.Po@am__quote@
2.160 @@ -820,6 +851,7 @@
2.161 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-io_glib.Po@am__quote@
2.162 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-io_osx.Po@am__quote@
2.163 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-ioutil.Po@am__quote@
2.164 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-isoread.Po@am__quote@
2.165 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-joy_linux.Po@am__quote@
2.166 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-kbd.Po@am__quote@
2.167 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-lightgun.Po@am__quote@
2.168 @@ -873,6 +905,7 @@
2.169 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-x86dasm.Po@am__quote@
2.170 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-xltcache.Po@am__quote@
2.171 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-yuv.Po@am__quote@
2.172 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sector.Po@am__quote@
2.173 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-cpu.Po@am__quote@
2.174 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-dis-buf.Po@am__quote@
2.175 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-dis-init.Po@am__quote@
2.176 @@ -885,6 +918,7 @@
2.177 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-util.Po@am__quote@
2.178 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-x86dasm.Po@am__quote@
2.179 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_testsh4x86-xltcache.Po@am__quote@
2.180 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testisoread.Po@am__quote@
2.181 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testxlt.Po@am__quote@
2.182 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xltcache.Po@am__quote@
2.183
2.184 @@ -2008,6 +2042,20 @@
2.185 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.186 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cdrom/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_mmc.c'; fi`
2.187
2.188 +lxdream-isoread.o: drivers/cdrom/isoread.c
2.189 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-isoread.o -MD -MP -MF "$(DEPDIR)/lxdream-isoread.Tpo" -c -o lxdream-isoread.o `test -f 'drivers/cdrom/isoread.c' || echo '$(srcdir)/'`drivers/cdrom/isoread.c; \
2.190 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-isoread.Tpo" "$(DEPDIR)/lxdream-isoread.Po"; else rm -f "$(DEPDIR)/lxdream-isoread.Tpo"; exit 1; fi
2.191 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/isoread.c' object='lxdream-isoread.o' libtool=no @AMDEPBACKSLASH@
2.192 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.193 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-isoread.o `test -f 'drivers/cdrom/isoread.c' || echo '$(srcdir)/'`drivers/cdrom/isoread.c
2.194 +
2.195 +lxdream-isoread.obj: drivers/cdrom/isoread.c
2.196 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-isoread.obj -MD -MP -MF "$(DEPDIR)/lxdream-isoread.Tpo" -c -o lxdream-isoread.obj `if test -f 'drivers/cdrom/isoread.c'; then $(CYGPATH_W) 'drivers/cdrom/isoread.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/isoread.c'; fi`; \
2.197 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-isoread.Tpo" "$(DEPDIR)/lxdream-isoread.Po"; else rm -f "$(DEPDIR)/lxdream-isoread.Tpo"; exit 1; fi
2.198 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/isoread.c' object='lxdream-isoread.obj' libtool=no @AMDEPBACKSLASH@
2.199 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.200 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-isoread.obj `if test -f 'drivers/cdrom/isoread.c'; then $(CYGPATH_W) 'drivers/cdrom/isoread.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/isoread.c'; fi`
2.201 +
2.202 lxdream-hotkeys.o: hotkeys.c
2.203 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-hotkeys.o -MD -MP -MF "$(DEPDIR)/lxdream-hotkeys.Tpo" -c -o lxdream-hotkeys.o `test -f 'hotkeys.c' || echo '$(srcdir)/'`hotkeys.c; \
2.204 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-hotkeys.Tpo" "$(DEPDIR)/lxdream-hotkeys.Po"; else rm -f "$(DEPDIR)/lxdream-hotkeys.Tpo"; exit 1; fi
2.205 @@ -2456,6 +2504,132 @@
2.206 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.207 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-joy_linux.obj `if test -f 'drivers/joy_linux.c'; then $(CYGPATH_W) 'drivers/joy_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/joy_linux.c'; fi`
2.208
2.209 +testisoread.o: test/testisoread.c
2.210 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testisoread.o -MD -MP -MF "$(DEPDIR)/testisoread.Tpo" -c -o testisoread.o `test -f 'test/testisoread.c' || echo '$(srcdir)/'`test/testisoread.c; \
2.211 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testisoread.Tpo" "$(DEPDIR)/testisoread.Po"; else rm -f "$(DEPDIR)/testisoread.Tpo"; exit 1; fi
2.212 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test/testisoread.c' object='testisoread.o' libtool=no @AMDEPBACKSLASH@
2.213 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.214 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testisoread.o `test -f 'test/testisoread.c' || echo '$(srcdir)/'`test/testisoread.c
2.215 +
2.216 +testisoread.obj: test/testisoread.c
2.217 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testisoread.obj -MD -MP -MF "$(DEPDIR)/testisoread.Tpo" -c -o testisoread.obj `if test -f 'test/testisoread.c'; then $(CYGPATH_W) 'test/testisoread.c'; else $(CYGPATH_W) '$(srcdir)/test/testisoread.c'; fi`; \
2.218 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testisoread.Tpo" "$(DEPDIR)/testisoread.Po"; else rm -f "$(DEPDIR)/testisoread.Tpo"; exit 1; fi
2.219 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test/testisoread.c' object='testisoread.obj' libtool=no @AMDEPBACKSLASH@
2.220 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.221 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testisoread.obj `if test -f 'test/testisoread.c'; then $(CYGPATH_W) 'test/testisoread.c'; else $(CYGPATH_W) '$(srcdir)/test/testisoread.c'; fi`
2.222 +
2.223 +isoread.o: drivers/cdrom/isoread.c
2.224 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT isoread.o -MD -MP -MF "$(DEPDIR)/isoread.Tpo" -c -o isoread.o `test -f 'drivers/cdrom/isoread.c' || echo '$(srcdir)/'`drivers/cdrom/isoread.c; \
2.225 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/isoread.Tpo" "$(DEPDIR)/isoread.Po"; else rm -f "$(DEPDIR)/isoread.Tpo"; exit 1; fi
2.226 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/isoread.c' object='isoread.o' libtool=no @AMDEPBACKSLASH@
2.227 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.228 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o isoread.o `test -f 'drivers/cdrom/isoread.c' || echo '$(srcdir)/'`drivers/cdrom/isoread.c
2.229 +
2.230 +isoread.obj: drivers/cdrom/isoread.c
2.231 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT isoread.obj -MD -MP -MF "$(DEPDIR)/isoread.Tpo" -c -o isoread.obj `if test -f 'drivers/cdrom/isoread.c'; then $(CYGPATH_W) 'drivers/cdrom/isoread.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/isoread.c'; fi`; \
2.232 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/isoread.Tpo" "$(DEPDIR)/isoread.Po"; else rm -f "$(DEPDIR)/isoread.Tpo"; exit 1; fi
2.233 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/isoread.c' object='isoread.obj' libtool=no @AMDEPBACKSLASH@
2.234 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.235 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o isoread.obj `if test -f 'drivers/cdrom/isoread.c'; then $(CYGPATH_W) 'drivers/cdrom/isoread.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/isoread.c'; fi`
2.236 +
2.237 +cdrom.o: drivers/cdrom/cdrom.c
2.238 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdrom.o -MD -MP -MF "$(DEPDIR)/cdrom.Tpo" -c -o cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c; \
2.239 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cdrom.Tpo" "$(DEPDIR)/cdrom.Po"; else rm -f "$(DEPDIR)/cdrom.Tpo"; exit 1; fi
2.240 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cdrom.c' object='cdrom.o' libtool=no @AMDEPBACKSLASH@
2.241 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.242 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c
2.243 +
2.244 +cdrom.obj: drivers/cdrom/cdrom.c
2.245 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cdrom.obj -MD -MP -MF "$(DEPDIR)/cdrom.Tpo" -c -o cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`; \
2.246 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cdrom.Tpo" "$(DEPDIR)/cdrom.Po"; else rm -f "$(DEPDIR)/cdrom.Tpo"; exit 1; fi
2.247 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cdrom.c' object='cdrom.obj' libtool=no @AMDEPBACKSLASH@
2.248 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.249 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`
2.250 +
2.251 +sector.o: drivers/cdrom/sector.c
2.252 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sector.o -MD -MP -MF "$(DEPDIR)/sector.Tpo" -c -o sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c; \
2.253 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sector.Tpo" "$(DEPDIR)/sector.Po"; else rm -f "$(DEPDIR)/sector.Tpo"; exit 1; fi
2.254 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/sector.c' object='sector.o' libtool=no @AMDEPBACKSLASH@
2.255 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.256 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c
2.257 +
2.258 +sector.obj: drivers/cdrom/sector.c
2.259 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sector.obj -MD -MP -MF "$(DEPDIR)/sector.Tpo" -c -o sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`; \
2.260 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sector.Tpo" "$(DEPDIR)/sector.Po"; else rm -f "$(DEPDIR)/sector.Tpo"; exit 1; fi
2.261 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/sector.c' object='sector.obj' libtool=no @AMDEPBACKSLASH@
2.262 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.263 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`
2.264 +
2.265 +edc_ecc.o: drivers/cdrom/edc_ecc.c
2.266 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edc_ecc.o -MD -MP -MF "$(DEPDIR)/edc_ecc.Tpo" -c -o edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c; \
2.267 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/edc_ecc.Tpo" "$(DEPDIR)/edc_ecc.Po"; else rm -f "$(DEPDIR)/edc_ecc.Tpo"; exit 1; fi
2.268 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/edc_ecc.c' object='edc_ecc.o' libtool=no @AMDEPBACKSLASH@
2.269 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.270 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c
2.271 +
2.272 +edc_ecc.obj: drivers/cdrom/edc_ecc.c
2.273 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edc_ecc.obj -MD -MP -MF "$(DEPDIR)/edc_ecc.Tpo" -c -o edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`; \
2.274 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/edc_ecc.Tpo" "$(DEPDIR)/edc_ecc.Po"; else rm -f "$(DEPDIR)/edc_ecc.Tpo"; exit 1; fi
2.275 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/edc_ecc.c' object='edc_ecc.obj' libtool=no @AMDEPBACKSLASH@
2.276 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.277 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`
2.278 +
2.279 +drive.o: drivers/cdrom/drive.c
2.280 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT drive.o -MD -MP -MF "$(DEPDIR)/drive.Tpo" -c -o drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c; \
2.281 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/drive.Tpo" "$(DEPDIR)/drive.Po"; else rm -f "$(DEPDIR)/drive.Tpo"; exit 1; fi
2.282 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/drive.c' object='drive.o' libtool=no @AMDEPBACKSLASH@
2.283 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.284 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c
2.285 +
2.286 +drive.obj: drivers/cdrom/drive.c
2.287 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT drive.obj -MD -MP -MF "$(DEPDIR)/drive.Tpo" -c -o drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`; \
2.288 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/drive.Tpo" "$(DEPDIR)/drive.Po"; else rm -f "$(DEPDIR)/drive.Tpo"; exit 1; fi
2.289 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/drive.c' object='drive.obj' libtool=no @AMDEPBACKSLASH@
2.290 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.291 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`
2.292 +
2.293 +cd_nrg.o: drivers/cdrom/cd_nrg.c
2.294 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_nrg.o -MD -MP -MF "$(DEPDIR)/cd_nrg.Tpo" -c -o cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c; \
2.295 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_nrg.Tpo" "$(DEPDIR)/cd_nrg.Po"; else rm -f "$(DEPDIR)/cd_nrg.Tpo"; exit 1; fi
2.296 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_nrg.c' object='cd_nrg.o' libtool=no @AMDEPBACKSLASH@
2.297 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.298 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c
2.299 +
2.300 +cd_nrg.obj: drivers/cdrom/cd_nrg.c
2.301 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_nrg.obj -MD -MP -MF "$(DEPDIR)/cd_nrg.Tpo" -c -o cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`; \
2.302 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_nrg.Tpo" "$(DEPDIR)/cd_nrg.Po"; else rm -f "$(DEPDIR)/cd_nrg.Tpo"; exit 1; fi
2.303 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_nrg.c' object='cd_nrg.obj' libtool=no @AMDEPBACKSLASH@
2.304 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.305 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`
2.306 +
2.307 +cd_cdi.o: drivers/cdrom/cd_cdi.c
2.308 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_cdi.o -MD -MP -MF "$(DEPDIR)/cd_cdi.Tpo" -c -o cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c; \
2.309 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_cdi.Tpo" "$(DEPDIR)/cd_cdi.Po"; else rm -f "$(DEPDIR)/cd_cdi.Tpo"; exit 1; fi
2.310 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_cdi.c' object='cd_cdi.o' libtool=no @AMDEPBACKSLASH@
2.311 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.312 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c
2.313 +
2.314 +cd_cdi.obj: drivers/cdrom/cd_cdi.c
2.315 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_cdi.obj -MD -MP -MF "$(DEPDIR)/cd_cdi.Tpo" -c -o cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`; \
2.316 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_cdi.Tpo" "$(DEPDIR)/cd_cdi.Po"; else rm -f "$(DEPDIR)/cd_cdi.Tpo"; exit 1; fi
2.317 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_cdi.c' object='cd_cdi.obj' libtool=no @AMDEPBACKSLASH@
2.318 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.319 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`
2.320 +
2.321 +cd_gdi.o: drivers/cdrom/cd_gdi.c
2.322 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_gdi.o -MD -MP -MF "$(DEPDIR)/cd_gdi.Tpo" -c -o cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c; \
2.323 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_gdi.Tpo" "$(DEPDIR)/cd_gdi.Po"; else rm -f "$(DEPDIR)/cd_gdi.Tpo"; exit 1; fi
2.324 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_gdi.c' object='cd_gdi.o' libtool=no @AMDEPBACKSLASH@
2.325 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.326 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c
2.327 +
2.328 +cd_gdi.obj: drivers/cdrom/cd_gdi.c
2.329 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cd_gdi.obj -MD -MP -MF "$(DEPDIR)/cd_gdi.Tpo" -c -o cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`; \
2.330 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cd_gdi.Tpo" "$(DEPDIR)/cd_gdi.Po"; else rm -f "$(DEPDIR)/cd_gdi.Tpo"; exit 1; fi
2.331 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_gdi.c' object='cd_gdi.obj' libtool=no @AMDEPBACKSLASH@
2.332 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.333 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`
2.334 +
2.335 test_testsh4x86-testsh4x86.o: test/testsh4x86.c
2.336 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_testsh4x86_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_testsh4x86-testsh4x86.o -MD -MP -MF "$(DEPDIR)/test_testsh4x86-testsh4x86.Tpo" -c -o test_testsh4x86-testsh4x86.o `test -f 'test/testsh4x86.c' || echo '$(srcdir)/'`test/testsh4x86.c; \
2.337 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_testsh4x86-testsh4x86.Tpo" "$(DEPDIR)/test_testsh4x86-testsh4x86.Po"; else rm -f "$(DEPDIR)/test_testsh4x86-testsh4x86.Tpo"; exit 1; fi
3.1 --- a/src/bios.c Sun Jan 31 18:36:06 2010 +1000
3.2 +++ b/src/bios.c Wed Feb 10 18:16:19 2010 +1000
3.3 @@ -20,7 +20,11 @@
3.4 #include "mem.h"
3.5 #include "syscall.h"
3.6 #include "dreamcast.h"
3.7 +#include "bootstrap.h"
3.8 #include "sh4/sh4.h"
3.9 +#include "drivers/cdrom/cdrom.h"
3.10 +#include "drivers/cdrom/isoread.h"
3.11 +#include "gdrom/gdrom.h"
3.12
3.13 #define COMMAND_QUEUE_LENGTH 16
3.14
3.15 @@ -203,6 +207,13 @@
3.16 }
3.17 }
3.18
3.19 +void bios_boot( uint32_t syscallid )
3.20 +{
3.21 + /* Initialize hardware */
3.22 + /* Boot disc if present */
3.23 + bios_boot_gdrom_disc();
3.24 +}
3.25 +
3.26 void bios_install( void )
3.27 {
3.28 bios_gdrom_init();
3.29 @@ -212,3 +223,96 @@
3.30 syscall_add_hook_vector( 0xBC, 0x8C0000BC, bios_syscall );
3.31 syscall_add_hook_vector( 0xE0, 0x8C0000E0, bios_syscall );
3.32 }
3.33 +
3.34 +#define MIN_ISO_SECTORS 32
3.35 +
3.36 +gboolean bios_boot_gdrom_disc( void )
3.37 +{
3.38 + cdrom_disc_t disc = gdrom_get_current_disc();
3.39 +
3.40 + int status = gdrom_get_drive_status();
3.41 + if( status == CDROM_DISC_NONE ) {
3.42 + ERROR( "No disc in drive" );
3.43 + return FALSE;
3.44 + }
3.45 +
3.46 + /* Find the bootable data track (if present) */
3.47 + cdrom_track_t track = gdrom_disc_get_boot_track(disc);
3.48 + if( track == NULL ) {
3.49 + ERROR( "Disc is not bootable" );
3.50 + return FALSE;
3.51 + }
3.52 + uint32_t lba = track->lba;
3.53 + uint32_t sectors = cdrom_disc_get_track_size(disc,track);
3.54 + if( sectors < MIN_ISO_SECTORS ) {
3.55 + ERROR( "Disc is not bootable" );
3.56 + return FALSE;
3.57 + }
3.58 + /* Load the initial bootstrap into DC ram at 8c008000 */
3.59 + size_t length = BOOTSTRAP_SIZE;
3.60 + unsigned char *bootstrap = mem_get_region(BOOTSTRAP_LOAD_ADDR);
3.61 + if( cdrom_disc_read_sectors( disc, track->lba, BOOTSTRAP_SIZE/2048,
3.62 + CDROM_READ_DATA|CDROM_READ_MODE2_FORM1, bootstrap, &length ) !=
3.63 + CDROM_ERROR_OK ) {
3.64 + ERROR( "Disc is not bootable" );
3.65 + return FALSE;
3.66 + }
3.67 +
3.68 + /* Check the magic just to be sure */
3.69 + dc_bootstrap_head_t metadata = (dc_bootstrap_head_t)bootstrap;
3.70 + if( memcmp( metadata->magic, BOOTSTRAP_MAGIC, BOOTSTRAP_MAGIC_SIZE ) != 0 ) {
3.71 + ERROR( "Disc is not bootable (missing dreamcast bootstrap)" );
3.72 + return FALSE;
3.73 + }
3.74 +
3.75 + /* Get the initial program from the bootstrap (usually 1ST_READ.BIN) */
3.76 + char program_name[17];
3.77 + memcpy(program_name, metadata->boot_file, 16);
3.78 + program_name[16] = '\0';
3.79 + for( int i=15; i >= 0 && program_name[i] == ' '; i-- ) {
3.80 + program_name[i] = '\0';
3.81 + }
3.82 +
3.83 + /* Bootstrap is good. Now find the program in the actual filesystem... */
3.84 + isofs_reader_t iso = isofs_reader_new_from_track( disc, track, NULL );
3.85 + if( iso == NULL ) {
3.86 + ERROR( "Disc is not bootable" );
3.87 + return FALSE;
3.88 + }
3.89 + isofs_reader_dirent_t ent = isofs_reader_get_file( iso, program_name );
3.90 + if( ent == NULL ) {
3.91 + ERROR( "Disc is not bootable (initial program '%s' not found)", program_name );
3.92 + isofs_reader_destroy(iso);
3.93 + return FALSE;
3.94 + }
3.95 +
3.96 + if( ent->size > (0x8D000000 - BINARY_LOAD_ADDR) ) {
3.97 + /* Bootstrap isn't going to fit in memory. Complain and abort */
3.98 + ERROR( "Disc is not bootable (initial program too large)" );
3.99 + isofs_reader_destroy(iso);
3.100 + return FALSE;
3.101 + }
3.102 + unsigned char *program = mem_get_region(BINARY_LOAD_ADDR);
3.103 + int program_sectors = (ent->size+2047)/2048;
3.104 + if( disc->disc_type == CDROM_DISC_GDROM ) {
3.105 + /* Load the binary directly into RAM */
3.106 + if( isofs_reader_read_file( iso, ent, 0, ent->size, program ) !=
3.107 + CDROM_ERROR_OK ) {
3.108 + ERROR( "Disc is not bootable (failed to read initial program)\n" );
3.109 + isofs_reader_destroy(iso);
3.110 + return FALSE;
3.111 + }
3.112 + } else {
3.113 + /* Load the binary into a temp buffer */
3.114 + unsigned char tmp[program_sectors*2048];
3.115 + if( isofs_reader_read_file( iso, ent, 0, ent->size, tmp ) !=
3.116 + CDROM_ERROR_OK ) {
3.117 + ERROR( "Disc is not bootable (failed to read initial program)\n" );
3.118 + isofs_reader_destroy(iso);
3.119 + return FALSE;
3.120 + }
3.121 + bootprogram_unscramble(program, tmp, ent->size);
3.122 + }
3.123 + isofs_reader_destroy(iso);
3.124 + dreamcast_program_loaded( "", BOOTSTRAP_LOAD_ADDR );
3.125 +}
4.1 --- a/src/bootstrap.c Sun Jan 31 18:36:06 2010 +1000
4.2 +++ b/src/bootstrap.c Wed Feb 10 18:16:19 2010 +1000
4.3 @@ -135,3 +135,71 @@
4.4 INFO( buf, NULL );
4.5 }
4.6 }
4.7 +
4.8 +/* Scramble/unscramble, based on Marcus Comstedt's algorithm. */
4.9 +
4.10 +typedef uint16_t randseed;
4.11 +
4.12 +#define MAXBLOCK (2048*1024)
4.13 +#define CHUNKSIZE 32
4.14 +#define NEXT(seed) (((seed = (seed*2109+9273)&0x7fff) + 0xC000) & 0xFFFF)
4.15 +
4.16 +void bootprogram_scramble( unsigned char *dest, unsigned char *src, size_t length )
4.17 +{
4.18 + randseed seed = length & 0xFFFF;
4.19 + unsigned table[MAXBLOCK/32];
4.20 + unsigned char *s = src;
4.21 + unsigned char *d = dest;
4.22 +
4.23 + for( unsigned blocksize = MAXBLOCK; blocksize >= CHUNKSIZE; blocksize >>= 1 ) {
4.24 + while( length >= blocksize ) {
4.25 + unsigned nchunks = blocksize/CHUNKSIZE;
4.26 + for( unsigned i=0; i<nchunks; i++ ) {
4.27 + table[i] = i; // Identity
4.28 + }
4.29 + for( unsigned i = nchunks-1; i != (unsigned)-1; --i ) {
4.30 + unsigned j = (NEXT(seed) * i)>>16;
4.31 + unsigned tmp = table[i];
4.32 + table[i] = table[j];
4.33 + table[j] = tmp;
4.34 + memcpy( d, s + CHUNKSIZE*table[i], CHUNKSIZE );
4.35 + d+= CHUNKSIZE;
4.36 + }
4.37 + length -= blocksize;
4.38 + s += blocksize;
4.39 + }
4.40 + }
4.41 + if( length ) {
4.42 + memcpy( d, s, length );
4.43 + }
4.44 +}
4.45 +
4.46 +void bootprogram_unscramble( unsigned char *dest, unsigned char *src, size_t length )
4.47 +{
4.48 + randseed seed = length & 0xFFFF;
4.49 + unsigned table[MAXBLOCK/32];
4.50 + unsigned char *s = src;
4.51 + unsigned char *d = dest;
4.52 +
4.53 + for( unsigned blocksize = MAXBLOCK; blocksize >= CHUNKSIZE; blocksize >>= 1 ) {
4.54 + while( length >= blocksize ) {
4.55 + unsigned nchunks = blocksize/CHUNKSIZE;
4.56 + for( unsigned i=0; i<nchunks; i++ ) {
4.57 + table[i] = i; // Identity
4.58 + }
4.59 + for( unsigned i = nchunks-1; i != (unsigned)-1; --i ) {
4.60 + unsigned j = (NEXT(seed) * i)>>16;
4.61 + unsigned tmp = table[i];
4.62 + table[i] = table[j];
4.63 + table[j] = tmp;
4.64 + memcpy( d + CHUNKSIZE*table[i], s, CHUNKSIZE );
4.65 + s+= CHUNKSIZE;
4.66 + }
4.67 + length -= blocksize;
4.68 + d += blocksize;
4.69 + }
4.70 + }
4.71 + if( length ) {
4.72 + memcpy( d, s, length );
4.73 + }
4.74 +}
5.1 --- a/src/bootstrap.h Sun Jan 31 18:36:06 2010 +1000
5.2 +++ b/src/bootstrap.h Wed Feb 10 18:16:19 2010 +1000
5.3 @@ -31,6 +31,7 @@
5.4 #define BOOTSTRAP_LOAD_ADDR 0x8C008000
5.5 #define BOOTSTRAP_SIZE 32768
5.6 #define BOOTSTRAP_MAGIC "SEGA SEGAKATANA SEGA ENTERPRISES"
5.7 +#define BOOTSTRAP_MAGIC_SIZE 32
5.8
5.9 #define BINARY_LOAD_ADDR 0x8C010000
5.10
5.11 @@ -59,6 +60,8 @@
5.12 */
5.13 void bootstrap_dump(void *data, gboolean detail);
5.14
5.15 +void bootprogram_scramble( unsigned char *dest, unsigned char *src, size_t length );
5.16 +void bootprogram_unscramble( unsigned char *dest, unsigned char *src, size_t length );
5.17 #ifdef __cplusplus
5.18 }
5.19 #endif
6.1 --- a/src/drivers/cdrom/cdrom.c Sun Jan 31 18:36:06 2010 +1000
6.2 +++ b/src/drivers/cdrom/cdrom.c Wed Feb 10 18:16:19 2010 +1000
6.3 @@ -74,7 +74,8 @@
6.4 len += tmplen;
6.5 current += sub_count;
6.6 }
6.7 - *length = len;
6.8 + if( length != NULL )
6.9 + *length = len;
6.10 return CDROM_ERROR_OK;
6.11 }
6.12
6.13 @@ -310,6 +311,15 @@
6.14 return &disc->track[disc->track_count-1];
6.15 }
6.16
6.17 +cdrom_track_t cdrom_disc_get_last_data_track( cdrom_disc_t disc )
6.18 +{
6.19 + for( unsigned i=disc->track_count; i>0; i-- ) {
6.20 + if( disc->track[i-1].flags & TRACK_FLAG_DATA ) {
6.21 + return &disc->track[i-1];
6.22 + }
6.23 + }
6.24 + return NULL;
6.25 +}
6.26 cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track )
6.27 {
6.28 if( track->trackno <= 1 )
6.29 @@ -383,4 +393,3 @@
6.30 {
6.31 cdrom_disc_print_toc( stderr, disc );
6.32 }
6.33 -
7.1 --- a/src/drivers/cdrom/cdrom.h Sun Jan 31 18:36:06 2010 +1000
7.2 +++ b/src/drivers/cdrom/cdrom.h Wed Feb 10 18:16:19 2010 +1000
7.3 @@ -110,6 +110,11 @@
7.4
7.5 cdrom_track_t cdrom_disc_get_last_track( cdrom_disc_t disc );
7.6
7.7 +/**
7.8 + * Get the track information for the last data track on the disc
7.9 + */
7.10 +cdrom_track_t cdrom_disc_get_last_data_track( cdrom_disc_t disc );
7.11 +
7.12 cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track );
7.13 cdrom_track_t cdrom_disc_next_track( cdrom_disc_t disc, cdrom_track_t track );
7.14
8.1 --- a/src/drivers/cdrom/drive.c Sun Jan 31 18:36:06 2010 +1000
8.2 +++ b/src/drivers/cdrom/drive.c Wed Feb 10 18:16:19 2010 +1000
8.3 @@ -17,6 +17,7 @@
8.4 */
8.5
8.6 #include <stdlib.h>
8.7 +#include <string.h>
8.8 #include <glib/gstrfuncs.h>
8.9 #include <glib/gmem.h>
8.10 #include "drivers/cdrom/drive.h"
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/drivers/cdrom/iso_impl.h Wed Feb 10 18:16:19 2010 +1000
9.3 @@ -0,0 +1,128 @@
9.4 +/**
9.5 + * $Id$
9.6 + *
9.7 + * ISO9660 filesystem support
9.8 + *
9.9 + * Copyright (c) 2009 Nathan Keynes.
9.10 + *
9.11 + * This program is free software; you can redistribute it and/or modify
9.12 + * it under the terms of the GNU General Public License as published by
9.13 + * the Free Software Foundation; either version 2 of the License, or
9.14 + * (at your option) any later version.
9.15 + *
9.16 + * This program is distributed in the hope that it will be useful,
9.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.19 + * GNU General Public License for more details.
9.20 + */
9.21 +
9.22 +#define ISO_SUPERBLOCK_OFFSET 16
9.23 +#define ISO_BOOT_DESCRIPTOR 0
9.24 +#define ISO_PRIMARY_DESCRIPTOR 1
9.25 +#define ISO_SECONDARY_DESCRIPTOR 2
9.26 +#define ISO_PARTITION_DESCRIPTOR 3
9.27 +#define ISO_TERMINAL_DESCRIPTOR 0xFF
9.28 +
9.29 +typedef struct iso_timestamp_full { /* 17 bytes */
9.30 + char year[4];
9.31 + char month[2];
9.32 + char day[2];
9.33 + char hour[2];
9.34 + char minute[2];
9.35 + char second[2];
9.36 + char hundredths[2];
9.37 + int8_t utc_offset; /* 15 min intervals from -48 to +52 7.1.2 */
9.38 +} *iso_timestamp_full_t;
9.39 +
9.40 +typedef struct iso_timestamp { /* 7 bytes */
9.41 + uint8_t year; /* Since 1900 */
9.42 + uint8_t month; /* 1 .. 12 */
9.43 + uint8_t day; /* 1 .. 31 */
9.44 + uint8_t hour; /* 0 .. 23 */
9.45 + uint8_t minute; /* 0 .. 59 */
9.46 + uint8_t second; /* 0 .. 59 */
9.47 + uint8_t utc_offset; /* 15 min intervals from -48 to +52 7.1.2 */
9.48 +} *iso_timestamp_t;
9.49 +
9.50 +#define ISO_FILE_EXISTS 0x01
9.51 +#define ISO_FILE_DIR 0x02
9.52 +#define ISO_FILE_ASSOC 0x04 /* Associated file */
9.53 +#define ISO_FILE_RECORD 0x08 /* Structure specified by XA record */
9.54 +#define ISO_FILE_PROTECT 0x10 /* Permissions specified */
9.55 +#define ISO_FILE_MULTIEXT 0x80 /* Multiple extents */
9.56 +
9.57 +typedef struct iso_dirent { /* 34+ bytes 9.1 */
9.58 + uint8_t record_len;
9.59 + uint8_t xa_record_len;
9.60 + uint32_t file_lba_le, file_lba_be;
9.61 + uint32_t file_size_le, file_size_be;
9.62 + struct iso_timestamp timestamp;
9.63 + uint8_t flags;
9.64 + uint8_t unit_size;
9.65 + uint8_t gap_size;
9.66 + uint16_t volume_seq_le, volume_seq_be;
9.67 + uint8_t file_id_len;
9.68 + char file_id[1];
9.69 +} __attribute__((packed)) *iso_dirent_t;
9.70 +
9.71 +typedef struct iso_pathtabrec { /* 8+ bytes 9.4 */
9.72 + uint8_t record_len;
9.73 + uint8_t xa_record_len;
9.74 + uint32_t file_lba;
9.75 + uint16_t parent_dir_no;
9.76 + char file_id[];
9.77 +} *iso_pathtabrec_t;
9.78 +
9.79 +typedef struct iso_xattrrec {
9.80 + uint16_t uid_le, uid_be;
9.81 + uint16_t gid_le, gid_be;
9.82 + uint16_t permissions;
9.83 + struct iso_timestamp_full create_time;
9.84 + struct iso_timestamp_full modify_time;
9.85 + struct iso_timestamp_full expiry_time;
9.86 + struct iso_timestamp_full effective_time;
9.87 + uint8_t record_format;
9.88 + uint8_t record_attrs;
9.89 + uint16_t record_len_le, record_len_be;
9.90 + char system_id[32];
9.91 + char system_use[64];
9.92 + uint8_t record_version; /* Should be 1 */
9.93 + uint8_t escape_len;
9.94 + char reserved[64];
9.95 + uint16_t app_use_len_le, app_use_len_be;
9.96 + char app_use[];
9.97 +} *iso_xattrrec_t;
9.98 +
9.99 +/** Primary Volume Descriptor */
9.100 +typedef struct iso_pvd {
9.101 + uint8_t desc_type;
9.102 + char tag[5];
9.103 + uint8_t desc_version;
9.104 + char pad0;
9.105 + char system_id[32];
9.106 + char volume_id[32];
9.107 + char pad1[8];
9.108 + uint32_t volume_size_le, volume_size_be;
9.109 + char pad2[32];
9.110 + uint16_t volume_sets_le, volume_sets_be;
9.111 + uint16_t volume_seq_le, volume_seq_be;
9.112 + uint16_t block_size_le, block_size_be;
9.113 + uint32_t pathtab_size_le, pathtab_size_be;
9.114 + uint32_t pathtab_offset_le, pathtab2_offset_le;
9.115 + uint32_t pathtab_offset_be, pathtab2_offset_be;
9.116 + struct iso_dirent root_dirent;
9.117 + char volume_set_id[128];
9.118 + char publisher_id[128];
9.119 + char preparer_id[128];
9.120 + char app_id[128];
9.121 + char copyright_file_id[37];
9.122 + char abstract_file_id[37];
9.123 + char biblio_file_id[37];
9.124 + struct iso_timestamp_full create_time;
9.125 + struct iso_timestamp_full modify_time;
9.126 + struct iso_timestamp_full expiry_time;
9.127 + struct iso_timestamp_full effective_time;
9.128 + uint8_t fs_version; /* must be 1 */
9.129 + char pad3[1166];
9.130 +} *iso_pvd_t;
9.131 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/src/drivers/cdrom/isoread.c Wed Feb 10 18:16:19 2010 +1000
10.3 @@ -0,0 +1,392 @@
10.4 +/**
10.5 + * $Id$
10.6 + *
10.7 + * ISO9660 filesystem reading support
10.8 + *
10.9 + * Copyright (c) 2010 Nathan Keynes.
10.10 + *
10.11 + * This program is free software; you can redistribute it and/or modify
10.12 + * it under the terms of the GNU General Public License as published by
10.13 + * the Free Software Foundation; either version 2 of the License, or
10.14 + * (at your option) any later version.
10.15 + *
10.16 + * This program is distributed in the hope that it will be useful,
10.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.19 + * GNU General Public License for more details.
10.20 + */
10.21 +
10.22 +#include "drivers/cdrom/cdrom.h"
10.23 +#include "drivers/cdrom/isoread.h"
10.24 +#include "drivers/cdrom/iso_impl.h"
10.25 +
10.26 +#include <string.h>
10.27 +#include <errno.h>
10.28 +
10.29 +static char isofs_magic[5] = { 'C', 'D', '0', '0', '1' };
10.30 +
10.31 +#define ISO_DIR_TAG 0x52494449
10.32 +
10.33 +struct isofs_reader_dir {
10.34 + uint32_t tag;
10.35 + isofs_reader_dir_t parent;
10.36 + size_t num_entries;
10.37 + struct isofs_reader_dirent entries[];
10.38 +};
10.39 +
10.40 +struct isofs_reader {
10.41 + /**
10.42 + * Base sector source to read the filesystem from (must support Mode 1 reads)
10.43 + */
10.44 + sector_source_t source;
10.45 +
10.46 + /**
10.47 + * Offset of the source relative to the start of the (notional) disc -
10.48 + * this is subtracted from all source lba addresses.
10.49 + */
10.50 + cdrom_lba_t source_offset;
10.51 +
10.52 + /**
10.53 + * Start of the ISO9660 filesystem relative to the start of the disc.
10.54 + * (The actual superblock is at fs_start+16)
10.55 + */
10.56 + cdrom_lba_t fs_start;
10.57 +
10.58 + /**
10.59 + * If TRUE, read the little-endian side of the FS, otherwise the big-endian
10.60 + * side. (They should normally give the same result, but in case it matters...)
10.61 + */
10.62 + gboolean little_endian;
10.63 +
10.64 + /**
10.65 + * The volume sequence number, for multi-volume sets.
10.66 + */
10.67 + uint16_t volume_seq_no;
10.68 +
10.69 + char volume_label[33];
10.70 +
10.71 + /**
10.72 + * Filesystem root directory
10.73 + */
10.74 + isofs_reader_dir_t root_dir;
10.75 +};
10.76 +
10.77 +/**
10.78 + * Read a 16-bit dual-endian field using the defined endianness of the reader
10.79 + */
10.80 +#define ISO_GET_DE16( iso, field ) \
10.81 + ( ((iso)->little_endian) ? GINT16_FROM_LE(field) : GINT16_FROM_BE(*((&field)+1)) )
10.82 +
10.83 +/**
10.84 + * Read a 32-bit dual-endian field using the defined endianness of the reader
10.85 + */
10.86 +#define ISO_GET_DE32( iso, field ) \
10.87 + ( ((iso)->little_endian) ? GINT32_FROM_LE(field) : GINT32_FROM_BE(*((&field)+1)) )
10.88 +
10.89 +
10.90 +static void isofs_reader_convert_dirent( isofs_reader_t iso, isofs_reader_dirent_t dest, iso_dirent_t src,
10.91 + char **strp )
10.92 +{
10.93 + dest->start_lba = ISO_GET_DE32(iso, src->file_lba_le);
10.94 + dest->size = ISO_GET_DE32(iso, src->file_size_le);
10.95 + dest->is_dir = (src->flags & ISO_FILE_DIR) ? TRUE : FALSE;
10.96 + dest->interleave_gap = src->gap_size;
10.97 + dest->interleave_size = src->unit_size;
10.98 + dest->name = *strp;
10.99 + memcpy( *strp, src->file_id, src->file_id_len );
10.100 + (*strp)[src->file_id_len] = '\0';
10.101 + *strp += src->file_id_len + 1;
10.102 +}
10.103 +
10.104 +/**
10.105 + * Read a directory from the disc into memory.
10.106 + */
10.107 +isofs_reader_dir_t isofs_reader_read_dir( isofs_reader_t iso, cdrom_lba_t lba, size_t size )
10.108 +{
10.109 + cdrom_count_t count = (size+2047)/2048;
10.110 +
10.111 + char buf[count*2048];
10.112 +
10.113 + if( isofs_reader_read_sectors( iso, lba, count, buf ) != CDROM_ERROR_OK )
10.114 + return NULL;
10.115 +
10.116 + size_t len = 0;
10.117 + unsigned num_entries = 0, i=0, offset=0;
10.118 + /* Compute number of entries and total string length */
10.119 + while( offset < size ) {
10.120 + struct iso_dirent *p = (struct iso_dirent *)&buf[offset];
10.121 + offset += p->record_len;
10.122 + if( offset > size || p->record_len < sizeof(struct iso_dirent) )
10.123 + break; // Bad record length
10.124 + if( p->file_id_len + sizeof(struct iso_dirent)-1 > p->record_len )
10.125 + break; // Bad fileid length
10.126 + if( p->file_id_len == 1 && (p->file_id[0] == 0 || p->file_id[0] == 1 ) )
10.127 + continue; /* self and parent-dir references */
10.128 + num_entries++;
10.129 + len += p->file_id_len + 1;
10.130 + }
10.131 +
10.132 + size_t table_len = num_entries * sizeof(struct isofs_reader_dirent);
10.133 + isofs_reader_dir_t dir = g_malloc0( sizeof(struct isofs_reader_dir) + table_len + len );
10.134 + dir->tag = ISO_DIR_TAG;
10.135 + dir->num_entries = num_entries;
10.136 +
10.137 + char *strp = (char *)&dir->entries[num_entries];
10.138 + offset = 0;
10.139 + for( i=0; i < num_entries; i++ ) {
10.140 + struct iso_dirent *p;
10.141 + do {
10.142 + p = (struct iso_dirent *)&buf[offset];
10.143 + offset += p->record_len;
10.144 + /* Skip over self and parent-dir references */
10.145 + } while( p->file_id_len == 1 && (p->file_id[0] == 0 || p->file_id[0] == 1 ) );
10.146 +
10.147 + isofs_reader_convert_dirent( iso, &dir->entries[i], p, &strp );
10.148 +
10.149 + }
10.150 + return dir;
10.151 +}
10.152 +
10.153 +static gboolean isofs_reader_dirent_match_exact( const char *file, const char *find )
10.154 +{
10.155 + return strcasecmp( file, find ) == 0;
10.156 +}
10.157 +
10.158 +static gboolean isofs_reader_dirent_match_unversioned( const char *file, const char *find )
10.159 +{
10.160 + char *semi = strchr(file, ';');
10.161 + if( semi == NULL ) {
10.162 + /* Unversioned ISO file */
10.163 + return strcasecmp( file, find ) == 0;
10.164 + } else {
10.165 + int len = semi - file;
10.166 + return strncasecmp( file, find, len ) == 0 && strlen(find) == len;
10.167 + }
10.168 +}
10.169 +
10.170 +/**
10.171 + * Search a directory for a given filename. If found, return the corresponding
10.172 + * dirent structure, otherwise NULL. Comparison is case-insensitive, and returns
10.173 + * the most recent (highest numbered) version of a file in case of multiple
10.174 + * versions unless the requested component is also explicitly versioned.
10.175 + *
10.176 + * For now just do a linear search, although we could do a binary search given
10.177 + * that the directory should be sorted.
10.178 + */
10.179 +static isofs_reader_dirent_t isofs_reader_get_file_component( isofs_reader_dir_t dir, const char *component )
10.180 +{
10.181 +
10.182 + if( strchr( component, ';' ) != NULL ) {
10.183 + for( unsigned i=0; i<dir->num_entries; i++ ) {
10.184 + if( isofs_reader_dirent_match_exact(dir->entries[i].name,component) ) {
10.185 + return &dir->entries[i];
10.186 + }
10.187 + }
10.188 + } else {
10.189 + for( unsigned i=0; i<dir->num_entries; i++ ) {
10.190 + if( isofs_reader_dirent_match_unversioned(dir->entries[i].name,component) ) {
10.191 + return &dir->entries[i];
10.192 + }
10.193 + }
10.194 + }
10.195 + return NULL;
10.196 +}
10.197 +
10.198 +isofs_reader_dirent_t isofs_reader_get_file( isofs_reader_t iso, const char *pathname )
10.199 +{
10.200 + int pathlen = strlen(pathname);
10.201 + char tmp[pathlen+1];
10.202 + char *p = tmp;
10.203 + isofs_reader_dir_t dir = iso->root_dir;
10.204 +
10.205 + memcpy( tmp, pathname, pathlen+1 );
10.206 + char *q = strchr(p, '/');
10.207 + while( q != NULL ) {
10.208 + *q = '\0';
10.209 + isofs_reader_dirent_t ent = isofs_reader_get_file_component( dir, p );
10.210 + if( ent == NULL || !ent->is_dir ) {
10.211 + return NULL;
10.212 + }
10.213 + if( ent->subdir == NULL ) {
10.214 + ent->subdir = dir = isofs_reader_read_dir( iso, ent->start_lba, ent->size );
10.215 + if( dir == NULL ) {
10.216 + return NULL;
10.217 + }
10.218 + }
10.219 +
10.220 + p = q+1;
10.221 + q = strchr(p, '/');
10.222 +
10.223 + }
10.224 + return isofs_reader_get_file_component( dir, p );
10.225 +}
10.226 +
10.227 +cdrom_error_t isofs_reader_read_file( isofs_reader_t iso, isofs_reader_dirent_t file,
10.228 + size_t offset, size_t byte_count, unsigned char *buf )
10.229 +{
10.230 + char tmp[2048];
10.231 +
10.232 + if( offset + byte_count > file->size )
10.233 + return CDROM_ERROR_BADREAD;
10.234 +
10.235 + if( file->interleave_gap == 0 ) {
10.236 + cdrom_lba_t lba = file->start_lba + (offset>>11);
10.237 + lba += ((file->xa_size+2047)>>11); /* Skip XA record if present */
10.238 +
10.239 + if( (offset & 2047) != 0 ) {
10.240 + /* Read an unaligned start block */
10.241 + cdrom_error_t status = isofs_reader_read_sectors( iso, lba, 1, tmp );
10.242 + if( status != CDROM_ERROR_OK )
10.243 + return status;
10.244 + unsigned align = offset & 2047;
10.245 + size_t length = 2048 - align;
10.246 + if( length >= byte_count ) {
10.247 + memcpy( buf, &tmp[align], byte_count );
10.248 + return CDROM_ERROR_OK;
10.249 + } else {
10.250 + memcpy( buf, &tmp[align], length );
10.251 + byte_count -= length;
10.252 + buf += length;
10.253 + lba++;
10.254 + }
10.255 + }
10.256 + /* Read the bulk of the data */
10.257 + cdrom_count_t sector_count = byte_count >> 11;
10.258 + if( sector_count > 0 ) {
10.259 + cdrom_error_t status = isofs_reader_read_sectors( iso, lba, sector_count, buf );
10.260 + if( status != CDROM_ERROR_OK )
10.261 + return status;
10.262 + buf += (sector_count << 11);
10.263 + lba += sector_count;
10.264 + }
10.265 + /* Finally read a partial final block */
10.266 + if( (byte_count & 2047) != 0 ) {
10.267 + cdrom_error_t status = isofs_reader_read_sectors( iso, lba, 1, tmp );
10.268 + if( status != CDROM_ERROR_OK )
10.269 + return status;
10.270 + memcpy( buf, tmp, byte_count & 2047 );
10.271 + }
10.272 + return CDROM_ERROR_OK;
10.273 + } else {
10.274 + // ERROR("Interleaved files not supported");
10.275 + return CDROM_ERROR_BADREAD;
10.276 + }
10.277 +}
10.278 +
10.279 +void isofs_reader_destroy_dir( isofs_reader_dir_t dir )
10.280 +{
10.281 + dir->tag = 0;
10.282 + for( unsigned i=0; i<dir->num_entries; i++ ) {
10.283 + if( dir->entries[i].subdir != NULL ) {
10.284 + isofs_reader_dir_t subdir = dir->entries[i].subdir;
10.285 + dir->entries[i].subdir = NULL;
10.286 + isofs_reader_destroy_dir(dir);
10.287 + }
10.288 + }
10.289 + g_free(dir);
10.290 +}
10.291 +
10.292 +cdrom_error_t isofs_reader_read_sectors( isofs_reader_t iso, cdrom_lba_t lba, cdrom_count_t count,
10.293 + unsigned char *buf )
10.294 +{
10.295 + if( lba < iso->source_offset )
10.296 + return CDROM_ERROR_BADREAD;
10.297 + return sector_source_read_sectors( iso->source, lba - iso->source_offset, count,
10.298 + CDROM_READ_MODE2_FORM1|CDROM_READ_DATA, buf, NULL );
10.299 +}
10.300 +
10.301 +
10.302 +isofs_reader_t isofs_reader_new( sector_source_t source, cdrom_lba_t offset, cdrom_lba_t start, ERROR *err )
10.303 +{
10.304 + char buf[2048];
10.305 + iso_pvd_t pvd = (iso_pvd_t)&buf;
10.306 + unsigned i = 0;
10.307 +
10.308 + isofs_reader_t iso = g_malloc0( sizeof(struct isofs_reader) );
10.309 + if( iso == NULL ) {
10.310 + SET_ERROR( err, ENOMEM, "Unable to allocate memory" );
10.311 + return NULL;
10.312 + }
10.313 + iso->source = source;
10.314 + iso->source_offset = offset;
10.315 + iso->fs_start = start;
10.316 + iso->little_endian = TRUE;
10.317 +
10.318 + do {
10.319 + /* Find the primary volume descriptor */
10.320 + cdrom_error_t status = isofs_reader_read_sectors( iso, iso->fs_start + ISO_SUPERBLOCK_OFFSET + i, 1, buf );
10.321 + if( status != CDROM_ERROR_OK ) {
10.322 + SET_ERROR( err, EBADF, "Unable to read superblock from ISO9660 filesystem" );
10.323 + g_free(iso);
10.324 + return NULL;
10.325 + }
10.326 + if( memcmp(pvd->tag, isofs_magic, 5) != 0 || /* Not an ISO volume descriptor */
10.327 + pvd->desc_type == ISO_TERMINAL_DESCRIPTOR ) { /* Reached the end of the descriptor list */
10.328 + SET_ERROR( err, EINVAL, "ISO9660 filesystem not found" );
10.329 + g_free(iso);
10.330 + return NULL;
10.331 + }
10.332 + i++;
10.333 + } while( pvd->desc_type != ISO_PRIMARY_DESCRIPTOR );
10.334 +
10.335 + if( pvd->desc_version != 1 ) {
10.336 + SET_ERROR( err, EINVAL, "Incompatible ISO9660 filesystem" );
10.337 + g_free(iso);
10.338 + return NULL;
10.339 + }
10.340 +
10.341 + iso->volume_seq_no = ISO_GET_DE16(iso, pvd->volume_seq_le);
10.342 + memcpy( iso->volume_label, pvd->volume_id, 32 );
10.343 + for( i=32; i>0 && iso->volume_label[i-1] == ' '; i-- );
10.344 + iso->volume_label[i] = '\0';
10.345 +
10.346 + iso->root_dir = isofs_reader_read_dir( iso,
10.347 + ISO_GET_DE32(iso, pvd->root_dirent.file_lba_le),
10.348 + ISO_GET_DE32(iso, pvd->root_dirent.file_size_le) );
10.349 + if( iso->root_dir == NULL ) {
10.350 + SET_ERROR( err, EINVAL, "Unable to read root directory from ISO9660 filesystem" );
10.351 + g_free(iso);
10.352 + return NULL;
10.353 + }
10.354 +
10.355 + sector_source_ref( source );
10.356 + return iso;
10.357 +}
10.358 +
10.359 +isofs_reader_t isofs_reader_new_from_disc( cdrom_disc_t disc, cdrom_lba_t lba, ERROR *err )
10.360 +{
10.361 + return isofs_reader_new( &disc->source, 0, lba, err );
10.362 +}
10.363 +
10.364 +isofs_reader_t isofs_reader_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err )
10.365 +{
10.366 + return isofs_reader_new( &disc->source, 0, track->lba, err );
10.367 +}
10.368 +
10.369 +isofs_reader_t isofs_reader_new_from_source( sector_source_t source, ERROR *err )
10.370 +{
10.371 + return isofs_reader_new( source, 0, 0, err );
10.372 +}
10.373 +
10.374 +void isofs_reader_destroy( isofs_reader_t iso )
10.375 +{
10.376 + isofs_reader_destroy_dir( iso->root_dir );
10.377 + iso->root_dir = NULL;
10.378 + sector_source_unref( iso->source );
10.379 + iso->source = NULL;
10.380 + g_free( iso );
10.381 +}
10.382 +
10.383 +isofs_reader_dir_t isofs_reader_get_root_dir( isofs_reader_t iso )
10.384 +{
10.385 + return iso->root_dir;
10.386 +}
10.387 +
10.388 +void isofs_reader_print_dir( FILE *f, isofs_reader_dir_t dir )
10.389 +{
10.390 + fprintf( f, "Total %d files\n", dir->num_entries );
10.391 + for( unsigned i=0; i<dir->num_entries; i++ ) {
10.392 + fprintf( f, "%7d %s\n", dir->entries[i].size, dir->entries[i].name );
10.393 + }
10.394 +
10.395 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/src/drivers/cdrom/isoread.h Wed Feb 10 18:16:19 2010 +1000
11.3 @@ -0,0 +1,95 @@
11.4 +/**
11.5 + * $Id$
11.6 + *
11.7 + * ISO9660 filesystem reading support
11.8 + *
11.9 + * Copyright (c) 2010 Nathan Keynes.
11.10 + *
11.11 + * This program is free software; you can redistribute it and/or modify
11.12 + * it under the terms of the GNU General Public License as published by
11.13 + * the Free Software Foundation; either version 2 of the License, or
11.14 + * (at your option) any later version.
11.15 + *
11.16 + * This program is distributed in the hope that it will be useful,
11.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.19 + * GNU General Public License for more details.
11.20 + */
11.21 +
11.22 +
11.23 +#ifndef cdrom_isoread_H
11.24 +#define cdrom_isoread_H 1
11.25 +
11.26 +#include "drivers/cdrom/defs.h"
11.27 +
11.28 +#ifdef __cplusplus
11.29 +extern "C" {
11.30 +#endif
11.31 +
11.32 +typedef struct isofs_reader_dir *isofs_reader_dir_t;
11.33 +
11.34 +typedef struct isofs_reader_dirent {
11.35 + const char *name;
11.36 + size_t size;
11.37 + gboolean is_dir;
11.38 +
11.39 + cdrom_lba_t start_lba;
11.40 + size_t xa_size;
11.41 + unsigned interleave_gap;
11.42 + unsigned interleave_size;
11.43 + isofs_reader_dir_t subdir;
11.44 +} *isofs_reader_dirent_t;
11.45 +
11.46 +/**
11.47 + * ISO9600 filesystem reader.
11.48 + */
11.49 +typedef struct isofs_reader *isofs_reader_t;
11.50 +
11.51 +/**
11.52 + * Construct an isofs reader from an existing sector source. On error, returns
11.53 + * NULL.
11.54 + */
11.55 +isofs_reader_t isofs_reader_new_from_source( sector_source_t track, ERROR *err );
11.56 +
11.57 +/**
11.58 + * Construct an isofs from a cdrom disc and sector position.
11.59 + * @return a new isofs_reader, or NULL on an error (and sets err).
11.60 + */
11.61 +isofs_reader_t isofs_reader_new_from_disc( cdrom_disc_t disc, cdrom_lba_t start_sector, ERROR *err );
11.62 +
11.63 +isofs_reader_t isofs_reader_new_from_track( cdrom_disc_t disc, cdrom_track_t track, ERROR *err );
11.64 +
11.65 +/**
11.66 + * Destroy an isofs reader.
11.67 + */
11.68 +void isofs_reader_destroy( isofs_reader_t reader );
11.69 +
11.70 +/**
11.71 + * Read 0 or more 2048-byte sectors from the filesystem.
11.72 + */
11.73 +cdrom_error_t isofs_reader_read_sectors( isofs_reader_t iso, cdrom_lba_t sector, cdrom_count_t count,
11.74 + unsigned char *buf );
11.75 +
11.76 +
11.77 +/**
11.78 + * Search the filesystem for the specific fully-qualified file.
11.79 + * @return FALSE if the file could not be found, otherwise TRUE and the iterator
11.80 + * is updated to point to the requested file.
11.81 + */
11.82 +isofs_reader_dirent_t isofs_reader_get_file( isofs_reader_t iso, const char *filename );
11.83 +
11.84 +cdrom_error_t isofs_reader_read_file( isofs_reader_t iso, isofs_reader_dirent_t file,
11.85 + size_t offset, size_t byte_count, unsigned char *buf );
11.86 +
11.87 +/**
11.88 + * Print an isofs directory to the given stream (mostly for debugging purposes)
11.89 + */
11.90 +void isofs_reader_print_dir( FILE *f, isofs_reader_dir_t dir );
11.91 +
11.92 +isofs_reader_dir_t isofs_reader_get_root_dir( isofs_reader_t iso );
11.93 +
11.94 +#ifdef __cplusplus
11.95 +}
11.96 +#endif
11.97 +
11.98 +#endif /* !cdrom_isoread_H */
12.1 --- a/src/drivers/cdrom/sector.c Sun Jan 31 18:36:06 2010 +1000
12.2 +++ b/src/drivers/cdrom/sector.c Wed Feb 10 18:16:19 2010 +1000
12.3 @@ -32,7 +32,7 @@
12.4 #define CHECK_READ(dev,lba,count) \
12.5 if( !IS_SECTOR_SOURCE(dev) ) { \
12.6 return CDROM_ERROR_NODISC; \
12.7 - } else if( (lba) >= (dev)->size || (lba+block_count) > (dev)->size ) { \
12.8 + } else if( (dev)->size != 0 && ((lba) >= (dev)->size || (lba+block_count) > (dev)->size) ) { \
12.9 return CDROM_ERROR_BADREAD; \
12.10 }
12.11
12.12 @@ -340,11 +340,13 @@
12.13 if( err != CDROM_ERROR_OK )
12.14 return err;
12.15 if( read_sector_fields == 0 ) { /* Read nothing */
12.16 - *length = 0;
12.17 + if( length != NULL )
12.18 + *length = 0;
12.19 return CDROM_ERROR_OK;
12.20 } else if( read_sector_fields == CDROM_READ_DATA ) {
12.21 /* Data-only */
12.22 - *length = block_count * CDROM_SECTOR_SIZE(device->mode);
12.23 + if( length != NULL )
12.24 + *length = block_count * CDROM_SECTOR_SIZE(device->mode);
12.25 return device->read_blocks( device, lba, block_count, buf );
12.26 } else if( read_sector_fields == CDROM_READ_RAW ) {
12.27 for( i=0; i<block_count; i++ ) {
12.28 @@ -366,7 +368,8 @@
12.29 }
12.30 }
12.31 }
12.32 - *length = len;
12.33 + if( length != NULL )
12.34 + *length = len;
12.35 return CDROM_ERROR_OK;
12.36
12.37 }
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/src/test/testisoread.c Wed Feb 10 18:16:19 2010 +1000
13.3 @@ -0,0 +1,63 @@
13.4 +/**
13.5 + * $Id$
13.6 + *
13.7 + * Unit tests for the ISO9660 filesystem reader
13.8 + *
13.9 + * Copyright (c) 2010 Nathan Keynes.
13.10 + *
13.11 + * This program is free software; you can redistribute it and/or modify
13.12 + * it under the terms of the GNU General Public License as published by
13.13 + * the Free Software Foundation; either version 2 of the License, or
13.14 + * (at your option) any later version.
13.15 + *
13.16 + * This program is distributed in the hope that it will be useful,
13.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.19 + * GNU General Public License for more details.
13.20 + */
13.21 +
13.22 +#include "drivers/cdrom/cdrom.h"
13.23 +#include "drivers/cdrom/isoread.h"
13.24 +#include <stdio.h>
13.25 +
13.26 +int main( int argc, char *argv[] )
13.27 +{
13.28 + if( argc < 2 ) {
13.29 + fprintf( stderr, "Usage: testisoread <disc image>\n" );
13.30 + return 1;
13.31 + }
13.32 +
13.33 + ERROR err;
13.34 + cdrom_disc_t disc = cdrom_disc_open(argv[1], &err);
13.35 +
13.36 + if( disc == NULL ) {
13.37 + fprintf( stderr, "Unable to open disc image '%s': %s\n", argv[1], err.msg );
13.38 + return 2;
13.39 + }
13.40 + cdrom_track_t track = cdrom_disc_get_last_data_track(disc);
13.41 + if( track == NULL ) {
13.42 + fprintf( stderr, "Disc has no data tracks\n" );
13.43 + return 3;
13.44 + }
13.45 +
13.46 + isofs_reader_t iso = isofs_reader_new_from_track( disc, track, &err );
13.47 + if( iso == NULL ) {
13.48 + fprintf( stderr, "Unable to open ISO filesystem: %s\n", err.msg );
13.49 + return 4;
13.50 + }
13.51 + isofs_reader_print_dir( stdout, isofs_reader_get_root_dir(iso) );
13.52 +
13.53 + isofs_reader_dirent_t boot = isofs_reader_get_file( iso, "1st_read.bin" );
13.54 + if( boot == NULL ) {
13.55 + fprintf( stderr, "Unable to find 1st_read.bin" );
13.56 + return 5;
13.57 + }
13.58 +
13.59 + printf( "Bootstrap: %s (%d)\n", boot->name, boot->size );
13.60 + char tmp[boot->size];
13.61 + if( isofs_reader_read_file( iso, boot, 0, boot->size, tmp ) != CDROM_ERROR_OK ) {
13.62 + fprintf( stderr, "Unable to read 1st_read.bin" );
13.63 + return 6;
13.64 + }
13.65 + return 0;
13.66 +}
.