diff --git a/3rdparty/3rdparty.vsprops b/3rdparty/3rdparty.vsprops new file mode 100644 index 0000000000..b5d789323f --- /dev/null +++ b/3rdparty/3rdparty.vsprops @@ -0,0 +1,25 @@ + + + + + diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/3dnow_win.cpp b/3rdparty/SoundTouch/3dnow_win.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/3dnow_win.cpp rename to 3rdparty/SoundTouch/3dnow_win.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/AAFilter.cpp b/3rdparty/SoundTouch/AAFilter.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/AAFilter.cpp rename to 3rdparty/SoundTouch/AAFilter.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/AAFilter.h b/3rdparty/SoundTouch/AAFilter.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/AAFilter.h rename to 3rdparty/SoundTouch/AAFilter.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/BPMDetect.h b/3rdparty/SoundTouch/BPMDetect.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/BPMDetect.h rename to 3rdparty/SoundTouch/BPMDetect.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSampleBuffer.cpp b/3rdparty/SoundTouch/FIFOSampleBuffer.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSampleBuffer.cpp rename to 3rdparty/SoundTouch/FIFOSampleBuffer.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSampleBuffer.h b/3rdparty/SoundTouch/FIFOSampleBuffer.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSampleBuffer.h rename to 3rdparty/SoundTouch/FIFOSampleBuffer.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSamplePipe.h b/3rdparty/SoundTouch/FIFOSamplePipe.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/FIFOSamplePipe.h rename to 3rdparty/SoundTouch/FIFOSamplePipe.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/FIRFilter.cpp b/3rdparty/SoundTouch/FIRFilter.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/FIRFilter.cpp rename to 3rdparty/SoundTouch/FIRFilter.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/FIRFilter.h b/3rdparty/SoundTouch/FIRFilter.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/FIRFilter.h rename to 3rdparty/SoundTouch/FIRFilter.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/Makefile.am b/3rdparty/SoundTouch/Makefile.am similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/Makefile.am rename to 3rdparty/SoundTouch/Makefile.am diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/RateTransposer.cpp b/3rdparty/SoundTouch/RateTransposer.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/RateTransposer.cpp rename to 3rdparty/SoundTouch/RateTransposer.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/RateTransposer.h b/3rdparty/SoundTouch/RateTransposer.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/RateTransposer.h rename to 3rdparty/SoundTouch/RateTransposer.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/STTypes.h b/3rdparty/SoundTouch/STTypes.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/STTypes.h rename to 3rdparty/SoundTouch/STTypes.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/SoundTouch.cpp b/3rdparty/SoundTouch/SoundTouch.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/SoundTouch.cpp rename to 3rdparty/SoundTouch/SoundTouch.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/SoundTouch.h b/3rdparty/SoundTouch/SoundTouch.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/SoundTouch.h rename to 3rdparty/SoundTouch/SoundTouch.h diff --git a/3rdparty/SoundTouch/SoundTouch.vcproj b/3rdparty/SoundTouch/SoundTouch.vcproj new file mode 100644 index 0000000000..9a1c83f998 --- /dev/null +++ b/3rdparty/SoundTouch/SoundTouch.vcproj @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/TDStretch.cpp b/3rdparty/SoundTouch/TDStretch.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/TDStretch.cpp rename to 3rdparty/SoundTouch/TDStretch.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/TDStretch.h b/3rdparty/SoundTouch/TDStretch.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/TDStretch.h rename to 3rdparty/SoundTouch/TDStretch.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/WavFile.cpp b/3rdparty/SoundTouch/WavFile.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/WavFile.cpp rename to 3rdparty/SoundTouch/WavFile.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/WavFile.h b/3rdparty/SoundTouch/WavFile.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/WavFile.h rename to 3rdparty/SoundTouch/WavFile.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect.h b/3rdparty/SoundTouch/cpu_detect.h similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect.h rename to 3rdparty/SoundTouch/cpu_detect.h diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp b/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp rename to 3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect_x86_win.cpp b/3rdparty/SoundTouch/cpu_detect_x86_win.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/cpu_detect_x86_win.cpp rename to 3rdparty/SoundTouch/cpu_detect_x86_win.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/mmx_optimized.cpp b/3rdparty/SoundTouch/mmx_optimized.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/mmx_optimized.cpp rename to 3rdparty/SoundTouch/mmx_optimized.cpp diff --git a/plugins/spu2-x/src/3rdparty/SoundTouch/sse_optimized.cpp b/3rdparty/SoundTouch/sse_optimized.cpp similarity index 100% rename from plugins/spu2-x/src/3rdparty/SoundTouch/sse_optimized.cpp rename to 3rdparty/SoundTouch/sse_optimized.cpp diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/LICENSE b/3rdparty/bzip2/LICENSE similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/LICENSE rename to 3rdparty/bzip2/LICENSE diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/README b/3rdparty/bzip2/README similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/README rename to 3rdparty/bzip2/README diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/blocksort.c b/3rdparty/bzip2/blocksort.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/blocksort.c rename to 3rdparty/bzip2/blocksort.c diff --git a/3rdparty/bzip2/bzip2.vcproj b/3rdparty/bzip2/bzip2.vcproj new file mode 100644 index 0000000000..74f0a8036d --- /dev/null +++ b/3rdparty/bzip2/bzip2.vcproj @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/bzlib.c b/3rdparty/bzip2/bzlib.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/bzlib.c rename to 3rdparty/bzip2/bzlib.c diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/bzlib.h b/3rdparty/bzip2/bzlib.h similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/bzlib.h rename to 3rdparty/bzip2/bzlib.h diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/bzlib_private.h b/3rdparty/bzip2/bzlib_private.h similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/bzlib_private.h rename to 3rdparty/bzip2/bzlib_private.h diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/compress.c b/3rdparty/bzip2/compress.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/compress.c rename to 3rdparty/bzip2/compress.c diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/crctable.c b/3rdparty/bzip2/crctable.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/crctable.c rename to 3rdparty/bzip2/crctable.c diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/decompress.c b/3rdparty/bzip2/decompress.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/decompress.c rename to 3rdparty/bzip2/decompress.c diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/huffman.c b/3rdparty/bzip2/huffman.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/huffman.c rename to 3rdparty/bzip2/huffman.c diff --git a/plugins/CDVDiso/src/3rdparty/bzip2/randtable.c b/3rdparty/bzip2/randtable.c similarity index 100% rename from plugins/CDVDiso/src/3rdparty/bzip2/randtable.c rename to 3rdparty/bzip2/randtable.c diff --git a/3rdparty/svn_readme.txt b/3rdparty/svn_readme.txt new file mode 100644 index 0000000000..1a3a7c173a --- /dev/null +++ b/3rdparty/svn_readme.txt @@ -0,0 +1,5 @@ +/3rdparty + +This folder contains libraries written and (un?)maintained by people or parties +outside the Pcsx2 DevTeam. Libraries or code snippets written by the Pcsx2 team +are housed in /common instead. \ No newline at end of file diff --git a/pcsx2/windows/pthreads/ANNOUNCE b/3rdparty/w32pthreads/ANNOUNCE similarity index 100% rename from pcsx2/windows/pthreads/ANNOUNCE rename to 3rdparty/w32pthreads/ANNOUNCE diff --git a/pcsx2/windows/pthreads/BUGS b/3rdparty/w32pthreads/BUGS similarity index 100% rename from pcsx2/windows/pthreads/BUGS rename to 3rdparty/w32pthreads/BUGS diff --git a/pcsx2/windows/pthreads/CONTRIBUTORS b/3rdparty/w32pthreads/CONTRIBUTORS similarity index 100% rename from pcsx2/windows/pthreads/CONTRIBUTORS rename to 3rdparty/w32pthreads/CONTRIBUTORS diff --git a/pcsx2/windows/pthreads/COPYING b/3rdparty/w32pthreads/COPYING similarity index 100% rename from pcsx2/windows/pthreads/COPYING rename to 3rdparty/w32pthreads/COPYING diff --git a/pcsx2/windows/pthreads/FAQ b/3rdparty/w32pthreads/FAQ similarity index 100% rename from pcsx2/windows/pthreads/FAQ rename to 3rdparty/w32pthreads/FAQ diff --git a/pcsx2/windows/pthreads/MAINTAINERS b/3rdparty/w32pthreads/MAINTAINERS similarity index 100% rename from pcsx2/windows/pthreads/MAINTAINERS rename to 3rdparty/w32pthreads/MAINTAINERS diff --git a/pcsx2/windows/pthreads/NEWS b/3rdparty/w32pthreads/NEWS similarity index 100% rename from pcsx2/windows/pthreads/NEWS rename to 3rdparty/w32pthreads/NEWS diff --git a/3rdparty/w32pthreads/PCSX2.txt b/3rdparty/w32pthreads/PCSX2.txt new file mode 100644 index 0000000000..51f1afaa18 --- /dev/null +++ b/3rdparty/w32pthreads/PCSX2.txt @@ -0,0 +1,15 @@ +----------------------------------- +-- Air's Notes on Using PThreads -- +----------------------------------- + +We use pthreads as a static link because it allows for inlined calls of several methods, +most notably the InterlockedExchange implementations. These would be DLL invocations +otherwise, and would be roughly twice to three times the total overhead. + +I created a subfolder for pthreads' publicall exposed header files, since "config.h" was +rather brutal include file namespace pollution. >_< + +Important: pthread_cond is an inherently flawed concept, and is quite incredibly slow +on top of it. It's primarily meant for inter-process thread regulation, of which we +do none. Therefore it has been excluded from the library builds. Don't use it! + diff --git a/pcsx2/windows/pthreads/README b/3rdparty/w32pthreads/README similarity index 100% rename from pcsx2/windows/pthreads/README rename to 3rdparty/w32pthreads/README diff --git a/pcsx2/windows/pthreads/README.NONPORTABLE b/3rdparty/w32pthreads/README.NONPORTABLE similarity index 100% rename from pcsx2/windows/pthreads/README.NONPORTABLE rename to 3rdparty/w32pthreads/README.NONPORTABLE diff --git a/pcsx2/windows/pthreads/TODO b/3rdparty/w32pthreads/TODO similarity index 100% rename from pcsx2/windows/pthreads/TODO rename to 3rdparty/w32pthreads/TODO diff --git a/pcsx2/windows/pthreads/attr.c b/3rdparty/w32pthreads/attr.c similarity index 100% rename from pcsx2/windows/pthreads/attr.c rename to 3rdparty/w32pthreads/attr.c diff --git a/pcsx2/windows/pthreads/barrier.c b/3rdparty/w32pthreads/barrier.c similarity index 100% rename from pcsx2/windows/pthreads/barrier.c rename to 3rdparty/w32pthreads/barrier.c diff --git a/pcsx2/windows/pthreads/cancel.c b/3rdparty/w32pthreads/cancel.c similarity index 100% rename from pcsx2/windows/pthreads/cancel.c rename to 3rdparty/w32pthreads/cancel.c diff --git a/pcsx2/windows/pthreads/cleanup.c b/3rdparty/w32pthreads/cleanup.c similarity index 100% rename from pcsx2/windows/pthreads/cleanup.c rename to 3rdparty/w32pthreads/cleanup.c diff --git a/pcsx2/windows/pthreads/condvar.c b/3rdparty/w32pthreads/condvar.c similarity index 100% rename from pcsx2/windows/pthreads/condvar.c rename to 3rdparty/w32pthreads/condvar.c diff --git a/pcsx2/windows/pthreads/config.h b/3rdparty/w32pthreads/config.h similarity index 100% rename from pcsx2/windows/pthreads/config.h rename to 3rdparty/w32pthreads/config.h diff --git a/pcsx2/windows/pthreads/create.c b/3rdparty/w32pthreads/create.c similarity index 100% rename from pcsx2/windows/pthreads/create.c rename to 3rdparty/w32pthreads/create.c diff --git a/pcsx2/windows/pthreads/dll.c b/3rdparty/w32pthreads/dll.c similarity index 100% rename from pcsx2/windows/pthreads/dll.c rename to 3rdparty/w32pthreads/dll.c diff --git a/pcsx2/windows/pthreads/errno.c b/3rdparty/w32pthreads/errno.c similarity index 100% rename from pcsx2/windows/pthreads/errno.c rename to 3rdparty/w32pthreads/errno.c diff --git a/pcsx2/windows/pthreads/exit.c b/3rdparty/w32pthreads/exit.c similarity index 100% rename from pcsx2/windows/pthreads/exit.c rename to 3rdparty/w32pthreads/exit.c diff --git a/pcsx2/windows/pthreads/fork.c b/3rdparty/w32pthreads/fork.c similarity index 100% rename from pcsx2/windows/pthreads/fork.c rename to 3rdparty/w32pthreads/fork.c diff --git a/pcsx2/windows/pthreads/global.c b/3rdparty/w32pthreads/global.c similarity index 100% rename from pcsx2/windows/pthreads/global.c rename to 3rdparty/w32pthreads/global.c diff --git a/pcsx2/windows/pthreads/implement.h b/3rdparty/w32pthreads/include/implement.h similarity index 100% rename from pcsx2/windows/pthreads/implement.h rename to 3rdparty/w32pthreads/include/implement.h diff --git a/pcsx2/windows/pthreads/need_errno.h b/3rdparty/w32pthreads/include/need_errno.h similarity index 100% rename from pcsx2/windows/pthreads/need_errno.h rename to 3rdparty/w32pthreads/include/need_errno.h diff --git a/pcsx2/windows/pthreads/pthread.h b/3rdparty/w32pthreads/include/pthread.h similarity index 100% rename from pcsx2/windows/pthreads/pthread.h rename to 3rdparty/w32pthreads/include/pthread.h diff --git a/pcsx2/windows/pthreads/sched.h b/3rdparty/w32pthreads/include/sched.h similarity index 100% rename from pcsx2/windows/pthreads/sched.h rename to 3rdparty/w32pthreads/include/sched.h diff --git a/pcsx2/windows/pthreads/semaphore.h b/3rdparty/w32pthreads/include/semaphore.h similarity index 100% rename from pcsx2/windows/pthreads/semaphore.h rename to 3rdparty/w32pthreads/include/semaphore.h diff --git a/pcsx2/windows/pthreads/misc.c b/3rdparty/w32pthreads/misc.c similarity index 100% rename from pcsx2/windows/pthreads/misc.c rename to 3rdparty/w32pthreads/misc.c diff --git a/pcsx2/windows/pthreads/mutex.c b/3rdparty/w32pthreads/mutex.c similarity index 100% rename from pcsx2/windows/pthreads/mutex.c rename to 3rdparty/w32pthreads/mutex.c diff --git a/pcsx2/windows/pthreads/nonportable.c b/3rdparty/w32pthreads/nonportable.c similarity index 95% rename from pcsx2/windows/pthreads/nonportable.c rename to 3rdparty/w32pthreads/nonportable.c index 6c2a990aa7..33a9eeb90e 100644 --- a/pcsx2/windows/pthreads/nonportable.c +++ b/3rdparty/w32pthreads/nonportable.c @@ -43,4 +43,6 @@ #include "pthread_delay_np.c" #include "pthread_num_processors_np.c" #include "pthread_win32_attach_detach_np.c" -#include "pthread_timechange_handler_np.c" + +// Removed due to pthread_cond reference - air +//#include "pthread_timechange_handler_np.c" diff --git a/pcsx2/windows/pthreads/private.c b/3rdparty/w32pthreads/private.c similarity index 100% rename from pcsx2/windows/pthreads/private.c rename to 3rdparty/w32pthreads/private.c diff --git a/pcsx2/windows/pthreads/pthread_attr_destroy.c b/3rdparty/w32pthreads/pthread_attr_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_destroy.c rename to 3rdparty/w32pthreads/pthread_attr_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getdetachstate.c b/3rdparty/w32pthreads/pthread_attr_getdetachstate.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getdetachstate.c rename to 3rdparty/w32pthreads/pthread_attr_getdetachstate.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getinheritsched.c b/3rdparty/w32pthreads/pthread_attr_getinheritsched.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getinheritsched.c rename to 3rdparty/w32pthreads/pthread_attr_getinheritsched.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getschedparam.c b/3rdparty/w32pthreads/pthread_attr_getschedparam.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getschedparam.c rename to 3rdparty/w32pthreads/pthread_attr_getschedparam.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getschedpolicy.c b/3rdparty/w32pthreads/pthread_attr_getschedpolicy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getschedpolicy.c rename to 3rdparty/w32pthreads/pthread_attr_getschedpolicy.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getscope.c b/3rdparty/w32pthreads/pthread_attr_getscope.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getscope.c rename to 3rdparty/w32pthreads/pthread_attr_getscope.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getstackaddr.c b/3rdparty/w32pthreads/pthread_attr_getstackaddr.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getstackaddr.c rename to 3rdparty/w32pthreads/pthread_attr_getstackaddr.c diff --git a/pcsx2/windows/pthreads/pthread_attr_getstacksize.c b/3rdparty/w32pthreads/pthread_attr_getstacksize.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_getstacksize.c rename to 3rdparty/w32pthreads/pthread_attr_getstacksize.c diff --git a/pcsx2/windows/pthreads/pthread_attr_init.c b/3rdparty/w32pthreads/pthread_attr_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_init.c rename to 3rdparty/w32pthreads/pthread_attr_init.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setdetachstate.c b/3rdparty/w32pthreads/pthread_attr_setdetachstate.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setdetachstate.c rename to 3rdparty/w32pthreads/pthread_attr_setdetachstate.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setinheritsched.c b/3rdparty/w32pthreads/pthread_attr_setinheritsched.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setinheritsched.c rename to 3rdparty/w32pthreads/pthread_attr_setinheritsched.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setschedparam.c b/3rdparty/w32pthreads/pthread_attr_setschedparam.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setschedparam.c rename to 3rdparty/w32pthreads/pthread_attr_setschedparam.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setschedpolicy.c b/3rdparty/w32pthreads/pthread_attr_setschedpolicy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setschedpolicy.c rename to 3rdparty/w32pthreads/pthread_attr_setschedpolicy.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setscope.c b/3rdparty/w32pthreads/pthread_attr_setscope.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setscope.c rename to 3rdparty/w32pthreads/pthread_attr_setscope.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setstackaddr.c b/3rdparty/w32pthreads/pthread_attr_setstackaddr.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setstackaddr.c rename to 3rdparty/w32pthreads/pthread_attr_setstackaddr.c diff --git a/pcsx2/windows/pthreads/pthread_attr_setstacksize.c b/3rdparty/w32pthreads/pthread_attr_setstacksize.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_attr_setstacksize.c rename to 3rdparty/w32pthreads/pthread_attr_setstacksize.c diff --git a/pcsx2/windows/pthreads/pthread_barrier_destroy.c b/3rdparty/w32pthreads/pthread_barrier_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrier_destroy.c rename to 3rdparty/w32pthreads/pthread_barrier_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_barrier_init.c b/3rdparty/w32pthreads/pthread_barrier_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrier_init.c rename to 3rdparty/w32pthreads/pthread_barrier_init.c diff --git a/pcsx2/windows/pthreads/pthread_barrier_wait.c b/3rdparty/w32pthreads/pthread_barrier_wait.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrier_wait.c rename to 3rdparty/w32pthreads/pthread_barrier_wait.c diff --git a/pcsx2/windows/pthreads/pthread_barrierattr_destroy.c b/3rdparty/w32pthreads/pthread_barrierattr_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrierattr_destroy.c rename to 3rdparty/w32pthreads/pthread_barrierattr_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_barrierattr_getpshared.c b/3rdparty/w32pthreads/pthread_barrierattr_getpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrierattr_getpshared.c rename to 3rdparty/w32pthreads/pthread_barrierattr_getpshared.c diff --git a/pcsx2/windows/pthreads/pthread_barrierattr_init.c b/3rdparty/w32pthreads/pthread_barrierattr_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrierattr_init.c rename to 3rdparty/w32pthreads/pthread_barrierattr_init.c diff --git a/pcsx2/windows/pthreads/pthread_barrierattr_setpshared.c b/3rdparty/w32pthreads/pthread_barrierattr_setpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_barrierattr_setpshared.c rename to 3rdparty/w32pthreads/pthread_barrierattr_setpshared.c diff --git a/pcsx2/windows/pthreads/pthread_cancel.c b/3rdparty/w32pthreads/pthread_cancel.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_cancel.c rename to 3rdparty/w32pthreads/pthread_cancel.c diff --git a/pcsx2/windows/pthreads/pthread_cond_destroy.c b/3rdparty/w32pthreads/pthread_cond_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_cond_destroy.c rename to 3rdparty/w32pthreads/pthread_cond_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_cond_init.c b/3rdparty/w32pthreads/pthread_cond_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_cond_init.c rename to 3rdparty/w32pthreads/pthread_cond_init.c diff --git a/pcsx2/windows/pthreads/pthread_cond_signal.c b/3rdparty/w32pthreads/pthread_cond_signal.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_cond_signal.c rename to 3rdparty/w32pthreads/pthread_cond_signal.c diff --git a/pcsx2/windows/pthreads/pthread_cond_wait.c b/3rdparty/w32pthreads/pthread_cond_wait.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_cond_wait.c rename to 3rdparty/w32pthreads/pthread_cond_wait.c diff --git a/pcsx2/windows/pthreads/pthread_condattr_destroy.c b/3rdparty/w32pthreads/pthread_condattr_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_condattr_destroy.c rename to 3rdparty/w32pthreads/pthread_condattr_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_condattr_getpshared.c b/3rdparty/w32pthreads/pthread_condattr_getpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_condattr_getpshared.c rename to 3rdparty/w32pthreads/pthread_condattr_getpshared.c diff --git a/pcsx2/windows/pthreads/pthread_condattr_init.c b/3rdparty/w32pthreads/pthread_condattr_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_condattr_init.c rename to 3rdparty/w32pthreads/pthread_condattr_init.c diff --git a/pcsx2/windows/pthreads/pthread_condattr_setpshared.c b/3rdparty/w32pthreads/pthread_condattr_setpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_condattr_setpshared.c rename to 3rdparty/w32pthreads/pthread_condattr_setpshared.c diff --git a/pcsx2/windows/pthreads/pthread_delay_np.c b/3rdparty/w32pthreads/pthread_delay_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_delay_np.c rename to 3rdparty/w32pthreads/pthread_delay_np.c diff --git a/pcsx2/windows/pthreads/pthread_detach.c b/3rdparty/w32pthreads/pthread_detach.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_detach.c rename to 3rdparty/w32pthreads/pthread_detach.c diff --git a/pcsx2/windows/pthreads/pthread_equal.c b/3rdparty/w32pthreads/pthread_equal.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_equal.c rename to 3rdparty/w32pthreads/pthread_equal.c diff --git a/pcsx2/windows/pthreads/pthread_exit.c b/3rdparty/w32pthreads/pthread_exit.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_exit.c rename to 3rdparty/w32pthreads/pthread_exit.c diff --git a/pcsx2/windows/pthreads/pthread_getconcurrency.c b/3rdparty/w32pthreads/pthread_getconcurrency.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_getconcurrency.c rename to 3rdparty/w32pthreads/pthread_getconcurrency.c diff --git a/pcsx2/windows/pthreads/pthread_getschedparam.c b/3rdparty/w32pthreads/pthread_getschedparam.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_getschedparam.c rename to 3rdparty/w32pthreads/pthread_getschedparam.c diff --git a/pcsx2/windows/pthreads/pthread_getspecific.c b/3rdparty/w32pthreads/pthread_getspecific.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_getspecific.c rename to 3rdparty/w32pthreads/pthread_getspecific.c diff --git a/pcsx2/windows/pthreads/pthread_getw32threadhandle_np.c b/3rdparty/w32pthreads/pthread_getw32threadhandle_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_getw32threadhandle_np.c rename to 3rdparty/w32pthreads/pthread_getw32threadhandle_np.c diff --git a/pcsx2/windows/pthreads/pthread_join.c b/3rdparty/w32pthreads/pthread_join.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_join.c rename to 3rdparty/w32pthreads/pthread_join.c diff --git a/pcsx2/windows/pthreads/pthread_key_create.c b/3rdparty/w32pthreads/pthread_key_create.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_key_create.c rename to 3rdparty/w32pthreads/pthread_key_create.c diff --git a/pcsx2/windows/pthreads/pthread_key_delete.c b/3rdparty/w32pthreads/pthread_key_delete.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_key_delete.c rename to 3rdparty/w32pthreads/pthread_key_delete.c diff --git a/pcsx2/windows/pthreads/pthread_kill.c b/3rdparty/w32pthreads/pthread_kill.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_kill.c rename to 3rdparty/w32pthreads/pthread_kill.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_destroy.c b/3rdparty/w32pthreads/pthread_mutex_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_destroy.c rename to 3rdparty/w32pthreads/pthread_mutex_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_init.c b/3rdparty/w32pthreads/pthread_mutex_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_init.c rename to 3rdparty/w32pthreads/pthread_mutex_init.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_lock.c b/3rdparty/w32pthreads/pthread_mutex_lock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_lock.c rename to 3rdparty/w32pthreads/pthread_mutex_lock.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_timedlock.c b/3rdparty/w32pthreads/pthread_mutex_timedlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_timedlock.c rename to 3rdparty/w32pthreads/pthread_mutex_timedlock.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_trylock.c b/3rdparty/w32pthreads/pthread_mutex_trylock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_trylock.c rename to 3rdparty/w32pthreads/pthread_mutex_trylock.c diff --git a/pcsx2/windows/pthreads/pthread_mutex_unlock.c b/3rdparty/w32pthreads/pthread_mutex_unlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutex_unlock.c rename to 3rdparty/w32pthreads/pthread_mutex_unlock.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_destroy.c b/3rdparty/w32pthreads/pthread_mutexattr_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_destroy.c rename to 3rdparty/w32pthreads/pthread_mutexattr_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_getkind_np.c b/3rdparty/w32pthreads/pthread_mutexattr_getkind_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_getkind_np.c rename to 3rdparty/w32pthreads/pthread_mutexattr_getkind_np.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_getpshared.c b/3rdparty/w32pthreads/pthread_mutexattr_getpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_getpshared.c rename to 3rdparty/w32pthreads/pthread_mutexattr_getpshared.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_gettype.c b/3rdparty/w32pthreads/pthread_mutexattr_gettype.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_gettype.c rename to 3rdparty/w32pthreads/pthread_mutexattr_gettype.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_init.c b/3rdparty/w32pthreads/pthread_mutexattr_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_init.c rename to 3rdparty/w32pthreads/pthread_mutexattr_init.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_setkind_np.c b/3rdparty/w32pthreads/pthread_mutexattr_setkind_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_setkind_np.c rename to 3rdparty/w32pthreads/pthread_mutexattr_setkind_np.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_setpshared.c b/3rdparty/w32pthreads/pthread_mutexattr_setpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_setpshared.c rename to 3rdparty/w32pthreads/pthread_mutexattr_setpshared.c diff --git a/pcsx2/windows/pthreads/pthread_mutexattr_settype.c b/3rdparty/w32pthreads/pthread_mutexattr_settype.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_mutexattr_settype.c rename to 3rdparty/w32pthreads/pthread_mutexattr_settype.c diff --git a/pcsx2/windows/pthreads/pthread_num_processors_np.c b/3rdparty/w32pthreads/pthread_num_processors_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_num_processors_np.c rename to 3rdparty/w32pthreads/pthread_num_processors_np.c diff --git a/pcsx2/windows/pthreads/pthread_once.c b/3rdparty/w32pthreads/pthread_once.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_once.c rename to 3rdparty/w32pthreads/pthread_once.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_destroy.c b/3rdparty/w32pthreads/pthread_rwlock_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_destroy.c rename to 3rdparty/w32pthreads/pthread_rwlock_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_init.c b/3rdparty/w32pthreads/pthread_rwlock_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_init.c rename to 3rdparty/w32pthreads/pthread_rwlock_init.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_rdlock.c b/3rdparty/w32pthreads/pthread_rwlock_rdlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_rdlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_rdlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_timedrdlock.c b/3rdparty/w32pthreads/pthread_rwlock_timedrdlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_timedrdlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_timedrdlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_timedwrlock.c b/3rdparty/w32pthreads/pthread_rwlock_timedwrlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_timedwrlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_timedwrlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_tryrdlock.c b/3rdparty/w32pthreads/pthread_rwlock_tryrdlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_tryrdlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_tryrdlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_trywrlock.c b/3rdparty/w32pthreads/pthread_rwlock_trywrlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_trywrlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_trywrlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_unlock.c b/3rdparty/w32pthreads/pthread_rwlock_unlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_unlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_unlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlock_wrlock.c b/3rdparty/w32pthreads/pthread_rwlock_wrlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlock_wrlock.c rename to 3rdparty/w32pthreads/pthread_rwlock_wrlock.c diff --git a/pcsx2/windows/pthreads/pthread_rwlockattr_destroy.c b/3rdparty/w32pthreads/pthread_rwlockattr_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlockattr_destroy.c rename to 3rdparty/w32pthreads/pthread_rwlockattr_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_rwlockattr_getpshared.c b/3rdparty/w32pthreads/pthread_rwlockattr_getpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlockattr_getpshared.c rename to 3rdparty/w32pthreads/pthread_rwlockattr_getpshared.c diff --git a/pcsx2/windows/pthreads/pthread_rwlockattr_init.c b/3rdparty/w32pthreads/pthread_rwlockattr_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlockattr_init.c rename to 3rdparty/w32pthreads/pthread_rwlockattr_init.c diff --git a/pcsx2/windows/pthreads/pthread_rwlockattr_setpshared.c b/3rdparty/w32pthreads/pthread_rwlockattr_setpshared.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_rwlockattr_setpshared.c rename to 3rdparty/w32pthreads/pthread_rwlockattr_setpshared.c diff --git a/pcsx2/windows/pthreads/pthread_self.c b/3rdparty/w32pthreads/pthread_self.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_self.c rename to 3rdparty/w32pthreads/pthread_self.c diff --git a/pcsx2/windows/pthreads/pthread_setcancelstate.c b/3rdparty/w32pthreads/pthread_setcancelstate.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_setcancelstate.c rename to 3rdparty/w32pthreads/pthread_setcancelstate.c diff --git a/pcsx2/windows/pthreads/pthread_setcanceltype.c b/3rdparty/w32pthreads/pthread_setcanceltype.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_setcanceltype.c rename to 3rdparty/w32pthreads/pthread_setcanceltype.c diff --git a/pcsx2/windows/pthreads/pthread_setconcurrency.c b/3rdparty/w32pthreads/pthread_setconcurrency.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_setconcurrency.c rename to 3rdparty/w32pthreads/pthread_setconcurrency.c diff --git a/pcsx2/windows/pthreads/pthread_setschedparam.c b/3rdparty/w32pthreads/pthread_setschedparam.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_setschedparam.c rename to 3rdparty/w32pthreads/pthread_setschedparam.c diff --git a/pcsx2/windows/pthreads/pthread_setspecific.c b/3rdparty/w32pthreads/pthread_setspecific.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_setspecific.c rename to 3rdparty/w32pthreads/pthread_setspecific.c diff --git a/pcsx2/windows/pthreads/pthread_spin_destroy.c b/3rdparty/w32pthreads/pthread_spin_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_spin_destroy.c rename to 3rdparty/w32pthreads/pthread_spin_destroy.c diff --git a/pcsx2/windows/pthreads/pthread_spin_init.c b/3rdparty/w32pthreads/pthread_spin_init.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_spin_init.c rename to 3rdparty/w32pthreads/pthread_spin_init.c diff --git a/pcsx2/windows/pthreads/pthread_spin_lock.c b/3rdparty/w32pthreads/pthread_spin_lock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_spin_lock.c rename to 3rdparty/w32pthreads/pthread_spin_lock.c diff --git a/pcsx2/windows/pthreads/pthread_spin_trylock.c b/3rdparty/w32pthreads/pthread_spin_trylock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_spin_trylock.c rename to 3rdparty/w32pthreads/pthread_spin_trylock.c diff --git a/pcsx2/windows/pthreads/pthread_spin_unlock.c b/3rdparty/w32pthreads/pthread_spin_unlock.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_spin_unlock.c rename to 3rdparty/w32pthreads/pthread_spin_unlock.c diff --git a/pcsx2/windows/pthreads/pthread_testcancel.c b/3rdparty/w32pthreads/pthread_testcancel.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_testcancel.c rename to 3rdparty/w32pthreads/pthread_testcancel.c diff --git a/pcsx2/windows/pthreads/pthread_timechange_handler_np.c b/3rdparty/w32pthreads/pthread_timechange_handler_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_timechange_handler_np.c rename to 3rdparty/w32pthreads/pthread_timechange_handler_np.c diff --git a/pcsx2/windows/pthreads/pthread_win32_attach_detach_np.c b/3rdparty/w32pthreads/pthread_win32_attach_detach_np.c similarity index 100% rename from pcsx2/windows/pthreads/pthread_win32_attach_detach_np.c rename to 3rdparty/w32pthreads/pthread_win32_attach_detach_np.c diff --git a/pcsx2/windows/VCprojects/pthreads_2008.vcproj b/3rdparty/w32pthreads/pthreads_2008.vcproj similarity index 53% rename from pcsx2/windows/VCprojects/pthreads_2008.vcproj rename to 3rdparty/w32pthreads/pthreads_2008.vcproj index 947144c36a..cac93c391f 100644 --- a/pcsx2/windows/VCprojects/pthreads_2008.vcproj +++ b/3rdparty/w32pthreads/pthreads_2008.vcproj @@ -18,9 +18,8 @@ @@ -114,7 +110,78 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" EnableFiberSafeOptimizations="true" - AdditionalIncludeDirectories=""$(InputDir)"" + AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\include"" + PreprocessorDefinitions="PTW32_STATIC_LIB;PTW32_BUILD_INLINED;__CLEANUP_SEH;WIN32;NDEBUG;_LIB" + StringPooling="true" + ExceptionHandling="2" + RuntimeLibrary="0" + StructMemberAlignment="5" + BufferSecurityCheck="false" + EnableFunctionLevelLinking="false" + UsePrecompiledHeader="0" + BrowseInformation="1" + WarningLevel="3" + DebugInformationFormat="3" + CompileAs="1" + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -256,27 +351,23 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > - - @@ -286,31 +377,35 @@ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > + + diff --git a/pcsx2/windows/pthreads/ptw32_InterlockedCompareExchange.c b/3rdparty/w32pthreads/ptw32_InterlockedCompareExchange.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_InterlockedCompareExchange.c rename to 3rdparty/w32pthreads/ptw32_InterlockedCompareExchange.c diff --git a/pcsx2/windows/pthreads/ptw32_MCS_lock.c b/3rdparty/w32pthreads/ptw32_MCS_lock.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_MCS_lock.c rename to 3rdparty/w32pthreads/ptw32_MCS_lock.c diff --git a/pcsx2/windows/pthreads/ptw32_callUserDestroyRoutines.c b/3rdparty/w32pthreads/ptw32_callUserDestroyRoutines.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_callUserDestroyRoutines.c rename to 3rdparty/w32pthreads/ptw32_callUserDestroyRoutines.c diff --git a/pcsx2/windows/pthreads/ptw32_calloc.c b/3rdparty/w32pthreads/ptw32_calloc.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_calloc.c rename to 3rdparty/w32pthreads/ptw32_calloc.c diff --git a/pcsx2/windows/pthreads/ptw32_cond_check_need_init.c b/3rdparty/w32pthreads/ptw32_cond_check_need_init.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_cond_check_need_init.c rename to 3rdparty/w32pthreads/ptw32_cond_check_need_init.c diff --git a/pcsx2/windows/pthreads/ptw32_getprocessors.c b/3rdparty/w32pthreads/ptw32_getprocessors.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_getprocessors.c rename to 3rdparty/w32pthreads/ptw32_getprocessors.c diff --git a/pcsx2/windows/pthreads/ptw32_is_attr.c b/3rdparty/w32pthreads/ptw32_is_attr.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_is_attr.c rename to 3rdparty/w32pthreads/ptw32_is_attr.c diff --git a/pcsx2/windows/pthreads/ptw32_mutex_check_need_init.c b/3rdparty/w32pthreads/ptw32_mutex_check_need_init.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_mutex_check_need_init.c rename to 3rdparty/w32pthreads/ptw32_mutex_check_need_init.c diff --git a/pcsx2/windows/pthreads/ptw32_new.c b/3rdparty/w32pthreads/ptw32_new.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_new.c rename to 3rdparty/w32pthreads/ptw32_new.c diff --git a/pcsx2/windows/pthreads/ptw32_processInitialize.c b/3rdparty/w32pthreads/ptw32_processInitialize.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_processInitialize.c rename to 3rdparty/w32pthreads/ptw32_processInitialize.c diff --git a/pcsx2/windows/pthreads/ptw32_processTerminate.c b/3rdparty/w32pthreads/ptw32_processTerminate.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_processTerminate.c rename to 3rdparty/w32pthreads/ptw32_processTerminate.c diff --git a/pcsx2/windows/pthreads/ptw32_relmillisecs.c b/3rdparty/w32pthreads/ptw32_relmillisecs.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_relmillisecs.c rename to 3rdparty/w32pthreads/ptw32_relmillisecs.c diff --git a/pcsx2/windows/pthreads/ptw32_reuse.c b/3rdparty/w32pthreads/ptw32_reuse.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_reuse.c rename to 3rdparty/w32pthreads/ptw32_reuse.c diff --git a/pcsx2/windows/pthreads/ptw32_rwlock_cancelwrwait.c b/3rdparty/w32pthreads/ptw32_rwlock_cancelwrwait.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_rwlock_cancelwrwait.c rename to 3rdparty/w32pthreads/ptw32_rwlock_cancelwrwait.c diff --git a/pcsx2/windows/pthreads/ptw32_rwlock_check_need_init.c b/3rdparty/w32pthreads/ptw32_rwlock_check_need_init.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_rwlock_check_need_init.c rename to 3rdparty/w32pthreads/ptw32_rwlock_check_need_init.c diff --git a/pcsx2/windows/pthreads/ptw32_semwait.c b/3rdparty/w32pthreads/ptw32_semwait.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_semwait.c rename to 3rdparty/w32pthreads/ptw32_semwait.c diff --git a/pcsx2/windows/pthreads/ptw32_spinlock_check_need_init.c b/3rdparty/w32pthreads/ptw32_spinlock_check_need_init.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_spinlock_check_need_init.c rename to 3rdparty/w32pthreads/ptw32_spinlock_check_need_init.c diff --git a/pcsx2/windows/pthreads/ptw32_threadDestroy.c b/3rdparty/w32pthreads/ptw32_threadDestroy.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_threadDestroy.c rename to 3rdparty/w32pthreads/ptw32_threadDestroy.c diff --git a/pcsx2/windows/pthreads/ptw32_threadStart.c b/3rdparty/w32pthreads/ptw32_threadStart.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_threadStart.c rename to 3rdparty/w32pthreads/ptw32_threadStart.c diff --git a/pcsx2/windows/pthreads/ptw32_throw.c b/3rdparty/w32pthreads/ptw32_throw.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_throw.c rename to 3rdparty/w32pthreads/ptw32_throw.c diff --git a/pcsx2/windows/pthreads/ptw32_timespec.c b/3rdparty/w32pthreads/ptw32_timespec.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_timespec.c rename to 3rdparty/w32pthreads/ptw32_timespec.c diff --git a/pcsx2/windows/pthreads/ptw32_tkAssocCreate.c b/3rdparty/w32pthreads/ptw32_tkAssocCreate.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_tkAssocCreate.c rename to 3rdparty/w32pthreads/ptw32_tkAssocCreate.c diff --git a/pcsx2/windows/pthreads/ptw32_tkAssocDestroy.c b/3rdparty/w32pthreads/ptw32_tkAssocDestroy.c similarity index 100% rename from pcsx2/windows/pthreads/ptw32_tkAssocDestroy.c rename to 3rdparty/w32pthreads/ptw32_tkAssocDestroy.c diff --git a/pcsx2/windows/pthreads/rwlock.c b/3rdparty/w32pthreads/rwlock.c similarity index 100% rename from pcsx2/windows/pthreads/rwlock.c rename to 3rdparty/w32pthreads/rwlock.c diff --git a/pcsx2/windows/pthreads/sched.c b/3rdparty/w32pthreads/sched.c similarity index 100% rename from pcsx2/windows/pthreads/sched.c rename to 3rdparty/w32pthreads/sched.c diff --git a/pcsx2/windows/pthreads/sched_get_priority_max.c b/3rdparty/w32pthreads/sched_get_priority_max.c similarity index 100% rename from pcsx2/windows/pthreads/sched_get_priority_max.c rename to 3rdparty/w32pthreads/sched_get_priority_max.c diff --git a/pcsx2/windows/pthreads/sched_get_priority_min.c b/3rdparty/w32pthreads/sched_get_priority_min.c similarity index 100% rename from pcsx2/windows/pthreads/sched_get_priority_min.c rename to 3rdparty/w32pthreads/sched_get_priority_min.c diff --git a/pcsx2/windows/pthreads/sched_getscheduler.c b/3rdparty/w32pthreads/sched_getscheduler.c similarity index 100% rename from pcsx2/windows/pthreads/sched_getscheduler.c rename to 3rdparty/w32pthreads/sched_getscheduler.c diff --git a/pcsx2/windows/pthreads/sched_setscheduler.c b/3rdparty/w32pthreads/sched_setscheduler.c similarity index 100% rename from pcsx2/windows/pthreads/sched_setscheduler.c rename to 3rdparty/w32pthreads/sched_setscheduler.c diff --git a/pcsx2/windows/pthreads/sched_yield.c b/3rdparty/w32pthreads/sched_yield.c similarity index 100% rename from pcsx2/windows/pthreads/sched_yield.c rename to 3rdparty/w32pthreads/sched_yield.c diff --git a/pcsx2/windows/pthreads/sem_close.c b/3rdparty/w32pthreads/sem_close.c similarity index 100% rename from pcsx2/windows/pthreads/sem_close.c rename to 3rdparty/w32pthreads/sem_close.c diff --git a/pcsx2/windows/pthreads/sem_destroy.c b/3rdparty/w32pthreads/sem_destroy.c similarity index 100% rename from pcsx2/windows/pthreads/sem_destroy.c rename to 3rdparty/w32pthreads/sem_destroy.c diff --git a/pcsx2/windows/pthreads/sem_getvalue.c b/3rdparty/w32pthreads/sem_getvalue.c similarity index 100% rename from pcsx2/windows/pthreads/sem_getvalue.c rename to 3rdparty/w32pthreads/sem_getvalue.c diff --git a/pcsx2/windows/pthreads/sem_init.c b/3rdparty/w32pthreads/sem_init.c similarity index 100% rename from pcsx2/windows/pthreads/sem_init.c rename to 3rdparty/w32pthreads/sem_init.c diff --git a/pcsx2/windows/pthreads/sem_open.c b/3rdparty/w32pthreads/sem_open.c similarity index 100% rename from pcsx2/windows/pthreads/sem_open.c rename to 3rdparty/w32pthreads/sem_open.c diff --git a/pcsx2/windows/pthreads/sem_post.c b/3rdparty/w32pthreads/sem_post.c similarity index 100% rename from pcsx2/windows/pthreads/sem_post.c rename to 3rdparty/w32pthreads/sem_post.c diff --git a/pcsx2/windows/pthreads/sem_post_multiple.c b/3rdparty/w32pthreads/sem_post_multiple.c similarity index 100% rename from pcsx2/windows/pthreads/sem_post_multiple.c rename to 3rdparty/w32pthreads/sem_post_multiple.c diff --git a/pcsx2/windows/pthreads/sem_timedwait.c b/3rdparty/w32pthreads/sem_timedwait.c similarity index 100% rename from pcsx2/windows/pthreads/sem_timedwait.c rename to 3rdparty/w32pthreads/sem_timedwait.c diff --git a/pcsx2/windows/pthreads/sem_trywait.c b/3rdparty/w32pthreads/sem_trywait.c similarity index 100% rename from pcsx2/windows/pthreads/sem_trywait.c rename to 3rdparty/w32pthreads/sem_trywait.c diff --git a/pcsx2/windows/pthreads/sem_unlink.c b/3rdparty/w32pthreads/sem_unlink.c similarity index 100% rename from pcsx2/windows/pthreads/sem_unlink.c rename to 3rdparty/w32pthreads/sem_unlink.c diff --git a/pcsx2/windows/pthreads/sem_wait.c b/3rdparty/w32pthreads/sem_wait.c similarity index 100% rename from pcsx2/windows/pthreads/sem_wait.c rename to 3rdparty/w32pthreads/sem_wait.c diff --git a/pcsx2/windows/pthreads/semaphore.c b/3rdparty/w32pthreads/semaphore.c similarity index 100% rename from pcsx2/windows/pthreads/semaphore.c rename to 3rdparty/w32pthreads/semaphore.c diff --git a/pcsx2/windows/pthreads/signal.c b/3rdparty/w32pthreads/signal.c similarity index 100% rename from pcsx2/windows/pthreads/signal.c rename to 3rdparty/w32pthreads/signal.c diff --git a/pcsx2/windows/pthreads/spin.c b/3rdparty/w32pthreads/spin.c similarity index 100% rename from pcsx2/windows/pthreads/spin.c rename to 3rdparty/w32pthreads/spin.c diff --git a/pcsx2/windows/pthreads/sync.c b/3rdparty/w32pthreads/sync.c similarity index 100% rename from pcsx2/windows/pthreads/sync.c rename to 3rdparty/w32pthreads/sync.c diff --git a/pcsx2/windows/pthreads/tsd.c b/3rdparty/w32pthreads/tsd.c similarity index 100% rename from pcsx2/windows/pthreads/tsd.c rename to 3rdparty/w32pthreads/tsd.c diff --git a/pcsx2/windows/pthreads/w32_CancelableWait.c b/3rdparty/w32pthreads/w32_CancelableWait.c similarity index 100% rename from pcsx2/windows/pthreads/w32_CancelableWait.c rename to 3rdparty/w32pthreads/w32_CancelableWait.c diff --git a/pcsx2/3rdparty/zlib/Makefile.am b/3rdparty/zlib/Makefile.am similarity index 100% rename from pcsx2/3rdparty/zlib/Makefile.am rename to 3rdparty/zlib/Makefile.am diff --git a/plugins/zerogs/opengl/3rdparty/zlib/adler32.c b/3rdparty/zlib/adler32.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/adler32.c rename to 3rdparty/zlib/adler32.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/compress.c b/3rdparty/zlib/compress.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/compress.c rename to 3rdparty/zlib/compress.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/crc32.c b/3rdparty/zlib/crc32.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/crc32.c rename to 3rdparty/zlib/crc32.c diff --git a/pcsx2/3rdparty/zlib/crc32.h b/3rdparty/zlib/crc32.h similarity index 100% rename from pcsx2/3rdparty/zlib/crc32.h rename to 3rdparty/zlib/crc32.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/deflate.c b/3rdparty/zlib/deflate.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/deflate.c rename to 3rdparty/zlib/deflate.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/deflate.h b/3rdparty/zlib/deflate.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/deflate.h rename to 3rdparty/zlib/deflate.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/gzio.c b/3rdparty/zlib/gzio.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/gzio.c rename to 3rdparty/zlib/gzio.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/infback.c b/3rdparty/zlib/infback.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/infback.c rename to 3rdparty/zlib/infback.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/inffast.c b/3rdparty/zlib/inffast.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/inffast.c rename to 3rdparty/zlib/inffast.c diff --git a/pcsx2/3rdparty/zlib/inffast.h b/3rdparty/zlib/inffast.h similarity index 100% rename from pcsx2/3rdparty/zlib/inffast.h rename to 3rdparty/zlib/inffast.h diff --git a/pcsx2/3rdparty/zlib/inffixed.h b/3rdparty/zlib/inffixed.h similarity index 100% rename from pcsx2/3rdparty/zlib/inffixed.h rename to 3rdparty/zlib/inffixed.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/inflate.c b/3rdparty/zlib/inflate.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/inflate.c rename to 3rdparty/zlib/inflate.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/inflate.h b/3rdparty/zlib/inflate.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/inflate.h rename to 3rdparty/zlib/inflate.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/inftrees.c b/3rdparty/zlib/inftrees.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/inftrees.c rename to 3rdparty/zlib/inftrees.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/inftrees.h b/3rdparty/zlib/inftrees.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/inftrees.h rename to 3rdparty/zlib/inftrees.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/trees.c b/3rdparty/zlib/trees.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/trees.c rename to 3rdparty/zlib/trees.c diff --git a/pcsx2/3rdparty/zlib/trees.h b/3rdparty/zlib/trees.h similarity index 100% rename from pcsx2/3rdparty/zlib/trees.h rename to 3rdparty/zlib/trees.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/uncompr.c b/3rdparty/zlib/uncompr.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/uncompr.c rename to 3rdparty/zlib/uncompr.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/zconf.h b/3rdparty/zlib/zconf.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/zconf.h rename to 3rdparty/zlib/zconf.h diff --git a/plugins/zerogs/opengl/3rdparty/zlib/zlib.h b/3rdparty/zlib/zlib.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/zlib.h rename to 3rdparty/zlib/zlib.h diff --git a/3rdparty/zlib/zlib.vcproj b/3rdparty/zlib/zlib.vcproj new file mode 100644 index 0000000000..00b4eb007a --- /dev/null +++ b/3rdparty/zlib/zlib.vcproj @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/zerogs/opengl/3rdparty/zlib/zutil.c b/3rdparty/zlib/zutil.c similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/zutil.c rename to 3rdparty/zlib/zutil.c diff --git a/plugins/zerogs/opengl/3rdparty/zlib/zutil.h b/3rdparty/zlib/zutil.h similarity index 100% rename from plugins/zerogs/opengl/3rdparty/zlib/zutil.h rename to 3rdparty/zlib/zutil.h diff --git a/pcsx2/common/PS2Edefs.h b/common/include/PS2Edefs.h similarity index 100% rename from pcsx2/common/PS2Edefs.h rename to common/include/PS2Edefs.h diff --git a/pcsx2/common/PS2Etypes.h b/common/include/PS2Etypes.h similarity index 100% rename from pcsx2/common/PS2Etypes.h rename to common/include/PS2Etypes.h diff --git a/pcsx2/windows/afxresmw.h b/common/include/afxresmw.h similarity index 100% rename from pcsx2/windows/afxresmw.h rename to common/include/afxresmw.h diff --git a/common/svn_readme.txt b/common/svn_readme.txt new file mode 100644 index 0000000000..1fca022271 --- /dev/null +++ b/common/svn_readme.txt @@ -0,0 +1,17 @@ + +Folder: vsprops/ + + Contains Win32-specific build scripts and .vsprops files for use by Win32 projects + of our many (many!) plugins. + +Folder: include/ + + Houses the common include files for various shared portions of Pcsx2 code. The most + significant are the PS2Edefs / PS2Etypes files (plugin APIs). Other code snippets\ + and generic usefuls may be added at a later date. + +Folder: src/ + + Source code for snippets and libs maintained by the Pcsx2 Team. Code is compiled into + libs, which are found in /deps. (automatically included into your plugin linker + search path if you use the common/vsprops/) \ No newline at end of file diff --git a/common/vsprops/3rdpartyDeps.vsprops b/common/vsprops/3rdpartyDeps.vsprops new file mode 100644 index 0000000000..6973130413 --- /dev/null +++ b/common/vsprops/3rdpartyDeps.vsprops @@ -0,0 +1,16 @@ + + + + + diff --git a/common/vsprops/BaseProperties.vsprops b/common/vsprops/BaseProperties.vsprops new file mode 100644 index 0000000000..173a4add24 --- /dev/null +++ b/common/vsprops/BaseProperties.vsprops @@ -0,0 +1,38 @@ + + + + + + + + diff --git a/common/vsprops/plugin_svnroot.vsprops b/common/vsprops/plugin_svnroot.vsprops new file mode 100644 index 0000000000..8d1c494ebe --- /dev/null +++ b/common/vsprops/plugin_svnroot.vsprops @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/common/vsprops/postBuild.tmpl b/common/vsprops/postBuild.tmpl new file mode 100644 index 0000000000..1da9bbe380 --- /dev/null +++ b/common/vsprops/postBuild.tmpl @@ -0,0 +1,50 @@ +::@echo off +:: +:: Usage: postBuild.cmd SourcePath DestFile DestExt {plugins} +:: +:: SourcePath - $(TargetPath) - Fully qualified path of the generated target file. +:: DestFile - Base filename of the target/dest, without extension! +:: DestExt - Extension of the target/dest! +:: plugins - optional parameter used to generate plugins into the /plugins folder +:: +:: The destination file is determined by the PCSX2_TARGET_DIR environment var. + +SETLOCAL ENABLEEXTENSIONS +if defined PCSX2_TARGET_COPY CALL :TestAndCopy "%PCSX2_TARGET_COPY%" %1 %2 %3 %4 +ENDLOCAL +exit 0 + + +:TestAndCopy +:: Subroutine. First parameter is our Target Dir. Since it's a parameter into +:: the subroutine, we can use tilda expansion to handle quotes correctly. :) + +if NOT EXIST "%~1" ( + md "%~1" +) + +:: Error checking. Try to change to the dir. If it fails, it means the dir is +:: actually a file, and we should cancel the script. + +set mycwd="%CD%" +cd "%~1" +if %ERRORLEVEL% NEQ 0 goto :eof +cd %mycwd% + +set pcsxoutdir=%~1\%~5 +set pcsxoutname="%pcsxoutdir%\%~3%4" +set pcsxnewname="%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4" + +IF NOT EXIST "%pcsxoutdir%" ( + md "%pcsxoutdir%" +) + +copy /Y "%~2" "%pcsxoutname%" +copy /Y "%~2" "%pcsxnewname%" +if %ERRORLEVEL% NEQ 0 ( + echo Target copied to %pcsxnewname% +) + +goto :eof + +:quit diff --git a/common/vsprops/postBuild.unknown b/common/vsprops/postBuild.unknown new file mode 100644 index 0000000000..c72584f9e0 --- /dev/null +++ b/common/vsprops/postBuild.unknown @@ -0,0 +1,48 @@ +::@echo off +:: +:: Usage: postBuild.cmd SourcePath DestFile DestExt {plugins} +:: +:: SourcePath - $(TargetPath) - Fully qualified path of the generated target file. +:: DestFile - Base filename of the target/dest, without extension! +:: DestExt - Extension of the target/dest! +:: plugins - optional parameter used to generate plugins into the /plugins folder +:: +:: The destination file is determined by the PCSX2_TARGET_DIR environment var. + +SETLOCAL ENABLEEXTENSIONS +if defined PCSX2_TARGET_COPY CALL :TestAndCopy "%PCSX2_TARGET_COPY%" %1 %2 %3 %4 +ENDLOCAL +exit 0 + + +:TestAndCopy +:: Subroutine. First parameter is our Target Dir. Since it's a parameter into +:: the subroutine, we can use tilda expansion to handle quotes correctly. :) + +if NOT EXIST "%~1" ( + md "%~1" +) + +:: Error checking. Try to change to the dir. If it fails, it means the dir is +:: actually a file, and we should cancel the script. + +set mycwd="%CD%" +cd "%~1" +if %ERRORLEVEL% NEQ 0 goto :eof +cd %mycwd% + +set pcsxoutdir=%~1\%~5 +set pcsxoutname=%pcsxoutdir%\%~3%4 + +IF NOT EXIST "%pcsxoutdir%" ( + md "%pcsxoutdir%" +) + +copy /Y "%~2" "%pcsxoutname%" +if %ERRORLEVEL% NEQ 0 ( + echo Target copied to %pcsxoutname% +) + +goto :eof + +:quit diff --git a/common/vsprops/preBuild.cmd b/common/vsprops/preBuild.cmd new file mode 100644 index 0000000000..9295263290 --- /dev/null +++ b/common/vsprops/preBuild.cmd @@ -0,0 +1,22 @@ +@echo off + +:: Usage: preBuild.cmd ProjectSrcDir VspropsDir +:: +:: ProjectSrcDir - $(ProjectDir)\.. - Top-level Directory of project source code. + +SETLOCAL ENABLEEXTENSIONS + +set mydir=%~0\..\ +SubWCRev.exe "%~1" "%mydir%\svnrev_template.h" "%CD%\svnrev.h" +if %ERRORLEVEL% NEQ 0 ( + echo Automatic revision update unavailable, using generic template instead. + echo You can safely ignore this message - see svnrev.h for details. + copy /Y "%mydir%\svnrev_unknown.h" "%CD%\svnrev.h" + copy /Y "%mydir%\postBuild.unknown" "%CD%\postBuild.cmd" +) else ( + SubWCRev.exe "%~1" "%mydir%\postBuild.tmpl" "%CD%\postBuild.cmd" > NUL +) + +ENDLOCAL +:: Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. +exit 0 diff --git a/common/vsprops/pthreads.vsprops b/common/vsprops/pthreads.vsprops new file mode 100644 index 0000000000..0c9b8f93cb --- /dev/null +++ b/common/vsprops/pthreads.vsprops @@ -0,0 +1,15 @@ + + + + + diff --git a/pcsx2/windows/VCprojects/vsprops/svnrev_template.h b/common/vsprops/svnrev_template.h similarity index 100% rename from pcsx2/windows/VCprojects/vsprops/svnrev_template.h rename to common/vsprops/svnrev_template.h diff --git a/pcsx2/windows/VCprojects/vsprops/svnrev_unknown.h b/common/vsprops/svnrev_unknown.h similarity index 100% rename from pcsx2/windows/VCprojects/vsprops/svnrev_unknown.h rename to common/vsprops/svnrev_unknown.h diff --git a/pcsx2/3rdparty/zlib/ChangeLog b/pcsx2/3rdparty/zlib/ChangeLog deleted file mode 100644 index 7f6869d323..0000000000 --- a/pcsx2/3rdparty/zlib/ChangeLog +++ /dev/null @@ -1,855 +0,0 @@ - - ChangeLog file for zlib - -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Added zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -Changes in 1.2.2 (3 October 2004) -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/pcsx2/3rdparty/zlib/README b/pcsx2/3rdparty/zlib/README deleted file mode 100644 index 758cc50020..0000000000 --- a/pcsx2/3rdparty/zlib/README +++ /dev/null @@ -1,125 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.3 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). These documents are also available in other -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile. In short "make test; make install" should work for most -machines. For Unix: "./configure; make test; make install". For MSDOS, use one -of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, -please check this site to verify that you have the latest version of zlib; -otherwise get the latest version and check whether the problem still exists or -not. - -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking -for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://dogma.net/markn/articles/zlibtool/zlibtool.htm - -The changes made in version 1.2.3 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html -See the zlib home page http://www.zlib.org for details. - -A Perl interface to zlib written by Paul Marquess is in the -CPAN (Comprehensive Perl Archive Network) sites -http://www.cpan.org/modules/by-module/Compress/ - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries is -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - -- When building a shared, i.e. dynamic library on Mac OS X, the library must be - installed before testing (do "make install" before "make test"), since the - library location is specified in the library. - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. Please -read the FAQ for more information on the distribution of modified source -versions. diff --git a/pcsx2/3rdparty/zlib/adler32.c b/pcsx2/3rdparty/zlib/adler32.c deleted file mode 100644 index 007ba26277..0000000000 --- a/pcsx2/3rdparty/zlib/adler32.c +++ /dev/null @@ -1,149 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -#define BASE 65521UL /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware */ -#ifdef NO_DIVIDE -# define MOD(a) \ - do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD4(a) \ - do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD4(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 > BASE) sum1 -= BASE; - if (sum1 > BASE) sum1 -= BASE; - if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); - if (sum2 > BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} diff --git a/pcsx2/3rdparty/zlib/compress.c b/pcsx2/3rdparty/zlib/compress.c deleted file mode 100644 index df04f0148e..0000000000 --- a/pcsx2/3rdparty/zlib/compress.c +++ /dev/null @@ -1,79 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; -} diff --git a/pcsx2/3rdparty/zlib/crc32.c b/pcsx2/3rdparty/zlib/crc32.c deleted file mode 100644 index f658a9ef55..0000000000 --- a/pcsx2/3rdparty/zlib/crc32.c +++ /dev/null @@ -1,423 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -#define local static - -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - -/* Definitions for doing the crc four data bytes at a time. */ -#ifdef BYFOUR -# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - unsigned long c; - int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (unsigned long)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = REV(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const unsigned long FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const unsigned long FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -#ifdef BYFOUR - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = (u4)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = REV((u4)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - buf4--; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf4++; - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(REV(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case */ - if (len2 == 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320L; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} diff --git a/pcsx2/3rdparty/zlib/deflate.c b/pcsx2/3rdparty/zlib/deflate.c deleted file mode 100644 index 29ce1f64a5..0000000000 --- a/pcsx2/3rdparty/zlib/deflate.c +++ /dev/null @@ -1,1736 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifndef FASTEST -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif -#endif -local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; - - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); - - if (length < MIN_MATCH) return Z_OK; - if (length > MAX_DIST(s)) { - length = MAX_DIST(s); - dictionary += dictLength - length; /* use the tail of the dictionary */ - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - lm_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if (func != configuration_table[level].func && strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_PARTIAL_FLUSH); - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; - s->nice_match = nice_length; - s->max_chain_length = max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds - * for every combination of windowBits and memLevel, as well as wrap. - * But even the conservative upper bound of about 14% expansion does not - * seem onerous for output buffer allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong destLen; - - /* conservative upper bound */ - destLen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; - - /* if can't get parameters, return conservative bound */ - if (strm == Z_NULL || strm->state == Z_NULL) - return destLen; - - /* if not default parameters, return conservative bound */ - s = strm->state; - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return destLen; - - /* default settings: return tight bound for that case */ - return compressBound(sourceLen); -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len = strm->state->pending; - - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, strm->state->pending_out, len); - strm->next_out += len; - strm->state->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_FINISH || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } -#ifdef GZIP - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; - } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; - } - } - else - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } - } - else - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; - } - else - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) - flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - } - } - else - s->status = BUSY_STATE; - } -#endif - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy(dest, source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy(ds, ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); - } -#endif - zmemcpy(buf, strm->next_in, len); - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ -#endif /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for level == 1 or strategy == Z_RLE only - */ -local uInt longest_match_fast(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - /* %%% avoid this when Z_RLE */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) return; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, eof) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (eof)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, eof) { \ - FLUSH_BLOCK_ONLY(s, eof); \ - if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ -#ifdef FASTEST - if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || - (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { - s->match_length = longest_match_fast (s, hash_head); - } -#else - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } -#endif - /* longest_match() or longest_match_fast() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } - /* longest_match() or longest_match_fast() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif /* FASTEST */ - -#if 0 -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt run; /* length of run */ - uInt max; /* maximum length of run */ - uInt prev; /* byte at distance one to match */ - Bytef *scan; /* scan for end of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest encodable run. - */ - if (s->lookahead < MAX_MATCH) { - fill_window(s); - if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - run = 0; - if (s->strstart > 0) { /* if there is a previous byte, that is */ - max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; - scan = s->window + s->strstart - 1; - prev = *scan++; - do { - if (*scan++ != prev) - break; - } while (++run < max); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (run >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, run); - _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); - s->lookahead -= run; - s->strstart += run; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif diff --git a/pcsx2/3rdparty/zlib/deflate.h b/pcsx2/3rdparty/zlib/deflate.h deleted file mode 100644 index 05a5ab3a2c..0000000000 --- a/pcsx2/3rdparty/zlib/deflate.h +++ /dev/null @@ -1,331 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2004 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - - /* in trees.c */ -void _tr_init OF((deflate_state *s)); -int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); -void _tr_align OF((deflate_state *s)); -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch _length_code[]; - extern uch _dist_code[]; -#else - extern const uch _length_code[]; - extern const uch _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/pcsx2/3rdparty/zlib/gzio.c b/pcsx2/3rdparty/zlib/gzio.c deleted file mode 100644 index b3c59ecd4c..0000000000 --- a/pcsx2/3rdparty/zlib/gzio.c +++ /dev/null @@ -1,1026 +0,0 @@ -/* gzio.c -- IO on .gz files - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. - */ - -/* @(#) $Id$ */ - -#include - -#include "zutil.h" - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef Z_BUFSIZE -# ifdef MAXSEG_64K -# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ -# else -# define Z_BUFSIZE 16384 -# endif -#endif -#ifndef Z_PRINTF_BUFSIZE -# define Z_PRINTF_BUFSIZE 4096 -#endif - -#ifdef __MVS__ -# pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern void free OF((voidpf ptr)); -#endif - -#define ALLOC(size) malloc(size) -#define TRYFREE(p) {if (p) free(p);} - -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define RESERVED 0xE0 /* bits 5..7: reserved */ - -typedef struct gz_stream { - z_stream stream; - int z_err; /* error code for last stream operation */ - int z_eof; /* set if end of input file */ - FILE *file; /* .gz file */ - Byte *inbuf; /* input buffer */ - Byte *outbuf; /* output buffer */ - uLong crc; /* crc32 of uncompressed data */ - char *msg; /* error message */ - char *path; /* path name for debugging only */ - int transparent; /* 1 if input file is not a .gz file */ - char mode; /* 'w' or 'r' */ - z_off_t start; /* start of compressed data in file (header skipped) */ - z_off_t in; /* bytes into deflate or inflate */ - z_off_t out; /* bytes out of deflate or inflate */ - int back; /* one character push-back */ - int last; /* true if push-back is last character */ -} gz_stream; - - -local gzFile gz_open OF((const char *path, const char *mode, int fd)); -local int do_flush OF((gzFile file, int flush)); -local int get_byte OF((gz_stream *s)); -local void check_header OF((gz_stream *s)); -local int destroy OF((gz_stream *s)); -local void putLong OF((FILE *file, uLong x)); -local uLong getLong OF((gz_stream *s)); - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb"). The file is given either by file descriptor - or path name (if fd == -1). - gz_open returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -*/ -local gzFile gz_open (path, mode, fd) - const char *path; - const char *mode; - int fd; -{ - int err; - int level = Z_BEST_SPEED; /* compression level */ - int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ - char *p = (char*)mode; - gz_stream *s; - char fmode[80]; /* copy of mode, without the compression level */ - char *m = fmode; - - if (!path || !mode) return Z_NULL; - - s = (gz_stream *)ALLOC(sizeof(gz_stream)); - if (!s) return Z_NULL; - - s->stream.zalloc = (alloc_func)0; - s->stream.zfree = (free_func)0; - s->stream.opaque = (voidpf)0; - s->stream.next_in = s->inbuf = Z_NULL; - s->stream.next_out = s->outbuf = Z_NULL; - s->stream.avail_in = s->stream.avail_out = 0; - s->file = NULL; - s->z_err = Z_OK; - s->z_eof = 0; - s->in = 0; - s->out = 0; - s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); - s->msg = NULL; - s->transparent = 0; - - s->path = (char*)ALLOC(strlen(path)+1); - if (s->path == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - strcpy(s->path, path); /* do this early for debugging */ - - s->mode = '\0'; - do { - if (*p == 'r') s->mode = 'r'; - if (*p == 'w' || *p == 'a') s->mode = 'w'; - if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else if (*p == 'R') { - strategy = Z_RLE; - } else { - *m++ = *p; /* copy the mode */ - } - } while (*p++ && m != fmode + sizeof(fmode)); - if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateInit2(&(s->stream), level, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); - /* windowBits is passed < 0 to suppress zlib header */ - - s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); -#endif - if (err != Z_OK || s->outbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } else { - s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); - - err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are - * present after the compressed stream. - */ - if (err != Z_OK || s->inbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } - s->stream.avail_out = Z_BUFSIZE; - - errno = 0; - s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); - - if (s->file == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - if (s->mode == 'w') { - /* Write a very simple .gz header: - */ - fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->start = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an - * fflush on some systems. This version of the library doesn't use - * start anyway in write mode, so this initialization is not - * necessary. - */ - } else { - check_header(s); /* skip the .gz header */ - s->start = ftell(s->file) - s->stream.avail_in; - } - - return (gzFile)s; -} - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. -*/ -gzFile ZEXPORT gzopen (path, mode) - const char *path; - const char *mode; -{ - return gz_open (path, mode, -1); -} - -/* =========================================================================== - Associate a gzFile with the file descriptor fd. fd is not dup'ed here - to mimic the behavio(u)r of fdopen. -*/ -gzFile ZEXPORT gzdopen (fd, mode) - int fd; - const char *mode; -{ - char name[46]; /* allow for up to 128-bit integers */ - - if (fd < 0) return (gzFile)Z_NULL; - sprintf(name, "", fd); /* for debugging */ - - return gz_open (name, mode, fd); -} - -/* =========================================================================== - * Update the compression level and strategy - */ -int ZEXPORT gzsetparams (file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - /* Make room to allow flushing */ - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; - } - - return deflateParams (&(s->stream), level, strategy); -} - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ -local int get_byte(s) - gz_stream *s; -{ - if (s->z_eof) return EOF; - if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; - } - s->stream.avail_in--; - return *(s->stream.next_in)++; -} - -/* =========================================================================== - Check the gzip header of a gz_stream opened for reading. Set the stream - mode to transparent if the gzip magic header is not present; set s->err - to Z_DATA_ERROR if the magic header is present but the rest of the header - is incorrect. - IN assertion: the stream s has already been created sucessfully; - s->stream.avail_in is zero for the first time, but may be non-zero - for concatenated .gz files. -*/ -local void check_header(s) - gz_stream *s; -{ - int method; /* method byte */ - int flags; /* flags byte */ - uInt len; - int c; - - /* Assure two bytes in the buffer so we can peek ahead -- handle case - where first byte of header is at the end of the buffer after the last - gzip segment */ - len = s->stream.avail_in; - if (len < 2) { - if (len) s->inbuf[0] = s->stream.next_in[0]; - errno = 0; - len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); - if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; - s->stream.avail_in += len; - s->stream.next_in = s->inbuf; - if (s->stream.avail_in < 2) { - s->transparent = s->stream.avail_in; - return; - } - } - - /* Peek ahead to check the gzip magic header */ - if (s->stream.next_in[0] != gz_magic[0] || - s->stream.next_in[1] != gz_magic[1]) { - s->transparent = 1; - return; - } - s->stream.avail_in -= 2; - s->stream.next_in += 2; - - /* Check the rest of the gzip header */ - method = get_byte(s); - flags = get_byte(s); - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; - } - - /* Discard time, xflags and OS code: */ - for (len = 0; len < 6; len++) (void)get_byte(s); - - if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; - } - if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); - } - s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; -} - - /* =========================================================================== - * Cleanup then free the given gz_stream. Return a zlib error code. - Try freeing in the reverse order of allocations. - */ -local int destroy (s) - gz_stream *s; -{ - int err = Z_OK; - - if (!s) return Z_STREAM_ERROR; - - TRYFREE(s->msg); - - if (s->stream.state != NULL) { - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateEnd(&(s->stream)); -#endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } - } - if (s->file != NULL && fclose(s->file)) { -#ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ -#endif - err = Z_ERRNO; - } - if (s->z_err < 0) err = s->z_err; - - TRYFREE(s->inbuf); - TRYFREE(s->outbuf); - TRYFREE(s->path); - TRYFREE(s); - return err; -} - -/* =========================================================================== - Reads the given number of uncompressed bytes from the compressed file. - gzread returns the number of bytes actually read (0 for end of file). -*/ -int ZEXPORT gzread (file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - Bytef *start = (Bytef*)buf; /* starting point for crc computation */ - Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ - - if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; - - if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; - if (s->z_err == Z_STREAM_END) return 0; /* EOF */ - - next_out = (Byte*)buf; - s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; - - if (s->stream.avail_out && s->back != EOF) { - *next_out++ = s->back; - s->stream.next_out++; - s->stream.avail_out--; - s->back = EOF; - s->out++; - start++; - if (s->last) { - s->z_err = Z_STREAM_END; - return 1; - } - } - - while (s->stream.avail_out != 0) { - - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= - (uInt)fread(next_out, 1, s->stream.avail_out, s->file); - } - len -= s->stream.avail_out; - s->in += len; - s->out += len; - if (len == 0) s->z_eof = 1; - return (int)len; - } - if (s->stream.avail_in == 0 && !s->z_eof) { - - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) { - s->z_err = Z_ERRNO; - break; - } - } - s->stream.next_in = s->inbuf; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; - - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); - /* The uncompressed length returned by above getlong() may be - * different from s->out in case of concatenated .gz files. - * Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - inflateReset(&(s->stream)); - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; - } - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - - if (len == s->stream.avail_out && - (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) - return -1; - return (int)(len - s->stream.avail_out); -} - - -/* =========================================================================== - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ -int ZEXPORT gzgetc(file) - gzFile file; -{ - unsigned char c; - - return gzread(file, &c, 1) == 1 ? c : -1; -} - - -/* =========================================================================== - Push one byte back onto the stream. -*/ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; - s->back = c; - s->out--; - s->last = (s->z_err == Z_STREAM_END); - if (s->last) s->z_err = Z_OK; - s->z_eof = 0; - return c; -} - - -/* =========================================================================== - Reads bytes from the compressed file until len-1 characters are - read, or a newline character is read and transferred to buf, or an - end-of-file condition is encountered. The string is then terminated - with a null character. - gzgets returns buf, or Z_NULL in case of error. - - The current implementation is not optimized at all. -*/ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - char *b = buf; - if (buf == Z_NULL || len <= 0) return Z_NULL; - - while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; - *buf = '\0'; - return b == buf && len > 0 ? Z_NULL : b; -} - - -#ifndef NO_GZCOMPRESS -/* =========================================================================== - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of bytes actually written (0 in case of error). -*/ -int ZEXPORT gzwrite (file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.next_in = (Bytef*)buf; - s->stream.avail_in = len; - - while (s->stream.avail_in != 0) { - - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - break; - } - s->stream.avail_out = Z_BUFSIZE; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - if (s->z_err != Z_OK) break; - } - s->crc = crc32(s->crc, (const Bytef *)buf, len); - - return (int)(len - s->stream.avail_in); -} - - -/* =========================================================================== - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ -#ifdef STDC -#include - -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) -{ - char buf[Z_PRINTF_BUFSIZE]; - va_list va; - int len; - - buf[sizeof(buf) - 1] = 0; - va_start(va, format); -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(buf, format, va); - va_end(va); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = vsprintf(buf, format, va); - va_end(va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(buf, sizeof(buf), format, va); - va_end(va); - len = strlen(buf); -# else - len = vsnprintf(buf, sizeof(buf), format, va); - va_end(va); -# endif -#endif - if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, (unsigned)len); -} -#else /* not ANSI C */ - -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - char buf[Z_PRINTF_BUFSIZE]; - int len; - - buf[sizeof(buf) - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(buf); -# else - len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, len); -} -#endif - -/* =========================================================================== - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char cc = (unsigned char) c; /* required for big endian systems */ - - return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; -} - - -/* =========================================================================== - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ -int ZEXPORT gzputs(file, s) - gzFile file; - const char *s; -{ - return gzwrite(file, (char*)s, (unsigned)strlen(s)); -} - - -/* =========================================================================== - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. -*/ -local int do_flush (file, flush) - gzFile file; - int flush; -{ - uInt len; - int done = 0; - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.avail_in = 0; /* should be zero already anyway */ - - for (;;) { - len = Z_BUFSIZE - s->stream.avail_out; - - if (len != 0) { - if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { - s->z_err = Z_ERRNO; - return Z_ERRNO; - } - s->stream.next_out = s->outbuf; - s->stream.avail_out = Z_BUFSIZE; - } - if (done) break; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), flush); - s->out -= s->stream.avail_out; - - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; - - /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: - */ - done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - - if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; - } - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} - -int ZEXPORT gzflush (file, flush) - gzFile file; - int flush; -{ - gz_stream *s = (gz_stream*)file; - int err = do_flush (file, flush); - - if (err) return err; - fflush(s->file); - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} -#endif /* NO_GZCOMPRESS */ - -/* =========================================================================== - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error. - SEEK_END is not implemented, returns error. - In this version of the library, gzseek can be extremely slow. -*/ -z_off_t ZEXPORT gzseek (file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; - } - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return -1L; -#else - if (whence == SEEK_SET) { - offset -= s->in; - } - if (offset < 0) return -1L; - - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - if (s->inbuf == Z_NULL) return -1L; - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; - - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; - - offset -= size; - } - return s->in; -#endif - } - /* Rest of function is for reading only */ - - /* compute absolute position */ - if (whence == SEEK_CUR) { - offset += s->out; - } - if (offset < 0) return -1L; - - if (s->transparent) { - /* map to fseek */ - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - - s->in = s->out = offset; - return offset; - } - - /* For a negative seek, rewind and use positive seek */ - if (offset >= s->out) { - offset -= s->out; - } else if (gzrewind(file) < 0) { - return -1L; - } - /* offset is now the number of bytes to skip. */ - - if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); - if (s->outbuf == Z_NULL) return -1L; - } - if (offset && s->back != EOF) { - s->back = EOF; - s->out++; - offset--; - if (s->last) s->z_err = Z_STREAM_END; - } - while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; - - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; - } - return s->out; -} - -/* =========================================================================== - Rewinds input file. -*/ -int ZEXPORT gzrewind (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return -1; - - s->z_err = Z_OK; - s->z_eof = 0; - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - s->crc = crc32(0L, Z_NULL, 0); - if (!s->transparent) (void)inflateReset(&s->stream); - s->in = 0; - s->out = 0; - return fseek(s->file, s->start, SEEK_SET); -} - -/* =========================================================================== - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -*/ -z_off_t ZEXPORT gztell (file) - gzFile file; -{ - return gzseek(file, 0L, SEEK_CUR); -} - -/* =========================================================================== - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ -int ZEXPORT gzeof (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - /* With concatenated compressed files that can have embedded - * crc trailers, z_eof is no longer the only/best indicator of EOF - * on a gz_stream. Handle end-of-stream error explicitly here. - */ - if (s == NULL || s->mode != 'r') return 0; - if (s->z_eof) return 1; - return s->z_err == Z_STREAM_END; -} - -/* =========================================================================== - Returns 1 if reading and doing so transparently, otherwise zero. -*/ -int ZEXPORT gzdirect (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return 0; - return s->transparent; -} - -/* =========================================================================== - Outputs a long in LSB order to the given file -*/ -local void putLong (file, x) - FILE *file; - uLong x; -{ - int n; - for (n = 0; n < 4; n++) { - fputc((int)(x & 0xff), file); - x >>= 8; - } -} - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets z_err in case - of error. -*/ -local uLong getLong (s) - gz_stream *s; -{ - uLong x = (uLong)get_byte(s); - int c; - - x += ((uLong)get_byte(s))<<8; - x += ((uLong)get_byte(s))<<16; - c = get_byte(s); - if (c == EOF) s->z_err = Z_DATA_ERROR; - x += ((uLong)c)<<24; - return x; -} - -/* =========================================================================== - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. -*/ -int ZEXPORT gzclose (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return Z_STREAM_ERROR; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return Z_STREAM_ERROR; -#else - if (do_flush (file, Z_FINISH) != Z_OK) - return destroy((gz_stream*)file); - - putLong (s->file, s->crc); - putLong (s->file, (uLong)(s->in & 0xffffffff)); -#endif - } - return destroy((gz_stream*)file); -} - -#ifdef STDC -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -/* =========================================================================== - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ -const char * ZEXPORT gzerror (file, errnum) - gzFile file; - int *errnum; -{ - char *m; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) { - *errnum = Z_STREAM_ERROR; - return (const char*)ERR_MSG(Z_STREAM_ERROR); - } - *errnum = s->z_err; - if (*errnum == Z_OK) return (const char*)""; - - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); - - if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); - - TRYFREE(s->msg); - s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); - if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); - strcpy(s->msg, s->path); - strcat(s->msg, ": "); - strcat(s->msg, m); - return (const char*)s->msg; -} - -/* =========================================================================== - Clear the error and end-of-file flags, and do the same for the real file. -*/ -void ZEXPORT gzclearerr (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return; - if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; - s->z_eof = 0; - clearerr(s->file); -} diff --git a/pcsx2/3rdparty/zlib/infback.c b/pcsx2/3rdparty/zlib/infback.c deleted file mode 100644 index 455dbc9ee8..0000000000 --- a/pcsx2/3rdparty/zlib/infback.c +++ /dev/null @@ -1,623 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->write = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - - /* process literal */ - if (this.op == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/pcsx2/3rdparty/zlib/inffast.c b/pcsx2/3rdparty/zlib/inffast.c deleted file mode 100644 index bbee92ed1e..0000000000 --- a/pcsx2/3rdparty/zlib/inffast.c +++ /dev/null @@ -1,318 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code this; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - write = state->write; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = lcode[hold & lmask]; - dolen: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op == 0) { /* literal */ - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - PUP(out) = (unsigned char)(this.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = dcode[hold & dmask]; - dodist: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - from = window - OFF; - if (write == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (write < op) { /* wrap around window */ - from += wsize + write - op; - op -= write; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (write < len) { /* some from start of window */ - op = write; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += write - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - this = dcode[this.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - this = lcode[this.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and write == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/pcsx2/3rdparty/zlib/inflate.c b/pcsx2/3rdparty/zlib/inflate.c deleted file mode 100644 index 792fdee8e9..0000000000 --- a/pcsx2/3rdparty/zlib/inflate.c +++ /dev/null @@ -1,1368 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common write == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - strm->adler = 1; /* to support ill-conceived Java test suite */ - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->wsize = 0; - state->whave = 0; - state->write = 0; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; - return Z_OK; -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - if (windowBits < 0) { - state->wrap = 0; - windowBits = -windowBits; - } - else { - state->wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) windowBits &= 15; -#endif - } - if (windowBits < 8 || windowBits > 15) { - ZFREE(strm, state); - strm->state = Z_NULL; - return Z_STREAM_ERROR; - } - state->wbits = (unsigned)windowBits; - state->window = Z_NULL; - return inflateReset(strm); -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, out) -z_streamp strm; -unsigned out; -{ - struct inflate_state FAR *state; - unsigned copy, dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->write = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; - if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->write = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->write; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->write, strm->next_out - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); - state->write = copy; - state->whave = state->wsize; - } - else { - state->write += dist; - if (state->write == state->wsize) state->write = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - break; - } - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - if ((int)(this.op) == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - state->mode = LIT; - break; - } - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(this.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->mode = DIST; - case DIST: - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - state->extra = (unsigned)(this.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - if (state->offset > state->whave + out - left) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->write) { - copy -= state->write; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->write - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - REVERSE(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) - if (updatewindow(strm, out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long id; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary id */ - if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy(dest, source, sizeof(z_stream)); - zmemcpy(copy, state, sizeof(struct inflate_state)); - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} diff --git a/pcsx2/3rdparty/zlib/inflate.h b/pcsx2/3rdparty/zlib/inflate.h deleted file mode 100644 index 07bd3e78a7..0000000000 --- a/pcsx2/3rdparty/zlib/inflate.h +++ /dev/null @@ -1,115 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN, /* i: waiting for length/lit code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD or MEM mode -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME - NAME -> COMMENT -> HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or CHECK - STORED -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; diff --git a/pcsx2/3rdparty/zlib/inftrees.c b/pcsx2/3rdparty/zlib/inftrees.c deleted file mode 100644 index 8a9c13ff03..0000000000 --- a/pcsx2/3rdparty/zlib/inftrees.c +++ /dev/null @@ -1,329 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code this; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)1; - this.val = (unsigned short)0; - *(*table)++ = this; /* make a table to force an error */ - *(*table)++ = this; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min <= MAXBITS; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked when a LENS table is being made - against the space in *table, ENOUGH, minus the maximum space needed by - the worst case distance code, MAXD. This should never happen, but the - sufficiency of ENOUGH has not been proven exhaustively, hence the check. - This assumes that when type == LENS, bits == 9. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - this.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - this.op = (unsigned char)0; - this.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - this.op = (unsigned char)(extra[work[sym]]); - this.val = base[work[sym]]; - } - else { - this.op = (unsigned char)(32 + 64); /* end of block */ - this.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = this; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)(len - drop); - this.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - this.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = this; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/pcsx2/3rdparty/zlib/inftrees.h b/pcsx2/3rdparty/zlib/inftrees.h deleted file mode 100644 index b1104c87e7..0000000000 --- a/pcsx2/3rdparty/zlib/inftrees.h +++ /dev/null @@ -1,55 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1444 code structures (852 for length/literals - and 592 for distances, the latter actually the result of an - exhaustive search). The true maximum is not known, but the value - below is more than safe. */ -#define ENOUGH 2048 -#define MAXD 592 - -/* Type of code to build for inftable() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/pcsx2/3rdparty/zlib/trees.c b/pcsx2/3rdparty/zlib/trees.c deleted file mode 100644 index 395e4e1681..0000000000 --- a/pcsx2/3rdparty/zlib/trees.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2005 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); -local void set_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (value << s->bi_valid); - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (val << s->bi_valid);\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void _tr_stored_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. - */ -void _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void _tr_flush_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) - set_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, eof); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+eof, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+eof, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (eof) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*eof)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; -} - -/* =========================================================================== - * Set the data type to BINARY or TEXT, using a crude approximation: - * set it to Z_TEXT if all symbols are either printable characters (33 to 255) - * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local void set_data_type(s) - deflate_state *s; -{ - int n; - - for (n = 0; n < 9; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - if (n == 9) - for (n = 14; n < 32; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/pcsx2/3rdparty/zlib/uncompr.c b/pcsx2/3rdparty/zlib/uncompr.c deleted file mode 100644 index b59e3d0def..0000000000 --- a/pcsx2/3rdparty/zlib/uncompr.c +++ /dev/null @@ -1,61 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/pcsx2/3rdparty/zlib/zconf.h b/pcsx2/3rdparty/zlib/zconf.h deleted file mode 100644 index 03a9431c8b..0000000000 --- a/pcsx2/3rdparty/zlib/zconf.h +++ /dev/null @@ -1,332 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/pcsx2/3rdparty/zlib/zlib.h b/pcsx2/3rdparty/zlib/zlib.h deleted file mode 100644 index 022817927c..0000000000 --- a/pcsx2/3rdparty/zlib/zlib.h +++ /dev/null @@ -1,1357 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumualte before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it gets to the next deflate block boundary. When decoding the - zlib or gzip format, this will cause inflate() to return immediately after - the header and before the first block. When doing a raw inflate, inflate() - will go ahead and process the first block, and will return when it gets to - the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. Z_FIXED prevents the - use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. In addition, the - current implementation of deflate will use at most the window size minus - 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - a crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg - is set to null if there is no error message. inflateInit2 does not perform - any decompression apart from reading the zlib header if present: this will - be done by inflate(). (So next_in and avail_in may be modified, but next_out - and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK can be used to - force inflate() to return immediately after header processing is complete - and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When - any of extra, name, or comment are not Z_NULL and the respective field is - not present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns 1 if file is being read directly without decompression, otherwise - zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is NULL, this function returns the required initial - value for the for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/pcsx2/3rdparty/zlib/zutil.c b/pcsx2/3rdparty/zlib/zutil.c deleted file mode 100644 index d55f5948a3..0000000000 --- a/pcsx2/3rdparty/zlib/zutil.c +++ /dev/null @@ -1,318 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch (sizeof(uInt)) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch (sizeof(uLong)) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch (sizeof(voidpf)) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch (sizeof(z_off_t)) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#ifdef STDC -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int z_verbose = verbose; - -void z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ diff --git a/pcsx2/3rdparty/zlib/zutil.h b/pcsx2/3rdparty/zlib/zutil.h deleted file mode 100644 index 532fc7084a..0000000000 --- a/pcsx2/3rdparty/zlib/zutil.h +++ /dev/null @@ -1,269 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#define ZLIB_INTERNAL -#include "zlib.h" - -#ifdef STDC -# ifndef _WIN32_WCE -# include -# endif -# include -# include -#endif -#ifdef NO_ERRNO_H -# ifdef _WIN32_WCE - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. We rename it to - * avoid conflict with other libraries that use the same workaround. - */ -# define errno z_errno -# endif - extern int errno; -#else -# ifndef _WIN32_WCE -# include -# endif -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 9 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# ifdef M_I86 - #include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# define vsnprintf _vsnprintf -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int z_verbose; - extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ diff --git a/pcsx2/Common.h b/pcsx2/Common.h index bf86b7031d..6820b9ee4d 100644 --- a/pcsx2/Common.h +++ b/pcsx2/Common.h @@ -37,6 +37,7 @@ struct TESTRUNARGS const char* pimagename; const char* plogname; const char* pgsdll, *pcdvddll, *pspudll; + const char* ppad1dll, *ppad2dll, *pdev9dll; }; diff --git a/pcsx2/GS.h b/pcsx2/GS.h index a30654e3fe..74c151a79e 100644 --- a/pcsx2/GS.h +++ b/pcsx2/GS.h @@ -26,7 +26,6 @@ #include "Common.h" #include "Threading.h" -#include "zlib.h" #define GSPATH3FIX diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index 72836c11d9..9e966cc0f0 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -55,7 +55,7 @@ using std::string; // we use it enough, so bring it into the global namespace. -#include "zlib.h" +#include "zlib/zlib.h" #include "PS2Etypes.h" #include "StringUtils.h" diff --git a/pcsx2/PsxCommon.h b/pcsx2/PsxCommon.h index a8fd2a14f3..2ccee86933 100644 --- a/pcsx2/PsxCommon.h +++ b/pcsx2/PsxCommon.h @@ -27,7 +27,6 @@ #include #include "System.h" -#include extern long LoadCdBios; extern int cdOpenCase; diff --git a/pcsx2/SaveState.h b/pcsx2/SaveState.h index 57d4e9624a..da1f9cfb36 100644 --- a/pcsx2/SaveState.h +++ b/pcsx2/SaveState.h @@ -19,8 +19,6 @@ #ifndef _SAVESTATE_H_ #define _SAVESTATE_H_ -#include - // This shouldn't break Win compiles, but it does. #ifdef __LINUX__ #include "PS2Edefs.h" diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index 19eabcf485..a569e2bde9 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -22,7 +22,6 @@ #include "RDebug/deci2.h" #else #include -#include "DebugTools/Debug.h" #endif #include @@ -31,6 +30,7 @@ #include "R3000A.h" #include "iR5900.h" #include "System.h" +#include "DebugTools/Debug.h" using namespace R5900; diff --git a/pcsx2/ThreadTools.cpp b/pcsx2/ThreadTools.cpp index 1b1c722627..da840de66a 100644 --- a/pcsx2/ThreadTools.cpp +++ b/pcsx2/ThreadTools.cpp @@ -56,6 +56,9 @@ namespace Threading return m_returncode; } +// pthread Cond is an evil api that is not suited for Pcsx2 needs. +// Let's not use it. (Air) +#if 0 WaitEvent::WaitEvent() { int err = 0; @@ -83,7 +86,7 @@ namespace Threading pthread_cond_wait( &cond, &mutex ); pthread_mutex_unlock( &mutex ); } - +#endif Semaphore::Semaphore() { sem_init( &sema, false, 0 ); diff --git a/pcsx2/build.sh b/pcsx2/build.sh index bbe7df2b04..9b88972756 100644 --- a/pcsx2/build.sh +++ b/pcsx2/build.sh @@ -1,6 +1,6 @@ #!/bin/sh # Pcsx2 - Pc Ps2 Emulator -# Copyright (C) 2002-2008 Pcsx2 Team +# Copyright (C) 2002-2009 Pcsx2 Team # # 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 diff --git a/pcsx2/windows/Debugreg.cpp b/pcsx2/windows/Debugreg.cpp index 8a38c52428..752cd638c6 100644 --- a/pcsx2/windows/Debugreg.cpp +++ b/pcsx2/windows/Debugreg.cpp @@ -23,7 +23,7 @@ #include "resource.h" #include "Debugger.h" -#include "Debug.h" +#include "DebugTools/Debug.h" #include "R5900.h" #include "R3000a.h" #include "VUmicro.h" diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index 7283f46164..bbcae1a510 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -20,8 +20,9 @@ @@ -102,7 +103,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcsx2/windows/VCprojects/vsprops/ProjectRootDir.vsprops b/pcsx2/windows/VCprojects/vsprops/ProjectRootDir.vsprops new file mode 100644 index 0000000000..8e4e3958fa --- /dev/null +++ b/pcsx2/windows/VCprojects/vsprops/ProjectRootDir.vsprops @@ -0,0 +1,15 @@ + + + + + diff --git a/pcsx2/windows/VCprojects/vsprops/common.vsprops b/pcsx2/windows/VCprojects/vsprops/common.vsprops index 5869ad8a41..26d3306dd2 100644 --- a/pcsx2/windows/VCprojects/vsprops/common.vsprops +++ b/pcsx2/windows/VCprojects/vsprops/common.vsprops @@ -3,21 +3,11 @@ ProjectType="Visual C++" Version="8.00" Name="common" - OutputDirectory="$(ProjectDir)\bin\" - IntermediateDirectory="$(ConfigurationName)" > - - + + + + diff --git a/pcsx2/windows/VCprojects/vsprops/postBuild.tmpl b/pcsx2/windows/VCprojects/vsprops/postBuild.tmpl deleted file mode 100644 index 5b260bef7f..0000000000 --- a/pcsx2/windows/VCprojects/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/pcsx2/windows/VCprojects/vsprops/postBuild.unknown b/pcsx2/windows/VCprojects/vsprops/postBuild.unknown deleted file mode 100644 index 35e76173e1..0000000000 --- a/pcsx2/windows/VCprojects/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/pcsx2/windows/VCprojects/vsprops/preBuild.cmd b/pcsx2/windows/VCprojects/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/pcsx2/windows/VCprojects/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/pcsx2/windows/WinConsole.cpp b/pcsx2/windows/WinConsole.cpp index 3b8a67f5fd..c5bb0a2800 100644 --- a/pcsx2/windows/WinConsole.cpp +++ b/pcsx2/windows/WinConsole.cpp @@ -19,7 +19,7 @@ #include "PrecompiledHeader.h" #include "System.h" -#include "Debug.h" +#include "DebugTools/Debug.h" namespace Console { diff --git a/pcsx2/windows/WinMain.cpp b/pcsx2/windows/WinMain.cpp index 267a3735ce..50cde0617e 100644 --- a/pcsx2/windows/WinMain.cpp +++ b/pcsx2/windows/WinMain.cpp @@ -83,10 +83,14 @@ static const char* phelpmsg = "\n" #endif - "Load Plugins:\n" - "\t-cdvd [dllpath] {specify the dll load path of the CDVD plugin}\n" - "\t-gs [dllpath] {specify the dll load path of the GS plugin}\n" - "\t-spu [dllpath] {specify the dll load path of the SPU2 plugin}\n" + "Plugin Overrides (specified dlls will be used in place of configured dlls):\n" + "\t-cdvd [dllpath] {specifies an override for the CDVD plugin}\n" + "\t-gs [dllpath] {specifies an override for the GS plugin}\n" + "\t-spu [dllpath] {specifies an override for the SPU2 plugin}\n" + "\t-pads [dllpath] {specifies an override for *both* pad plugins}\n" + "\t-pad1 [dllpath] {specifies an override for the PAD1 plugin only}\n" + "\t-pad2 [dllpath] {specifies an override for the PAD2 plugin only}\n" + "\t-dev9 [dllpath] {specifies an override for the DEV9 plugin}\n" "\n"; /// This code is courtesy of http://alter.org.ua/en/docs/win/args/ @@ -188,7 +192,7 @@ void WinClose() BOOL SysLoggedSetLockPagesPrivilege ( HANDLE hProcess, BOOL bEnable); -// Returns TRUE if the test run mode was activaated (game was run and has been exited) +// Returns TRUE if the test run mode was activated (game was run and has been exited) static bool TestRunMode() { if( IsDevBuild && (g_TestRun.enabled || g_TestRun.ptitle != NULL) ) @@ -203,6 +207,14 @@ static bool TestRunMode() return false; } +static void _doPluginOverride( const char* name, const char* src, char (&dest)[g_MaxPath] ) +{ + if( src == NULL ) return; + + _tcscpy_s( dest, g_TestRun.pgsdll ); + Console::Notice( "* %s plugin override: \n\t%s\n", params name, Config.GS ); +} + void WinRun() { // Load the command line overrides for plugins. @@ -210,23 +222,13 @@ void WinRun() memcpy( &winConfig, &Config, sizeof( PcsxConfig ) ); - if( g_TestRun.pgsdll ) - { - _tcscpy_s( Config.GS, g_MaxPath, g_TestRun.pgsdll ); - Console::Notice( "* GS plugin override: \n\t%s\n", params Config.GS ); - } - if( g_TestRun.pcdvddll ) - { - _tcscpy_s( Config.CDVD, g_MaxPath, g_TestRun.pcdvddll ); - Console::Notice( "* CDVD plugin override: \n\t%s\n", params Config.CDVD ); - } - if( g_TestRun.pspudll ) - { - _tcscpy_s( Config.SPU2, g_MaxPath, g_TestRun.pspudll ); - Console::Notice( "* SPU2 plugin override: \n\t%s\n", params Config.SPU2 ); - } + _doPluginOverride( "GS", g_TestRun.pgsdll, Config.GS ); + _doPluginOverride( "CDVD", g_TestRun.pcdvddll, Config.CDVD ); + _doPluginOverride( "SPU2", g_TestRun.pspudll, Config.SPU2 ); + _doPluginOverride( "PAD1", g_TestRun.ppad1dll, Config.PAD1 ); + _doPluginOverride( "PAD2", g_TestRun.ppad2dll, Config.PAD2 ); + _doPluginOverride( "DEV9", g_TestRun.pdev9dll, Config.DEV9 ); - // [TODO] : Add the other plugin overrides here... #ifndef _DEBUG if( Config.Profiler ) diff --git a/pcsx2/windows/WinSysExec.cpp b/pcsx2/windows/WinSysExec.cpp index e01e567a29..108bd19197 100644 --- a/pcsx2/windows/WinSysExec.cpp +++ b/pcsx2/windows/WinSysExec.cpp @@ -137,6 +137,19 @@ int ParseCommandLine( int tokenCount, TCHAR *const *const tokens ) else if( CmdSwitchIs( "spu" ) ) { g_TestRun.pspudll = param; } + else if( CmdSwitchIs( "pads" ) ) { + g_TestRun.ppad1dll = param; + g_TestRun.ppad2dll = param; + } + else if( CmdSwitchIs( "pad1" ) ) { + g_TestRun.ppad1dll = param; + } + else if( CmdSwitchIs( "pad2" ) ) { + g_TestRun.ppad2dll = param; + } + else if( CmdSwitchIs( "dev9" ) ) { + g_TestRun.pdev9dll = param; + } #ifdef PCSX2_DEVBUILD else if( CmdSwitchIs( "image" ) ) { diff --git a/pcsx2/windows/pcsx2.rc b/pcsx2/windows/pcsx2.rc index 151680a281..df34a677bd 100644 --- a/pcsx2/windows/pcsx2.rc +++ b/pcsx2/windows/pcsx2.rc @@ -25,16 +25,16 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_DEFAULT // Dialog // -IDD_CMDLINE DIALOG 0, 0, 186, 82 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CMDLINE DIALOGEX 0, 0, 221, 82 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Program arguments" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,36,37,50,14 PUSHBUTTON "Cancel",IDCANCEL,99,37,50,14 - CTEXT "Tip: If you don't know what to write\nleave it blank",IDC_TIP,7,56,172,19,WS_BORDER - EDITTEXT IDC_CMDLINE,7,17,172,14,ES_AUTOHSCROLL - LTEXT "Fill in the command line arguments for the opened program:",IDC_TEXT,7,7,174,8 + CTEXT "Tip: If you don't know what to write\nleave it blank",IDC_TIP,7,56,207,19,WS_BORDER + EDITTEXT IDC_CMDLINE,7,17,207,14,ES_AUTOHSCROLL + LTEXT "Fill in the command line arguments for the opened program:",IDC_TEXT,7,7,207,8 END @@ -49,7 +49,7 @@ BEGIN IDD_CMDLINE, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 179 + RIGHTMARGIN, 214 TOPMARGIN, 7 BOTTOMMARGIN, 75 END @@ -129,10 +129,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog // -IDD_CP0REGS DIALOG 0, 0, 267, 237 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CP0REGS DIALOGEX 0, 0, 267, 237 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "COP0 " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_CP00,48,7,51,12,ES_READONLY LTEXT "Index",-1,7,9,18,8 @@ -190,9 +190,9 @@ BEGIN END IDD_DEBUG DIALOGEX 0, 0, 341, 270 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Debugger" -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN LISTBOX IDC_DEBUG_DISASM,7,6,198,257,LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_TABSTOP,WS_EX_TRANSPARENT SCROLLBAR IDC_DEBUG_SCROLL,205,6,11,257,SBS_VERT @@ -218,9 +218,9 @@ BEGIN END IDD_DUMP DIALOGEX 0, 0, 386, 96 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dump code" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_DUMP_START,73,14,82,13 EDITTEXT IDC_DUMP_END,73,29,82,13 @@ -240,10 +240,10 @@ BEGIN GROUPBOX "IOP",IDC_STATIC,195,7,167,63 END -IDD_GPREGS DIALOG 0, 0, 391, 279 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_GPREGS DIALOGEX 0, 0, 391, 279 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "R5900 Main registers" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_GPR0,22,7,166,12,ES_READONLY LTEXT "R0",-1,7,9,10,8 @@ -317,15 +317,15 @@ BEGIN EDITTEXT IDC_GPR_LO,214,238,165,12,ES_READONLY END -IDD_JUMP DIALOG 0, 0, 175, 64 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +IDD_JUMP DIALOGEX 0, 0, 175, 64 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Jump to specific address" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_JUMP_PC,73,14,82,13 DEFPUSHBUTTON "OK",IDOK,25,43,50,14 PUSHBUTTON "Cancel",IDCANCEL,101,42,50,14 - LTEXT "Enter new PC Address:",IDC_STATIC,3,18,70,8 + LTEXT "Enter new PC Address:",IDC_STATIC,3,16,65,8 END IDD_MEMORY DIALOG 0, 0, 317, 270 @@ -347,10 +347,10 @@ BEGIN PUSHBUTTON "Raw dump",IDC_DUMPRAW,204,7,50,14 END -IDD_VU1INTEGER DIALOG 0, 0, 357, 263 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VU1INTEGER DIALOGEX 0, 0, 357, 263 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VU1 Integer & Control Registers" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_VU1_VI00,29,7,89,12,WS_DISABLED LTEXT "VI00",IDC_STATIC,7,9,16,8 @@ -418,10 +418,10 @@ BEGIN EDITTEXT IDC_VU1_ACC,78,239,166,12,ES_READONLY END -IDD_VU0REGS DIALOG 0, 0, 391, 279 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VU0REGS DIALOGEX 0, 0, 391, 279 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VUO Floating Point Registers" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_VU0_VF00,28,7,166,12,ES_READONLY LTEXT "VF00",-1,7,9,18,8 @@ -489,10 +489,10 @@ BEGIN LTEXT "VF31",-1,196,220,18,8 END -IDD_CP1REGS DIALOG 0, 0, 357, 237 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CP1REGS DIALOGEX 0, 0, 357, 237 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "COP1 Registers " -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_FP0,29,7,89,12,WS_DISABLED LTEXT "FP0",IDC_STATIC,7,9,14,8 @@ -569,10 +569,10 @@ BEGIN EDITTEXT IDC_FPU_ACC,299,68,49,12,ES_AUTOHSCROLL | WS_DISABLED END -IDD_VU0INTEGER DIALOG 0, 0, 357, 263 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VU0INTEGER DIALOGEX 0, 0, 357, 263 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VUO Integer & Control Registers" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_VU0_VI00,29,7,89,12,WS_DISABLED LTEXT "VI00",IDC_STATIC,7,9,16,8 @@ -644,10 +644,10 @@ BEGIN LTEXT "P register",IDC_STATIC,124,108,30,8 END -IDD_VU1REGS DIALOG 0, 0, 391, 279 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_VU1REGS DIALOGEX 0, 0, 391, 279 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "VU1Floating Point Registers" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_VU1_VF00,28,7,166,12,ES_READONLY LTEXT "VF00",-1,7,9,18,8 @@ -749,9 +749,9 @@ BEGIN END IDD_MCDCONF DIALOGEX 0, 0, 466, 261 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Memcard Manager" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,147,236,50,14 PUSHBUTTON "Cancel",IDCANCEL,209,236,50,14 @@ -782,10 +782,10 @@ BEGIN CONTROL "",IDC_LIST2,"SysListView32",LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,262,15,185,143 END -IDD_DUMPMEM DIALOG 0, 0, 175, 95 -STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +IDD_DUMPMEM DIALOGEX 0, 0, 175, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dump memory" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_DUMPMEM_START,73,14,82,13 EDITTEXT IDC_DUMPMEM_END,73,29,82,13 @@ -797,13 +797,6 @@ BEGIN LTEXT "Filename:",IDC_STATIC,19,53,31,8 END -IDD_DIALOGBAR DIALOGEX 0, 0, 330, 16 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "TODO: layout dialog bar",IDC_STATIC,126,4,77,8 -END - IDD_IOPREGS DIALOGEX 0, 0, 417, 295 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "IOP Main Registers" @@ -881,18 +874,6 @@ BEGIN EDITTEXT IDC_IOPGPR_LO,214,252,165,12,ES_READONLY END -IDD_USERNAME DIALOGEX 0, 0, 186, 79 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Enter User Name" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,7,58,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,58,50,14 - LTEXT "Pcsx2 needs to allocate physical memory in order to execute faster. Enter the windows username you wish this privilege to be enabled for.",IDC_STATIC,7,7,172,25 - EDITTEXT IDC_USER_NAME,73,37,106,13,ES_AUTOHSCROLL - LTEXT "User Name:",IDC_STATIC,7,41,38,8 -END - IDD_ADVANCED_OPTIONS DIALOGEX 0, 0, 543, 275 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Advanced Options" @@ -999,14 +980,6 @@ BEGIN BOTTOMMARGIN, 178 END - IDD_DIALOGBAR, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 323 - TOPMARGIN, 7 - BOTTOMMARGIN, 9 - END - IDD_IOPREGS, DIALOG BEGIN LEFTMARGIN, 7 @@ -1015,14 +988,6 @@ BEGIN BOTTOMMARGIN, 284 END - IDD_USERNAME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 72 - END - IDD_ADVANCED_OPTIONS, DIALOG BEGIN LEFTMARGIN, 7 @@ -1081,7 +1046,7 @@ EXSTYLE WS_EX_ACCEPTFILES CAPTION "About PCSX2" FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN - DEFPUSHBUTTON "OK",IDOK,205,273,50,14 + DEFPUSHBUTTON "OK",IDOK,205,274,50,14 CTEXT "PCSX2, a PS2 Emulator...",IDC_PCSX_ABOUT_AUTHORS,9,10,135,127,0,WS_EX_TRANSPARENT CTEXT "Greets to...",IDC_PCSX_ABOUT_GREETS,94,178,319,77 GROUPBOX "",IDC_STATIC,5,3,145,141 @@ -1205,9 +1170,9 @@ BEGIN END IDD_ADD DIALOGEX 3, 1, 145, 74 -STYLE DS_SETFONT | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU CAPTION "Add Cheat" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN PUSHBUTTON "OK",IDOK,37,54,49,15,NOT WS_TABSTOP PUSHBUTTON "Cancel",IDCANCEL,91,54,49,15,NOT WS_TABSTOP @@ -1238,9 +1203,9 @@ BEGIN END IDD_ADDGS DIALOGEX 3, 1, 145, 117 -STYLE DS_SETFONT | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU CAPTION "Add Cheat" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN PUSHBUTTON "Add",IDOK,91,98,49,15,NOT WS_TABSTOP PUSHBUTTON "Convert",IDC_CONVERT,38,98,49,15,NOT WS_TABSTOP @@ -1278,9 +1243,9 @@ BEGIN END IDD_ADDRAW DIALOGEX 3, 1, 145, 71 -STYLE DS_SETFONT | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU CAPTION "Add Cheat" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN PUSHBUTTON "Add",IDOK,91,51,49,15,NOT WS_TABSTOP LTEXT "Enter RAW codes:",-1,5,5,123,10,NOT WS_GROUP @@ -1289,9 +1254,9 @@ BEGIN END IDD_PNACHWRITER DIALOGEX 3, 1, 146, 161 -STYLE DS_SETFONT | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU CAPTION "pnach Writer" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN PUSHBUTTON "Cancel",IDCANCEL,91,141,49,15,NOT WS_TABSTOP PUSHBUTTON "Save",IDC_SAVE,38,141,49,15,NOT WS_TABSTOP @@ -1416,63 +1381,63 @@ LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_ARGENTINA // Dialog // -IDD_CONFIG DIALOGEX 0, 0, 317, 244 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_CONFIG DIALOGEX 0, 0, 331, 247 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Dialog" -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - COMBOBOX IDC_LISTGS,10,15,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGGS,10,35,45,12 - PUSHBUTTON "Test...",IDC_TESTGS,60,35,45,12 - PUSHBUTTON "About...",IDC_ABOUTGS,110,35,45,12 - COMBOBOX IDC_LISTSPU2,166,15,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGSPU2,165,35,45,12 - PUSHBUTTON "Test...",IDC_TESTSPU2,215,35,45,12 - PUSHBUTTON "About...",IDC_ABOUTSPU2,265,35,43,12 - COMBOBOX IDC_LISTCDVD,10,105,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGCDVD,10,125,43,12 - PUSHBUTTON "Test...",IDC_TESTCDVD,60,125,45,12 - PUSHBUTTON "About...",IDC_ABOUTCDVD,110,125,45,12 - COMBOBOX IDC_LISTBIOS,165,196,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,207,223,50,14 - PUSHBUTTON "Cancel",IDCANCEL,260,223,50,14 - CTEXT "Graphics",IDC_GRAPHICS,50,5,62,10,SS_CENTERIMAGE - CTEXT "Sound",IDC_SOUND,200,5,71,10,SS_CENTERIMAGE - CTEXT "Cdvdrom",IDC_CDVDROM,55,95,56,10,SS_CENTERIMAGE - CTEXT "Bios",IDC_BIOS,208,185,61,10,SS_CENTERIMAGE - COMBOBOX IDC_LISTPAD1,10,60,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGPAD1,10,80,45,12 - PUSHBUTTON "Test...",IDC_TESTPAD1,60,80,45,12 - PUSHBUTTON "About...",IDC_ABOUTPAD1,110,80,45,12 - CTEXT "Second Controller",IDC_SECONDCONTROLLER,191,50,90,10,SS_CENTERIMAGE - COMBOBOX IDC_LISTPAD2,166,60,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGPAD2,165,80,45,12 - PUSHBUTTON "Test...",IDC_TESTPAD2,215,80,45,12 - PUSHBUTTON "About...",IDC_ABOUTPAD2,265,80,45,12 - CTEXT "First Controller",IDC_FIRSTCONTROLLER,41,50,82,10,SS_CENTERIMAGE - PUSHBUTTON "Set Bios Directory",IDC_BIOSDIR,14,223,134,14 - PUSHBUTTON "Set Plugins Directory",IDC_PLUGINSDIR,14,204,134,14 - COMBOBOX IDC_LISTDEV9,165,105,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGDEV9,165,125,43,12 - PUSHBUTTON "Test...",IDC_TESTDEV9,215,125,45,12 - PUSHBUTTON "About...",IDC_ABOUTDEV9,265,125,45,12 - CTEXT "Dev9",IDC_DEV9,221,95,30,10,SS_CENTERIMAGE - COMBOBOX IDC_LISTUSB,10,151,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGUSB,10,170,43,12 - PUSHBUTTON "Test...",IDC_TESTUSB,60,170,45,12 - PUSHBUTTON "About...",IDC_ABOUTUSB,110,170,45,12 - CTEXT "Usb",IDC_USB,59,140,47,10,SS_CENTERIMAGE - COMBOBOX IDC_LISTFW,165,151,145,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_CONFIGFW,165,169,43,12 - PUSHBUTTON "Test...",IDC_TESTFW,214,169,45,12 - PUSHBUTTON "About...",IDC_ABOUTFW,265,169,45,12 - CTEXT "FireWire",IDC_FW,206,141,60,8 + COMBOBOX IDC_LISTGS,5,15,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGGS,5,30,50,12 + PUSHBUTTON "Test...",IDC_TESTGS,60,30,47,12 + PUSHBUTTON "About...",IDC_ABOUTGS,111,30,47,12 + COMBOBOX IDC_LISTSPU2,172,15,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGSPU2,172,31,50,12 + PUSHBUTTON "Test...",IDC_TESTSPU2,226,31,47,12 + PUSHBUTTON "About...",IDC_ABOUTSPU2,278,31,47,12 + COMBOBOX IDC_LISTCDVD,5,109,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGCDVD,5,124,50,12 + PUSHBUTTON "Test...",IDC_TESTCDVD,60,124,47,12 + PUSHBUTTON "About...",IDC_ABOUTCDVD,111,124,47,12 + COMBOBOX IDC_LISTBIOS,172,203,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,222,226,50,14 + PUSHBUTTON "Cancel",IDCANCEL,276,226,50,14 + CTEXT "Graphics",IDC_GRAPHICS,5,5,154,8,SS_CENTERIMAGE + CTEXT "Sound",IDC_SOUND,172,5,154,8,SS_CENTERIMAGE + CTEXT "Cdvdrom",IDC_CDVDROM,5,99,154,8,SS_CENTERIMAGE + CTEXT "Bios",IDC_BIOS,172,193,154,8,SS_CENTERIMAGE + COMBOBOX IDC_LISTPAD1,5,63,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGPAD1,5,78,50,12 + PUSHBUTTON "Test...",IDC_TESTPAD1,60,78,47,12 + PUSHBUTTON "About...",IDC_ABOUTPAD1,111,78,47,12 + CTEXT "Second Controller",IDC_SECONDCONTROLLER,172,52,154,8,SS_CENTERIMAGE + COMBOBOX IDC_LISTPAD2,172,63,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGPAD2,172,78,50,12 + PUSHBUTTON "Test...",IDC_TESTPAD2,226,78,47,12 + PUSHBUTTON "About...",IDC_ABOUTPAD2,278,78,47,12 + CTEXT "First Controller",IDC_FIRSTCONTROLLER,5,52,154,8,SS_CENTERIMAGE + PUSHBUTTON "Set Bios Directory",IDC_BIOSDIR,5,226,134,14 + PUSHBUTTON "Set Plugins Directory",IDC_PLUGINSDIR,5,208,134,14 + COMBOBOX IDC_LISTDEV9,172,109,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGDEV9,172,124,50,12 + PUSHBUTTON "Test...",IDC_TESTDEV9,226,124,47,12 + PUSHBUTTON "About...",IDC_ABOUTDEV9,278,124,47,12 + CTEXT "Dev9",IDC_DEV9,173,99,154,8,SS_CENTERIMAGE + COMBOBOX IDC_LISTUSB,5,157,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGUSB,5,172,50,12 + PUSHBUTTON "Test...",IDC_TESTUSB,60,172,47,12 + PUSHBUTTON "About...",IDC_ABOUTUSB,111,172,47,12 + CTEXT "Usb",IDC_USB,5,146,154,8,SS_CENTERIMAGE + COMBOBOX IDC_LISTFW,172,157,154,74,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Configure...",IDC_CONFIGFW,172,172,50,12 + PUSHBUTTON "Test...",IDC_TESTFW,226,172,47,12 + PUSHBUTTON "About...",IDC_ABOUTFW,278,172,47,12 + CTEXT "FireWire",IDC_FW,172,146,154,8 END -IDD_BPEXEC DIALOG 0, 0, 182, 61 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_BPEXEC DIALOGEX 0, 0, 182, 61 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "BreakPoint on Exec" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_EXECBP,92,10,82,13 DEFPUSHBUTTON "OK",IDOK,30,40,50,14 @@ -1480,10 +1445,10 @@ BEGIN LTEXT "Enter BreakPoint Address:",IDC_STATIC,5,13,84,8 END -IDD_BPCNT DIALOG 0, 0, 182, 61 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +IDD_BPCNT DIALOGEX 0, 0, 182, 61 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "BreakPoint on Count" -FONT 8, "MS Sans Serif" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_CNTBP,92,10,82,13 DEFPUSHBUTTON "OK",IDOK,30,40,50,14 @@ -1491,18 +1456,6 @@ BEGIN LTEXT "Enter BreakPoint Count:",IDC_STATIC,5,13,77,8 END -IDD_ADVANCED DIALOGEX 0, 0, 177, 69 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Advanced" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "OK",IDOK,65,47,50,14 - PUSHBUTTON "Cancel",IDCANCEL,121,47,50,14 - CONTROL "Enable Reg Caching",IDC_REGCACHING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,15,81,10 - GROUPBOX "",IDC_STATIC,2,7,168,38 - PUSHBUTTON "Reset",IDC_ADVRESET,5,47,50,14 -END - ///////////////////////////////////////////////////////////////////////////// // @@ -1514,11 +1467,10 @@ GUIDELINES DESIGNINFO BEGIN IDD_CONFIG, DIALOG BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 310 - TOPMARGIN, 7 - BOTTOMMARGIN, 237 - HORZGUIDE, 169 + LEFTMARGIN, 5 + RIGHTMARGIN, 326 + TOPMARGIN, 5 + BOTTOMMARGIN, 240 END IDD_BPEXEC, DIALOG @@ -1536,14 +1488,6 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 54 END - - IDD_ADVANCED, DIALOG - BEGIN - LEFTMARGIN, 2 - RIGHTMARGIN, 170 - TOPMARGIN, 7 - BOTTOMMARGIN, 61 - END END #endif // APSTUDIO_INVOKED @@ -1591,9 +1535,9 @@ BEGIN END IDD_LOGGING DIALOGEX 0, 0, 263, 177 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Logging" -FONT 8, "MS Sans Serif", 0, 0, 0x0 +FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,206,156,50,14 CONTROL "Cpu log",IDC_CPULOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,5,53,10 diff --git a/pcsx2/windows/resource.h b/pcsx2/windows/resource.h index 2878b2170c..1390c7e8ba 100644 --- a/pcsx2/windows/resource.h +++ b/pcsx2/windows/resource.h @@ -25,12 +25,9 @@ #define IDD_RDEBUGPARAMS 121 #define ID_DEBUG_REMOTEDEBUGGING 122 #define IDD_RDEBUG 123 -#define IDD_DIALOGBAR 124 #define IDD_IOP_DEBUG 125 #define IDD_CPUDLG 126 -#define IDD_ADVANCED 127 #define IDD_IOPREGS 128 -#define IDD_USERNAME 129 #define IDB_PS2SILVER 132 #define IDD_CHEATS 133 #define IDD_GAMEFIXES 134 @@ -457,12 +454,6 @@ #define IDC_FAMILYINPUT 1202 #define IDC_CPUSPEEDINPUT 1203 #define IDC_FEATURESINPUT 1204 -#define IDC_REGCACHING 1208 -#define IDC_ADVRESET 1214 -#define IDC_SYNCHACK 1217 -#define IDC_SPU2HACK 1218 -#define IDC_SYNCHACK2 1218 -#define IDC_SYNCHACK3 1219 #define IDC_IOPGPR0 1220 #define IDC_IOPGPR1 1221 #define IDC_IOPGPR2 1222 @@ -500,7 +491,6 @@ #define IDC_BIOSDIR 1254 #define IDC_IOPGPR3 1254 #define IDC_PLUGINSDIR 1255 -#define IDC_USER_NAME 1257 #define IDC_CPU_GSMULTI 1259 #define IDC_PS2SILVER_RECT 1259 #define IDC_CPU_EEREC 1262 @@ -539,7 +529,6 @@ #define IDC_DATA 1282 #define IDC_PNACHWRITER 1282 #define IDC_CUSTOM_CONSECUTIVE_SKIP 1282 -#define IDC_PNACHWRITER2 1283 #define IDC_SKIPMPEG 1283 #define IDC_FRAMESKIP_LABEL4 1283 #define IDC_SPIN1 1284 @@ -568,7 +557,6 @@ #define IDC_FRAMELIMIT_OPTIONS 1303 #define IDC_VU_CHECK2 1303 #define IDC_GAMEFIX4 1303 -#define IDC_SOUNDHACK2 1304 #define IDC_ESCHACK 1304 #define IDC_VU_CHECK3 1304 #define IDC_GAMEFIX5 1304 diff --git a/pcsx2_2008.sln b/pcsx2_2008.sln deleted file mode 100644 index 49c7c5678f..0000000000 --- a/pcsx2_2008.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2\windows\VCprojects\pcsx2_2008.vcproj", "{1CEFD830-2B76-4596-A4EE-BCD7280A60BD}" - ProjectSection(ProjectDependencies) = postProject - {26511268-2902-4997-8421-ECD7055F9E28} = {26511268-2902-4997-8421-ECD7055F9E28} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthreads", "pcsx2\windows\VCprojects\pthreads_2008.vcproj", "{26511268-2902-4997-8421-ECD7055F9E28}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Devel|Win32 = Devel|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug|Win32.ActiveCfg = Debug|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug|Win32.Build.0 = Debug|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel|Win32.ActiveCfg = Devel|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel|Win32.Build.0 = Devel|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release|Win32.ActiveCfg = Release|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release|Win32.Build.0 = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.ActiveCfg = Debug|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.Build.0 = Debug|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.ActiveCfg = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.Build.0 = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Release|Win32.ActiveCfg = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/pcsx2_suite_2008.sln b/pcsx2_suite_2008.sln index 4ee9cebabb..3da5e8ef3d 100644 --- a/pcsx2_suite_2008.sln +++ b/pcsx2_suite_2008.sln @@ -6,77 +6,275 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pcsx2", "pcsx2\windows\VCpr {26511268-2902-4997-8421-ECD7055F9E28} = {26511268-2902-4997-8421-ECD7055F9E28} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthreads", "pcsx2\windows\VCprojects\pthreads_2008.vcproj", "{26511268-2902-4997-8421-ECD7055F9E28}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroGS", "plugins\zerogs\dx\Win32\zerogs_2008.vcproj", "{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroSPU2", "plugins\zerospu2\Win32\ZeroSPU2_2008.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}" + ProjectSection(ProjectDependencies) = postProject + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDiso", "plugins\CDVDiso\src\Win32\CDVDiso_vs2008.vcproj", "{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroPAD", "plugins\zeropad\Windows\ZeroPAD_2008.vcproj", "{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}" + ProjectSection(ProjectDependencies) = postProject + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} + {F4EB4AB2-C595-4B05-8BC0-059024BC796C} = {F4EB4AB2-C595-4B05-8BC0-059024BC796C} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPU2-X", "plugins\spu2-x\src\Win32\Spu2-X_vs2008.vcproj", "{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}" + ProjectSection(ProjectDependencies) = postProject + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} = {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GSdx", "plugins\GSdx\GSdx_vs2008.vcproj", "{18E42F6F-3A62-41EE-B42F-79366C4F1E95}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "3rdparty\SoundTouch\SoundTouch.vcproj", "{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "3rdparty\zlib\zlib.vcproj", "{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "3rdparty\bzip2\bzip2.vcproj", "{F4EB4AB2-C595-4B05-8BC0-059024BC796C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LilyPad", "plugins\LilyPad\LilyPad_VC2008.vcproj", "{E4081455-398C-4610-A87C-90A8A7D72DC3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthreads", "3rdparty\w32pthreads\pthreads_2008.vcproj", "{26511268-2902-4997-8421-ECD7055F9E28}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroSPU2", "plugins\zerospu2\Win32\ZeroSPU2_2008.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}" + ProjectSection(ProjectDependencies) = postProject + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} = {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} + {26511268-2902-4997-8421-ECD7055F9E28} = {26511268-2902-4997-8421-ECD7055F9E28} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xpad", "plugins\xpad\xpad_vs2008.vcproj", "{6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDolio", "plugins\CDVDolio\cdvd_vs2008.vcproj", "{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDnull", "plugins\CDVDnull\Src\CDVDnull_vs2008.vcproj", "{F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBnull", "plugins\USBnull\Win32\USBnull_vc2008.vcproj", "{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FWnull", "plugins\FWnull\Win32\FWnull_vc2008.vcproj", "{3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DEV9null", "plugins\dev9null\src\DEV9null_vc2008.vcproj", "{04439C5F-05FB-4A9C-AAD1-5388C25377DB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Nulls", "Nulls", "{E1828E40-2FBB-48FE-AE7F-5587755DCE0E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rdparty", "3rdparty", "{78EBE642-7A4D-4EA7-86BE-5639C6646C38}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zerofrog", "Zerofrog", "{4CFBEFA8-2D4F-4B62-99D4-7E54F95B3FD9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroPAD", "plugins\zeropad\Windows\ZeroPAD_2008.vcproj", "{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}" + ProjectSection(ProjectDependencies) = postProject + {26511268-2902-4997-8421-ECD7055F9E28} = {26511268-2902-4997-8421-ECD7055F9E28} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{703FD00B-D7A0-41E3-BD03-CEC86B385DAF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Devel|Win32 = Devel|Win32 - Release|Win32 = Release|Win32 + Release SSE2|Win32 = Release SSE2|Win32 + Release SSE4|Win32 = Release SSE4|Win32 + Release SSSE3|Win32 = Release SSSE3|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug|Win32.ActiveCfg = Debug|Win32 {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Debug|Win32.Build.0 = Debug|Win32 {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel|Win32.ActiveCfg = Devel|Win32 {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Devel|Win32.Build.0 = Devel|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release|Win32.ActiveCfg = Release|Win32 - {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release|Win32.Build.0 = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.ActiveCfg = Debug|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.Build.0 = Debug|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.ActiveCfg = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.Build.0 = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Release|Win32.ActiveCfg = Release|Win32 - {26511268-2902-4997-8421-ECD7055F9E28}.Release|Win32.Build.0 = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSE2|Win32.Build.0 = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSE4|Win32.Build.0 = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {1CEFD830-2B76-4596-A4EE-BCD7280A60BD}.Release SSSE3|Win32.Build.0 = Release|Win32 {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Debug|Win32.ActiveCfg = Debug|Win32 {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Debug|Win32.Build.0 = Debug|Win32 {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Devel|Win32.ActiveCfg = Devel|Win32 {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Devel|Win32.Build.0 = Devel|Win32 - {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release|Win32.ActiveCfg = Release|Win32 - {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release|Win32.Build.0 = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.Build.0 = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Devel|Win32.ActiveCfg = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Devel|Win32.Build.0 = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.ActiveCfg = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.Build.0 = Release|Win32 + {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release SSSE3|Win32.Build.0 = Release|Win32 {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.ActiveCfg = Debug|Win32 {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.Build.0 = Debug|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.ActiveCfg = Release|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.Build.0 = Release|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.ActiveCfg = Release|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.Build.0 = Release|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.ActiveCfg = Debug|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.Build.0 = Debug|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Devel|Win32.ActiveCfg = Release|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Devel|Win32.Build.0 = Release|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.ActiveCfg = Release|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.Build.0 = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.ActiveCfg = Devel|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.Build.0 = Devel|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSE2|Win32.Build.0 = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSE4|Win32.Build.0 = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release SSSE3|Win32.Build.0 = Release|Win32 {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.ActiveCfg = Debug|Win32 {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.Build.0 = Debug|Win32 {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.ActiveCfg = Devel|Win32 {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.Build.0 = Devel|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.ActiveCfg = Release|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.Build.0 = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSE2|Win32.Build.0 = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSE4|Win32.Build.0 = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release SSSE3|Win32.Build.0 = Release|Win32 {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.ActiveCfg = Debug SSE2|Win32 {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.Build.0 = Debug SSE2|Win32 {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|Win32.ActiveCfg = Release SSE2|Win32 {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Devel|Win32.Build.0 = Release SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.ActiveCfg = Release SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.Build.0 = Release SSE2|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.ActiveCfg = Release SSE2|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.Build.0 = Release SSE2|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.ActiveCfg = Release SSE4|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.Build.0 = Release SSE4|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.ActiveCfg = Release SSSE3|Win32 + {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.Build.0 = Release SSSE3|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Debug|Win32.ActiveCfg = Debug|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Debug|Win32.Build.0 = Debug|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Devel|Win32.ActiveCfg = Devel|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Devel|Win32.Build.0 = Devel|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSE2|Win32.Build.0 = Release|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSE4|Win32.Build.0 = Release|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Release SSSE3|Win32.Build.0 = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.ActiveCfg = Debug|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Debug|Win32.Build.0 = Debug|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.ActiveCfg = Devel|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Devel|Win32.Build.0 = Devel|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSE2|Win32.Build.0 = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSE4|Win32.Build.0 = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release SSSE3|Win32.Build.0 = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Debug|Win32.ActiveCfg = Debug|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Debug|Win32.Build.0 = Debug|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Devel|Win32.ActiveCfg = Devel|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Devel|Win32.Build.0 = Devel|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSE2|Win32.Build.0 = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSE4|Win32.Build.0 = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release SSSE3|Win32.Build.0 = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|Win32.ActiveCfg = Debug|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|Win32.Build.0 = Debug|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Devel|Win32.ActiveCfg = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Devel|Win32.Build.0 = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSE2|Win32.Build.0 = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSE4|Win32.Build.0 = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release SSSE3|Win32.Build.0 = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.ActiveCfg = Debug|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Debug|Win32.Build.0 = Debug|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.ActiveCfg = Devel|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Devel|Win32.Build.0 = Devel|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSE2|Win32.Build.0 = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSE4|Win32.Build.0 = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {26511268-2902-4997-8421-ECD7055F9E28}.Release SSSE3|Win32.Build.0 = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.ActiveCfg = Debug|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.Build.0 = Debug|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Devel|Win32.ActiveCfg = Devel|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Devel|Win32.Build.0 = Devel|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSE2|Win32.Build.0 = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSE4|Win32.Build.0 = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release SSSE3|Win32.Build.0 = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Debug|Win32.ActiveCfg = Debug|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Debug|Win32.Build.0 = Debug|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Devel|Win32.ActiveCfg = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Devel|Win32.Build.0 = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSE2|Win32.Build.0 = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSE4|Win32.Build.0 = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A}.Release SSSE3|Win32.Build.0 = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|Win32.ActiveCfg = Debug|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|Win32.Build.0 = Debug|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|Win32.ActiveCfg = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|Win32.Build.0 = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSE2|Win32.Build.0 = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSE4|Win32.Build.0 = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release SSSE3|Win32.Build.0 = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Debug|Win32.ActiveCfg = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Debug|Win32.Build.0 = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Devel|Win32.ActiveCfg = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Devel|Win32.Build.0 = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSE2|Win32.Build.0 = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSE4|Win32.Build.0 = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release SSSE3|Win32.Build.0 = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win32.ActiveCfg = Debug|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win32.Build.0 = Debug|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Devel|Win32.ActiveCfg = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Devel|Win32.Build.0 = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSE2|Win32.Build.0 = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSE4|Win32.Build.0 = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release SSSE3|Win32.Build.0 = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Debug|Win32.Build.0 = Debug|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|Win32.ActiveCfg = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Devel|Win32.Build.0 = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE2|Win32.Build.0 = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSE4|Win32.Build.0 = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C}.Release SSSE3|Win32.Build.0 = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Debug|Win32.ActiveCfg = Debug|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Debug|Win32.Build.0 = Debug|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Devel|Win32.ActiveCfg = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Devel|Win32.Build.0 = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSE2|Win32.Build.0 = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSE4|Win32.Build.0 = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {04439C5F-05FB-4A9C-AAD1-5388C25377DB}.Release SSSE3|Win32.Build.0 = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.ActiveCfg = Debug|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.Build.0 = Debug|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Devel|Win32.ActiveCfg = Devel|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Devel|Win32.Build.0 = Devel|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSE2|Win32.ActiveCfg = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSE2|Win32.Build.0 = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSE4|Win32.ActiveCfg = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSE4|Win32.Build.0 = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSSE3|Win32.ActiveCfg = Release|Win32 + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release SSSE3|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {18E42F6F-3A62-41EE-B42F-79366C4F1E95} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {E4081455-398C-4610-A87C-90A8A7D72DC3} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {4CFBEFA8-2D4F-4B62-99D4-7E54F95B3FD9} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {6F3C4136-5801-4EBC-AC6E-37DF6FAB150A} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {E1828E40-2FBB-48FE-AE7F-5587755DCE0E} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF} + {2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} + {F4EB4AB2-C595-4B05-8BC0-059024BC796C} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} + {26511268-2902-4997-8421-ECD7055F9E28} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} + {E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38} + {7F059854-568D-4E08-9D00-1E78E203E4DC} = {4CFBEFA8-2D4F-4B62-99D4-7E54F95B3FD9} + {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022} = {4CFBEFA8-2D4F-4B62-99D4-7E54F95B3FD9} + {5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8} = {4CFBEFA8-2D4F-4B62-99D4-7E54F95B3FD9} + {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E} + {3D0EB14D-32F3-4D82-9C6D-B806ADBB859C} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E} + {04439C5F-05FB-4A9C-AAD1-5388C25377DB} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E} + {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0} = {E1828E40-2FBB-48FE-AE7F-5587755DCE0E} + EndGlobalSection EndGlobal diff --git a/plugins/CDVDiso/src/3rdparty/zlib/ChangeLog b/plugins/CDVDiso/src/3rdparty/zlib/ChangeLog deleted file mode 100644 index 7f6869d323..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/ChangeLog +++ /dev/null @@ -1,855 +0,0 @@ - - ChangeLog file for zlib - -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Added zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -Changes in 1.2.2 (3 October 2004) -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/plugins/CDVDiso/src/3rdparty/zlib/Makefile.am b/plugins/CDVDiso/src/3rdparty/zlib/Makefile.am deleted file mode 100644 index ff26496e22..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_LIBRARIES = libpcsx2zlib.a - -libpcsx2zlib_a_SOURCES = \ -adler32.c crc32.c deflate.h inffast.c inflate.c inftrees.h trees.h zlib.h \ -crc32.h gzio.c inffast.h inflate.h uncompr.c zutil.c \ -compress.c deflate.c infback.c inffixed.h inftrees.c trees.c zconf.h zutil.h diff --git a/plugins/CDVDiso/src/3rdparty/zlib/README b/plugins/CDVDiso/src/3rdparty/zlib/README deleted file mode 100644 index 758cc50020..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/README +++ /dev/null @@ -1,125 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.3 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). These documents are also available in other -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile. In short "make test; make install" should work for most -machines. For Unix: "./configure; make test; make install". For MSDOS, use one -of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, -please check this site to verify that you have the latest version of zlib; -otherwise get the latest version and check whether the problem still exists or -not. - -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking -for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://dogma.net/markn/articles/zlibtool/zlibtool.htm - -The changes made in version 1.2.3 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html -See the zlib home page http://www.zlib.org for details. - -A Perl interface to zlib written by Paul Marquess is in the -CPAN (Comprehensive Perl Archive Network) sites -http://www.cpan.org/modules/by-module/Compress/ - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries is -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - -- When building a shared, i.e. dynamic library on Mac OS X, the library must be - installed before testing (do "make install" before "make test"), since the - library location is specified in the library. - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. Please -read the FAQ for more information on the distribution of modified source -versions. diff --git a/plugins/CDVDiso/src/3rdparty/zlib/adler32.c b/plugins/CDVDiso/src/3rdparty/zlib/adler32.c deleted file mode 100644 index 007ba26277..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/adler32.c +++ /dev/null @@ -1,149 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -#define BASE 65521UL /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware */ -#ifdef NO_DIVIDE -# define MOD(a) \ - do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD4(a) \ - do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD4(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 > BASE) sum1 -= BASE; - if (sum1 > BASE) sum1 -= BASE; - if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); - if (sum2 > BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/compress.c b/plugins/CDVDiso/src/3rdparty/zlib/compress.c deleted file mode 100644 index df04f0148e..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/compress.c +++ /dev/null @@ -1,79 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/crc32.c b/plugins/CDVDiso/src/3rdparty/zlib/crc32.c deleted file mode 100644 index f658a9ef55..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/crc32.c +++ /dev/null @@ -1,423 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -#define local static - -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - -/* Definitions for doing the crc four data bytes at a time. */ -#ifdef BYFOUR -# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - unsigned long c; - int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (unsigned long)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = REV(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const unsigned long FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const unsigned long FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -#ifdef BYFOUR - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = (u4)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = REV((u4)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const u4 FAR *)(const void FAR *)buf; - buf4--; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf4++; - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(REV(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case */ - if (len2 == 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320L; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/crc32.h b/plugins/CDVDiso/src/3rdparty/zlib/crc32.h deleted file mode 100644 index 8053b6117c..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const unsigned long FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/plugins/CDVDiso/src/3rdparty/zlib/deflate.c b/plugins/CDVDiso/src/3rdparty/zlib/deflate.c deleted file mode 100644 index 29ce1f64a5..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/deflate.c +++ /dev/null @@ -1,1736 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifndef FASTEST -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif -#endif -local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; - - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); - - if (length < MIN_MATCH) return Z_OK; - if (length > MAX_DIST(s)) { - length = MAX_DIST(s); - dictionary += dictLength - length; /* use the tail of the dictionary */ - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - lm_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if (func != configuration_table[level].func && strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_PARTIAL_FLUSH); - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; - s->nice_match = nice_length; - s->max_chain_length = max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds - * for every combination of windowBits and memLevel, as well as wrap. - * But even the conservative upper bound of about 14% expansion does not - * seem onerous for output buffer allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong destLen; - - /* conservative upper bound */ - destLen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; - - /* if can't get parameters, return conservative bound */ - if (strm == Z_NULL || strm->state == Z_NULL) - return destLen; - - /* if not default parameters, return conservative bound */ - s = strm->state; - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return destLen; - - /* default settings: return tight bound for that case */ - return compressBound(sourceLen); -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len = strm->state->pending; - - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, strm->state->pending_out, len); - strm->next_out += len; - strm->state->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_FINISH || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } -#ifdef GZIP - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; - } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; - } - } - else - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } - } - else - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; - } - else - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) - flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - } - } - else - s->status = BUSY_STATE; - } -#endif - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy(dest, source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy(ds, ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); - } -#endif - zmemcpy(buf, strm->next_in, len); - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ -#endif /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for level == 1 or strategy == Z_RLE only - */ -local uInt longest_match_fast(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - /* %%% avoid this when Z_RLE */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) return; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, eof) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (eof)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, eof) { \ - FLUSH_BLOCK_ONLY(s, eof); \ - if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ -#ifdef FASTEST - if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || - (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { - s->match_length = longest_match_fast (s, hash_head); - } -#else - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } -#endif - /* longest_match() or longest_match_fast() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } - /* longest_match() or longest_match_fast() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif /* FASTEST */ - -#if 0 -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt run; /* length of run */ - uInt max; /* maximum length of run */ - uInt prev; /* byte at distance one to match */ - Bytef *scan; /* scan for end of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest encodable run. - */ - if (s->lookahead < MAX_MATCH) { - fill_window(s); - if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - run = 0; - if (s->strstart > 0) { /* if there is a previous byte, that is */ - max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; - scan = s->window + s->strstart - 1; - prev = *scan++; - do { - if (*scan++ != prev) - break; - } while (++run < max); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (run >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, run); - _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); - s->lookahead -= run; - s->strstart += run; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif diff --git a/plugins/CDVDiso/src/3rdparty/zlib/deflate.h b/plugins/CDVDiso/src/3rdparty/zlib/deflate.h deleted file mode 100644 index 05a5ab3a2c..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/deflate.h +++ /dev/null @@ -1,331 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2004 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - - /* in trees.c */ -void _tr_init OF((deflate_state *s)); -int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); -void _tr_align OF((deflate_state *s)); -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch _length_code[]; - extern uch _dist_code[]; -#else - extern const uch _length_code[]; - extern const uch _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/plugins/CDVDiso/src/3rdparty/zlib/gzio.c b/plugins/CDVDiso/src/3rdparty/zlib/gzio.c deleted file mode 100644 index b3c59ecd4c..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/gzio.c +++ /dev/null @@ -1,1026 +0,0 @@ -/* gzio.c -- IO on .gz files - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. - */ - -/* @(#) $Id$ */ - -#include - -#include "zutil.h" - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef Z_BUFSIZE -# ifdef MAXSEG_64K -# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ -# else -# define Z_BUFSIZE 16384 -# endif -#endif -#ifndef Z_PRINTF_BUFSIZE -# define Z_PRINTF_BUFSIZE 4096 -#endif - -#ifdef __MVS__ -# pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern void free OF((voidpf ptr)); -#endif - -#define ALLOC(size) malloc(size) -#define TRYFREE(p) {if (p) free(p);} - -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define RESERVED 0xE0 /* bits 5..7: reserved */ - -typedef struct gz_stream { - z_stream stream; - int z_err; /* error code for last stream operation */ - int z_eof; /* set if end of input file */ - FILE *file; /* .gz file */ - Byte *inbuf; /* input buffer */ - Byte *outbuf; /* output buffer */ - uLong crc; /* crc32 of uncompressed data */ - char *msg; /* error message */ - char *path; /* path name for debugging only */ - int transparent; /* 1 if input file is not a .gz file */ - char mode; /* 'w' or 'r' */ - z_off_t start; /* start of compressed data in file (header skipped) */ - z_off_t in; /* bytes into deflate or inflate */ - z_off_t out; /* bytes out of deflate or inflate */ - int back; /* one character push-back */ - int last; /* true if push-back is last character */ -} gz_stream; - - -local gzFile gz_open OF((const char *path, const char *mode, int fd)); -local int do_flush OF((gzFile file, int flush)); -local int get_byte OF((gz_stream *s)); -local void check_header OF((gz_stream *s)); -local int destroy OF((gz_stream *s)); -local void putLong OF((FILE *file, uLong x)); -local uLong getLong OF((gz_stream *s)); - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb"). The file is given either by file descriptor - or path name (if fd == -1). - gz_open returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -*/ -local gzFile gz_open (path, mode, fd) - const char *path; - const char *mode; - int fd; -{ - int err; - int level = Z_BEST_SPEED; /* compression level */ - int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ - char *p = (char*)mode; - gz_stream *s; - char fmode[80]; /* copy of mode, without the compression level */ - char *m = fmode; - - if (!path || !mode) return Z_NULL; - - s = (gz_stream *)ALLOC(sizeof(gz_stream)); - if (!s) return Z_NULL; - - s->stream.zalloc = (alloc_func)0; - s->stream.zfree = (free_func)0; - s->stream.opaque = (voidpf)0; - s->stream.next_in = s->inbuf = Z_NULL; - s->stream.next_out = s->outbuf = Z_NULL; - s->stream.avail_in = s->stream.avail_out = 0; - s->file = NULL; - s->z_err = Z_OK; - s->z_eof = 0; - s->in = 0; - s->out = 0; - s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); - s->msg = NULL; - s->transparent = 0; - - s->path = (char*)ALLOC(strlen(path)+1); - if (s->path == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - strcpy(s->path, path); /* do this early for debugging */ - - s->mode = '\0'; - do { - if (*p == 'r') s->mode = 'r'; - if (*p == 'w' || *p == 'a') s->mode = 'w'; - if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else if (*p == 'R') { - strategy = Z_RLE; - } else { - *m++ = *p; /* copy the mode */ - } - } while (*p++ && m != fmode + sizeof(fmode)); - if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateInit2(&(s->stream), level, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); - /* windowBits is passed < 0 to suppress zlib header */ - - s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); -#endif - if (err != Z_OK || s->outbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } else { - s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); - - err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are - * present after the compressed stream. - */ - if (err != Z_OK || s->inbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } - s->stream.avail_out = Z_BUFSIZE; - - errno = 0; - s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); - - if (s->file == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - if (s->mode == 'w') { - /* Write a very simple .gz header: - */ - fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->start = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an - * fflush on some systems. This version of the library doesn't use - * start anyway in write mode, so this initialization is not - * necessary. - */ - } else { - check_header(s); /* skip the .gz header */ - s->start = ftell(s->file) - s->stream.avail_in; - } - - return (gzFile)s; -} - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. -*/ -gzFile ZEXPORT gzopen (path, mode) - const char *path; - const char *mode; -{ - return gz_open (path, mode, -1); -} - -/* =========================================================================== - Associate a gzFile with the file descriptor fd. fd is not dup'ed here - to mimic the behavio(u)r of fdopen. -*/ -gzFile ZEXPORT gzdopen (fd, mode) - int fd; - const char *mode; -{ - char name[46]; /* allow for up to 128-bit integers */ - - if (fd < 0) return (gzFile)Z_NULL; - sprintf(name, "", fd); /* for debugging */ - - return gz_open (name, mode, fd); -} - -/* =========================================================================== - * Update the compression level and strategy - */ -int ZEXPORT gzsetparams (file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - /* Make room to allow flushing */ - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; - } - - return deflateParams (&(s->stream), level, strategy); -} - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ -local int get_byte(s) - gz_stream *s; -{ - if (s->z_eof) return EOF; - if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; - } - s->stream.avail_in--; - return *(s->stream.next_in)++; -} - -/* =========================================================================== - Check the gzip header of a gz_stream opened for reading. Set the stream - mode to transparent if the gzip magic header is not present; set s->err - to Z_DATA_ERROR if the magic header is present but the rest of the header - is incorrect. - IN assertion: the stream s has already been created sucessfully; - s->stream.avail_in is zero for the first time, but may be non-zero - for concatenated .gz files. -*/ -local void check_header(s) - gz_stream *s; -{ - int method; /* method byte */ - int flags; /* flags byte */ - uInt len; - int c; - - /* Assure two bytes in the buffer so we can peek ahead -- handle case - where first byte of header is at the end of the buffer after the last - gzip segment */ - len = s->stream.avail_in; - if (len < 2) { - if (len) s->inbuf[0] = s->stream.next_in[0]; - errno = 0; - len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); - if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; - s->stream.avail_in += len; - s->stream.next_in = s->inbuf; - if (s->stream.avail_in < 2) { - s->transparent = s->stream.avail_in; - return; - } - } - - /* Peek ahead to check the gzip magic header */ - if (s->stream.next_in[0] != gz_magic[0] || - s->stream.next_in[1] != gz_magic[1]) { - s->transparent = 1; - return; - } - s->stream.avail_in -= 2; - s->stream.next_in += 2; - - /* Check the rest of the gzip header */ - method = get_byte(s); - flags = get_byte(s); - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; - } - - /* Discard time, xflags and OS code: */ - for (len = 0; len < 6; len++) (void)get_byte(s); - - if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; - } - if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); - } - s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; -} - - /* =========================================================================== - * Cleanup then free the given gz_stream. Return a zlib error code. - Try freeing in the reverse order of allocations. - */ -local int destroy (s) - gz_stream *s; -{ - int err = Z_OK; - - if (!s) return Z_STREAM_ERROR; - - TRYFREE(s->msg); - - if (s->stream.state != NULL) { - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateEnd(&(s->stream)); -#endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } - } - if (s->file != NULL && fclose(s->file)) { -#ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ -#endif - err = Z_ERRNO; - } - if (s->z_err < 0) err = s->z_err; - - TRYFREE(s->inbuf); - TRYFREE(s->outbuf); - TRYFREE(s->path); - TRYFREE(s); - return err; -} - -/* =========================================================================== - Reads the given number of uncompressed bytes from the compressed file. - gzread returns the number of bytes actually read (0 for end of file). -*/ -int ZEXPORT gzread (file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - Bytef *start = (Bytef*)buf; /* starting point for crc computation */ - Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ - - if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; - - if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; - if (s->z_err == Z_STREAM_END) return 0; /* EOF */ - - next_out = (Byte*)buf; - s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; - - if (s->stream.avail_out && s->back != EOF) { - *next_out++ = s->back; - s->stream.next_out++; - s->stream.avail_out--; - s->back = EOF; - s->out++; - start++; - if (s->last) { - s->z_err = Z_STREAM_END; - return 1; - } - } - - while (s->stream.avail_out != 0) { - - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= - (uInt)fread(next_out, 1, s->stream.avail_out, s->file); - } - len -= s->stream.avail_out; - s->in += len; - s->out += len; - if (len == 0) s->z_eof = 1; - return (int)len; - } - if (s->stream.avail_in == 0 && !s->z_eof) { - - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) { - s->z_err = Z_ERRNO; - break; - } - } - s->stream.next_in = s->inbuf; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; - - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); - /* The uncompressed length returned by above getlong() may be - * different from s->out in case of concatenated .gz files. - * Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - inflateReset(&(s->stream)); - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; - } - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - - if (len == s->stream.avail_out && - (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) - return -1; - return (int)(len - s->stream.avail_out); -} - - -/* =========================================================================== - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ -int ZEXPORT gzgetc(file) - gzFile file; -{ - unsigned char c; - - return gzread(file, &c, 1) == 1 ? c : -1; -} - - -/* =========================================================================== - Push one byte back onto the stream. -*/ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; - s->back = c; - s->out--; - s->last = (s->z_err == Z_STREAM_END); - if (s->last) s->z_err = Z_OK; - s->z_eof = 0; - return c; -} - - -/* =========================================================================== - Reads bytes from the compressed file until len-1 characters are - read, or a newline character is read and transferred to buf, or an - end-of-file condition is encountered. The string is then terminated - with a null character. - gzgets returns buf, or Z_NULL in case of error. - - The current implementation is not optimized at all. -*/ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - char *b = buf; - if (buf == Z_NULL || len <= 0) return Z_NULL; - - while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; - *buf = '\0'; - return b == buf && len > 0 ? Z_NULL : b; -} - - -#ifndef NO_GZCOMPRESS -/* =========================================================================== - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of bytes actually written (0 in case of error). -*/ -int ZEXPORT gzwrite (file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.next_in = (Bytef*)buf; - s->stream.avail_in = len; - - while (s->stream.avail_in != 0) { - - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - break; - } - s->stream.avail_out = Z_BUFSIZE; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - if (s->z_err != Z_OK) break; - } - s->crc = crc32(s->crc, (const Bytef *)buf, len); - - return (int)(len - s->stream.avail_in); -} - - -/* =========================================================================== - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ -#ifdef STDC -#include - -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) -{ - char buf[Z_PRINTF_BUFSIZE]; - va_list va; - int len; - - buf[sizeof(buf) - 1] = 0; - va_start(va, format); -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(buf, format, va); - va_end(va); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = vsprintf(buf, format, va); - va_end(va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(buf, sizeof(buf), format, va); - va_end(va); - len = strlen(buf); -# else - len = vsnprintf(buf, sizeof(buf), format, va); - va_end(va); -# endif -#endif - if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, (unsigned)len); -} -#else /* not ANSI C */ - -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - char buf[Z_PRINTF_BUFSIZE]; - int len; - - buf[sizeof(buf) - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(buf); -# else - len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, len); -} -#endif - -/* =========================================================================== - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char cc = (unsigned char) c; /* required for big endian systems */ - - return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; -} - - -/* =========================================================================== - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ -int ZEXPORT gzputs(file, s) - gzFile file; - const char *s; -{ - return gzwrite(file, (char*)s, (unsigned)strlen(s)); -} - - -/* =========================================================================== - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. -*/ -local int do_flush (file, flush) - gzFile file; - int flush; -{ - uInt len; - int done = 0; - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.avail_in = 0; /* should be zero already anyway */ - - for (;;) { - len = Z_BUFSIZE - s->stream.avail_out; - - if (len != 0) { - if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { - s->z_err = Z_ERRNO; - return Z_ERRNO; - } - s->stream.next_out = s->outbuf; - s->stream.avail_out = Z_BUFSIZE; - } - if (done) break; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), flush); - s->out -= s->stream.avail_out; - - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; - - /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: - */ - done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - - if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; - } - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} - -int ZEXPORT gzflush (file, flush) - gzFile file; - int flush; -{ - gz_stream *s = (gz_stream*)file; - int err = do_flush (file, flush); - - if (err) return err; - fflush(s->file); - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} -#endif /* NO_GZCOMPRESS */ - -/* =========================================================================== - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error. - SEEK_END is not implemented, returns error. - In this version of the library, gzseek can be extremely slow. -*/ -z_off_t ZEXPORT gzseek (file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; - } - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return -1L; -#else - if (whence == SEEK_SET) { - offset -= s->in; - } - if (offset < 0) return -1L; - - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - if (s->inbuf == Z_NULL) return -1L; - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; - - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; - - offset -= size; - } - return s->in; -#endif - } - /* Rest of function is for reading only */ - - /* compute absolute position */ - if (whence == SEEK_CUR) { - offset += s->out; - } - if (offset < 0) return -1L; - - if (s->transparent) { - /* map to fseek */ - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - - s->in = s->out = offset; - return offset; - } - - /* For a negative seek, rewind and use positive seek */ - if (offset >= s->out) { - offset -= s->out; - } else if (gzrewind(file) < 0) { - return -1L; - } - /* offset is now the number of bytes to skip. */ - - if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); - if (s->outbuf == Z_NULL) return -1L; - } - if (offset && s->back != EOF) { - s->back = EOF; - s->out++; - offset--; - if (s->last) s->z_err = Z_STREAM_END; - } - while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; - - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; - } - return s->out; -} - -/* =========================================================================== - Rewinds input file. -*/ -int ZEXPORT gzrewind (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return -1; - - s->z_err = Z_OK; - s->z_eof = 0; - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - s->crc = crc32(0L, Z_NULL, 0); - if (!s->transparent) (void)inflateReset(&s->stream); - s->in = 0; - s->out = 0; - return fseek(s->file, s->start, SEEK_SET); -} - -/* =========================================================================== - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -*/ -z_off_t ZEXPORT gztell (file) - gzFile file; -{ - return gzseek(file, 0L, SEEK_CUR); -} - -/* =========================================================================== - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ -int ZEXPORT gzeof (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - /* With concatenated compressed files that can have embedded - * crc trailers, z_eof is no longer the only/best indicator of EOF - * on a gz_stream. Handle end-of-stream error explicitly here. - */ - if (s == NULL || s->mode != 'r') return 0; - if (s->z_eof) return 1; - return s->z_err == Z_STREAM_END; -} - -/* =========================================================================== - Returns 1 if reading and doing so transparently, otherwise zero. -*/ -int ZEXPORT gzdirect (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return 0; - return s->transparent; -} - -/* =========================================================================== - Outputs a long in LSB order to the given file -*/ -local void putLong (file, x) - FILE *file; - uLong x; -{ - int n; - for (n = 0; n < 4; n++) { - fputc((int)(x & 0xff), file); - x >>= 8; - } -} - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets z_err in case - of error. -*/ -local uLong getLong (s) - gz_stream *s; -{ - uLong x = (uLong)get_byte(s); - int c; - - x += ((uLong)get_byte(s))<<8; - x += ((uLong)get_byte(s))<<16; - c = get_byte(s); - if (c == EOF) s->z_err = Z_DATA_ERROR; - x += ((uLong)c)<<24; - return x; -} - -/* =========================================================================== - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. -*/ -int ZEXPORT gzclose (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return Z_STREAM_ERROR; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return Z_STREAM_ERROR; -#else - if (do_flush (file, Z_FINISH) != Z_OK) - return destroy((gz_stream*)file); - - putLong (s->file, s->crc); - putLong (s->file, (uLong)(s->in & 0xffffffff)); -#endif - } - return destroy((gz_stream*)file); -} - -#ifdef STDC -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -/* =========================================================================== - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ -const char * ZEXPORT gzerror (file, errnum) - gzFile file; - int *errnum; -{ - char *m; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) { - *errnum = Z_STREAM_ERROR; - return (const char*)ERR_MSG(Z_STREAM_ERROR); - } - *errnum = s->z_err; - if (*errnum == Z_OK) return (const char*)""; - - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); - - if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); - - TRYFREE(s->msg); - s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); - if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); - strcpy(s->msg, s->path); - strcat(s->msg, ": "); - strcat(s->msg, m); - return (const char*)s->msg; -} - -/* =========================================================================== - Clear the error and end-of-file flags, and do the same for the real file. -*/ -void ZEXPORT gzclearerr (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return; - if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; - s->z_eof = 0; - clearerr(s->file); -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/infback.c b/plugins/CDVDiso/src/3rdparty/zlib/infback.c deleted file mode 100644 index 455dbc9ee8..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/infback.c +++ /dev/null @@ -1,623 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->write = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - - /* process literal */ - if (this.op == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inffast.c b/plugins/CDVDiso/src/3rdparty/zlib/inffast.c deleted file mode 100644 index bbee92ed1e..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inffast.c +++ /dev/null @@ -1,318 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code this; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - write = state->write; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = lcode[hold & lmask]; - dolen: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op == 0) { /* literal */ - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - PUP(out) = (unsigned char)(this.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = dcode[hold & dmask]; - dodist: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - from = window - OFF; - if (write == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (write < op) { /* wrap around window */ - from += wsize + write - op; - op -= write; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (write < len) { /* some from start of window */ - op = write; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += write - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - this = dcode[this.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - this = lcode[this.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and write == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inffast.h b/plugins/CDVDiso/src/3rdparty/zlib/inffast.h deleted file mode 100644 index 1e88d2d97b..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inffixed.h b/plugins/CDVDiso/src/3rdparty/zlib/inffixed.h deleted file mode 100644 index 75ed4b5978..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inflate.c b/plugins/CDVDiso/src/3rdparty/zlib/inflate.c deleted file mode 100644 index 792fdee8e9..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inflate.c +++ /dev/null @@ -1,1368 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common write == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - strm->adler = 1; /* to support ill-conceived Java test suite */ - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->wsize = 0; - state->whave = 0; - state->write = 0; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; - return Z_OK; -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - if (windowBits < 0) { - state->wrap = 0; - windowBits = -windowBits; - } - else { - state->wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) windowBits &= 15; -#endif - } - if (windowBits < 8 || windowBits > 15) { - ZFREE(strm, state); - strm->state = Z_NULL; - return Z_STREAM_ERROR; - } - state->wbits = (unsigned)windowBits; - state->window = Z_NULL; - return inflateReset(strm); -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, out) -z_streamp strm; -unsigned out; -{ - struct inflate_state FAR *state; - unsigned copy, dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->write = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; - if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->write = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->write; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->write, strm->next_out - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); - state->write = copy; - state->whave = state->wsize; - } - else { - state->write += dist; - if (state->write == state->wsize) state->write = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - break; - } - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - if ((int)(this.op) == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - state->mode = LIT; - break; - } - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(this.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->mode = DIST; - case DIST: - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - state->extra = (unsigned)(this.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - if (state->offset > state->whave + out - left) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->write) { - copy -= state->write; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->write - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - REVERSE(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) - if (updatewindow(strm, out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long id; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary id */ - if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy(dest, source, sizeof(z_stream)); - zmemcpy(copy, state, sizeof(struct inflate_state)); - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inflate.h b/plugins/CDVDiso/src/3rdparty/zlib/inflate.h deleted file mode 100644 index 07bd3e78a7..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inflate.h +++ /dev/null @@ -1,115 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN, /* i: waiting for length/lit code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD or MEM mode -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME - NAME -> COMMENT -> HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or CHECK - STORED -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inftrees.c b/plugins/CDVDiso/src/3rdparty/zlib/inftrees.c deleted file mode 100644 index 8a9c13ff03..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inftrees.c +++ /dev/null @@ -1,329 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code this; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)1; - this.val = (unsigned short)0; - *(*table)++ = this; /* make a table to force an error */ - *(*table)++ = this; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min <= MAXBITS; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked when a LENS table is being made - against the space in *table, ENOUGH, minus the maximum space needed by - the worst case distance code, MAXD. This should never happen, but the - sufficiency of ENOUGH has not been proven exhaustively, hence the check. - This assumes that when type == LENS, bits == 9. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - this.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - this.op = (unsigned char)0; - this.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - this.op = (unsigned char)(extra[work[sym]]); - this.val = base[work[sym]]; - } - else { - this.op = (unsigned char)(32 + 64); /* end of block */ - this.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = this; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)(len - drop); - this.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - this.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = this; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/inftrees.h b/plugins/CDVDiso/src/3rdparty/zlib/inftrees.h deleted file mode 100644 index b1104c87e7..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/inftrees.h +++ /dev/null @@ -1,55 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1444 code structures (852 for length/literals - and 592 for distances, the latter actually the result of an - exhaustive search). The true maximum is not known, but the value - below is more than safe. */ -#define ENOUGH 2048 -#define MAXD 592 - -/* Type of code to build for inftable() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/plugins/CDVDiso/src/3rdparty/zlib/trees.c b/plugins/CDVDiso/src/3rdparty/zlib/trees.c deleted file mode 100644 index 395e4e1681..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/trees.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2005 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); -local void set_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (value << s->bi_valid); - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (val << s->bi_valid);\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void _tr_stored_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. - */ -void _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void _tr_flush_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) - set_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, eof); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+eof, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+eof, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (eof) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*eof)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; -} - -/* =========================================================================== - * Set the data type to BINARY or TEXT, using a crude approximation: - * set it to Z_TEXT if all symbols are either printable characters (33 to 255) - * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local void set_data_type(s) - deflate_state *s; -{ - int n; - - for (n = 0; n < 9; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - if (n == 9) - for (n = 14; n < 32; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/trees.h b/plugins/CDVDiso/src/3rdparty/zlib/trees.h deleted file mode 100644 index 72facf900f..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/plugins/CDVDiso/src/3rdparty/zlib/uncompr.c b/plugins/CDVDiso/src/3rdparty/zlib/uncompr.c deleted file mode 100644 index b59e3d0def..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/uncompr.c +++ /dev/null @@ -1,61 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/plugins/CDVDiso/src/3rdparty/zlib/zconf.h b/plugins/CDVDiso/src/3rdparty/zlib/zconf.h deleted file mode 100644 index 03a9431c8b..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/zconf.h +++ /dev/null @@ -1,332 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/plugins/CDVDiso/src/3rdparty/zlib/zlib.h b/plugins/CDVDiso/src/3rdparty/zlib/zlib.h deleted file mode 100644 index 022817927c..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/zlib.h +++ /dev/null @@ -1,1357 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumualte before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it gets to the next deflate block boundary. When decoding the - zlib or gzip format, this will cause inflate() to return immediately after - the header and before the first block. When doing a raw inflate, inflate() - will go ahead and process the first block, and will return when it gets to - the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. Z_FIXED prevents the - use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. In addition, the - current implementation of deflate will use at most the window size minus - 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - a crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg - is set to null if there is no error message. inflateInit2 does not perform - any decompression apart from reading the zlib header if present: this will - be done by inflate(). (So next_in and avail_in may be modified, but next_out - and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK can be used to - force inflate() to return immediately after header processing is complete - and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When - any of extra, name, or comment are not Z_NULL and the respective field is - not present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns 1 if file is being read directly without decompression, otherwise - zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is NULL, this function returns the required initial - value for the for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/plugins/CDVDiso/src/3rdparty/zlib/zutil.c b/plugins/CDVDiso/src/3rdparty/zlib/zutil.c deleted file mode 100644 index d55f5948a3..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/zutil.c +++ /dev/null @@ -1,318 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch (sizeof(uInt)) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch (sizeof(uLong)) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch (sizeof(voidpf)) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch (sizeof(z_off_t)) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#ifdef STDC -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int z_verbose = verbose; - -void z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ diff --git a/plugins/CDVDiso/src/3rdparty/zlib/zutil.h b/plugins/CDVDiso/src/3rdparty/zlib/zutil.h deleted file mode 100644 index 532fc7084a..0000000000 --- a/plugins/CDVDiso/src/3rdparty/zlib/zutil.h +++ /dev/null @@ -1,269 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#define ZLIB_INTERNAL -#include "zlib.h" - -#ifdef STDC -# ifndef _WIN32_WCE -# include -# endif -# include -# include -#endif -#ifdef NO_ERRNO_H -# ifdef _WIN32_WCE - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. We rename it to - * avoid conflict with other libraries that use the same workaround. - */ -# define errno z_errno -# endif - extern int errno; -#else -# ifndef _WIN32_WCE -# include -# endif -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 9 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# ifdef M_I86 - #include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# define vsnprintf _vsnprintf -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int z_verbose; - extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ diff --git a/plugins/CDVDiso/src/CDVDiso.h b/plugins/CDVDiso/src/CDVDiso.h index bcb891856d..0c4c173a0f 100644 --- a/plugins/CDVDiso/src/CDVDiso.h +++ b/plugins/CDVDiso/src/CDVDiso.h @@ -21,8 +21,8 @@ #pragma warning(disable:4018) #endif -#include "common/PS2Etypes.h" -#include "common/PS2Edefs.h" +#include "PS2Etypes.h" +#include "PS2Edefs.h" #include "libiso.h" #ifdef __cplusplus diff --git a/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj b/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj index dbbe62c328..7b60b1c225 100644 --- a/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj +++ b/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj @@ -19,7 +19,7 @@ @@ -141,6 +143,90 @@ /> + + + + + + + + + + + + + + + + + + + @@ -198,7 +283,14 @@ > + + + @@ -211,7 +303,6 @@ > @@ -220,7 +311,14 @@ > + + + @@ -233,7 +331,6 @@ > @@ -242,7 +339,14 @@ > + + + @@ -255,7 +359,6 @@ > @@ -264,7 +367,14 @@ > + + + @@ -302,508 +412,6 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/CDVDiso/src/Win32/Win32.c b/plugins/CDVDiso/src/Win32/Win32.c index 35e3f5b88f..900f9c31a3 100644 --- a/plugins/CDVDiso/src/Win32/Win32.c +++ b/plugins/CDVDiso/src/Win32/Win32.c @@ -11,7 +11,7 @@ #include "Config.h" -#include "CDVDiso.h" +#include "../CDVDiso.h" #include "resource.h" HINSTANCE hInst; diff --git a/plugins/CDVDiso/src/Win32/afxresmw.h b/plugins/CDVDiso/src/Win32/afxresmw.h deleted file mode 100644 index 99eace37c4..0000000000 --- a/plugins/CDVDiso/src/Win32/afxresmw.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/CDVDiso/src/Win32/vsprops/pcsx2_plugin_common.vsprops b/plugins/CDVDiso/src/Win32/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/CDVDiso/src/Win32/vsprops/postBuild.tmpl b/plugins/CDVDiso/src/Win32/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/CDVDiso/src/Win32/vsprops/postBuild.unknown b/plugins/CDVDiso/src/Win32/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/CDVDiso/src/Win32/vsprops/preBuild.cmd b/plugins/CDVDiso/src/Win32/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/CDVDiso/src/Win32/vsprops/svnrev_template.h b/plugins/CDVDiso/src/Win32/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/CDVDiso/src/Win32/vsprops/svnrev_unknown.h b/plugins/CDVDiso/src/Win32/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/CDVDiso/src/Win32/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/CDVDiso/src/common/PS2Edefs.h b/plugins/CDVDiso/src/common/PS2Edefs.h deleted file mode 100644 index 49b16e16d5..0000000000 --- a/plugins/CDVDiso/src/common/PS2Edefs.h +++ /dev/null @@ -1,885 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/CDVDiso/src/common/PS2Etypes.h b/plugins/CDVDiso/src/common/PS2Etypes.h deleted file mode 100644 index 4c62b47f0f..0000000000 --- a/plugins/CDVDiso/src/common/PS2Etypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifdef __LINUX__ -#define CALLBACK -#else -#define CALLBACK __stdcall -#endif - - -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x - -#define __naked __declspec(naked) - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -#define PCSX2_ALIGNED16_DECL(x) x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/CDVDiso/src/libiso.c b/plugins/CDVDiso/src/libiso.c index d6c8168e9c..51b7bdb3d0 100644 --- a/plugins/CDVDiso/src/libiso.c +++ b/plugins/CDVDiso/src/libiso.c @@ -12,8 +12,8 @@ #include #include #include -#include "3rdparty/zlib/zlib.h" -#include "3rdparty/bzip2/bzlib.h" +#include "zlib/zlib.h" +#include "bzip2/bzlib.h" #include "CDVDiso.h" #include "libiso.h" diff --git a/plugins/CDVDisoEFP/src/zlib/zlib.h.bak b/plugins/CDVDisoEFP/src/zlib/zlib.h.bak deleted file mode 100644 index 530c64c4d8..0000000000 --- a/plugins/CDVDisoEFP/src/zlib/zlib.h.bak +++ /dev/null @@ -1,1200 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.1, November 17th, 2003 - - Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.1" -#define ZLIB_VERNUM 0x1210 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by the in-memory functions is the zlib - format, which is a zlib wrapper documented in RFC 1950, wrapped around a - deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - This library does not provide any functions to write gzip files in memory. - However such functions could be easily written using zlib's deflate function, - the documentation in the gzip RFC, and the examples in gzio.c. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: ascii or binary */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_ASCII 1 -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it get to the next deflate block boundary. When decoding the zlib - or gzip format, this will cause inflate() to return immediately after the - header and before the first block. When doing a raw inflate, inflate() will - go ahead and process the first block, and will return when it gets to the end - of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary). - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); - -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int err)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/plugins/CDVDiso_vs2008.sln b/plugins/CDVDiso_vs2008.sln deleted file mode 100644 index ba699f154f..0000000000 --- a/plugins/CDVDiso_vs2008.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDiso", "CDVDiso\src\Win32\CDVDiso_vs2008.vcproj", "{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.ActiveCfg = Debug|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.Build.0 = Debug|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.ActiveCfg = Release|Win32 - {5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/CDVDnull/Src/CDVDnull.def b/plugins/CDVDnull/Src/CDVDnull.def index 18fb48080a..2fee123e61 100644 --- a/plugins/CDVDnull/Src/CDVDnull.def +++ b/plugins/CDVDnull/Src/CDVDnull.def @@ -1,7 +1,7 @@ ; CDVDnull.def : Declares the module parameters for the DLL. LIBRARY "CDVDnull" -DESCRIPTION 'CDVD Null Driver' +;DESCRIPTION 'CDVD Null Driver' EXPORTS ; Explicit exports can go here diff --git a/plugins/CDVDnull/Src/CDVDnull.dsp b/plugins/CDVDnull/Src/CDVDnull.dsp deleted file mode 100644 index 5e02435d1f..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="CDVDnull" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=CDVDNULL - WIN32 RELEASE -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "CDVDnull.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "CDVDnull.mak" CFG="CDVDNULL - WIN32 RELEASE" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "CDVDnull - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "__MSCW32__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CDVDNULL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "__MSCW32__" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CDVDNULL_EXPORTS" /D "__WIN32__" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x2c0a /d "NDEBUG" -# ADD RSC /l 0x2c0a /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# Begin Target - -# Name "CDVDnull - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\CDVD.c -# End Source File -# Begin Source File - -SOURCE=.\CDVDnull.def -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\CDVD.h -# End Source File -# Begin Source File - -SOURCE=.\PS2Edefs.h -# End Source File -# Begin Source File - -SOURCE=.\PS2Etypes.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/plugins/CDVDnull/Src/CDVDnull.dsw b/plugins/CDVDnull/Src/CDVDnull.dsw deleted file mode 100644 index ca22d5ba79..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "CDVDnull"=".\CDVDnull.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/plugins/CDVDnull/Src/CDVDnull.opt b/plugins/CDVDnull/Src/CDVDnull.opt deleted file mode 100644 index 13a3499ad3..0000000000 Binary files a/plugins/CDVDnull/Src/CDVDnull.opt and /dev/null differ diff --git a/plugins/CDVDnull/Src/CDVDnull.plg b/plugins/CDVDnull/Src/CDVDnull.plg deleted file mode 100644 index 7241554538..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull.plg +++ /dev/null @@ -1,34 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: CDVDnull - Win32 Release-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\marcelo\LOCALS~1\Temp\RSP89.tmp" with contents -[ -/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CDVDNULL_EXPORTS" /D "__WIN32__" /Fo"Release/" /Fd"Release/" /FD /c -"C:\pcsx2\plugins\cdvd\CDVDnull\Src\CDVD.c" -] -Creating command line "xicl6.exe @C:\DOCUME~1\marcelo\LOCALS~1\Temp\RSP89.tmp" -Creating temporary file "C:\DOCUME~1\marcelo\LOCALS~1\Temp\RSP8A.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /pdb:"Release/CDVDnull.pdb" /machine:I386 /def:".\CDVDnull.def" /out:"Release/CDVDnull.dll" /implib:"Release/CDVDnull.lib" -.\Release\CDVD.obj -] -Creating command line "xilink6.exe @C:\DOCUME~1\marcelo\LOCALS~1\Temp\RSP8A.tmp" -

Output Window

-Compiling... -CDVD.c -Linking... -xilink6: executing 'C:\PROGRA~1\MICROS~2\VC98\Bin\link.exe' - Creating library Release/CDVDnull.lib and object Release/CDVDnull.exp - - - -

Results

-CDVDnull.dll - 0 error(s), 0 warning(s) -
- - diff --git a/plugins/CDVDnull/Src/CDVDnull.sln b/plugins/CDVDnull/Src/CDVDnull.sln deleted file mode 100644 index 4336fc793a..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull.sln +++ /dev/null @@ -1,18 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDnull", "CDVDnull.vcproj", "{F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release.ActiveCfg = Release|Win32 - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/CDVDnull/Src/CDVDnull.vcproj b/plugins/CDVDnull/Src/CDVDnull.vcproj deleted file mode 100644 index 632c7b4250..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull.vcproj +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/CDVDnull/Src/CDVDnull_2003.sln b/plugins/CDVDnull/Src/CDVDnull_2003.sln deleted file mode 100644 index c0b7d9093e..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_2003.sln +++ /dev/null @@ -1,18 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDnull", "CDVDnull_2003.vcproj", "{F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release.ActiveCfg = Release|Win32 - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/CDVDnull/Src/CDVDnull_2003.vcproj b/plugins/CDVDnull/Src/CDVDnull_2003.vcproj deleted file mode 100644 index 863e3909e7..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_2003.vcproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/CDVDnull/Src/CDVDnull_2005_x64.sln b/plugins/CDVDnull/Src/CDVDnull_2005_x64.sln deleted file mode 100644 index 28148839fa..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_2005_x64.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDnull", "CDVDnull_2005_x64.vcproj", "{F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release|x64.ActiveCfg = amd64|x64 - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release|x64.Build.0 = amd64|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/CDVDnull/Src/CDVDnull_2005_x64.vcproj b/plugins/CDVDnull/Src/CDVDnull_2005_x64.vcproj deleted file mode 100644 index 466b0f3052..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_2005_x64.vcproj +++ /dev/null @@ -1,607 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/CDVDnull/Src/CDVDnull_vs2008.vcproj b/plugins/CDVDnull/Src/CDVDnull_vs2008.vcproj new file mode 100644 index 0000000000..4cff1f46a5 --- /dev/null +++ b/plugins/CDVDnull/Src/CDVDnull_vs2008.vcproj @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.sln b/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.sln deleted file mode 100644 index 349a3a17ab..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDnull", "CDVDnull_vsnet2005beta1.vcproj", "{F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release|Win32.ActiveCfg = Release|Win32 - {F38D9DF0-F68D-49D9-B3A0-932E74FB74A0}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.vcproj b/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.vcproj deleted file mode 100644 index 097ba19f38..0000000000 --- a/plugins/CDVDnull/Src/CDVDnull_vsnet2005beta1.vcproj +++ /dev/null @@ -1,418 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/CDVDnull/Src/PS2Edefs.h b/plugins/CDVDnull/Src/PS2Edefs.h deleted file mode 100644 index 9b6d49a2f3..0000000000 --- a/plugins/CDVDnull/Src/PS2Edefs.h +++ /dev/null @@ -1,827 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -// extended funcs - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgetLastTag GSgetLastTag; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; -_PADupdate PAD1update; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; -_PADupdate PAD2update; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/CDVDnull/Src/PS2Etypes.h b/plugins/CDVDnull/Src/PS2Etypes.h deleted file mode 100644 index 1ad73e273d..0000000000 --- a/plugins/CDVDnull/Src/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/CDVDnull/Src/ProjectRootDir.vsprops b/plugins/CDVDnull/Src/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/CDVDnull/Src/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/CDVDolio/cdvd_vs2008.vcproj b/plugins/CDVDolio/cdvd_vs2008.vcproj index 642a0914ee..04c092dc00 100644 --- a/plugins/CDVDolio/cdvd_vs2008.vcproj +++ b/plugins/CDVDolio/cdvd_vs2008.vcproj @@ -2,7 +2,7 @@ @@ -83,10 +83,463 @@ Name="VCPostBuildEventTool" />
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -147,75 +600,10 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -786,75 +916,10 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - - - @@ -914,75 +979,10 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - - - - - - @@ -1091,14 +1083,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1107,14 +1091,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1123,14 +1099,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1139,14 +1107,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1155,14 +1115,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1172,7 +1124,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/CDVDolio/vsprops/common.vsprops b/plugins/CDVDolio/vsprops/common.vsprops index 5b34339bc0..6d4b6a7665 100644 --- a/plugins/CDVDolio/vsprops/common.vsprops +++ b/plugins/CDVDolio/vsprops/common.vsprops @@ -25,15 +25,4 @@ SubSystem="2" RandomizedBaseAddress="1" /> - - - diff --git a/plugins/CDVDolio/vsprops/pcsx2_plugin_common.vsprops b/plugins/CDVDolio/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/CDVDolio/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/CDVDolio/vsprops/postBuild.tmpl b/plugins/CDVDolio/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/CDVDolio/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/CDVDolio/vsprops/postBuild.unknown b/plugins/CDVDolio/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/CDVDolio/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/CDVDolio/vsprops/preBuild.cmd b/plugins/CDVDolio/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/CDVDolio/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/CDVDolio/vsprops/svnrev_template.h b/plugins/CDVDolio/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/CDVDolio/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/CDVDolio/vsprops/svnrev_unknown.h b/plugins/CDVDolio/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/CDVDolio/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/CDVDpeops/Cdr.c.bak b/plugins/CDVDpeops/Cdr.c.bak deleted file mode 100644 index 7a6100ebe5..0000000000 --- a/plugins/CDVDpeops/Cdr.c.bak +++ /dev/null @@ -1,848 +0,0 @@ -/*************************************************************************** - cdr.c - description - ------------------- - begin : Sun Nov 16 2003 - copyright : (C) 2003 by Pete Bernert - email : BlackDove@addcom.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -//*************************************************************************// -// History of changes: -// -// 2004/12/25 - Pete -// - added an hack in CDVDgetTD for big dvds -// -// 2003/11/16 - Pete -// - generic cleanup for the Peops cdvd release -// -//*************************************************************************// - -///////////////////////////////////////////////////////// - -#include "stdafx.h" -#include -#include "resource.h" -#define _IN_CDR -#include "externals.h" -#include "libiso.h" - -#ifdef DBGOUT -#define SMALLDEBUG 1 -#include -#endif - -///////////////////////////////////////////////////////// -// PCSX2 CDVD interface: - -EXPORT_GCC char * CALLBACK PS2EgetLibName(); -EXPORT_GCC unsigned long CALLBACK PS2EgetLibType(); -EXPORT_GCC unsigned long CALLBACK PS2EgetLibVersion2(unsigned long type); -EXPORT_GCC long CALLBACK CDVDinit(); -EXPORT_GCC void CALLBACK CDVDshutdown(); -EXPORT_GCC long CALLBACK CDVDopen(); -EXPORT_GCC void CALLBACK CDVDclose(); -EXPORT_GCC long CALLBACK CDVDtest(); -EXPORT_GCC long CALLBACK CDVDreadTrack(unsigned long lsn, int mode); -EXPORT_GCC unsigned char * CALLBACK CDVDgetBuffer(); -EXPORT_GCC long CALLBACK CDVDgetTN(cdvdTN *Buffer); -EXPORT_GCC long CALLBACK CDVDgetTD(unsigned char track, cdvdTD *Buffer); -EXPORT_GCC long CALLBACK CDVDgetDiskType(); -EXPORT_GCC long CALLBACK CDVDgetTrayStatus(); - -///////////////////////////////////////////////////////// - -const unsigned char version = PS2E_CDVD_VERSION; -const unsigned char revision = 1; -const unsigned char build = 2; -char *libraryName = "P.E.Op.S. CDVD Driver (CDDA mod)"; - -///////////////////////////////////////////////////////// - -BOOL bIsOpen=FALSE; // flag: open called once -BOOL bCDDAPlay=FALSE; // flag: audio is playing -int iCDROK=0; // !=0: cd is ok -int iCDType=CDVD_TYPE_UNKNOWN; // CD/DVD -int iCheckTrayStatus=0; // if 0 : report tray as closed, else try a real check -void *fdump; - -///////////////////////////////////////////////////////// -// usual info funcs - -EXPORT_GCC char * CALLBACK PS2EgetLibName() -{ - return libraryName; -} - -EXPORT_GCC unsigned long CALLBACK PS2EgetLibType() -{ - return PS2E_LT_CDVD; -} - -EXPORT_GCC unsigned long CALLBACK PS2EgetLibVersion2(unsigned long type) -{ - return version<<16|revision<<8|build; -} -/* -EXPORT_GCC unsigned long CALLBACK PS2EgetCpuPlatform(void) -{ - return PS2E_X86; -// return PS2E_X86_64; -}*/ - -s32 msf_to_lba(u8 m, u8 s, u8 f) { - u32 lsn; - lsn = f; - lsn+=(s - 2) * 75; - lsn+= m * 75 * 60; - return lsn; -} - -void lba_to_msf(s32 lba, u8* m, u8* s, u8* f) { - lba += 150; - *m = lba / (60*75); - *s = (lba / 75) % 60; - *f = lba % 75; -} - -///////////////////////////////////////////////////////// -// init: called once at library load - -EXPORT_GCC long CALLBACK CDVDinit() -{ - szSUBF[0]=0; // just init the filename buffers - szPPF[0] =0; - return 0; -} - -///////////////////////////////////////////////////////// -// shutdown: called once at final exit - -EXPORT_GCC void CALLBACK CDVDshutdown() -{ -} - -///////////////////////////////////////////////////////// -// open: called, when games starts/cd has been changed - -int CheckDiskType(int baseType); - -EXPORT_GCC long CALLBACK CDVDopen() -{ - int i,audioTracks,dataTracks; - cdvdTD T; - if(bIsOpen) // double-open check (if the main emu coder doesn't know what he is doing ;) - { - if(iCDROK<=0) return -1; - else return 0; - } - - bIsOpen=TRUE; // ok, open func called once - - ReadConfig(); // read user config - - BuildPPFCache(); // build ppf cache - - BuildSUBCache(); // build sub cache - - CreateREADBufs(); // setup generic read buffers - - CreateGenEvent(); // create read event - - iCDROK=OpenGenCD(iCD_AD,iCD_TA,iCD_LU); // generic open, setup read func - - if(iCDROK<=0) {iCDROK=0;return -1;} - - ReadTOC(); // read the toc - - SetGenCDSpeed(0); // try to change the reading speed (if wanted) - - iCDType=CDVD_TYPE_UNKNOWN; // let's look after the disc type - // (funny stuff taken from Xobro's/Florin's bin plugin) - if(CDVDreadTrack(16,CDVD_MODE_2048)==0) - { - struct cdVolDesc *volDesc; - volDesc=(struct cdVolDesc *)CDVDgetBuffer(); - if(volDesc) - { - -//todo: CDVD_TYPE_CDDA - - if(volDesc->rootToc.tocSize==2048) - iCDType = CDVD_TYPE_DETCTCD; - else iCDType = CDVD_TYPE_DETCTDVDS; - } - } - - fprintf(stderr," * CDVD Disk Open: %d tracks (%d to %d):\n",sTOC.cLastTrack-sTOC.cFirstTrack+1,sTOC.cFirstTrack,sTOC.cLastTrack); - - audioTracks=dataTracks=0; - for(i=sTOC.cFirstTrack;i<=sTOC.cLastTrack;i++) - { - CDVDgetTD(i,&T); - if(T.type==CDVD_AUDIO_TRACK) { - audioTracks++; - fprintf(stderr," * * Track %d: Audio (%d sectors)\n",i,T.lsn); - } - else { - dataTracks++; - fprintf(stderr," * * Track %d: Data (Mode %d) (%d sectors)\n",i,((T.type==CDVD_MODE1_TRACK)?1:2),T.lsn); - } - } - if((dataTracks==0)&&(audioTracks>0)) - iCDType=CDVD_TYPE_CDDA; - else if(dataTracks>0) - iCDType=CheckDiskType(iCDType); - - if((iCDType==CDVD_TYPE_ILLEGAL)&&(audioTracks>0)) - iCDType=CDVD_TYPE_CDDA; - else if((iCDType==CDVD_TYPE_PS2CD)&&(audioTracks>0)) - iCDType=CDVD_TYPE_PS2CDDA; - else if((iCDType==CDVD_TYPE_PSCD)&&(audioTracks>0)) - iCDType=CDVD_TYPE_PSCDDA; - - switch(iCDType) { - case CDVD_TYPE_ILLEGAL: // Illegal Disc - fprintf(stderr," * Disk Type: Illegal Disk.\n");break; - case CDVD_TYPE_DVDV: // DVD Video - fprintf(stderr," * Disk Type: DVD Video.\n");break; - case CDVD_TYPE_CDDA: // Audio CD - fprintf(stderr," * Disk Type: CDDA.\n");break; - case CDVD_TYPE_PS2DVD: // PS2 DVD - fprintf(stderr," * Disk Type: PS2 DVD.\n");break; - case CDVD_TYPE_PS2CDDA: // PS2 CD (with audio) - fprintf(stderr," * Disk Type: PS2 CD+Audio.\n");break; - case CDVD_TYPE_PS2CD: // PS2 CD - fprintf(stderr," * Disk Type: PS2 CD.\n");break; - case CDVD_TYPE_PSCDDA: // PS CD (with audio) - fprintf(stderr," * Disk Type: PS1 CD+Audio.\n");break; - case CDVD_TYPE_PSCD: // PS CD - fprintf(stderr," * Disk Type: PS1 CD.\n");break; - case CDVD_TYPE_UNKNOWN: // Unknown - fprintf(stderr," * Disk Type: Unknown.\n");break; - case CDVD_TYPE_NODISC: // No Disc - fprintf(stderr," * Disk Type: No Disc.\n");break; - } - -/* if (iBlockDump)*/ { -// fdump = isoCreate("block.dump", ISOFLAGS_BLOCKDUMP); - fdump = NULL; - if (fdump) { - cdvdTD buf; - CDVDgetTD(0, &buf); - isoSetFormat(fdump, 0, 2352, buf.lsn); - } - } /*else { - fdump = NULL; - }*/ - - - return 0; // ok, done -} - -///////////////////////////////////////////////////////// -// close: called when emulation stops - -EXPORT_GCC void CALLBACK CDVDclose() -{ - if(!bIsOpen) return; // no open? no close... - - if (fdump != NULL) { - isoClose(fdump); - } - bIsOpen=FALSE; // no more open - - LockGenCDAccess(); // make sure that no more reading is happening - - if(iCDROK) // cd was ok? - { - if(bCDDAPlay) {DoCDDAPlay(0);bCDDAPlay=FALSE;} // -> cdda playing? stop it - SetGenCDSpeed(1); // -> repair speed - CloseGenCD(); // -> cd not used anymore - } - - UnlockGenCDAccess(); - - FreeREADBufs(); // free read bufs - FreeGenEvent(); // free event - FreePPFCache(); // free ppf cache - FreeSUBCache(); // free sub cache -} - -///////////////////////////////////////////////////////// -// test: ah, well, always fine - -EXPORT_GCC long CALLBACK CDVDtest() -{ - return 0; -} - -///////////////////////////////////////////////////////// -// readSubQ: read subq from disc (only cds have subq data) -EXPORT_GCC long CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) -{ - if(!bIsOpen) CDVDopen(); // usual checks - if(!iCDROK) return -1; - - // fake it - u8 min, sec, frm; - subq->ctrl = 4; - subq->mode = 1; - subq->trackNum = itob(1); - subq->trackIndex= itob(1); - - lba_to_msf(lsn, &min, &sec, &frm); - subq->trackM = itob(min); - subq->trackS = itob(sec); - subq->trackF = itob(frm); - - subq->pad = 0; - - lba_to_msf(lsn + (2*75), &min, &sec, &frm); - subq->discM = itob(min); - subq->discS = itob(sec); - subq->discF = itob(frm); - return 0; -} - -///////////////////////////////////////////////////////// -// gettoc: ps2 style TOC -EXPORT_GCC long CALLBACK CDVDgetTOC(void* toc) -{ - u32 type; - u8* tocBuff = (u8*)toc; - - if(!bIsOpen) CDVDopen(); // not open? funny emu... - - if(!iCDROK) return -1; // cd not ok? - - type = CDVDgetDiskType(); - - if( type == CDVD_TYPE_DVDV || - type == CDVD_TYPE_PS2DVD) - { - // get dvd structure format - // scsi command 0x43 - memset(tocBuff, 0, 2048); - // fake it - tocBuff[ 0] = 0x04; - tocBuff[ 1] = 0x02; - tocBuff[ 2] = 0xF2; - tocBuff[ 3] = 0x00; - tocBuff[ 4] = 0x86; - tocBuff[ 5] = 0x72; - - tocBuff[16] = 0x00; - tocBuff[17] = 0x03; - tocBuff[18] = 0x00; - tocBuff[19] = 0x00; - } - else if(type == CDVD_TYPE_CDDA || - type == CDVD_TYPE_PS2CDDA || - type == CDVD_TYPE_PS2CD || - type == CDVD_TYPE_PSCDDA || - type == CDVD_TYPE_PSCD) - { - // cd toc - // (could be replaced by 1 command that reads the full toc) - u8 min, sec, frm,i; - s32 err; - cdvdTN diskInfo; - cdvdTD trackInfo; - memset(tocBuff, 0, 1024); - if (CDVDgetTN(&diskInfo) == -1) { diskInfo.etrack = 0;diskInfo.strack = 1; } - if (CDVDgetTD(0, &trackInfo) == -1) trackInfo.lsn = 0; - - tocBuff[0] = 0x41; - tocBuff[1] = 0x00; - - //Number of FirstTrack - tocBuff[2] = 0xA0; - tocBuff[7] = itob(diskInfo.strack); - - //Number of LastTrack - tocBuff[12] = 0xA1; - tocBuff[17] = itob(diskInfo.etrack); - - //DiskLength - lba_to_msf(trackInfo.lsn, &min, &sec, &frm); - tocBuff[22] = 0xA2; - tocBuff[27] = itob(min); - tocBuff[28] = itob(sec); - tocBuff[29] = itob(frm); - - for (i=diskInfo.strack; i<=diskInfo.etrack; i++) - { - err = CDVDgetTD(i, &trackInfo); - lba_to_msf(trackInfo.lsn, &min, &sec, &frm); - tocBuff[i*10+30] = trackInfo.type; - tocBuff[i*10+32] = err == -1 ? 0 : itob(i); //number - tocBuff[i*10+37] = itob(min); - tocBuff[i*10+38] = itob(sec); - tocBuff[i*10+39] = itob(frm); - } - } - else - return -1; - - return 0; -} - -EXPORT_GCC long CALLBACK CDVDctrlTrayOpen() -{ - return 0; -} - -EXPORT_GCC long CALLBACK CDVDctrlTrayClose() -{ - return 0; -} - - -///////////////////////////////////////////////////////// -// gettn: first/last track num - -EXPORT_GCC long CALLBACK CDVDgetTN(cdvdTN *Buffer) -{ - if(!bIsOpen) CDVDopen(); // not open? funny emu... - - if(!iCDROK) // cd not ok? - { - Buffer->strack=1; - Buffer->etrack=1; - return -1; - } - - ReadTOC(); // read the TOC - - Buffer->strack=sTOC.cFirstTrack; // get the infos - Buffer->etrack=sTOC.cLastTrack; - - return 0; -} - -///////////////////////////////////////////////////////// -// gettd: track addr - -EXPORT_GCC long CALLBACK CDVDgetTD(unsigned char track, cdvdTD *Buffer) -{ - unsigned long lu,i; - unsigned char buffer[2352]; - unsigned char *buf; - u8 t1; - - if(!bIsOpen) CDVDopen(); // not open? funny emu... - - if(!iCDROK) return -1; // cd not ok? bye - - ReadTOC(); // read toc - -/* -// PSEmu style: - if(track==0) // 0 = last track - { - lu=reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr); - addr2time(lu,buffer); - } - else // others: track n - { - lu=reOrder(sTOC.tracks[track-1].lAddr); - addr2time(lu,buffer); - } - - Buffer->minute = buffer[1]; - Buffer->second = buffer[2]; - Buffer->frame = buffer[3]; - Buffer->type = iCDType; -#ifdef DBGOUT - auxprintf("Read Toc %d: %u\n",track,lu); -#endif -*/ - - lu=0; - if(track==0) - lu=reOrder(sTOC.tracks[sTOC.cLastTrack].lAddr); - else - lu=reOrder(sTOC.tracks[track].lAddr); - //addr2time(lu,buffer); - - Buffer->lsn=lu; - - if(track==0) - Buffer->type = iCDType; - else - { - lu=0; - for(i=sTOC.cFirstTrack;itype=t1; - } - - return 0; -} - -///////////////////////////////////////////////////////// -// readtrack: start reading at given address - -EXPORT_GCC long CALLBACK CDVDreadTrack(unsigned long lsn, int mode) -{ - if(!bIsOpen) CDVDopen(); // usual checks - if(!iCDROK) return -1; - if(bCDDAPlay) bCDDAPlay=FALSE; - -#ifdef DBGOUT - auxprintf("Read Track %u: %d\n",lsn,mode); -#endif - - lLastAccessedAddr=lsn; // store read track values (for getbuffer) - iLastAccessedMode=mode; - - if(!pReadTrackFunc(lLastAccessedAddr)) // start reading - return -1; - - return 0; -} - -///////////////////////////////////////////////////////// -// getbuffer: will be called after readtrack, to get ptr -// to data - -// small helper buffer to get bigger block sizes -unsigned char cDataAndSub[2368]; - -EXPORT_GCC unsigned char * CALLBACK CDVDgetBuffer() -{ - unsigned char * pbuffer; - - if(!bIsOpen) CDVDopen(); - - if(pGetPtrFunc) pGetPtrFunc(); // get ptr on thread modes - - pbuffer=pCurrReadBuf; // init buffer pointer - - if(iLastAccessedMode!=iUsedMode) - { - switch(iLastAccessedMode) // what does the emu want? - {//------------------------------------------------// - case CDVD_MODE_2048: - { - if(iUsedBlockSize==2352) pbuffer+=24; - }break; - //------------------------------------------------// - case CDVD_MODE_2352: - { - if(iUsedBlockSize==2048) - { - memset(cDataAndSub,0,2368); - memcpy(cDataAndSub+24,pbuffer,2048); - pbuffer=cDataAndSub; - } - }break; - //------------------------------------------------// - case CDVD_MODE_2340: - { - if(iUsedBlockSize==2048) - { - memset(cDataAndSub,0,2368); - memcpy(cDataAndSub+12,pbuffer,2048); - pbuffer=cDataAndSub; - } - else pbuffer+=12; - }break; - //------------------------------------------------// - case CDVD_MODE_2328: - { - if(iUsedBlockSize==2048) - { - memset(cDataAndSub,0,2368); - memcpy(cDataAndSub+0,pbuffer,2048); - pbuffer=cDataAndSub; - } - else pbuffer+=24; - }break; - //------------------------------------------------// - case CDVD_MODE_2368: - { - if(iUsedBlockSize==2048) - { - memset(cDataAndSub,0,2368); - memcpy(cDataAndSub+24,pbuffer,2048); - pbuffer=cDataAndSub; - -/* -// NO SUBCHANNEL SUPPORT RIGHT NOW!!! - { - if(subHead) // some sub file? - CheckSUBCache(lLastAccessedAddr); // -> get cached subs - else - if(iUseSubReading!=1 && pCurrSubBuf) // no direct cd sub read? - FakeSubData(lLastAccessedAddr); // -> fake the data - memcpy(cDataAndSub,pCurrReadBuf,2352); - if(pCurrSubBuf) - memcpy(cDataAndSub+2352,pCurrSubBuf+12,16); - pbuffer=cDataAndSub; - } -*/ - - } - }break; - //------------------------------------------------// - } - } - -#ifdef DBGOUT - auxprintf("get buf %d\n",iLastAccessedMode); - -/* -{ - int k; - for(k=0;k<2352;k++) - auxprintf("%02x ",*(pbuffer+k)); - auxprintf("\n\n"); -} -*/ -#endif - - return pbuffer; -} - -///////////////////////////////////////////////////////// - -EXPORT_GCC long CALLBACK CDVDgetDiskType() -{ - return iCDType; -} - -///////////////////////////////////////////////////////// -// CDVDgetTrayStatus - -EXPORT_GCC long CALLBACK CDVDgetTrayStatus() -{ - static time_t to=0; - static long lLastTrayState=CDVD_TRAY_CLOSE; - - if(to==time(NULL)) return lLastTrayState; // we only check once per second - to = time(NULL); - - lLastTrayState=CDVD_TRAY_CLOSE; // init state with "closed" - - if(iCheckTrayStatus) // user really want a tray check - { - int iStatus; - - LockGenCDAccess(); // make sure that no more reading is happening - iStatus=GetSCSIStatus(iCD_AD,iCD_TA,iCD_LU); // get device status - UnlockGenCDAccess(); - - if(iStatus==SS_ERR) - lLastTrayState=CDVD_TRAY_OPEN; - } - -#ifdef DBGOUT -auxprintf("check %d -> %d\n",to,lLastTrayState); -#endif - - - return lLastTrayState; -} - - -///////////////////////////////////////////////////////// -// configure: shows config window - -EXPORT_GCC void CALLBACK CDVDconfigure() -{ - if(iCDROK) // mmm... someone has already called Open? bad - {MessageBeep((UINT)-1);return;} - - CreateGenEvent(); // we need an event handle - - DialogBox(hInst,MAKEINTRESOURCE(IDD_CONFIG), // call dialog - GetActiveWindow(),(DLGPROC)CDRDlgProc); - - FreeGenEvent(); // free event handle -} - -///////////////////////////////////////////////////////// -// about: shows about window - -EXPORT_GCC void CALLBACK CDVDabout() -{ - DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT), - GetActiveWindow(),(DLGPROC)AboutDlgProc); -} - -///////////////////////////////////////////////////////// -///////////////////////////////////////////////////////// -///////////////////////////////////////////////////////// - -/* -// CURRENTLY UNUSED OLD STUFF FROM PSX CD PLUGIN: - -///////////////////////////////////////////////////////// -// audioplay: PLAYSECTOR is NOT BCD coded !!! - -EXPORT_GCC long CALLBACK CDRplay(unsigned char * sector) -{ - if(!bIsOpen) CDVDopen(); - if(!iCDROK) return PSE_ERR_FATAL; - - if(!DoCDDAPlay(time2addr(sector))) // start playing - return PSE_CDR_ERR_NOREAD; - - bCDDAPlay=TRUE; // raise flag: we are playing - - return PSE_CDR_ERR_SUCCESS; -} - -///////////////////////////////////////////////////////// -// audiostop: stops cdda playing - -EXPORT_GCC long CALLBACK CDRstop(void) -{ - if(!bCDDAPlay) return PSE_ERR_FATAL; - - DoCDDAPlay(0); // stop cdda - - bCDDAPlay=FALSE; // reset flag: no more playing - - return PSE_CDR_ERR_SUCCESS; -} - -///////////////////////////////////////////////////////// -// getdriveletter - -EXPORT_GCC char CALLBACK CDRgetDriveLetter(void) -{ - if(!iCDROK) return 0; // not open? no way to get the letter - - if(iInterfaceMode==2 || iInterfaceMode==3) // w2k/xp: easy - { - return MapIOCTLDriveLetter(iCD_AD,iCD_TA,iCD_LU); - } - else // but with aspi??? - { // -> no idea yet (maybe registry read...pfff) - } - - return 0; -} - -///////////////////////////////////////////////////////// -// getstatus: pcsx func... poorly supported here -// problem is: func will be called often, which -// would block all of my cdr reading if I would use -// lotsa scsi commands - -struct CdrStat -{ - unsigned long Type; - unsigned long Status; - unsigned char Time[3]; // current playing time -}; - -struct CdrStat ostat; - -// reads cdr status -// type: -// 0x00 - unknown -// 0x01 - data -// 0x02 - audio -// 0xff - no cdrom -// status: -// 0x00 - unknown -// 0x02 - error -// 0x08 - seek error -// 0x10 - shell open -// 0x20 - reading -// 0x40 - seeking -// 0x80 - playing -// time: -// byte 0 - minute -// byte 1 - second -// byte 2 - frame - - -EXPORT_GCC long CALLBACK CDRgetStatus(struct CdrStat *stat) -{ - int iStatus; - static time_t to; - - if(!bCDDAPlay) // if not playing update stat only once in a second - { - if(to get pos - stat->Type = 0x02; // -> audio - if(pB) - { - stat->Status|=0x80; // --> playing flag - stat->Time[0]=pB[18]; // --> and curr play time - stat->Time[1]=pB[19]; - stat->Time[2]=pB[20]; - } - } - else // cdda not playing? - { - stat->Type = 0x01; // -> data - } - - LockGenCDAccess(); // make sure that no more reading is happening - iStatus=GetSCSIStatus(iCD_AD,iCD_TA,iCD_LU); // get device status - UnlockGenCDAccess(); - - if(iStatus==SS_ERR) - { // no cdrom? - stat->Type = 0xff; - stat->Status|= 0x10; - } - - memcpy(&ostat, stat, sizeof(struct CdrStat)); - - return 0; -} - -///////////////////////////////////////////////////////// -*/ diff --git a/plugins/CDVDpeops/cdvdPeops.aps b/plugins/CDVDpeops/cdvdPeops.aps deleted file mode 100644 index 057382fdde..0000000000 Binary files a/plugins/CDVDpeops/cdvdPeops.aps and /dev/null differ diff --git a/plugins/CDVDpeops/cdvdPeops.def.bak b/plugins/CDVDpeops/cdvdPeops.def.bak deleted file mode 100644 index 55d1203109..0000000000 --- a/plugins/CDVDpeops/cdvdPeops.def.bak +++ /dev/null @@ -1,30 +0,0 @@ -; cdvdPeops.def : Declares the module parameters for the DLL. - -LIBRARY "cdvdPeops" - -EXPORTS - ; Explicit exports can go here - - PS2EgetLibType @2 - PS2EgetLibName @3 - PS2EgetLibVersion2 @4 - CDVDinit @5 - CDVDshutdown @6 - CDVDopen @7 - CDVDclose @8 - CDVDconfigure @9 - CDVDabout @10 - CDVDtest @11 - CDVDgetTN @12 - CDVDgetTD @13 - CDVDreadTrack @14 - CDVDgetBuffer @15 - CDVDgetDiskType @16 - CDVDgetTrayStatus @17 - PS2EgetCpuPlatform @18 - CDVDreadSubQ @19 - CDVDgetTOC @20 - CDVDctrlTrayOpen @21 - CDVDctrlTrayClose @22 - - diff --git a/plugins/CDVDpeops/cdvdPeops.dsp b/plugins/CDVDpeops/cdvdPeops.dsp deleted file mode 100644 index 1d4555c0ef..0000000000 --- a/plugins/CDVDpeops/cdvdPeops.dsp +++ /dev/null @@ -1,251 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cdvdPeops" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=cdvdPeops - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cdvdPeops.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cdvdPeops.mak" CFG="cdvdPeops - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cdvdPeops - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cdvdPeops - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cdvdPeops - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G5 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib advapi32.lib comdlg32.lib /nologo /subsystem:windows /dll /machine:I386 -# SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=copy release\*.dll d:\emus\pcsx2_07\plugins -# End Special Build Tool - -!ELSEIF "$(CFG)" == "cdvdPeops - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cdvdPeops - Win32 Release" -# Name "cdvdPeops - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\cdda.c -# End Source File -# Begin Source File - -SOURCE=.\cdr.c -# End Source File -# Begin Source File - -SOURCE=.\cdvdPeops.c -# End Source File -# Begin Source File - -SOURCE=.\cdvdPeops.def -# End Source File -# Begin Source File - -SOURCE=.\cfg.c -# End Source File -# Begin Source File - -SOURCE=.\generic.c -# End Source File -# Begin Source File - -SOURCE=.\ioctrl.c -# End Source File -# Begin Source File - -SOURCE=.\ppf.c -# End Source File -# Begin Source File - -SOURCE=.\read.c -# End Source File -# Begin Source File - -SOURCE=.\scsi.c -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.c -# End Source File -# Begin Source File - -SOURCE=.\sub.c -# End Source File -# Begin Source File - -SOURCE=.\toc.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\cdda.h -# End Source File -# Begin Source File - -SOURCE=.\cdr.h -# End Source File -# Begin Source File - -SOURCE=.\cdvdPeops.h -# End Source File -# Begin Source File - -SOURCE=.\cfg.h -# End Source File -# Begin Source File - -SOURCE=.\defines.h -# End Source File -# Begin Source File - -SOURCE=.\externals.h -# End Source File -# Begin Source File - -SOURCE=.\generic.h -# End Source File -# Begin Source File - -SOURCE=.\ioctrl.h -# End Source File -# Begin Source File - -SOURCE=.\ppf.h -# End Source File -# Begin Source File - -SOURCE=".\PSEmu Plugin Defs.h" -# End Source File -# Begin Source File - -SOURCE=.\read.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\scsi.h -# End Source File -# Begin Source File - -SOURCE=.\scsidefs.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\sub.h -# End Source File -# Begin Source File - -SOURCE=.\toc.h -# End Source File -# Begin Source File - -SOURCE=.\wnaspi32.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\cdvdPeops.rc -# End Source File -# End Group -# Begin Group "Documentation files" - -# PROP Default_Filter "txt" -# Begin Source File - -SOURCE=.\changelog.txt -# End Source File -# Begin Source File - -SOURCE=.\filemap.txt -# End Source File -# Begin Source File - -SOURCE=.\license.txt -# End Source File -# End Group -# End Target -# End Project diff --git a/plugins/CDVDpeops/cdvdPeops.dsw b/plugins/CDVDpeops/cdvdPeops.dsw deleted file mode 100644 index 55e36029fc..0000000000 --- a/plugins/CDVDpeops/cdvdPeops.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cdvdPeops"=.\cdvdPeops.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/plugins/CDVDpeops/cdvdPeops.layout b/plugins/CDVDpeops/cdvdPeops.layout deleted file mode 100644 index ebcf4cfa69..0000000000 --- a/plugins/CDVDpeops/cdvdPeops.layout +++ /dev/null @@ -1,238 +0,0 @@ -[Editor_26] -CursorCol=1 -CursorRow=19 -TopLine=12 -LeftChar=1 -Open=0 -Top=0 -[Editors] -Order=0,35,11,4,10 -Focused=35 -[Editor_0] -Open=1 -Top=0 -CursorCol=39 -CursorRow=60 -TopLine=36 -LeftChar=1 -[Editor_1] -Open=0 -Top=0 -CursorCol=1 -CursorRow=23 -TopLine=1 -LeftChar=1 -[Editor_2] -Open=0 -Top=0 -CursorCol=2 -CursorRow=26 -TopLine=1 -LeftChar=1 -[Editor_3] -Open=0 -Top=0 -CursorCol=1 -CursorRow=438 -TopLine=428 -LeftChar=1 -[Editor_4] -Open=1 -Top=0 -CursorCol=19 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_5] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_6] -Open=0 -Top=0 -CursorCol=20 -CursorRow=20 -TopLine=1 -LeftChar=1 -[Editor_7] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_8] -Open=0 -Top=0 -CursorCol=19 -CursorRow=95 -TopLine=94 -LeftChar=1 -[Editor_9] -Open=0 -Top=0 -CursorCol=1 -CursorRow=8 -TopLine=1 -LeftChar=1 -[Editor_10] -Open=1 -Top=0 -CursorCol=17 -CursorRow=167 -TopLine=156 -LeftChar=1 -[Editor_11] -Open=1 -Top=0 -CursorCol=7 -CursorRow=99 -TopLine=70 -LeftChar=1 -[Editor_12] -Open=0 -Top=0 -[Editor_13] -Open=0 -Top=0 -CursorCol=27 -CursorRow=19 -TopLine=2 -LeftChar=1 -[Editor_14] -Open=0 -Top=0 -[Editor_15] -Open=0 -Top=0 -[Editor_16] -Open=0 -Top=0 -CursorCol=9 -CursorRow=112 -TopLine=95 -LeftChar=1 -[Editor_17] -Open=0 -Top=0 -CursorCol=1 -CursorRow=42 -TopLine=31 -LeftChar=1 -[Editor_18] -Open=0 -Top=0 -CursorCol=15 -CursorRow=15 -TopLine=16 -LeftChar=1 -[Editor_19] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_20] -Open=0 -Top=0 -[Editor_21] -Open=0 -Top=0 -[Editor_22] -Open=0 -Top=0 -[Editor_23] -Open=0 -Top=0 -CursorCol=18 -CursorRow=32 -TopLine=20 -LeftChar=1 -[Editor_24] -Open=0 -Top=0 -CursorCol=16 -CursorRow=258 -TopLine=544 -LeftChar=1 -[Editor_25] -Open=0 -Top=0 -CursorCol=1 -CursorRow=19 -TopLine=47 -LeftChar=1 -[Editor_27] -Open=0 -Top=0 -CursorCol=16 -CursorRow=22 -TopLine=1 -LeftChar=1 -[Editor_28] -Open=0 -Top=0 -CursorCol=83 -CursorRow=281 -TopLine=187 -LeftChar=1 -[Editor_29] -Open=0 -Top=0 -CursorCol=17 -CursorRow=210 -TopLine=1 -LeftChar=1 -[Editor_30] -Open=0 -Top=0 -CursorCol=47 -CursorRow=5 -TopLine=1 -LeftChar=1 -[Editor_31] -Open=0 -Top=0 -CursorCol=34 -CursorRow=19 -TopLine=1 -LeftChar=1 -[Editor_32] -Open=0 -Top=0 -CursorCol=13 -CursorRow=269 -TopLine=257 -LeftChar=1 -[Editor_33] -Open=0 -Top=0 -CursorCol=29 -CursorRow=20 -TopLine=1 -LeftChar=1 -[Editor_34] -Open=0 -Top=0 -CursorCol=1 -CursorRow=26 -TopLine=1 -LeftChar=1 -[Editor_35] -CursorCol=15 -CursorRow=282 -TopLine=39 -LeftChar=1 -Open=1 -Top=1 -[Editor_36] -Open=0 -Top=0 -CursorCol=1 -CursorRow=29 -TopLine=1 -LeftChar=1 diff --git a/plugins/CDVDpeops/cdvdPeops.opt b/plugins/CDVDpeops/cdvdPeops.opt deleted file mode 100644 index ed0495e333..0000000000 Binary files a/plugins/CDVDpeops/cdvdPeops.opt and /dev/null differ diff --git a/plugins/CDVDpeops/cdvdPeops.plg b/plugins/CDVDpeops/cdvdPeops.plg deleted file mode 100644 index c020cb436b..0000000000 --- a/plugins/CDVDpeops/cdvdPeops.plg +++ /dev/null @@ -1,96 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: cdvdPeops - Win32 Release-------------------- -

-

Command Lines

-Creating command line "rc.exe /l 0x407 /fo"Release/cdvdPeops.res" /d "NDEBUG" "D:\src\cdvdPeops\src\cdvdPeops.rc"" -Creating temporary file "E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSP9E.tmp" with contents -[ -/nologo /G5 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"Release/" /Fp"Release/cdvdPeops.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c -"D:\src\cdvdPeops\src\cdda.c" -"D:\src\cdvdPeops\src\cdr.c" -"D:\src\cdvdPeops\src\cdvdPeops.c" -"D:\src\cdvdPeops\src\cfg.c" -"D:\src\cdvdPeops\src\generic.c" -"D:\src\cdvdPeops\src\ioctrl.c" -"D:\src\cdvdPeops\src\ppf.c" -"D:\src\cdvdPeops\src\read.c" -"D:\src\cdvdPeops\src\scsi.c" -"D:\src\cdvdPeops\src\StdAfx.c" -"D:\src\cdvdPeops\src\sub.c" -"D:\src\cdvdPeops\src\toc.c" -] -Creating command line "cl.exe @E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSP9E.tmp" -Creating temporary file "E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSP9F.tmp" with contents -[ -kernel32.lib user32.lib advapi32.lib comdlg32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"Release/cdvdPeops.pdb" /machine:I386 /def:".\cdvdPeops.def" /out:"Release/cdvdPeops.dll" /implib:"Release/cdvdPeops.lib" -.\Release\cdda.obj -.\Release\cdr.obj -.\Release\cdvdPeops.obj -.\Release\cfg.obj -.\Release\generic.obj -.\Release\ioctrl.obj -.\Release\ppf.obj -.\Release\read.obj -.\Release\scsi.obj -.\Release\StdAfx.obj -.\Release\sub.obj -.\Release\toc.obj -.\Release\cdvdPeops.res -] -Creating command line "link.exe @E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSP9F.tmp" -

Output Window

-Compiling resources... -Compiling... -cdda.c -cdr.c -cdvdPeops.c -cfg.c -generic.c -ioctrl.c -ppf.c -read.c -scsi.c -StdAfx.c -sub.c -toc.c -Linking... - Creating library Release/cdvdPeops.lib and object Release/cdvdPeops.exp -Creating temporary file "E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSPA3.tmp" with contents -[ -/nologo /o"Release/cdvdPeops.bsc" -.\Release\cdda.sbr -.\Release\cdr.sbr -.\Release\cdvdPeops.sbr -.\Release\cfg.sbr -.\Release\generic.sbr -.\Release\ioctrl.sbr -.\Release\ppf.sbr -.\Release\read.sbr -.\Release\scsi.sbr -.\Release\StdAfx.sbr -.\Release\sub.sbr -.\Release\toc.sbr] -Creating command line "bscmake.exe @E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSPA3.tmp" -Creating browse info file... -

Output Window

-Creating temporary file "E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSPA4.bat" with contents -[ -@echo off -copy release\*.dll d:\emus\pcsx2_07\plugins -] -Creating command line "E:\DOCUME~1\Pete1\LOCALS~1\Temp\RSPA4.bat" - -release\cdvdPeops.dll - 1 file(s) copied. - - - -

Results

-cdvdPeops.dll - 0 error(s), 0 warning(s) -
- - diff --git a/plugins/CDVDpeops/defines.h.bak b/plugins/CDVDpeops/defines.h.bak deleted file mode 100644 index 7926e945e7..0000000000 --- a/plugins/CDVDpeops/defines.h.bak +++ /dev/null @@ -1,213 +0,0 @@ -/*************************************************************************** - defines.h - description - ------------------- - begin : Wed Sep 18 2002 - copyright : (C) 2002 by Pete Bernert - email : BlackDove@addcom.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -//*************************************************************************// -// History of changes: -// -// 2002/09/19 - Pete -// - generic cleanup for the Peops release -// -//*************************************************************************// - -///////////////////////////////////////////////////////// - -// general buffer for reading several frames - -#pragma pack(1) - -typedef struct _FRAMEBUF -{ - DWORD dwFrame; - DWORD dwFrameCnt; - DWORD dwBufLen; - unsigned char BufData[1024*1024]; -} FRAMEBUF; - -#pragma pack() - -// raw ioctl structs: - -typedef enum _TRACK_MODE_TYPE -{ - YellowMode2, - XAForm2, - CDDA -} TRACK_MODE_TYPE, *PTRACK_MODE_TYPE; - -typedef struct _RAW_READ_INFO -{ - LARGE_INTEGER DiskOffset; - ULONG SectorCount; - TRACK_MODE_TYPE TrackMode; -} RAW_READ_INFO, *PRAW_READ_INFO; - -// sub cache: - -typedef struct -{ - long addr; - void * pNext; - unsigned char subq[10]; -} SUB_DATA; - -typedef struct -{ - long addr; - void * pNext; -} SUB_CACHE; - -// ppf cache: - -typedef struct -{ - long addr; - void * pNext; - long pos; - long anz; - // memdata -} PPF_DATA; - -typedef struct -{ - long addr; - void * pNext; -} PPF_CACHE; - -///////////////////////////////////////////////////////// - -#define MODE_BE_1 1 -#define MODE_BE_2 2 -#define MODE_28_1 3 -#define MODE_28_2 4 -#define MODE_28_2048 5 -#define MODE_28_2048_Ex 6 - -u8 __inline itob(u32 i); - -#define btoi(b) ((b)/16*10 + (b)%16) -#define itod(i) ((((i)/10)<<4) + ((i)%10)) -#define dtoi(b) ((((b)>>4)&0xf)*10 + (((b)&0xf)%10)) - -///////////////////////////////////////////////////////// - -void addr2time(unsigned long addr, unsigned char *time); -void addr2timeB(unsigned long addr, unsigned char *time); -unsigned long time2addr(unsigned char *time); -unsigned long time2addrB(unsigned char *time); -#ifdef _GCC -#define reOrder i386_reOrder -#endif -unsigned long reOrder(unsigned long value); - -///////////////////////////////////////////////////////// -// debug helper - -#ifndef _IN_CDR -#ifdef DBGOUT -void auxprintf (LPCTSTR pFormat, ...); -#endif -#endif - -///////////////////////////////////////////////////////// - -typedef DWORD (*READFUNC)(BOOL bWait,FRAMEBUF * f); -typedef DWORD (*DEINITFUNC)(void); -typedef BOOL (*READTRACKFUNC)(unsigned long addr); -typedef void (*GETPTRFUNC)(void); - -///////////////////////////////////////////////////////// - -#define WAITFOREVER 0xFFFFFFFF -#define WAITSUB 10000 -#define FRAMEBUFEXTRA 12 -#define CDSECTOR 2352 -#define MAXCACHEBLOCK 26 -#define MAXCDBUFFER (((MAXCACHEBLOCK+1)*(CDSECTOR+16))+240) - -///////////////////////////////////////////////////////// - -/* some structs from libcdvd by Hiryu & Sjeep (C) 2002 */ - -#pragma pack(1) - -struct rootDirTocHeader -{ - u16 length; //+00 - u32 tocLBA; //+02 - u32 tocLBA_bigend; //+06 - u32 tocSize; //+0A - u32 tocSize_bigend; //+0E - u8 dateStamp[8]; //+12 - u8 reserved[6]; //+1A - u8 reserved2; //+20 - u8 reserved3; //+21 -}; //+22 - -struct asciiDate -{ - char year[4]; - char month[2]; - char day[2]; - char hours[2]; - char minutes[2]; - char seconds[2]; - char hundreths[2]; - char terminator[1]; -}; - -struct cdVolDesc -{ - u8 filesystemType; // 0x01 = ISO9660, 0x02 = Joliet, 0xFF = NULL - u8 volID[5]; // "CD001" - u8 reserved2; - u8 reserved3; - u8 sysIdName[32]; - u8 volName[32]; // The ISO9660 Volume Name - u8 reserved5[8]; - u32 volSize; // Volume Size - u32 volSizeBig; // Volume Size Big-Endian - u8 reserved6[32]; - u32 unknown1; - u32 unknown1_bigend; - u16 volDescSize; //+80 - u16 volDescSize_bigend; //+82 - u32 unknown3; //+84 - u32 unknown3_bigend; //+88 - u32 priDirTableLBA; // LBA of Primary Dir Table //+8C - u32 reserved7; //+90 - u32 secDirTableLBA; // LBA of Secondary Dir Table //+94 - u32 reserved8; //+98 - struct rootDirTocHeader rootToc; - u8 volSetName[128]; - u8 publisherName[128]; - u8 preparerName[128]; - u8 applicationName[128]; - u8 copyrightFileName[37]; - u8 abstractFileName[37]; - u8 bibliographyFileName[37]; - struct asciiDate creationDate; - struct asciiDate modificationDate; - struct asciiDate effectiveDate; - struct asciiDate expirationDate; - u8 reserved10; - u8 reserved11[1166]; -}; - -#pragma pack() - - diff --git a/plugins/CDVDpeops/externals.h.bak b/plugins/CDVDpeops/externals.h.bak deleted file mode 100644 index c0ffb37b71..0000000000 --- a/plugins/CDVDpeops/externals.h.bak +++ /dev/null @@ -1,175 +0,0 @@ -/*************************************************************************** - externals.h - description - ------------------- - begin : Wed Sep 18 2002 - copyright : (C) 2002 by Pete Bernert - email : BlackDove@addcom.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -//*************************************************************************// -// History of changes: -// -// 2002/09/19 - Pete -// - generic cleanup for the Peops release -// -//*************************************************************************// - -///////////////////////////////////////////////////////// - -#ifndef _IN_CDDA - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_CDR - -extern BOOL bIsOpen; -extern BOOL bCDDAPlay; -extern int iCDROK; -extern char *libraryName; -extern int iCheckTrayStatus; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_PEOPS - -extern HINSTANCE hInst; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_CFG - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_GENERIC - -extern int iCD_AD; -extern int iCD_TA; -extern int iCD_LU; -extern int iRType; -extern int iUseSpeedLimit; -extern int iSpeedLimit; -extern int iNoWait; -extern int iMaxRetry; -extern int iShowReadErr; -extern HANDLE hEvent; -extern HINSTANCE hASPI; -extern READFUNC pReadFunc; -extern DEINITFUNC pDeInitFunc; -extern int iInterfaceMode; -extern int iWantedBlockSize; -extern int iUsedBlockSize; -extern int iUsedMode; - -extern DWORD (*pGetASPI32SupportInfo)(void); -extern DWORD (*pSendASPI32Command)(LPSRB); - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_IOCTL - -extern HANDLE hIOCTL; -extern DWORD dwIOCTLAttr; -extern OVERLAPPED ovcIOCTL; -extern SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sptIOCTL; -extern RAW_READ_INFO rawIOCTL; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_PPF - -extern int iUsePPF; -extern char szPPF[]; -extern PPF_CACHE * ppfCache; -extern PPF_DATA * ppfHead; -extern int iPPFNum; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_READ - -extern READTRACKFUNC pReadTrackFunc; -extern GETPTRFUNC pGetPtrFunc; - -extern int iUseCaching; -extern int iUseDataCache; -extern int iTryAsync; -extern int iBufSel; - -extern unsigned char * pMainBuffer; -extern unsigned char * pCurrReadBuf; -extern unsigned char * pFirstReadBuf; -extern unsigned char * pAsyncBuffer; - -extern unsigned long lMaxAddr; -extern unsigned long lLastAddr; -extern unsigned long lLastAsyncAddr; - -extern unsigned char * ptrBuffer[]; -extern unsigned char * pAsyncFirstReadBuf[]; -extern unsigned long lLastAccessedAddr; -extern int iLastAccessedMode; - -extern HANDLE hReadThread; -extern BOOL bThreadEnded; -extern HANDLE hThreadEvent[]; -extern HANDLE hThreadMutex[]; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_SCSI - -extern SRB_ExecSCSICmd sx; -extern BOOL bDoWaiting; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_SUB - -extern unsigned char * pCurrSubBuf; -extern int iUseSubReading; -extern char szSUBF[]; -extern SUB_CACHE * subCache; -extern SUB_DATA * subHead; -extern int iSUBNum; -extern unsigned char SubCData[]; -extern unsigned char SubAData[]; - -#endif - -///////////////////////////////////////////////////////// - -#ifndef _IN_TOC - -extern TOC sTOC; - -#endif - -///////////////////////////////////////////////////////// diff --git a/plugins/CDVDpeops/generic.c.bak b/plugins/CDVDpeops/generic.c.bak deleted file mode 100644 index 30cf7eba25..0000000000 --- a/plugins/CDVDpeops/generic.c.bak +++ /dev/null @@ -1,377 +0,0 @@ -/*************************************************************************** - generic.c - description - ------------------- - begin : Sun Nov 16 2003 - copyright : (C) 2003 by Pete Bernert - email : BlackDove@addcom.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. See also the license.txt file for * - * additional informations. * - * * - ***************************************************************************/ - -//*************************************************************************// -// History of changes: -// -// 2004/12/25 - Pete -// - repaired time2addr/addr2time -// -// 2003/11/16 - Pete -// - generic cleanup for the Peops release -// -//*************************************************************************// - -///////////////////////////////////////////////////////// - -#include "stdafx.h" -#define _IN_GENERIC -#include "externals.h" - -///////////////////////////////////////////////////////// - -int iCD_AD=-1; // drive address -int iCD_TA=-1; -int iCD_LU=-1; -int iRType=0; // read mode -int iUseSpeedLimit=0; // speed limit use -int iSpeedLimit=2; // speed 2x -int iNoWait=0; // wait -int iMaxRetry=5; // retry on error -int iShowReadErr=0; // show msg on error -HANDLE hEvent=NULL; // global event -HINSTANCE hASPI=NULL; // aspi lib -READFUNC pReadFunc=NULL; // read func -DEINITFUNC pDeInitFunc=NULL; // deinit func -int iInterfaceMode=1; // interface (aspi/ioctrlscsi/ioctrlraw) -int iWantedBlockSize=2352; -int iUsedBlockSize=2352; -int iUsedMode=CDVD_MODE_2352; - -DWORD (*pGetASPI32SupportInfo)(void); // ptrs to aspi funcs -DWORD (*pSendASPI32Command)(LPSRB); - -///////////////////////////////////////////////////////// - -void addr2time(unsigned long addr, unsigned char *time) -{ - addr+=150; - time[3] = (unsigned char)(addr%75); - addr/=75; - time[2]=(unsigned char)(addr%60); - addr/=60; - time[1]=(unsigned char)(addr%100); - time[0]=(unsigned char)(addr/100); -} - -void addr2timeB(unsigned long addr, unsigned char *time) -{ - time[3] = itob((unsigned char)(addr%75)); - addr/=75; - time[2]=itob((unsigned char)(addr%60)); - addr/=60; - time[1]=itob((unsigned char)(addr%100)); - time[0]=itob((unsigned char)(addr/100)); -} - -unsigned long time2addr(unsigned char *time) -{ - unsigned long addr; - - addr = time[0]*100; - addr += time[1]; - addr *= 60; - - addr = (addr + time[2])*75; - addr += time[3]; - addr -= 150; - return addr; -} - -unsigned long time2addrB(unsigned char *time) -{ - unsigned long addr; - - addr = (btoi(time[0]))*100; - addr += btoi(time[1]); - addr *= 60; - addr = (addr + btoi(time[2]))*75; - addr += btoi(time[3]); - addr -= 150; - return addr; -} - -#ifndef _GCC -unsigned long reOrder(unsigned long value) -{ -#pragma warning (disable: 4035) - __asm - { - mov eax,value - bswap eax - } -} -#endif - -///////////////////////////////////////////////////////// - -void CreateGenEvent(void) -{ - hEvent=CreateEvent(NULL,TRUE,FALSE,NULL); -} - -///////////////////////////////////////////////////////// - -void FreeGenEvent(void) -{ - if(hEvent) CloseHandle(hEvent); - hEvent=0; -} - -///////////////////////////////////////////////////////// - -DWORD WaitGenEvent(DWORD dwMS) -{ - if(hASPI) // aspi event - return WaitForSingleObject(hEvent,dwMS); - else - { // ioctl overlapped (always waiting til finished, dwMS not used) - DWORD dwR=0; - GetOverlappedResult(hIOCTL,&ovcIOCTL,&dwR,TRUE); - return 0; - } -} - -///////////////////////////////////////////////////////// - -void LockGenCDAccess(void) -{ - if(hReadThread) // thread mode? - WaitForSingleObject(hThreadMutex[0],INFINITE); // -> wait until all reading is done - else // async prefetch? - if(bDoWaiting) // -> async operation has to finish first - {WaitGenEvent(0xFFFFFFFF);bDoWaiting=FALSE;} -} - -///////////////////////////////////////////////////////// - -void UnlockGenCDAccess(void) -{ - if(hReadThread) // thread mode? - ReleaseMutex(hThreadMutex[0]); // -> we are finished with our special command, now reading can go on -} - -///////////////////////////////////////////////////////// - -void WaitUntilDriveIsReady(void) -{ - if(iNoWait==0) - { - while(TestSCSIUnitReady()==0) Sleep(500); - } -} - -///////////////////////////////////////////////////////// - -void SetGenCDSpeed(int iReset) -{ - if(iUseSpeedLimit) - { - if(bDoWaiting) // still a command running? wait - {WaitGenEvent(0xFFFFFFFF);bDoWaiting=FALSE;} - - if(iReset) SetSCSISpeed(0xFFFF); - else - if(SetSCSISpeed(176*iSpeedLimit)<=0) - { - MessageBox(GetActiveWindow(), - "Failure: cannot change the drive speed!", - "cdvdPeops... speed limitation", - MB_OK|MB_ICONEXCLAMATION); - iUseSpeedLimit=0; - } - } -} - -///////////////////////////////////////////////////////// -// checks, which direct subchannel reading type is supported - -void GetBESubReadFunc(void) -{ - unsigned char * pB=(unsigned char *)malloc(4096); - - pReadFunc = ReadSCSI_BE_Sub; // pre-init read func - - WaitUntilDriveIsReady(); // wait before first read - - ReadSub_BE_2(0,pB,1); // first (unchecked) read - if(!ReadSub_BE_2(0,pB,1)) // read again, and check this time - { // -> read failed? - if(ReadSub_BE_2_1(0,pB,1)) // -> try different sub reading - { // --> success? mmm... let us check the data - DecodeSub_BE_2_1(pB+2352); // --> decode sub - if(*(pB+2352)==0x41) // --> check the first decoded byte - pReadFunc = ReadSCSI_BE_Sub_1; // ---> wow, byte is ok - } - } - free(pB); -} - -///////////////////////////////////////////////////////// - -int GetGenReadFunc(int iRM) -{ - switch(iRM) // scsi read mode - { - // ------------------------------------------------ // - case MODE_BE_1: - case MODE_BE_2: - { - if(iUseSubReading==1) - GetBESubReadFunc(); - else pReadFunc = ReadSCSI_BE; - } break; - // ------------------------------------------------ // - case MODE_28_1: - case MODE_28_2: - { - if(iUseSubReading==1) - pReadFunc = ReadSCSI_28_Sub; - else pReadFunc = ReadSCSI_28; - } break; - // ------------------------------------------------ // - case MODE_28_2048: - { - pReadFunc = ReadSCSI_28_2048; - } break; - // ------------------------------------------------ // - case MODE_28_2048_Ex: - { - pReadFunc = ReadSCSI_28_2048_Ex; - } break; - // ------------------------------------------------ // - default: - { - pReadFunc = ReadSCSI_Dummy; - } return -3; - // ------------------------------------------------ // - } - return 1; -} - -///////////////////////////////////////////////////////// - -int OpenGenCD(int iA,int iT,int iL) -{ - pDeInitFunc = NULL; // init de-init func - pReadFunc = ReadSCSI_Dummy; // init (dummy) read func - - if(iA==-1) return -1; // not configured properly - - // -------------------------------------------------- // - - if(iInterfaceMode>1) // ioctrl interfaces? - { - OpenIOCTLHandle(iA,iT,iL); // open w2k/xp ioctrl device - if(hIOCTL==NULL) return -2; // no cdrom available - - if(iInterfaceMode==3) // special ioctl RAW mode? - { // -> get special reading funcs (non-scsi!) - if(iUseSubReading==1) - pReadFunc = ReadIOCTL_Raw_Sub; - else pReadFunc = ReadIOCTL_Raw; - - WaitUntilDriveIsReady(); - return 1; - } - } - else // aspi interface? - { - int iDevice=GetSCSIDevice(iA,iT,iL); // get device type - if(iDevice!=DTYPE_CDROM) return -2; // no cdrom? bye - } - - if(CheckSCSIReadMode()==SS_COMP) - WaitUntilDriveIsReady(); - else - { - CloseIOCTLHandle(); - return -3; - } - - return 1; -} - -///////////////////////////////////////////////////////// - -void CloseGenCD(void) -{ - iCDROK=0; // no more cd available - if(pDeInitFunc) pDeInitFunc(); // deinit, if needed - pDeInitFunc = NULL; - pReadFunc = ReadSCSI_Dummy; - CloseIOCTLHandle(); // close ioctl drive file (if used) -} - -///////////////////////////////////////////////////////// - -void OpenGenInterface(void) -{ - hASPI=NULL; - - if(iInterfaceMode==0) return; // no interface? no fun - else - if(iInterfaceMode==1) // aspi - { - hASPI=LoadLibrary("WNASPI32.DLL"); - if(hASPI) - { - pGetASPI32SupportInfo = - (DWORD(*)(void)) GetProcAddress(hASPI,"GetASPI32SupportInfo"); - pSendASPI32Command = - (DWORD(*)(LPSRB))GetProcAddress(hASPI,"SendASPI32Command"); - - if(!pGetASPI32SupportInfo || !pSendASPI32Command) - { - iInterfaceMode=0; - return; - } - } - } - else // ioctl - { - if(iInterfaceMode<2 || iInterfaceMode>3) iInterfaceMode=2; - pGetASPI32SupportInfo = NULL; - pSendASPI32Command = IOCTLSendASPI32Command; - } -} - -///////////////////////////////////////////////////////// - -void CloseGenInterface(void) -{ - pGetASPI32SupportInfo=NULL; // clear funcs - pSendASPI32Command=NULL; - - if(hASPI) // free aspi - { - FreeLibrary(hASPI); - hASPI=NULL; - } - else CloseIOCTLHandle(); // or close ioctl file -} - -///////////////////////////////////////////////////////// - -int GetGenCDDrives(char * pDList) -{ - if(hASPI) return GetSCSICDDrives(pDList); // aspi? use it - return GetIOCTLCDDrives(pDList); // or use ioctl -} - -///////////////////////////////////////////////////////// diff --git a/plugins/FWnull/PS2Edefs.h b/plugins/FWnull/PS2Edefs.h deleted file mode 100644 index 34bfdf54f2..0000000000 --- a/plugins/FWnull/PS2Edefs.h +++ /dev/null @@ -1,848 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgetLastTag GSgetLastTag; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSsetupRecording GSsetupRecording; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; -_PADupdate PAD1update; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; -_PADupdate PAD2update; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2setDMABaseAddr SPU2setDMABaseAddr; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2setupRecording SPU2setupRecording; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/FWnull/PS2Etypes.h b/plugins/FWnull/PS2Etypes.h deleted file mode 100644 index 1ad73e273d..0000000000 --- a/plugins/FWnull/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/FWnull/Win32/Config.c b/plugins/FWnull/Win32/Config.c index 4090db202c..aee13009b9 100644 --- a/plugins/FWnull/Win32/Config.c +++ b/plugins/FWnull/Win32/Config.c @@ -1,6 +1,6 @@ #include -#include "FW.h" +#include "../FW.h" extern HINSTANCE hInst; void SaveConfig() diff --git a/plugins/SPU2null/Src/SPU2null_2005.vcproj b/plugins/FWnull/Win32/FWnull_vc2008.vcproj similarity index 58% rename from plugins/SPU2null/Src/SPU2null_2005.vcproj rename to plugins/FWnull/Win32/FWnull_vc2008.vcproj index e68a2a063c..61289dd1d7 100644 --- a/plugins/SPU2null/Src/SPU2null_2005.vcproj +++ b/plugins/FWnull/Win32/FWnull_vc2008.vcproj @@ -1,11 +1,12 @@ - @@ -108,7 +100,6 @@ /> -
@@ -180,51 +169,44 @@ - - - - + + diff --git a/plugins/FWnull/Win32/FireWireNull.def b/plugins/FWnull/Win32/FireWireNull.def index dc1fd03968..51e786a1fd 100644 --- a/plugins/FWnull/Win32/FireWireNull.def +++ b/plugins/FWnull/Win32/FireWireNull.def @@ -1,6 +1,6 @@ ; FireWire.def : Declares the module parameters for the DLL. -LIBRARY "FireWirePlugin" +LIBRARY "FWnull" EXPORTS ; Explicit exports can go here diff --git a/plugins/FWnull/Win32/FireWireNull.sln b/plugins/FWnull/Win32/FireWireNull.sln deleted file mode 100644 index 95dd0df9c4..0000000000 --- a/plugins/FWnull/Win32/FireWireNull.sln +++ /dev/null @@ -1,18 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FireWireNull", "FireWireNull.vcproj", "{F7181922-7377-4F67-9F50-10997B4613D8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F7181922-7377-4F67-9F50-10997B4613D8}.Release.ActiveCfg = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/FWnull/Win32/FireWireNull.suo b/plugins/FWnull/Win32/FireWireNull.suo deleted file mode 100644 index c194506856..0000000000 Binary files a/plugins/FWnull/Win32/FireWireNull.suo and /dev/null differ diff --git a/plugins/FWnull/Win32/FireWireNull.vcproj b/plugins/FWnull/Win32/FireWireNull.vcproj deleted file mode 100644 index 45837c7548..0000000000 --- a/plugins/FWnull/Win32/FireWireNull.vcproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/FWnull/Win32/FireWireNull_2005_x64.vcproj b/plugins/FWnull/Win32/FireWireNull_2005_x64.vcproj deleted file mode 100644 index 840da7efd2..0000000000 --- a/plugins/FWnull/Win32/FireWireNull_2005_x64.vcproj +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.sln b/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.sln deleted file mode 100644 index 8348796c93..0000000000 --- a/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FireWireNull", "FireWireNull_vsnet2005beta1.vcproj", "{F7181922-7377-4F67-9F50-10997B4613D8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - amd64|Win32 = amd64|Win32 - amd64|Win64 (AMD64) = amd64|Win64 (AMD64) - Release|Win32 = Release|Win32 - Release|Win64 (AMD64) = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win32.ActiveCfg = amd64|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win32.Build.0 = amd64|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win64 (AMD64).ActiveCfg = amd64|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win64 (AMD64).Build.0 = amd64|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win32.ActiveCfg = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win32.Build.0 = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win64 (AMD64).ActiveCfg = Release|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win64 (AMD64).Build.0 = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.vcproj b/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.vcproj deleted file mode 100644 index 477f6c82d7..0000000000 --- a/plugins/FWnull/Win32/FireWireNull_vsnet2005beta1.vcproj +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/FWnull/Win32/ProjectRootDir.vsprops b/plugins/FWnull/Win32/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/FWnull/Win32/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/FWnull/Win32/Win32.c b/plugins/FWnull/Win32/Win32.c index b3815ed22f..3d964f68ad 100644 --- a/plugins/FWnull/Win32/Win32.c +++ b/plugins/FWnull/Win32/Win32.c @@ -4,7 +4,7 @@ #include "resource.h" -#include "FW.h" +#include "../FW.h" HINSTANCE hInst; diff --git a/plugins/FWnull/Win32/afxresmw.h b/plugins/FWnull/Win32/afxresmw.h deleted file mode 100644 index 99eace37c4..0000000000 --- a/plugins/FWnull/Win32/afxresmw.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/GSdx/GSdx_vs2008.vcproj b/plugins/GSdx/GSdx_vs2008.vcproj index d62abfced6..8fa577240e 100644 --- a/plugins/GSdx/GSdx_vs2008.vcproj +++ b/plugins/GSdx/GSdx_vs2008.vcproj @@ -22,7 +22,7 @@ @@ -82,6 +82,452 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1198,6 +1191,14 @@ AssemblerOutput="4" /> + + + - - - @@ -1474,14 +1467,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1490,14 +1475,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1506,14 +1483,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1522,14 +1491,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1538,14 +1499,6 @@ UsePrecompiledHeader="1" /> - - - @@ -1555,7 +1508,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -1962,14 +1955,6 @@ UsePrecompiledHeader="0" /> - - - @@ -1978,14 +1963,6 @@ UsePrecompiledHeader="0" /> - - - @@ -1994,14 +1971,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2010,14 +1979,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2026,14 +1987,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2043,7 +1996,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2098,14 +2091,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2114,14 +2099,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2130,14 +2107,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2146,14 +2115,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2162,14 +2123,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2179,7 +2132,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2234,14 +2227,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2250,14 +2235,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2266,14 +2243,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2282,14 +2251,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2298,14 +2259,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2315,7 +2268,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2370,14 +2363,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2386,14 +2371,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2402,14 +2379,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2418,14 +2387,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2434,14 +2395,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2451,7 +2404,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2506,14 +2499,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2522,14 +2507,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2538,14 +2515,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2554,14 +2523,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2570,14 +2531,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2587,7 +2540,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2642,14 +2635,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2658,14 +2643,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2674,14 +2651,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2690,14 +2659,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2706,14 +2667,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2723,7 +2676,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2794,14 +2787,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2810,14 +2795,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2826,14 +2803,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2842,14 +2811,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2858,14 +2819,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2875,7 +2828,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -2930,14 +2923,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2946,14 +2931,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2962,14 +2939,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2978,14 +2947,6 @@ UsePrecompiledHeader="0" /> - - - @@ -2994,14 +2955,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3011,7 +2964,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3066,14 +3059,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3082,14 +3067,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3098,14 +3075,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3114,14 +3083,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3130,14 +3091,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3147,7 +3100,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3202,14 +3195,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3218,14 +3203,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3234,14 +3211,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3250,14 +3219,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3266,14 +3227,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3283,7 +3236,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3338,14 +3331,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3354,14 +3339,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3370,14 +3347,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3386,14 +3355,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3402,14 +3363,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3419,7 +3372,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3478,14 +3471,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3494,14 +3479,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3510,14 +3487,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3526,14 +3495,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3542,14 +3503,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3559,7 +3512,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3614,14 +3607,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3630,14 +3615,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3646,14 +3623,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3662,14 +3631,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3678,14 +3639,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3695,7 +3648,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3750,14 +3743,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3766,14 +3751,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3782,14 +3759,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3798,14 +3767,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3814,14 +3775,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3831,7 +3784,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -3886,14 +3879,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3902,14 +3887,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3918,14 +3895,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3934,14 +3903,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3950,14 +3911,6 @@ UsePrecompiledHeader="0" /> - - - @@ -3967,7 +3920,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4026,14 +4019,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4042,14 +4027,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4058,14 +4035,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4074,14 +4043,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4090,14 +4051,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4107,7 +4060,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4162,14 +4155,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4178,14 +4163,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4194,14 +4171,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4210,14 +4179,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4226,14 +4187,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4243,7 +4196,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4298,14 +4291,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4314,14 +4299,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4330,14 +4307,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4346,14 +4315,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4362,14 +4323,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4379,7 +4332,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4434,14 +4427,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4450,14 +4435,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4466,14 +4443,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4482,14 +4451,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4498,14 +4459,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4515,7 +4468,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4570,14 +4563,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4586,14 +4571,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4602,14 +4579,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4618,14 +4587,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4634,14 +4595,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4651,7 +4604,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4706,14 +4699,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4722,14 +4707,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4738,14 +4715,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4754,14 +4723,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4770,14 +4731,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4787,7 +4740,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4842,14 +4835,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4858,14 +4843,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4874,14 +4851,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4890,14 +4859,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4906,14 +4867,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4923,7 +4876,7 @@ /> + + + + + + + + + + + + + + + + + + - - - @@ -4978,14 +4971,6 @@ UsePrecompiledHeader="0" /> - - - @@ -4994,14 +4979,6 @@ UsePrecompiledHeader="0" /> - - - @@ -5010,14 +4987,6 @@ UsePrecompiledHeader="0" /> - - - @@ -5026,14 +4995,6 @@ UsePrecompiledHeader="0" /> - - - @@ -5042,14 +5003,6 @@ UsePrecompiledHeader="0" /> - - - @@ -5059,7 +5012,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/GSdx/vsprops/common.vsprops b/plugins/GSdx/vsprops/common.vsprops index 105979a357..3f15600998 100644 --- a/plugins/GSdx/vsprops/common.vsprops +++ b/plugins/GSdx/vsprops/common.vsprops @@ -3,7 +3,6 @@ ProjectType="Visual C++" Version="8.00" Name="common" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" > diff --git a/plugins/GSdx/vsprops/postBuild.tmpl b/plugins/GSdx/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/GSdx/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/GSdx/vsprops/postBuild.unknown b/plugins/GSdx/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/GSdx/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/GSdx/vsprops/preBuild.cmd b/plugins/GSdx/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/GSdx/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/GSdx/vsprops/svnrev_template.h b/plugins/GSdx/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/GSdx/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/GSdx/vsprops/svnrev_unknown.h b/plugins/GSdx/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/GSdx/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/GSdx_vs2008.sln b/plugins/GSdx_vs2008.sln deleted file mode 100644 index fcae93f3c0..0000000000 --- a/plugins/GSdx_vs2008.sln +++ /dev/null @@ -1,38 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GSdx", "GSdx\GSdx_vs2008.vcproj", "{18E42F6F-3A62-41EE-B42F-79366C4F1E95}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug SSE2|Win32 = Debug SSE2|Win32 - Debug SSE4|Win32 = Debug SSE4|Win32 - Debug SSSE3|Win32 = Debug SSSE3|Win32 - Debug|Win32 = Debug|Win32 - Release SSE2|Win32 = Release SSE2|Win32 - Release SSE4|Win32 = Release SSE4|Win32 - Release SSSE3|Win32 = Release SSSE3|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSE2|Win32.ActiveCfg = Debug SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSE2|Win32.Build.0 = Debug SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSE4|Win32.ActiveCfg = Debug SSE4|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSE4|Win32.Build.0 = Debug SSE4|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSSE3|Win32.ActiveCfg = Debug SSSE3|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug SSSE3|Win32.Build.0 = Debug SSSE3|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.ActiveCfg = Debug|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Debug|Win32.Build.0 = Debug|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.ActiveCfg = Release SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE2|Win32.Build.0 = Release SSE2|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.ActiveCfg = Release SSE4|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSE4|Win32.Build.0 = Release SSE4|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.ActiveCfg = Release SSSE3|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release SSSE3|Win32.Build.0 = Release SSSE3|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.ActiveCfg = Release|Win32 - {18E42F6F-3A62-41EE-B42F-79366C4F1E95}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/LilyPad/Global.h b/plugins/LilyPad/Global.h index c28857a6ab..98a68c4994 100644 --- a/plugins/LilyPad/Global.h +++ b/plugins/LilyPad/Global.h @@ -9,7 +9,10 @@ #define UNICODE +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE +#endif + // Actually works with 0x0400, but need 0x500 to get XBUTTON defines, // 0x501 to get raw input structures, and 0x0600 to get WM_MOUSEHWHEEL. #define WINVER 0x0600 diff --git a/plugins/LilyPad/KeyboardQueue.cpp b/plugins/LilyPad/KeyboardQueue.cpp index fe937afbeb..39ad231bf3 100644 --- a/plugins/LilyPad/KeyboardQueue.cpp +++ b/plugins/LilyPad/KeyboardQueue.cpp @@ -32,7 +32,7 @@ void QueueKeyEvent(int key, int event) { } } queuedEvents[index].key = key; - queuedEvents[index].event = event; + queuedEvents[index].evt = event; numQueuedEvents ++; LeaveCriticalSection(&cSection); } diff --git a/plugins/LilyPad/LilyPad.cpp b/plugins/LilyPad/LilyPad.cpp index c356b5cdb4..892dc5a35f 100644 --- a/plugins/LilyPad/LilyPad.cpp +++ b/plugins/LilyPad/LilyPad.cpp @@ -1080,14 +1080,14 @@ keyEvent* CALLBACK PADkeyEvent() { static int shiftDown = 0; static keyEvent ev; if (!GetQueuedKeyEvent(&ev)) return 0; - if (ev.key == VK_ESCAPE && ev.event == KEYPRESS && config.escapeFullscreenHack) { + if (ev.key == VK_ESCAPE && ev.evt == KEYPRESS && config.escapeFullscreenHack) { if (IsWindowMaximized(hWnd)) { EatWndProc(hWnd, KillFullScreenProc); return 0; } } - if (ev.key == VK_F2 && ev.event == KEYPRESS) { + if (ev.key == VK_F2 && ev.evt == KEYPRESS) { saveStateIndex += 1 - 2*shiftDown; saveStateIndex = (saveStateIndex+10)%10; if (config.saveStateTitle) { @@ -1100,7 +1100,7 @@ keyEvent* CALLBACK PADkeyEvent() { if (ev.key == VK_LSHIFT || ev.key == VK_RSHIFT || ev.key == VK_SHIFT) { ev.key = VK_SHIFT; - if (ev.event == KEYPRESS) + if (ev.evt == KEYPRESS) shiftDown = 1; else shiftDown = 0; diff --git a/plugins/LilyPad/LilyPad_VC2008.sln b/plugins/LilyPad/LilyPad_VC2008.sln deleted file mode 100644 index e59b5c350c..0000000000 --- a/plugins/LilyPad/LilyPad_VC2008.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LilyPad", "LilyPad_VC2008.vcproj", "{E4081455-398C-4610-A87C-90A8A7D72DC3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|Win32.ActiveCfg = Debug|Win32 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|Win32.Build.0 = Debug|Win32 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|x64.ActiveCfg = Debug|x64 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Debug|x64.Build.0 = Debug|x64 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release|Win32.ActiveCfg = Release|Win32 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release|Win32.Build.0 = Release|Win32 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release|x64.ActiveCfg = Release|x64 - {E4081455-398C-4610-A87C-90A8A7D72DC3}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/LilyPad/LilyPad_VC2008.vcproj b/plugins/LilyPad/LilyPad_VC2008.vcproj index 41886cdb04..bfacc6d245 100644 --- a/plugins/LilyPad/LilyPad_VC2008.vcproj +++ b/plugins/LilyPad/LilyPad_VC2008.vcproj @@ -20,12 +20,9 @@ @@ -144,7 +133,6 @@ MkTypLibCompatible="true" SuppressStartupBanner="true" TargetEnvironment="1" - TypeLibraryName=".\Release/LilyPad.tlb" HeaderFileName="" /> @@ -339,7 +311,6 @@ MkTypLibCompatible="true" SuppressStartupBanner="true" TargetEnvironment="3" - TypeLibraryName=".\Release/LilyPad.tlb" HeaderFileName="" /> - - - - diff --git a/plugins/LilyPad/PS2Edefs.h b/plugins/LilyPad/PS2Edefs.h deleted file mode 100644 index 702dce6fa2..0000000000 --- a/plugins/LilyPad/PS2Edefs.h +++ /dev/null @@ -1,834 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -// extended funcs - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgetLastTag GSgetLastTag; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; -_PADupdate PAD1update; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; -_PADupdate PAD2update; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2setDMABaseAddr SPU2setDMABaseAddr; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/LilyPad/PS2Etypes.h b/plugins/LilyPad/PS2Etypes.h deleted file mode 100644 index 00ecf22447..0000000000 --- a/plugins/LilyPad/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/LilyPad/ProjectRootDir.vsprops b/plugins/LilyPad/ProjectRootDir.vsprops new file mode 100644 index 0000000000..06f5c60676 --- /dev/null +++ b/plugins/LilyPad/ProjectRootDir.vsprops @@ -0,0 +1,23 @@ + + + + + + + diff --git a/plugins/PeopsSPU2/spu2PeopsSound.aps b/plugins/PeopsSPU2/spu2PeopsSound.aps deleted file mode 100644 index ca140bb3d2..0000000000 Binary files a/plugins/PeopsSPU2/spu2PeopsSound.aps and /dev/null differ diff --git a/plugins/PeopsSPU2/spu2PeopsSound.dsp b/plugins/PeopsSPU2/spu2PeopsSound.dsp deleted file mode 100644 index d6c71d4860..0000000000 --- a/plugins/PeopsSPU2/spu2PeopsSound.dsp +++ /dev/null @@ -1,282 +0,0 @@ -# Microsoft Developer Studio Project File - Name="spu2PeopsSound" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=spu2PeopsSound - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "spu2PeopsSound.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "spu2PeopsSound.mak" CFG="spu2PeopsSound - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "spu2PeopsSound - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "spu2PeopsSound - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "spu2PeopsSound - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G5 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "NDEBUG" -# ADD RSC /l 0x407 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 dsound.lib winmm.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=rem copy release\spu2PeopsSound.dll D:\pcsx2\plugins\spu2PeopsDSound.dll -# End Special Build Tool - -!ELSEIF "$(CFG)" == "spu2PeopsSound - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x407 /d "_DEBUG" -# ADD RSC /l 0x407 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "spu2PeopsSound - Win32 Release" -# Name "spu2PeopsSound - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\adsr.c -# End Source File -# Begin Source File - -SOURCE=.\alsa.c -# End Source File -# Begin Source File - -SOURCE=.\cfg.c -# End Source File -# Begin Source File - -SOURCE=.\debug.c -# End Source File -# Begin Source File - -SOURCE=.\dma.c -# End Source File -# Begin Source File - -SOURCE=.\dsound.c -# End Source File -# Begin Source File - -SOURCE=.\freeze.c -# End Source File -# Begin Source File - -SOURCE=.\oss.c -# End Source File -# Begin Source File - -SOURCE=.\psemu.c -# End Source File -# Begin Source File - -SOURCE=.\record.c -# End Source File -# Begin Source File - -SOURCE=.\registers.c -# End Source File -# Begin Source File - -SOURCE=.\reverb.c -# End Source File -# Begin Source File - -SOURCE=.\spu.c -# End Source File -# Begin Source File - -SOURCE=.\spu2PeopsSound.c -# End Source File -# Begin Source File - -SOURCE=.\spu2PeopsSound.def -# End Source File -# Begin Source File - -SOURCE=.\spu2PeopsSound.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.c -# End Source File -# Begin Source File - -SOURCE=.\xa.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\adsr.h -# End Source File -# Begin Source File - -SOURCE=.\alsa.h -# End Source File -# Begin Source File - -SOURCE=.\cfg.h -# End Source File -# Begin Source File - -SOURCE=.\debug.h -# End Source File -# Begin Source File - -SOURCE=.\dma.h -# End Source File -# Begin Source File - -SOURCE=.\dsoundoss.h -# End Source File -# Begin Source File - -SOURCE=.\externals.h -# End Source File -# Begin Source File - -SOURCE=.\gauss_i.h -# End Source File -# Begin Source File - -SOURCE=.\psemuxa.h -# End Source File -# Begin Source File - -SOURCE=.\record.h -# End Source File -# Begin Source File - -SOURCE=.\registers.h -# End Source File -# Begin Source File - -SOURCE=.\regs.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\reverb.h -# End Source File -# Begin Source File - -SOURCE=.\spu.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\xa.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\bitmap1.bmp -# End Source File -# Begin Source File - -SOURCE=.\bitmap2.bmp -# End Source File -# Begin Source File - -SOURCE=.\bitmap3.bmp -# End Source File -# Begin Source File - -SOURCE=.\bitmap4.bmp -# End Source File -# Begin Source File - -SOURCE=.\bitmap5.bmp -# End Source File -# End Group -# Begin Group "Documentation Files" - -# PROP Default_Filter "txt" -# Begin Source File - -SOURCE=.\changelog.txt -# End Source File -# Begin Source File - -SOURCE=.\Filemap.txt -# End Source File -# Begin Source File - -SOURCE=.\License.txt -# End Source File -# End Group -# End Target -# End Project diff --git a/plugins/PeopsSPU2/spu2PeopsSound.dsw b/plugins/PeopsSPU2/spu2PeopsSound.dsw deleted file mode 100644 index fe93e6f06e..0000000000 --- a/plugins/PeopsSPU2/spu2PeopsSound.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "spu2PeopsSound"=.\spu2PeopsSound.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/plugins/PeopsSPU2/spu2PeopsSound.layout b/plugins/PeopsSPU2/spu2PeopsSound.layout deleted file mode 100644 index 0b3a784f5a..0000000000 --- a/plugins/PeopsSPU2/spu2PeopsSound.layout +++ /dev/null @@ -1,284 +0,0 @@ -[Editor_0] -CursorCol=5 -CursorRow=443 -TopLine=431 -LeftChar=1 -Open=1 -Top=0 -[Editor_3] -CursorCol=27 -CursorRow=232 -TopLine=223 -LeftChar=1 -Open=1 -Top=0 -[Editors] -Order=11,9,4,34,2,14,23,29,5,0,3,19,6,7,8,10,12,13 -Focused=14 -[Editor_1] -Open=0 -Top=0 -CursorCol=9 -CursorRow=81 -TopLine=81 -LeftChar=1 -[Editor_2] -Open=1 -Top=0 -CursorCol=1 -CursorRow=312 -TopLine=284 -LeftChar=1 -[Editor_4] -Open=1 -Top=0 -CursorCol=1 -CursorRow=204 -TopLine=186 -LeftChar=1 -[Editor_5] -Open=1 -Top=0 -CursorCol=1 -CursorRow=41 -TopLine=35 -LeftChar=1 -[Editor_6] -Open=1 -Top=0 -CursorCol=27 -CursorRow=90 -TopLine=66 -LeftChar=1 -[Editor_7] -Open=1 -Top=0 -CursorCol=1 -CursorRow=175 -TopLine=151 -LeftChar=1 -[Editor_8] -Open=1 -Top=0 -CursorCol=2 -CursorRow=188 -TopLine=153 -LeftChar=1 -[Editor_9] -Open=1 -Top=0 -CursorCol=6 -CursorRow=989 -TopLine=978 -LeftChar=1 -[Editor_10] -Open=1 -Top=0 -CursorCol=11 -CursorRow=99 -TopLine=88 -LeftChar=1 -[Editor_11] -Open=1 -Top=0 -CursorCol=33 -CursorRow=514 -TopLine=531 -LeftChar=1 -[Editor_12] -Open=1 -Top=0 -CursorCol=15 -CursorRow=36 -TopLine=9 -LeftChar=1 -[Editor_13] -Open=1 -Top=0 -CursorCol=7 -CursorRow=26 -TopLine=1 -LeftChar=1 -[Editor_14] -Open=1 -Top=1 -CursorCol=31 -CursorRow=139 -TopLine=121 -LeftChar=1 -[Editor_15] -Open=0 -Top=0 -CursorCol=7 -CursorRow=251 -TopLine=234 -LeftChar=1 -[Editor_16] -Open=0 -Top=0 -CursorCol=14 -CursorRow=32 -TopLine=154 -LeftChar=1 -[Editor_17] -Open=0 -Top=0 -CursorCol=1 -CursorRow=28 -TopLine=1 -LeftChar=1 -[Editor_18] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_19] -Open=1 -Top=0 -CursorCol=15 -CursorRow=33 -TopLine=8 -LeftChar=1 -[Editor_20] -Open=0 -Top=0 -CursorCol=13 -CursorRow=20 -TopLine=1 -LeftChar=1 -[Editor_21] -Open=0 -Top=0 -CursorCol=1 -CursorRow=29 -TopLine=1 -LeftChar=1 -[Editor_22] -Open=0 -Top=0 -CursorCol=20 -CursorRow=21 -TopLine=1 -LeftChar=1 -[Editor_23] -Open=1 -Top=0 -CursorCol=20 -CursorRow=144 -TopLine=126 -LeftChar=1 -[Editor_24] -Open=0 -Top=0 -CursorCol=3 -CursorRow=344 -TopLine=309 -LeftChar=1 -[Editor_25] -Open=0 -Top=0 -CursorCol=5 -CursorRow=25 -TopLine=1 -LeftChar=1 -[Editor_26] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_27] -Open=0 -Top=0 -CursorCol=1 -CursorRow=57 -TopLine=41 -LeftChar=1 -[Editor_28] -Open=0 -Top=0 -CursorCol=62 -CursorRow=43 -TopLine=8 -LeftChar=1 -[Editor_29] -Open=1 -Top=0 -CursorCol=9 -CursorRow=22 -TopLine=1 -LeftChar=1 -[Editor_30] -Open=0 -Top=0 -CursorCol=1 -CursorRow=25 -TopLine=1 -LeftChar=1 -[Editor_31] -Open=0 -Top=0 -CursorCol=1 -CursorRow=25 -TopLine=1 -LeftChar=1 -[Editor_32] -Open=0 -Top=0 -CursorCol=3 -CursorRow=48 -TopLine=26 -LeftChar=1 -[Editor_33] -Open=0 -Top=0 -CursorCol=16 -CursorRow=29 -TopLine=1 -LeftChar=1 -[Editor_34] -Open=1 -Top=0 -CursorCol=5 -CursorRow=13 -TopLine=1 -LeftChar=1 -[Editor_35] -Open=0 -Top=0 -CursorCol=19 -CursorRow=16 -TopLine=1 -LeftChar=1 -[Editor_36] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_37] -Open=0 -Top=0 -CursorCol=27 -CursorRow=19 -TopLine=1 -LeftChar=1 -[Editor_38] -Open=0 -Top=0 -[Editor_39] -Open=0 -Top=0 -[Editor_40] -Open=0 -Top=0 -[Editor_41] -Open=0 -Top=0 -[Editor_42] -Open=0 -Top=0 diff --git a/plugins/PeopsSPU2/spu2PeopsSound.opt b/plugins/PeopsSPU2/spu2PeopsSound.opt deleted file mode 100644 index 542785eafa..0000000000 Binary files a/plugins/PeopsSPU2/spu2PeopsSound.opt and /dev/null differ diff --git a/plugins/PeopsSPU2/spu2PeopsSound.plg b/plugins/PeopsSPU2/spu2PeopsSound.plg deleted file mode 100644 index 1860a27e48..0000000000 --- a/plugins/PeopsSPU2/spu2PeopsSound.plg +++ /dev/null @@ -1,81 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: spu2PeopsSound - Win32 Release-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3A5.tmp" with contents -[ -/nologo /G5 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"Release/" /Fp"Release/spu2PeopsSound.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c -"C:\Documents and Settings\SAQIB\Desktop\PeopsSpu2_103\src\dma.c" -] -Creating command line "snCl.exe @C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3A5.tmp" -Creating temporary file "C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3A6.tmp" with contents -[ -dsound.lib winmm.lib user32.lib gdi32.lib advapi32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"Release/spu2PeopsSound.pdb" /machine:I386 /def:".\spu2PeopsSound.def" /out:"Release/spu2PeopsSound.dll" /implib:"Release/spu2PeopsSound.lib" -".\Release\adsr.obj" -".\Release\alsa.obj" -".\Release\cfg.obj" -".\Release\debug.obj" -".\Release\dma.obj" -".\Release\dsound.obj" -".\Release\freeze.obj" -".\Release\oss.obj" -".\Release\psemu.obj" -".\Release\record.obj" -".\Release\registers.obj" -".\Release\reverb.obj" -".\Release\spu.obj" -".\Release\spu2PeopsSound.obj" -".\Release\StdAfx.obj" -".\Release\xa.obj" -".\Release\spu2PeopsSound.res" -] -Creating command line "snLink.exe @C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3A6.tmp" -

Output Window

-Compiling... -snCL -- Detected win32 build...passing to cl.exe -dma.c -Linking... -snCL -- Detected win32 build...passing to link.exe - Creating library Release/spu2PeopsSound.lib and object Release/spu2PeopsSound.exp -Creating temporary file "C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3AA.tmp" with contents -[ -/nologo /o"Release/spu2PeopsSound.bsc" -".\Release\adsr.sbr" -".\Release\alsa.sbr" -".\Release\cfg.sbr" -".\Release\debug.sbr" -".\Release\dma.sbr" -".\Release\dsound.sbr" -".\Release\freeze.sbr" -".\Release\oss.sbr" -".\Release\psemu.sbr" -".\Release\record.sbr" -".\Release\registers.sbr" -".\Release\reverb.sbr" -".\Release\spu.sbr" -".\Release\spu2PeopsSound.sbr" -".\Release\StdAfx.sbr" -".\Release\xa.sbr"] -Creating command line "snBsc.exe @C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3AA.tmp" -Creating browse info file... -snCL -- Detected win32 build...passing to bscmake.exe -

Output Window

-Creating temporary file "C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3AB.bat" with contents -[ -@echo off -rem copy release\spu2PeopsSound.dll D:\pcsx2\plugins\spu2PeopsDSound.dll -] -Creating command line "C:\DOCUME~1\SAQIB\LOCALS~1\Temp\RSP3AB.bat" - - - - -

Results

-spu2PeopsSound.dll - 0 error(s), 0 warning(s) -
- - diff --git a/plugins/SPU2-X_vs2008.sln b/plugins/SPU2-X_vs2008.sln deleted file mode 100644 index 2b9dbd22bc..0000000000 --- a/plugins/SPU2-X_vs2008.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spu2-X", "spu2-x\src\Win32\Spu2-X_vs2008.vcproj", "{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - DebugStrict|Win32 = DebugStrict|Win32 - Devel|Win32 = Devel|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.Build.0 = Debug|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.DebugStrict|Win32.ActiveCfg = DebugStrict|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.DebugStrict|Win32.Build.0 = DebugStrict|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.ActiveCfg = Devel|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.Build.0 = Devel|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.ActiveCfg = Release|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/SPU2ghz_vs2008.sln b/plugins/SPU2ghz_vs2008.sln deleted file mode 100644 index 32cb195332..0000000000 --- a/plugins/SPU2ghz_vs2008.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPU2ghz", "spu2ghz\src\Win32\SPU2ghz_vs2008.vcproj", "{5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - DebugStrict|Win32 = DebugStrict|Win32 - Devel|Win32 = Devel|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Debug|Win32.Build.0 = Debug|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.DebugStrict|Win32.ActiveCfg = DebugStrict|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.DebugStrict|Win32.Build.0 = DebugStrict|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.ActiveCfg = Devel|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Devel|Win32.Build.0 = Devel|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.ActiveCfg = Release|Win32 - {5307BBB7-EBB9-4AA4-8CB6-A94EC473C8C4}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/SPU2null/Src/Makefile.mingw b/plugins/SPU2null/Src/Makefile.mingw deleted file mode 100644 index bf3cef415a..0000000000 --- a/plugins/SPU2null/Src/Makefile.mingw +++ /dev/null @@ -1,51 +0,0 @@ -# -# Makefile for MINGW32 -# - - -all: spu2null - -PLUGIN = SPU2null.dll - -CC = gcc -NASM = nasmw -RM = rm -f -AR = ar -STRIP = strip -RC = windres - -OPTIMIZE = -O2 -fomit-frame-pointer -finline-functions -ffast-math -fno-strict-aliasing -FLAGS = -D__WIN32__ -D__MINGW32__ # -DENABLE_NLS -DPACKAGE=\"pcsx2\" -RC1FLAGS = -d__MINGW32__ -LIBS = -L./ -lcomctl32 -lwinmm -lgdi32 -lcomdlg32 #-lintl -lwsock32 -RESOBJ = spu2nullrc.o - -OBJS = SPU2.o Config.o Win32.o - - -DEPS:= $(OBJS:.o=.d) - -CFLAGS = -Wall ${OPTIMIZE} -I. -I/usr/local/include ${FLAGS} - -spu2null: ${OBJS} - dllwrap --def plugin.def -o ${PLUGIN} ${OBJS} ${LIBS} -# ${CC} -shared -Wl,--kill-at,--output-def,plugin.def ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS} - ${STRIP} ${PLUGIN} - -.PHONY: clean spu2null - -clean: - ${RM} ${OBJS} ${DEPS} ${PCSX2} - -%.o: %.asm - ${NASM} ${ASMFLAGS} -o $@ $< - -%.o: %.c - ${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@) - -${RESOBJ}: SPU2null.rc - ${RC} -D__MINGW32__ -I rc -O coff -o $@ -i $< - --include ${DEPS} - - \ No newline at end of file diff --git a/plugins/SPU2null/Src/PS2Edefs.h b/plugins/SPU2null/Src/PS2Edefs.h deleted file mode 100644 index 06276f168e..0000000000 --- a/plugins/SPU2null/Src/PS2Edefs.h +++ /dev/null @@ -1,812 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -// extended funcs - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/SPU2null/Src/PS2Etypes.h b/plugins/SPU2null/Src/PS2Etypes.h deleted file mode 100644 index 34ab5c2c54..0000000000 --- a/plugins/SPU2null/Src/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/SPU2null/Src/ProjectRootDir.vsprops b/plugins/SPU2null/Src/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/SPU2null/Src/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/SPU2null/Src/SPU2null.ncb b/plugins/SPU2null/Src/SPU2null.ncb deleted file mode 100644 index ac4d6174ff..0000000000 Binary files a/plugins/SPU2null/Src/SPU2null.ncb and /dev/null differ diff --git a/plugins/SPU2null/Src/SPU2null.sln b/plugins/SPU2null/Src/SPU2null.sln deleted file mode 100644 index a7d7f2f1a8..0000000000 --- a/plugins/SPU2null/Src/SPU2null.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPU2null", "SPU2null.vcproj", "{35024C58-7F8B-4F3A-AFFE-E82DCD6B579F}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {35024C58-7F8B-4F3A-AFFE-E82DCD6B579F}.Debug.ActiveCfg = Debug|Win32 - {35024C58-7F8B-4F3A-AFFE-E82DCD6B579F}.Debug.Build.0 = Debug|Win32 - {35024C58-7F8B-4F3A-AFFE-E82DCD6B579F}.Release.ActiveCfg = Release|Win32 - {35024C58-7F8B-4F3A-AFFE-E82DCD6B579F}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/SPU2null/Src/SPU2null.vcproj b/plugins/SPU2null/Src/SPU2null.vcproj deleted file mode 100644 index b2a04fac52..0000000000 --- a/plugins/SPU2null/Src/SPU2null.vcproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/SPU2null/Src/SPU2null_2005.sln b/plugins/SPU2null/Src/SPU2null_2005.sln deleted file mode 100644 index 15d0cf751b..0000000000 --- a/plugins/SPU2null/Src/SPU2null_2005.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPU2null", "SPU2null_2005.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.Build.0 = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.ActiveCfg = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/SPU2null/Src/SPU2null_2005_x64.sln b/plugins/SPU2null/Src/SPU2null_2005_x64.sln deleted file mode 100644 index 0894e2818a..0000000000 --- a/plugins/SPU2null/Src/SPU2null_2005_x64.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPU2null", "SPU2null_2005_x64.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|x64.ActiveCfg = Debug|x64 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|x64.Build.0 = Debug|x64 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|x64.ActiveCfg = Release|x64 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/SPU2null/Src/SPU2null_2005_x64.vcproj b/plugins/SPU2null/Src/SPU2null_2005_x64.vcproj deleted file mode 100644 index 47881a790f..0000000000 --- a/plugins/SPU2null/Src/SPU2null_2005_x64.vcproj +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/SPU2null/Src/mingw/Makefile.win b/plugins/SPU2null/Src/mingw/Makefile.win deleted file mode 100644 index e789c19793..0000000000 --- a/plugins/SPU2null/Src/mingw/Makefile.win +++ /dev/null @@ -1,43 +0,0 @@ -# Project: SPU2null -# Makefile created by Dev-C++ 4.9.9.2 - -CPP = mingw32-g++.exe -CC = mingw32-gcc.exe -WINDRES = windres.exe -RES = Obj//SPU2null_private.res -OBJ = Obj//Win32.o Obj//Config.o Obj//SPU2.o $(RES) -LINKOBJ = Obj//Win32.o Obj//Config.o Obj//SPU2.o $(RES) -LIBS = -L"C:/Develop/Dev-Cpp/lib" --def plugin.def -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32 -INCS = -I"C:/Develop/Dev-Cpp/include" -CXXINCS = -I"C:/Develop/Dev-Cpp/include" -BIN = SPU2null.dll -CXXFLAGS = $(CXXINCS) -CFLAGS = $(INCS) -Wall -O2 -fomit-frame-pointer -D__WIN32__ -D__MINGW32___ -RM = rm -f - -.PHONY: all all-before all-after clean clean-custom - -all: all-before SPU2null.dll all-after - - -clean: clean-custom - ${RM} $(OBJ) $(BIN) - -DLLWRAP=dllwrap.exe -DEFFILE=libSPU2null.def -STATICLIB=libSPU2null.a - -$(BIN): $(LINKOBJ) - $(DLLWRAP) --output-def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN) - -Obj//Win32.o: ../Win32.c - $(CC) -c ../Win32.c -o Obj//Win32.o $(CFLAGS) - -Obj//Config.o: ../Config.c - $(CC) -c ../Config.c -o Obj//Config.o $(CFLAGS) - -Obj//SPU2.o: ../SPU2.c - $(CC) -c ../SPU2.c -o Obj//SPU2.o $(CFLAGS) - -Obj//SPU2null_private.res: SPU2null_private.rc ../SPU2null.rc - $(WINDRES) -i SPU2null_private.rc --input-format=rc -o Obj//SPU2null_private.res -O coff --include-dir ../mingw --include-dir ../ diff --git a/plugins/SPU2null/Src/mingw/SPU2null.dev b/plugins/SPU2null/Src/mingw/SPU2null.dev deleted file mode 100644 index 2a811e60ac..0000000000 --- a/plugins/SPU2null/Src/mingw/SPU2null.dev +++ /dev/null @@ -1,148 +0,0 @@ -[Project] -FileName=SPU2null.dev -Name=SPU2null -UnitCount=10 -Type=3 -Ver=1 -ObjFiles= -Includes= -Libs= -PrivateResource=SPU2null_private.rc -ResourceIncludes=..\mingw;../ -MakeIncludes= -Compiler=-Wall -O2 -fomit-frame-pointer -D__WIN32__ -D__MINGW32____@@_ -CppCompiler= -Linker=--def ../plugin.def -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32_@@_ -IsCpp=0 -Icon= -ExeOutput= -ObjectOutput=Obj/ -OverrideOutput=0 -OverrideOutputName=SPU2null.dll -HostApplication= -Folders= -CommandLine= -UseCustomMakefile=0 -CustomMakefile= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000000000000000000 - -[Unit1] -FileName=afxres.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit2] -FileName=..\Win32.c -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit3] -FileName=..\Config.c -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit4] -FileName=..\PS2Edefs.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit5] -FileName=..\PS2Etypes.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit6] -FileName=..\regs.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit7] -FileName=..\resource.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit8] -FileName=..\SPU2.c -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit9] -FileName=..\SPU2.h -CompileCpp=0 -Folder=SPU2null -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit10] -FileName=..\SPU2null.rc -Folder=SPU2null -Compile=1 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - diff --git a/plugins/SPU2null/Src/mingw/afxres.h b/plugins/SPU2null/Src/mingw/afxres.h deleted file mode 100644 index 99eace37c4..0000000000 --- a/plugins/SPU2null/Src/mingw/afxres.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/SPU2null/Src/mingw/plugin.def b/plugins/SPU2null/Src/mingw/plugin.def deleted file mode 100644 index 4bf46055f9..0000000000 --- a/plugins/SPU2null/Src/mingw/plugin.def +++ /dev/null @@ -1,22 +0,0 @@ -EXPORTS - PS2EgetLibName = PS2EgetLibName@0 @2 - PS2EgetLibType = PS2EgetLibType@0 @3 - PS2EgetLibVersion2 = PS2EgetLibVersion2@4 @4 - SPU2about = SPU2about@0 @5 - SPU2async = SPU2async@4 @6 - SPU2close = SPU2close@0 @7 - SPU2configure = SPU2configure@0 @8 - SPU2freeze = SPU2freeze@8 @9 - SPU2init = SPU2init@0 @10 - SPU2interruptDMA4 = SPU2interruptDMA4@0 @11 - SPU2interruptDMA7 = SPU2interruptDMA7@0 @12 - SPU2irqCallback = SPU2irqCallback@4 @13 - SPU2open = SPU2open@4 @14 - SPU2read = SPU2read@4 @15 - SPU2readDMA4Mem = SPU2readDMA4Mem@8 @16 - SPU2readDMA7Mem = SPU2readDMA7Mem@8 @17 - SPU2shutdown = SPU2shutdown@0 @18 - SPU2test = SPU2test@0 @19 - SPU2write = SPU2write@8 @20 - SPU2writeDMA4Mem = SPU2writeDMA4Mem@8 @21 - SPU2writeDMA7Mem = SPU2writeDMA7Mem@8 @22 diff --git a/plugins/USBnull/PS2Edefs.h b/plugins/USBnull/PS2Edefs.h deleted file mode 100644 index 34bfdf54f2..0000000000 --- a/plugins/USBnull/PS2Edefs.h +++ /dev/null @@ -1,848 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgetLastTag GSgetLastTag; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSsetupRecording GSsetupRecording; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; -_PADupdate PAD1update; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; -_PADupdate PAD2update; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2setDMABaseAddr SPU2setDMABaseAddr; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2setupRecording SPU2setupRecording; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/USBnull/PS2Etypes.h b/plugins/USBnull/PS2Etypes.h deleted file mode 100644 index 1ad73e273d..0000000000 --- a/plugins/USBnull/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/USBnull/Win32/Config.c b/plugins/USBnull/Win32/Config.c index 1c7bb393a1..5e31d6dcb5 100644 --- a/plugins/USBnull/Win32/Config.c +++ b/plugins/USBnull/Win32/Config.c @@ -1,6 +1,6 @@ #include -#include "USB.h" +#include "../USB.h" extern HINSTANCE hInst; void SaveConfig() diff --git a/plugins/USBnull/Win32/ProjectRootDir.vsprops b/plugins/USBnull/Win32/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/USBnull/Win32/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/USBnull/Win32/USBnull.def b/plugins/USBnull/Win32/USBnull.def index 9acbd1190b..6ef99db341 100644 --- a/plugins/USBnull/Win32/USBnull.def +++ b/plugins/USBnull/Win32/USBnull.def @@ -1,7 +1,7 @@ ; USBlinuz.def : Declares the module parameters for the DLL. LIBRARY "USBnull" -DESCRIPTION 'USBnull Driver' +;DESCRIPTION 'USBnull Driver' EXPORTS ; Explicit exports can go here diff --git a/plugins/USBnull/Win32/USBnull.dsp b/plugins/USBnull/Win32/USBnull.dsp deleted file mode 100644 index b40466a510..0000000000 --- a/plugins/USBnull/Win32/USBnull.dsp +++ /dev/null @@ -1,85 +0,0 @@ -# Microsoft Developer Studio Project File - Name="USBnull" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=USBnull - WIN32 RELEASE -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "USBnull.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "USBnull.mak" CFG="USBnull - WIN32 RELEASE" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "USBnull - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "USBnull_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "USBnull_EXPORTS" /D "__WIN32__" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x2c0a /d "NDEBUG" -# ADD RSC /l 0x2c0a /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# Begin Target - -# Name "USBnull - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\Config.c -# End Source File -# Begin Source File - -SOURCE=..\USB.c -# End Source File -# Begin Source File - -SOURCE=.\Win32.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\USBnull.rc -# End Source File -# End Group -# End Target -# End Project diff --git a/plugins/USBnull/Win32/USBnull.dsw b/plugins/USBnull/Win32/USBnull.dsw deleted file mode 100644 index bf79c966b8..0000000000 --- a/plugins/USBnull/Win32/USBnull.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "USBnull"=".\USBnull.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/plugins/USBnull/Win32/USBnull_2005_x64.vcproj b/plugins/USBnull/Win32/USBnull_2005_x64.vcproj deleted file mode 100644 index 92b1829a92..0000000000 --- a/plugins/USBnull/Win32/USBnull_2005_x64.vcproj +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/USBnull/Win32/USBnull_vc2003.sln b/plugins/USBnull/Win32/USBnull_vc2003.sln deleted file mode 100644 index 490038a06e..0000000000 --- a/plugins/USBnull/Win32/USBnull_vc2003.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBnull", "USBnull_vc2003.vcproj", "{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug.ActiveCfg = Debug|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug.Build.0 = Debug|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release.ActiveCfg = Release|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/USBnull/Win32/USBnull_vc2003.vcproj b/plugins/USBnull/Win32/USBnull_vc2003.vcproj deleted file mode 100644 index b1cdf5bdc5..0000000000 --- a/plugins/USBnull/Win32/USBnull_vc2003.vcproj +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/USBnull/Win32/USBnull_vc2005beta1.sln b/plugins/USBnull/Win32/USBnull_vc2005beta1.sln deleted file mode 100644 index 48ee6e28a4..0000000000 --- a/plugins/USBnull/Win32/USBnull_vc2005beta1.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "USBnull", "USBnull_vc2005beta1.vcproj", "{BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - amd64|Win32 = amd64|Win32 - amd64|Win64 (AMD64) = amd64|Win64 (AMD64) - Debug|Win32 = Debug|Win32 - Debug|Win64 (AMD64) = Debug|Win64 (AMD64) - Release|Win32 = Release|Win32 - Release|Win64 (AMD64) = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.amd64|Win32.ActiveCfg = amd64|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.amd64|Win32.Build.0 = amd64|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.amd64|Win64 (AMD64).ActiveCfg = amd64|Win64 (AMD64) - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.amd64|Win64 (AMD64).Build.0 = amd64|Win64 (AMD64) - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win32.ActiveCfg = Debug|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win32.Build.0 = Debug|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win64 (AMD64) - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Debug|Win64 (AMD64).Build.0 = Debug|Win64 (AMD64) - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|Win32.ActiveCfg = Release|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|Win32.Build.0 = Release|Win32 - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|Win64 (AMD64).ActiveCfg = Release|Win64 (AMD64) - {BF7B81A5-E348-4F7C-A69F-F74C8EEEAD70}.Release|Win64 (AMD64).Build.0 = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/USBnull/Win32/USBnull_vc2005beta1.vcproj b/plugins/USBnull/Win32/USBnull_vc2005beta1.vcproj deleted file mode 100644 index d1de3fefd0..0000000000 --- a/plugins/USBnull/Win32/USBnull_vc2005beta1.vcproj +++ /dev/null @@ -1,530 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/USBnull/Win32/USBnull_vc2008.vcproj b/plugins/USBnull/Win32/USBnull_vc2008.vcproj new file mode 100644 index 0000000000..9bc02c5ad4 --- /dev/null +++ b/plugins/USBnull/Win32/USBnull_vc2008.vcproj @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/USBnull/Win32/Win32.c b/plugins/USBnull/Win32/Win32.c index ab1c538f3b..b2cd1fac99 100644 --- a/plugins/USBnull/Win32/Win32.c +++ b/plugins/USBnull/Win32/Win32.c @@ -2,7 +2,7 @@ #include #include -#include "USB.h" +#include "../USB.h" #include "resource.h" HINSTANCE hInst; diff --git a/plugins/USBnull/Win32/afxresmw.h b/plugins/USBnull/Win32/afxresmw.h deleted file mode 100644 index 99eace37c4..0000000000 --- a/plugins/USBnull/Win32/afxresmw.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/USBnull/Win32/mingw/Makefile.win b/plugins/USBnull/Win32/mingw/Makefile.win deleted file mode 100644 index 2d7d0d030f..0000000000 --- a/plugins/USBnull/Win32/mingw/Makefile.win +++ /dev/null @@ -1,43 +0,0 @@ -# Project: USBnull -# Makefile created by Dev-C++ 4.9.9.2 - -CPP = mingw32-g++.exe -CC = mingw32-gcc.exe -WINDRES = windres.exe -RES = Obj//USBnull_private.res -OBJ = Obj//Win32.o Obj//Config.o Obj//USB.o $(RES) -LINKOBJ = Obj//Win32.o Obj//Config.o Obj//USB.o $(RES) -LIBS = -L"C:/Develop/Dev-Cpp/lib" --def ../plugin.def -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32 -INCS = -I"C:/Develop/Dev-Cpp/include" -I"../" -I"../../" -I"../.." -CXXINCS = -I"C:/Develop/Dev-Cpp/include" -I"../" -I"../../" -I"../.." -BIN = USBnull.dll -CXXFLAGS = $(CXXINCS) -CFLAGS = $(INCS) -Wall -O2 -fomit-frame-pointer -D__WIN32__ -D__MINGW32__ -RM = rm -f - -.PHONY: all all-before all-after clean clean-custom - -all: all-before USBnull.dll all-after - - -clean: clean-custom - ${RM} $(OBJ) $(BIN) - -DLLWRAP=dllwrap.exe -DEFFILE=libUSBnull.def -STATICLIB=libUSBnull.a - -$(BIN): $(LINKOBJ) - $(DLLWRAP) --output-def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN) - -Obj//Win32.o: ../Win32.c - $(CC) -c ../Win32.c -o Obj//Win32.o $(CFLAGS) - -Obj//Config.o: ../Config.c - $(CC) -c ../Config.c -o Obj//Config.o $(CFLAGS) - -Obj//USB.o: ../../USB.c - $(CC) -c ../../USB.c -o Obj//USB.o $(CFLAGS) - -Obj//USBnull_private.res: USBnull_private.rc ../USBnull.rc - $(WINDRES) -i USBnull_private.rc --input-format=rc -o Obj//USBnull_private.res -O coff --include-dir ../mingw --include-dir ../ diff --git a/plugins/USBnull/Win32/mingw/USBnull.dev b/plugins/USBnull/Win32/mingw/USBnull.dev deleted file mode 100644 index 9a0830cfd9..0000000000 --- a/plugins/USBnull/Win32/mingw/USBnull.dev +++ /dev/null @@ -1,138 +0,0 @@ -[Project] -FileName=USBnull.dev -Name=USBnull -UnitCount=9 -Type=3 -Ver=1 -ObjFiles= -Includes=../;../../;../.. -Libs= -PrivateResource=USBnull_private.rc -ResourceIncludes=..\mingw;../ -MakeIncludes= -Compiler=-Wall -O2 -fomit-frame-pointer -D__WIN32__ -D__MINGW32___@@_ -CppCompiler= -Linker=--def ../plugin.def -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32_@@_ -IsCpp=0 -Icon= -ExeOutput= -ObjectOutput=Obj/ -OverrideOutput=0 -OverrideOutputName=USBnull.dll -HostApplication= -Folders= -CommandLine= -UseCustomMakefile=0 -CustomMakefile= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings=0000000000000000000000 - -[Unit1] -FileName=afxres.h -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit2] -FileName=..\Win32.c -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit3] -FileName=..\Config.c -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit4] -FileName=..\resource.h -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit5] -FileName=..\USBnull.rc -Folder=USBnull -Compile=1 -Link=0 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit6] -FileName=..\..\USB.h -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit7] -FileName=..\..\PS2Edefs.h -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit8] -FileName=..\..\PS2Etypes.h -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit9] -FileName=..\..\USB.c -CompileCpp=0 -Folder=USBnull -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - diff --git a/plugins/USBnull/Win32/mingw/USBnull.layout b/plugins/USBnull/Win32/mingw/USBnull.layout deleted file mode 100644 index c30ca06382..0000000000 --- a/plugins/USBnull/Win32/mingw/USBnull.layout +++ /dev/null @@ -1,50 +0,0 @@ -[Editor_4] -CursorCol=1 -CursorRow=12 -TopLine=1 -LeftChar=1 -Open=0 -Top=0 -[Editors] -Focused=-1 -Order=-1,0 -[Editor_0] -Open=1 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=1 -LeftChar=1 -[Editor_1] -Open=1 -Top=1 -CursorCol=1 -CursorRow=5 -TopLine=1 -LeftChar=1 -[Editor_2] -Open=0 -Top=0 -[Editor_3] -Open=0 -Top=0 -[Editor_5] -Open=0 -Top=0 -CursorCol=1 -CursorRow=1 -TopLine=27 -LeftChar=1 -[Editor_6] -Open=0 -Top=0 -[Editor_7] -Open=0 -Top=0 -[Editor_8] -Open=0 -Top=0 -CursorCol=1 -CursorRow=24 -TopLine=4 -LeftChar=1 diff --git a/plugins/USBnull/Win32/mingw/afxres.h b/plugins/USBnull/Win32/mingw/afxres.h deleted file mode 100644 index 99eace37c4..0000000000 --- a/plugins/USBnull/Win32/mingw/afxres.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/ZeroPAD_2008.sln b/plugins/ZeroPAD_2008.sln deleted file mode 100644 index db5d098538..0000000000 --- a/plugins/ZeroPAD_2008.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroPAD", "zeropad\Windows\ZeroPAD_2008.vcproj", "{CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.ActiveCfg = Debug|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Debug|Win32.Build.0 = Debug|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.ActiveCfg = Release|Win32 - {CDD9DB83-3BD9-4ED8-BB83-399A2F65F022}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/ZeroSPU2_2008.sln b/plugins/ZeroSPU2_2008.sln deleted file mode 100644 index 16a6c1c277..0000000000 --- a/plugins/ZeroSPU2_2008.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroSPU2", "zerospu2\Win32\ZeroSPU2_2008.vcproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.ActiveCfg = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.Build.0 = Debug|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.ActiveCfg = Release|Win32 - {7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/dev9null/src/DEV9null_vc2008.vcproj b/plugins/dev9null/src/DEV9null_vc2008.vcproj new file mode 100644 index 0000000000..7805cac719 --- /dev/null +++ b/plugins/dev9null/src/DEV9null_vc2008.vcproj @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/dev9null/src/Dev9null.sln b/plugins/dev9null/src/Dev9null.sln deleted file mode 100644 index 61bcaa6745..0000000000 --- a/plugins/dev9null/src/Dev9null.sln +++ /dev/null @@ -1,18 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dev9null", "Dev9null.vcproj", "{F7181922-7377-4F67-9F50-10997B4613D8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F7181922-7377-4F67-9F50-10997B4613D8}.Release.ActiveCfg = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/plugins/dev9null/src/Dev9null.vcproj b/plugins/dev9null/src/Dev9null.vcproj deleted file mode 100644 index 88c3755aa7..0000000000 --- a/plugins/dev9null/src/Dev9null.vcproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/dev9null/src/Dev9null_2005_x64.vcproj b/plugins/dev9null/src/Dev9null_2005_x64.vcproj deleted file mode 100644 index 8bad17356d..0000000000 --- a/plugins/dev9null/src/Dev9null_2005_x64.vcproj +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/dev9null/src/Dev9null_vsnet2005beta1.sln b/plugins/dev9null/src/Dev9null_vsnet2005beta1.sln deleted file mode 100644 index 4b73f6edfa..0000000000 --- a/plugins/dev9null/src/Dev9null_vsnet2005beta1.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dev9null", "Dev9null_vsnet2005beta1.vcproj", "{F7181922-7377-4F67-9F50-10997B4613D8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - amd64|Win32 = amd64|Win32 - amd64|Win64 (AMD64) = amd64|Win64 (AMD64) - Release|Win32 = Release|Win32 - Release|Win64 (AMD64) = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win32.ActiveCfg = amd64|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win32.Build.0 = amd64|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win64 (AMD64).ActiveCfg = amd64|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.amd64|Win64 (AMD64).Build.0 = amd64|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win32.ActiveCfg = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win32.Build.0 = Release|Win32 - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win64 (AMD64).ActiveCfg = Release|Win64 (AMD64) - {F7181922-7377-4F67-9F50-10997B4613D8}.Release|Win64 (AMD64).Build.0 = Release|Win64 (AMD64) - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/plugins/dev9null/src/Dev9null_vsnet2005beta1.vcproj b/plugins/dev9null/src/Dev9null_vsnet2005beta1.vcproj deleted file mode 100644 index a3c91f5ec4..0000000000 --- a/plugins/dev9null/src/Dev9null_vsnet2005beta1.vcproj +++ /dev/null @@ -1,416 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/dev9null/src/PS2Edefs.h b/plugins/dev9null/src/PS2Edefs.h deleted file mode 100644 index 34bfdf54f2..0000000000 --- a/plugins/dev9null/src/PS2Edefs.h +++ /dev/null @@ -1,848 +0,0 @@ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - -#ifdef __LINUX__ -#define CALLBACK -#else -#include -#endif - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct { - u32 key; - u32 event; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WIN32 -typedef struct { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WIN32 -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -_GSinit GSinit; -_GSopen GSopen; -_GSclose GSclose; -_GSshutdown GSshutdown; -_GSvsync GSvsync; -_GSgifTransfer1 GSgifTransfer1; -_GSgifTransfer2 GSgifTransfer2; -_GSgifTransfer3 GSgifTransfer3; -_GSgetLastTag GSgetLastTag; -_GSgifSoftReset GSgifSoftReset; -_GSreadFIFO GSreadFIFO; -_GSreadFIFO2 GSreadFIFO2; - -_GSkeyEvent GSkeyEvent; -_GSchangeSaveState GSchangeSaveState; -_GSmakeSnapshot GSmakeSnapshot; -_GSmakeSnapshot2 GSmakeSnapshot2; -_GSirqCallback GSirqCallback; -_GSprintf GSprintf; -_GSsetBaseMem GSsetBaseMem; -_GSsetGameCRC GSsetGameCRC; -_GSsetFrameSkip GSsetFrameSkip; -_GSsetupRecording GSsetupRecording; -_GSreset GSreset; -_GSwriteCSR GSwriteCSR; -_GSgetDriverInfo GSgetDriverInfo; -#ifdef _WIN32 -_GSsetWindowInfo GSsetWindowInfo; -#endif -_GSfreeze GSfreeze; -_GSconfigure GSconfigure; -_GStest GStest; -_GSabout GSabout; - -// PAD1 -_PADinit PAD1init; -_PADopen PAD1open; -_PADclose PAD1close; -_PADshutdown PAD1shutdown; -_PADkeyEvent PAD1keyEvent; -_PADstartPoll PAD1startPoll; -_PADpoll PAD1poll; -_PADquery PAD1query; -_PADupdate PAD1update; - -_PADgsDriverInfo PAD1gsDriverInfo; -_PADconfigure PAD1configure; -_PADtest PAD1test; -_PADabout PAD1about; - -// PAD2 -_PADinit PAD2init; -_PADopen PAD2open; -_PADclose PAD2close; -_PADshutdown PAD2shutdown; -_PADkeyEvent PAD2keyEvent; -_PADstartPoll PAD2startPoll; -_PADpoll PAD2poll; -_PADquery PAD2query; -_PADupdate PAD2update; - -_PADgsDriverInfo PAD2gsDriverInfo; -_PADconfigure PAD2configure; -_PADtest PAD2test; -_PADabout PAD2about; - -// SIO[2] -_SIOinit SIOinit[2][9]; -_SIOopen SIOopen[2][9]; -_SIOclose SIOclose[2][9]; -_SIOshutdown SIOshutdown[2][9]; -_SIOstartPoll SIOstartPoll[2][9]; -_SIOpoll SIOpoll[2][9]; -_SIOquery SIOquery[2][9]; - -_SIOconfigure SIOconfigure[2][9]; -_SIOtest SIOtest[2][9]; -_SIOabout SIOabout[2][9]; - -// SPU2 -_SPU2init SPU2init; -_SPU2open SPU2open; -_SPU2close SPU2close; -_SPU2shutdown SPU2shutdown; -_SPU2write SPU2write; -_SPU2read SPU2read; -_SPU2readDMA4Mem SPU2readDMA4Mem; -_SPU2writeDMA4Mem SPU2writeDMA4Mem; -_SPU2interruptDMA4 SPU2interruptDMA4; -_SPU2readDMA7Mem SPU2readDMA7Mem; -_SPU2writeDMA7Mem SPU2writeDMA7Mem; -_SPU2setDMABaseAddr SPU2setDMABaseAddr; -_SPU2interruptDMA7 SPU2interruptDMA7; -_SPU2ReadMemAddr SPU2ReadMemAddr; -_SPU2setupRecording SPU2setupRecording; -_SPU2WriteMemAddr SPU2WriteMemAddr; -_SPU2irqCallback SPU2irqCallback; - -_SPU2async SPU2async; -_SPU2freeze SPU2freeze; -_SPU2configure SPU2configure; -_SPU2test SPU2test; -_SPU2about SPU2about; - -// CDVD -_CDVDinit CDVDinit; -_CDVDopen CDVDopen; -_CDVDclose CDVDclose; -_CDVDshutdown CDVDshutdown; -_CDVDreadTrack CDVDreadTrack; -_CDVDgetBuffer CDVDgetBuffer; -_CDVDreadSubQ CDVDreadSubQ; -_CDVDgetTN CDVDgetTN; -_CDVDgetTD CDVDgetTD; -_CDVDgetTOC CDVDgetTOC; -_CDVDgetDiskType CDVDgetDiskType; -_CDVDgetTrayStatus CDVDgetTrayStatus; -_CDVDctrlTrayOpen CDVDctrlTrayOpen; -_CDVDctrlTrayClose CDVDctrlTrayClose; - -_CDVDconfigure CDVDconfigure; -_CDVDtest CDVDtest; -_CDVDabout CDVDabout; -_CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -_DEV9init DEV9init; -_DEV9open DEV9open; -_DEV9close DEV9close; -_DEV9shutdown DEV9shutdown; -_DEV9read8 DEV9read8; -_DEV9read16 DEV9read16; -_DEV9read32 DEV9read32; -_DEV9write8 DEV9write8; -_DEV9write16 DEV9write16; -_DEV9write32 DEV9write32; -_DEV9readDMA8Mem DEV9readDMA8Mem; -_DEV9writeDMA8Mem DEV9writeDMA8Mem; -_DEV9irqCallback DEV9irqCallback; -_DEV9irqHandler DEV9irqHandler; - -_DEV9configure DEV9configure; -_DEV9freeze DEV9freeze; -_DEV9test DEV9test; -_DEV9about DEV9about; - -// USB -_USBinit USBinit; -_USBopen USBopen; -_USBclose USBclose; -_USBshutdown USBshutdown; -_USBread8 USBread8; -_USBread16 USBread16; -_USBread32 USBread32; -_USBwrite8 USBwrite8; -_USBwrite16 USBwrite16; -_USBwrite32 USBwrite32; -_USBirqCallback USBirqCallback; -_USBirqHandler USBirqHandler; -_USBsetRAM USBsetRAM; - -_USBconfigure USBconfigure; -_USBfreeze USBfreeze; -_USBtest USBtest; -_USBabout USBabout; - -// FW -_FWinit FWinit; -_FWopen FWopen; -_FWclose FWclose; -_FWshutdown FWshutdown; -_FWread32 FWread32; -_FWwrite32 FWwrite32; -_FWirqCallback FWirqCallback; - -_FWconfigure FWconfigure; -_FWfreeze FWfreeze; -_FWtest FWtest; -_FWabout FWabout; -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/dev9null/src/PS2Etypes.h b/plugins/dev9null/src/PS2Etypes.h deleted file mode 100644 index 1ad73e273d..0000000000 --- a/plugins/dev9null/src/PS2Etypes.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x - -#else - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#ifdef __LINUX__ -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; -#endif - -#if defined(__MINGW32__) -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#else -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) -#endif - -#ifndef __forceinline -#define __forceinline inline -#endif - -#endif // _MSC_VER - -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/dev9null/src/ProjectRootDir.vsprops b/plugins/dev9null/src/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/dev9null/src/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/spu2-x/src/DllInterface.cpp b/plugins/spu2-x/src/DllInterface.cpp index 5282530395..1f5a1c2eb1 100644 --- a/plugins/spu2-x/src/DllInterface.cpp +++ b/plugins/spu2-x/src/DllInterface.cpp @@ -20,8 +20,8 @@ */ #include "Spu2.h" -#include "RegTable.h" #include "Dialogs.h" +#include "RegTable.h" #ifdef _MSC_VER #include "svnrev.h" diff --git a/plugins/spu2-x/src/Linux/Dialogs.h b/plugins/spu2-x/src/Linux/Dialogs.h index 1a660644e3..158511a3e9 100644 --- a/plugins/spu2-x/src/Linux/Dialogs.h +++ b/plugins/spu2-x/src/Linux/Dialogs.h @@ -22,4 +22,6 @@ #ifndef DIALOG_H_INCLUDED #define DIALOG_H_INCLUDED +#include "../spu2.h" + #endif \ No newline at end of file diff --git a/plugins/spu2-x/src/Win32/AboutBox.cpp b/plugins/spu2-x/src/Win32/AboutBox.cpp index 883da5b273..a485862f9c 100644 --- a/plugins/spu2-x/src/Win32/AboutBox.cpp +++ b/plugins/spu2-x/src/Win32/AboutBox.cpp @@ -19,8 +19,7 @@ * */ -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" #include #include "svnrev.h" diff --git a/plugins/spu2-x/src/Win32/CfgHelpers.cpp b/plugins/spu2-x/src/Win32/CfgHelpers.cpp index dcdf8b1a64..8b5a4f5194 100644 --- a/plugins/spu2-x/src/Win32/CfgHelpers.cpp +++ b/plugins/spu2-x/src/Win32/CfgHelpers.cpp @@ -19,7 +19,7 @@ * */ -#include "dialogs.h" +#include "Dialogs.h" ////// diff --git a/plugins/spu2-x/src/Win32/Config.cpp b/plugins/spu2-x/src/Win32/Config.cpp index 3a471c632e..45588ce7b0 100644 --- a/plugins/spu2-x/src/Win32/Config.cpp +++ b/plugins/spu2-x/src/Win32/Config.cpp @@ -19,8 +19,7 @@ * */ -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" #ifdef SPU2X_DEVBUILD static const int LATENCY_MAX = 3000; diff --git a/plugins/spu2-x/src/Win32/ConfigDebug.cpp b/plugins/spu2-x/src/Win32/ConfigDebug.cpp index 5ae8529b3b..e724bd7f25 100644 --- a/plugins/spu2-x/src/Win32/ConfigDebug.cpp +++ b/plugins/spu2-x/src/Win32/ConfigDebug.cpp @@ -19,8 +19,7 @@ * */ -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" bool DebugEnabled=false; diff --git a/plugins/spu2-x/src/Win32/ConfigSoundtouch.cpp b/plugins/spu2-x/src/Win32/ConfigSoundtouch.cpp index 4054054035..1e2c9d6fa0 100644 --- a/plugins/spu2-x/src/Win32/ConfigSoundtouch.cpp +++ b/plugins/spu2-x/src/Win32/ConfigSoundtouch.cpp @@ -19,8 +19,7 @@ * */ -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" int SoundtouchCfg::SequenceLenMS = 63; int SoundtouchCfg::SeekWindowMS = 16; diff --git a/plugins/spu2-x/src/Win32/Dialogs.h b/plugins/spu2-x/src/Win32/Dialogs.h index d339ef7acd..fca47d9e99 100644 --- a/plugins/spu2-x/src/Win32/Dialogs.h +++ b/plugins/spu2-x/src/Win32/Dialogs.h @@ -24,7 +24,7 @@ #ifndef _DIALOGS_H_ #define _DIALOGS_H_ -#include "BaseTypes.h" +#include "../Spu2.h" #include #include diff --git a/plugins/spu2-x/src/Win32/RealtimeDebugger.cpp b/plugins/spu2-x/src/Win32/RealtimeDebugger.cpp index e4555d7a19..0aa82ffd83 100644 --- a/plugins/spu2-x/src/Win32/RealtimeDebugger.cpp +++ b/plugins/spu2-x/src/Win32/RealtimeDebugger.cpp @@ -20,9 +20,8 @@ */ -#include "SPU2.h" #include "Dialogs.h" -#include "RegTable.h" +#include "../RegTable.h" static bool debugDialogOpen=false; diff --git a/plugins/spu2-x/src/Win32/SndOut_DSound.cpp b/plugins/spu2-x/src/Win32/SndOut_DSound.cpp index 541f2f95a1..a45b33e1f2 100644 --- a/plugins/spu2-x/src/Win32/SndOut_DSound.cpp +++ b/plugins/spu2-x/src/Win32/SndOut_DSound.cpp @@ -20,8 +20,7 @@ */ #define _WIN32_DCOM -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" #define DIRECTSOUND_VERSION 0x1000 #include diff --git a/plugins/spu2-x/src/Win32/SndOut_XAudio2.cpp b/plugins/spu2-x/src/Win32/SndOut_XAudio2.cpp index a890c1db31..8354c6aa96 100644 --- a/plugins/spu2-x/src/Win32/SndOut_XAudio2.cpp +++ b/plugins/spu2-x/src/Win32/SndOut_XAudio2.cpp @@ -21,8 +21,7 @@ #define _WIN32_DCOM -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" #include #include diff --git a/plugins/spu2-x/src/Win32/SndOut_waveOut.cpp b/plugins/spu2-x/src/Win32/SndOut_waveOut.cpp index b7fda8f676..bbe6485d61 100644 --- a/plugins/spu2-x/src/Win32/SndOut_waveOut.cpp +++ b/plugins/spu2-x/src/Win32/SndOut_waveOut.cpp @@ -19,8 +19,7 @@ * */ -#include "spu2.h" -#include "dialogs.h" +#include "Dialogs.h" #include diff --git a/plugins/spu2-x/src/Win32/Spu2-X.rc b/plugins/spu2-x/src/Win32/Spu2-X.rc index 869e07791e..5fdb7b5347 100644 --- a/plugins/spu2-x/src/Win32/Spu2-X.rc +++ b/plugins/spu2-x/src/Win32/Spu2-X.rc @@ -7,7 +7,8 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxresmw.h" +#include "afxresmw.h" + ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS diff --git a/plugins/spu2-x/src/Win32/Spu2-X_vs2008.vcproj b/plugins/spu2-x/src/Win32/Spu2-X_vs2008.vcproj index 3a872e225e..fb83f85546 100644 --- a/plugins/spu2-x/src/Win32/Spu2-X_vs2008.vcproj +++ b/plugins/spu2-x/src/Win32/Spu2-X_vs2008.vcproj @@ -17,8 +17,9 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1107,6 +1016,14 @@ + + +
diff --git a/plugins/spu2-x/src/Win32/UIHelpers.cpp b/plugins/spu2-x/src/Win32/UIHelpers.cpp index 724493ecb5..8fadeb2fde 100644 --- a/plugins/spu2-x/src/Win32/UIHelpers.cpp +++ b/plugins/spu2-x/src/Win32/UIHelpers.cpp @@ -19,7 +19,7 @@ * */ -#include "dialogs.h" +#include "Dialogs.h" int SendDialogMsg( HWND hwnd, int dlgId, UINT code, WPARAM wParam, LPARAM lParam) { diff --git a/plugins/spu2-x/src/Win32/afxresmw.h b/plugins/spu2-x/src/Win32/afxresmw.h deleted file mode 100644 index b0078b1dfb..0000000000 --- a/plugins/spu2-x/src/Win32/afxresmw.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/spu2-x/src/Win32/dsp.cpp b/plugins/spu2-x/src/Win32/dsp.cpp index e0b1b945e0..442a5c919c 100644 --- a/plugins/spu2-x/src/Win32/dsp.cpp +++ b/plugins/spu2-x/src/Win32/dsp.cpp @@ -15,7 +15,7 @@ //License along with this library; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -#include "spu2.h" +#include "../spu2.h" extern "C" { #include "dsp.h" diff --git a/plugins/spu2-x/src/Win32/vsprops/pcsx2_plugin_common.vsprops b/plugins/spu2-x/src/Win32/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/spu2-x/src/Win32/vsprops/postBuild.tmpl b/plugins/spu2-x/src/Win32/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/spu2-x/src/Win32/vsprops/postBuild.unknown b/plugins/spu2-x/src/Win32/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/spu2-x/src/Win32/vsprops/preBuild.cmd b/plugins/spu2-x/src/Win32/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/spu2-x/src/Win32/vsprops/svnrev_template.h b/plugins/spu2-x/src/Win32/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/spu2-x/src/Win32/vsprops/svnrev_unknown.h b/plugins/spu2-x/src/Win32/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/spu2-x/src/Win32/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/spu2-x/src/common/PS2Edefs.h b/plugins/spu2-x/src/common/PS2Edefs.h deleted file mode 100644 index 49b16e16d5..0000000000 --- a/plugins/spu2-x/src/common/PS2Edefs.h +++ /dev/null @@ -1,885 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/spu2-x/src/common/PS2Etypes.h b/plugins/spu2-x/src/common/PS2Etypes.h deleted file mode 100644 index 4c62b47f0f..0000000000 --- a/plugins/spu2-x/src/common/PS2Etypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifdef __LINUX__ -#define CALLBACK -#else -#define CALLBACK __stdcall -#endif - - -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x - -#define __naked __declspec(naked) - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -#define PCSX2_ALIGNED16_DECL(x) x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/spu2ghz/CHANGELOG.TXT b/plugins/spu2ghz/CHANGELOG.TXT deleted file mode 100644 index 7ca8964e9e..0000000000 --- a/plugins/spu2ghz/CHANGELOG.TXT +++ /dev/null @@ -1,154 +0,0 @@ -# -# CHANGELOG -# -# [+] Added Feature -# [*] Modified Feature -# [-] Removed Feature -# [!] Other -# -# Dates are in D/M/Y format - -26/05/2008 - v0.1.9 - [+] Added Timestretching feature. Added part of the SoundTouch library files. - [+] Added Winamp DSP plugin support. - [+] Added Limiter toggle key (defaults to [Numpad -] - [*] Completely replaced the sound buffering system in the output modules with a centralized one. - [*] Fixed a few bugs in the savestates: Now the savestats can be used (and seem to work). - [*] Some changes to the mixer. - [-] Removed FMod output. Didn't give any improvement over DSound or XAudio2 and added lad. - [*] Updated config dialog to reflect some of the previous changes. - [!] Updated the copyright notices in each file. - -26/05/2008 - v0.1.8 - [*] Improved the mixer (gives better volumes in many games) - [*] Coded a working volume fading emulation - [*] Somewhat better AC3 code, which still doesn't work yet anyway. - [*] Improved DPL2 dematrixing. - [*] Many other changes I don't really remember. - [!] It might be a good idea to reset the settings (delete the .ini). - -09/01/2008 - v0.1.7 - [-] SPU2replay disabled until I add options for it. - [+] Improved the limiter handling to reduce lag (in dsound stereo and 5.1 only). - [+] Initial AC3 decoding - does NOT work yet! - [+] Experimental 24/32bit audio input. This allows the CDDA player in the bios to work! - [+] Added a button on the config to configure the output modules. - NOTE: None of the modules have a config dialog yet. - [*] Simplified redundant code in the mixer. - [*] New experimental register handling method. Might slightly improve the processing speed. - - -09/01/2008 - SPU2replay alpha 1 - [+] Added SPU2replay feature. - How does it work: - 1. Play a game using the plugin (it doesn't matter what output mode or audio settings you use). - The plugin will dump ALL the write events in the game, until the emulator is closed. - This is a alpha version and doesn't come with option to start or stop the dumping, it always dumps. - 2. In a cmd window, navigate to the pcsx2 folder and run: - - rundll32 plugins\spu2ghz.dll,SPU2replay replay_dump.s2r - - Alternatively, you can set .s2r files to open with "rundll32 plugins\spu2ghz.dll,SPU2replay %1" - - 3. Wait for it to finish. - This alpha version doesn't have a dialog for it yet, so there is no way to stop the replay until it finishes. - - NOTE: The replay feature saves the events as they happened in the specific session it was run, - it's recommended to avoid playing a replay file with a different version of the plugin, - in case something changed. - -02/01/2008 - v0.1.6 - [*] Converted all the output modules into C++ classes, this way it's easier to manage them. - [*] Cleaned up some parts of the code. - [*] Modified the DPLII decoding code to try to improve the quality. - [+] Added an option to change the LFE lowpass crossover frequency. - [+] Added "delayed" Irq calls so they are only called once in each T. - [*] Restored the older decoding function, and partially rewrote it. - The newer decoder function was breaking some games. - -01/01/2008 - WIP2 - [+] Updated the 5.1 module to include experimental ProLogic II decoding (it should give better surround). - [*] Changed the buffer sizing so that the configured buffer size applies to whole samples. - This means now settings 1024 as the buffer size will make it 2048 on stereo output, and 6144 on 5.1 output. - -31/12/2007 - WIP - [+] Added a highly experimental Dolby ProLogic decoding (upmixes stereo output into 5.1) output module. - -30/12/2007 - v0.1.5 - [*] Changed the way the ATTR register is handled. Should fix a lot of games, but it's experimental. - [*] Changed the thread priority of the output modules to TIME_CRITICAL, so that they have the highest possible priority. - [*] Updated to latest and final version of FMod 3. - [*] Changed some parts of register-based (PIO) memory writes to speed up audio streaming writes in RotTK games. - [+] Added DirectSound output module. It seems to work better than all the other modules so I set it as the new default. - [+] Added setting of IRQ reason flags. I didn't even know that register existed! - [+] Added a new ADPCM decoder based on the old one, but with full-block decoding to try to make it a bit faster. - [-] If running with an older emulator build, the CoreReset feature is executed immediately, without a delay. - This fixes booting problems in bios and many games that were broken since this feature was introduced. - -30/12/2007 - v0.1.4 - [-] completely removed the remains of the "async mixer" mode. It was meaningless without threading, and didn't work. - [*] Fixed the waveOut output module. - [*] Fixed a bug where the ASIO output system was using the defaulf ASIO device sample rate, - regardless of the config value. - [*] Changed the min. buffer size allowed in the config dialog to 512 isntead of 2400. - NOTE 1: Sizes too small can increase the CPU usage and might cause audio problems. - NOTE 2: FMOD and waveOut have this limit increased to 2048. - [*] Changed some code handling voice looping. I don't know if it will fix or break anything. - [+] Added partial support for log levels to the register logging system, to remove the basic - channel attributes from the log files (makes logs more readable and less bloated). - [+] Added experimental XAudio2 output module. Seems to sound well. - [+] Added a hidden option to change the AutoDMA sample rate for each core. - Useful only in some games where the FMVs hang. - [+] Added a check to the Effects processor to avoid crashes when the effects start address is - after the effects end address. - [+] Added /delayload:fmod.dll switch to the linker, so the fmod dll is only needed while - using the fmod output module. - -28/12/2007 - v0.1.3 - [*] Fixed the sync in pre-svn265 pcsx2 builds. Might help with some games. - -27/12/2007 - v0.1.2 - [*] Fixed the speed limit dialog setting (it wasn't being handled correctly). - [*] Changed the way I handle AutoDMA transfers: - For some reason the data for core 1 was being replaced with 0s, - so I added a separate temporary buffer to store the data chunks. - This fixes many FMVs with stuttering audio. - [-] Commented out some lines that were changing the ATTR register. - I don't know if this will break anything, but none of the games I tried worked worse. - [-] Removed a BAD hack that was breaking thigns instead of fixing. - -26/12/2007 - v0.1.1 - [*] Increased the volume shift for the AutoDMA'd audio by 2 (makes the FMVs louder). - [+] Experimental implementation of "core reset" handling. - [+] Added a setting to the config dialog to enable/disable the limiter. - [+] Added a setting to the config dialog to enable/disable all console prints at once. - [+] Uncommented the AutoDMA transfer message prints as they can now be toggled from the config dialog. - [+] Added "Public Release" build option that automatically creates the release package. - -25/12/2007 - v0.1.0 - [!] First Public release - [!] Too many changes to remember. - I promise to list the changes for every release from now on. - -30/04/2007 - [+] New feature: Added configuration option "Speed_Limit_Mode" to change the speed limiting algorithm. - - Values: - 0. No limiter - 1. Soft limiter -- less cpu-intensive, but can cause problems - 2. Hard limiter -- more cpu-intensive while limiting, but should give better (constant) speeds - - NOTE: Only implemented in the FMOD output module. - -29/04/2007 - [-] Hack: Removed a hack where I was ignoring any KeyOn with ADSR values set to 0. - [-] Hack: Removed a hack in the ADMA detection code. This could break some games. - [*] Bugfix: ENDX wasn't being set/cleared correctly. Thanks pSXAuthor for telling me the way it actually works. - [*] Bugfix: Fixed a bug in the adpcm streaming where I was overwriting the active (playing) block with new data. - This caused clicks in the audio, and desyncs. - [!] Any other changes I forgot. - -before 29/04/2007 - [!] I wiped the two old changes in the changelog, dated back from 2003. - I will try to update this a bit more. - There have been way too many changes in the last 4 years to remember everything. \ No newline at end of file diff --git a/plugins/spu2ghz/LGPL.txt b/plugins/spu2ghz/LGPL.txt deleted file mode 100644 index ebb7aa9340..0000000000 --- a/plugins/spu2ghz/LGPL.txt +++ /dev/null @@ -1,503 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - diff --git a/plugins/spu2ghz/License.txt b/plugins/spu2ghz/License.txt deleted file mode 100644 index be8e2a2099..0000000000 --- a/plugins/spu2ghz/License.txt +++ /dev/null @@ -1,17 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/3dnow_win.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/3dnow_win.cpp deleted file mode 100644 index 01e6dab8a7..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/3dnow_win.cpp +++ /dev/null @@ -1,350 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Win32 version of the AMD 3DNow! optimized routines for AMD K6-2/Athlon -/// processors. All 3DNow! optimized functions have been gathered into this -/// single source code file, regardless to their class or original source code -/// file, in order to ease porting the library to other compiler and processor -/// platforms. -/// -/// By the way; the performance gain depends heavily on the CPU generation: On -/// K6-2 these routines provided speed-up of even 2.4 times, while on Athlon the -/// difference to the original routines stayed at unremarkable 8%! Such a small -/// improvement on Athlon is due to 3DNow can perform only two operations in -/// parallel, and obviously also the Athlon FPU is doing a very good job with -/// the standard C floating point routines! Here these routines are anyway, -/// although it might not be worth the effort to convert these to GCC platform, -/// for Athlon CPU at least. The situation is different regarding the SSE -/// optimizations though, thanks to the four parallel operations of SSE that -/// already make a difference. -/// -/// This file is to be compiled in Windows platform with Microsoft Visual C++ -/// Compiler. Please see '3dnow_gcc.cpp' for the gcc compiler version for all -/// GNU platforms (if file supplied). -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support 3DNow! instruction set. The update is -/// available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and -/// perform a search with keywords "processor pack". -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: 3dnow_win.cpp,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" -#include "STTypes.h" - -#ifndef _WIN32 -#error "wrong platform - this source code file is exclusively for Win32 platform" -#endif - -using namespace soundtouch; - -#ifdef ALLOW_3DNOW -// 3DNow! routines available only with float sample type - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of 3DNow! optimized functions of class 'TDStretch3DNow' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include - -// these are declared in 'TDStretch.cpp' -extern int scanOffsets[4][24]; - - -// Calculates cross correlation of two buffers -double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) const -{ - uint overlapLengthLocal = overlapLength; - float corr; - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - /* - c-pseudocode: - - corr = 0; - for (i = 0; i < overlapLength / 4; i ++) - { - corr += pV1[0] * pV2[0]; - pV1[1] * pV2[1]; - pV1[2] * pV2[2]; - pV1[3] * pV2[3]; - pV1[4] * pV2[4]; - pV1[5] * pV2[5]; - pV1[6] * pV2[6]; - pV1[7] * pV2[7]; - - pV1 += 8; - pV2 += 8; - } - */ - - _asm - { - // give prefetch hints to CPU of what data are to be needed soonish. - // give more aggressive hints on pV1 as that changes more between different calls - // while pV2 stays the same. - prefetch [pV1] - prefetch [pV2] - prefetch [pV1 + 32] - - mov eax, dword ptr pV2 - mov ebx, dword ptr pV1 - - pxor mm0, mm0 - - mov ecx, overlapLengthLocal - shr ecx, 2 // div by four - - loop1: - movq mm1, [eax] - prefetch [eax + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm1, [ebx] - prefetch [ebx + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movq mm2, [eax + 8] - pfadd mm0, mm1 - pfmul mm2, [ebx + 8] - - movq mm3, [eax + 16] - pfadd mm0, mm2 - pfmul mm3, [ebx + 16] - - movq mm4, [eax + 24] - pfadd mm0, mm3 - pfmul mm4, [ebx + 24] - - add eax, 32 - pfadd mm0, mm4 - add ebx, 32 - - dec ecx - jnz loop1 - - // add halfs of mm0 together and return the result. - // note: mm1 is used as a dummy parameter only, we actually don't care about it's value - pfacc mm0, mm1 - movd corr, mm0 - femms - } - - return corr; -} - - - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of 3DNow! optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - -FIRFilter3DNow::FIRFilter3DNow() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilter3DNow::~FIRFilter3DNow() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for 3DNow! routine -void FIRFilter3DNow::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - float fDivider; - - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Scale the filter coefficients so that it won't be necessary to scale the filtering result - // also rearrange coefficients suitably for 3DNow! - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new float[2 * newLength + 4]; - filterCoeffsAlign = (float *)(((uint)filterCoeffsUnalign + 15) & -16); - - fDivider = (float)resultDivider; - - // rearrange the filter coefficients for mmx routines - for (i = 0; i < newLength; i ++) - { - filterCoeffsAlign[2 * i + 0] = - filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider; - } -} - - -// 3DNow!-optimized version of the filter routine for stereo sound -uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, const uint numSamples) const -{ - float *filterCoeffsLocal = filterCoeffsAlign; - uint count = (numSamples - length) & -2; - uint lengthLocal = length / 4; - - assert(length != 0); - assert(count % 2 == 0); - - /* original code: - - double suml1, suml2; - double sumr1, sumr2; - uint i, j; - - for (j = 0; j < count; j += 2) - { - const float *ptr; - - suml1 = sumr1 = 0.0; - suml2 = sumr2 = 0.0; - ptr = src; - filterCoeffsLocal = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) - { - // unroll loop for efficiency. - - suml1 += ptr[0] * filterCoeffsLocal[0] + - ptr[2] * filterCoeffsLocal[2] + - ptr[4] * filterCoeffsLocal[4] + - ptr[6] * filterCoeffsLocal[6]; - - sumr1 += ptr[1] * filterCoeffsLocal[1] + - ptr[3] * filterCoeffsLocal[3] + - ptr[5] * filterCoeffsLocal[5] + - ptr[7] * filterCoeffsLocal[7]; - - suml2 += ptr[8] * filterCoeffsLocal[0] + - ptr[10] * filterCoeffsLocal[2] + - ptr[12] * filterCoeffsLocal[4] + - ptr[14] * filterCoeffsLocal[6]; - - sumr2 += ptr[9] * filterCoeffsLocal[1] + - ptr[11] * filterCoeffsLocal[3] + - ptr[13] * filterCoeffsLocal[5] + - ptr[15] * filterCoeffsLocal[7]; - - ptr += 16; - filterCoeffsLocal += 8; - } - dest[0] = (float)suml1; - dest[1] = (float)sumr1; - dest[2] = (float)suml2; - dest[3] = (float)sumr2; - - src += 4; - dest += 4; - } - - */ - _asm - { - mov eax, dword ptr dest - mov ebx, dword ptr src - mov edx, count - shr edx, 1 - - loop1: - // "outer loop" : during each round 2*2 output samples are calculated - prefetch [ebx] // give a prefetch hint to CPU what data are to be needed soonish - prefetch [filterCoeffsLocal] // give a prefetch hint to CPU what data are to be needed soonish - - mov esi, ebx - mov edi, filterCoeffsLocal - pxor mm0, mm0 - pxor mm1, mm1 - mov ecx, lengthLocal - - loop2: - // "inner loop" : during each round four FIR filter taps are evaluated for 2*2 output samples - movq mm2, [edi] - movq mm3, mm2 - prefetch [edi + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm2, [esi] - prefetch [esi + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm3, [esi + 8] - - movq mm4, [edi + 8] - movq mm5, mm4 - pfadd mm0, mm2 - pfmul mm4, [esi + 8] - pfadd mm1, mm3 - pfmul mm5, [esi + 16] - - movq mm2, [edi + 16] - movq mm6, mm2 - pfadd mm0, mm4 - pfmul mm2, [esi + 16] - pfadd mm1, mm5 - pfmul mm6, [esi + 24] - - movq mm3, [edi + 24] - movq mm7, mm3 - pfadd mm0, mm2 - pfmul mm3, [esi + 24] - pfadd mm1, mm6 - pfmul mm7, [esi + 32] - add esi, 32 - pfadd mm0, mm3 - add edi, 32 - pfadd mm1, mm7 - - dec ecx - jnz loop2 - - movq [eax], mm0 - add ebx, 16 - movq [eax + 8], mm1 - add eax, 16 - - dec edx - jnz loop1 - - femms - } - - return count; -} - - -#endif // ALLOW_3DNOW diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.cpp deleted file mode 100644 index 6bf529ccec..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.cpp +++ /dev/null @@ -1,184 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// FIR low-pass (anti-alias) filter with filter coefficient design routine and -/// MMX optimization. -/// -/// Anti-alias filter is used to prevent folding of high frequencies when -/// transposing the sample rate with interpolation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.9 $ -// -// $Id: AAFilter.cpp,v 1.9 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include "AAFilter.h" -#include "FIRFilter.h" - -using namespace soundtouch; - -#define PI 3.141592655357989 -#define TWOPI (2 * PI) - -/***************************************************************************** - * - * Implementation of the class 'AAFilter' - * - *****************************************************************************/ - -AAFilter::AAFilter(const uint length) -{ - pFIR = FIRFilter::newInstance(); - cutoffFreq = 0.5; - setLength(length); -} - - - -AAFilter::~AAFilter() -{ - delete pFIR; -} - - - -// Sets new anti-alias filter cut-off edge frequency, scaled to -// sampling frequency (nyquist frequency = 0.5). -// The filter will cut frequencies higher than the given frequency. -void AAFilter::setCutoffFreq(const double newCutoffFreq) -{ - cutoffFreq = newCutoffFreq; - calculateCoeffs(); -} - - - -// Sets number of FIR filter taps -void AAFilter::setLength(const uint newLength) -{ - length = newLength; - calculateCoeffs(); -} - - - -// Calculates coefficients for a low-pass FIR filter using Hamming window -void AAFilter::calculateCoeffs() -{ - uint i; - double cntTemp, temp, tempCoeff,h, w; - double fc2, wc; - double scaleCoeff, sum; - double *work; - SAMPLETYPE *coeffs; - - assert(length > 0); - assert(length % 4 == 0); - assert(cutoffFreq >= 0); - assert(cutoffFreq <= 0.5); - - work = new double[length]; - coeffs = new SAMPLETYPE[length]; - - fc2 = 2.0 * cutoffFreq; - wc = PI * fc2; - tempCoeff = TWOPI / (double)length; - - sum = 0; - for (i = 0; i < length; i ++) - { - cntTemp = (double)i - (double)(length / 2); - - temp = cntTemp * wc; - if (temp != 0) - { - h = fc2 * sin(temp) / temp; // sinc function - } - else - { - h = 1.0; - } - w = 0.54 + 0.46 * cos(tempCoeff * cntTemp); // hamming window - - temp = w * h; - work[i] = temp; - - // calc net sum of coefficients - sum += temp; - } - - // ensure the sum of coefficients is larger than zero - assert(sum > 0); - - // ensure we've really designed a lowpass filter... - assert(work[length/2] > 0); - assert(work[length/2 + 1] > -1e-6); - assert(work[length/2 - 1] > -1e-6); - - // Calculate a scaling coefficient in such a way that the result can be - // divided by 16384 - scaleCoeff = 16384.0f / sum; - - for (i = 0; i < length; i ++) - { - // scale & round to nearest integer - temp = work[i] * scaleCoeff; - temp += (temp >= 0) ? 0.5 : -0.5; - // ensure no overfloods - assert(temp >= -32768 && temp <= 32767); - coeffs[i] = (SAMPLETYPE)temp; - } - - // Set coefficients. Use divide factor 14 => divide result by 2^14 = 16384 - pFIR->setCoefficients(coeffs, length, 14); - - delete[] work; - delete[] coeffs; -} - - -// Applies the filter to the given sequence of samples. -// Note : The amount of outputted samples is by value of 'filter length' -// smaller than the amount of input samples. -uint AAFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const -{ - return pFIR->evaluate(dest, src, numSamples, numChannels); -} - - -uint AAFilter::getLength() const -{ - return pFIR->getLength(); -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.h deleted file mode 100644 index 68eb50d27f..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/AAFilter.h +++ /dev/null @@ -1,91 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method -/// with several performance-increasing tweaks. -/// -/// Anti-alias filter is used to prevent folding of high frequencies when -/// transposing the sample rate with interpolation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: AAFilter.h,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef AAFilter_H -#define AAFilter_H - -#include "STTypes.h" - -namespace soundtouch -{ - -class AAFilter -{ -protected: - class FIRFilter *pFIR; - - /// Low-pass filter cut-off frequency, negative = invalid - double cutoffFreq; - - /// num of filter taps - uint length; - - /// Calculate the FIR coefficients realizing the given cutoff-frequency - void calculateCoeffs(); -public: - AAFilter(uint length); - - ~AAFilter(); - - /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling - /// frequency (nyquist frequency = 0.5). The filter will cut off the - /// frequencies than that. - void setCutoffFreq(double newCutoffFreq); - - /// Sets number of FIR filter taps, i.e. ~filter complexity - void setLength(uint newLength); - - uint getLength() const; - - /// Applies the filter to the given sequence of samples. - /// Note : The amount of outputted samples is by value of 'filter length' - /// smaller than the amount of input samples. - uint evaluate(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples, - uint numChannels) const; -}; - -} - -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/BPMDetect.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/BPMDetect.h deleted file mode 100644 index b5e393979d..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/BPMDetect.h +++ /dev/null @@ -1,159 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Beats-per-minute (BPM) detection routine. -/// -/// The beat detection algorithm works as follows: -/// - Use function 'inputSamples' to input a chunks of samples to the class for -/// analysis. It's a good idea to enter a large sound file or stream in smallish -/// chunks of around few kilosamples in order not to extinguish too much RAM memory. -/// - Input sound data is decimated to approx 500 Hz to reduce calculation burden, -/// which is basically ok as low (bass) frequencies mostly determine the beat rate. -/// Simple averaging is used for anti-alias filtering because the resulting signal -/// quality isn't of that high importance. -/// - Decimated sound data is enveloped, i.e. the amplitude shape is detected by -/// taking absolute value that's smoothed by sliding average. Signal levels that -/// are below a couple of times the general RMS amplitude level are cut away to -/// leave only notable peaks there. -/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term -/// autocorrelation function of the enveloped signal. -/// - After whole sound data file has been analyzed as above, the bpm level is -/// detected by function 'getBpm' that finds the highest peak of the autocorrelation -/// function, calculates it's precise location and converts this reading to bpm's. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.5 $ -// -// $Id: BPMDetect.h,v 1.5 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef _BPMDetect_H_ -#define _BPMDetect_H_ - -#include "STTypes.h" -#include "FIFOSampleBuffer.h" - -/// Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit. -#define MIN_BPM 45 - -/// Maximum allowed BPM rate. Used to restrict accepted result below a reasonable limit. -#define MAX_BPM 230 - - -/// Class for calculating BPM rate for audio data. -class BPMDetect -{ -protected: - /// Auto-correlation accumulator bins. - float *xcorr; - - /// Amplitude envelope sliding average approximation level accumulator - float envelopeAccu; - - /// RMS volume sliding average approximation level accumulator - float RMSVolumeAccu; - - /// Sample average counter. - int decimateCount; - - /// Sample average accumulator for FIFO-like decimation. - soundtouch::LONG_SAMPLETYPE decimateSum; - - /// Decimate sound by this coefficient to reach approx. 500 Hz. - int decimateBy; - - /// Auto-correlation window length - int windowLen; - - /// Number of channels (1 = mono, 2 = stereo) - int channels; - - /// sample rate - int sampleRate; - - /// Beginning of auto-correlation window: Autocorrelation isn't being updated for - /// the first these many correlation bins. - int windowStart; - - /// FIFO-buffer for decimated processing samples. - soundtouch::FIFOSampleBuffer *buffer; - - /// Initialize the class for processing. - void init(int numChannels, int sampleRate); - - /// Updates auto-correlation function for given number of decimated samples that - /// are read from the internal 'buffer' pipe (samples aren't removed from the pipe - /// though). - void updateXCorr(int process_samples /// How many samples are processed. - ); - - /// Decimates samples to approx. 500 Hz. - /// - /// \return Number of output samples. - int decimate(soundtouch::SAMPLETYPE *dest, ///< Destination buffer - const soundtouch::SAMPLETYPE *src, ///< Source sample buffer - int numsamples ///< Number of source samples. - ); - - /// Calculates amplitude envelope for the buffer of samples. - /// Result is output to 'samples'. - void calcEnvelope(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/output data buffer - int numsamples ///< Number of samples in buffer - ); - -public: - /// Constructor. - BPMDetect(int numChannels, ///< Number of channels in sample data. - int sampleRate ///< Sample rate in Hz. - ); - - /// Destructor. - virtual ~BPMDetect(); - - /// Inputs a block of samples for analyzing: Envelopes the samples and then - /// updates the autocorrelation estimation. When whole song data has been input - /// in smaller blocks using this function, read the resulting bpm with 'getBpm' - /// function. - /// - /// Notice that data in 'samples' array can be disrupted in processing. - void inputSamples(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer - int numSamples ///< Number of samples in buffer - ); - - - /// Analyzes the results and returns the BPM rate. Use this function to read result - /// after whole song data has been input to the class by consecutive calls of - /// 'inputSamples' function. - /// - /// \return Beats-per-minute rate, or zero if detection failed. - float getBpm(); -}; - -#endif // _BPMDetect_H_ diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.cpp deleted file mode 100644 index a8918a8133..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.cpp +++ /dev/null @@ -1,252 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A buffer class for temporarily storaging sound samples, operates as a -/// first-in-first-out pipe. -/// -/// Samples are added to the end of the sample buffer with the 'putSamples' -/// function, and are received from the beginning of the buffer by calling -/// the 'receiveSamples' function. The class automatically removes the -/// outputted samples from the buffer, as well as grows the buffer size -/// whenever necessary. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.11 $ -// -// $Id: FIFOSampleBuffer.cpp,v 1.11 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -#include "FIFOSampleBuffer.h" - -using namespace soundtouch; - -// Constructor -FIFOSampleBuffer::FIFOSampleBuffer(uint numChannels) -{ - sizeInBytes = 0; // reasonable initial value - buffer = NULL; //new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE)]; - bufferUnaligned = NULL; - samplesInBuffer = 0; - bufferPos = 0; - channels = numChannels; -} - - -// destructor -FIFOSampleBuffer::~FIFOSampleBuffer() -{ - delete[] bufferUnaligned; -} - - -// Sets number of channels, 1 = mono, 2 = stereo -void FIFOSampleBuffer::setChannels(const uint numChannels) -{ - uint usedBytes; - - usedBytes = channels * samplesInBuffer; - channels = numChannels; - samplesInBuffer = usedBytes / channels; -} - - -// if output location pointer 'bufferPos' isn't zero, 'rewinds' the buffer and -// zeroes this pointer by copying samples from the 'bufferPos' pointer -// location on to the beginning of the buffer. -void FIFOSampleBuffer::rewind() -{ - if (bufferPos) - { - memmove(buffer, ptrBegin(), sizeof(SAMPLETYPE) * channels * samplesInBuffer); - bufferPos = 0; - } -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position to -// the sample buffer. -void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - memcpy(ptrEnd(numSamples), samples, sizeof(SAMPLETYPE) * numSamples * channels); - samplesInBuffer += numSamples; -} - - -// Increases the number of samples in the buffer without copying any actual -// samples. -// -// This function is used to update the number of samples in the sample buffer -// when accessing the buffer directly with 'ptrEnd' function. Please be -// careful though! -void FIFOSampleBuffer::putSamples(uint numSamples) -{ - uint req; - - req = samplesInBuffer + numSamples; - ensureCapacity(req); - samplesInBuffer += numSamples; -} - - -// Returns a pointer to the end of the used part of the sample buffer (i.e. -// where the new samples are to be inserted). This function may be used for -// inserting new samples into the sample buffer directly. Please be careful! -// -// Parameter 'slackCapacity' tells the function how much free capacity (in -// terms of samples) there _at least_ should be, in order to the caller to -// succesfully insert all the required samples to the buffer. When necessary, -// the function grows the buffer size to comply with this requirement. -// -// When using this function as means for inserting new samples, also remember -// to increase the sample count afterwards, by calling the -// 'putSamples(numSamples)' function. -SAMPLETYPE *FIFOSampleBuffer::ptrEnd(uint slackCapacity) -{ - ensureCapacity(samplesInBuffer + slackCapacity); - return buffer + samplesInBuffer * channels; -} - - -// Returns a pointer to the beginning of the currently non-outputted samples. -// This function is provided for accessing the output samples directly. -// Please be careful! -// -// When using this function to output samples, also remember to 'remove' the -// outputted samples from the buffer by calling the -// 'receiveSamples(numSamples)' function -SAMPLETYPE *FIFOSampleBuffer::ptrBegin() const -{ - return buffer + bufferPos * channels; -} - - -// Ensures that the buffer has enought capacity, i.e. space for _at least_ -// 'capacityRequirement' number of samples. The buffer is grown in steps of -// 4 kilobytes to eliminate the need for frequently growing up the buffer, -// as well as to round the buffer size up to the virtual memory page size. -void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) -{ - SAMPLETYPE *tempUnaligned, *temp; - - if (capacityRequirement > getCapacity()) - { - // enlarge the buffer in 4kbyte steps (round up to next 4k boundary) - sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & -4096; - assert(sizeInBytes % 2 == 0); - tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)]; - if (tempUnaligned == NULL) - { - throw std::runtime_error("Couldn't allocate memory!\n"); - } - temp = (SAMPLETYPE *)(((ulongptr)tempUnaligned + 15) & -16); - memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE)); - delete[] bufferUnaligned; - buffer = temp; - bufferUnaligned = tempUnaligned; - bufferPos = 0; - } - else - { - // simply rewind the buffer (if necessary) - rewind(); - } -} - - -// Returns the current buffer capacity in terms of samples -uint FIFOSampleBuffer::getCapacity() const -{ - return sizeInBytes / (channels * sizeof(SAMPLETYPE)); -} - - -// Returns the number of samples currently in the buffer -uint FIFOSampleBuffer::numSamples() const -{ - return samplesInBuffer; -} - - -// Output samples from beginning of the sample buffer. Copies demanded number -// of samples to output and removes them from the sample buffer. If there -// are less than 'numsample' samples in the buffer, returns all available. -// -// Returns number of samples copied. -uint FIFOSampleBuffer::receiveSamples(SAMPLETYPE *output, uint maxSamples) -{ - uint num; - - num = (maxSamples > samplesInBuffer) ? samplesInBuffer : maxSamples; - - memcpy(output, ptrBegin(), channels * sizeof(SAMPLETYPE) * num); - return receiveSamples(num); -} - - -// Removes samples from the beginning of the sample buffer without copying them -// anywhere. Used to reduce the number of samples in the buffer, when accessing -// the sample buffer with the 'ptrBegin' function. -uint FIFOSampleBuffer::receiveSamples(uint maxSamples) -{ - if (maxSamples >= samplesInBuffer) - { - uint temp; - - temp = samplesInBuffer; - samplesInBuffer = 0; - return temp; - } - - samplesInBuffer -= maxSamples; - bufferPos += maxSamples; - - return maxSamples; -} - - -// Returns nonzero if the sample buffer is empty -int FIFOSampleBuffer::isEmpty() const -{ - return (samplesInBuffer == 0) ? 1 : 0; -} - - -// Clears the sample buffer -void FIFOSampleBuffer::clear() -{ - samplesInBuffer = 0; - bufferPos = 0; -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.h deleted file mode 100644 index bcbfb59d4e..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSampleBuffer.h +++ /dev/null @@ -1,174 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A buffer class for temporarily storaging sound samples, operates as a -/// first-in-first-out pipe. -/// -/// Samples are added to the end of the sample buffer with the 'putSamples' -/// function, and are received from the beginning of the buffer by calling -/// the 'receiveSamples' function. The class automatically removes the -/// output samples from the buffer as well as grows the storage size -/// whenever necessary. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.9 $ -// -// $Id: FIFOSampleBuffer.h,v 1.9 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIFOSampleBuffer_H -#define FIFOSampleBuffer_H - -#include "FIFOSamplePipe.h" - -namespace soundtouch -{ - -/// Sample buffer working in FIFO (first-in-first-out) principle. The class takes -/// care of storage size adjustment and data moving during input/output operations. -/// -/// Notice that in case of stereo audio, one sample is considered to consist of -/// both channel data. -class FIFOSampleBuffer : public FIFOSamplePipe -{ -private: - /// Sample buffer. - SAMPLETYPE *buffer; - - // Raw unaligned buffer memory. 'buffer' is made aligned by pointing it to first - // 16-byte aligned location of this buffer - SAMPLETYPE *bufferUnaligned; - - /// Sample buffer size in bytes - uint sizeInBytes; - - /// How many samples are currently in buffer. - uint samplesInBuffer; - - /// Channels, 1=mono, 2=stereo. - uint channels; - - /// Current position pointer to the buffer. This pointer is increased when samples are - /// removed from the pipe so that it's necessary to actually rewind buffer (move data) - /// only new data when is put to the pipe. - uint bufferPos; - - /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real - /// beginning of the buffer. - void rewind(); - - /// Ensures that the buffer has capacity for at least this many samples. - void ensureCapacity(const uint capacityRequirement); - - /// Returns current capacity. - uint getCapacity() const; - -public: - - /// Constructor - FIFOSampleBuffer(uint numChannels = 2 ///< Number of channels, 1=mono, 2=stereo. - ///< Default is stereo. - ); - - /// destructor - ~FIFOSampleBuffer(); - - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const; - - /// Returns a pointer to the end of the used part of the sample buffer (i.e. - /// where the new samples are to be inserted). This function may be used for - /// inserting new samples into the sample buffer directly. Please be careful - /// not corrupt the book-keeping! - /// - /// When using this function as means for inserting new samples, also remember - /// to increase the sample count afterwards, by calling the - /// 'putSamples(numSamples)' function. - SAMPLETYPE *ptrEnd( - uint slackCapacity ///< How much free capacity (in samples) there _at least_ - ///< should be so that the caller can succesfully insert the - ///< desired samples to the buffer. If necessary, the function - ///< grows the buffer size to comply with this requirement. - ); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position to - /// the sample buffer. - virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. - uint numSamples ///< Number of samples to insert. - ); - - /// Adjusts the book-keeping to increase number of samples in the buffer without - /// copying any actual samples. - /// - /// This function is used to update the number of samples in the sample buffer - /// when accessing the buffer directly with 'ptrEnd' function. Please be - /// careful though! - virtual void putSamples(uint numSamples ///< Number of samples been inserted. - ); - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ); - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ); - - /// Returns number of samples currently available. - virtual uint numSamples() const; - - /// Sets number of channels, 1 = mono, 2 = stereo. - void setChannels(uint numChannels); - - /// Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const; - - /// Clears all the samples. - virtual void clear(); -}; - -} - -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSamplePipe.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSamplePipe.h deleted file mode 100644 index e10b8b26c8..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIFOSamplePipe.h +++ /dev/null @@ -1,217 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// 'FIFOSamplePipe' : An abstract base class for classes that manipulate sound -/// samples by operating like a first-in-first-out pipe: New samples are fed -/// into one end of the pipe with the 'putSamples' function, and the processed -/// samples are received from the other end with the 'receiveSamples' function. -/// -/// 'FIFOProcessor' : A base class for classes the do signal processing with -/// the samples while operating like a first-in-first-out pipe. When samples -/// are input with the 'putSamples' function, the class processes them -/// and moves the processed samples to the given 'output' pipe object, which -/// may be either another processing stage, or a fifo sample buffer object. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.8 $ -// -// $Id: FIFOSamplePipe.h,v 1.8 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIFOSamplePipe_H -#define FIFOSamplePipe_H - -#include -#include -#include "STTypes.h" - -namespace soundtouch -{ - -/// Abstract base class for FIFO (first-in-first-out) sample processing classes. -class FIFOSamplePipe -{ -public: - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const = 0; - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position to - /// the sample buffer. - virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. - uint numSamples ///< Number of samples to insert. - ) = 0; - - - // Moves samples from the 'other' pipe instance to this instance. - void moveSamples(FIFOSamplePipe &other ///< Other pipe instance where from the receive the data. - ) - { - int oNumSamples = other.numSamples(); - - putSamples(other.ptrBegin(), oNumSamples); - other.receiveSamples(oNumSamples); - }; - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ) = 0; - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ) = 0; - - /// Returns number of samples currently available. - virtual uint numSamples() const = 0; - - // Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const = 0; - - /// Clears all the samples. - virtual void clear() = 0; -}; - - - -/// Base-class for sound processing routines working in FIFO principle. With this base -/// class it's easy to implement sound processing stages that can be chained together, -/// so that samples that are fed into beginning of the pipe automatically go through -/// all the processing stages. -/// -/// When samples are input to this class, they're first processed and then put to -/// the FIFO pipe that's defined as output of this class. This output pipe can be -/// either other processing stage or a FIFO sample buffer. -class FIFOProcessor :public FIFOSamplePipe -{ -protected: - /// Internal pipe where processed samples are put. - FIFOSamplePipe *output; - - /// Sets output pipe. - void setOutPipe(FIFOSamplePipe *pOutput) - { - assert(output == NULL); - assert(pOutput != NULL); - output = pOutput; - } - - - /// Constructor. Doesn't define output pipe; it has to be set be - /// 'setOutPipe' function. - FIFOProcessor() - { - output = NULL; - } - - - /// Constructor. Configures output pipe. - FIFOProcessor(FIFOSamplePipe *pOutput ///< Output pipe. - ) - { - output = pOutput; - } - - - /// Destructor. - virtual ~FIFOProcessor() - { - } - - - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const - { - return output->ptrBegin(); - } - -public: - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ) - { - return output->receiveSamples(outBuffer, maxSamples); - } - - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ) - { - return output->receiveSamples(maxSamples); - } - - - /// Returns number of samples currently available. - virtual uint numSamples() const - { - return output->numSamples(); - } - - - /// Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const - { - return output->isEmpty(); - } -}; - -} - -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.cpp deleted file mode 100644 index 10a0bb0299..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.cpp +++ /dev/null @@ -1,272 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// General FIR digital filter routines with MMX optimization. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: FIRFilter.cpp,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include "FIRFilter.h" -#include "cpu_detect.h" - -using namespace soundtouch; - -/***************************************************************************** - * - * Implementation of the class 'FIRFilter' - * - *****************************************************************************/ - -FIRFilter::FIRFilter() -{ - resultDivFactor = 0; - length = 0; - lengthDiv8 = 0; - filterCoeffs = NULL; -} - - -FIRFilter::~FIRFilter() -{ - delete[] filterCoeffs; -} - -// Usual C-version of the filter routine for stereo sound -uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const -{ - uint i, j, end; - LONG_SAMPLETYPE suml, sumr; -#ifdef FLOAT_SAMPLES - // when using floating point samples, use a scaler instead of a divider - // because division is much slower operation than multiplying. - double dScaler = 1.0 / (double)resultDivider; -#endif - - assert(length != 0); - - end = 2 * (numSamples - length); - - for (j = 0; j < end; j += 2) - { - const SAMPLETYPE *ptr; - - suml = sumr = 0; - ptr = src + j; - - for (i = 0; i < length; i += 4) - { - // loop is unrolled by factor of 4 here for efficiency - suml += ptr[2 * i + 0] * filterCoeffs[i + 0] + - ptr[2 * i + 2] * filterCoeffs[i + 1] + - ptr[2 * i + 4] * filterCoeffs[i + 2] + - ptr[2 * i + 6] * filterCoeffs[i + 3]; - sumr += ptr[2 * i + 1] * filterCoeffs[i + 0] + - ptr[2 * i + 3] * filterCoeffs[i + 1] + - ptr[2 * i + 5] * filterCoeffs[i + 2] + - ptr[2 * i + 7] * filterCoeffs[i + 3]; - } - -#ifdef INTEGER_SAMPLES - suml >>= resultDivFactor; - sumr >>= resultDivFactor; - // saturate to 16 bit integer limits - suml = (suml < -32768) ? -32768 : (suml > 32767) ? 32767 : suml; - // saturate to 16 bit integer limits - sumr = (sumr < -32768) ? -32768 : (sumr > 32767) ? 32767 : sumr; -#else - suml *= dScaler; - sumr *= dScaler; -#endif // INTEGER_SAMPLES - dest[j] = (SAMPLETYPE)suml; - dest[j + 1] = (SAMPLETYPE)sumr; - } - return numSamples - length; -} - - - - -// Usual C-version of the filter routine for mono sound -uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const -{ - uint i, j, end; - LONG_SAMPLETYPE sum; -#ifdef FLOAT_SAMPLES - // when using floating point samples, use a scaler instead of a divider - // because division is much slower operation than multiplying. - double dScaler = 1.0 / (double)resultDivider; -#endif - - - assert(length != 0); - - end = numSamples - length; - for (j = 0; j < end; j ++) - { - sum = 0; - for (i = 0; i < length; i += 4) - { - // loop is unrolled by factor of 4 here for efficiency - sum += src[i + 0] * filterCoeffs[i + 0] + - src[i + 1] * filterCoeffs[i + 1] + - src[i + 2] * filterCoeffs[i + 2] + - src[i + 3] * filterCoeffs[i + 3]; - } -#ifdef INTEGER_SAMPLES - sum >>= resultDivFactor; - // saturate to 16 bit integer limits - sum = (sum < -32768) ? -32768 : (sum > 32767) ? 32767 : sum; -#else - sum *= dScaler; -#endif // INTEGER_SAMPLES - dest[j] = (SAMPLETYPE)sum; - src ++; - } - return end; -} - - -// Set filter coeffiecients and length. -// -// Throws an exception if filter length isn't divisible by 8 -void FIRFilter::setCoefficients(const SAMPLETYPE *coeffs, uint newLength, uint uResultDivFactor) -{ - assert(newLength > 0); - if (newLength % 8) throw std::runtime_error("FIR filter length not divisible by 8"); - - lengthDiv8 = newLength / 8; - length = lengthDiv8 * 8; - assert(length == newLength); - - resultDivFactor = uResultDivFactor; -#ifdef INTEGER_SAMPLES - resultDivider = (SAMPLETYPE)(1< 0); - assert(lengthDiv8 * 8 == length); - if (numSamples < length) return 0; - assert(resultDivFactor >= 0); - if (numChannels == 2) - { - return evaluateFilterStereo(dest, src, numSamples); - } else { - return evaluateFilterMono(dest, src, numSamples); - } -} - - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX-capable CPU available or not. -void * FIRFilter::operator new(size_t s) -{ - // Notice! don't use "new FIRFilter" directly, use "newInstance" to create a new instance instead! - throw std::runtime_error("Don't use 'new FIRFilter', use 'newInstance' member instead!"); - return NULL; -} - - -FIRFilter * FIRFilter::newInstance() -{ - uint uExtensions = 0; - -#if !defined(_MSC_VER) || !defined(__x86_64__) - uExtensions = detectCPUextensions(); -#endif - - // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU - -#ifdef ALLOW_MMX - // MMX routines available only with integer sample types - if (uExtensions & SUPPORT_MMX) - { - return ::new FIRFilterMMX; - } - else -#endif // ALLOW_MMX - -#ifdef ALLOW_SSE - if (uExtensions & SUPPORT_SSE) - { - // SSE support - return ::new FIRFilterSSE; - } - else -#endif // ALLOW_SSE - -#ifdef ALLOW_3DNOW - if (uExtensions & SUPPORT_3DNOW) - { - // 3DNow! support - return ::new FIRFilter3DNow; - } - else -#endif // ALLOW_3DNOW - - { - // ISA optimizations not supported, use plain C version - return ::new FIRFilter; - } -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.h deleted file mode 100644 index 5e9b3410f8..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/FIRFilter.h +++ /dev/null @@ -1,163 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// General FIR digital filter routines with MMX optimization. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.17 $ -// -// $Id: FIRFilter.h,v 1.17 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIRFilter_H -#define FIRFilter_H - -#include "STTypes.h" - -namespace soundtouch -{ - -class FIRFilter -{ -protected: - // Number of FIR filter taps - uint length; - // Number of FIR filter taps divided by 8 - uint lengthDiv8; - - // Result divider factor in 2^k format - uint resultDivFactor; - - // Result divider value. - SAMPLETYPE resultDivider; - - // Memory for filter coefficients - SAMPLETYPE *filterCoeffs; - - virtual uint evaluateFilterStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) const; - virtual uint evaluateFilterMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) const; - -public: - FIRFilter(); - virtual ~FIRFilter(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we've a MMX-capable CPU available or not. - void * operator new(size_t s); - - static FIRFilter *newInstance(); - - /// Applies the filter to the given sequence of samples. - /// Note : The amount of outputted samples is by value of 'filter_length' - /// smaller than the amount of input samples. - /// - /// \return Number of samples copied to 'dest'. - uint evaluate(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples, - uint numChannels) const; - - uint getLength() const; - - virtual void setCoefficients(const SAMPLETYPE *coeffs, - uint newLength, - uint uResultDivFactor); -}; - - -// Optional subclasses that implement CPU-specific optimizations: - -#ifdef ALLOW_MMX - - /// Class that implements MMX optimized functions exclusive for 16bit integer samples type. - class FIRFilterMMX : public FIRFilter - { - protected: - short *filterCoeffsUnalign; - short *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const; - public: - FIRFilterMMX(); - ~FIRFilterMMX(); - - virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_MMX - - -#ifdef ALLOW_3DNOW - - /// Class that implements 3DNow! optimized functions exclusive for floating point samples type. - class FIRFilter3DNow : public FIRFilter - { - protected: - float *filterCoeffsUnalign; - float *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; - public: - FIRFilter3DNow(); - ~FIRFilter3DNow(); - virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_3DNOW - - -#ifdef ALLOW_SSE - /// Class that implements SSE optimized functions exclusive for floating point samples type. - class FIRFilterSSE : public FIRFilter - { - protected: - float *filterCoeffsUnalign; - float *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; - public: - FIRFilterSSE(); - ~FIRFilterSSE(); - - virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_SSE - -} - -#endif // FIRFilter_H diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/Makefile.am b/plugins/spu2ghz/src/3rdparty/SoundTouch/Makefile.am deleted file mode 100644 index 8e1d6d4bbf..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id: Makefile.am,v 1.3 2006/02/05 18:33:34 Olli Exp $ -## -## Copyright (C) 2003 - David W. Durham -## -## This file is part of SoundTouch, an audio processing library for pitch/time adjustments -## -## SoundTouch 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. -## -## SoundTouch 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, write to the Free Software Foundation, Inc., 59 Temple -## Place - Suite 330, Boston, MA 02111-1307, USA - -AUTOMAKE_OPTIONS = foreign - -noinst_HEADERS=AAFilter.h cpu_detect.h FIRFilter.h RateTransposer.h TDStretch.h cpu_detect_x86_gcc.cpp -noinst_LIBRARIES = libSoundTouch.a - -if X86_64 -libSoundTouch_a_CXXFLAGS = -fPIC -libSoundTouch_a_CFLAGS = -fPIC -else -libSoundTouch_a_CXXFLAGS = -msse -mmmx -libSoundTouch_a_CFLAGS = -msse -mmmx -endif - -#lib_LTLIBRARIES=libSoundTouch.la -# the mmx_gcc.cpp and cpu_detect_x86_gcc.cpp may need to be conditionally included here from things discovered in configure.ac -libSoundTouch_a_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp mmx_optimized.cpp sse_optimized.cpp \ -RateTransposer.cpp SoundTouch.cpp TDStretch.cpp WavFile.cpp cpu_detect_x86_gcc.cpp - -# ??? test for -fcheck-new in configure.ac -# other compiler flags to add -AM_CXXFLAGS=-O3 -msse -fcheck-new -I../../include - -# other linking flags to add -#libSoundTouch_la_LIBADD= - diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.cpp deleted file mode 100644 index 9e5c962d13..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.cpp +++ /dev/null @@ -1,626 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation -/// together with anti-alias filtering (first order interpolation with anti- -/// alias filtering should be quite adequate for this application) -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/03/19 10:05:49 $ -// File revision : $Revision: 1.13 $ -// -// $Id: RateTransposer.cpp,v 1.13 2006/03/19 10:05:49 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include "RateTransposer.h" -#include "AAFilter.h" - -using namespace soundtouch; - - -/// A linear samplerate transposer class that uses integer arithmetics. -/// for the transposing. -class RateTransposerInteger : public RateTransposer -{ -protected: - int iSlopeCount; - uint uRate; - SAMPLETYPE sPrevSampleL, sPrevSampleR; - - virtual void resetRegisters(); - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - -public: - RateTransposerInteger(); - virtual ~RateTransposerInteger(); - - /// Sets new target rate. Normal rate = 1.0, smaller values represent slower - /// rate, larger faster rates. - virtual void setRate(float newRate); - -}; - - -/// A linear samplerate transposer class that uses floating point arithmetics -/// for the transposing. -class RateTransposerFloat : public RateTransposer -{ -protected: - float fSlopeCount; - float fRateStep; - SAMPLETYPE sPrevSampleL, sPrevSampleR; - - virtual void resetRegisters(); - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - -public: - RateTransposerFloat(); - virtual ~RateTransposerFloat(); -}; - - - -#ifndef min -#define min(a,b) ((a > b) ? b : a) -#define max(a,b) ((a < b) ? b : a) -#endif - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX/SSE/etc-capable CPU available or not. -void * RateTransposer::operator new(size_t s) -{ - // Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead! - assert(FALSE); - return NULL; -} - - -RateTransposer *RateTransposer::newInstance() -{ -#ifdef INTEGER_SAMPLES - return ::new RateTransposerInteger; -#else - return ::new RateTransposerFloat; -#endif -} - - -// Constructor -RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer) -{ - uChannels = 2; - bUseAAFilter = TRUE; - - // Instantiates the anti-alias filter with default tap length - // of 32 - pAAFilter = new AAFilter(32); -} - - - -RateTransposer::~RateTransposer() -{ - delete pAAFilter; -} - - - -/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable -void RateTransposer::enableAAFilter(const BOOL newMode) -{ - bUseAAFilter = newMode; -} - - -/// Returns nonzero if anti-alias filter is enabled. -BOOL RateTransposer::isAAFilterEnabled() const -{ - return bUseAAFilter; -} - - -AAFilter *RateTransposer::getAAFilter() const -{ - return pAAFilter; -} - - - -// Sets new target uRate. Normal uRate = 1.0, smaller values represent slower -// uRate, larger faster uRates. -void RateTransposer::setRate(float newRate) -{ - float fCutoff; - - fRate = newRate; - - // design a new anti-alias filter - if (newRate > 1.0f) - { - fCutoff = 0.5f / newRate; - } - else - { - fCutoff = 0.5f * newRate; - } - pAAFilter->setCutoffFreq(fCutoff); -} - - -// Outputs as many samples of the 'outputBuffer' as possible, and if there's -// any room left, outputs also as many of the incoming samples as possible. -// The goal is to drive the outputBuffer empty. -// -// It's allowed for 'output' and 'input' parameters to point to the same -// memory position. -void RateTransposer::flushStoreBuffer() -{ - if (storeBuffer.isEmpty()) return; - - outputBuffer.moveSamples(storeBuffer); -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void RateTransposer::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - processSamples(samples, numSamples); -} - - - -// Transposes up the sample rate, causing the observed playback 'rate' of the -// sound to decrease -void RateTransposer::upsample(const SAMPLETYPE *src, uint numSamples) -{ - int count, sizeTemp, num; - - // If the parameter 'uRate' value is smaller than 'SCALE', first transpose - // the samples and then apply the anti-alias filter to remove aliasing. - - // First check that there's enough room in 'storeBuffer' - // (+16 is to reserve some slack in the destination buffer) - sizeTemp = (int)((float)numSamples / fRate + 16.0f); - - // Transpose the samples, store the result into the end of "storeBuffer" - count = transpose(storeBuffer.ptrEnd(sizeTemp), src, numSamples); - storeBuffer.putSamples(count); - - // Apply the anti-alias filter to samples in "store output", output the - // result to "dest" - num = storeBuffer.numSamples(); - count = pAAFilter->evaluate(outputBuffer.ptrEnd(num), - storeBuffer.ptrBegin(), num, uChannels); - outputBuffer.putSamples(count); - - // Remove the processed samples from "storeBuffer" - storeBuffer.receiveSamples(count); -} - - -// Transposes down the sample rate, causing the observed playback 'rate' of the -// sound to increase -void RateTransposer::downsample(const SAMPLETYPE *src, uint numSamples) -{ - int count, sizeTemp; - - // If the parameter 'uRate' value is larger than 'SCALE', first apply the - // anti-alias filter to remove high frequencies (prevent them from folding - // over the lover frequencies), then transpose. */ - - // Add the new samples to the end of the storeBuffer */ - storeBuffer.putSamples(src, numSamples); - - // Anti-alias filter the samples to prevent folding and output the filtered - // data to tempBuffer. Note : because of the FIR filter length, the - // filtering routine takes in 'filter_length' more samples than it outputs. - assert(tempBuffer.isEmpty()); - sizeTemp = storeBuffer.numSamples(); - - count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp), - storeBuffer.ptrBegin(), sizeTemp, uChannels); - - // Remove the filtered samples from 'storeBuffer' - storeBuffer.receiveSamples(count); - - // Transpose the samples (+16 is to reserve some slack in the destination buffer) - sizeTemp = (int)((float)numSamples / fRate + 16.0f); - count = transpose(outputBuffer.ptrEnd(sizeTemp), tempBuffer.ptrBegin(), count); - outputBuffer.putSamples(count); -} - - -// Transposes sample rate by applying anti-alias filter to prevent folding. -// Returns amount of samples returned in the "dest" buffer. -// The maximum amount of samples that can be returned at a time is set by -// the 'set_returnBuffer_size' function. -void RateTransposer::processSamples(const SAMPLETYPE *src, uint numSamples) -{ - uint count; - uint sizeReq; - - if (numSamples == 0) return; - assert(pAAFilter); - - // If anti-alias filter is turned off, simply transpose without applying - // the filter - if (bUseAAFilter == FALSE) - { - sizeReq = (int)((float)numSamples / fRate + 1.0f); - count = transpose(outputBuffer.ptrEnd(sizeReq), src, numSamples); - outputBuffer.putSamples(count); - return; - } - - // Transpose with anti-alias filter - if (fRate < 1.0f) - { - upsample(src, numSamples); - } - else - { - downsample(src, numSamples); - } -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// Returns the number of samples returned in the "dest" buffer -inline uint RateTransposer::transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - if (uChannels == 2) - { - return transposeStereo(dest, src, numSamples); - } - else - { - return transposeMono(dest, src, numSamples); - } -} - - -// Sets the number of channels, 1 = mono, 2 = stereo -void RateTransposer::setChannels(const uint numchannels) -{ - if (uChannels == numchannels) return; - - assert(numchannels == 1 || numchannels == 2); - uChannels = numchannels; - - storeBuffer.setChannels(uChannels); - tempBuffer.setChannels(uChannels); - outputBuffer.setChannels(uChannels); - - // Inits the linear interpolation registers - resetRegisters(); -} - - -// Clears all the samples in the object -void RateTransposer::clear() -{ - outputBuffer.clear(); - storeBuffer.clear(); -} - - -// Returns nonzero if there aren't any samples available for outputting. -uint RateTransposer::isEmpty() -{ - int res; - - res = FIFOProcessor::isEmpty(); - if (res == 0) return 0; - return storeBuffer.isEmpty(); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// RateTransposerInteger - integer arithmetic implementation -// - -/// fixed-point interpolation routine precision -#define SCALE 65536 - -// Constructor -RateTransposerInteger::RateTransposerInteger() : RateTransposer() -{ - // call these here as these are virtual functions; calling these - // from the base class constructor wouldn't execute the overloaded - // versions (peculiar C++ can be). - resetRegisters(); - setRate(1.0f); -} - - -RateTransposerInteger::~RateTransposerInteger() -{ -} - - -void RateTransposerInteger::resetRegisters() -{ - iSlopeCount = 0; - sPrevSampleL = - sPrevSampleR = 0; -} - - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int i, used; - LONG_SAMPLETYPE temp, vol1; - - used = 0; - i = 0; - - // Process the last sample saved from the previous call first... - while (iSlopeCount <= SCALE) - { - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; - dest[i] = (SAMPLETYPE)(temp / SCALE); - i++; - iSlopeCount += uRate; - } - // now always (iSlopeCount > SCALE) - iSlopeCount -= SCALE; - - while (1) - { - while (iSlopeCount > SCALE) - { - iSlopeCount -= SCALE; - used ++; - if (used >= numSamples - 1) goto end; - } - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = src[used] * vol1 + iSlopeCount * src[used + 1]; - dest[i] = (SAMPLETYPE)(temp / SCALE); - - i++; - iSlopeCount += uRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[numSamples - 1]; - - return i; -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Stereo' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int srcPos, i, used; - LONG_SAMPLETYPE temp, vol1; - - if (numSamples == 0) return 0; // no samples, no work - - used = 0; - i = 0; - - // Process the last sample saved from the sPrevSampleLious call first... - while (iSlopeCount <= SCALE) - { - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; - dest[2 * i] = (SAMPLETYPE)(temp / SCALE); - temp = vol1 * sPrevSampleR + iSlopeCount * src[1]; - dest[2 * i + 1] = (SAMPLETYPE)(temp / SCALE); - i++; - iSlopeCount += uRate; - } - // now always (iSlopeCount > SCALE) - iSlopeCount -= SCALE; - - while (1) - { - while (iSlopeCount > SCALE) - { - iSlopeCount -= SCALE; - used ++; - if (used >= numSamples - 1) goto end; - } - srcPos = 2 * used; - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = src[srcPos] * vol1 + iSlopeCount * src[srcPos + 2]; - dest[2 * i] = (SAMPLETYPE)(temp / SCALE); - temp = src[srcPos + 1] * vol1 + iSlopeCount * src[srcPos + 3]; - dest[2 * i + 1] = (SAMPLETYPE)(temp / SCALE); - - i++; - iSlopeCount += uRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[2 * numSamples - 2]; - sPrevSampleR = src[2 * numSamples - 1]; - - return i; -} - - -// Sets new target uRate. Normal uRate = 1.0, smaller values represent slower -// uRate, larger faster uRates. -void RateTransposerInteger::setRate(float newRate) -{ - uRate = (int)(newRate * SCALE + 0.5f); - RateTransposer::setRate(newRate); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// RateTransposerFloat - floating point arithmetic implementation -// -////////////////////////////////////////////////////////////////////////////// - -// Constructor -RateTransposerFloat::RateTransposerFloat() : RateTransposer() -{ - // call these here as these are virtual functions; calling these - // from the base class constructor wouldn't execute the overloaded - // versions (peculiar C++ can be). - resetRegisters(); - setRate(1.0f); -} - - -RateTransposerFloat::~RateTransposerFloat() -{ -} - - -void RateTransposerFloat::resetRegisters() -{ - fSlopeCount = 0; - sPrevSampleL = - sPrevSampleR = 0; -} - - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int i, used; - - used = 0; - i = 0; - - // Process the last sample saved from the previous call first... - while (fSlopeCount <= 1.0f) - { - dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); - i++; - fSlopeCount += fRate; - } - fSlopeCount -= 1.0f; - - if (numSamples == 1) goto end; - - while (1) - { - while (fSlopeCount > 1.0f) - { - fSlopeCount -= 1.0f; - used ++; - if (used >= numSamples - 1) goto end; - } - dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[used] + fSlopeCount * src[used + 1]); - i++; - fSlopeCount += fRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[numSamples - 1]; - - return i; -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int srcPos, i, used; - - if (numSamples == 0) return 0; // no samples, no work - - used = 0; - i = 0; - - // Process the last sample saved from the sPrevSampleLious call first... - while (fSlopeCount <= 1.0f) - { - dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); - dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleR + fSlopeCount * src[1]); - i++; - fSlopeCount += fRate; - } - // now always (iSlopeCount > 1.0f) - fSlopeCount -= 1.0f; - - if (numSamples == 1) goto end; - - while (1) - { - while (fSlopeCount > 1.0f) - { - fSlopeCount -= 1.0f; - used ++; - if (used >= numSamples - 1) goto end; - } - srcPos = 2 * used; - - dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos] - + fSlopeCount * src[srcPos + 2]); - dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1] - + fSlopeCount * src[srcPos + 3]); - - i++; - fSlopeCount += fRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[2 * numSamples - 2]; - sPrevSampleR = src[2 * numSamples - 1]; - - return i; -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.h deleted file mode 100644 index 1cd6e9026d..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/RateTransposer.h +++ /dev/null @@ -1,162 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation -/// together with anti-alias filtering (first order interpolation with anti- -/// alias filtering should be quite adequate for this application). -/// -/// Use either of the derived classes of 'RateTransposerInteger' or -/// 'RateTransposerFloat' for corresponding integer/floating point tranposing -/// algorithm implementation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: RateTransposer.h,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef RateTransposer_H -#define RateTransposer_H - -#include "AAFilter.h" -#include "FIFOSamplePipe.h" -#include "FIFOSampleBuffer.h" - -#include "STTypes.h" - -namespace soundtouch -{ - -/// A common linear samplerate transposer class. -/// -/// Note: Use function "RateTransposer::newInstance()" to create a new class -/// instance instead of the "new" operator; that function automatically -/// chooses a correct implementation depending on if integer or floating -/// arithmetics are to be used. -class RateTransposer : public FIFOProcessor -{ -protected: - /// Anti-alias filter object - AAFilter *pAAFilter; - - float fRate; - - uint uChannels; - - /// Buffer for collecting samples to feed the anti-alias filter between - /// two batches - FIFOSampleBuffer storeBuffer; - - /// Buffer for keeping samples between transposing & anti-alias filter - FIFOSampleBuffer tempBuffer; - - /// Output sample buffer - FIFOSampleBuffer outputBuffer; - - BOOL bUseAAFilter; - - void init(); - - virtual void resetRegisters() = 0; - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) = 0; - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) = 0; - uint transpose(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - - void flushStoreBuffer(); - - void downsample(const SAMPLETYPE *src, - uint numSamples); - void upsample(const SAMPLETYPE *src, - uint numSamples); - - /// Transposes sample rate by applying anti-alias filter to prevent folding. - /// Returns amount of samples returned in the "dest" buffer. - /// The maximum amount of samples that can be returned at a time is set by - /// the 'set_returnBuffer_size' function. - void processSamples(const SAMPLETYPE *src, - uint numSamples); - - -public: - RateTransposer(); - virtual ~RateTransposer(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we're to use integer or floating point arithmetics. - void *operator new(size_t s); - - /// Use this function instead of "new" operator to create a new instance of this class. - /// This function automatically chooses a correct implementation, depending on if - /// integer ot floating point arithmetics are to be used. - static RateTransposer *newInstance(); - - /// Returns the output buffer object - FIFOSamplePipe *getOutput() { return &outputBuffer; }; - - /// Returns the store buffer object - FIFOSamplePipe *getStore() { return &storeBuffer; }; - - /// Return anti-alias filter object - AAFilter *getAAFilter() const; - - /// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable - void enableAAFilter(BOOL newMode); - - /// Returns nonzero if anti-alias filter is enabled. - BOOL isAAFilterEnabled() const; - - /// Sets new target rate. Normal rate = 1.0, smaller values represent slower - /// rate, larger faster rates. - virtual void setRate(float newRate); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint channels); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position into - /// the input of the object. - void putSamples(const SAMPLETYPE *samples, uint numSamples); - - /// Clears all the samples in the object - void clear(); - - /// Returns nonzero if there aren't any samples available for outputting. - uint isEmpty(); -}; - -} - -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/STTypes.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/STTypes.h deleted file mode 100644 index d0969ec1c9..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/STTypes.h +++ /dev/null @@ -1,202 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Common type definitions for SoundTouch audio processing library. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: STTypes.h,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef STTypes_H -#define STTypes_H - -//#define INTEGER_SAMPLES 1 - -typedef unsigned int uint; -typedef unsigned long ulong; - -#ifdef __x86_64__ -typedef unsigned long long ulongptr; -#else -typedef unsigned long ulongptr; -#endif - - -#ifdef __GNUC__ - // In GCC, include soundtouch_config.h made by config scritps -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Use Integer as Sample type */ -//#define INTEGER_SAMPLES 1 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -#endif - -#ifndef _WINDEF_ - // if these aren't defined already by Windows headers, define now - - typedef int BOOL; - -#ifndef FALSE - #define FALSE 0 -#endif - -#ifndef TRUE - #define TRUE 1 -#endif - -#endif // _WINDEF_ - - -namespace soundtouch -{ -/// Activate these undef's to overrule the possible sampletype -/// setting inherited from some other header file: -//#undef INTEGER_SAMPLES -//#undef FLOAT_SAMPLES - -#if !(INTEGER_SAMPLES || FLOAT_SAMPLES) - - /// Choose either 32bit floating point or 16bit integer sampletype - /// by choosing one of the following defines, unless this selection - /// has already been done in some other file. - //// - /// Notes: - /// - In Windows environment, choose the sample format with the - /// following defines. - /// - In GNU environment, the floating point samples are used by - /// default, but integer samples can be chosen by giving the - /// following switch to the configure script: - /// ./configure --enable-integer-samples - /// However, if you still prefer to select the sample format here - /// also in GNU environment, then please #undef the INTEGER_SAMPLE - /// and FLOAT_SAMPLE defines first as in comments above. - //#define INTEGER_SAMPLES 1 //< 16bit integer samples - #define FLOAT_SAMPLES 1 //< 32bit float samples - - #endif - - /// Define this to allow CPU-specific assembler optimizations. Notice that - /// having this enabled on non-x86 platforms doesn't matter; the compiler can - /// drop unsupported extensions on different platforms automatically. - /// However, if you're having difficulties getting the optimized routines - /// compiled with your compler (e.g. some gcc compiler versions may be picky), - /// you may wish to disable the optimizations to make the library compile. - #if !defined(_MSC_VER) || !defined(__x86_64__) - #define ALLOW_OPTIMIZATIONS 1 - #define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 - #endif - - - // If defined, allows the SIMD-optimized routines to take minor shortcuts - // for improved performance. Undefine to require faithfully similar SIMD - // calculations as in normal C implementation. - - - - #ifdef INTEGER_SAMPLES - // 16bit integer sample type - typedef short SAMPLETYPE; - // data type for sample accumulation: Use 32bit integer to prevent overflows - typedef long LONG_SAMPLETYPE; - - #ifdef FLOAT_SAMPLES - // check that only one sample type is defined - #error "conflicting sample types defined" - #endif // FLOAT_SAMPLES - - #ifdef ALLOW_OPTIMIZATIONS - #if (_WIN32 || __i386__ || __x86_64__) - // Allow MMX optimizations - #define ALLOW_MMX 1 - #endif - #endif - - #else - - // floating point samples - typedef float SAMPLETYPE; - // data type for sample accumulation: Use double to utilize full precision. - typedef double LONG_SAMPLETYPE; - - #ifdef ALLOW_OPTIMIZATIONS - // Allow 3DNow! and SSE optimizations - #if _WIN32 - // #define ALLOW_3DNOW 1 - #endif - - #if (_WIN32 || __i386__ || __x86_64__) - #define ALLOW_SSE 1 - #endif - #endif - - #endif // INTEGER_SAMPLES -}; - -#endif \ No newline at end of file diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.cpp deleted file mode 100644 index 381c517162..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.cpp +++ /dev/null @@ -1,474 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -/// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. -/// -/// Notes: -/// - Initialize the SoundTouch object instance by setting up the sound stream -/// parameters with functions 'setSampleRate' and 'setChannels', then set -/// desired tempo/pitch/rate settings with the corresponding functions. -/// -/// - The SoundTouch class behaves like a first-in-first-out pipeline: The -/// samples that are to be processed are fed into one of the pipe by calling -/// function 'putSamples', while the ready processed samples can be read -/// from the other end of the pipeline with function 'receiveSamples'. -/// -/// - The SoundTouch processing classes require certain sized 'batches' of -/// samples in order to process the sound. For this reason the classes buffer -/// incoming samples until there are enough of samples available for -/// processing, then they carry out the processing step and consequently -/// make the processed samples available for outputting. -/// -/// - For the above reason, the processing routines introduce a certain -/// 'latency' between the input and output, so that the samples input to -/// SoundTouch may not be immediately available in the output, and neither -/// the amount of outputtable samples may not immediately be in direct -/// relationship with the amount of previously input samples. -/// -/// - The tempo/pitch/rate control parameters can be altered during processing. -/// Please notice though that they aren't currently protected by semaphores, -/// so in multi-thread application external semaphore protection may be -/// required. -/// -/// - This class utilizes classes 'TDStretch' for tempo change (without modifying -/// pitch) and 'RateTransposer' for changing the playback rate (that is, both -/// tempo and pitch in the same ratio) of the sound. The third available control -/// 'pitch' (change pitch but maintain tempo) is produced by a combination of -/// combining the two other controls. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.13 $ -// -// $Id: SoundTouch.cpp,v 1.13 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include "SoundTouch.h" -#include "TDStretch.h" -#include "RateTransposer.h" -#include "cpu_detect.h" - -using namespace soundtouch; - -/// Print library version string -extern "C" void soundtouch_ac_test() -{ - printf("SoundTouch Version: %s\n",SOUNDTOUCH_VERSION); -} - - -SoundTouch::SoundTouch() -{ - // Initialize rate transposer and tempo changer instances - - pRateTransposer = RateTransposer::newInstance(); - pTDStretch = TDStretch::newInstance(); - - setOutPipe(pTDStretch); - - rate = tempo = 0; - - virtualPitch = - virtualRate = - virtualTempo = 1.0; - - calcEffectiveRateAndTempo(); - - channels = 0; - bSrateSet = FALSE; -} - - - -SoundTouch::~SoundTouch() -{ - delete pRateTransposer; - delete pTDStretch; -} - - - -/// Get SoundTouch library version string -const char *SoundTouch::getVersionString() -{ - static const char *_version = SOUNDTOUCH_VERSION; - - return _version; -} - - -/// Get SoundTouch library version Id -uint SoundTouch::getVersionId() -{ - return SOUNDTOUCH_VERSION_ID; -} - - -// Sets the number of channels, 1 = mono, 2 = stereo -void SoundTouch::setChannels(uint numChannels) -{ - if (numChannels != 1 && numChannels != 2) - { - throw std::runtime_error("Illegal number of channels"); - } - channels = numChannels; - pRateTransposer->setChannels(numChannels); - pTDStretch->setChannels(numChannels); -} - - - -// Sets new rate control value. Normal rate = 1.0, smaller values -// represent slower rate, larger faster rates. -void SoundTouch::setRate(float newRate) -{ - virtualRate = newRate; - calcEffectiveRateAndTempo(); -} - - - -// Sets new rate control value as a difference in percents compared -// to the original rate (-50 .. +100 %) -void SoundTouch::setRateChange(float newRate) -{ - virtualRate = 1.0f + 0.01f * newRate; - calcEffectiveRateAndTempo(); -} - - - -// Sets new tempo control value. Normal tempo = 1.0, smaller values -// represent slower tempo, larger faster tempo. -void SoundTouch::setTempo(float newTempo) -{ - virtualTempo = newTempo; - calcEffectiveRateAndTempo(); -} - - - -// Sets new tempo control value as a difference in percents compared -// to the original tempo (-50 .. +100 %) -void SoundTouch::setTempoChange(float newTempo) -{ - virtualTempo = 1.0f + 0.01f * newTempo; - calcEffectiveRateAndTempo(); -} - - - -// Sets new pitch control value. Original pitch = 1.0, smaller values -// represent lower pitches, larger values higher pitch. -void SoundTouch::setPitch(float newPitch) -{ - virtualPitch = newPitch; - calcEffectiveRateAndTempo(); -} - - - -// Sets pitch change in octaves compared to the original pitch -// (-1.00 .. +1.00) -void SoundTouch::setPitchOctaves(float newPitch) -{ - virtualPitch = (float)exp(0.69314718056f * newPitch); - calcEffectiveRateAndTempo(); -} - - - -// Sets pitch change in semi-tones compared to the original pitch -// (-12 .. +12) -void SoundTouch::setPitchSemiTones(int newPitch) -{ - setPitchOctaves((float)newPitch / 12.0f); -} - - - -void SoundTouch::setPitchSemiTones(float newPitch) -{ - setPitchOctaves(newPitch / 12.0f); -} - - -// Calculates 'effective' rate and tempo values from the -// nominal control values. -void SoundTouch::calcEffectiveRateAndTempo() -{ - float oldTempo = tempo; - float oldRate = rate; - - tempo = virtualTempo / virtualPitch; - rate = virtualPitch * virtualRate; - - if (rate != oldRate) pRateTransposer->setRate(rate); - if (tempo != oldTempo) pTDStretch->setTempo(tempo); - - if (rate > 1.0f) - { - if (output != pRateTransposer) - { - FIFOSamplePipe *transOut; - - assert(output == pTDStretch); - // move samples in the current output buffer to the output of pRateTransposer - transOut = pRateTransposer->getOutput(); - transOut->moveSamples(*output); - // move samples in tempo changer's input to pitch transposer's input - pRateTransposer->moveSamples(*pTDStretch->getInput()); - - output = pRateTransposer; - } - } - else - { - if (output != pTDStretch) - { - FIFOSamplePipe *tempoOut; - - assert(output == pRateTransposer); - // move samples in the current output buffer to the output of pTDStretch - tempoOut = pTDStretch->getOutput(); - tempoOut->moveSamples(*output); - // move samples in pitch transposer's store buffer to tempo changer's input - pTDStretch->moveSamples(*pRateTransposer->getStore()); - - output = pTDStretch; - - } - } -} - - -// Sets sample rate. -void SoundTouch::setSampleRate(uint srate) -{ - bSrateSet = TRUE; - // set sample rate, leave other tempo changer parameters as they are. - pTDStretch->setParameters(srate); -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void SoundTouch::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - if (bSrateSet == FALSE) - { - throw std::runtime_error("SoundTouch : Sample rate not defined"); - } - else if (channels == 0) - { - throw std::runtime_error("SoundTouch : Number of channels not defined"); - } - - // Transpose the rate of the new samples if necessary - /* Bypass the nominal setting - can introduce a click in sound when tempo/pitch control crosses the nominal value... - if (rate == 1.0f) - { - // The rate value is same as the original, simply evaluate the tempo changer. - assert(output == pTDStretch); - if (pRateTransposer->isEmpty() == 0) - { - // yet flush the last samples in the pitch transposer buffer - // (may happen if 'rate' changes from a non-zero value to zero) - pTDStretch->moveSamples(*pRateTransposer); - } - pTDStretch->putSamples(samples, numSamples); - } - */ - else if (rate <= 1.0f) - { - // transpose the rate down, output the transposed sound to tempo changer buffer - assert(output == pTDStretch); - pRateTransposer->putSamples(samples, numSamples); - pTDStretch->moveSamples(*pRateTransposer); - } - else - { - assert(rate > 1.0f); - // evaluate the tempo changer, then transpose the rate up, - assert(output == pRateTransposer); - pTDStretch->putSamples(samples, numSamples); - pRateTransposer->moveSamples(*pTDStretch); - } -} - - -// Flushes the last samples from the processing pipeline to the output. -// Clears also the internal processing buffers. -// -// Note: This function is meant for extracting the last samples of a sound -// stream. This function may introduce additional blank samples in the end -// of the sound stream, and thus it's not recommended to call this function -// in the middle of a sound stream. -void SoundTouch::flush() -{ - int i; - uint nOut; - SAMPLETYPE buff[128]; - - nOut = numSamples(); - - memset(buff, 0, 128 * sizeof(SAMPLETYPE)); - // "Push" the last active samples out from the processing pipeline by - // feeding blank samples into the processing pipeline until new, - // processed samples appear in the output (not however, more than - // 8ksamples in any case) - for (i = 0; i < 128; i ++) - { - putSamples(buff, 64); - if (numSamples() != nOut) break; // new samples have appeared in the output! - } - - // Clear working buffers - pRateTransposer->clear(); - pTDStretch->clearInput(); - // yet leave the 'tempoChanger' output intouched as that's where the - // flushed samples are! -} - - -// Changes a setting controlling the processing system behaviour. See the -// 'SETTING_...' defines for available setting ID's. -BOOL SoundTouch::setSetting(uint settingId, uint value) -{ - uint sampleRate, sequenceMs, seekWindowMs, overlapMs; - - // read current tdstretch routine parameters - pTDStretch->getParameters(&sampleRate, &sequenceMs, &seekWindowMs, &overlapMs); - - switch (settingId) - { - case SETTING_USE_AA_FILTER : - // enables / disabless anti-alias filter - pRateTransposer->enableAAFilter((value != 0) ? TRUE : FALSE); - return TRUE; - - case SETTING_AA_FILTER_LENGTH : - // sets anti-alias filter length - pRateTransposer->getAAFilter()->setLength(value); - return TRUE; - - case SETTING_USE_QUICKSEEK : - // enables / disables tempo routine quick seeking algorithm - pTDStretch->enableQuickSeek((value != 0) ? TRUE : FALSE); - return TRUE; - - case SETTING_SEQUENCE_MS: - // change time-stretch sequence duration parameter - pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs); - return TRUE; - - case SETTING_SEEKWINDOW_MS: - // change time-stretch seek window length parameter - pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs); - return TRUE; - - case SETTING_OVERLAP_MS: - // change time-stretch overlap length parameter - pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value); - return TRUE; - - default : - return FALSE; - } -} - - -// Reads a setting controlling the processing system behaviour. See the -// 'SETTING_...' defines for available setting ID's. -// -// Returns the setting value. -uint SoundTouch::getSetting(uint settingId) const -{ - uint temp; - - switch (settingId) - { - case SETTING_USE_AA_FILTER : - return pRateTransposer->isAAFilterEnabled(); - - case SETTING_AA_FILTER_LENGTH : - return pRateTransposer->getAAFilter()->getLength(); - - case SETTING_USE_QUICKSEEK : - return pTDStretch->isQuickSeekEnabled(); - - case SETTING_SEQUENCE_MS: - pTDStretch->getParameters(NULL, &temp, NULL, NULL); - return temp; - - case SETTING_SEEKWINDOW_MS: - pTDStretch->getParameters(NULL, NULL, &temp, NULL); - return temp; - - case SETTING_OVERLAP_MS: - pTDStretch->getParameters(NULL, NULL, NULL, &temp); - return temp; - - default : - return 0; - } -} - - -// Clears all the samples in the object's output and internal processing -// buffers. -void SoundTouch::clear() -{ - pRateTransposer->clear(); - pTDStretch->clear(); -} - - - -/// Returns number of samples currently unprocessed. -uint SoundTouch::numUnprocessedSamples() const -{ - FIFOSamplePipe * psp; - if (pTDStretch) - { - psp = pTDStretch->getInput(); - if (psp) - { - return psp->numSamples(); - } - } - return 0; -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.h deleted file mode 100644 index 9f3a152f26..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/SoundTouch.h +++ /dev/null @@ -1,252 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -/// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. -/// -/// Notes: -/// - Initialize the SoundTouch object instance by setting up the sound stream -/// parameters with functions 'setSampleRate' and 'setChannels', then set -/// desired tempo/pitch/rate settings with the corresponding functions. -/// -/// - The SoundTouch class behaves like a first-in-first-out pipeline: The -/// samples that are to be processed are fed into one of the pipe by calling -/// function 'putSamples', while the ready processed samples can be read -/// from the other end of the pipeline with function 'receiveSamples'. -/// -/// - The SoundTouch processing classes require certain sized 'batches' of -/// samples in order to process the sound. For this reason the classes buffer -/// incoming samples until there are enough of samples available for -/// processing, then they carry out the processing step and consequently -/// make the processed samples available for outputting. -/// -/// - For the above reason, the processing routines introduce a certain -/// 'latency' between the input and output, so that the samples input to -/// SoundTouch may not be immediately available in the output, and neither -/// the amount of outputtable samples may not immediately be in direct -/// relationship with the amount of previously input samples. -/// -/// - The tempo/pitch/rate control parameters can be altered during processing. -/// Please notice though that they aren't currently protected by semaphores, -/// so in multi-thread application external semaphore protection may be -/// required. -/// -/// - This class utilizes classes 'TDStretch' for tempo change (without modifying -/// pitch) and 'RateTransposer' for changing the playback rate (that is, both -/// tempo and pitch in the same ratio) of the sound. The third available control -/// 'pitch' (change pitch but maintain tempo) is produced by a combination of -/// combining the two other controls. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.14 $ -// -// $Id: SoundTouch.h,v 1.14 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef SoundTouch_H -#define SoundTouch_H - -#include "FIFOSamplePipe.h" -#include "STTypes.h" - -namespace soundtouch -{ - -/// Soundtouch library version string -#define SOUNDTOUCH_VERSION "1.3.1" - -/// SoundTouch library version id -#define SOUNDTOUCH_VERSION_ID 010301 - -// -// Available setting IDs for the 'setSetting' & 'get_setting' functions: - -/// Enable/disable anti-alias filter in pitch transposer (0 = disable) -#define SETTING_USE_AA_FILTER 0 - -/// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) -#define SETTING_AA_FILTER_LENGTH 1 - -/// Enable/disable quick seeking algorithm in tempo changer routine -/// (enabling quick seeking lowers CPU utilization but causes a minor sound -/// quality compromising) -#define SETTING_USE_QUICKSEEK 2 - -/// Time-stretch algorithm single processing sequence length in milliseconds. This determines -/// to how long sequences the original sound is chopped in the time-stretch algorithm. -/// See "STTypes.h" or README for more information. -#define SETTING_SEQUENCE_MS 3 - -/// Time-stretch algorithm seeking window length in milliseconds for algorithm that finds the -/// best possible overlapping location. This determines from how wide window the algorithm -/// may look for an optimal joining location when mixing the sound sequences back together. -/// See "STTypes.h" or README for more information. -#define SETTING_SEEKWINDOW_MS 4 - -/// Time-stretch algorithm overlap length in milliseconds. When the chopped sound sequences -/// are mixed back together, to form a continuous sound stream, this parameter defines over -/// how long period the two consecutive sequences are let to overlap each other. -/// See "STTypes.h" or README for more information. -#define SETTING_OVERLAP_MS 5 - - -class SoundTouch : public FIFOProcessor -{ -private: - /// Rate transposer class instance - class RateTransposer *pRateTransposer; - - /// Time-stretch class instance - class TDStretch *pTDStretch; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualRate; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualTempo; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualPitch; - - /// Flag: Has sample rate been set? - BOOL bSrateSet; - - /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and - /// 'virtualPitch' parameters. - void calcEffectiveRateAndTempo(); - -protected : - /// Number of channels - uint channels; - - /// Effective 'rate' value calculated from 'virtualRate', 'virtualTempo' and 'virtualPitch' - float rate; - - /// Effective 'tempo' value calculated from 'virtualRate', 'virtualTempo' and 'virtualPitch' - float tempo; - -public: - SoundTouch(); - virtual ~SoundTouch(); - - /// Get SoundTouch library version string - static const char *getVersionString(); - - /// Get SoundTouch library version Id - static uint getVersionId(); - - /// Sets new rate control value. Normal rate = 1.0, smaller values - /// represent slower rate, larger faster rates. - void setRate(float newRate); - - /// Sets new tempo control value. Normal tempo = 1.0, smaller values - /// represent slower tempo, larger faster tempo. - void setTempo(float newTempo); - - /// Sets new rate control value as a difference in percents compared - /// to the original rate (-50 .. +100 %) - void setRateChange(float newRate); - - /// Sets new tempo control value as a difference in percents compared - /// to the original tempo (-50 .. +100 %) - void setTempoChange(float newTempo); - - /// Sets new pitch control value. Original pitch = 1.0, smaller values - /// represent lower pitches, larger values higher pitch. - void setPitch(float newPitch); - - /// Sets pitch change in octaves compared to the original pitch - /// (-1.00 .. +1.00) - void setPitchOctaves(float newPitch); - - /// Sets pitch change in semi-tones compared to the original pitch - /// (-12 .. +12) - void setPitchSemiTones(int newPitch); - void setPitchSemiTones(float newPitch); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint numChannels); - - /// Sets sample rate. - void setSampleRate(uint srate); - - /// Flushes the last samples from the processing pipeline to the output. - /// Clears also the internal processing buffers. - // - /// Note: This function is meant for extracting the last samples of a sound - /// stream. This function may introduce additional blank samples in the end - /// of the sound stream, and thus it's not recommended to call this function - /// in the middle of a sound stream. - void flush(); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position into - /// the input of the object. Notice that sample rate _has_to_ be set before - /// calling this function, otherwise throws a runtime_error exception. - virtual void putSamples( - const SAMPLETYPE *samples, ///< Pointer to sample buffer. - uint numSamples ///< Number of samples in buffer. Notice - ///< that in case of stereo-sound a single sample - ///< contains data for both channels. - ); - - /// Clears all the samples in the object's output and internal processing - /// buffers. - virtual void clear(); - - /// Changes a setting controlling the processing system behaviour. See the - /// 'SETTING_...' defines for available setting ID's. - /// - /// \return 'TRUE' if the setting was succesfully changed - BOOL setSetting(uint settingId, ///< Setting ID number. see SETTING_... defines. - uint value ///< New setting value. - ); - - /// Reads a setting controlling the processing system behaviour. See the - /// 'SETTING_...' defines for available setting ID's. - /// - /// \return the setting value. - uint getSetting(uint settingId ///< Setting ID number, see SETTING_... defines. - ) const; - - /// Returns number of samples currently unprocessed. - virtual uint numUnprocessedSamples() const; - - - /// Other handy functions that are implemented in the ancestor classes (see - /// classes 'FIFOProcessor' and 'FIFOSamplePipe') - /// - /// - receiveSamples() : Use this function to receive 'ready' processed samples from SoundTouch. - /// - numSamples() : Get number of 'ready' samples that can be received with - /// function 'receiveSamples()' - /// - isEmpty() : Returns nonzero if there aren't any 'ready' samples. - /// - clear() : Clears all samples from ready/processing buffers. -}; - -} -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.cpp deleted file mode 100644 index 339c7378fb..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.cpp +++ /dev/null @@ -1,940 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like -/// method with several performance-increasing tweaks. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific -/// file, e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.24 $ -// -// $Id: TDStretch.cpp,v 1.24 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include "STTypes.h" -#include "cpu_detect.h" -#include "TDStretch.h" - -using namespace soundtouch; - -#ifndef min -#define min(a,b) ((a > b) ? b : a) -#define max(a,b) ((a < b) ? b : a) -#endif - - - -/***************************************************************************** - * - * Constant definitions - * - *****************************************************************************/ - - -// Table for the hierarchical mixing position seeking algorithm -int scanOffsets[4][24]={ - { 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806, - 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0}, - {-100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; - -/***************************************************************************** - * - * Implementation of the class 'TDStretch' - * - *****************************************************************************/ - - -TDStretch::TDStretch() : FIFOProcessor(&outputBuffer) -{ - bQuickseek = FALSE; - channels = 2; - bMidBufferDirty = FALSE; - - pMidBuffer = NULL; - pRefMidBufferUnaligned = NULL; - overlapLength = 0; - - setParameters(48000, DEFAULT_SEQUENCE_MS, DEFAULT_SEEKWINDOW_MS, DEFAULT_OVERLAP_MS); - - setTempo(1.0f); -} - - - - -TDStretch::~TDStretch() -{ - delete[] pMidBuffer; - delete[] pRefMidBufferUnaligned; -} - - - -// Calculates the x having the closest 2^x value for the given value -static int _getClosest2Power(double value) -{ - return (int)(log(value) / log(2.0) + 0.5); -} - - - -// Sets routine control parameters. These control are certain time constants -// defining how the sound is stretched to the desired duration. -// -// 'sampleRate' = sample rate of the sound -// 'sequenceMS' = one processing sequence length in milliseconds (default = 82 ms) -// 'seekwindowMS' = seeking window length for scanning the best overlapping -// position (default = 28 ms) -// 'overlapMS' = overlapping length (default = 12 ms) - -void TDStretch::setParameters(uint aSampleRate, uint aSequenceMS, - uint aSeekWindowMS, uint aOverlapMS) -{ - this->sampleRate = aSampleRate; - this->sequenceMs = aSequenceMS; - this->seekWindowMs = aSeekWindowMS; - this->overlapMs = aOverlapMS; - - seekLength = (sampleRate * seekWindowMs) / 1000; - seekWindowLength = (sampleRate * sequenceMs) / 1000; - - maxOffset = seekLength; - - calculateOverlapLength(overlapMs); - - // set tempo to recalculate 'sampleReq' - setTempo(tempo); - -} - - - -/// Get routine control parameters, see setParameters() function. -/// Any of the parameters to this function can be NULL, in such case corresponding parameter -/// value isn't returned. -void TDStretch::getParameters(uint *pSampleRate, uint *pSequenceMs, uint *pSeekWindowMs, uint *pOverlapMs) -{ - if (pSampleRate) - { - *pSampleRate = sampleRate; - } - - if (pSequenceMs) - { - *pSequenceMs = sequenceMs; - } - - if (pSeekWindowMs) - { - *pSeekWindowMs = seekWindowMs; - } - - if (pOverlapMs) - { - *pOverlapMs = overlapMs; - } -} - - -// Overlaps samples in 'midBuffer' with the samples in 'input' -void TDStretch::overlapMono(SAMPLETYPE *output, const SAMPLETYPE *input) const -{ - int i, itemp; - - for (i = 0; i < (int)overlapLength ; i ++) - { - itemp = overlapLength - i; - output[i] = (input[i] * i + pMidBuffer[i] * itemp ) / overlapLength; // >> overlapDividerBits; - } -} - - - -void TDStretch::clearMidBuffer() -{ - if (bMidBufferDirty) - { - memset(pMidBuffer, 0, 2 * sizeof(SAMPLETYPE) * overlapLength); - bMidBufferDirty = FALSE; - } -} - - -void TDStretch::clearInput() -{ - inputBuffer.clear(); - clearMidBuffer(); -} - - -// Clears the sample buffers -void TDStretch::clear() -{ - outputBuffer.clear(); - inputBuffer.clear(); - clearMidBuffer(); -} - - - -// Enables/disables the quick position seeking algorithm. Zero to disable, nonzero -// to enable -void TDStretch::enableQuickSeek(BOOL enable) -{ - bQuickseek = enable; -} - - -// Returns nonzero if the quick seeking algorithm is enabled. -BOOL TDStretch::isQuickSeekEnabled() const -{ - return bQuickseek; -} - - -// Seeks for the optimal overlap-mixing position. -uint TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos) -{ - if (channels == 2) - { - // stereo sound - if (bQuickseek) - { - return seekBestOverlapPositionStereoQuick(refPos); - } - else - { - return seekBestOverlapPositionStereo(refPos); - } - } - else - { - // mono sound - if (bQuickseek) - { - return seekBestOverlapPositionMonoQuick(refPos); - } - else - { - return seekBestOverlapPositionMono(refPos); - } - } -} - - - - -// Overlaps samples in 'midBuffer' with the samples in 'inputBuffer' at position -// of 'ovlPos'. -inline void TDStretch::overlap(SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const -{ - if (channels == 2) - { - // stereo sound - overlapStereo(output, input + 2 * ovlPos); - } else { - // mono sound. - overlapMono(output, input + ovlPos); - } -} - - - - -// Seeks for the optimal overlap-mixing position. The 'stereo' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) -{ - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint i; - - // Slopes the amplitudes of the 'midBuffer' samples - precalcCorrReferenceStereo(); - - bestCorr = INT_MIN; - bestOffs = 0; - - // Scans for the best correlation value by testing each possible position - // over the permitted range. - for (i = 0; i < seekLength; i ++) - { - // Calculates correlation value for the mixing position corresponding - // to 'i' - corr = calcCrossCorrStereo(refPos + 2 * i, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = i; - } - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -// Seeks for the optimal overlap-mixing position. The 'stereo' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) -{ - uint j; - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint scanCount, corrOffset, tempOffset; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceStereo(); - - bestCorr = INT_MIN; - bestOffs = 0; - corrOffset = 0; - tempOffset = 0; - - // Scans for the best correlation value using four-pass hierarchical search. - // - // The look-up table 'scans' has hierarchical position adjusting steps. - // In first pass the routine searhes for the highest correlation with - // relatively coarse steps, then rescans the neighbourhood of the highest - // correlation with better resolution and so on. - for (scanCount = 0;scanCount < 4; scanCount ++) - { - j = 0; - while (scanOffsets[scanCount][j]) - { - tempOffset = corrOffset + scanOffsets[scanCount][j]; - if (tempOffset >= seekLength) break; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrStereo(refPos + 2 * tempOffset, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - j ++; - } - corrOffset = bestOffs; - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - - -// Seeks for the optimal overlap-mixing position. The 'mono' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) -{ - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint tempOffset; - const SAMPLETYPE *compare; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceMono(); - - bestCorr = INT_MIN; - bestOffs = 0; - - // Scans for the best correlation value by testing each possible position - // over the permitted range. - for (tempOffset = 0; tempOffset < seekLength; tempOffset ++) - { - compare = refPos + tempOffset; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrMono(pRefMidBuffer, compare); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -// Seeks for the optimal overlap-mixing position. The 'mono' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) -{ - uint j; - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint scanCount, corrOffset, tempOffset; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceMono(); - - bestCorr = INT_MIN; - bestOffs = 0; - corrOffset = 0; - tempOffset = 0; - - // Scans for the best correlation value using four-pass hierarchical search. - // - // The look-up table 'scans' has hierarchical position adjusting steps. - // In first pass the routine searhes for the highest correlation with - // relatively coarse steps, then rescans the neighbourhood of the highest - // correlation with better resolution and so on. - for (scanCount = 0;scanCount < 4; scanCount ++) - { - j = 0; - while (scanOffsets[scanCount][j]) - { - tempOffset = corrOffset + scanOffsets[scanCount][j]; - if (tempOffset >= seekLength) break; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrMono(refPos + tempOffset, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - j ++; - } - corrOffset = bestOffs; - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -/// clear cross correlation routine state if necessary -void TDStretch::clearCrossCorrState() -{ - // default implementation is empty. -} - - -// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower -// tempo, larger faster tempo. -void TDStretch::setTempo(float newTempo) -{ - uint intskip; - - tempo = newTempo; - - // Calculate ideal skip length (according to tempo value) - nominalSkip = tempo * (seekWindowLength - overlapLength); - skipFract = 0; - intskip = (int)(nominalSkip + 0.5f); - - // Calculate how many samples are needed in the 'inputBuffer' to - // process another batch of samples - sampleReq = max(intskip + overlapLength, seekWindowLength) + maxOffset; -} - - - -// Sets the number of channels, 1 = mono, 2 = stereo -void TDStretch::setChannels(uint numChannels) -{ - if (channels == numChannels) return; - assert(numChannels == 1 || numChannels == 2); - - channels = numChannels; - inputBuffer.setChannels(channels); - outputBuffer.setChannels(channels); -} - - -// nominal tempo, no need for processing, just pass the samples through -// to outputBuffer -void TDStretch::processNominalTempo() -{ - assert(tempo == 1.0f); - - if (bMidBufferDirty) - { - // If there are samples in pMidBuffer waiting for overlapping, - // do a single sliding overlapping with them in order to prevent a - // clicking distortion in the output sound - if (inputBuffer.numSamples() < overlapLength) - { - // wait until we've got overlapLength input samples - return; - } - // Mix the samples in the beginning of 'inputBuffer' with the - // samples in 'midBuffer' using sliding overlapping - overlap(outputBuffer.ptrEnd(overlapLength), inputBuffer.ptrBegin(), 0); - outputBuffer.putSamples(overlapLength); - inputBuffer.receiveSamples(overlapLength); - clearMidBuffer(); - // now we've caught the nominal sample flow and may switch to - // bypass mode - } - - // Simply bypass samples from input to output - outputBuffer.moveSamples(inputBuffer); -} - - -// Processes as many processing frames of the samples 'inputBuffer', store -// the result into 'outputBuffer' -void TDStretch::processSamples() -{ - uint ovlSkip, offset; - int temp; - - /* Removed this small optimization - can introduce a click to sound when tempo setting - crosses the nominal value - if (tempo == 1.0f) - { - // tempo not changed from the original, so bypass the processing - processNominalTempo(); - return; - } - */ - - if (bMidBufferDirty == FALSE) - { - // if midBuffer is empty, move the first samples of the input stream - // into it - if (inputBuffer.numSamples() < overlapLength) - { - // wait until we've got overlapLength samples - return; - } - memcpy(pMidBuffer, inputBuffer.ptrBegin(), channels * overlapLength * sizeof(SAMPLETYPE)); - inputBuffer.receiveSamples(overlapLength); - bMidBufferDirty = TRUE; - } - - // Process samples as long as there are enough samples in 'inputBuffer' - // to form a processing frame. - while (inputBuffer.numSamples() >= sampleReq) - { - // If tempo differs from the normal ('SCALE'), scan for the best overlapping - // position - offset = seekBestOverlapPosition(inputBuffer.ptrBegin()); - - // Mix the samples in the 'inputBuffer' at position of 'offset' with the - // samples in 'midBuffer' using sliding overlapping - // ... first partially overlap with the end of the previous sequence - // (that's in 'midBuffer') - overlap(outputBuffer.ptrEnd(overlapLength), inputBuffer.ptrBegin(), offset); - outputBuffer.putSamples(overlapLength); - - // ... then copy sequence samples from 'inputBuffer' to output - temp = (seekWindowLength - 2 * overlapLength);// & 0xfffffffe; - if (temp > 0) - { - outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * (offset + overlapLength), temp); - } - - // Copies the end of the current sequence from 'inputBuffer' to - // 'midBuffer' for being mixed with the beginning of the next - // processing sequence and so on - assert(offset + seekWindowLength <= inputBuffer.numSamples()); - memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + seekWindowLength - overlapLength), - channels * sizeof(SAMPLETYPE) * overlapLength); - bMidBufferDirty = TRUE; - - // Remove the processed samples from the input buffer. Update - // the difference between integer & nominal skip step to 'skipFract' - // in order to prevent the error from accumulating over time. - skipFract += nominalSkip; // real skip size - ovlSkip = (int)skipFract; // rounded to integer skip - skipFract -= ovlSkip; // maintain the fraction part, i.e. real vs. integer skip - inputBuffer.receiveSamples(ovlSkip); - } -} - - -// Adds 'numsamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void TDStretch::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - // Add the samples into the input buffer - inputBuffer.putSamples(samples, numSamples); - // Process the samples in input buffer - processSamples(); -} - - - -/// Set new overlap length parameter & reallocate RefMidBuffer if necessary. -void TDStretch::acceptNewOverlapLength(uint newOverlapLength) -{ - uint prevOvl; - - prevOvl = overlapLength; - overlapLength = newOverlapLength; - - if (overlapLength > prevOvl) - { - delete[] pMidBuffer; - delete[] pRefMidBufferUnaligned; - - pMidBuffer = new SAMPLETYPE[overlapLength * 2]; - bMidBufferDirty = TRUE; - clearMidBuffer(); - - pRefMidBufferUnaligned = new SAMPLETYPE[2 * overlapLength + 16 / sizeof(SAMPLETYPE)]; - // ensure that 'pRefMidBuffer' is aligned to 16 byte boundary for efficiency - pRefMidBuffer = (SAMPLETYPE *)((((ulongptr)pRefMidBufferUnaligned) + 15) & -16); - } -} - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX/SSE/etc-capable CPU available or not. -void * TDStretch::operator new(size_t s) -{ - // Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead! - assert(FALSE); - return NULL; -} - - -TDStretch * TDStretch::newInstance() -{ - uint uExtensions = 0; - -#if !defined(_MSC_VER) || !defined(__x86_64__) - uExtensions = detectCPUextensions(); -#endif - - // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU - -#ifdef ALLOW_MMX - // MMX routines available only with integer sample types - if (uExtensions & SUPPORT_MMX) - { - return ::new TDStretchMMX; - } - else -#endif // ALLOW_MMX - - -#ifdef ALLOW_SSE - if (uExtensions & SUPPORT_SSE) - { - // SSE support - return ::new TDStretchSSE; - } - else -#endif // ALLOW_SSE - - -#ifdef ALLOW_3DNOW - if (uExtensions & SUPPORT_3DNOW) - { - // 3DNow! support - return ::new TDStretch3DNow; - } - else -#endif // ALLOW_3DNOW - - { - // ISA optimizations not supported, use plain C version - return ::new TDStretch; - } -} - - -////////////////////////////////////////////////////////////////////////////// -// -// Integer arithmetics specific algorithm implementations. -// -////////////////////////////////////////////////////////////////////////////// - -#ifdef INTEGER_SAMPLES - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceStereo() -{ - int i, cnt2; - int temp, temp2; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = i * (overlapLength - i); - cnt2 = i * 2; - - temp2 = (pMidBuffer[cnt2] * temp) / slopingDivider; - pRefMidBuffer[cnt2] = (short)(temp2); - temp2 = (pMidBuffer[cnt2 + 1] * temp) / slopingDivider; - pRefMidBuffer[cnt2 + 1] = (short)(temp2); - } -} - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceMono() -{ - int i; - long temp; - long temp2; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = i * (overlapLength - i); - temp2 = (pMidBuffer[i] * temp) / slopingDivider; - pRefMidBuffer[i] = (short)temp2; - } -} - - -// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo' -// version of the routine. -void TDStretch::overlapStereo(short *output, const short *input) const -{ - int i; - short temp; - uint cnt2; - - for (i = 0; i < (int)overlapLength ; i ++) - { - temp = (short)(overlapLength - i); - cnt2 = 2 * i; - output[cnt2] = (input[cnt2] * i + pMidBuffer[cnt2] * temp ) / overlapLength; - output[cnt2 + 1] = (input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp ) / overlapLength; - } -} - - -/// Calculates overlap period length in samples. -/// Integer version rounds overlap length to closest power of 2 -/// for a divide scaling operation. -void TDStretch::calculateOverlapLength(uint overlapMs) -{ - uint newOvl; - - overlapDividerBits = _getClosest2Power((sampleRate * overlapMs) / 1000.0); - if (overlapDividerBits > 9) overlapDividerBits = 9; - if (overlapDividerBits < 4) overlapDividerBits = 4; - newOvl = 1<> overlapDividerBits; - } - - return corr; -} - - -long TDStretch::calcCrossCorrStereo(const short *mixingPos, const short *compare) const -{ - long corr; - uint i; - - corr = 0; - for (i = 2; i < 2 * overlapLength; i += 2) - { - corr += (mixingPos[i] * compare[i] + - mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBits; - } - - return corr; -} - -#endif // INTEGER_SAMPLES - -////////////////////////////////////////////////////////////////////////////// -// -// Floating point arithmetics specific algorithm implementations. -// - -#ifdef FLOAT_SAMPLES - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceStereo() -{ - int i, cnt2; - float temp; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = (float)i * (float)(overlapLength - i); - cnt2 = i * 2; - pRefMidBuffer[cnt2] = (float)(pMidBuffer[cnt2] * temp); - pRefMidBuffer[cnt2 + 1] = (float)(pMidBuffer[cnt2 + 1] * temp); - } -} - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceMono() -{ - int i; - float temp; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = (float)i * (float)(overlapLength - i); - pRefMidBuffer[i] = (float)(pMidBuffer[i] * temp); - } -} - - -// SSE-optimized version of the function overlapStereo -void TDStretch::overlapStereo(float *output, const float *input) const -{ - int i; - uint cnt2; - float fTemp; - float fScale; - float fi; - - fScale = 1.0f / (float)overlapLength; - - for (i = 0; i < (int)overlapLength ; i ++) - { - fTemp = (float)(overlapLength - i) * fScale; - fi = (float)i * fScale; - cnt2 = 2 * i; - output[cnt2 + 0] = input[cnt2 + 0] * fi + pMidBuffer[cnt2 + 0] * fTemp; - output[cnt2 + 1] = input[cnt2 + 1] * fi + pMidBuffer[cnt2 + 1] * fTemp; - } -} - - -/// Calculates overlap period length in samples. -void TDStretch::calculateOverlapLength(uint overlapMs) -{ - uint newOvl; - - newOvl = (sampleRate * overlapMs) / 1000; - if (newOvl < 16) newOvl = 16; - - // must be divisible by 8 - newOvl -= newOvl % 8; - - acceptNewOverlapLength(newOvl); -} - - - -double TDStretch::calcCrossCorrMono(const float *mixingPos, const float *compare) const -{ - double corr; - uint i; - - corr = 0; - for (i = 1; i < overlapLength; i ++) - { - corr += mixingPos[i] * compare[i]; - } - - return corr; -} - - -double TDStretch::calcCrossCorrStereo(const float *mixingPos, const float *compare) const -{ - double corr; - uint i; - - corr = 0; - for (i = 2; i < 2 * overlapLength; i += 2) - { - corr += mixingPos[i] * compare[i] + - mixingPos[i + 1] * compare[i + 1]; - } - - return corr; -} - -#endif // FLOAT_SAMPLES diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.h deleted file mode 100644 index 133c227d49..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/TDStretch.h +++ /dev/null @@ -1,236 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method -/// with several performance-increasing tweaks. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: TDStretch.h,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef TDStretch_H -#define TDStretch_H - -#include "STTypes.h" -#include "RateTransposer.h" -#include "FIFOSamplePipe.h" - -namespace soundtouch -{ - -// Default values for sound processing parameters: - -/// Default length of a single processing sequence, in milliseconds. This determines to how -/// long sequences the original sound is chopped in the time-stretch algorithm. -/// -/// The larger this value is, the lesser sequences are used in processing. In principle -/// a bigger value sounds better when slowing down tempo, but worse when increasing tempo -/// and vice versa. -/// -/// Increasing this value reduces computational burden & vice versa. -#define DEFAULT_SEQUENCE_MS 61 - -#define DEFAULT_SEEKWINDOW_MS 18 - -#define DEFAULT_OVERLAP_MS 7 - - -/// Class that does the time-stretch (tempo change) effect for the processed -/// sound. -class TDStretch : public FIFOProcessor -{ -protected: - uint channels; - uint sampleReq; - float tempo; - - SAMPLETYPE *pMidBuffer; - SAMPLETYPE *pRefMidBuffer; - SAMPLETYPE *pRefMidBufferUnaligned; - uint overlapLength; - uint overlapDividerBits; - uint slopingDivider; - uint seekLength; - uint seekWindowLength; - uint maxOffset; - float nominalSkip; - float skipFract; - FIFOSampleBuffer outputBuffer; - FIFOSampleBuffer inputBuffer; - BOOL bQuickseek; - BOOL bMidBufferDirty; - - uint sampleRate; - uint sequenceMs; - uint seekWindowMs; - uint overlapMs; - - void acceptNewOverlapLength(uint newOverlapLength); - - virtual void clearCrossCorrState(); - void calculateOverlapLength(uint overlapMs); - - virtual LONG_SAMPLETYPE calcCrossCorrStereo(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const; - virtual LONG_SAMPLETYPE calcCrossCorrMono(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const; - - virtual uint seekBestOverlapPositionStereo(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionMono(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos); - uint seekBestOverlapPosition(const SAMPLETYPE *refPos); - - virtual void overlapStereo(SAMPLETYPE *output, const SAMPLETYPE *input) const; - virtual void overlapMono(SAMPLETYPE *output, const SAMPLETYPE *input) const; - - void clearMidBuffer(); - void overlap(SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const; - - void precalcCorrReferenceMono(); - void precalcCorrReferenceStereo(); - - void processNominalTempo(); - - /// Changes the tempo of the given sound samples. - /// Returns amount of samples returned in the "output" buffer. - /// The maximum amount of samples that can be returned at a time is set by - /// the 'set_returnBuffer_size' function. - void processSamples(); - -public: - TDStretch(); - virtual ~TDStretch(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we've a MMX/SSE/etc-capable CPU available or not. - void *operator new(size_t s); - - /// Use this function instead of "new" operator to create a new instance of this class. - /// This function automatically chooses a correct feature set depending on if the CPU - /// supports MMX/SSE/etc extensions. - static TDStretch *newInstance(); - - /// Returns the output buffer object - FIFOSamplePipe *getOutput() { return &outputBuffer; }; - - /// Returns the input buffer object - FIFOSamplePipe *getInput() { return &inputBuffer; }; - - /// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower - /// tempo, larger faster tempo. - void setTempo(float newTempo); - - /// Returns nonzero if there aren't any samples available for outputting. - virtual void clear(); - - /// Clears the input buffer - void clearInput(); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint numChannels); - - /// Enables/disables the quick position seeking algorithm. Zero to disable, - /// nonzero to enable - void enableQuickSeek(BOOL enable); - - /// Returns nonzero if the quick seeking algorithm is enabled. - BOOL isQuickSeekEnabled() const; - - /// Sets routine control parameters. These control are certain time constants - /// defining how the sound is stretched to the desired duration. - // - /// 'sampleRate' = sample rate of the sound - /// 'sequenceMS' = one processing sequence length in milliseconds - /// 'seekwindowMS' = seeking window length for scanning the best overlapping - /// position - /// 'overlapMS' = overlapping length - void setParameters(uint sampleRate, ///< Samplerate of sound being processed (Hz) - uint sequenceMS = DEFAULT_SEQUENCE_MS, ///< Single processing sequence length (ms) - uint seekwindowMS = DEFAULT_SEEKWINDOW_MS, ///< Offset seeking window length (ms) - uint overlapMS = DEFAULT_OVERLAP_MS ///< Sequence overlapping length (ms) - ); - - /// Get routine control parameters, see setParameters() function. - /// Any of the parameters to this function can be NULL, in such case corresponding parameter - /// value isn't returned. - void getParameters(uint *pSampleRate, uint *pSequenceMs, uint *pSeekWindowMs, uint *pOverlapMs); - - /// Adds 'numsamples' pcs of samples from the 'samples' memory position into - /// the input of the object. - virtual void putSamples( - const SAMPLETYPE *samples, ///< Input sample data - uint numSamples ///< Number of samples in 'samples' so that one sample - ///< contains both channels if stereo - ); -}; - - - -// Implementation-specific class declarations: - -//#ifdef ALLOW_MMX -// /// Class that implements MMX optimized routines for 16bit integer samples type. -// class TDStretchMMX : public TDStretch -// { -// protected: -// long calcCrossCorrStereo(const short *mixingPos, const short *compare) const; -// virtual void overlapStereo(short *output, const short *input) const; -// virtual void clearCrossCorrState(); -// }; -//#endif /// ALLOW_MMX -// -// -//#ifdef ALLOW_3DNOW -// /// Class that implements 3DNow! optimized routines for floating point samples type. -// class TDStretch3DNow : public TDStretch -// { -// protected: -// double calcCrossCorrStereo(const float *mixingPos, const float *compare) const; -// }; -//#endif /// ALLOW_3DNOW - - -#ifdef ALLOW_SSE - /// Class that implements SSE optimized routines for floating point samples type. - class TDStretchSSE : public TDStretch - { - protected: - double calcCrossCorrStereo(const float *mixingPos, const float *compare) const; - }; - -#endif /// ALLOW_SSE - -} -#endif /// TDStretch_H diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.cpp deleted file mode 100644 index 15a679871c..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.cpp +++ /dev/null @@ -1,714 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Classes for easy reading & writing of WAV sound files. -/// -/// For big-endian CPU, define _BIG_ENDIAN_ during compile-time to correctly -/// parse the WAV files with such processors. -/// -/// Admittingly, more complete WAV reader routines may exist in public domain, -/// but the reason for 'yet another' one is that those generic WAV reader -/// libraries are exhaustingly large and cumbersome! Wanted to have something -/// simpler here, i.e. something that's not already larger than rest of the -/// SoundTouch/SoundStretch program... -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.15 $ -// -// $Id: WavFile.cpp,v 1.15 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -#include -#include - -#include "WavFile.h" - -using namespace std; - -const static char riffStr[] = "RIFF"; -const static char waveStr[] = "WAVE"; -const static char fmtStr[] = "fmt "; -const static char dataStr[] = "data"; - - -////////////////////////////////////////////////////////////////////////////// -// -// Helper functions for swapping byte order to correctly read/write WAV files -// with big-endian CPU's: Define compile-time definition _BIG_ENDIAN_ to -// turn-on the conversion if it appears necessary. -// -// For example, Intel x86 is little-endian and doesn't require conversion, -// while PowerPC of Mac's and many other RISC cpu's are big-endian. - -#ifdef BYTE_ORDER - // In gcc compiler detect the byte order automatically - #if BYTE_ORDER == BIG_ENDIAN - // big-endian platform. - #define _BIG_ENDIAN_ - #endif -#endif - -#ifdef _BIG_ENDIAN_ - // big-endian CPU, swap bytes in 16 & 32 bit words - - // helper-function to swap byte-order of 32bit integer - static inline void _swap32(unsigned int &dwData) - { - dwData = ((dwData >> 24) & 0x000000FF) | - ((dwData >> 8) & 0x0000FF00) | - ((dwData << 8) & 0x00FF0000) | - ((dwData << 24) & 0xFF000000); - } - - // helper-function to swap byte-order of 16bit integer - static inline void _swap16(unsigned short &wData) - { - wData = ((wData >> 8) & 0x00FF) | - ((wData << 8) & 0xFF00); - } - - // helper-function to swap byte-order of buffer of 16bit integers - static inline void _swap16Buffer(unsigned short *pData, unsigned int dwNumWords) - { - unsigned long i; - - for (i = 0; i < dwNumWords; i ++) - { - _swap16(pData[i]); - } - } - -#else // BIG_ENDIAN - // little-endian CPU, WAV file is ok as such - - // dummy helper-function - static inline void _swap32(unsigned int &dwData) - { - // do nothing - } - - // dummy helper-function - static inline void _swap16(unsigned short &wData) - { - // do nothing - } - - // dummy helper-function - static inline void _swap16Buffer(unsigned short *pData, unsigned int dwNumBytes) - { - // do nothing - } - -#endif // BIG_ENDIAN - - -////////////////////////////////////////////////////////////////////////////// -// -// Class WavInFile -// - -WavInFile::WavInFile(const char *fileName) -{ - int hdrsOk; - - // Try to open the file for reading - fptr = fopen(fileName, "rb"); - if (fptr == NULL) - { - // didn't succeed - string msg = "Error : Unable to open file \""; - msg += fileName; - msg += "\" for reading."; - throw runtime_error(msg); - } - - // Read the file headers - hdrsOk = readWavHeaders(); - if (hdrsOk != 0) - { - // Something didn't match in the wav file headers - string msg = "File \""; - msg += fileName; - msg += "\" is corrupt or not a WAV file"; - throw runtime_error(msg); - } - - if (header.format.fixed != 1) - { - string msg = "File \""; - msg += fileName; - msg += "\" uses unsupported encoding."; - throw runtime_error(msg); - } - - dataRead = 0; -} - - - -WavInFile::~WavInFile() -{ - close(); -} - - - -void WavInFile::rewind() -{ - int hdrsOk; - - fseek(fptr, 0, SEEK_SET); - hdrsOk = readWavHeaders(); - assert(hdrsOk == 0); - dataRead = 0; -} - - -int WavInFile::checkCharTags() -{ - // header.format.fmt should equal to 'fmt ' - if (memcmp(fmtStr, header.format.fmt, 4) != 0) return -1; - // header.data.data_field should equal to 'data' - if (memcmp(dataStr, header.data.data_field, 4) != 0) return -1; - - return 0; -} - - -int WavInFile::read(char *buffer, int maxElems) -{ - int numBytes; - uint afterDataRead; - - // ensure it's 8 bit format - if (header.format.bits_per_sample != 8) - { - throw runtime_error("Error: WavInFile::read(char*, int) works only with 8bit samples."); - } - assert(sizeof(char) == 1); - - numBytes = maxElems; - afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) - { - // Don't read more samples than are marked available in header - numBytes = header.data.data_len - dataRead; - assert(numBytes >= 0); - } - - numBytes = fread(buffer, 1, numBytes, fptr); - dataRead += numBytes; - - return numBytes; -} - - -int WavInFile::read(short *buffer, int maxElems) -{ - unsigned int afterDataRead; - int numBytes; - int numElems; - - if (header.format.bits_per_sample == 8) - { - // 8 bit format - char *temp = new char[maxElems]; - int i; - - numElems = read(temp, maxElems); - // convert from 8 to 16 bit - for (i = 0; i < numElems; i ++) - { - buffer[i] = temp[i] << 8; - } - delete[] temp; - } - else - { - // 16 bit format - assert(header.format.bits_per_sample == 16); - assert(sizeof(short) == 2); - - numBytes = maxElems * 2; - afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) - { - // Don't read more samples than are marked available in header - numBytes = header.data.data_len - dataRead; - assert(numBytes >= 0); - } - - numBytes = fread(buffer, 1, numBytes, fptr); - dataRead += numBytes; - numElems = numBytes / 2; - - // 16bit samples, swap byte order if necessary - _swap16Buffer((unsigned short *)buffer, numElems); - } - - return numElems; -} - - - -int WavInFile::read(float *buffer, int maxElems) -{ - short *temp = new short[maxElems]; - int num; - int i; - double fscale; - - num = read(temp, maxElems); - - fscale = 1.0 / 32768.0; - // convert to floats, scale to range [-1..+1[ - for (i = 0; i < num; i ++) - { - buffer[i] = (float)(fscale * (double)temp[i]); - } - - delete[] temp; - - return num; -} - - -int WavInFile::eof() const -{ - // return true if all data has been read or file eof has reached - return (dataRead == header.data.data_len || feof(fptr)); -} - - -void WavInFile::close() -{ - fclose(fptr); - fptr = NULL; -} - - - -// test if character code is between a white space ' ' and little 'z' -static int isAlpha(char c) -{ - return (c >= ' ' && c <= 'z') ? 1 : 0; -} - - -// test if all characters are between a white space ' ' and little 'z' -static int isAlphaStr(char *str) -{ - int c; - - c = str[0]; - while (c) - { - if (isAlpha(c) == 0) return 0; - str ++; - c = str[0]; - } - - return 1; -} - - -int WavInFile::readRIFFBlock() -{ - fread(&(header.riff), sizeof(WavRiff), 1, fptr); - - // swap 32bit data byte order if necessary - _swap32((unsigned int &)header.riff.package_len); - - // header.riff.riff_char should equal to 'RIFF'); - if (memcmp(riffStr, header.riff.riff_char, 4) != 0) return -1; - // header.riff.wave should equal to 'WAVE' - if (memcmp(waveStr, header.riff.wave, 4) != 0) return -1; - - return 0; -} - - - - -int WavInFile::readHeaderBlock() -{ - char label[5]; - string sLabel; - - // lead label string - fread(label, 1, 4, fptr); - label[4] = 0; - - if (isAlphaStr(label) == 0) return -1; // not a valid label - - // Decode blocks according to their label - if (strcmp(label, fmtStr) == 0) - { - int nLen, nDump; - - // 'fmt ' block - memcpy(header.format.fmt, fmtStr, 4); - - // read length of the format field - fread(&nLen, sizeof(int), 1, fptr); - // swap byte order if necessary - _swap32((unsigned int &)nLen); // int format_len; - header.format.format_len = nLen; - - // calculate how much length differs from expected - nDump = nLen - (sizeof(header.format) - 8); - - // if format_len is larger than expected, read only as much data as we've space for - if (nDump > 0) - { - nLen = sizeof(header.format) - 8; - } - - // read data - fread(&(header.format.fixed), nLen, 1, fptr); - - // swap byte order if necessary - _swap16((unsigned short &)header.format.fixed); // short int fixed; - _swap16((unsigned short &)header.format.channel_number); // short int channel_number; - _swap32((unsigned int &)header.format.sample_rate); // int sample_rate; - _swap32((unsigned int &)header.format.byte_rate); // int byte_rate; - _swap16((unsigned short &)header.format.byte_per_sample); // short int byte_per_sample; - _swap16((unsigned short &)header.format.bits_per_sample); // short int bits_per_sample; - - // if format_len is larger than expected, skip the extra data - if (nDump > 0) - { - fseek(fptr, nDump, SEEK_CUR); - } - - return 0; - } - else if (strcmp(label, dataStr) == 0) - { - // 'data' block - memcpy(header.data.data_field, dataStr, 4); - fread(&(header.data.data_len), sizeof(uint), 1, fptr); - - // swap byte order if necessary - _swap32((unsigned int &)header.data.data_len); - - return 1; - } - else - { - uint len, i; - uint temp; - // unknown block - - // read length - fread(&len, sizeof(len), 1, fptr); - // scan through the block - for (i = 0; i < len; i ++) - { - fread(&temp, 1, 1, fptr); - if (feof(fptr)) return -1; // unexpected eof - } - } - return 0; -} - - -int WavInFile::readWavHeaders() -{ - int res; - - memset(&header, 0, sizeof(header)); - - res = readRIFFBlock(); - if (res) return 1; - // read header blocks until data block is found - do - { - // read header blocks - res = readHeaderBlock(); - if (res < 0) return 1; // error in file structure - } while (res == 0); - // check that all required tags are legal - return checkCharTags(); -} - - -uint WavInFile::getNumChannels() const -{ - return header.format.channel_number; -} - - -uint WavInFile::getNumBits() const -{ - return header.format.bits_per_sample; -} - - -uint WavInFile::getBytesPerSample() const -{ - return getNumChannels() * getNumBits() / 8; -} - - -uint WavInFile::getSampleRate() const -{ - return header.format.sample_rate; -} - - - -uint WavInFile::getDataSizeInBytes() const -{ - return header.data.data_len; -} - - -uint WavInFile::getNumSamples() const -{ - return header.data.data_len / header.format.byte_per_sample; -} - - -uint WavInFile::getLengthMS() const -{ - uint numSamples; - uint sampleRate; - - numSamples = getNumSamples(); - sampleRate = getSampleRate(); - - assert(numSamples < UINT_MAX / 1000); - return (1000 * numSamples / sampleRate); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// Class WavOutFile -// - -WavOutFile::WavOutFile(const char *fileName, int sampleRate, int bits, int channels) -{ - bytesWritten = 0; - fptr = fopen(fileName, "wb"); - if (fptr == NULL) - { - string msg = "Error : Unable to open file \""; - msg += fileName; - msg += "\" for writing."; - //pmsg = msg.c_str; - throw runtime_error(msg); - } - - fillInHeader(sampleRate, bits, channels); - writeHeader(); -} - - - -WavOutFile::~WavOutFile() -{ - close(); -} - - - -void WavOutFile::fillInHeader(uint sampleRate, uint bits, uint channels) -{ - // fill in the 'riff' part.. - - // copy string 'RIFF' to riff_char - memcpy(&(header.riff.riff_char), riffStr, 4); - // package_len unknown so far - header.riff.package_len = 0; - // copy string 'WAVE' to wave - memcpy(&(header.riff.wave), waveStr, 4); - - - // fill in the 'format' part.. - - // copy string 'fmt ' to fmt - memcpy(&(header.format.fmt), fmtStr, 4); - - header.format.format_len = 0x10; - header.format.fixed = 1; - header.format.channel_number = (short)channels; - header.format.sample_rate = sampleRate; - header.format.bits_per_sample = (short)bits; - header.format.byte_per_sample = (short)(bits * channels / 8); - header.format.byte_rate = header.format.byte_per_sample * sampleRate; - header.format.sample_rate = sampleRate; - - // fill in the 'data' part.. - - // copy string 'data' to data_field - memcpy(&(header.data.data_field), dataStr, 4); - // data_len unknown so far - header.data.data_len = 0; -} - - -void WavOutFile::finishHeader() -{ - // supplement the file length into the header structure - header.riff.package_len = bytesWritten + 36; - header.data.data_len = bytesWritten; - - writeHeader(); -} - - - -void WavOutFile::writeHeader() -{ - WavHeader hdrTemp; - - // swap byte order if necessary - hdrTemp = header; - _swap32((unsigned int &)hdrTemp.riff.package_len); - _swap32((unsigned int &)hdrTemp.format.format_len); - _swap16((unsigned short &)hdrTemp.format.fixed); - _swap16((unsigned short &)hdrTemp.format.channel_number); - _swap32((unsigned int &)hdrTemp.format.sample_rate); - _swap32((unsigned int &)hdrTemp.format.byte_rate); - _swap16((unsigned short &)hdrTemp.format.byte_per_sample); - _swap16((unsigned short &)hdrTemp.format.bits_per_sample); - _swap32((unsigned int &)hdrTemp.data.data_len); - - // write the supplemented header in the beginning of the file - fseek(fptr, 0, SEEK_SET); - fwrite(&hdrTemp, sizeof(hdrTemp), 1, fptr); - // jump back to the end of the file - fseek(fptr, 0, SEEK_END); -} - - - -void WavOutFile::close() -{ - finishHeader(); - fclose(fptr); - fptr = NULL; -} - - -void WavOutFile::write(const char *buffer, int numElems) -{ - int res; - - if (header.format.bits_per_sample != 8) - { - throw runtime_error("Error: WavOutFile::write(const char*, int) accepts only 8bit samples."); - } - assert(sizeof(char) == 1); - - res = fwrite(buffer, 1, numElems, fptr); - if (res != numElems) - { - throw runtime_error("Error while writing to a wav file."); - } - - bytesWritten += numElems; -} - - -void WavOutFile::write(const short *buffer, int numElems) -{ - int res; - - // 16 bit samples - if (numElems < 1) return; // nothing to do - - if (header.format.bits_per_sample == 8) - { - int i; - char *temp = new char[numElems]; - // convert from 16bit format to 8bit format - for (i = 0; i < numElems; i ++) - { - temp[i] = buffer[i] >> 8; - } - // write in 8bit format - write(temp, numElems); - delete[] temp; - } - else - { - // 16bit format - unsigned short *pTemp = new unsigned short[numElems]; - - assert(header.format.bits_per_sample == 16); - - // allocate temp buffer to swap byte order if necessary - memcpy(pTemp, buffer, numElems * 2); - _swap16Buffer(pTemp, numElems); - - res = fwrite(pTemp, 2, numElems, fptr); - - delete[] pTemp; - - if (res != numElems) - { - throw runtime_error("Error while writing to a wav file."); - } - bytesWritten += 2 * numElems; - } -} - - -void WavOutFile::write(const float *buffer, int numElems) -{ - int i; - short *temp = new short[numElems]; - int iTemp; - - // convert to 16 bit integer - for (i = 0; i < numElems; i ++) - { - // convert to integer - iTemp = (int)(32768.0f * buffer[i]); - - // saturate - if (iTemp < -32768) iTemp = -32768; - if (iTemp > 32767) iTemp = 32767; - temp[i] = (short)iTemp; - } - - write(temp, numElems); - - delete[] temp; -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.h deleted file mode 100644 index 331ef4d3e9..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/WavFile.h +++ /dev/null @@ -1,253 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Classes for easy reading & writing of WAV sound files. -/// -/// For big-endian CPU, define BIG_ENDIAN during compile-time to correctly -/// parse the WAV files with such processors. -/// -/// Admittingly, more complete WAV reader routines may exist in public domain, but -/// the reason for 'yet another' one is that those generic WAV reader libraries are -/// exhaustingly large and cumbersome! Wanted to have something simpler here, i.e. -/// something that's not already larger than rest of the SoundTouch/SoundStretch program... -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.7 $ -// -// $Id: WavFile.h,v 1.7 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef WAVFILE_H -#define WAVFILE_H - -#include - -#ifndef uint -typedef unsigned int uint; -#endif - - -/// WAV audio file 'riff' section header -typedef struct -{ - char riff_char[4]; - int package_len; - char wave[4]; -} WavRiff; - -/// WAV audio file 'format' section header -typedef struct -{ - char fmt[4]; - int format_len; - short fixed; - short channel_number; - int sample_rate; - int byte_rate; - short byte_per_sample; - short bits_per_sample; -} WavFormat; - -/// WAV audio file 'data' section header -typedef struct -{ - char data_field[4]; - uint data_len; -} WavData; - - -/// WAV audio file header -typedef struct -{ - WavRiff riff; - WavFormat format; - WavData data; -} WavHeader; - - -/// Class for reading WAV audio files. -class WavInFile -{ -private: - /// File pointer. - FILE *fptr; - - /// Counter of how many bytes of sample data have been read from the file. - uint dataRead; - - /// WAV header information - WavHeader header; - - /// Read WAV file headers. - /// \return zero if all ok, nonzero if file format is invalid. - int readWavHeaders(); - - /// Checks WAV file header tags. - /// \return zero if all ok, nonzero if file format is invalid. - int checkCharTags(); - - /// Reads a single WAV file header block. - /// \return zero if all ok, nonzero if file format is invalid. - int readHeaderBlock(); - - /// Reads WAV file 'riff' block - int readRIFFBlock(); - -public: - /// Constructor: Opens the given WAV file. If the file can't be opened, - /// throws 'runtime_error' exception. - WavInFile(const char *filename); - - /// Destructor: Closes the file. - ~WavInFile(); - - /// Close the file. Notice that file is automatically closed also when the - /// class instance is deleted. - void close(); - - /// Rewind to beginning of the file - void rewind(); - - /// Get sample rate. - uint getSampleRate() const; - - /// Get number of bits per sample, i.e. 8 or 16. - uint getNumBits() const; - - /// Get sample data size in bytes. Ahem, this should return same information as - /// 'getBytesPerSample'... - uint getDataSizeInBytes() const; - - /// Get total number of samples in file. - uint getNumSamples() const; - - /// Get number of bytes per audio sample (e.g. 16bit stereo = 4 bytes/sample) - uint getBytesPerSample() const; - - /// Get number of audio channels in the file (1=mono, 2=stereo) - uint getNumChannels() const; - - /// Get the audio file length in milliseconds - uint getLengthMS() const; - - /// Reads audio samples from the WAV file. This routine works only for 8 bit samples. - /// Reads given number of elements from the file or if end-of-file reached, as many - /// elements as are left in the file. - /// - /// \return Number of 8-bit integers read from the file. - int read(char *buffer, int maxElems); - - /// Reads audio samples from the WAV file to 16 bit integer format. Reads given number - /// of elements from the file or if end-of-file reached, as many elements as are - /// left in the file. - /// - /// \return Number of 16-bit integers read from the file. - int read(short *buffer, ///< Pointer to buffer where to read data. - int maxElems ///< Size of 'buffer' array (number of array elements). - ); - - /// Reads audio samples from the WAV file to floating point format, converting - /// sample values to range [-1,1[. Reads given number of elements from the file - /// or if end-of-file reached, as many elements as are left in the file. - /// - /// \return Number of elements read from the file. - int read(float *buffer, ///< Pointer to buffer where to read data. - int maxElems ///< Size of 'buffer' array (number of array elements). - ); - - /// Check end-of-file. - /// - /// \return Nonzero if end-of-file reached. - int eof() const; -}; - - - -/// Class for writing WAV audio files. -class WavOutFile -{ -private: - /// Pointer to the WAV file - FILE *fptr; - - /// WAV file header data. - WavHeader header; - - /// Counter of how many bytes have been written to the file so far. - int bytesWritten; - - /// Fills in WAV file header information. - void fillInHeader(const uint sampleRate, const uint bits, const uint channels); - - /// Finishes the WAV file header by supplementing information of amount of - /// data written to file etc - void finishHeader(); - - /// Writes the WAV file header. - void writeHeader(); - -public: - /// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception - /// if file creation fails. - WavOutFile(const char *fileName, ///< Filename - int sampleRate, ///< Sample rate (e.g. 44100 etc) - int bits, ///< Bits per sample (8 or 16 bits) - int channels ///< Number of channels (1=mono, 2=stereo) - ); - - /// Destructor: Finalizes & closes the WAV file. - ~WavOutFile(); - - /// Write data to WAV file. This function works only with 8bit samples. - /// Throws a 'runtime_error' exception if writing to file fails. - void write(const char *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Write data to WAV file. Throws a 'runtime_error' exception if writing to - /// file fails. - void write(const short *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Write data to WAV file in floating point format, saturating sample values to range - /// [-1..+1[. Throws a 'runtime_error' exception if writing to file fails. - void write(const float *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Finalize & close the WAV file. Automatically supplements the WAV file header - /// information according to written data etc. - /// - /// Notice that file is automatically closed also when the class instance is deleted. - void close(); -}; - -#endif diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect.h b/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect.h deleted file mode 100644 index 69892102c9..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect.h +++ /dev/null @@ -1,62 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A header file for detecting the Intel MMX instructions set extension. -/// -/// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the -/// routine implementations for x86 Windows, x86 gnu version and non-x86 -/// platforms, respectively. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.4 $ -// -// $Id: cpu_detect.h,v 1.4 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef _CPU_DETECT_H_ -#define _CPU_DETECT_H_ - -#include "STTypes.h" - -#define SUPPORT_MMX 0x0001 -#define SUPPORT_3DNOW 0x0002 -#define SUPPORT_ALTIVEC 0x0004 -#define SUPPORT_SSE 0x0008 -#define SUPPORT_SSE2 0x0010 - -/// Checks which instruction set extensions are supported by the CPU. -/// -/// \return A bitmask of supported extensions, see SUPPORT_... defines. -uint detectCPUextensions(void); - -/// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint wDisableMask); - -#endif // _CPU_DETECT_H_ diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp deleted file mode 100644 index 68423c3a0e..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp +++ /dev/null @@ -1,138 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// gcc version of the x86 CPU detect routine. -/// -/// This file is to be compiled on any platform with the GNU C compiler. -/// Compiler. Please see 'cpu_detect_x86_win.cpp' for the x86 Windows version -/// of this file. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.6 $ -// -// $Id: cpu_detect_x86_gcc.cpp,v 1.6 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "cpu_detect.h" - -#ifndef __GNUC__ -#error wrong platform - this source code file is for the GNU C compiler. -#endif - -using namespace std; - -#include -////////////////////////////////////////////////////////////////////////////// -// -// processor instructions extension detection routines -// -////////////////////////////////////////////////////////////////////////////// - - -// Flag variable indicating whick ISA extensions are disabled (for debugging) -static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions - -// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint dwDisableMask) -{ - _dwDisabledISA = dwDisableMask; -} - - - -/// Checks which instruction set extensions are supported by the CPU. -uint detectCPUextensions(void) -{ -#ifndef __i386__ - return 0; // always disable extensions on non-x86 platforms. -#else - uint res = 0; - - if (_dwDisabledISA == 0xffffffff) return 0; - - asm volatile( - "\n\txor %%esi, %%esi" // clear %%esi = result register - // check if 'cpuid' instructions is available by toggling eflags bit 21 - - "\n\tpushf" // save eflags to stack - "\n\tpop %%eax" // load eax from stack (with eflags) - "\n\tmovl %%eax, %%ecx" // save the original eflags values to ecx - "\n\txor $0x00200000, %%eax" // toggle bit 21 - "\n\tpush %%eax" // store toggled eflags to stack - "\n\tpopf" // load eflags from stack - "\n\tpushf" // save updated eflags to stack - "\n\tpop %%eax" // load from stack - "\n\txor %%edx, %%edx" // clear edx for defaulting no mmx - "\n\tcmp %%ecx, %%eax" // compare to original eflags values - "\n\tjz end" // jumps to 'end' if cpuid not present - - // cpuid instruction available, test for presence of mmx instructions - - "\n\tmovl $1, %%eax" - "\n\tcpuid" -// movl $0x00800000, %edx // force enable MMX - "\n\ttest $0x00800000, %%edx" - "\n\tjz end" // branch if MMX not available - - "\n\tor $0x01, %%esi" // otherwise add MMX support bit - - "\n\ttest $0x02000000, %%edx" - "\n\tjz test3DNow" // branch if SSE not available - - "\n\tor $0x08, %%esi" // otherwise add SSE support bit - - "\n\ttest3DNow:" - // test for precense of AMD extensions - "\n\tmov $0x80000000, %%eax" - "\n\tcpuid" - "\n\tcmp $0x80000000, %%eax" - "\n\tjbe end" // branch if no AMD extensions detected - - // test for precense of 3DNow! extension - "\n\tmov $0x80000001, %%eax" - "\n\tcpuid" - "\n\ttest $0x80000000, %%edx" - "\n\tjz end" // branch if 3DNow! not detected - - "\n\tor $0x02, %%esi" // otherwise add 3DNow support bit - - "\n\tend:" - - "\n\tmov %%esi, %0" - - : "=r" (res) - : /* no inputs */ - : "%edx", "%eax", "%ecx", "%esi" ); - - return res & ~_dwDisabledISA; -#endif -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_win.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_win.cpp deleted file mode 100644 index ee3acf69f7..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/cpu_detect_x86_win.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Win32 version of the x86 CPU detect routine. -/// -/// This file is to be compiled in Windows platform with Microsoft Visual C++ -/// Compiler. Please see 'cpu_detect_x86_gcc.cpp' for the gcc compiler version -/// for all GNU platforms. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: cpu_detect_x86_win.cpp,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" - -#ifndef _WIN32 -#error wrong platform - this source code file is exclusively for Win32 platform -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// processor instructions extension detection routines -// -////////////////////////////////////////////////////////////////////////////// - -// Flag variable indicating whick ISA extensions are disabled (for debugging) -static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions - - -// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint dwDisableMask) -{ - _dwDisabledISA = dwDisableMask; -} - - - -/// Checks which instruction set extensions are supported by the CPU. -uint detectCPUextensions(void) -{ - uint res = 0; - - if (_dwDisabledISA == 0xffffffff) return 0; - - _asm - { - ; check if 'cpuid' instructions is available by toggling eflags bit 21 - ; - xor esi, esi ; clear esi = result register - - pushfd ; save eflags to stack - pop eax ; load eax from stack (with eflags) - mov ecx, eax ; save the original eflags values to ecx - xor eax, 0x00200000 ; toggle bit 21 - push eax ; store toggled eflags to stack - popfd ; load eflags from stack - pushfd ; save updated eflags to stack - pop eax ; load from stack - xor edx, edx ; clear edx for defaulting no mmx - cmp eax, ecx ; compare to original eflags values - jz end ; jumps to 'end' if cpuid not present - - ; cpuid instruction available, test for presence of mmx instructions - mov eax, 1 - cpuid - test edx, 0x00800000 - jz end ; branch if MMX not available - - or esi, SUPPORT_MMX ; otherwise add MMX support bit - - test edx, 0x02000000 - jz test3DNow ; branch if SSE not available - - or esi, SUPPORT_SSE ; otherwise add SSE support bit - - test3DNow: - ; test for precense of AMD extensions - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000000 - jbe end ; branch if no AMD extensions detected - - ; test for precense of 3DNow! extension - mov eax, 0x80000001 - cpuid - test edx, 0x80000000 - jz end ; branch if 3DNow! not detected - - or esi, SUPPORT_3DNOW ; otherwise add 3DNow support bit - - end: - - mov res, esi - } - - return res & ~_dwDisabledISA; -} diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/mmx_optimized.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/mmx_optimized.cpp deleted file mode 100644 index b49584b694..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/mmx_optimized.cpp +++ /dev/null @@ -1,305 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// MMX optimized routines. All MMX optimized functions have been gathered into -/// this single source code file, regardless to their class or original source -/// code file, in order to ease porting the library to other compiler and -/// processor platforms. -/// -/// The MMX-optimizations are programmed using MMX compiler intrinsics that -/// are supported both by Microsoft Visual C++ and GCC compilers, so this file -/// should compile with both toolsets. -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support compiler intrinsic syntax. The update -/// is available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/06 18:52:43 $ -// File revision : $Revision: 1.1 $ -// -// $Id: mmx_optimized.cpp,v 1.1 2006/02/06 18:52:43 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "STTypes.h" - -#ifdef ALLOW_MMX -// MMX routines available only with integer sample type - -#if !(_WIN32 || __i386__ || __x86_64__) -#error "wrong platform - this source code file is exclusively for x86 platforms" -#endif - -using namespace soundtouch; - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of MMX optimized functions of class 'TDStretchMMX' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include -#include - - -// Calculates cross correlation of two buffers -long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const -{ - const __m64 *pVec1, *pVec2; - __m64 shifter; - __m64 accu; - long corr; - uint i; - - pVec1 = (__m64*)pV1; - pVec2 = (__m64*)pV2; - - shifter = _m_from_int(overlapDividerBits); - accu = _mm_setzero_si64(); - - // Process 4 parallel sets of 2 * stereo samples each during each - // round to improve CPU-level parallellization. - for (i = 0; i < overlapLength / 8; i ++) - { - __m64 temp; - - // dictionary of instructions: - // _m_pmaddwd : 4*16bit multiply-add, resulting two 32bits = [a0*b0+a1*b1 ; a2*b2+a3*b3] - // _mm_add_pi32 : 2*32bit add - // _m_psrad : 32bit right-shift - - temp = _mm_add_pi32(_mm_madd_pi16(pVec1[0], pVec2[0]), - _mm_madd_pi16(pVec1[1], pVec2[1])); - accu = _mm_add_pi32(accu, _mm_sra_pi32(temp, shifter)); - - temp = _mm_add_pi32(_mm_madd_pi16(pVec1[2], pVec2[2]), - _mm_madd_pi16(pVec1[3], pVec2[3])); - accu = _mm_add_pi32(accu, _mm_sra_pi32(temp, shifter)); - - pVec1 += 4; - pVec2 += 4; - } - - // copy hi-dword of mm0 to lo-dword of mm1, then sum mmo+mm1 - // and finally store the result into the variable "corr" - - accu = _mm_add_pi32(accu, _mm_srli_si64(accu, 32)); - corr = _m_to_int(accu); - - // Clear MMS state - _m_empty(); - - return corr; - // Note: Warning about the missing EMMS instruction is harmless - // as it'll be called elsewhere. -} - - - -void TDStretchMMX::clearCrossCorrState() -{ - // Clear MMS state - _m_empty(); - //_asm EMMS; -} - - - -// MMX-optimized version of the function overlapStereo -void TDStretchMMX::overlapStereo(short *output, const short *input) const -{ - const __m64 *pVinput, *pVMidBuf; - __m64 *pVdest; - __m64 mix1, mix2, adder, shifter; - uint i; - - pVinput = (const __m64*)input; - pVMidBuf = (const __m64*)pMidBuffer; - pVdest = (__m64*)output; - - // mix1 = mixer values for 1st stereo sample - // mix1 = mixer values for 2nd stereo sample - // adder = adder for updating mixer values after each round - - mix1 = _mm_set_pi16(0, overlapLength, 0, overlapLength); - adder = _mm_set_pi16(1, -1, 1, -1); - mix2 = _mm_add_pi16(mix1, adder); - adder = _mm_add_pi16(adder, adder); - - shifter = _m_from_int(overlapDividerBits); - - for (i = 0; i < overlapLength / 4; i ++) - { - __m64 temp1, temp2; - - // load & shuffle data so that input & mixbuffer data samples are paired - temp1 = _mm_unpacklo_pi16(pVMidBuf[0], pVinput[0]); // = i0l m0l i0r m0r - temp2 = _mm_unpackhi_pi16(pVMidBuf[0], pVinput[0]); // = i1l m1l i1r m1r - - // temp = (temp .* mix) >> shifter - temp1 = _mm_sra_pi32(_mm_madd_pi16(temp1, mix1), shifter); - temp2 = _mm_sra_pi32(_mm_madd_pi16(temp2, mix2), shifter); - pVdest[0] = _mm_packs_pi32(temp1, temp2); // pack 2*2*32bit => 4*16bit - - // update mix += adder - mix1 = _mm_add_pi16(mix1, adder); - mix2 = _mm_add_pi16(mix2, adder); - - // --- second round begins here --- - - // load & shuffle data so that input & mixbuffer data samples are paired - temp1 = _mm_unpacklo_pi16(pVMidBuf[1], pVinput[1]); // = i2l m2l i2r m2r - temp2 = _mm_unpackhi_pi16(pVMidBuf[1], pVinput[1]); // = i3l m3l i3r m3r - - // temp = (temp .* mix) >> shifter - temp1 = _mm_sra_pi32(_mm_madd_pi16(temp1, mix1), shifter); - temp2 = _mm_sra_pi32(_mm_madd_pi16(temp2, mix2), shifter); - pVdest[1] = _mm_packs_pi32(temp1, temp2); // pack 2*2*32bit => 4*16bit - - // update mix += adder - mix1 = _mm_add_pi16(mix1, adder); - mix2 = _mm_add_pi16(mix2, adder); - - pVinput += 2; - pVMidBuf += 2; - pVdest += 2; - } - - _m_empty(); // clear MMS state -} - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of MMX optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - - -FIRFilterMMX::FIRFilterMMX() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilterMMX::~FIRFilterMMX() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for MMX routine -void FIRFilterMMX::setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new short[2 * newLength + 8]; - filterCoeffsAlign = (short *)(((ulongptr)filterCoeffsUnalign + 15) & -16); - - // rearrange the filter coefficients for mmx routines - for (i = 0;i < length; i += 4) - { - filterCoeffsAlign[2 * i + 0] = coeffs[i + 0]; - filterCoeffsAlign[2 * i + 1] = coeffs[i + 2]; - filterCoeffsAlign[2 * i + 2] = coeffs[i + 0]; - filterCoeffsAlign[2 * i + 3] = coeffs[i + 2]; - - filterCoeffsAlign[2 * i + 4] = coeffs[i + 1]; - filterCoeffsAlign[2 * i + 5] = coeffs[i + 3]; - filterCoeffsAlign[2 * i + 6] = coeffs[i + 1]; - filterCoeffsAlign[2 * i + 7] = coeffs[i + 3]; - } -} - - - -// mmx-optimized version of the filter routine for stereo sound -uint FIRFilterMMX::evaluateFilterStereo(short *dest, const short *src, const uint numSamples) const -{ - // Create stack copies of the needed member variables for asm routines : - uint i, j; - __m64 *pVdest = (__m64*)dest; - - if (length < 2) return 0; - - for (i = 0; i < numSamples / 2; i ++) - { - __m64 accu1; - __m64 accu2; - const __m64 *pVsrc = (const __m64*)src; - const __m64 *pVfilter = (const __m64*)filterCoeffsAlign; - - accu1 = accu2 = _mm_setzero_si64(); - for (j = 0; j < lengthDiv8 * 2; j ++) - { - __m64 temp1, temp2; - - temp1 = _mm_unpacklo_pi16(pVsrc[0], pVsrc[1]); // = l2 l0 r2 r0 - temp2 = _mm_unpackhi_pi16(pVsrc[0], pVsrc[1]); // = l3 l1 r3 r1 - - accu1 = _mm_add_pi32(accu1, _mm_madd_pi16(temp1, pVfilter[0])); // += l2*f2+l0*f0 r2*f2+r0*f0 - accu1 = _mm_add_pi32(accu1, _mm_madd_pi16(temp2, pVfilter[1])); // += l3*f3+l1*f1 r3*f3+r1*f1 - - temp1 = _mm_unpacklo_pi16(pVsrc[1], pVsrc[2]); // = l4 l2 r4 r2 - - accu2 = _mm_add_pi32(accu2, _mm_madd_pi16(temp2, pVfilter[0])); // += l3*f2+l1*f0 r3*f2+r1*f0 - accu2 = _mm_add_pi32(accu2, _mm_madd_pi16(temp1, pVfilter[1])); // += l4*f3+l2*f1 r4*f3+r2*f1 - - // accu1 += l2*f2+l0*f0 r2*f2+r0*f0 - // += l3*f3+l1*f1 r3*f3+r1*f1 - - // accu2 += l3*f2+l1*f0 r3*f2+r1*f0 - // l4*f3+l2*f1 r4*f3+r2*f1 - - pVfilter += 2; - pVsrc += 2; - } - // accu >>= resultDivFactor - accu1 = _mm_srai_pi32(accu1, resultDivFactor); - accu2 = _mm_srai_pi32(accu2, resultDivFactor); - - // pack 2*2*32bits => 4*16 bits - pVdest[0] = _mm_packs_pi32(accu1, accu2); - src += 4; - pVdest ++; - } - - _m_empty(); // clear emms state - - return (numSamples & 0xfffffffe) - length; -} - -#endif // ALLOW_MMX diff --git a/plugins/spu2ghz/src/3rdparty/SoundTouch/sse_optimized.cpp b/plugins/spu2ghz/src/3rdparty/SoundTouch/sse_optimized.cpp deleted file mode 100644 index 1e70da6608..0000000000 --- a/plugins/spu2ghz/src/3rdparty/SoundTouch/sse_optimized.cpp +++ /dev/null @@ -1,484 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// SSE optimized routines for Pentium-III, Athlon-XP and later CPUs. All SSE -/// optimized functions have been gathered into this single source -/// code file, regardless to their class or original source code file, in order -/// to ease porting the library to other compiler and processor platforms. -/// -/// The SSE-optimizations are programmed using SSE compiler intrinsics that -/// are supported both by Microsoft Visual C++ and GCC compilers, so this file -/// should compile with both toolsets. -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support SSE instruction set. The update is -/// available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and -/// perform a search with keywords "processor pack". -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.2 $ -// -// $Id: sse_optimized.cpp,v 1.2 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" -#include "STTypes.h" - -using namespace soundtouch; - -#ifdef ALLOW_SSE - -// SSE routines available only with float sample type - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of SSE optimized functions of class 'TDStretchSSE' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include - -// Calculates cross correlation of two buffers -double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) const -{ - uint i; - __m128 vSum, *pVec2; - - // Note. It means a major slow-down if the routine needs to tolerate - // unaligned __m128 memory accesses. It's way faster if we can skip - // unaligned slots and use _mm_load_ps instruction instead of _mm_loadu_ps. - // This can mean up to ~ 10-fold difference (incl. part of which is - // due to skipping every second round for stereo sound though). - // - // Compile-time define ALLOW_NONEXACT_SIMD_OPTIMIZATION is provided - // for choosing if this little cheating is allowed. - -#ifdef ALLOW_NONEXACT_SIMD_OPTIMIZATION - // Little cheating allowed, return valid correlation only for - // aligned locations, meaning every second round for stereo sound. - - #define _MM_LOAD _mm_load_ps - - if (((ulong)pV1) & 15) return -1e50; // skip unaligned locations - -#else - // No cheating allowed, use unaligned load & take the resulting - // performance hit. - #define _MM_LOAD _mm_loadu_ps -#endif - - // ensure overlapLength is divisible by 8 - assert((overlapLength % 8) == 0); - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - // Note: pV2 _must_ be aligned to 16-bit boundary, pV1 need not. - pVec2 = (__m128*)pV2; - vSum = _mm_setzero_ps(); - - // Unroll the loop by factor of 4 * 4 operations - for (i = 0; i < overlapLength / 8; i ++) - { - // vSum += pV1[0..3] * pV2[0..3] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1),pVec2[0])); - - // vSum += pV1[4..7] * pV2[4..7] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 4), pVec2[1])); - - // vSum += pV1[8..11] * pV2[8..11] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 8), pVec2[2])); - - // vSum += pV1[12..15] * pV2[12..15] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 12), pVec2[3])); - - pV1 += 16; - pVec2 += 4; - } - - // return value = vSum[0] + vSum[1] + vSum[2] + vSum[3] - float *pvSum = (float*)&vSum; - return (double)(pvSum[0] + pvSum[1] + pvSum[2] + pvSum[3]); - - /* This is approximately corresponding routine in C-language: - double corr; - uint i; - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - corr = 0.0; - for (i = 0; i < overlapLength / 8; i ++) - { - corr += pV1[0] * pV2[0] + - pV1[1] * pV2[1] + - pV1[2] * pV2[2] + - pV1[3] * pV2[3] + - pV1[4] * pV2[4] + - pV1[5] * pV2[5] + - pV1[6] * pV2[6] + - pV1[7] * pV2[7] + - pV1[8] * pV2[8] + - pV1[9] * pV2[9] + - pV1[10] * pV2[10] + - pV1[11] * pV2[11] + - pV1[12] * pV2[12] + - pV1[13] * pV2[13] + - pV1[14] * pV2[14] + - pV1[15] * pV2[15]; - - pV1 += 16; - pV2 += 16; - } - */ - - /* This is corresponding routine in assembler. This may be teeny-weeny bit faster - than intrinsic version, but more difficult to maintain & get compiled on multiple - platforms. - - uint overlapLengthLocal = overlapLength; - float corr; - - _asm - { - // Very important note: data in 'pV2' _must_ be aligned to - // 16-byte boundary! - - // give prefetch hints to CPU of what data are to be needed soonish - // give more aggressive hints on pV1 as that changes while pV2 stays - // same between runs - prefetcht0 [pV1] - prefetcht0 [pV2] - prefetcht0 [pV1 + 32] - - mov eax, dword ptr pV1 - mov ebx, dword ptr pV2 - - xorps xmm0, xmm0 - - mov ecx, overlapLengthLocal - shr ecx, 3 // div by eight - - loop1: - prefetcht0 [eax + 64] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [ebx + 32] // give a prefetch hint to CPU what data are to be needed soonish - movups xmm1, [eax] - mulps xmm1, [ebx] - addps xmm0, xmm1 - - movups xmm2, [eax + 16] - mulps xmm2, [ebx + 16] - addps xmm0, xmm2 - - prefetcht0 [eax + 96] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [ebx + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm3, [eax + 32] - mulps xmm3, [ebx + 32] - addps xmm0, xmm3 - - movups xmm4, [eax + 48] - mulps xmm4, [ebx + 48] - addps xmm0, xmm4 - - add eax, 64 - add ebx, 64 - - dec ecx - jnz loop1 - - // add the four floats of xmm0 together and return the result. - - movhlps xmm1, xmm0 // move 3 & 4 of xmm0 to 1 & 2 of xmm1 - addps xmm1, xmm0 - movaps xmm2, xmm1 - shufps xmm2, xmm2, 0x01 // move 2 of xmm2 as 1 of xmm2 - addss xmm2, xmm1 - movss corr, xmm2 - } - - return (double)corr; - */ -} - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of SSE optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - -FIRFilterSSE::FIRFilterSSE() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilterSSE::~FIRFilterSSE() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for SSE routine -void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - float fDivider; - - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Scale the filter coefficients so that it won't be necessary to scale the filtering result - // also rearrange coefficients suitably for 3DNow! - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new float[2 * newLength + 4]; - filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15) & -16); - - fDivider = (float)resultDivider; - - // rearrange the filter coefficients for mmx routines - for (i = 0; i < newLength; i ++) - { - filterCoeffsAlign[2 * i + 0] = - filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider; - } -} - - - -// SSE-optimized version of the filter routine for stereo sound -uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint numSamples) const -{ - int count = (numSamples - length) & -2; - int j; - - assert(count % 2 == 0); - - if (count < 2) return 0; - - assert((length % 8) == 0); - assert(((unsigned long)filterCoeffsAlign) % 16 == 0); - - // filter is evaluated for two stereo samples with each iteration, thus use of 'j += 2' - for (j = 0; j < count; j += 2) - { - const float *pSrc; - const __m128 *pFil; - __m128 sum1, sum2; - uint i; - - pSrc = source; // source audio data - pFil = (__m128*)filterCoeffsAlign; // filter coefficients. NOTE: Assumes coefficients - // are aligned to 16-byte boundary - sum1 = sum2 = _mm_setzero_ps(); - - for (i = 0; i < length / 8; i ++) - { - // Unroll loop for efficiency & calculate filter for 2*2 stereo samples - // at each pass - - // sum1 is accu for 2*2 filtered stereo sound data at the primary sound data offset - // sum2 is accu for 2*2 filtered stereo sound data for the next sound sample offset. - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc) , pFil[0])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 2), pFil[0])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 4), pFil[1])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 6), pFil[1])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 8) , pFil[2])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 10), pFil[2])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 12), pFil[3])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 14), pFil[3])); - - pSrc += 16; - pFil += 4; - } - - // Now sum1 and sum2 both have a filtered 2-channel sample each, but we still need - // to sum the two hi- and lo-floats of these registers together. - - // post-shuffle & add the filtered values and store to dest. - _mm_storeu_ps(dest, _mm_add_ps( - _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(1,0,3,2)), // s2_1 s2_0 s1_3 s1_2 - _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(3,2,1,0)) // s2_3 s2_2 s1_1 s1_0 - )); - source += 4; - dest += 4; - } - - // Ideas for further improvement: - // 1. If it could be guaranteed that 'source' were always aligned to 16-byte - // boundary, a faster aligned '_mm_load_ps' instruction could be used. - // 2. If it could be guaranteed that 'dest' were always aligned to 16-byte - // boundary, a faster '_mm_store_ps' instruction could be used. - - return (uint)count; - - /* original routine in C-language. please notice the C-version has differently - organized coefficients though. - double suml1, suml2; - double sumr1, sumr2; - uint i, j; - - for (j = 0; j < count; j += 2) - { - const float *ptr; - const float *pFil; - - suml1 = sumr1 = 0.0; - suml2 = sumr2 = 0.0; - ptr = src; - pFil = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) - { - // unroll loop for efficiency. - - suml1 += ptr[0] * pFil[0] + - ptr[2] * pFil[2] + - ptr[4] * pFil[4] + - ptr[6] * pFil[6]; - - sumr1 += ptr[1] * pFil[1] + - ptr[3] * pFil[3] + - ptr[5] * pFil[5] + - ptr[7] * pFil[7]; - - suml2 += ptr[8] * pFil[0] + - ptr[10] * pFil[2] + - ptr[12] * pFil[4] + - ptr[14] * pFil[6]; - - sumr2 += ptr[9] * pFil[1] + - ptr[11] * pFil[3] + - ptr[13] * pFil[5] + - ptr[15] * pFil[7]; - - ptr += 16; - pFil += 8; - } - dest[0] = (float)suml1; - dest[1] = (float)sumr1; - dest[2] = (float)suml2; - dest[3] = (float)sumr2; - - src += 4; - dest += 4; - } - */ - - - /* Similar routine in assembly, again obsoleted due to maintainability - _asm - { - // Very important note: data in 'src' _must_ be aligned to - // 16-byte boundary! - mov edx, count - mov ebx, dword ptr src - mov eax, dword ptr dest - shr edx, 1 - - loop1: - // "outer loop" : during each round 2*2 output samples are calculated - - // give prefetch hints to CPU of what data are to be needed soonish - prefetcht0 [ebx] - prefetcht0 [filterCoeffsLocal] - - mov esi, ebx - mov edi, filterCoeffsLocal - xorps xmm0, xmm0 - xorps xmm1, xmm1 - mov ecx, lengthLocal - - loop2: - // "inner loop" : during each round eight FIR filter taps are evaluated for 2*2 samples - prefetcht0 [esi + 32] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [edi + 32] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm2, [esi] // possibly unaligned load - movups xmm3, [esi + 8] // possibly unaligned load - mulps xmm2, [edi] - mulps xmm3, [edi] - addps xmm0, xmm2 - addps xmm1, xmm3 - - movups xmm4, [esi + 16] // possibly unaligned load - movups xmm5, [esi + 24] // possibly unaligned load - mulps xmm4, [edi + 16] - mulps xmm5, [edi + 16] - addps xmm0, xmm4 - addps xmm1, xmm5 - - prefetcht0 [esi + 64] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [edi + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm6, [esi + 32] // possibly unaligned load - movups xmm7, [esi + 40] // possibly unaligned load - mulps xmm6, [edi + 32] - mulps xmm7, [edi + 32] - addps xmm0, xmm6 - addps xmm1, xmm7 - - movups xmm4, [esi + 48] // possibly unaligned load - movups xmm5, [esi + 56] // possibly unaligned load - mulps xmm4, [edi + 48] - mulps xmm5, [edi + 48] - addps xmm0, xmm4 - addps xmm1, xmm5 - - add esi, 64 - add edi, 64 - dec ecx - jnz loop2 - - // Now xmm0 and xmm1 both have a filtered 2-channel sample each, but we still need - // to sum the two hi- and lo-floats of these registers together. - - movhlps xmm2, xmm0 // xmm2 = xmm2_3 xmm2_2 xmm0_3 xmm0_2 - movlhps xmm2, xmm1 // xmm2 = xmm1_1 xmm1_0 xmm0_3 xmm0_2 - shufps xmm0, xmm1, 0xe4 // xmm0 = xmm1_3 xmm1_2 xmm0_1 xmm0_0 - addps xmm0, xmm2 - - movaps [eax], xmm0 - add ebx, 16 - add eax, 16 - - dec edx - jnz loop1 - } - */ -} - -#endif // ALLOW_SSE diff --git a/plugins/spu2ghz/src/3rdparty/liba52/a52.h b/plugins/spu2ghz/src/3rdparty/liba52/a52.h deleted file mode 100644 index 9db52ccf83..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/a52.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * a52.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef A52_H -#define A52_H - -#ifndef LIBA52_DOUBLE -typedef float sample_t; -#else -typedef double sample_t; -#endif - -typedef struct a52_state_s a52_state_t; - -#define A52_CHANNEL 0 -#define A52_MONO 1 -#define A52_STEREO 2 -#define A52_3F 3 -#define A52_2F1R 4 -#define A52_3F1R 5 -#define A52_2F2R 6 -#define A52_3F2R 7 -#define A52_CHANNEL1 8 -#define A52_CHANNEL2 9 -#define A52_DOLBY 10 -#define A52_CHANNEL_MASK 15 - -#define A52_LFE 16 -#define A52_ADJUST_LEVEL 32 - -a52_state_t * a52_init (uint32_t mm_accel); -sample_t * a52_samples (a52_state_t * state); -int a52_syncinfo (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate); -int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, - sample_t * level, sample_t bias); -void a52_dynrng (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data); -int a52_block (a52_state_t * state); -void a52_free (a52_state_t * state); - -#endif /* A52_H */ diff --git a/plugins/spu2ghz/src/3rdparty/liba52/a52_internal.h b/plugins/spu2ghz/src/3rdparty/liba52/a52_internal.h deleted file mode 100644 index 834df47a9c..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/a52_internal.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * a52_internal.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -typedef struct { - uint8_t bai; /* fine SNR offset, fast gain */ - uint8_t deltbae; /* delta bit allocation exists */ - int8_t deltba[50]; /* per-band delta bit allocation */ -} ba_t; - -typedef struct { - uint8_t exp[256]; /* decoded channel exponents */ - int8_t bap[256]; /* derived channel bit allocation */ -} expbap_t; - -struct a52_state_s { - uint8_t fscod; /* sample rate */ - uint8_t halfrate; /* halfrate factor */ - uint8_t acmod; /* coded channels */ - uint8_t lfeon; /* coded lfe channel */ - sample_t clev; /* centre channel mix level */ - sample_t slev; /* surround channels mix level */ - - int output; /* type of output */ - sample_t level; /* output level */ - sample_t bias; /* output bias */ - - int dynrnge; /* apply dynamic range */ - sample_t dynrng; /* dynamic range */ - void * dynrngdata; /* dynamic range callback funtion and data */ - sample_t (* dynrngcall) (sample_t range, void * dynrngdata); - - uint8_t chincpl; /* channel coupled */ - uint8_t phsflginu; /* phase flags in use (stereo only) */ - uint8_t cplstrtmant; /* coupling channel start mantissa */ - uint8_t cplendmant; /* coupling channel end mantissa */ - uint32_t cplbndstrc; /* coupling band structure */ - sample_t cplco[5][18]; /* coupling coordinates */ - - /* derived information */ - uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */ - uint8_t ncplbnd; /* number of coupling bands */ - - uint8_t rematflg; /* stereo rematrixing */ - - uint8_t endmant[5]; /* channel end mantissa */ - - uint16_t bai; /* bit allocation information */ - - uint32_t * buffer_start; - uint16_t lfsr_state; /* dither state */ - uint32_t bits_left; - uint32_t current_word; - - uint8_t csnroffst; /* coarse SNR offset */ - ba_t cplba; /* coupling bit allocation parameters */ - ba_t ba[5]; /* channel bit allocation parameters */ - ba_t lfeba; /* lfe bit allocation parameters */ - - uint8_t cplfleak; /* coupling fast leak init */ - uint8_t cplsleak; /* coupling slow leak init */ - - expbap_t cpl_expbap; - expbap_t fbw_expbap[5]; - expbap_t lfe_expbap; - - sample_t * samples; - int downmixed; -}; - -// [Air]: Added sample_t casts here. -// Improves SSE2 optimization efficiency under Visual Studio 2008 - -#define LEVEL_PLUS6DB ((sample_t)2.0) -#define LEVEL_PLUS3DB ((sample_t)1.4142135623730951) -#define LEVEL_3DB ((sample_t)0.7071067811865476) -#define LEVEL_45DB ((sample_t)0.5946035575013605) -#define LEVEL_6DB ((sample_t)0.5) - -#define EXP_REUSE (0) -#define EXP_D15 (1) -#define EXP_D25 (2) -#define EXP_D45 (3) - -#define DELTA_BIT_REUSE (0) -#define DELTA_BIT_NEW (1) -#define DELTA_BIT_NONE (2) -#define DELTA_BIT_RESERVED (3) - -void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap); - -int a52_downmix_init (int input, int flags, sample_t * level, - sample_t clev, sample_t slev); -int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level, - sample_t clev, sample_t slev); -void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev); -void a52_upmix (sample_t * samples, int acmod, int output); - -void a52_imdct_init (uint32_t mm_accel); -void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias); -void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias); diff --git a/plugins/spu2ghz/src/3rdparty/liba52/attributes.h b/plugins/spu2ghz/src/3rdparty/liba52/attributes.h deleted file mode 100644 index 598f43ded5..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/attributes.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * attributes.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* use gcc attribs to align critical data structures */ -#ifdef ATTRIBUTE_ALIGNED_MAX -#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) -#else -#define ATTR_ALIGN(align) -#endif diff --git a/plugins/spu2ghz/src/3rdparty/liba52/bit_allocate.c b/plugins/spu2ghz/src/3rdparty/liba52/bit_allocate.c deleted file mode 100644 index 954f998cfb..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/bit_allocate.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * bit_allocate.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include "inttypes.h" - -#include "a52.h" -#include "a52_internal.h" - -static int hthtab[3][50] = { - {0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860, - 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890, - 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, - 0x910, 0x910, 0x910, 0x910, 0x900, 0x8f0, 0x8c0, 0x870, 0x820, 0x7e0, - 0x7a0, 0x770, 0x760, 0x7a0, 0x7c0, 0x7c0, 0x6e0, 0x400, 0x3c0, 0x3c0}, - {0x710, 0x710, 0x7a0, 0x7f0, 0x820, 0x830, 0x840, 0x850, 0x850, 0x860, - 0x860, 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, - 0x890, 0x890, 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8e0, 0x8f0, - 0x900, 0x910, 0x910, 0x910, 0x910, 0x900, 0x8e0, 0x8b0, 0x870, 0x820, - 0x7e0, 0x7b0, 0x760, 0x770, 0x7a0, 0x7c0, 0x780, 0x5d0, 0x3c0, 0x3c0}, - {0x680, 0x680, 0x750, 0x7b0, 0x7e0, 0x810, 0x820, 0x830, 0x840, 0x850, - 0x850, 0x850, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, - 0x870, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, 0x890, 0x8a0, 0x8b0, - 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x910, 0x910, 0x900, 0x8f0, - 0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720} -}; - -static int8_t baptab[305] = { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 93 padding elems */ - - 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 14, 14, 14, 14, - 14, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, - 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, - 5, 4, 4, -3, -3, 3, 3, 3, -2, -2, -1, -1, -1, -1, -1, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 /* 148 padding elems */ -}; - -static int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34, - 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, - 85, 97, 109, 121, 133, 157, 181, 205, 229, 253}; - -static int8_t latab[256] = { - -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, - -52, -52, -51, -50, -49, -48, -47, -47, -46, -45, -44, -44, - -43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35, - -35, -34, -33, -33, -32, -32, -31, -30, -30, -29, -29, -28, - -28, -27, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22, - -22, -21, -21, -21, -20, -20, -19, -19, -19, -18, -18, -18, - -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14, - -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11, - -10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -8, -8, - -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -6, -6, - -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, - -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, - -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, - -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -#define UPDATE_LEAK() \ -do { \ - fastleak += fdecay; \ - if (fastleak > psd + fgain) \ - fastleak = psd + fgain; \ - slowleak += sdecay; \ - if (slowleak > psd + sgain) \ - slowleak = psd + sgain; \ -} while (0) - -#define COMPUTE_MASK() \ -do { \ - if (psd > dbknee) \ - mask -= (psd - dbknee) >> 2; \ - if (mask > hth [i >> halfrate]) \ - mask = hth [i >> halfrate]; \ - mask -= snroffset + 128 * deltba[i]; \ - mask = (mask > 0) ? 0 : ((-mask) >> 5); \ - mask -= floor; \ -} while (0) - -void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart, - int start, int end, int fastleak, int slowleak, - expbap_t * expbap) -{ - static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410}; - static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100}; - static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0, - 0xa10, 0xa90, 0xb10, 0x1400}; - - int i, j; - uint8_t * exp; - int8_t * bap; - int fdecay, fgain, sdecay, sgain, dbknee, floor, snroffset; - int psd, mask; - int8_t * deltba; - int * hth; - int halfrate; - - halfrate = state->halfrate; - fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */ - fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */ - sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */ - sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */ - dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */ - hth = hthtab[state->fscod]; - /* - * if there is no delta bit allocation, make deltba point to an area - * known to contain zeroes. baptab+156 here. - */ - deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba; - floor = floortab[state->bai & 7]; /* floorcod */ - snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor; - floor >>= 5; - - exp = expbap->exp; - bap = expbap->bap; - - i = bndstart; - j = start; - if (start == 0) { /* not the coupling channel */ - int lowcomp; - - lowcomp = 0; - j = end - 1; - do { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - mask = psd + fgain + lowcomp; - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1]))); - fastleak = psd + fgain; - slowleak = psd + sgain; - - while (i < 7) { - if (i < j) { - if (exp[i+1] == exp[i] - 2) - lowcomp = 384; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - } - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } - - if (end == 7) /* lfe channel */ - return; - - do { - if (exp[i+1] == exp[i] - 2) - lowcomp = 320; - else if (lowcomp && (exp[i+1] > exp[i])) - lowcomp -= 64; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } while (i < 20); - - while (lowcomp > 128) { /* two iterations maximum */ - lowcomp -= 128; - psd = 128 * exp[i]; - UPDATE_LEAK (); - mask = ((fastleak + lowcomp < slowleak) ? - fastleak + lowcomp : slowleak); - COMPUTE_MASK (); - bap[i] = (baptab+156)[mask + 4 * exp[i]]; - i++; - } - j = i; - } - - do { - int startband, endband; - - startband = j; - endband = ((bndtab-20)[i] < end) ? (bndtab-20)[i] : end; - psd = 128 * exp[j++]; - while (j < endband) { - int next, delta; - - next = 128 * exp[j++]; - delta = next - psd; - switch (delta >> 9) { - case -6: case -5: case -4: case -3: case -2: - psd = next; - break; - case -1: - psd = next + latab[(-delta) >> 1]; - break; - case 0: - psd += latab[delta >> 1]; - break; - } - } - /* minpsd = -289 */ - UPDATE_LEAK (); - mask = (fastleak < slowleak) ? fastleak : slowleak; - COMPUTE_MASK (); - i++; - j = startband; - do { - /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */ - /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */ - bap[j] = (baptab+156)[mask + 4 * exp[j]]; - } while (++j < endband); - } while (j < end); -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/bitstream.c b/plugins/spu2ghz/src/3rdparty/liba52/bitstream.c deleted file mode 100644 index 013d8e0afc..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/bitstream.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * bitstream.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include "inttypes.h" - -#include "a52.h" -#include "a52_internal.h" -#include "bitstream.h" - -#define BUFFER_SIZE 4096 - -void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf) -{ - int align; - - align = (long)buf & 3; - state->buffer_start = (uint32_t *) (buf - align); - state->bits_left = 0; - bitstream_get (state, align * 8); -} - -static inline void bitstream_fill_current (a52_state_t * state) -{ - uint32_t tmp; - - tmp = *(state->buffer_start++); - state->current_word = swab32 (tmp); -} - -/* - * The fast paths for _get is in the - * bitstream.h header file so it can be inlined. - * - * The "bottom half" of this routine is suffixed _bh - * - * -ah - */ - -uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits) -{ - uint32_t result; - - num_bits -= state->bits_left; - result = ((state->current_word << (32 - state->bits_left)) >> - (32 - state->bits_left)); - - bitstream_fill_current (state); - - if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - - state->bits_left = 32 - num_bits; - - return result; -} - -int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits) -{ - int32_t result; - - num_bits -= state->bits_left; - result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >> - (32 - state->bits_left)); - - bitstream_fill_current(state); - - if (num_bits != 0) - result = (result << num_bits) | (state->current_word >> (32 - num_bits)); - - state->bits_left = 32 - num_bits; - - return result; -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/bitstream.h b/plugins/spu2ghz/src/3rdparty/liba52/bitstream.h deleted file mode 100644 index 7d7ea7679f..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/bitstream.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * bitstream.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* (stolen from the kernel) */ -#ifdef WORDS_BIGENDIAN - -# define swab32(x) (x) - -#else - -# if 0 && defined (__i386__) - -# define swab32(x) __i386_swab32(x) - static inline const uint32_t __i386_swab32(uint32_t x) - { - __asm__("bswap %0" : "=r" (x) : "0" (x)); - return x; - } - -# else - -# define swab32(x)\ -((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | \ - (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3])) - -# endif -#endif - -void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf); -uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits); -int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits); - -static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits) -{ - uint32_t result; - - if (num_bits < state->bits_left) { - result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; - } - - return a52_bitstream_get_bh (state, num_bits); -} - -static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits) -{ - int32_t result; - - if (num_bits < state->bits_left) { - result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits); - state->bits_left -= num_bits; - return result; - } - - return a52_bitstream_get_bh_2 (state, num_bits); -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/config.h b/plugins/spu2ghz/src/3rdparty/liba52/config.h deleted file mode 100644 index b1b20fe3ca..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/config.h +++ /dev/null @@ -1,124 +0,0 @@ -/* vc++/config.h - manually adapted from include/config.h.in */ - -/* maximum supported data alignment */ -/* #undef ATTRIBUTE_ALIGNED_MAX */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the `ftime' function. */ -#define HAVE_FTIME 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -/* #undef HAVE_GETTIMEOFDAY */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_IO_H 1 - -/* Define to 1 if you have the `memalign' function. */ -/* #undef HAVE_MEMALIGN */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TIME_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_UNISTD_H */ - -/* liba52 djbfft support */ -/* #undef LIBA52_DJBFFT */ - -/* a52 sample precision */ -/* #undef LIBA52_DOUBLE */ - -/* libao al support */ -/* #undef LIBAO_AL */ - -/* libao OSS support */ -/* #undef LIBAO_OSS */ - -/* libao solaris support */ -/* #undef LIBAO_SOLARIS */ - -/* libao win support */ -#define LIBAO_WIN - -/* Name of package */ -#define PACKAGE "a52dec" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* The size of a `char', as computed by sizeof. */ -#define SIZEOF_CHAR 1 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "0.7.4-cvs" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#define inline __inline - -/* Define as `__restrict' if that's what the C compiler calls it, or to - nothing if it is not supported. */ -#define restrict /*__restrict*/ - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ diff --git a/plugins/spu2ghz/src/3rdparty/liba52/configure.incl b/plugins/spu2ghz/src/3rdparty/liba52/configure.incl deleted file mode 100644 index 4dbbcea6dc..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/configure.incl +++ /dev/null @@ -1,19 +0,0 @@ -AC_SUBST([LIBA52_CFLAGS]) -AC_SUBST([LIBA52_LIBS]) - -dnl avoid -fPIC when possible -LIBA52_CFLAGS="$LIBA52_CFLAGS -prefer-non-pic" - -AC_ARG_ENABLE([double], - [ --enable-double use double-precision samples]) -if test x"$enable_double" = x"yes"; then - AC_DEFINE([LIBA52_DOUBLE],,[a52 sample precision]) -fi - -dnl check for djbttf -AC_ARG_ENABLE([djbfft], - [ --enable-djbfft make a version using djbfft]) -if test x"$enable_djbfft" = x"yes"; then - AC_DEFINE([LIBA52_DJBFFT],,[liba52 djbfft support]) - LIBA52_LIBS="$LIBA52_LIBS -ldjbfft" -fi diff --git a/plugins/spu2ghz/src/3rdparty/liba52/downmix.c b/plugins/spu2ghz/src/3rdparty/liba52/downmix.c deleted file mode 100644 index 390d546a73..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/downmix.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * downmix.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#pragma warning(disable:4244) -#include "config.h" - -#include -#include "inttypes.h" - -#include "a52.h" -#include "a52_internal.h" - -#define CONVERT(acmod,output) (((output) << 3) + (acmod)) - -int a52_downmix_init (int input, int flags, sample_t * level, - sample_t clev, sample_t slev) -{ - static uint8_t table[11][8] = { - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_MONO, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_STEREO, A52_3F, A52_STEREO, A52_3F}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO, - A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F, - A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R}, - {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO, - A52_MONO, A52_MONO, A52_MONO, A52_MONO}, - {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY, - A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY} - }; - int output; - - output = flags & A52_CHANNEL_MASK; - if (output > A52_DOLBY) - return -1; - - output = table[output][input & 7]; - - if ((output == A52_STEREO) && - ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB)))) - output = A52_DOLBY; - - if (flags & A52_ADJUST_LEVEL) - switch (CONVERT (input & 7, output)) { - - case CONVERT (A52_3F, A52_MONO): - *level *= LEVEL_3DB / (1 + clev); - break; - - case CONVERT (A52_STEREO, A52_MONO): - case CONVERT (A52_2F2R, A52_2F1R): - case CONVERT (A52_3F2R, A52_3F1R): - level_3db: - *level *= LEVEL_3DB; - break; - - case CONVERT (A52_3F2R, A52_2F1R): - if (clev < LEVEL_PLUS3DB - 1) - goto level_3db; - /* break thru */ - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F1R, A52_2F1R): - case CONVERT (A52_3F1R, A52_2F2R): - case CONVERT (A52_3F2R, A52_2F2R): - *level /= 1 + clev; - break; - - case CONVERT (A52_2F1R, A52_MONO): - *level *= LEVEL_PLUS3DB / (2 + slev); - break; - - case CONVERT (A52_2F1R, A52_STEREO): - case CONVERT (A52_3F1R, A52_3F): - *level /= 1 + slev * LEVEL_3DB; - break; - - case CONVERT (A52_3F1R, A52_MONO): - *level *= LEVEL_3DB / (1 + clev + 0.5 * slev); - break; - - case CONVERT (A52_3F1R, A52_STEREO): - *level /= 1 + clev + slev * LEVEL_3DB; - break; - - case CONVERT (A52_2F2R, A52_MONO): - *level *= LEVEL_3DB / (1 + slev); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - case CONVERT (A52_3F2R, A52_3F): - *level /= 1 + slev; - break; - - case CONVERT (A52_3F2R, A52_MONO): - *level *= LEVEL_3DB / (1 + clev + slev); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - *level /= 1 + clev + slev; - break; - - case CONVERT (A52_MONO, A52_DOLBY): - *level *= LEVEL_PLUS3DB; - break; - - case CONVERT (A52_3F, A52_DOLBY): - case CONVERT (A52_2F1R, A52_DOLBY): - *level *= 1 / (1 + LEVEL_3DB); - break; - - case CONVERT (A52_3F1R, A52_DOLBY): - case CONVERT (A52_2F2R, A52_DOLBY): - *level *= 1 / (1 + 2 * LEVEL_3DB); - break; - - case CONVERT (A52_3F2R, A52_DOLBY): - *level *= 1 / (1 + 3 * LEVEL_3DB); - break; - } - - return output; -} - -int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level, - sample_t clev, sample_t slev) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL): - case CONVERT (A52_MONO, A52_MONO): - case CONVERT (A52_STEREO, A52_STEREO): - case CONVERT (A52_3F, A52_3F): - case CONVERT (A52_2F1R, A52_2F1R): - case CONVERT (A52_3F1R, A52_3F1R): - case CONVERT (A52_2F2R, A52_2F2R): - case CONVERT (A52_3F2R, A52_3F2R): - case CONVERT (A52_STEREO, A52_DOLBY): - coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level; - return 0; - - case CONVERT (A52_CHANNEL, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_6DB; - return 3; - - case CONVERT (A52_STEREO, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - return 3; - - case CONVERT (A52_3F, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - return 7; - - case CONVERT (A52_2F1R, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - coeff[2] = level * slev * LEVEL_3DB; - return 7; - - case CONVERT (A52_2F2R, A52_MONO): - coeff[0] = coeff[1] = level * LEVEL_3DB; - coeff[2] = coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_3F1R, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_3F2R, A52_MONO): - coeff[0] = coeff[2] = level * LEVEL_3DB; - coeff[1] = level * clev * LEVEL_PLUS3DB; - coeff[3] = coeff[4] = level * slev * LEVEL_3DB; - return 31; - - case CONVERT (A52_MONO, A52_DOLBY): - coeff[0] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_3F, A52_DOLBY): - clev = LEVEL_3DB; - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F1R, A52_2F1R): - case CONVERT (A52_3F2R, A52_2F2R): - coeff[0] = coeff[2] = coeff[3] = coeff[4] = level; - coeff[1] = level * clev; - return 7; - - case CONVERT (A52_2F1R, A52_DOLBY): - slev = 1; - case CONVERT (A52_2F1R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = level * slev * LEVEL_3DB; - return 7; - - case CONVERT (A52_3F1R, A52_DOLBY): - clev = LEVEL_3DB; - slev = 1; - case CONVERT (A52_3F1R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = level * slev * LEVEL_3DB; - return 15; - - case CONVERT (A52_2F2R, A52_DOLBY): - slev = LEVEL_3DB; - case CONVERT (A52_2F2R, A52_STEREO): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level * slev; - return 15; - - case CONVERT (A52_3F2R, A52_DOLBY): - clev = LEVEL_3DB; - case CONVERT (A52_3F2R, A52_2F1R): - slev = LEVEL_3DB; - case CONVERT (A52_3F2R, A52_STEREO): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = coeff[4] = level * slev; - return 31; - - case CONVERT (A52_3F1R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = level * slev * LEVEL_3DB; - return 13; - - case CONVERT (A52_3F2R, A52_3F): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = level * slev; - return 29; - - case CONVERT (A52_2F2R, A52_2F1R): - coeff[0] = coeff[1] = level; - coeff[2] = coeff[3] = level * LEVEL_3DB; - return 12; - - case CONVERT (A52_3F2R, A52_3F1R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = coeff[4] = level * LEVEL_3DB; - return 24; - - case CONVERT (A52_2F1R, A52_2F2R): - coeff[0] = coeff[1] = level; - coeff[2] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_3F1R, A52_2F2R): - coeff[0] = coeff[2] = level; - coeff[1] = level * clev; - coeff[3] = level * LEVEL_3DB; - return 7; - - case CONVERT (A52_3F1R, A52_3F2R): - coeff[0] = coeff[1] = coeff[2] = level; - coeff[3] = level * LEVEL_3DB; - return 0; - - case CONVERT (A52_CHANNEL, A52_CHANNEL1): - coeff[0] = level; - coeff[1] = 0; - return 0; - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - coeff[0] = 0; - coeff[1] = level; - return 0; - } - - return -1; /* NOTREACHED */ -} - -static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - dest[i] += src[i] + bias; -} - -static void mix3to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += samples[i + 256] + samples[i + 512] + bias; -} - -static void mix4to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += (samples[i + 256] + samples[i + 512] + - samples[i + 768] + bias); -} - -static void mix5to1 (sample_t * samples, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] += (samples[i + 256] + samples[i + 512] + - samples[i + 768] + samples[i + 1024] + bias); -} - -static void mix3to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; - } -} - -static void mix21to2 (sample_t * left, sample_t * right, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = right[i + 256] + bias; - left[i] += common; - right[i] += common; - } -} - -static void mix21toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512]; - samples[i] += bias - surround; - samples[i + 256] += bias + surround; - } -} - -static void mix31to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + samples[i + 768] + bias; - samples[i] += common; - samples[i + 256] = samples[i + 512] + common; - } -} - -static void mix31toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t common, surround; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - surround = samples[i + 768]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; - } -} - -static void mix22toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t surround; - - for (i = 0; i < 256; i++) { - surround = samples[i + 512] + samples[i + 768]; - samples[i] += bias - surround; - samples[i + 256] += bias + surround; - } -} - -static void mix32to2 (sample_t * samples, sample_t bias) -{ - int i; - sample_t common; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - samples[i] += common + samples[i + 768]; - samples[i + 256] = common + samples[i + 512] + samples[i + 1024]; - } -} - -static void mix32toS (sample_t * samples, sample_t bias) -{ - int i; - sample_t common, surround; - - for (i = 0; i < 256; i++) { - common = samples[i + 256] + bias; - surround = samples[i + 768] + samples[i + 1024]; - samples[i] += common - surround; - samples[i + 256] = samples[i + 512] + common + surround; - } -} - -static void move2to1 (sample_t * src, sample_t * dest, sample_t bias) -{ - int i; - - for (i = 0; i < 256; i++) - dest[i] = src[i] + src[i + 256] + bias; -} - -static void zero (sample_t * samples) -{ - int i; - - for (i = 0; i < 256; i++) - samples[i] = 0; -} - -void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias, - sample_t clev, sample_t slev) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples, samples + 256, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_CHANNEL, A52_MONO): - case CONVERT (A52_STEREO, A52_MONO): - mix_2to1: - mix2to1 (samples, samples + 256, bias); - break; - - case CONVERT (A52_2F1R, A52_MONO): - if (slev == 0) - goto mix_2to1; - case CONVERT (A52_3F, A52_MONO): - mix_3to1: - mix3to1 (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_MONO): - if (slev == 0) - goto mix_3to1; - case CONVERT (A52_2F2R, A52_MONO): - if (slev == 0) - goto mix_2to1; - mix4to1 (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_MONO): - if (slev == 0) - goto mix_3to1; - mix5to1 (samples, bias); - break; - - case CONVERT (A52_MONO, A52_DOLBY): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F, A52_DOLBY): - mix_3to2: - mix3to2 (samples, bias); - break; - - case CONVERT (A52_2F1R, A52_STEREO): - if (slev == 0) - break; - mix21to2 (samples, samples + 256, bias); - break; - - case CONVERT (A52_2F1R, A52_DOLBY): - mix21toS (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix31to2 (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_DOLBY): - mix31toS (samples, bias); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - if (slev == 0) - break; - mix2to1 (samples, samples + 512, bias); - mix2to1 (samples + 256, samples + 768, bias); - break; - - case CONVERT (A52_2F2R, A52_DOLBY): - mix22toS (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - if (slev == 0) - goto mix_3to2; - mix32to2 (samples, bias); - break; - - case CONVERT (A52_3F2R, A52_DOLBY): - mix32toS (samples, bias); - break; - - case CONVERT (A52_3F1R, A52_3F): - if (slev == 0) - break; - mix21to2 (samples, samples + 512, bias); - break; - - case CONVERT (A52_3F2R, A52_3F): - if (slev == 0) - break; - mix2to1 (samples, samples + 768, bias); - mix2to1 (samples + 512, samples + 1024, bias); - break; - - case CONVERT (A52_3F1R, A52_2F1R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_2F2R, A52_2F1R): - mix2to1 (samples + 512, samples + 768, bias); - break; - - case CONVERT (A52_3F2R, A52_2F1R): - mix3to2 (samples, bias); - move2to1 (samples + 768, samples + 512, bias); - break; - - case CONVERT (A52_3F2R, A52_3F1R): - mix2to1 (samples + 768, samples + 1024, bias); - break; - - case CONVERT (A52_2F1R, A52_2F2R): - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F1R, A52_2F2R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F2R, A52_2F2R): - mix3to2 (samples, bias); - memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t)); - memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F1R, A52_3F2R): - memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t)); - break; - } -} - -void a52_upmix (sample_t * samples, int acmod, int output) -{ - switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) { - - case CONVERT (A52_CHANNEL, A52_CHANNEL2): - memcpy (samples + 256, samples, 256 * sizeof (sample_t)); - break; - - case CONVERT (A52_3F2R, A52_MONO): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_MONO): - case CONVERT (A52_2F2R, A52_MONO): - zero (samples + 768); - case CONVERT (A52_3F, A52_MONO): - case CONVERT (A52_2F1R, A52_MONO): - zero (samples + 512); - case CONVERT (A52_CHANNEL, A52_MONO): - case CONVERT (A52_STEREO, A52_MONO): - zero (samples + 256); - break; - - case CONVERT (A52_3F2R, A52_STEREO): - case CONVERT (A52_3F2R, A52_DOLBY): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_STEREO): - case CONVERT (A52_3F1R, A52_DOLBY): - zero (samples + 768); - case CONVERT (A52_3F, A52_STEREO): - case CONVERT (A52_3F, A52_DOLBY): - mix_3to2: - memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t)); - zero (samples + 256); - break; - - case CONVERT (A52_2F2R, A52_STEREO): - case CONVERT (A52_2F2R, A52_DOLBY): - zero (samples + 768); - case CONVERT (A52_2F1R, A52_STEREO): - case CONVERT (A52_2F1R, A52_DOLBY): - zero (samples + 512); - break; - - case CONVERT (A52_3F2R, A52_3F): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_3F): - case CONVERT (A52_2F2R, A52_2F1R): - zero (samples + 768); - break; - - case CONVERT (A52_3F2R, A52_3F1R): - zero (samples + 1024); - break; - - case CONVERT (A52_3F2R, A52_2F1R): - zero (samples + 1024); - case CONVERT (A52_3F1R, A52_2F1R): - mix_31to21: - memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t)); - goto mix_3to2; - - case CONVERT (A52_3F2R, A52_2F2R): - memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t)); - goto mix_31to21; - } -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/imdct.c b/plugins/spu2ghz/src/3rdparty/liba52/imdct.c deleted file mode 100644 index 4e81e4a099..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/imdct.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * imdct.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * The ifft algorithms in this file have been largely inspired by Dan - * Bernstein's work, djbfft, available at http://cr.yp.to/djbfft.html - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#pragma warning(disable:4244) -#include "config.h" - -#include -#include -#ifdef LIBA52_DJBFFT -#include -#endif -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795029 -#endif -#include "inttypes.h" - -#include "a52.h" -#include "a52_internal.h" -#include "mm_accel.h" - -typedef struct complex_s { - sample_t real; - sample_t imag; -} complex_t; - -static uint8_t fftorder[] = { - 0,128, 64,192, 32,160,224, 96, 16,144, 80,208,240,112, 48,176, - 8,136, 72,200, 40,168,232,104,248,120, 56,184, 24,152,216, 88, - 4,132, 68,196, 36,164,228,100, 20,148, 84,212,244,116, 52,180, - 252,124, 60,188, 28,156,220, 92, 12,140, 76,204,236,108, 44,172, - 2,130, 66,194, 34,162,226, 98, 18,146, 82,210,242,114, 50,178, - 10,138, 74,202, 42,170,234,106,250,122, 58,186, 26,154,218, 90, - 254,126, 62,190, 30,158,222, 94, 14,142, 78,206,238,110, 46,174, - 6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86 -}; - -/* Root values for IFFT */ -static sample_t roots16[3]; -static sample_t roots32[7]; -static sample_t roots64[15]; -static sample_t roots128[31]; - -/* Twiddle factors for IMDCT */ -static complex_t pre1[128]; -static complex_t post1[64]; -static complex_t pre2[64]; -static complex_t post2[32]; - -static sample_t a52_imdct_window[256]; - -static void (* ifft128) (complex_t * buf); -static void (* ifft64) (complex_t * buf); - -static inline void ifft2 (complex_t * buf) -{ - double r, i; - - r = buf[0].real; - i = buf[0].imag; - buf[0].real += buf[1].real; - buf[0].imag += buf[1].imag; - buf[1].real = r - buf[1].real; - buf[1].imag = i - buf[1].imag; -} - -static inline void ifft4 (complex_t * buf) -{ - double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - - tmp1 = buf[0].real + buf[1].real; - tmp2 = buf[3].real + buf[2].real; - tmp3 = buf[0].imag + buf[1].imag; - tmp4 = buf[2].imag + buf[3].imag; - tmp5 = buf[0].real - buf[1].real; - tmp6 = buf[0].imag - buf[1].imag; - tmp7 = buf[2].imag - buf[3].imag; - tmp8 = buf[3].real - buf[2].real; - - buf[0].real = tmp1 + tmp2; - buf[0].imag = tmp3 + tmp4; - buf[2].real = tmp1 - tmp2; - buf[2].imag = tmp3 - tmp4; - buf[1].real = tmp5 + tmp7; - buf[1].imag = tmp6 + tmp8; - buf[3].real = tmp5 - tmp7; - buf[3].imag = tmp6 - tmp8; -} - -/* the basic split-radix ifft butterfly */ - -#define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \ - tmp5 = a2.real * wr + a2.imag * wi; \ - tmp6 = a2.imag * wr - a2.real * wi; \ - tmp7 = a3.real * wr - a3.imag * wi; \ - tmp8 = a3.imag * wr + a3.real * wi; \ - tmp1 = tmp5 + tmp7; \ - tmp2 = tmp6 + tmp8; \ - tmp3 = tmp6 - tmp8; \ - tmp4 = tmp7 - tmp5; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ -} while (0) - -/* split-radix ifft butterfly, specialized for wr=1 wi=0 */ - -#define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \ - tmp1 = a2.real + a3.real; \ - tmp2 = a2.imag + a3.imag; \ - tmp3 = a2.imag - a3.imag; \ - tmp4 = a3.real - a2.real; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ -} while (0) - -/* split-radix ifft butterfly, specialized for wr=wi */ - -#define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \ - tmp5 = (a2.real + a2.imag) * w; \ - tmp6 = (a2.imag - a2.real) * w; \ - tmp7 = (a3.real - a3.imag) * w; \ - tmp8 = (a3.imag + a3.real) * w; \ - tmp1 = tmp5 + tmp7; \ - tmp2 = tmp6 + tmp8; \ - tmp3 = tmp6 - tmp8; \ - tmp4 = tmp7 - tmp5; \ - a2.real = a0.real - tmp1; \ - a2.imag = a0.imag - tmp2; \ - a3.real = a1.real - tmp3; \ - a3.imag = a1.imag - tmp4; \ - a0.real += tmp1; \ - a0.imag += tmp2; \ - a1.real += tmp3; \ - a1.imag += tmp4; \ -} while (0) - -static inline void ifft8 (complex_t * buf) -{ - double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - - ifft4 (buf); - ifft2 (buf + 4); - ifft2 (buf + 6); - BUTTERFLY_ZERO (buf[0], buf[2], buf[4], buf[6]); - BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], roots16[1]); -} - -static void ifft_pass (complex_t * buf, sample_t * weight, int n) -{ - complex_t * buf1; - complex_t * buf2; - complex_t * buf3; - double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - int i; - - buf++; - buf1 = buf + n; - buf2 = buf + 2 * n; - buf3 = buf + 3 * n; - - BUTTERFLY_ZERO (buf[-1], buf1[-1], buf2[-1], buf3[-1]); - - i = n - 1; - - do { - BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], weight[n], weight[2*i]); - buf++; - buf1++; - buf2++; - buf3++; - weight++; - } while (--i); -} - -static void ifft16 (complex_t * buf) -{ - ifft8 (buf); - ifft4 (buf + 8); - ifft4 (buf + 12); - ifft_pass (buf, roots16 - 4, 4); -} - -static void ifft32 (complex_t * buf) -{ - ifft16 (buf); - ifft8 (buf + 16); - ifft8 (buf + 24); - ifft_pass (buf, roots32 - 8, 8); -} - -static void ifft64_c (complex_t * buf) -{ - ifft32 (buf); - ifft16 (buf + 32); - ifft16 (buf + 48); - ifft_pass (buf, roots64 - 16, 16); -} - -static void ifft128_c (complex_t * buf) -{ - ifft32 (buf); - ifft16 (buf + 32); - ifft16 (buf + 48); - ifft_pass (buf, roots64 - 16, 16); - - ifft32 (buf + 64); - ifft32 (buf + 96); - ifft_pass (buf, roots128 - 32, 32); -} - -void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias) -{ - int i, k; - sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2; - const sample_t * window = a52_imdct_window; - complex_t buf[128]; - - for (i = 0; i < 128; i++) { - k = fftorder[i]; - t_r = pre1[i].real; - t_i = pre1[i].imag; - - buf[i].real = t_i * data[255-k] + t_r * data[k]; - buf[i].imag = t_r * data[255-k] - t_i * data[k]; - } - - ifft128 (buf); - - /* Post IFFT complex multiply plus IFFT complex conjugate*/ - /* Window and convert to real valued signal */ - for (i = 0; i < 64; i++) { - /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */ - t_r = post1[i].real; - t_i = post1[i].imag; - - a_r = t_r * buf[i].real + t_i * buf[i].imag; - a_i = t_i * buf[i].real - t_r * buf[i].imag; - b_r = t_i * buf[127-i].real + t_r * buf[127-i].imag; - b_i = t_r * buf[127-i].real - t_i * buf[127-i].imag; - - w_1 = window[2*i]; - w_2 = window[255-2*i]; - data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias; - data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias; - delay[2*i] = a_i; - - w_1 = window[2*i+1]; - w_2 = window[254-2*i]; - data[2*i+1] = delay[2*i+1] * w_2 + b_r * w_1 + bias; - data[254-2*i] = delay[2*i+1] * w_1 - b_r * w_2 + bias; - delay[2*i+1] = b_i; - } -} - -void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias) -{ - int i, k; - sample_t t_r, t_i, a_r, a_i, b_r, b_i, c_r, c_i, d_r, d_i, w_1, w_2; - const sample_t * window = a52_imdct_window; - complex_t buf1[64], buf2[64]; - - /* Pre IFFT complex multiply plus IFFT cmplx conjugate */ - for (i = 0; i < 64; i++) { - k = fftorder[i]; - t_r = pre2[i].real; - t_i = pre2[i].imag; - - buf1[i].real = t_i * data[254-k] + t_r * data[k]; - buf1[i].imag = t_r * data[254-k] - t_i * data[k]; - - buf2[i].real = t_i * data[255-k] + t_r * data[k+1]; - buf2[i].imag = t_r * data[255-k] - t_i * data[k+1]; - } - - ifft64 (buf1); - ifft64 (buf2); - - /* Post IFFT complex multiply */ - /* Window and convert to real valued signal */ - for (i = 0; i < 32; i++) { - /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ - t_r = post2[i].real; - t_i = post2[i].imag; - - a_r = t_r * buf1[i].real + t_i * buf1[i].imag; - a_i = t_i * buf1[i].real - t_r * buf1[i].imag; - b_r = t_i * buf1[63-i].real + t_r * buf1[63-i].imag; - b_i = t_r * buf1[63-i].real - t_i * buf1[63-i].imag; - - c_r = t_r * buf2[i].real + t_i * buf2[i].imag; - c_i = t_i * buf2[i].real - t_r * buf2[i].imag; - d_r = t_i * buf2[63-i].real + t_r * buf2[63-i].imag; - d_i = t_r * buf2[63-i].real - t_i * buf2[63-i].imag; - - w_1 = window[2*i]; - w_2 = window[255-2*i]; - data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias; - data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias; - delay[2*i] = c_i; - - w_1 = window[128+2*i]; - w_2 = window[127-2*i]; - data[128+2*i] = delay[127-2*i] * w_2 + a_i * w_1 + bias; - data[127-2*i] = delay[127-2*i] * w_1 - a_i * w_2 + bias; - delay[127-2*i] = c_r; - - w_1 = window[2*i+1]; - w_2 = window[254-2*i]; - data[2*i+1] = delay[2*i+1] * w_2 - b_i * w_1 + bias; - data[254-2*i] = delay[2*i+1] * w_1 + b_i * w_2 + bias; - delay[2*i+1] = d_r; - - w_1 = window[129+2*i]; - w_2 = window[126-2*i]; - data[129+2*i] = delay[126-2*i] * w_2 + b_r * w_1 + bias; - data[126-2*i] = delay[126-2*i] * w_1 - b_r * w_2 + bias; - delay[126-2*i] = d_i; - } -} - -static double besselI0 (double x) -{ - double bessel = 1; - int i = 100; - - do - bessel = bessel * x / (i * i) + 1; - while (--i); - return bessel; -} - -void a52_imdct_init (uint32_t mm_accel) -{ - int i, k; - double sum; - - /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */ - sum = 0; - for (i = 0; i < 256; i++) { - sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256)); - a52_imdct_window[i] = sum; - } - sum++; - for (i = 0; i < 256; i++) - a52_imdct_window[i] = sqrt (a52_imdct_window[i] / sum); - - for (i = 0; i < 3; i++) - roots16[i] = cos ((M_PI / 8) * (i + 1)); - - for (i = 0; i < 7; i++) - roots32[i] = cos ((M_PI / 16) * (i + 1)); - - for (i = 0; i < 15; i++) - roots64[i] = cos ((M_PI / 32) * (i + 1)); - - for (i = 0; i < 31; i++) - roots128[i] = cos ((M_PI / 64) * (i + 1)); - - for (i = 0; i < 64; i++) { - k = fftorder[i] / 2 + 64; - pre1[i].real = cos ((M_PI / 256) * (k - 0.25)); - pre1[i].imag = sin ((M_PI / 256) * (k - 0.25)); - } - - for (i = 64; i < 128; i++) { - k = fftorder[i] / 2 + 64; - pre1[i].real = -cos ((M_PI / 256) * (k - 0.25)); - pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25)); - } - - for (i = 0; i < 64; i++) { - post1[i].real = cos ((M_PI / 256) * (i + 0.5)); - post1[i].imag = sin ((M_PI / 256) * (i + 0.5)); - } - - for (i = 0; i < 64; i++) { - k = fftorder[i] / 4; - pre2[i].real = cos ((M_PI / 128) * (k - 0.25)); - pre2[i].imag = sin ((M_PI / 128) * (k - 0.25)); - } - - for (i = 0; i < 32; i++) { - post2[i].real = cos ((M_PI / 128) * (i + 0.5)); - post2[i].imag = sin ((M_PI / 128) * (i + 0.5)); - } - -#ifdef LIBA52_DJBFFT - if (mm_accel & MM_ACCEL_DJBFFT) { - fprintf (stderr, "Using djbfft for IMDCT transform\n"); - ifft128 = (void (*) (complex_t *)) fftc4_un128; - ifft64 = (void (*) (complex_t *)) fftc4_un64; - } else -#endif - { - fprintf (stderr, "No accelerated IMDCT transform found\n"); - ifft128 = ifft128_c; - ifft64 = ifft64_c; - } -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/inttypes.h b/plugins/spu2ghz/src/3rdparty/liba52/inttypes.h deleted file mode 100644 index 5cd0239c26..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/inttypes.h +++ /dev/null @@ -1,13 +0,0 @@ -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -#ifdef ARCH_X86 -typedef signed long long int64_t; -#endif - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -#ifdef ARCH_X86 -typedef unsigned long long uint64_t; -#endif diff --git a/plugins/spu2ghz/src/3rdparty/liba52/mm_accel.h b/plugins/spu2ghz/src/3rdparty/liba52/mm_accel.h deleted file mode 100644 index 25258c3683..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/mm_accel.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * mm_accel.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MM_ACCEL_H -#define MM_ACCEL_H - -/* generic accelerations */ -#define MM_ACCEL_DJBFFT 0x00000001 - -/* x86 accelerations */ -#define MM_ACCEL_X86_MMX 0x80000000 -#define MM_ACCEL_X86_3DNOW 0x40000000 -#define MM_ACCEL_X86_MMXEXT 0x20000000 - -uint32_t mm_accel (void); - -#endif /* MM_ACCEL_H */ diff --git a/plugins/spu2ghz/src/3rdparty/liba52/parse.c b/plugins/spu2ghz/src/3rdparty/liba52/parse.c deleted file mode 100644 index 3626944f65..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/parse.c +++ /dev/null @@ -1,903 +0,0 @@ -/* - * parse.c - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#pragma warning(disable:4305) -#pragma warning(disable:4244) - -#include "config.h" - -#include -#include -#include "inttypes.h" - -#include "a52.h" -#include "a52_internal.h" -#include "bitstream.h" -#include "tables.h" - -#ifdef HAVE_MEMALIGN -/* some systems have memalign() but no declaration for it */ -void * memalign (size_t align, size_t size); -#else -/* assume malloc alignment is sufficient */ -#define memalign(align,size) malloc (size) -#endif - -typedef struct { - sample_t q1[2]; - sample_t q2[2]; - sample_t q4; - int q1_ptr; - int q2_ptr; - int q4_ptr; -} quantizer_t; - -static uint8_t halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; - -a52_state_t * a52_init (uint32_t mm_accel) -{ - a52_state_t * state; - int i; - - state = malloc (sizeof (a52_state_t)); - if (state == NULL) - return NULL; - - state->samples = memalign (16, 256 * 12 * sizeof (sample_t)); - if (state->samples == NULL) { - free (state); - return NULL; - } - - for (i = 0; i < 256 * 12; i++) - state->samples[i] = 0; - - state->downmixed = 1; - - state->lfsr_state = 1; - - a52_imdct_init (mm_accel); - - return state; -} - -sample_t * a52_samples (a52_state_t * state) -{ - return state->samples; -} - -int a52_syncinfo (uint8_t * buf, int * flags, - int * sample_rate, int * bit_rate) -{ - static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112, - 128, 160, 192, 224, 256, 320, 384, 448, - 512, 576, 640}; - static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01}; - int frmsizecod; - int bitrate; - int half; - int acmod; - - if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */ - return 0; - - if (buf[5] >= 0x60) /* bsid >= 12 */ - return 0; - half = halfrate[buf[5] >> 3]; - - /* acmod, dsurmod and lfeon */ - acmod = buf[6] >> 5; - *flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) | - ((buf[6] & lfeon[acmod]) ? A52_LFE : 0)); - - frmsizecod = buf[4] & 63; - if (frmsizecod >= 38) - return 0; - bitrate = rate [frmsizecod >> 1]; - *bit_rate = (bitrate * 1000) >> half; - - switch (buf[4] & 0xc0) { - case 0: - *sample_rate = 48000 >> half; - return 4 * bitrate; - case 0x40: - *sample_rate = 44100 >> half; - return 2 * (320 * bitrate / 147 + (frmsizecod & 1)); - case 0x80: - *sample_rate = 32000 >> half; - return 6 * bitrate; - default: - return 0; - } -} - -int a52_frame (a52_state_t * state, uint8_t * buf, int * flags, - sample_t * level, sample_t bias) -{ - static sample_t clev[4] = {LEVEL_3DB, LEVEL_45DB, LEVEL_6DB, LEVEL_45DB}; - static sample_t slev[4] = {LEVEL_3DB, LEVEL_6DB, 0, LEVEL_6DB}; - int chaninfo; - int acmod; - - state->fscod = buf[4] >> 6; - state->halfrate = halfrate[buf[5] >> 3]; - state->acmod = acmod = buf[6] >> 5; - - a52_bitstream_set_ptr (state, buf + 6); - bitstream_get (state, 3); /* skip acmod we already parsed */ - - if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */ - acmod = A52_DOLBY; - - if ((acmod & 1) && (acmod != 1)) - state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */ - - if (acmod & 4) - state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */ - - state->lfeon = bitstream_get (state, 1); - - state->output = a52_downmix_init (acmod, *flags, level, - state->clev, state->slev); - if (state->output < 0) - return 1; - if (state->lfeon && (*flags & A52_LFE)) - state->output |= A52_LFE; - *flags = state->output; - /* the 2* compensates for differences in imdct */ - state->dynrng = state->level = 2 * *level; - state->bias = bias; - state->dynrnge = 1; - state->dynrngcall = NULL; - state->cplba.deltbae = DELTA_BIT_NONE; - state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae = - state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE; - - chaninfo = !acmod; - do { - bitstream_get (state, 5); /* dialnorm */ - if (bitstream_get (state, 1)) /* compre */ - bitstream_get (state, 8); /* compr */ - if (bitstream_get (state, 1)) /* langcode */ - bitstream_get (state, 8); /* langcod */ - if (bitstream_get (state, 1)) /* audprodie */ - bitstream_get (state, 7); /* mixlevel + roomtyp */ - } while (chaninfo--); - - bitstream_get (state, 2); /* copyrightb + origbs */ - - if (bitstream_get (state, 1)) /* timecod1e */ - bitstream_get (state, 14); /* timecod1 */ - if (bitstream_get (state, 1)) /* timecod2e */ - bitstream_get (state, 14); /* timecod2 */ - - if (bitstream_get (state, 1)) { /* addbsie */ - int addbsil; - - addbsil = bitstream_get (state, 6); - do { - bitstream_get (state, 8); /* addbsi */ - } while (addbsil--); - } - - return 0; -} - -void a52_dynrng (a52_state_t * state, - sample_t (* call) (sample_t, void *), void * data) -{ - state->dynrnge = 0; - if (call) { - state->dynrnge = 1; - state->dynrngcall = call; - state->dynrngdata = data; - } -} - -static int parse_exponents (a52_state_t * state, int expstr, int ngrps, - uint8_t exponent, uint8_t * dest) -{ - int exps; - - while (ngrps--) { - exps = bitstream_get (state, 7); - - exponent += exp_1[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - - exponent += exp_2[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - - exponent += exp_3[exps]; - if (exponent > 24) - return 1; - - switch (expstr) { - case EXP_D45: - *(dest++) = exponent; - *(dest++) = exponent; - case EXP_D25: - *(dest++) = exponent; - case EXP_D15: - *(dest++) = exponent; - } - } - - return 0; -} - -static int parse_deltba (a52_state_t * state, int8_t * deltba) -{ - int deltnseg, deltlen, delta, j; - - memset (deltba, 0, 50); - - deltnseg = bitstream_get (state, 3); - j = 0; - do { - j += bitstream_get (state, 5); - deltlen = bitstream_get (state, 4); - delta = bitstream_get (state, 3); - delta -= (delta >= 4) ? 3 : 4; - if (!deltlen) - continue; - if (j + deltlen >= 50) - return 1; - while (deltlen--) - deltba[j++] = delta; - } while (deltnseg--); - - return 0; -} - -static inline int zero_snr_offsets (int nfchans, a52_state_t * state) -{ - int i; - - if ((state->csnroffst) || - (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */ - (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */ - return 0; - for (i = 0; i < nfchans; i++) - if (state->ba[i].bai >> 3) /* fsnroffst */ - return 0; - return 1; -} - -static inline int16_t dither_gen (a52_state_t * state) -{ - int16_t nstate; - - nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8); - - state->lfsr_state = (uint16_t) nstate; - - return nstate; -} - -static void coeff_get (a52_state_t * state, sample_t * coeff, - expbap_t * expbap, quantizer_t * quantizer, - sample_t level, int dither, int end) -{ - int i; - uint8_t * exp; - int8_t * bap; - sample_t factor[25]; - - for (i = 0; i <= 24; i++) - factor[i] = scale_factor[i] * level; - - exp = expbap->exp; - bap = expbap->bap; - - for (i = 0; i < end; i++) { - int bapi; - - bapi = bap[i]; - switch (bapi) { - case 0: - if (dither) { - coeff[i] = dither_gen (state) * LEVEL_3DB * factor[exp[i]]; - continue; - } else { - coeff[i] = 0; - continue; - } - - case -1: - if (quantizer->q1_ptr >= 0) { - coeff[i] = quantizer->q1[quantizer->q1_ptr--] * factor[exp[i]]; - continue; - } else { - int code; - - code = bitstream_get (state, 5); - - quantizer->q1_ptr = 1; - quantizer->q1[0] = q_1_2[code]; - quantizer->q1[1] = q_1_1[code]; - coeff[i] = q_1_0[code] * factor[exp[i]]; - continue; - } - - case -2: - if (quantizer->q2_ptr >= 0) { - coeff[i] = quantizer->q2[quantizer->q2_ptr--] * factor[exp[i]]; - continue; - } else { - int code; - - code = bitstream_get (state, 7); - - quantizer->q2_ptr = 1; - quantizer->q2[0] = q_2_2[code]; - quantizer->q2[1] = q_2_1[code]; - coeff[i] = q_2_0[code] * factor[exp[i]]; - continue; - } - - case 3: - coeff[i] = q_3[bitstream_get (state, 3)] * factor[exp[i]]; - continue; - - case -3: - if (quantizer->q4_ptr == 0) { - quantizer->q4_ptr = -1; - coeff[i] = quantizer->q4 * factor[exp[i]]; - continue; - } else { - int code; - - code = bitstream_get (state, 7); - - quantizer->q4_ptr = 0; - quantizer->q4 = q_4_1[code]; - coeff[i] = q_4_0[code] * factor[exp[i]]; - continue; - } - - case 4: - coeff[i] = q_5[bitstream_get (state, 4)] * factor[exp[i]]; - continue; - - default: - coeff[i] = ((bitstream_get_2 (state, bapi) << (16 - bapi)) * - factor[exp[i]]); - } - } -} - -static void coeff_get_coupling (a52_state_t * state, int nfchans, - sample_t * coeff, sample_t (* samples)[256], - quantizer_t * quantizer, uint8_t dithflag[5]) -{ - int cplbndstrc, bnd, i, i_end, ch; - uint8_t * exp; - int8_t * bap; - sample_t cplco[5]; - - exp = state->cpl_expbap.exp; - bap = state->cpl_expbap.bap; - bnd = 0; - cplbndstrc = state->cplbndstrc; - i = state->cplstrtmant; - while (i < state->cplendmant) { - i_end = i + 12; - while (cplbndstrc & 1) { - cplbndstrc >>= 1; - i_end += 12; - } - cplbndstrc >>= 1; - for (ch = 0; ch < nfchans; ch++) - cplco[ch] = state->cplco[ch][bnd] * coeff[ch]; - bnd++; - - while (i < i_end) { - sample_t cplcoeff; - int bapi; - - bapi = bap[i]; - switch (bapi) { - case 0: - cplcoeff = LEVEL_3DB * scale_factor[exp[i]]; - for (ch = 0; ch < nfchans; ch++) - if ((state->chincpl >> ch) & 1) { - if (dithflag[ch]) - samples[ch][i] = (cplcoeff * cplco[ch] * - dither_gen (state)); - else - samples[ch][i] = 0; - } - i++; - continue; - - case -1: - if (quantizer->q1_ptr >= 0) { - cplcoeff = quantizer->q1[quantizer->q1_ptr--]; - break; - } else { - int code; - - code = bitstream_get (state, 5); - - quantizer->q1_ptr = 1; - quantizer->q1[0] = q_1_2[code]; - quantizer->q1[1] = q_1_1[code]; - cplcoeff = q_1_0[code]; - break; - } - - case -2: - if (quantizer->q2_ptr >= 0) { - cplcoeff = quantizer->q2[quantizer->q2_ptr--]; - break; - } else { - int code; - - code = bitstream_get (state, 7); - - quantizer->q2_ptr = 1; - quantizer->q2[0] = q_2_2[code]; - quantizer->q2[1] = q_2_1[code]; - cplcoeff = q_2_0[code]; - break; - } - - case 3: - cplcoeff = q_3[bitstream_get (state, 3)]; - break; - - case -3: - if (quantizer->q4_ptr == 0) { - quantizer->q4_ptr = -1; - cplcoeff = quantizer->q4; - break; - } else { - int code; - - code = bitstream_get (state, 7); - - quantizer->q4_ptr = 0; - quantizer->q4 = q_4_1[code]; - cplcoeff = q_4_0[code]; - break; - } - - case 4: - cplcoeff = q_5[bitstream_get (state, 4)]; - break; - - default: - cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi); - } - - cplcoeff *= scale_factor[exp[i]]; - for (ch = 0; ch < nfchans; ch++) - if ((state->chincpl >> ch) & 1) - samples[ch][i] = cplcoeff * cplco[ch]; - i++; - } - } -} - -int a52_block (a52_state_t * state) -{ - static const uint8_t nfchans_tbl[] = {2, 1, 2, 3, 3, 4, 4, 5, 1, 1, 2}; - static int rematrix_band[4] = {25, 37, 61, 253}; - int i, nfchans, chaninfo; - uint8_t cplexpstr, chexpstr[5], lfeexpstr, do_bit_alloc, done_cpl; - uint8_t blksw[5], dithflag[5]; - sample_t coeff[5]; - int chanbias; - quantizer_t quantizer; - sample_t * samples; - - nfchans = nfchans_tbl[state->acmod]; - - for (i = 0; i < nfchans; i++) - blksw[i] = bitstream_get (state, 1); - - for (i = 0; i < nfchans; i++) - dithflag[i] = bitstream_get (state, 1); - - chaninfo = !state->acmod; - do { - if (bitstream_get (state, 1)) { /* dynrnge */ - int dynrng; - - dynrng = bitstream_get_2 (state, 8); - if (state->dynrnge) { - sample_t range; - - range = ((((dynrng & 0x1f) | 0x20) << 13) * - scale_factor[3 - (dynrng >> 5)]); - if (state->dynrngcall) - range = state->dynrngcall (range, state->dynrngdata); - state->dynrng = state->level * range; - } - } - } while (chaninfo--); - - if (bitstream_get (state, 1)) { /* cplstre */ - state->chincpl = 0; - if (bitstream_get (state, 1)) { /* cplinu */ - static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44, - 45, 45, 46, 46, 47, 47, 48, 48}; - int cplbegf; - int cplendf; - int ncplsubnd; - - for (i = 0; i < nfchans; i++) - state->chincpl |= bitstream_get (state, 1) << i; - switch (state->acmod) { - case 0: case 1: - return 1; - case 2: - state->phsflginu = bitstream_get (state, 1); - } - cplbegf = bitstream_get (state, 4); - cplendf = bitstream_get (state, 4); - - if (cplendf + 3 - cplbegf < 0) - return 1; - state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf; - state->cplstrtbnd = bndtab[cplbegf]; - state->cplstrtmant = cplbegf * 12 + 37; - state->cplendmant = cplendf * 12 + 73; - - state->cplbndstrc = 0; - for (i = 0; i < ncplsubnd - 1; i++) - if (bitstream_get (state, 1)) { - state->cplbndstrc |= 1 << i; - state->ncplbnd--; - } - } - } - - if (state->chincpl) { /* cplinu */ - int j, cplcoe; - - cplcoe = 0; - for (i = 0; i < nfchans; i++) - if ((state->chincpl) >> i & 1) - if (bitstream_get (state, 1)) { /* cplcoe */ - int mstrcplco, cplcoexp, cplcomant; - - cplcoe = 1; - mstrcplco = 3 * bitstream_get (state, 2); - for (j = 0; j < state->ncplbnd; j++) { - cplcoexp = bitstream_get (state, 4); - cplcomant = bitstream_get (state, 4); - if (cplcoexp == 15) - cplcomant <<= 14; - else - cplcomant = (cplcomant | 0x10) << 13; - state->cplco[i][j] = - cplcomant * scale_factor[cplcoexp + mstrcplco]; - } - } - if ((state->acmod == 2) && state->phsflginu && cplcoe) - for (j = 0; j < state->ncplbnd; j++) - if (bitstream_get (state, 1)) /* phsflg */ - state->cplco[1][j] = -state->cplco[1][j]; - } - - if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */ - int end; - - state->rematflg = 0; - end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */ - i = 0; - do - state->rematflg |= bitstream_get (state, 1) << i; - while (rematrix_band[i++] < end); - } - - cplexpstr = EXP_REUSE; - lfeexpstr = EXP_REUSE; - if (state->chincpl) /* cplinu */ - cplexpstr = bitstream_get (state, 2); - for (i = 0; i < nfchans; i++) - chexpstr[i] = bitstream_get (state, 2); - if (state->lfeon) - lfeexpstr = bitstream_get (state, 1); - - for (i = 0; i < nfchans; i++) - if (chexpstr[i] != EXP_REUSE) { - if ((state->chincpl >> i) & 1) - state->endmant[i] = state->cplstrtmant; - else { - int chbwcod; - - chbwcod = bitstream_get (state, 6); - if (chbwcod > 60) - return 1; - state->endmant[i] = chbwcod * 3 + 73; - } - } - - do_bit_alloc = 0; - - if (cplexpstr != EXP_REUSE) { - int cplabsexp, ncplgrps; - - do_bit_alloc = 64; - ncplgrps = ((state->cplendmant - state->cplstrtmant) / - (3 << (cplexpstr - 1))); - cplabsexp = bitstream_get (state, 4) << 1; - if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp, - state->cpl_expbap.exp + state->cplstrtmant)) - return 1; - } - for (i = 0; i < nfchans; i++) - if (chexpstr[i] != EXP_REUSE) { - int grp_size, nchgrps; - - do_bit_alloc |= 1 << i; - grp_size = 3 << (chexpstr[i] - 1); - nchgrps = (state->endmant[i] + grp_size - 4) / grp_size; - state->fbw_expbap[i].exp[0] = bitstream_get (state, 4); - if (parse_exponents (state, chexpstr[i], nchgrps, - state->fbw_expbap[i].exp[0], - state->fbw_expbap[i].exp + 1)) - return 1; - bitstream_get (state, 2); /* gainrng */ - } - if (lfeexpstr != EXP_REUSE) { - do_bit_alloc |= 32; - state->lfe_expbap.exp[0] = bitstream_get (state, 4); - if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0], - state->lfe_expbap.exp + 1)) - return 1; - } - - if (bitstream_get (state, 1)) { /* baie */ - do_bit_alloc = -1; - state->bai = bitstream_get (state, 11); - } - if (bitstream_get (state, 1)) { /* snroffste */ - do_bit_alloc = -1; - state->csnroffst = bitstream_get (state, 6); - if (state->chincpl) /* cplinu */ - state->cplba.bai = bitstream_get (state, 7); - for (i = 0; i < nfchans; i++) - state->ba[i].bai = bitstream_get (state, 7); - if (state->lfeon) - state->lfeba.bai = bitstream_get (state, 7); - } - if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */ - do_bit_alloc |= 64; - state->cplfleak = 9 - bitstream_get (state, 3); - state->cplsleak = 9 - bitstream_get (state, 3); - } - - if (bitstream_get (state, 1)) { /* deltbaie */ - do_bit_alloc = -1; - if (state->chincpl) /* cplinu */ - state->cplba.deltbae = bitstream_get (state, 2); - for (i = 0; i < nfchans; i++) - state->ba[i].deltbae = bitstream_get (state, 2); - if (state->chincpl && /* cplinu */ - (state->cplba.deltbae == DELTA_BIT_NEW) && - parse_deltba (state, state->cplba.deltba)) - return 1; - for (i = 0; i < nfchans; i++) - if ((state->ba[i].deltbae == DELTA_BIT_NEW) && - parse_deltba (state, state->ba[i].deltba)) - return 1; - } - - if (do_bit_alloc) { - if (zero_snr_offsets (nfchans, state)) { - memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap)); - for (i = 0; i < nfchans; i++) - memset (state->fbw_expbap[i].bap, 0, - sizeof (state->fbw_expbap[i].bap)); - memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap)); - } else { - if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */ - a52_bit_allocate (state, &state->cplba, state->cplstrtbnd, - state->cplstrtmant, state->cplendmant, - state->cplfleak << 8, state->cplsleak << 8, - &state->cpl_expbap); - for (i = 0; i < nfchans; i++) - if (do_bit_alloc & (1 << i)) - a52_bit_allocate (state, state->ba + i, 0, 0, - state->endmant[i], 0, 0, - state->fbw_expbap +i); - if (state->lfeon && (do_bit_alloc & 32)) { - state->lfeba.deltbae = DELTA_BIT_NONE; - a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0, - &state->lfe_expbap); - } - } - } - - if (bitstream_get (state, 1)) { /* skiple */ - i = bitstream_get (state, 9); /* skipl */ - while (i--) - bitstream_get (state, 8); - } - - samples = state->samples; - if (state->output & A52_LFE) - samples += 256; /* shift for LFE channel */ - - chanbias = a52_downmix_coeff (coeff, state->acmod, state->output, - state->dynrng, state->clev, state->slev); - - quantizer.q1_ptr = quantizer.q2_ptr = quantizer.q4_ptr = -1; - done_cpl = 0; - - for (i = 0; i < nfchans; i++) { - int j; - - coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quantizer, - coeff[i], dithflag[i], state->endmant[i]); - - if ((state->chincpl >> i) & 1) { - if (!done_cpl) { - done_cpl = 1; - coeff_get_coupling (state, nfchans, coeff, - (sample_t (*)[256])samples, &quantizer, - dithflag); - } - j = state->cplendmant; - } else - j = state->endmant[i]; - do - (samples + 256 * i)[j] = 0; - while (++j < 256); - } - - if (state->acmod == 2) { - int j, end, band, rematflg; - - end = ((state->endmant[0] < state->endmant[1]) ? - state->endmant[0] : state->endmant[1]); - - i = 0; - j = 13; - rematflg = state->rematflg; - do { - if (! (rematflg & 1)) { - rematflg >>= 1; - j = rematrix_band[i++]; - continue; - } - rematflg >>= 1; - band = rematrix_band[i++]; - if (band > end) - band = end; - do { - sample_t tmp0, tmp1; - - tmp0 = samples[j]; - tmp1 = (samples+256)[j]; - samples[j] = tmp0 + tmp1; - (samples+256)[j] = tmp0 - tmp1; - } while (++j < band); - } while (j < end); - } - - if (state->lfeon) { - if (state->output & A52_LFE) { - coeff_get (state, samples - 256, &state->lfe_expbap, &quantizer, - state->dynrng, 0, 7); - for (i = 7; i < 256; i++) - (samples-256)[i] = 0; - a52_imdct_512 (samples - 256, samples + 1536 - 256, state->bias); - } else { - /* just skip the LFE coefficients */ - coeff_get (state, samples + 1280, &state->lfe_expbap, &quantizer, - 0, 0, 7); - } - } - - i = 0; - if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans) - for (i = 1; i < nfchans; i++) - if (blksw[i] != blksw[0]) - break; - - if (i < nfchans) { - if (state->downmixed) { - state->downmixed = 0; - a52_upmix (samples + 1536, state->acmod, state->output); - } - - for (i = 0; i < nfchans; i++) { - sample_t bias; - - bias = 0; - if (!(chanbias & (1 << i))) - bias = state->bias; - - if (coeff[i]) { - if (blksw[i]) - a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, - bias); - else - a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, - bias); - } else { - int j; - - for (j = 0; j < 256; j++) - (samples + 256 * i)[j] = bias; - } - } - - a52_downmix (samples, state->acmod, state->output, state->bias, - state->clev, state->slev); - } else { - nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK]; - - a52_downmix (samples, state->acmod, state->output, 0, - state->clev, state->slev); - - if (!state->downmixed) { - state->downmixed = 1; - a52_downmix (samples + 1536, state->acmod, state->output, 0, - state->clev, state->slev); - } - - if (blksw[0]) - for (i = 0; i < nfchans; i++) - a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i, - state->bias); - else - for (i = 0; i < nfchans; i++) - a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i, - state->bias); - } - - return 0; -} - -void a52_free (a52_state_t * state) -{ - free (state->samples); - free (state); -} diff --git a/plugins/spu2ghz/src/3rdparty/liba52/tables.h b/plugins/spu2ghz/src/3rdparty/liba52/tables.h deleted file mode 100644 index a35543db7c..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/tables.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * tables.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -static const int8_t exp_1[128] = { - -2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 25,25,25 -}; -static const int8_t exp_2[128] = { - -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - 25,25,25 -}; -static const int8_t exp_3[128] = { - -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2, - -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2, - -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2, - -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2, - -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2, - 25,25,25 -}; - -#define Q0 ((-2 << 15) / 3.0) -#define Q1 (0) -#define Q2 ((2 << 15) / 3.0) - -static const sample_t q_1_0[32] = { - Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0, - Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1, - Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2, - 0,0,0,0,0 -}; - -static const sample_t q_1_1[32] = { - Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2, - Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2, - Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2, - 0,0,0,0,0 -}; - -static const sample_t q_1_2[32] = { - Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2, - Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2, - Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2, - 0,0,0,0,0 -}; - -#undef Q0 -#undef Q1 -#undef Q2 - -#define Q0 ((-4 << 15) / 5.0) -#define Q1 ((-2 << 15) / 5.0) -#define Q2 (0) -#define Q3 ((2 << 15) / 5.0) -#define Q4 ((4 << 15) / 5.0) - -static const sample_t q_2_0[128] = { - Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0, - Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1, - Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2, - Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3, - Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4, - 0,0,0 -}; - -static const sample_t q_2_1[128] = { - Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4, - Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4, - Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4, - Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4, - Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4, - 0,0,0 -}; - -static const sample_t q_2_2[128] = { - Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4, - Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4, - Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4, - Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4, - Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4, - 0,0,0 -}; - -#undef Q0 -#undef Q1 -#undef Q2 -#undef Q3 -#undef Q4 - -static const sample_t q_3[8] = { - (-6 << 15)/7.0, (-4 << 15)/7.0, (-2 << 15)/7.0, 0, - ( 2 << 15)/7.0, ( 4 << 15)/7.0, ( 6 << 15)/7.0, 0 -}; - -#define Q0 ((-10 << 15) / 11.0) -#define Q1 ((-8 << 15) / 11.0) -#define Q2 ((-6 << 15) / 11.0) -#define Q3 ((-4 << 15) / 11.0) -#define Q4 ((-2 << 15) / 11.0) -#define Q5 (0) -#define Q6 ((2 << 15) / 11.0) -#define Q7 ((4 << 15) / 11.0) -#define Q8 ((6 << 15) / 11.0) -#define Q9 ((8 << 15) / 11.0) -#define QA ((10 << 15) / 11.0) - -static const sample_t q_4_0[128] = { - Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, - Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, - Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, - Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, - Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, - Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, - Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, - Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, - Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, - Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, - QA, QA, QA, QA, QA, QA, QA, QA, QA, QA, QA, - 0, 0, 0, 0, 0, 0, 0 -}; - -static const sample_t q_4_1[128] = { - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA, - 0, 0, 0, 0, 0, 0, 0 -}; - -#undef Q0 -#undef Q1 -#undef Q2 -#undef Q3 -#undef Q4 -#undef Q5 -#undef Q6 -#undef Q7 -#undef Q8 -#undef Q9 -#undef QA - -static const sample_t q_5[16] = { - (-14 << 15)/15.0,(-12 << 15)/15.0,(-10 << 15)/15.0, - ( -8 << 15)/15.0,( -6 << 15)/15.0,( -4 << 15)/15.0, - ( -2 << 15)/15.0, 0 ,( 2 << 15)/15.0, - ( 4 << 15)/15.0,( 6 << 15)/15.0,( 8 << 15)/15.0, - ( 10 << 15)/15.0,( 12 << 15)/15.0,( 14 << 15)/15.0, - 0 -}; - -static const sample_t scale_factor[25] = { - 0.000030517578125, - 0.0000152587890625, - 0.00000762939453125, - 0.000003814697265625, - 0.0000019073486328125, - 0.00000095367431640625, - 0.000000476837158203125, - 0.0000002384185791015625, - 0.00000011920928955078125, - 0.000000059604644775390625, - 0.0000000298023223876953125, - 0.00000001490116119384765625, - 0.000000007450580596923828125, - 0.0000000037252902984619140625, - 0.00000000186264514923095703125, - 0.000000000931322574615478515625, - 0.0000000004656612873077392578125, - 0.00000000023283064365386962890625, - 0.000000000116415321826934814453125, - 0.0000000000582076609134674072265625, - 0.00000000002910383045673370361328125, - 0.000000000014551915228366851806640625, - 0.0000000000072759576141834259033203125, - 0.00000000000363797880709171295166015625, - 0.000000000001818989403545856475830078125 -}; - -static const uint16_t dither_lut[256] = { - 0x0000, 0xa011, 0xe033, 0x4022, 0x6077, 0xc066, 0x8044, 0x2055, - 0xc0ee, 0x60ff, 0x20dd, 0x80cc, 0xa099, 0x0088, 0x40aa, 0xe0bb, - 0x21cd, 0x81dc, 0xc1fe, 0x61ef, 0x41ba, 0xe1ab, 0xa189, 0x0198, - 0xe123, 0x4132, 0x0110, 0xa101, 0x8154, 0x2145, 0x6167, 0xc176, - 0x439a, 0xe38b, 0xa3a9, 0x03b8, 0x23ed, 0x83fc, 0xc3de, 0x63cf, - 0x8374, 0x2365, 0x6347, 0xc356, 0xe303, 0x4312, 0x0330, 0xa321, - 0x6257, 0xc246, 0x8264, 0x2275, 0x0220, 0xa231, 0xe213, 0x4202, - 0xa2b9, 0x02a8, 0x428a, 0xe29b, 0xc2ce, 0x62df, 0x22fd, 0x82ec, - 0x8734, 0x2725, 0x6707, 0xc716, 0xe743, 0x4752, 0x0770, 0xa761, - 0x47da, 0xe7cb, 0xa7e9, 0x07f8, 0x27ad, 0x87bc, 0xc79e, 0x678f, - 0xa6f9, 0x06e8, 0x46ca, 0xe6db, 0xc68e, 0x669f, 0x26bd, 0x86ac, - 0x6617, 0xc606, 0x8624, 0x2635, 0x0660, 0xa671, 0xe653, 0x4642, - 0xc4ae, 0x64bf, 0x249d, 0x848c, 0xa4d9, 0x04c8, 0x44ea, 0xe4fb, - 0x0440, 0xa451, 0xe473, 0x4462, 0x6437, 0xc426, 0x8404, 0x2415, - 0xe563, 0x4572, 0x0550, 0xa541, 0x8514, 0x2505, 0x6527, 0xc536, - 0x258d, 0x859c, 0xc5be, 0x65af, 0x45fa, 0xe5eb, 0xa5c9, 0x05d8, - 0xae79, 0x0e68, 0x4e4a, 0xee5b, 0xce0e, 0x6e1f, 0x2e3d, 0x8e2c, - 0x6e97, 0xce86, 0x8ea4, 0x2eb5, 0x0ee0, 0xaef1, 0xeed3, 0x4ec2, - 0x8fb4, 0x2fa5, 0x6f87, 0xcf96, 0xefc3, 0x4fd2, 0x0ff0, 0xafe1, - 0x4f5a, 0xef4b, 0xaf69, 0x0f78, 0x2f2d, 0x8f3c, 0xcf1e, 0x6f0f, - 0xede3, 0x4df2, 0x0dd0, 0xadc1, 0x8d94, 0x2d85, 0x6da7, 0xcdb6, - 0x2d0d, 0x8d1c, 0xcd3e, 0x6d2f, 0x4d7a, 0xed6b, 0xad49, 0x0d58, - 0xcc2e, 0x6c3f, 0x2c1d, 0x8c0c, 0xac59, 0x0c48, 0x4c6a, 0xec7b, - 0x0cc0, 0xacd1, 0xecf3, 0x4ce2, 0x6cb7, 0xcca6, 0x8c84, 0x2c95, - 0x294d, 0x895c, 0xc97e, 0x696f, 0x493a, 0xe92b, 0xa909, 0x0918, - 0xe9a3, 0x49b2, 0x0990, 0xa981, 0x89d4, 0x29c5, 0x69e7, 0xc9f6, - 0x0880, 0xa891, 0xe8b3, 0x48a2, 0x68f7, 0xc8e6, 0x88c4, 0x28d5, - 0xc86e, 0x687f, 0x285d, 0x884c, 0xa819, 0x0808, 0x482a, 0xe83b, - 0x6ad7, 0xcac6, 0x8ae4, 0x2af5, 0x0aa0, 0xaab1, 0xea93, 0x4a82, - 0xaa39, 0x0a28, 0x4a0a, 0xea1b, 0xca4e, 0x6a5f, 0x2a7d, 0x8a6c, - 0x4b1a, 0xeb0b, 0xab29, 0x0b38, 0x2b6d, 0x8b7c, 0xcb5e, 0x6b4f, - 0x8bf4, 0x2be5, 0x6bc7, 0xcbd6, 0xeb83, 0x4b92, 0x0bb0, 0xaba1 -}; diff --git a/plugins/spu2ghz/src/3rdparty/liba52/tendra.h b/plugins/spu2ghz/src/3rdparty/liba52/tendra.h deleted file mode 100644 index 41f825a8d6..0000000000 --- a/plugins/spu2ghz/src/3rdparty/liba52/tendra.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * tendra.h - * Copyright (C) 2000-2002 Michel Lespinasse - * Copyright (C) 1999-2000 Aaron Holtzman - * - * This file is part of a52dec, a free ATSC A-52 stream decoder. - * See http://liba52.sourceforge.net/ for updates. - * - * a52dec 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. - * - * a52dec 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#pragma TenDRA begin -#pragma TenDRA longlong type warning - -#ifdef TenDRA_check - -#pragma TenDRA conversion analysis (pointer-int explicit) off -#pragma TenDRA implicit function declaration off - -/* avoid the "No declarations in translation unit" problem */ -int TenDRA; - -#endif /* TenDRA_check */ diff --git a/plugins/spu2ghz/src/Win32/SPU2ghz.def b/plugins/spu2ghz/src/Win32/SPU2ghz.def deleted file mode 100644 index d304b8fe49..0000000000 --- a/plugins/spu2ghz/src/Win32/SPU2ghz.def +++ /dev/null @@ -1,57 +0,0 @@ -;GiGaHeRz's SPU2 Driver -;Copyright (c) David Quintana (gigaherz@gmail.com) -; -;This library is free software; you can redistribute it and/or -;modify it under the terms of the GNU Lesser General Public -;License as published by the Free Software Foundation; either -;version 2.1 of the License, or (at your option) any later version. -; -;This library 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 -;Lesser General Public License for more details. -; -;You should have received a copy of the GNU Lesser General Public -;License along with this library; if not, write to the Free Software -;Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -; -; SPU2ghz.def : Declares the module parameters for the DLL. - -;LIBRARY "SPU2ghz" - -EXPORTS - ; Explicit exports can go here - PS2EgetLibType @2 - PS2EgetLibName @3 - PS2EgetLibVersion2 @4 - SPU2init @5 - SPU2shutdown @6 - SPU2open @7 - SPU2close @8 - SPU2write @9 - SPU2read @10 - SPU2readDMA4Mem @11 - SPU2writeDMA4Mem @12 - SPU2readDMA7Mem @13 - SPU2writeDMA7Mem @14 - SPU2async @15 - SPU2interruptDMA4 @16 - SPU2interruptDMA7 @17 - SPU2irqCallback @18 - - SPU2setupRecording @19 - - SPU2configure @20 - SPU2test @21 - SPU2about @22 - - SPU2ReadMemAddr @23 - SPU2WriteMemAddr @24 - - SPU2setClockPtr @25 - - SPU2setDMABaseAddr @26 - - SPU2replay = s2r_replay @27 - - SPU2freeze @28 \ No newline at end of file diff --git a/plugins/spu2ghz/src/Win32/SPU2ghz.rc b/plugins/spu2ghz/src/Win32/SPU2ghz.rc deleted file mode 100644 index 9075810e93..0000000000 --- a/plugins/spu2ghz/src/Win32/SPU2ghz.rc +++ /dev/null @@ -1,266 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxresmw.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Spanish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) -#ifdef _WIN32 -LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxresmw.h""\r\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONFIG DIALOGEX 3, 1, 410, 237 -STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "SPU2ghz Settings" -FONT 8, "MS Sans Serif", 0, 0, 0x0 -BEGIN - PUSHBUTTON "OK",IDOK,291,219,54,15,NOT WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,351,219,54,15,NOT WS_TABSTOP - GROUPBOX "Mixing Settings",IDC_STATIC,6,6,119,116 - GROUPBOX "Speed Limiter (obsolete)",IDC_STATIC,6,127,120,98 - GROUPBOX "Output Settings",IDC_STATIC,132,6,119,182 - GROUPBOX "",IDC_DEBUG_GROUP,257,7,148,208 - GROUPBOX "",IDC_STATIC,264,19,135,85 - GROUPBOX "Logging",IDC_STATIC,264,107,136,50 - GROUPBOX "Dumps (on close)",IDC_STATIC,264,160,135,49 - COMBOBOX IDC_OUTPUT,138,27,108,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Configure...",IDC_OUTCONF,198,42,48,12 - COMBOBOX IDC_INTERPOLATE,12,28,108,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Enable at start-up",IDC_SPEEDLIMIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,176,106,12 - COMBOBOX IDC_SRATE,188,62,58,201,CBS_DROPDOWN | WS_DISABLED | WS_TABSTOP,WS_EX_RIGHT - CONTROL "Slider2",IDC_LATENCY_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,177,94,72,10 - CONTROL "Use Time-stretching",IDC_TS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,114,79,11 - CONTROL "Use a Winamp DSP plugin",IDC_DSP_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,160,103,11 - CHECKBOX "Enable Debug Options",IDC_DEBUG,264,7,87,10,NOT WS_TABSTOP - CONTROL "Show In Console",IDC_MSGSHOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,19,69,10 - CHECKBOX "KeyOn/Off Events",IDC_MSGKEY,276,31,74,10,NOT WS_TABSTOP - CONTROL "Voice Stop Events",IDC_MSGVOICE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,43,75,10 - CONTROL "DMA Operations",IDC_MSGDMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,55,68,10 - CONTROL "AutoDMA Operations",IDC_MSGADMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,283,67,83,10 - CONTROL "Buffer Over/Underruns",IDC_DBG_OVERRUNS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,79,97,11 - CONTROL "ADPCM Cache Statistics",IDC_DBG_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,276,91,114,9 - CHECKBOX "Dump Core and Voice State",IDC_DUMPCORE,270,172,104,10,NOT WS_TABSTOP - CHECKBOX "Dump Memory Contents",IDC_DUMPMEM,270,184,91,10,NOT WS_TABSTOP - CHECKBOX "Dump Register Data",IDC_DUMPREGS,270,196,80,10,NOT WS_TABSTOP - CHECKBOX "Enable Effects Processing",IDC_EFFECTS,12,49,99,10,WS_DISABLED | NOT WS_TABSTOP - LTEXT "Latency:",IDC_STATIC,138,89,33,8,NOT WS_GROUP - LTEXT "Sample Rate:",IDC_STATIC,137,63,44,8,NOT WS_GROUP - LTEXT "Interpolation:",IDC_STATIC,12,18,42,10,NOT WS_GROUP - LTEXT "Module:",IDC_STATIC,138,17,50,9,NOT WS_GROUP - LTEXT "Not working yet, disabled for now.",IDC_STATIC,24,61,96,17 - LTEXT "(configure in the .ini)",IDC_STATIC,150,172,64,8 - LTEXT "Uses the SPU2 to limit framerate for games that cause buffer overruns. Use Timestretching instead.",IDC_STATIC,11,138,109,34 - CTEXT "100 ms (avg)",IDC_LATENCY_LABEL,185,84,58,10 - LTEXT "Helps reduce latency and usually eliminates audio skips. Uses a little extra CPU.",IDC_STATIC,150,127,96,25 - CHECKBOX "Log Register/DMA Actions",IDC_LOGREGS,269,119,101,10,WS_GROUP | NOT WS_TABSTOP - CHECKBOX "Log DMA Writes",IDC_LOGDMA,269,131,68,10,NOT WS_TABSTOP - CHECKBOX "Log Audio Output",IDC_LOGWAVE,269,143,71,10,NOT WS_TABSTOP - CONTROL "Enable runtime toggle",IDC_SPEEDLIMIT_RUNTIME_TOGGLE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,190,110,10 - LTEXT "Allows speed limiter to be toggled with the minus (-) key.",IDC_STATIC,23,202,95,17 - CONTROL "Volume Boost",IDC_VOLBOOST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,86,85,11 - LTEXT "Can break sound in games that are already loud.",IDC_STATIC,24,99,96,17 -END - -IDD_DEBUG DIALOGEX 0, 0, 326, 525 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "SPU2ghz Debug" -FONT 9, "Lucida Console", 400, 0, 0x0 -BEGIN - DEFPUSHBUTTON "Close",IDOK,269,504,50,14 -END - -IDD_DSOUND DIALOGEX 0, 0, 170, 122 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "DirectSound Output Module Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,52,104,50,14 - PUSHBUTTON "Cancel",IDCANCEL,115,104,50,14 - COMBOBOX IDC_DS_DEVICE,4,15,161,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "DirectSound Device",IDC_STATIC,4,3,63,8 - LTEXT "Number of Buffers",IDC_STATIC,4,40,61,11 - CONTROL "",IDC_BUFFERS_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,71,48,94,10 - LTEXT "Use extra buffers if you are experiencing loopy or studdery audio even when games run at high FPS.",IDC_STATIC,8,66,151,27 - CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,70,37,95,11 -END - -IDD_DSOUND51 DIALOGEX 0, 0, 336, 180 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "DirectSound 5.1 Output Module Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,228,161,50,14 - PUSHBUTTON "Cancel",IDCANCEL,281,161,50,14 - COMBOBOX IDC_DS_DEVICE,5,17,142,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "DirectSound Device",IDC_STATIC,5,5,63,8 - CONTROL "",IDC_LEFT_GAIN_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,15,53,30,36 - CONTROL "",IDC_CENTER_GAIN_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,57,54,30,34 - CONTROL "",IDC_RIGHT_GAIN_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,99,54,30,34 - GROUPBOX "Surround Volume Correction",IDC_STATIC,5,35,138,139 - CTEXT "Center",IDC_STATIC,50,46,42,8 - CTEXT "Left",IDC_STATIC,8,46,42,8 - CTEXT "Right",IDC_STATIC,92,46,42,8 - CONTROL "",IDC_RLEFT_GAIN_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,15,115,30,40 - CONTROL "",IDC_LFE_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,57,115,30,40 - CONTROL "",IDC_RRIGHT_GAIN_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,99,115,30,40 - CTEXT "LFE (sub)",IDC_STATIC,51,107,42,8 - CTEXT "Rear Left",IDC_STATIC,9,107,42,8 - CTEXT "Rear Right",IDC_STATIC,93,107,42,8 - GROUPBOX "Other Tweaks",IDC_STATIC,153,77,63,97 - CONTROL "",IDC_LR_CENTER_SLIDER,"msctls_trackbar32",TBS_VERT | TBS_BOTH | WS_TABSTOP,169,99,30,49 - CTEXT "Center in LR",IDC_STATIC,163,90,42,8 - EDITTEXT IDC_LEFT_GAIN_EDIT,15,88,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_CENTER_GAIN_EDIT,57,88,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_RIGHT_GAIN_EDIT,99,88,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_RLEFT_GAIN_EDIT,15,155,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_LFE_EDIT,57,155,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_RRIGHT_GAIN_EDIT,99,155,30,14,ES_AUTOHSCROLL - EDITTEXT IDC_LR_CENTER_EDIT,169,151,30,14,ES_AUTOHSCROLL - LTEXT "Number of Buffers",IDC_STATIC,160,32,61,11 - CONTROL "",IDC_BUFFERS_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,229,40,94,10 - LTEXT "Use extra buffers if you are experiencing loopy or studdery audio even when games run at high FPS.",IDC_STATIC,226,69,102,46 - CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL2,227,29,95,11 - GROUPBOX "Latency",IDC_STATIC,154,13,174,48 -END - -IDD_ASIO DIALOGEX 0, 0, 186, 58 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ASIO Output Module Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,75,37,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,37,50,14 - COMBOBOX IDC_DS_DEVICE,7,17,172,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "ASIO Driver",IDC_STATIC,7,7,39,8 -END - -IDD_WAVEOUT DIALOGEX 0, 0, 170, 122 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "waveOut Output Module Settings" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,52,104,50,14 - PUSHBUTTON "Cancel",IDCANCEL,115,104,50,14 - COMBOBOX IDC_DS_DEVICE,4,15,161,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "waveOut Device",IDC_STATIC,4,3,54,8 - LTEXT "Number of Buffers",IDC_STATIC,4,39,61,11 - CONTROL "",IDC_BUFFERS_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,71,48,94,10 - LTEXT "Use extra buffers if you are experiencing loopy or studdery audio even when games run at high FPS.",IDC_STATIC,8,66,151,27 - CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,70,37,95,11 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 6 - RIGHTMARGIN, 405 - BOTTOMMARGIN, 234 - END - - IDD_DEBUG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 319 - TOPMARGIN, 7 - BOTTOMMARGIN, 518 - END - - IDD_DSOUND, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 165 - TOPMARGIN, 3 - BOTTOMMARGIN, 118 - END - - IDD_DSOUND51, DIALOG - BEGIN - LEFTMARGIN, 5 - RIGHTMARGIN, 331 - TOPMARGIN, 5 - BOTTOMMARGIN, 175 - END - - IDD_ASIO, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 51 - END - - IDD_WAVEOUT, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 165 - TOPMARGIN, 3 - BOTTOMMARGIN, 118 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Spanish resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/spu2ghz/src/Win32/SPU2ghz_vs2008.vcproj b/plugins/spu2ghz/src/Win32/SPU2ghz_vs2008.vcproj deleted file mode 100644 index 8a839e8e79..0000000000 --- a/plugins/spu2ghz/src/Win32/SPU2ghz_vs2008.vcproj +++ /dev/null @@ -1,1099 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/spu2ghz/src/Win32/afxresmw.h b/plugins/spu2ghz/src/Win32/afxresmw.h deleted file mode 100644 index b0078b1dfb..0000000000 --- a/plugins/spu2ghz/src/Win32/afxresmw.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include - -#define IDC_STATIC (-1) diff --git a/plugins/spu2ghz/src/Win32/config.cpp b/plugins/spu2ghz/src/Win32/config.cpp deleted file mode 100644 index 35dbed8505..0000000000 --- a/plugins/spu2ghz/src/Win32/config.cpp +++ /dev/null @@ -1,618 +0,0 @@ -///GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "spu2.h" -#include "dialogs.h" -// Config Vars - - -static bool VolumeBoostEnabled = false; -static int VolumeShiftModifier = 0; - -#ifndef PUBLIC -static const int LATENCY_MAX = 2000; -#else -static const int LATENCY_MAX = 500; -#endif - -static const int LATENCY_MIN = 40; - - -// DEBUG - -bool DebugEnabled=false; -bool _MsgToConsole=false; -bool _MsgKeyOnOff=false; -bool _MsgVoiceOff=false; -bool _MsgDMA=false; -bool _MsgAutoDMA=false; -bool _MsgOverruns=false; -bool _MsgCache=false; - -bool _AccessLog=false; -bool _DMALog=false; -bool _WaveLog=false; - -bool _CoresDump=false; -bool _MemDump=false; -bool _RegDump=false; - - - -char AccessLogFileName[255]; -char WaveLogFileName[255]; - -char DMA4LogFileName[255]; -char DMA7LogFileName[255]; - -char CoresDumpFileName[255]; -char MemDumpFileName[255]; -char RegDumpFileName[255]; - -int WaveDumpFormat; - -int AutoDMAPlayRate[2]={0,0}; - -// MIXING -int Interpolation=1; -/* values: - 0: no interpolation (use nearest) - 1. linear interpolation - 2. cubic interpolation -*/ - -bool EffectsEnabled=false; - -// OUTPUT -int SampleRate=48000; -int SndOutLatencyMS=160; -//int SndOutLatency=1024; -//int MaxBufferCount=8; -//int CurBufferCount=MaxBufferCount; -bool timeStretchEnabled=true; - -u32 OutputModule=0; //OUTPUT_DSOUND; - -//int VolumeMultiplier=1; -//int VolumeDivisor=1; - -int LimitMode=0; -/* values: - 0. No limiter - 1. Soft limiter -- less cpu-intensive, but can cause problems - 2. Hard limiter -- more cpu-intensive while limiting, but should give better (constant) speeds -*/ - - -CONFIG_DSOUNDOUT Config_DSoundOut; -CONFIG_DSOUND51 Config_DSound51; -CONFIG_WAVEOUT Config_WaveOut; - -// MISC -bool LimiterToggleEnabled=false; -int LimiterToggle=VK_SUBTRACT; - -// DSP -bool dspPluginEnabled=false; -char dspPlugin[256]; -int dspPluginModule=0; - -// OUTPUT MODULES -char AsioDriver[129]=""; - - -////// - -const char NewCfgFile[]="inis\\SPU2Ghz-v2.ini"; -const char LegacyCfgFile[]="inis\\SPU2Ghz.ini"; -const char* CfgFile=NewCfgFile; - - - /*| Config File Format: |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*\ -+--+---------------------+------------------------+ -| | -| Option=Value | -| | -| | -| Boolean Values: TRUE,YES,1,T,Y mean 'true', | -| everything else means 'false'. | -| | -| All Values are limited to 255 chars. | -| | -+-------------------------------------------------+ - \*_____________________________________________*/ - - -void CfgWriteBool(const char *Section, const char*Name, bool Value) { - char *Data=Value?"TRUE":"FALSE"; - - WritePrivateProfileString(Section,Name,Data,CfgFile); -} - -void CfgWriteInt(const char *Section, const char*Name, int Value) { - char Data[255]; - _itoa(Value,Data,10); - - WritePrivateProfileString(Section,Name,Data,CfgFile); -} - -void CfgWriteStr(const char *Section, const char* Name, const char *Data) { - WritePrivateProfileString(Section,Name,Data,CfgFile); -} - -/*****************************************************************************/ - -bool CfgReadBool(const char *Section,const char *Name,bool Default) { - char Data[255]=""; - GetPrivateProfileString(Section,Name,"",Data,255,CfgFile); - Data[254]=0; - if(strlen(Data)==0) { - CfgWriteBool(Section,Name,Default); - return Default; - } - - if(strcmp(Data,"1")==0) return true; - if(strcmp(Data,"Y")==0) return true; - if(strcmp(Data,"T")==0) return true; - if(strcmp(Data,"YES")==0) return true; - if(strcmp(Data,"TRUE")==0) return true; - return false; -} - - -int CfgReadInt(const char *Section, const char*Name,int Default) { - char Data[255]=""; - GetPrivateProfileString(Section,Name,"",Data,255,CfgFile); - Data[254]=0; - - if(strlen(Data)==0) { - CfgWriteInt(Section,Name,Default); - return Default; - } - - return atoi(Data); -} - - -void CfgReadStr(const char *Section, const char* Name, char *Data, int DataSize, const char *Default) { - GetPrivateProfileString(Section,Name,"",Data,DataSize,CfgFile); - - if(strlen(Data)==0) { - sprintf_s( Data, DataSize, "%s", Default ); - CfgWriteStr(Section,Name,Data); - } -} - -// Tries to read the requested value. -// Returns FALSE if the value isn't found. -bool CfgFindName( const char *Section, const char* Name) -{ - // Only load 24 characters. No need to load more. - char Data[24]=""; - GetPrivateProfileString(Section,Name,"",Data,24,CfgFile); - Data[23]=0; - - if(strlen(Data)==0) return false; - return true; -} -/*****************************************************************************/ - -void ReadSettings() -{ - DebugEnabled=CfgReadBool("DEBUG","Global_Debug_Enabled",0); - _MsgToConsole=CfgReadBool("DEBUG","Show_Messages",0); - _MsgKeyOnOff =CfgReadBool("DEBUG","Show_Messages_Key_On_Off",0); - _MsgVoiceOff =CfgReadBool("DEBUG","Show_Messages_Voice_Off",0); - _MsgDMA =CfgReadBool("DEBUG","Show_Messages_DMA_Transfer",0); - _MsgAutoDMA =CfgReadBool("DEBUG","Show_Messages_AutoDMA",0); - _MsgOverruns =CfgReadBool("DEBUG","Show_Messages_Overruns",0); - _MsgCache =CfgReadBool("DEBUG","Show_Messages_CacheStats",0); - - _AccessLog =CfgReadBool("DEBUG","Log_Register_Access",0); - _DMALog =CfgReadBool("DEBUG","Log_DMA_Transfers",0); - _WaveLog =CfgReadBool("DEBUG","Log_WAVE_Output",0); - - _CoresDump =CfgReadBool("DEBUG","Dump_Info",0); - _MemDump =CfgReadBool("DEBUG","Dump_Memory",0); - _RegDump =CfgReadBool("DEBUG","Dump_Regs",0); - - CfgReadStr("DEBUG","Access_Log_Filename",AccessLogFileName,255,"logs\\SPU2Log.txt"); - CfgReadStr("DEBUG","WaveLog_Filename", WaveLogFileName, 255,"logs\\SPU2log.wav"); - CfgReadStr("DEBUG","DMA4Log_Filename", DMA4LogFileName, 255,"logs\\SPU2dma4.dat"); - CfgReadStr("DEBUG","DMA7Log_Filename", DMA7LogFileName, 255,"logs\\SPU2dma7.dat"); - - CfgReadStr("DEBUG","Info_Dump_Filename",CoresDumpFileName,255,"logs\\SPU2Cores.txt"); - CfgReadStr("DEBUG","Mem_Dump_Filename", MemDumpFileName, 255,"logs\\SPU2mem.dat"); - CfgReadStr("DEBUG","Reg_Dump_Filename", RegDumpFileName, 255,"logs\\SPU2regs.dat"); - - WaveDumpFormat=CfgReadInt("DEBUG","Wave_Log_Format",0); - - - AutoDMAPlayRate[0]=CfgReadInt("MIXING","AutoDMA_Play_Rate_0",0); - AutoDMAPlayRate[1]=CfgReadInt("MIXING","AutoDMA_Play_Rate_1",0); - - Interpolation=CfgReadInt("MIXING","Interpolation",1); - - // Moved Timestretch from DSP to Output - timeStretchEnabled = CfgReadBool( - CfgFindName( "OUTPUT", "Timestretch_Enable" ) ? "OUTPUT" : "DSP", - "Timestretch_Enable", true - ); - - // Moved Effects_Enable from Effects to Mixing - EffectsEnabled = CfgReadBool( - CfgFindName( "MIXING", "Enable_Effects" ) ? "MIXING" : "EFFECTS", - "Enable_Effects", false - ); - EffectsEnabled = false; // force disabled for now. - - SampleRate=CfgReadInt("OUTPUT","Sample_Rate",48000); - SndOutLatencyMS=CfgReadInt("OUTPUT","Latency", 160); - - //OutputModule = CfgReadInt("OUTPUT","Output_Module", OUTPUT_DSOUND ); - char omodid[128]; - CfgReadStr( "OUTPUT", "Output_Module", omodid, 127, XAudio2Out->GetIdent() ); - - // find the driver index of this module: - OutputModule = FindOutputModuleById( omodid ); - - VolumeShiftModifier = CfgReadInt( "OUTPUT","Volume_Shift", 0 ); - LimitMode=CfgReadInt("OUTPUT","Speed_Limit_Mode",0); - - CfgReadStr("DSP PLUGIN","Filename",dspPlugin,255,""); - dspPluginModule = CfgReadInt("DSP PLUGIN","ModuleNum",0); - dspPluginEnabled= CfgReadBool("DSP PLUGIN","Enabled",false); - - LimiterToggleEnabled = CfgReadBool("KEYS","Limiter_Toggle_Enabled",false); - LimiterToggle = CfgReadInt ("KEYS","Limiter_Toggle",VK_SUBTRACT); - - // Read DSOUNDOUT and WAVEOUT configs: - CfgReadStr( "DSOUNDOUT", "Device", Config_DSoundOut.Device, 254, "default" ); - CfgReadStr( "WAVEOUT", "Device", Config_WaveOut.Device, 254, "default" ); - Config_DSoundOut.NumBuffers = CfgReadInt( "DSOUNDOUT", "Buffer_Count", 5 ); - Config_WaveOut.NumBuffers = CfgReadInt( "WAVEOUT", "Buffer_Count", 4 ); - - // Read DSOUND51 config: - CfgReadStr( "DSOUND51", "Device", Config_DSound51.Device, 254, "default" ); - Config_DSound51.NumBuffers = CfgReadInt( "DSOUND51", "Buffer_Count", 5 ); - Config_DSound51.GainL =CfgReadInt("DSOUND51","Channel_Gain_L", 256); - Config_DSound51.GainR =CfgReadInt("DSOUND51","Channel_Gain_R", 256); - Config_DSound51.GainC =CfgReadInt("DSOUND51","Channel_Gain_C", 256); - Config_DSound51.GainLFE=CfgReadInt("DSOUND51","Channel_Gain_LFE",256); - Config_DSound51.GainSL =CfgReadInt("DSOUND51","Channel_Gain_SL", 200); - Config_DSound51.GainSR =CfgReadInt("DSOUND51","Channel_Gain_SR", 200); - Config_DSound51.AddCLR =CfgReadInt("DSOUND51","Channel_Center_In_LR", 56); - Config_DSound51.LowpassLFE = CfgReadInt("DSOUND51","LFE_Lowpass_Frequency", 80); - - // Sanity Checks - // ------------- - - SampleRate = 48000; // Yup nothing else is supported for now. - VolumeShiftModifier = min( max( VolumeShiftModifier, -2 ), 2 ); - SndOutVolumeShift = SndOutVolumeShiftBase - VolumeShiftModifier; - SndOutLatencyMS = min( max( SndOutLatencyMS, LATENCY_MIN ), LATENCY_MAX ); - - Config_DSoundOut.NumBuffers = min( max( Config_DSoundOut.NumBuffers, 2 ), 8 ); - Config_WaveOut.NumBuffers = min( max( Config_DSoundOut.NumBuffers, 3 ), 8 ); - - if( mods[OutputModule] == NULL ) - { - // Unsupported or legacy module. - fprintf( stderr, " * SPU2: Unknown output module '%s' specified in configuration file.\n", omodid ); - fprintf( stderr, " * SPU2: Defaulting to DirectSound (%s).\n", DSoundOut->GetIdent() ); - OutputModule = FindOutputModuleById( DSoundOut->GetIdent() ); - } - - -} - -/*****************************************************************************/ - -void WriteSettings() -{ - CfgWriteBool("DEBUG","Global_Debug_Enabled",DebugEnabled); - - // [Air] : Commented out so that we retain debug settings even if disabled... - //if(DebugEnabled) - { - CfgWriteBool("DEBUG","Show_Messages", _MsgToConsole); - CfgWriteBool("DEBUG","Show_Messages_Key_On_Off", _MsgKeyOnOff); - CfgWriteBool("DEBUG","Show_Messages_Voice_Off", _MsgVoiceOff); - CfgWriteBool("DEBUG","Show_Messages_DMA_Transfer",_MsgDMA); - CfgWriteBool("DEBUG","Show_Messages_AutoDMA", _MsgAutoDMA); - CfgWriteBool("DEBUG","Show_Messages_Overruns", _MsgOverruns); - CfgWriteBool("DEBUG","Show_Messages_CacheStats", _MsgCache); - - CfgWriteBool("DEBUG","Log_Register_Access",_AccessLog); - CfgWriteBool("DEBUG","Log_DMA_Transfers", _DMALog); - CfgWriteBool("DEBUG","Log_WAVE_Output", _WaveLog); - - CfgWriteBool("DEBUG","Dump_Info", _CoresDump); - CfgWriteBool("DEBUG","Dump_Memory",_MemDump); - CfgWriteBool("DEBUG","Dump_Regs", _RegDump); - - CfgWriteStr("DEBUG","Access_Log_Filename",AccessLogFileName); - CfgWriteStr("DEBUG","WaveLog_Filename", WaveLogFileName); - CfgWriteStr("DEBUG","DMA4Log_Filename", DMA4LogFileName); - CfgWriteStr("DEBUG","DMA7Log_Filename", DMA7LogFileName); - - CfgWriteStr("DEBUG","Info_Dump_Filename",CoresDumpFileName); - CfgWriteStr("DEBUG","Mem_Dump_Filename", MemDumpFileName); - CfgWriteStr("DEBUG","Reg_Dump_Filename", RegDumpFileName); - - CfgWriteInt("DEBUG","Wave_Log_Format", WaveDumpFormat); - } - - CfgWriteInt("MIXING","Interpolation",Interpolation); - - CfgWriteInt("MIXING","AutoDMA_Play_Rate_0",AutoDMAPlayRate[0]); - CfgWriteInt("MIXING","AutoDMA_Play_Rate_1",AutoDMAPlayRate[1]); - - CfgWriteBool("MIXING","Enable_Effects",EffectsEnabled); - - CfgWriteStr("OUTPUT","Output_Module",mods[OutputModule]->GetIdent() ); - CfgWriteInt("OUTPUT","Sample_Rate",SampleRate); - CfgWriteInt("OUTPUT","Latency",SndOutLatencyMS); - CfgWriteBool("OUTPUT","Timestretch_Enable",timeStretchEnabled); - CfgWriteInt("OUTPUT","Speed_Limit_Mode",LimitMode); - - CfgWriteInt("OUTPUT","Volume_Shift",SndOutVolumeShiftBase - SndOutVolumeShift); - - if( strlen( Config_DSoundOut.Device ) == 0 ) strcpy( Config_DSoundOut.Device, "default" ); - if( strlen( Config_DSound51.Device ) == 0 ) strcpy( Config_DSound51.Device, "default" ); - if( strlen( Config_WaveOut.Device ) == 0 ) strcpy( Config_WaveOut.Device, "default" ); - - CfgWriteStr("DSOUNDOUT","Device",Config_DSoundOut.Device); - CfgWriteInt("DSOUNDOUT","Buffer_Count",Config_DSoundOut.NumBuffers); - - CfgWriteStr("WAVEOUT","Device",Config_WaveOut.Device); - CfgWriteInt("WAVEOUT","Buffer_Count",Config_WaveOut.NumBuffers); - - CfgWriteStr("DSOUND51","Device",Config_DSound51.Device); - CfgWriteInt("DSOUND51","Buffer_Count", Config_DSound51.NumBuffers); - CfgWriteInt("DSOUND51","Channel_Gain_L", Config_DSound51.GainL); - CfgWriteInt("DSOUND51","Channel_Gain_R", Config_DSound51.GainR); - CfgWriteInt("DSOUND51","Channel_Gain_C", Config_DSound51.GainC); - CfgWriteInt("DSOUND51","Channel_Gain_LFE",Config_DSound51.GainLFE); - CfgWriteInt("DSOUND51","Channel_Gain_SL", Config_DSound51.GainSL); - CfgWriteInt("DSOUND51","Channel_Gain_SR", Config_DSound51.GainSR); - CfgWriteInt("DSOUND51","Channel_Center_In_LR", Config_DSound51.AddCLR); - CfgWriteInt("DSOUND51","LFE_Lowpass_Frequency", Config_DSound51.LowpassLFE); - - CfgWriteStr("DSP PLUGIN","Filename",dspPlugin); - CfgWriteInt("DSP PLUGIN","ModuleNum",dspPluginModule); - CfgWriteBool("DSP PLUGIN","Enabled",dspPluginEnabled); - - CfgWriteBool("KEYS","Limiter_Toggle_Enabled",LimiterToggleEnabled); - CfgWriteInt ("KEYS","Limiter_Toggle",LimiterToggle); -} - -static void EnableDebugMessages( HWND hWnd ) -{ - ENABLE_CONTROL(IDC_MSGSHOW, DebugEnabled); - ENABLE_CONTROL(IDC_MSGKEY, MsgToConsole()); - ENABLE_CONTROL(IDC_MSGVOICE,MsgToConsole()); - ENABLE_CONTROL(IDC_MSGDMA, MsgToConsole()); - ENABLE_CONTROL(IDC_MSGADMA, MsgDMA()); - ENABLE_CONTROL(IDC_DBG_OVERRUNS, MsgToConsole()); - ENABLE_CONTROL(IDC_DBG_CACHE, MsgToConsole()); -} - -static void EnableDebugControls( HWND hWnd ) -{ - EnableDebugMessages( hWnd ); - ENABLE_CONTROL(IDC_LOGREGS, DebugEnabled); - ENABLE_CONTROL(IDC_LOGDMA, DebugEnabled); - ENABLE_CONTROL(IDC_LOGWAVE, DebugEnabled); - ENABLE_CONTROL(IDC_DUMPCORE,DebugEnabled); - ENABLE_CONTROL(IDC_DUMPMEM, DebugEnabled); - ENABLE_CONTROL(IDC_DUMPREGS,DebugEnabled); -} - -static int myWidth, myDebugWidth; -static int myHeight; -static bool debugShow = false; - -BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) -{ - int wmId,wmEvent; - char temp[384]={0}; - - switch(uMsg) - { - - case WM_PAINT: - return FALSE; - - case WM_INITDIALOG: - - // If debugging is enabled, show the debug box by default: - debugShow = DebugEnabled; - - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_RESETCONTENT,0,0); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"16000"); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"22050"); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"24000"); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"32000"); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"44100"); - SendMessage(GetDlgItem(hWnd,IDC_SRATE),CB_ADDSTRING,0,(LPARAM)"48000"); - - sprintf_s(temp,48,"%d",SampleRate); - SetDlgItemText(hWnd,IDC_SRATE,temp); - - SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_RESETCONTENT,0,0); - SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_ADDSTRING,0,(LPARAM)"0 - Nearest (none/fast)"); - SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_ADDSTRING,0,(LPARAM)"1 - Linear (recommended)"); - SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_ADDSTRING,0,(LPARAM)"2 - Cubic (better/slower)"); - SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_SETCURSEL,Interpolation,0); - - SendMessage(GetDlgItem(hWnd,IDC_OUTPUT),CB_RESETCONTENT,0,0); - - { - int modidx = 0; - while( mods[modidx] != NULL ) - { - sprintf_s( temp, 72, "%d - %s", modidx, mods[modidx]->GetLongName() ); - SendMessage(GetDlgItem(hWnd,IDC_OUTPUT),CB_ADDSTRING,0,(LPARAM)temp); - ++modidx; - } - SendMessage(GetDlgItem(hWnd,IDC_OUTPUT),CB_SETCURSEL,OutputModule,0); - } - - //INIT_SLIDER(IDC_BUFFER,512,16384,4096,2048,512); - INIT_SLIDER( IDC_LATENCY_SLIDER, LATENCY_MIN, LATENCY_MAX, 100, 20, 5 ); - - SendMessage(GetDlgItem(hWnd,IDC_LATENCY_SLIDER),TBM_SETPOS,TRUE,SndOutLatencyMS); - sprintf_s(temp,80,"%d ms (avg)",SndOutLatencyMS); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); - - EnableDebugControls( hWnd ); - - // Debugging / Logging Flags: - SET_CHECK(IDC_EFFECTS, EffectsEnabled); - SET_CHECK(IDC_DEBUG, DebugEnabled); - SET_CHECK(IDC_MSGSHOW, _MsgToConsole); - SET_CHECK(IDC_MSGKEY, _MsgKeyOnOff); - SET_CHECK(IDC_MSGVOICE,_MsgVoiceOff); - SET_CHECK(IDC_MSGDMA, _MsgDMA); - SET_CHECK(IDC_MSGADMA, _MsgAutoDMA); - SET_CHECK(IDC_DBG_OVERRUNS, _MsgOverruns ); - SET_CHECK(IDC_DBG_CACHE, _MsgCache ); - SET_CHECK(IDC_LOGREGS, _AccessLog); - SET_CHECK(IDC_LOGDMA, _DMALog); - SET_CHECK(IDC_LOGWAVE, _WaveLog); - SET_CHECK(IDC_DUMPCORE,_CoresDump); - SET_CHECK(IDC_DUMPMEM, _MemDump); - SET_CHECK(IDC_DUMPREGS,_RegDump); - - SET_CHECK(IDC_SPEEDLIMIT,LimitMode); - SET_CHECK(IDC_SPEEDLIMIT_RUNTIME_TOGGLE,LimiterToggleEnabled); - SET_CHECK(IDC_DSP_ENABLE,dspPluginEnabled); - SET_CHECK(IDC_TS_ENABLE,timeStretchEnabled); - - VolumeBoostEnabled = ( VolumeShiftModifier > 0 ) ? true : false; - SET_CHECK(IDC_VOLBOOST, VolumeBoostEnabled ); - - break; - - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) - { - case IDOK: - GetDlgItemText(hWnd,IDC_SRATE,temp,20); - temp[19]=0; - SampleRate=atoi(temp); - - SndOutLatencyMS = (int)SendMessage( GetDlgItem( hWnd, IDC_LATENCY_SLIDER ), TBM_GETPOS, 0, 0 ); - - if( SndOutLatencyMS > LATENCY_MAX ) SndOutLatencyMS = LATENCY_MAX; - if( SndOutLatencyMS < LATENCY_MIN ) SndOutLatencyMS = LATENCY_MIN; - - Interpolation=(int)SendMessage(GetDlgItem(hWnd,IDC_INTERPOLATE),CB_GETCURSEL,0,0); - OutputModule=(int)SendMessage(GetDlgItem(hWnd,IDC_OUTPUT),CB_GETCURSEL,0,0); - - WriteSettings(); - EndDialog(hWnd,0); - break; - case IDCANCEL: - EndDialog(hWnd,0); - break; - - case IDC_OUTCONF: - SndConfigure( hWnd, - (int)SendMessage(GetDlgItem(hWnd,IDC_OUTPUT),CB_GETCURSEL,0,0) - ); - break; - - HANDLE_CHECKNB( IDC_VOLBOOST, VolumeBoostEnabled ); - VolumeShiftModifier = (VolumeBoostEnabled ? 1 : 0 ); - SndOutVolumeShift = SndOutVolumeShiftBase - VolumeShiftModifier; - break; - - HANDLE_CHECK(IDC_EFFECTS,EffectsEnabled); - HANDLE_CHECKNB(IDC_DEBUG,DebugEnabled); - EnableDebugControls( hWnd ); - break; - HANDLE_CHECKNB(IDC_MSGSHOW,_MsgToConsole); - EnableDebugMessages( hWnd ); - break; - HANDLE_CHECK(IDC_MSGKEY,_MsgKeyOnOff); - HANDLE_CHECK(IDC_MSGVOICE,_MsgVoiceOff); - HANDLE_CHECKNB(IDC_MSGDMA,_MsgDMA); - ENABLE_CONTROL(IDC_MSGADMA, MsgDMA()); - break; - HANDLE_CHECK(IDC_MSGADMA,_MsgAutoDMA); - HANDLE_CHECK(IDC_DBG_OVERRUNS,_MsgOverruns); - HANDLE_CHECK(IDC_DBG_CACHE,_MsgCache); - HANDLE_CHECK(IDC_LOGREGS,_AccessLog); - HANDLE_CHECK(IDC_LOGDMA, _DMALog); - HANDLE_CHECK(IDC_LOGWAVE,_WaveLog); - HANDLE_CHECK(IDC_DUMPCORE,_CoresDump); - HANDLE_CHECK(IDC_DUMPMEM, _MemDump); - HANDLE_CHECK(IDC_DUMPREGS,_RegDump); - HANDLE_CHECK(IDC_DSP_ENABLE,dspPluginEnabled); - HANDLE_CHECK(IDC_TS_ENABLE,timeStretchEnabled); - HANDLE_CHECK(IDC_SPEEDLIMIT,LimitMode); - HANDLE_CHECK(IDC_SPEEDLIMIT_RUNTIME_TOGGLE,LimiterToggleEnabled); - default: - return FALSE; - } - break; - case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - switch(wmId) { - //case TB_ENDTRACK: - //case TB_THUMBPOSITION: - case TB_LINEUP: - case TB_LINEDOWN: - case TB_PAGEUP: - case TB_PAGEDOWN: - wmEvent=(int)SendMessage((HWND)lParam,TBM_GETPOS,0,0); - case TB_THUMBTRACK: - if(wmEventLATENCY_MAX) wmEvent=LATENCY_MAX; - SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent); - sprintf_s(temp,80,"%d ms (avg)",wmEvent); - SetDlgItemText(hWnd,IDC_LATENCY_LABEL,temp); - break; - default: - return FALSE; - } - break; - default: - return FALSE; - } - return TRUE; -} - -void configure() -{ - INT_PTR ret; - ReadSettings(); - ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_CONFIG),GetActiveWindow(),(DLGPROC)ConfigProc,1); - if(ret==-1) - { - MessageBoxEx(GetActiveWindow(),"Error Opening the config dialog.","OMG ERROR!",MB_OK,0); - return; - } - ReadSettings(); -} diff --git a/plugins/spu2ghz/src/Win32/config.h b/plugins/spu2ghz/src/Win32/config.h deleted file mode 100644 index 036d009d9b..0000000000 --- a/plugins/spu2ghz/src/Win32/config.h +++ /dev/null @@ -1,169 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef CONFIG_H_INCLUDED -#define CONFIG_H_INCLUDED - -extern bool DebugEnabled; - -extern bool _MsgToConsole; -extern bool _MsgKeyOnOff; -extern bool _MsgVoiceOff; -extern bool _MsgDMA; -extern bool _MsgAutoDMA; -extern bool _MsgOverruns; -extern bool _MsgCache; - -extern bool _AccessLog; -extern bool _DMALog; -extern bool _WaveLog; - -extern bool _CoresDump; -extern bool _MemDump; -extern bool _RegDump; - -static __forceinline bool MsgToConsole() { return _MsgToConsole & DebugEnabled; } - -static __forceinline bool MsgKeyOnOff() { return _MsgKeyOnOff & MsgToConsole(); } -static __forceinline bool MsgVoiceOff() { return _MsgVoiceOff & MsgToConsole(); } -static __forceinline bool MsgDMA() { return _MsgDMA & MsgToConsole(); } -static __forceinline bool MsgAutoDMA() { return _MsgAutoDMA & MsgDMA(); } -static __forceinline bool MsgOverruns() { return _MsgOverruns & MsgToConsole(); } -static __forceinline bool MsgCache() { return _MsgCache & MsgToConsole(); } - -static __forceinline bool AccessLog() { return _AccessLog & DebugEnabled; } -static __forceinline bool DMALog() { return _DMALog & DebugEnabled; } -static __forceinline bool WaveLog() { return _WaveLog & DebugEnabled; } - -static __forceinline bool CoresDump() { return _CoresDump & DebugEnabled; } -static __forceinline bool MemDump() { return _MemDump & DebugEnabled; } -static __forceinline bool RegDump() { return _RegDump & DebugEnabled; } - - -extern char AccessLogFileName[255]; -extern char WaveLogFileName[255]; - -extern char DMA4LogFileName[255]; -extern char DMA7LogFileName[255]; - -extern char CoresDumpFileName[255]; -extern char MemDumpFileName[255]; -extern char RegDumpFileName[255]; - -extern int Interpolation; - -extern int WaveDumpFormat; - -extern int SampleRate; - -extern bool EffectsEnabled; - -extern int AutoDMAPlayRate[2]; - -extern u32 OutputModule; -extern int SndOutLatencyMS; - -//extern int VolumeMultiplier; -//extern int VolumeDivisor; - -extern int LimitMode; - -extern char AsioDriver[129]; - -extern char dspPlugin[]; -extern int dspPluginModule; - -extern bool dspPluginEnabled; -extern bool timeStretchEnabled; - -extern bool LimiterToggleEnabled; -extern int LimiterToggle; - -// *** BEGIN DRIVER-SPECIFIC CONFIGURATION *** -// ------------------------------------------- - -// DSOUND -struct CONFIG_DSOUNDOUT -{ - char Device[256]; - s8 NumBuffers; - - CONFIG_DSOUNDOUT() : - NumBuffers( 3 ) - { - memset( Device, 0, sizeof( Device ) ); - } -}; - -// WAVEOUT -struct CONFIG_WAVEOUT -{ - char Device[255]; - s8 NumBuffers; - - CONFIG_WAVEOUT() : - NumBuffers( 4 ) - { - memset( Device, 0, sizeof( Device ) ); - } -}; - -// DSOUND51 -struct CONFIG_DSOUND51 -{ - char Device[256]; - u32 NumBuffers; - - u32 GainL; - u32 GainR; - u32 GainSL; - u32 GainSR; - u32 GainC; - u32 GainLFE; - u32 AddCLR; - u32 LowpassLFE; - - // C++ style struct/class initializer - CONFIG_DSOUND51() : - NumBuffers( 4 ) - , GainL( 256 ) - , GainR( 256 ) - , GainSL( 200 ) - , GainSR( 200 ) - , GainC( 200 ) - , GainLFE( 256 ) - , AddCLR( 56 ) - , LowpassLFE( 80 ) - { - memset( Device, 0, sizeof( Device ) ); - } -}; - - -extern CONFIG_DSOUNDOUT Config_DSoundOut; -extern CONFIG_DSOUND51 Config_DSound51; -extern CONFIG_WAVEOUT Config_WaveOut; - - -////// - -void ReadSettings(); -void WriteSettings(); -void configure(); - -#endif // CONFIG_H_INCLUDED diff --git a/plugins/spu2ghz/src/Win32/dialogs.h b/plugins/spu2ghz/src/Win32/dialogs.h deleted file mode 100644 index 0e788c80c6..0000000000 --- a/plugins/spu2ghz/src/Win32/dialogs.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include "resource.h" -#include - -#define SET_CHECK(idc,value) SendMessage(GetDlgItem(hWnd,idc),BM_SETCHECK,((value)==0)?BST_UNCHECKED:BST_CHECKED,0) -#define HANDLE_CHECK(idc,hvar) case idc: hvar=hvar?0:1; SendMessage(GetDlgItem(hWnd,idc),BM_SETCHECK,(hvar==1)?BST_CHECKED:BST_UNCHECKED,0); break -#define HANDLE_CHECKNB(idc,hvar)case idc: hvar=hvar?0:1; SendMessage(GetDlgItem(hWnd,idc),BM_SETCHECK,(hvar==1)?BST_CHECKED:BST_UNCHECKED,0) -#define ENABLE_CONTROL(idc,value) EnableWindow(GetDlgItem(hWnd,idc),value) - -#define INIT_SLIDER(idc,minrange,maxrange,tickfreq,pagesize,linesize) \ - SendMessage(GetDlgItem(hWnd,idc),TBM_SETRANGEMIN,FALSE,minrange); \ - SendMessage(GetDlgItem(hWnd,idc),TBM_SETRANGEMAX,FALSE,maxrange); \ - SendMessage(GetDlgItem(hWnd,idc),TBM_SETTICFREQ,tickfreq,0); \ - SendMessage(GetDlgItem(hWnd,idc),TBM_SETPAGESIZE,0,pagesize); \ - SendMessage(GetDlgItem(hWnd,idc),TBM_SETLINESIZE,0,linesize) diff --git a/plugins/spu2ghz/src/Win32/dsound51.cpp b/plugins/spu2ghz/src/Win32/dsound51.cpp deleted file mode 100644 index 1cce175d40..0000000000 --- a/plugins/spu2ghz/src/Win32/dsound51.cpp +++ /dev/null @@ -1,690 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#define _WIN32_DCOM -#include "spu2.h" -#include "dialogs.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lowpass.h" - -#define ENABLE_DPLII - -struct ds_device_data { - char name[256]; - GUID guid; - bool hasGuid; -}; - -static ds_device_data devices[32]; -static int ndevs; -static GUID DevGuid; // currently employed GUID. -static bool haveGuid; - -extern HRESULT GUIDFromString(const char *str, LPGUID guid); - -class DSound51: public SndOutModule -{ -private: - # define MAX_BUFFER_COUNT 8 - - static const int PacketsPerBuffer = 1; - static const int BufferSize = SndOutPacketSize * PacketsPerBuffer * 3; - static const int BufferSizeBytes = BufferSize << 1; - - - FILE *voicelog; - - u32 numBuffers; // cached copy of our configuration setting. - int channel; - int myLastWrite; - - bool dsound_running; - HANDLE thread; - DWORD tid; - - IDirectSound8* dsound; - IDirectSoundBuffer8* buffer; - IDirectSoundNotify8* buffer_notify; - HANDLE buffer_events[MAX_BUFFER_COUNT]; - - WAVEFORMATEXTENSIBLE wfx; - - SndBuffer *buff; - - s32 LAccum; - s32 RAccum; - s32 ANum; - - s32 LBuff[128]; - s32 RBuff[128]; - - LPF_data lpf_l; - LPF_data lpf_r; - - void Convert(s16 *obuffer, s32 ValL, s32 ValR) - { - static u8 bufdone=1; - static s32 Gfl=0,Gfr=0; - - static s32 spdif_data[6]; - static s32 LMax=0,RMax=0; - - if(PlayMode&4) - { - spdif_get_samples(spdif_data); - } - else - { - spdif_data[0]=0; - spdif_data[1]=0; - spdif_data[2]=0; - spdif_data[3]=0; - spdif_data[4]=0; - spdif_data[5]=0; - } - -#ifdef ENABLE_DPLII -#ifdef USE_AVERAGING - LAccum+=abs(ValL); - RAccum+=abs(ValR); - ANum++; - - if(ANum>=512) - { - LMax=0;RMax=0; - - LAccum/=ANum; - RAccum/=ANum; - ANum=0; - - for(int i=0;i<127;i++) - { - LMax+=LBuff[i]; - RMax+=RBuff[i]; - LBuff[i]=LBuff[i+1]; - RBuff[i]=RBuff[i+1]; - } - LBuff[127]=LAccum; - RBuff[127]=RAccum; - LMax+=LAccum; - RMax+=RAccum; - - s32 TL = (LMax>>15)+1; - s32 TR = (RMax>>15)+1; - - Gfl=(RMax)/(TL); - Gfr=(LMax)/(TR); - - if(Gfl>255) Gfl=255; - if(Gfr>255) Gfr=255; - } -#else - - if(ValL>LMax) LMax = ValL; - if(-ValL>LMax) LMax = -ValL; - if(ValR>RMax) RMax = ValR; - if(-ValR>RMax) RMax = -ValR; - ANum++; - if(ANum>=128) - { - // shift into a 21 bit value - const u8 shift = SndOutVolumeShift-5; - - ANum=0; - LAccum = ((LAccum * 224) + (LMax>>shift))>>8; - RAccum = ((RAccum * 224) + (RMax>>shift))>>8; - - LMax=0; - RMax=0; - - if(LAccum<1) LAccum=1; - if(RAccum<1) RAccum=1; - - Gfl=(RAccum)*255/(LAccum); - Gfr=(LAccum)*255/(RAccum); - - int gMax = max(Gfl,Gfr); - - Gfl=Gfl*255/gMax; - Gfr=Gfr*255/gMax; - - if(Gfl>255) Gfl=255; - if(Gfr>255) Gfr=255; - if(Gfl<1) Gfl=1; - if(Gfr<1) Gfr=1; - } -#endif - - Gfr = 1; Gfl = 1; - - s32 L,R,C,LFE,SL,SR,LL,LR; - - extern double pow_2_31; - - // shift Values into 12 bits: - u8 shift2 = SndOutVolumeShift + 4; - - LL = (s32)(LPF(&lpf_l,(ValL>>shift2)/pow_2_31)*pow_2_31); - LR = (s32)(LPF(&lpf_r,(ValR>>shift2)/pow_2_31)*pow_2_31); - LFE = (LL + LR)>>4; - - C=(ValL+ValR)>>1; //16.8 - - ValL-=C;//16.8 - ValR-=C;//16.8 - - L=ValL>>SndOutVolumeShift; //16.0 - R=ValR>>SndOutVolumeShift; //16.0 - C=C>>SndOutVolumeShift; //16.0 - - s32 VL=(ValL>>4) * Gfl; //16.12 - s32 VR=(ValR>>4) * Gfr; - - SL=(VL/209 - VR/148)>>4; //16.0 (?) - SR=(VL/148 - VR/209)>>4; //16.0 (?) - - // increase surround stereo separation - int SC = (SL+SR)>>1; //16.0 - int SLd = SL - SC; //16.0 - int SRd = SL - SC; //16.0 - - SL = (SLd * 209 + SC * 148)>>8; //16.0 - SR = (SRd * 209 + SC * 148)>>8; //16.0 - - obuffer[0]=spdif_data[0] + (((L * Config_DSound51.GainL ) + (C * Config_DSound51.AddCLR))>>8); - obuffer[1]=spdif_data[1] + (((R * Config_DSound51.GainR ) + (C * Config_DSound51.AddCLR))>>8); - obuffer[2]=spdif_data[2] + (((C * Config_DSound51.GainC ))>>8); - obuffer[3]=spdif_data[3] + (((LFE * Config_DSound51.GainLFE))>>8); - obuffer[4]=spdif_data[4] + (((SL * Config_DSound51.GainSL ))>>8); - obuffer[5]=spdif_data[5] + (((SR * Config_DSound51.GainSR ))>>8); -#else - obuffer[0]=spdif_data[0]+(ValL>>8); - obuffer[1]=spdif_data[1]+(ValR>>8); - obuffer[2]=spdif_data[2]; - obuffer[3]=spdif_data[3]; - obuffer[4]=spdif_data[4]; - obuffer[5]=spdif_data[5]; -#endif - } - -# define STRFY(x) #x - -# define verifyc(x) if(Verifyc(x,STRFY(x))) return -1; - - static DWORD CALLBACK RThread(DSound51*obj) - { - return obj->Thread(); - } - - int __forceinline Verifyc(HRESULT hr,const char* fn) - { - if(FAILED(hr)) - { - SysMessage("ERROR: Call to %s Failed.",fn); - return -1; - } - return 0; - } - - DWORD Thread() - { - while( dsound_running ) - { - u32 rv = WaitForMultipleObjects(numBuffers,buffer_events,FALSE,200); - - s16* p1, *oldp1; - LPVOID p2; - DWORD s1,s2; - - u32 poffset=BufferSizeBytes * rv; - -#ifdef _DEBUG - verifyc(buffer->Lock(poffset,BufferSizeBytes,(LPVOID*)&p1,&s1,&p2,&s2,0)); -#else - if( FAILED(buffer->Lock(poffset,BufferSizeBytes,(LPVOID*)&p1,&s1,&p2,&s2,0) ) ) - { - fputs( " * SPU2 : Directsound Warning > Buffer lock failure. You may need to increase the DSound buffer count.\n", stderr ); - continue; - } -#endif - oldp1 = p1; - - for(int p=0; pReadSamples( temp ); - for(int j=0;jUnlock(oldp1,s1,p2,s2)); -#else - buffer->Unlock(oldp1,s1,p2,s2); -#endif - verifyc(buffer->Unlock(oldp1,s1,p2,s2)); - - // Set the write pointer to the beginning of the next block. - myLastWrite = (poffset + BufferSizeBytes) % (BufferSizeBytes*numBuffers); - } - return 0; - } - -public: - s32 Init(SndBuffer *sb) - { - buff = sb; - numBuffers = Config_DSound51.NumBuffers; - - // - // Initialize DSound - // - GUID cGuid; - bool success = false; - - if( (strlen(Config_DSound51.Device)>0)&&(!FAILED(GUIDFromString(Config_DSound51.Device,&cGuid)))) - { - if( !FAILED( DirectSoundCreate8(&cGuid,&dsound,NULL) ) ) - success = true; - } - - // if the GUID failed, just open up the default dsound driver: - if( !success ) - { - verifyc(DirectSoundCreate8(NULL,&dsound,NULL)); - } - - verifyc(dsound->SetCooperativeLevel(GetDesktopWindow(),DSSCL_PRIORITY)); - IDirectSoundBuffer* buffer_; - DSBUFFERDESC desc; - - // Set up WAV format structure. - - memset(&wfx, 0, sizeof(WAVEFORMATEX)); - wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - wfx.Format.nSamplesPerSec = SampleRate; - wfx.Format.nChannels=6; - wfx.Format.wBitsPerSample = 16; - wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample/8; - wfx.Format.nAvgBytesPerSec = SampleRate * wfx.Format.nBlockAlign; - wfx.Format.cbSize=22; - wfx.Samples.wValidBitsPerSample=0; - wfx.dwChannelMask=SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT; - wfx.SubFormat=KSDATAFORMAT_SUBTYPE_PCM; - - verifyc(dsound->SetSpeakerConfig(DSSPEAKER_5POINT1)); - - // Set up DSBUFFERDESC structure. - - memset(&desc, 0, sizeof(DSBUFFERDESC)); - desc.dwSize = sizeof(DSBUFFERDESC); - desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY;// _CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; - desc.dwBufferBytes = BufferSizeBytes * numBuffers; - desc.lpwfxFormat = &wfx.Format; - - desc.dwFlags |=DSBCAPS_LOCSOFTWARE; - desc.dwFlags|=DSBCAPS_GLOBALFOCUS; - - verifyc(dsound->CreateSoundBuffer(&desc,&buffer_,0)); - verifyc(buffer_->QueryInterface(IID_IDirectSoundBuffer8,(void**)&buffer)); - buffer_->Release(); - - verifyc(buffer->QueryInterface(IID_IDirectSoundNotify8,(void**)&buffer_notify)); - - DSBPOSITIONNOTIFY not[MAX_BUFFER_COUNT]; - - for(u32 i=0;iSetNotificationPositions(numBuffers,not); - - LPVOID p1=0,p2=0; - DWORD s1=0,s2=0; - - verifyc(buffer->Lock(0,desc.dwBufferBytes,&p1,&s1,&p2,&s2,0)); - assert(p2==0); - memset(p1,0,s1); - verifyc(buffer->Unlock(p1,s1,p2,s2)); - - LPF_init(&lpf_l,Config_DSound51.LowpassLFE,SampleRate); - LPF_init(&lpf_r,Config_DSound51.LowpassLFE,SampleRate); - - //Play the buffer ! - verifyc(buffer->Play(0,0,DSBPLAY_LOOPING)); - - // Start Thread - myLastWrite = 0; - dsound_running=true; - thread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)RThread,this,0,&tid); - SetThreadPriority(thread,THREAD_PRIORITY_TIME_CRITICAL); - - return 0; - } - - void Close() - { - // Stop Thread - fprintf(stderr," * SPU2: Waiting for DSound thread to finish..."); - dsound_running=false; - - WaitForSingleObject(thread,INFINITE); - CloseHandle(thread); - - fprintf(stderr," Done.\n"); - - // - // Clean up - // - if( buffer != NULL ) - { - buffer->Stop(); - - for(u32 i=0;i=0) - { - SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_SETCURSEL,tSel,0); - } - - INIT_SLIDER(IDC_LEFT_GAIN_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_RIGHT_GAIN_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_RLEFT_GAIN_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_RRIGHT_GAIN_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_CENTER_GAIN_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_LFE_SLIDER,0,512,64,16,8); - INIT_SLIDER(IDC_LR_CENTER_SLIDER,0,512,64,16,8); - - AssignSliderValue( hWnd, IDC_LEFT_GAIN_SLIDER, IDC_LEFT_GAIN_EDIT, Config_DSound51.GainL ); - AssignSliderValue( hWnd, IDC_RIGHT_GAIN_SLIDER, IDC_RIGHT_GAIN_EDIT, Config_DSound51.GainR ); - AssignSliderValue( hWnd, IDC_RLEFT_GAIN_SLIDER, IDC_RLEFT_GAIN_EDIT, Config_DSound51.GainSL ); - AssignSliderValue( hWnd, IDC_RRIGHT_GAIN_SLIDER, IDC_RRIGHT_GAIN_EDIT, Config_DSound51.GainSR ); - AssignSliderValue( hWnd, IDC_CENTER_GAIN_SLIDER, IDC_CENTER_GAIN_EDIT, Config_DSound51.GainC); - AssignSliderValue( hWnd, IDC_LFE_SLIDER, IDC_LFE_EDIT, Config_DSound51.GainLFE); - AssignSliderValue( hWnd, IDC_LR_CENTER_SLIDER, IDC_LR_CENTER_EDIT, Config_DSound51.AddCLR ); - - char temp[128]; - INIT_SLIDER( IDC_BUFFERS_SLIDER, 2, MAX_BUFFER_COUNT, 2, 1, 1 ); - SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_DSound51.NumBuffers); - sprintf_s(temp, 128, "%d (%d ms latency)",Config_DSound51.NumBuffers, 1000 / (96000 / (Config_DSound51.NumBuffers * BufferSize))); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL2),temp); - break; - - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) - { - case IDOK: - { - int i = (int)SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_GETCURSEL,0,0); - - if(!devices[i].hasGuid) - { - Config_DSound51.Device[0]=0; // clear device name to "" - } - else - { - sprintf_s(Config_DSound51.Device,256,"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - devices[i].guid.Data1, - devices[i].guid.Data2, - devices[i].guid.Data3, - devices[i].guid.Data4[0], - devices[i].guid.Data4[1], - devices[i].guid.Data4[2], - devices[i].guid.Data4[3], - devices[i].guid.Data4[4], - devices[i].guid.Data4[5], - devices[i].guid.Data4[6], - devices[i].guid.Data4[7] - ); - - Config_DSound51.NumBuffers = GetSliderValue( hWnd, IDC_BUFFERS_SLIDER ); - Config_DSound51.GainL = GetSliderValue( hWnd, IDC_LEFT_GAIN_SLIDER ); - Config_DSound51.GainR = GetSliderValue( hWnd, IDC_RIGHT_GAIN_SLIDER ); - Config_DSound51.GainSL = GetSliderValue( hWnd, IDC_RLEFT_GAIN_SLIDER ); - Config_DSound51.GainSR = GetSliderValue( hWnd, IDC_RRIGHT_GAIN_SLIDER ); - Config_DSound51.GainLFE = GetSliderValue( hWnd, IDC_LFE_SLIDER ); - Config_DSound51.GainC = GetSliderValue( hWnd, IDC_CENTER_GAIN_SLIDER ); - Config_DSound51.AddCLR = GetSliderValue( hWnd, IDC_LR_CENTER_SLIDER ); - - if( Config_DSound51.NumBuffers < 2 ) Config_DSound51.NumBuffers = 2; - if( Config_DSound51.NumBuffers > MAX_BUFFER_COUNT ) Config_DSound51.NumBuffers = MAX_BUFFER_COUNT; - } - } - EndDialog(hWnd,0); - break; - case IDCANCEL: - EndDialog(hWnd,0); - break; - default: - return FALSE; - } - break; - - case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - switch(wmId) { - //case TB_ENDTRACK: - //case TB_THUMBPOSITION: - case TB_LINEUP: - case TB_LINEDOWN: - case TB_PAGEUP: - case TB_PAGEDOWN: - wmEvent=(int)SendMessage((HWND)lParam,TBM_GETPOS,0,0); - case TB_THUMBTRACK: - if( wmEvent < 2 ) wmEvent = 2; - if( wmEvent > MAX_BUFFER_COUNT ) wmEvent = MAX_BUFFER_COUNT; - SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent); - sprintf_s(temp,128,"%d (%d ms latency)",wmEvent, 1000 / (96000 / (wmEvent * BufferSize))); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL2),temp); - break; - default: - return FALSE; - } - break; - - case WM_VSCROLL: - HANDLE_SCROLL_MESSAGE(IDC_LEFT_GAIN_SLIDER,IDC_LEFT_GAIN_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_RIGHT_GAIN_SLIDER,IDC_RIGHT_GAIN_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_RLEFT_GAIN_SLIDER,IDC_RLEFT_GAIN_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_RRIGHT_GAIN_SLIDER,IDC_RRIGHT_GAIN_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_CENTER_GAIN_SLIDER,IDC_CENTER_GAIN_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_LFE_SLIDER,IDC_LFE_EDIT); - HANDLE_SCROLL_MESSAGE(IDC_LR_CENTER_SLIDER,IDC_LR_CENTER_EDIT); - - default: - return FALSE; - } - return TRUE; - } - -public: - virtual void Configure(HWND parent) - { - INT_PTR ret; - ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DSOUND51),GetActiveWindow(),(DLGPROC)ConfigProc,1); - if(ret==-1) - { - MessageBoxEx(GetActiveWindow(),"Error Opening the config dialog.","OMG ERROR!",MB_OK,0); - return; - } - } - - s32 Test() const - { - return 0; - } - - bool Is51Out() const { return true; } - - int GetEmptySampleCount() const - { - DWORD play, write; - buffer->GetCurrentPosition( &play, &write ); - - // Note: Dsound's write cursor is bogus. Use our own instead: - - int empty = play - myLastWrite; - if( empty < 0 ) - empty = -empty; - - return empty / 6; - - } - - const char* GetIdent() const - { - return "dsound51"; - } - - const char* GetLongName() const - { - return "DSound 5.1 (Experimental)"; - } -} DS51; - -SndOutModule *DSound51Out=&DS51; \ No newline at end of file diff --git a/plugins/spu2ghz/src/Win32/dsoundout.cpp b/plugins/spu2ghz/src/Win32/dsoundout.cpp deleted file mode 100644 index f2070d91ba..0000000000 --- a/plugins/spu2ghz/src/Win32/dsoundout.cpp +++ /dev/null @@ -1,459 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#define _WIN32_DCOM -#include "spu2.h" -#include "dialogs.h" -#include -#include -#include -#include -#include -#include -#include -#include - -struct ds_device_data { - char name[256]; - GUID guid; - bool hasGuid; -}; - -static ds_device_data devices[32]; -static int ndevs; -static GUID DevGuid; // currently employed GUID. -static bool haveGuid; - -HRESULT GUIDFromString(const char *str, LPGUID guid) -{ - // "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" - - struct T{ // this is a hack because for some reason sscanf writes too much :/ - GUID g; - int k; - } t; - - int r = sscanf_s(str,"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - &t.g.Data1, - &t.g.Data2, - &t.g.Data3, - &t.g.Data4[0], - &t.g.Data4[1], - &t.g.Data4[2], - &t.g.Data4[3], - &t.g.Data4[4], - &t.g.Data4[5], - &t.g.Data4[6], - &t.g.Data4[7] - ); - - if(r!=11) return -1; - - *guid = t.g; - return 0; -} - -class DSound: public SndOutModule -{ -private: - # define MAX_BUFFER_COUNT 8 - - static const int PacketsPerBuffer = 1; - static const int BufferSize = SndOutPacketSize * PacketsPerBuffer; - static const int BufferSizeBytes = BufferSize << 1; - - - FILE *voicelog; - - u32 numBuffers; // cached copy of our configuration setting. - int channel; - int myLastWrite; // last write position, in bytes - - bool dsound_running; - HANDLE thread; - DWORD tid; - - IDirectSound8* dsound; - IDirectSoundBuffer8* buffer; - IDirectSoundNotify8* buffer_notify; - HANDLE buffer_events[MAX_BUFFER_COUNT]; - - WAVEFORMATEX wfx; - - HANDLE waitEvent; - - SndBuffer *buff; - -# define STRFY(x) #x -# define verifyc(x) if(Verifyc(x,STRFY(x))) return -1; - - int __forceinline Verifyc(HRESULT hr,const char* fn) - { - if(FAILED(hr)) - { - SysMessage("ERROR: Call to %s Failed.",fn); - return -1; - } - return 0; - } - - static DWORD CALLBACK RThread(DSound*obj) - { - return obj->Thread(); - } - - DWORD CALLBACK Thread() - { - - while( dsound_running ) - { - u32 rv = WaitForMultipleObjects(numBuffers,buffer_events,FALSE,200); - - s16* p1, *oldp1; - LPVOID p2; - DWORD s1,s2; - - u32 poffset=BufferSizeBytes * rv; - -#ifdef _DEBUG - verifyc(buffer->Lock(poffset,BufferSizeBytes,(LPVOID*)&p1,&s1,&p2,&s2,0)); -#else - if( FAILED(buffer->Lock(poffset,BufferSizeBytes,(LPVOID*)&p1,&s1,&p2,&s2,0) ) ) - { - fputs( " * SPU2 : Directsound Warning > Buffer lock failure. You may need to increase the DSound buffer count.\n", stderr ); - continue; - } -#endif - oldp1 = p1; - - for(int p=0; pReadSamples( p1 ); - -#ifndef PUBLIC - verifyc(buffer->Unlock(oldp1,s1,p2,s2)); -#else - buffer->Unlock(oldp1,s1,p2,s2); -#endif - // Set the write pointer to the beginning of the next block. - myLastWrite = (poffset + BufferSizeBytes) & ~BufferSizeBytes; - } - return 0; - } - -public: - s32 Init(SndBuffer *sb) - { - buff = sb; - numBuffers = Config_DSoundOut.NumBuffers; - - // - // Initialize DSound - // - GUID cGuid; - bool success = false; - - if( (strlen(Config_DSoundOut.Device)>0)&&(!FAILED(GUIDFromString(Config_DSoundOut.Device,&cGuid)))) - { - if( !FAILED( DirectSoundCreate8(&cGuid,&dsound,NULL) ) ) - success = true; - } - - // if the GUID failed, just open up the default dsound driver: - if( !success ) - { - verifyc(DirectSoundCreate8(NULL,&dsound,NULL)); - } - - verifyc(dsound->SetCooperativeLevel(GetDesktopWindow(),DSSCL_PRIORITY)); - IDirectSoundBuffer* buffer_; - DSBUFFERDESC desc; - - // Set up WAV format structure. - - memset(&wfx, 0, sizeof(WAVEFORMATEX)); - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nSamplesPerSec = SampleRate; - wfx.nChannels=2; - wfx.wBitsPerSample = 16; - wfx.nBlockAlign = 2*2; - wfx.nAvgBytesPerSec = SampleRate * wfx.nBlockAlign; - wfx.cbSize=0; - - // Set up DSBUFFERDESC structure. - - memset(&desc, 0, sizeof(DSBUFFERDESC)); - desc.dwSize = sizeof(DSBUFFERDESC); - desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY;// _CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY; - desc.dwBufferBytes = BufferSizeBytes * numBuffers; - desc.lpwfxFormat = &wfx; - - desc.dwFlags |=DSBCAPS_LOCSOFTWARE; - desc.dwFlags|=DSBCAPS_GLOBALFOCUS; - - verifyc(dsound->CreateSoundBuffer(&desc,&buffer_,0)); - verifyc(buffer_->QueryInterface(IID_IDirectSoundBuffer8,(void**)&buffer)); - buffer_->Release(); - - verifyc(buffer->QueryInterface(IID_IDirectSoundNotify8,(void**)&buffer_notify)); - - DSBPOSITIONNOTIFY not[MAX_BUFFER_COUNT]; - - for(u32 i=0;iSetNotificationPositions(numBuffers,not); - - LPVOID p1=0,p2=0; - DWORD s1=0,s2=0; - - verifyc(buffer->Lock(0,desc.dwBufferBytes,&p1,&s1,&p2,&s2,0)); - assert(p2==0); - memset(p1,0,s1); - verifyc(buffer->Unlock(p1,s1,p2,s2)); - - //Play the buffer ! - verifyc(buffer->Play(0,0,DSBPLAY_LOOPING)); - - // Start Thread - myLastWrite = 0; - dsound_running=true; - thread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)RThread,this,0,&tid); - SetThreadPriority(thread,THREAD_PRIORITY_TIME_CRITICAL); - - return 0; - } - - void Close() - { - // Stop Thread - fprintf(stderr," * SPU2: Waiting for DSound thread to finish..."); - dsound_running=false; - - WaitForSingleObject(thread,INFINITE); - CloseHandle(thread); - - fprintf(stderr," Done.\n"); - - // - // Clean up - // - if( buffer != NULL ) - { - buffer->Stop(); - - for(u32 i=0;i=0) - { - SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_SETCURSEL,tSel,0); - } - - char temp[128]; - INIT_SLIDER( IDC_BUFFERS_SLIDER, 2, MAX_BUFFER_COUNT, 2, 1, 1 ); - SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_DSoundOut.NumBuffers); - sprintf_s(temp, 128, "%d (%d ms latency)",Config_DSoundOut.NumBuffers, 1000 / (96000 / (Config_DSoundOut.NumBuffers * BufferSize))); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); - - break; - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) - { - case IDOK: - { - int i = (int)SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_GETCURSEL,0,0); - - if(!devices[i].hasGuid) - { - Config_DSoundOut.Device[0] = 0; // clear device name to "" - } - else - { - sprintf_s(Config_DSoundOut.Device,256,"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - devices[i].guid.Data1, - devices[i].guid.Data2, - devices[i].guid.Data3, - devices[i].guid.Data4[0], - devices[i].guid.Data4[1], - devices[i].guid.Data4[2], - devices[i].guid.Data4[3], - devices[i].guid.Data4[4], - devices[i].guid.Data4[5], - devices[i].guid.Data4[6], - devices[i].guid.Data4[7] - ); - } - - Config_DSoundOut.NumBuffers = (int)SendMessage( GetDlgItem( hWnd, IDC_BUFFERS_SLIDER ), TBM_GETPOS, 0, 0 ); - - if( Config_DSoundOut.NumBuffers < 2 ) Config_DSoundOut.NumBuffers = 2; - if( Config_DSoundOut.NumBuffers > MAX_BUFFER_COUNT ) Config_DSoundOut.NumBuffers = MAX_BUFFER_COUNT; - } - EndDialog(hWnd,0); - break; - case IDCANCEL: - EndDialog(hWnd,0); - break; - default: - return FALSE; - } - break; - - case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - switch(wmId) { - //case TB_ENDTRACK: - //case TB_THUMBPOSITION: - case TB_LINEUP: - case TB_LINEDOWN: - case TB_PAGEUP: - case TB_PAGEDOWN: - wmEvent=(int)SendMessage((HWND)lParam,TBM_GETPOS,0,0); - case TB_THUMBTRACK: - if( wmEvent < 2 ) wmEvent = 2; - if( wmEvent > MAX_BUFFER_COUNT ) wmEvent = MAX_BUFFER_COUNT; - SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent); - sprintf_s(temp,128,"%d (%d ms latency)",wmEvent, 1000 / (96000 / (wmEvent * BufferSize))); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); - break; - default: - return FALSE; - } - break; - - default: - return FALSE; - } - return TRUE; - } - -public: - virtual void Configure(HWND parent) - { - INT_PTR ret; - ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DSOUND),GetActiveWindow(),(DLGPROC)ConfigProc,1); - if(ret==-1) - { - MessageBoxEx(GetActiveWindow(),"Error Opening the config dialog.","OMG ERROR!",MB_OK,0); - return; - } - } - - virtual bool Is51Out() const { return false; } - - s32 Test() const - { - return 0; - } - - int GetEmptySampleCount() const - { - DWORD play, write; - buffer->GetCurrentPosition( &play, &write ); - - // Note: Dsound's write cursor is bogus. Use our own instead: - - int empty = play - myLastWrite; - if( empty < 0 ) - empty = -empty; - - return empty / 2; - } - - const char* GetIdent() const - { - return "dsound"; - } - - const char* GetLongName() const - { - return "DirectSound (nice)"; - } - -} DS; - -SndOutModule *DSoundOut=&DS; diff --git a/plugins/spu2ghz/src/Win32/dsp.cpp b/plugins/spu2ghz/src/Win32/dsp.cpp deleted file mode 100644 index 4f37bdcb54..0000000000 --- a/plugins/spu2ghz/src/Win32/dsp.cpp +++ /dev/null @@ -1,174 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "spu2.h" - -extern "C" { -#include "dsp.h" - -typedef winampDSPHeader* (*pWinampDSPGetHeader2)(); -} - -HMODULE hLib = NULL; -pWinampDSPGetHeader2 pGetHeader = NULL; -winampDSPHeader* pHeader = NULL; - -winampDSPModule* pModule = NULL; - -HWND hTemp; - -#define USE_A_THREAD -#ifdef USE_A_THREAD - -HANDLE hUpdateThread; -DWORD UpdateThreadId; - -bool running; - -DWORD WINAPI DspUpdateThread(PVOID param); -#endif -s32 DspLoadLibrary(char *fileName, int modNum) -#ifdef USE_A_THREAD -{ - if(!dspPluginEnabled) return -1; - - running=true; - hUpdateThread = CreateThread(NULL,0,DspUpdateThread,NULL,0,&UpdateThreadId); - return (hUpdateThread==INVALID_HANDLE_VALUE); -} - -s32 DspLoadLibrary2(char *fileName, int modNum) -#endif -{ - if(!dspPluginEnabled) return -1; - - hLib = LoadLibraryA(fileName); - if(!hLib) - { - return 1; - } - - pGetHeader = (pWinampDSPGetHeader2)GetProcAddress(hLib,"winampDSPGetHeader2"); - - if(!pGetHeader) - { - FreeLibrary(hLib); - hLib=NULL; - return 1; - } - - pHeader = pGetHeader(); - - pModule = pHeader->getModule(modNum); - - if(!pModule) - { - pGetHeader=NULL; - pHeader=NULL; - FreeLibrary(hLib); - hLib=NULL; - return -1; - } - - pModule->hDllInstance = hLib; - pModule->hwndParent=0; - pModule->Init(pModule); - - return 0; -} - -void DspCloseLibrary() -#ifdef USE_A_THREAD -{ - if(!dspPluginEnabled) return ; - - PostThreadMessage(UpdateThreadId,WM_QUIT,0,0); - running=false; - if(WaitForSingleObject(hUpdateThread,1000)==WAIT_TIMEOUT) - { - TerminateThread(hUpdateThread,1); - } -} - -void DspCloseLibrary2() -#endif -{ - if(!dspPluginEnabled) return ; - - if(hLib) - { - pModule->Quit(pModule); - FreeLibrary(hLib); - } - pModule=NULL; - pHeader=NULL; - pGetHeader=NULL; - hLib=NULL; -} - -int DspProcess(s16 *buffer, int samples) -{ - if(!dspPluginEnabled) return samples; - - if(hLib) - { - return pModule->ModifySamples(pModule,buffer,samples,16,2,SampleRate); - } - return samples; -} - -void DspUpdate() -#ifdef USE_A_THREAD -{ -} - -DWORD WINAPI DspUpdateThread(PVOID param) -{ - if(!dspPluginEnabled) return -1; - - if(DspLoadLibrary2(dspPlugin,dspPluginModule)) - return -1; - - MSG msg; - while(running) - { - GetMessage(&msg,0,0,0); - if((msg.hwnd==NULL)&&(msg.message==WM_QUIT)) - { - break; - } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - DspCloseLibrary2(); - return 0; -} - -#else -{ - if(!dspPluginEnabled) return; - - MSG msg; - while(PeekMessage(&msg,0,0,0,PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -} - -#endif \ No newline at end of file diff --git a/plugins/spu2ghz/src/Win32/dsp.h b/plugins/spu2ghz/src/Win32/dsp.h deleted file mode 100644 index ca1d187484..0000000000 --- a/plugins/spu2ghz/src/Win32/dsp.h +++ /dev/null @@ -1,56 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -// DSP plugin interface - -// notes: -// any window that remains in foreground should optimally pass unused -// keystrokes to the parent (winamp's) window, so that the user -// can still control it. As for storing configuration, -// Configuration data should be stored in \plugin.ini -// (look at the vis plugin for configuration code) - -typedef struct winampDSPModule { - char *description; // description - HWND hwndParent; // parent window (filled in by calling app) - HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app) - - void (*Config)(struct winampDSPModule *this_mod); // configuration dialog (if needed) - int (*Init)(struct winampDSPModule *this_mod); // 0 on success, creates window, etc (if needed) - - // modify waveform samples: returns number of samples to actually write - // (typically numsamples, but no more than twice numsamples, and no less than half numsamples) - // numsamples should always be at least 128. should, but I'm not sure - int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate); - - void (*Quit)(struct winampDSPModule *this_mod); // called when unloading - - void *userData; // user data, optional -} winampDSPModule; - -typedef struct { - int version; // DSP_HDRVER - char *description; // description of library - winampDSPModule* (*getModule)(int); // module retrieval function -} winampDSPHeader; - -// exported symbols -typedef winampDSPHeader* (*winampDSPGetHeaderType)(); - -// header version: 0x20 == 0.20 == winamp 2.0 -#define DSP_HDRVER 0x20 diff --git a/plugins/spu2ghz/src/Win32/resource.h b/plugins/spu2ghz/src/Win32/resource.h deleted file mode 100644 index a85052f174..0000000000 --- a/plugins/spu2ghz/src/Win32/resource.h +++ /dev/null @@ -1,86 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by SPU2ghz.rc -// -#define IDD_CONFIG 9 -#define IDD_DEBUG 105 -#define IDD_DSOUND 106 -#define IDD_DSOUND51 107 -#define IDD_ASIO 108 -#define IDD_WAVEOUT 109 -#define IDC_EFFECTS 1001 -#define IDC_DUMPREGS 1003 -#define IDC_DUMPMEM 1004 -#define IDC_DUMPCORE 1005 -#define IDC_LOGWAVE 1006 -#define IDC_LOGDMA 1007 -#define IDC_LOGREGS 1008 -#define IDC_DEBUG 1010 -#define IDC_INTERPOLATE 1011 -#define IDC_SRATE 1012 -#define IDC_OUTPUT 1013 -#define IDC_BUFFER 1014 -#define IDC_BUFFERS_SLIDER 1014 -#define IDC_BSIZE 1016 -#define IDC_BCOUNT 1018 -#define IDC_TEXT 1019 -#define IDC_MSGKEY 1020 -#define IDC_MSGDMA 1021 -#define IDC_MSGADMA 1022 -#define IDC_MSGVOICE 1023 -#define IDC_MSGSHOW 1024 -#define IDC_SPEEDLIMIT 1025 -#define IDC_OUTCONF 1028 -#define IDC_DSP_ENABLE 1029 -#define IDC_TS_ENABLE 1030 -#define IDC_DS_DEVICE 1032 -#define IDC_SLIDER1 1033 -#define IDC_LEFT_GAIN_SLIDER 1033 -#define IDC_SLIDER2 1034 -#define IDC_CENTER_GAIN_SLIDER 1034 -#define IDC_SLIDER3 1035 -#define IDC_RIGHT_GAIN_SLIDER 1035 -#define IDC_EDIT1 1036 -#define IDC_LEFT_GAIN_EDIT 1036 -#define IDC_BUTTON1 1037 -#define IDC_SHOW_DEBUG 1037 -#define IDC_DBG_OVERRUNS 1038 -#define IDC_SLIDER4 1039 -#define IDC_DBG_CACHE 1039 -#define IDC_RLEFT_GAIN_SLIDER 1039 -#define IDC_SLIDER5 1040 -#define IDC_DEBUG_GROUP 1040 -#define IDC_LFE_SLIDER 1040 -#define IDC_SLIDER6 1041 -#define IDC_LATENCY_SLIDER 1041 -#define IDC_RRIGHT_GAIN_SLIDER 1041 -#define IDC_SLIDER7 1042 -#define IDC_LATENCY_LABEL 1042 -#define ICD_LR_CENTER_SLIDER 1042 -#define IDC_LR_CENTER_SLIDER 1042 -#define IDC_EDIT2 1043 -#define IDC_CENTER_GAIN_EDIT 1043 -#define IDC_EDIT3 1044 -#define IDC_SPEEDLIMIT_RUNTIME_TOGGLE 1044 -#define IDC_RIGHT_GAIN_EDIT 1044 -#define IDC_EDIT4 1045 -#define IDC_RLEFT_GAIN_EDIT 1045 -#define IDC_EDIT5 1046 -#define IDC_LFE_EDIT 1046 -#define IDC_EDIT6 1047 -#define IDC_VOLBOOST 1047 -#define IDC_RRIGHT_GAIN_EDIT 1047 -#define IDC_EDIT7 1048 -#define IDC_LR_CENTER_EDIT 1048 -#define IDC_LATENCY_LABEL2 1049 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 110 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1048 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/spu2ghz/src/Win32/vsprops/pcsx2_plugin_common.vsprops b/plugins/spu2ghz/src/Win32/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/spu2ghz/src/Win32/vsprops/postBuild.tmpl b/plugins/spu2ghz/src/Win32/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/spu2ghz/src/Win32/vsprops/postBuild.unknown b/plugins/spu2ghz/src/Win32/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/spu2ghz/src/Win32/vsprops/preBuild.cmd b/plugins/spu2ghz/src/Win32/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/spu2ghz/src/Win32/vsprops/svnrev_template.h b/plugins/spu2ghz/src/Win32/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/spu2ghz/src/Win32/vsprops/svnrev_unknown.h b/plugins/spu2ghz/src/Win32/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/spu2ghz/src/Win32/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/spu2ghz/src/Win32/xaudio2out.cpp b/plugins/spu2ghz/src/Win32/xaudio2out.cpp deleted file mode 100644 index 211b63b418..0000000000 --- a/plugins/spu2ghz/src/Win32/xaudio2out.cpp +++ /dev/null @@ -1,235 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#define _WIN32_DCOM -#include "spu2.h" -#include -#include -#include -#include -#include -#include - -class XAudio2Mod: public SndOutModule -{ -private: - static const int PacketsPerBuffer = 1; - static const int BufferSize = SndOutPacketSize * PacketsPerBuffer; - static const int BufferSizeBytes = BufferSize * 2; - - s16* qbuffer; - s32 out_num; - -#define MAX_BUFFER_COUNT 3 - - //-------------------------------------------------------------------------------------- - // Callback structure - //-------------------------------------------------------------------------------------- - class StreamingVoiceContext : public IXAudio2VoiceCallback - { - public: - SndBuffer* sndout; - IXAudio2SourceVoice* pSourceVoice; - CRITICAL_SECTION cs; - - protected: - STDMETHOD_(void, OnVoiceProcessingPassStart) () {} - STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) { }; - STDMETHOD_(void, OnVoiceProcessingPassEnd) () {} - STDMETHOD_(void, OnStreamEnd) () {} - STDMETHOD_(void, OnBufferStart) ( void* ) {} - STDMETHOD_(void, OnBufferEnd) ( void* context ) - { - EnterCriticalSection( &cs ); - - // All of these checks are necessary because XAudio2 is wonky shizat. - if( pSourceVoice == NULL || context == NULL ) return; - - s16* qb = (s16*)context; - - for(int p=0; pReadSamples( qb ); - - XAUDIO2_BUFFER buf = {0}; - buf.AudioBytes = BufferSizeBytes; - buf.pAudioData=(BYTE*)context; - buf.pContext=context; - - pSourceVoice->SubmitSourceBuffer( &buf ); - LeaveCriticalSection( &cs ); - } - STDMETHOD_(void, OnLoopEnd) ( void* ) {} - STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) { }; - - } voiceContext; - - IXAudio2* pXAudio2; - IXAudio2MasteringVoice* pMasteringVoice; - IXAudio2SourceVoice* pSourceVoice; - - WAVEFORMATEX wfx; - -public: - - s32 Init(SndBuffer *sb) - { - HRESULT hr; - - // - // Initialize XAudio2 - // - CoInitializeEx( NULL, COINIT_MULTITHREADED ); - - UINT32 flags = 0; -#ifdef _DEBUG - flags |= XAUDIO2_DEBUG_ENGINE; -#endif - - if ( FAILED(hr = XAudio2Create( &pXAudio2, flags ) ) ) - { - SysMessage( "Failed to init XAudio2 engine: %#X\n", hr ); - CoUninitialize(); - return -1; - } - - // - // Create a mastering voice - // - if ( FAILED(hr = pXAudio2->CreateMasteringVoice( &pMasteringVoice, 0, SampleRate ) ) ) - { - SysMessage( "Failed creating mastering voice: %#X\n", hr ); - SAFE_RELEASE( pXAudio2 ); - CoUninitialize(); - return -1; - } - - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nSamplesPerSec = SampleRate; - wfx.nChannels=2; - wfx.wBitsPerSample = 16; - wfx.nBlockAlign = 2*2; - wfx.nAvgBytesPerSec = SampleRate * wfx.nBlockAlign; - wfx.cbSize=0; - - InitializeCriticalSection( &voiceContext.cs ); - EnterCriticalSection( &voiceContext.cs ); - - // - // Create an XAudio2 voice to stream this wave - // - if( FAILED(hr = pXAudio2->CreateSourceVoice( &pSourceVoice, &wfx, - XAUDIO2_VOICE_NOSRC, 1.0f, &voiceContext ) ) ) - { - SysMessage( "Error %#X creating source voice\n", hr ); - SAFE_RELEASE( pXAudio2 ); - return -1; - } - - voiceContext.pSourceVoice = pSourceVoice; - voiceContext.sndout = sb; - pSourceVoice->FlushSourceBuffers(); - pSourceVoice->Start( 0, 0 ); - - qbuffer = new s16[BufferSize*MAX_BUFFER_COUNT]; - ZeroMemory(qbuffer,BufferSizeBytes*MAX_BUFFER_COUNT); - - // Start two buffers. - // Frankly two buffers is all we should ever need since the buffer fill code - // is tied directly to the XAudio2 engine. - - { - XAUDIO2_BUFFER buf = {0}; - buf.AudioBytes = BufferSizeBytes; - buf.pContext=qbuffer; - buf.pAudioData=(BYTE*)buf.pContext; - pSourceVoice->SubmitSourceBuffer( &buf ); - } - - { - XAUDIO2_BUFFER buf = {0}; - buf.AudioBytes = BufferSizeBytes; - buf.pContext=&qbuffer[BufferSize]; - buf.pAudioData=(BYTE*)buf.pContext; - pSourceVoice->SubmitSourceBuffer( &buf ); - } - LeaveCriticalSection( &voiceContext.cs ); - - return 0; - } - - void Close() - { - EnterCriticalSection( &voiceContext.cs ); - - // Clean up? - // All XAudio2 interfaces are released when the engine is destroyed, - // but being tidy never hurt. - - // Actually it can hurt. As of DXSDK Aug 2008, doing a full cleanup causes - // XA2 on Vista to crash. Even if you copy/paste code directly from Microsoft. - // But doing no cleanup at all causes XA2 under XP to crash. So after much trial - // and error we found a happy comprimise as follows: - - if( pSourceVoice != NULL ) - pSourceVoice->DestroyVoice(); - - if( pMasteringVoice != NULL ) - pMasteringVoice->DestroyVoice(); - - SAFE_RELEASE( pXAudio2 ); - SAFE_DELETE_ARRAY( qbuffer ); - - pMasteringVoice = NULL; - voiceContext.sndout = NULL; - voiceContext.pSourceVoice = NULL; - pSourceVoice = NULL; - LeaveCriticalSection( &voiceContext.cs ); - DeleteCriticalSection( &voiceContext.cs ); - CoUninitialize(); - } - - virtual void Configure(HWND parent) - { - } - - virtual bool Is51Out() const { return false; } - - s32 Test() const - { - return 0; - } - - int GetEmptySampleCount() const - { - XAUDIO2_VOICE_STATE state; - pSourceVoice->GetState( &state ); - return state.SamplesPlayed & (BufferSize-1); - } - - const char* GetIdent() const - { - return "xaudio2"; - } - - const char* GetLongName() const - { - return "XAudio 2 (Recommended)"; - } - -} XA2; - -SndOutModule *XAudio2Out=&XA2; diff --git a/plugins/spu2ghz/src/common/PS2Edefs.h b/plugins/spu2ghz/src/common/PS2Edefs.h deleted file mode 100644 index 49b16e16d5..0000000000 --- a/plugins/spu2ghz/src/common/PS2Edefs.h +++ /dev/null @@ -1,885 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/spu2ghz/src/common/PS2Etypes.h b/plugins/spu2ghz/src/common/PS2Etypes.h deleted file mode 100644 index 4c62b47f0f..0000000000 --- a/plugins/spu2ghz/src/common/PS2Etypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifdef __LINUX__ -#define CALLBACK -#else -#define CALLBACK __stdcall -#endif - - -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x - -#define __naked __declspec(naked) - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -#define PCSX2_ALIGNED16_DECL(x) x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/spu2ghz/src/debug.cpp b/plugins/spu2ghz/src/debug.cpp deleted file mode 100644 index 8bd687dfa8..0000000000 --- a/plugins/spu2ghz/src/debug.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "spu2.h" - -int crazy_debug=0; - -char s[4096]; - -FILE *spu2Log; - -void FileLog(const char *fmt, ...) { -#ifdef SPU2_LOG - int n; - va_list list; - - if(!AccessLog()) return; - if(!spu2Log) return; - - va_start(list, fmt); - n=vsprintf(s,fmt, list); - va_end(list); - - fputs(s,spu2Log); - fflush(spu2Log); - -#if 0 - if(crazy_debug) - { - fputs(s,stderr); - fflush(stderr); - } -#endif -#endif -} - -void ConLog(const char *fmt, ...) { -#ifdef SPU2_LOG - int n; - va_list list; - - if(!MsgToConsole()) return; - - va_start(list, fmt); - n=vsprintf(s,fmt, list); - va_end(list); - - fputs(s,stderr); - fflush(stderr); - - if(spu2Log) - { - fputs(s,spu2Log); - fflush(spu2Log); - } -#endif -} - -void DoFullDump() { -#ifdef SPU2_LOG - FILE *dump; - u8 c=0, v=0; - - if(MemDump()) { - dump=fopen(MemDumpFileName,"wb"); - if (dump) { - fwrite(_spu2mem,0x200000,1,dump); - fclose(dump); - } - } - if(RegDump()) { - dump=fopen(RegDumpFileName,"wb"); - if (dump) { - fwrite(spu2regs,0x2000,1,dump); - fclose(dump); - } - } - - if(!CoresDump()) return; - dump=fopen(CoresDumpFileName,"wt"); - if (dump) { - for(c=0;c<2;c++) { - fprintf(dump,"#### CORE %d DUMP.\n",c); - fprintf(dump,"Master Volume for Left Channel: %x\n" - " - Value: %x\n" - " - Mode: %x\n" - " - Increment: %x\n", - Cores[c].MasterL.Reg_VOL, - Cores[c].MasterL.Value, - Cores[c].MasterL.Mode, - Cores[c].MasterL.Increment); - fprintf(dump,"Master Volume for Right Channel: %x\n" - " - Value: %x\n" - " - Mode: %x\n" - " - Increment: %x\n", - Cores[c].MasterR.Reg_VOL, - Cores[c].MasterR.Value, - Cores[c].MasterR.Mode, - Cores[c].MasterR.Increment); - fprintf(dump,"Volume for External Data Input (Left Channel): %x\n",Cores[c].ExtL); - fprintf(dump,"Volume for External Data Input (Right Channel): %x\n",Cores[c].ExtR); - fprintf(dump,"Volume for Sound Data Input (Left Channel): %x\n",Cores[c].InpL); - fprintf(dump,"Volume for Sound Data Input (Right Channel): %x\n",Cores[c].InpR); - fprintf(dump,"Volume for Output from Effects (Left Channel): %x\n",Cores[c].FxL); - fprintf(dump,"Volume for Output from Effects (Right Channel): %x\n",Cores[c].FxR); - fprintf(dump,"Interrupt Address: %x\n",Cores[c].IRQA); - fprintf(dump,"DMA Transfer Start Address: %x\n",Cores[c].TSA); - fprintf(dump,"External Input to Direct Output (Left): %s\n",Cores[c].ExtDryL?"Yes":"No"); - fprintf(dump,"External Input to Direct Output (Right): %s\n",Cores[c].ExtDryR?"Yes":"No"); - fprintf(dump,"External Input to Effects (Left): %s\n",Cores[c].ExtWetL?"Yes":"No"); - fprintf(dump,"External Input to Effects (Right): %s\n",Cores[c].ExtWetR?"Yes":"No"); - fprintf(dump,"Sound Data Input to Direct Output (Left): %s\n",Cores[c].SndDryL?"Yes":"No"); - fprintf(dump,"Sound Data Input to Direct Output (Right): %s\n",Cores[c].SndDryR?"Yes":"No"); - fprintf(dump,"Sound Data Input to Effects (Left): %s\n",Cores[c].SndWetL?"Yes":"No"); - fprintf(dump,"Sound Data Input to Effects (Right): %s\n",Cores[c].SndWetR?"Yes":"No"); - fprintf(dump,"Voice Data Input to Direct Output (Left): %s\n",Cores[c].InpDryL?"Yes":"No"); - fprintf(dump,"Voice Data Input to Direct Output (Right): %s\n",Cores[c].InpDryR?"Yes":"No"); - fprintf(dump,"Voice Data Input to Effects (Left): %s\n",Cores[c].InpWetL?"Yes":"No"); - fprintf(dump,"Voice Data Input to Effects (Right): %s\n",Cores[c].InpWetR?"Yes":"No"); - fprintf(dump,"IRQ Enabled: %s\n",Cores[c].IRQEnable?"Yes":"No"); - fprintf(dump,"Effects Enabled: %s\n",Cores[c].FxEnable?"Yes":"No"); - fprintf(dump,"Mute Enabled: %s\n",Cores[c].Mute?"Yes":"No"); - fprintf(dump,"Noise Clock: %d\n",Cores[c].NoiseClk); - fprintf(dump,"DMA Bits: %d\n",Cores[c].DMABits); - fprintf(dump,"Effects Start: %x\n",Cores[c].EffectsStartA); - fprintf(dump,"Effects End: %x\n",Cores[c].EffectsEndA); - fprintf(dump,"Registers:\n"); - fprintf(dump," - PMON: %x\n",Cores[c].Regs.PMON); - fprintf(dump," - NON: %x\n",Cores[c].Regs.NON); - fprintf(dump," - VMIXL: %x\n",Cores[c].Regs.VMIXL); - fprintf(dump," - VMIXR: %x\n",Cores[c].Regs.VMIXR); - fprintf(dump," - VMIXEL: %x\n",Cores[c].Regs.VMIXEL); - fprintf(dump," - VMIXER: %x\n",Cores[c].Regs.VMIXER); - fprintf(dump," - MMIX: %x\n",Cores[c].Regs.VMIXEL); - fprintf(dump," - ENDX: %x\n",Cores[c].Regs.VMIXER); - fprintf(dump," - STATX: %x\n",Cores[c].Regs.VMIXEL); - fprintf(dump," - ATTR: %x\n",Cores[c].Regs.VMIXER); - for(v=0;v<24;v++) { - fprintf(dump,"Voice %d:\n",v); - fprintf(dump," - Volume for Left Channel: %x\n" - " - Value: %x\n" - " - Mode: %x\n" - " - Increment: %x\n", - Cores[c].Voices[v].VolumeL.Reg_VOL, - Cores[c].Voices[v].VolumeL.Value, - Cores[c].Voices[v].VolumeL.Mode, - Cores[c].Voices[v].VolumeL.Increment); - fprintf(dump," - Volume for Right Channel: %x\n" - " - Value: %x\n" - " - Mode: %x\n" - " - Increment: %x\n", - Cores[c].Voices[v].VolumeR.Reg_VOL, - Cores[c].Voices[v].VolumeR.Value, - Cores[c].Voices[v].VolumeR.Mode, - Cores[c].Voices[v].VolumeR.Increment); - fprintf(dump," - ADSR Envelope: %x & %x\n" - " - Ar: %x\n" - " - Am: %x\n" - " - Dr: %x\n" - " - Sl: %x\n" - " - Sr: %x\n" - " - Sm: %x\n" - " - Rr: %x\n" - " - Rm: %x\n" - " - Phase: %x\n" - " - Value: %x\n", - Cores[c].Voices[v].ADSR.Reg_ADSR1, - Cores[c].Voices[v].ADSR.Reg_ADSR2, - Cores[c].Voices[v].ADSR.Ar, - Cores[c].Voices[v].ADSR.Am, - Cores[c].Voices[v].ADSR.Dr, - Cores[c].Voices[v].ADSR.Sl, - Cores[c].Voices[v].ADSR.Sr, - Cores[c].Voices[v].ADSR.Sm, - Cores[c].Voices[v].ADSR.Rr, - Cores[c].Voices[v].ADSR.Rm, - Cores[c].Voices[v].ADSR.Phase, - Cores[c].Voices[v].ADSR.Value); - fprintf(dump," - Pitch: %x\n",Cores[c].Voices[v].Pitch); - fprintf(dump," - Modulated: %s\n",Cores[c].Voices[v].Modulated?"Yes":"No"); - fprintf(dump," - Source: %s\n",Cores[c].Voices[v].Noise?"Noise":"Wave"); - fprintf(dump," - Direct Output for Left Channel: %s\n",Cores[c].Voices[v].DryL?"Yes":"No"); - fprintf(dump," - Direct Output for Right Channel: %s\n",Cores[c].Voices[v].DryR?"Yes":"No"); - fprintf(dump," - Effects Output for Left Channel: %s\n",Cores[c].Voices[v].WetL?"Yes":"No"); - fprintf(dump," - Effects Output for Right Channel: %s\n",Cores[c].Voices[v].WetR?"Yes":"No"); - fprintf(dump," - Loop Start Adress: %x\n",Cores[c].Voices[v].LoopStartA); - fprintf(dump," - Sound Start Adress: %x\n",Cores[c].Voices[v].StartA); - fprintf(dump," - Next Data Adress: %x\n",Cores[c].Voices[v].NextA); - fprintf(dump," - Play Start Cycle: %d\n",Cores[c].Voices[v].PlayCycle); - fprintf(dump," - Play Status: %s\n",(Cores[c].Voices[v].ADSR.Phase>0)?"Playing":"Not Playing"); - fprintf(dump," - Block Sample: %d\n",Cores[c].Voices[v].SCurrent); - } - fprintf(dump,"#### END OF DUMP.\n\n"); - } - } - fclose(dump); - dump=fopen("logs/effects.txt","wt"); - if (dump) { - for(c=0;c<2;c++) { - fprintf(dump,"#### CORE %d EFFECTS PROCESSOR DUMP.\n",c); - - fprintf(dump," - IN_COEF_L: %x\n",Cores[c].Revb.IN_COEF_R); - fprintf(dump," - IN_COEF_R: %x\n",Cores[c].Revb.IN_COEF_L); - - fprintf(dump," - FB_ALPHA: %x\n",Cores[c].Revb.FB_ALPHA); - fprintf(dump," - FB_X: %x\n",Cores[c].Revb.FB_X); - fprintf(dump," - FB_SRC_A: %x\n",Cores[c].Revb.FB_SRC_A); - fprintf(dump," - FB_SRC_B: %x\n",Cores[c].Revb.FB_SRC_B); - - fprintf(dump," - IIR_ALPHA: %x\n",Cores[c].Revb.IIR_ALPHA); - fprintf(dump," - IIR_COEF: %x\n",Cores[c].Revb.IIR_COEF); - fprintf(dump," - IIR_SRC_A0: %x\n",Cores[c].Revb.IIR_SRC_A0); - fprintf(dump," - IIR_SRC_A1: %x\n",Cores[c].Revb.IIR_SRC_A1); - fprintf(dump," - IIR_SRC_B1: %x\n",Cores[c].Revb.IIR_SRC_B0); - fprintf(dump," - IIR_SRC_B0: %x\n",Cores[c].Revb.IIR_SRC_B1); - fprintf(dump," - IIR_DEST_A0: %x\n",Cores[c].Revb.IIR_DEST_A0); - fprintf(dump," - IIR_DEST_A1: %x\n",Cores[c].Revb.IIR_DEST_A1); - fprintf(dump," - IIR_DEST_B0: %x\n",Cores[c].Revb.IIR_DEST_B0); - fprintf(dump," - IIR_DEST_B1: %x\n",Cores[c].Revb.IIR_DEST_B1); - - fprintf(dump," - ACC_COEF_A: %x\n",Cores[c].Revb.ACC_COEF_A); - fprintf(dump," - ACC_COEF_B: %x\n",Cores[c].Revb.ACC_COEF_B); - fprintf(dump," - ACC_COEF_C: %x\n",Cores[c].Revb.ACC_COEF_C); - fprintf(dump," - ACC_COEF_D: %x\n",Cores[c].Revb.ACC_COEF_D); - fprintf(dump," - ACC_SRC_A0: %x\n",Cores[c].Revb.ACC_SRC_A0); - fprintf(dump," - ACC_SRC_A1: %x\n",Cores[c].Revb.ACC_SRC_A1); - fprintf(dump," - ACC_SRC_B0: %x\n",Cores[c].Revb.ACC_SRC_B0); - fprintf(dump," - ACC_SRC_B1: %x\n",Cores[c].Revb.ACC_SRC_B1); - fprintf(dump," - ACC_SRC_C0: %x\n",Cores[c].Revb.ACC_SRC_C0); - fprintf(dump," - ACC_SRC_C1: %x\n",Cores[c].Revb.ACC_SRC_C1); - fprintf(dump," - ACC_SRC_D0: %x\n",Cores[c].Revb.ACC_SRC_D0); - fprintf(dump," - ACC_SRC_D1: %x\n",Cores[c].Revb.ACC_SRC_D1); - - fprintf(dump," - MIX_DEST_A0: %x\n",Cores[c].Revb.MIX_DEST_A0); - fprintf(dump," - MIX_DEST_A1: %x\n",Cores[c].Revb.MIX_DEST_A1); - fprintf(dump," - MIX_DEST_B0: %x\n",Cores[c].Revb.MIX_DEST_B0); - fprintf(dump," - MIX_DEST_B1: %x\n",Cores[c].Revb.MIX_DEST_B1); - fprintf(dump,"#### END OF DUMP.\n\n"); - } - fclose(dump); - } -#endif -} diff --git a/plugins/spu2ghz/src/debug.h b/plugins/spu2ghz/src/debug.h deleted file mode 100644 index b6d29e837a..0000000000 --- a/plugins/spu2ghz/src/debug.h +++ /dev/null @@ -1,67 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef DEBUG_H_INCLUDED -#define DEBUG_H_INCLUDED - -extern FILE *spu2Log; - -void FileLog(const char *fmt, ...); -void ConLog(const char *fmt, ...); - -void DoFullDump(); - -namespace WaveDump -{ - enum CoreSourceType - { - // Core's input stream, usually pulled from ADMA streams. - CoreSrc_Input = 0 - - // Output of the actual 24 input voices which have dry output enabled. - , CoreSrc_DryVoiceMix - - // Output of the actual 24 input voices that have wet output enabled. - , CoreSrc_WetVoiceMix - - // Wet mix including inputs and externals, prior to the application of reverb. - , CoreSrc_PreReverb - - // Wet mix after reverb has turned it into a pile of garbly gook. - , CoreSrc_PostReverb - - // Final output of the core. For core 0, it's the feed into Core1. - // For Core1, it's the feed into SndOut. - , CoreSrc_External - - , CoreSrc_Count - }; - - void Open(); - void Close(); - void WriteCore( uint coreidx, CoreSourceType src, s16 left, s16 right ); -} - -using WaveDump::CoreSrc_Input; -using WaveDump::CoreSrc_DryVoiceMix; -using WaveDump::CoreSrc_WetVoiceMix; -using WaveDump::CoreSrc_PreReverb; -using WaveDump::CoreSrc_PostReverb; -using WaveDump::CoreSrc_External; - -#endif // DEBUG_H_INCLUDED // diff --git a/plugins/spu2ghz/src/decoder.cpp b/plugins/spu2ghz/src/decoder.cpp deleted file mode 100644 index ac7efcf57f..0000000000 --- a/plugins/spu2ghz/src/decoder.cpp +++ /dev/null @@ -1,385 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "spu2.h" - -extern "C" { -#include "liba52/inttypes.h" -#include "liba52/a52.h" -#include "liba52/mm_accel.h" -} - -extern u32 spdif_read_data(u8 *buff, u32 max_data); - -#define DATA_SIZE 0x100000 - -u32 use51=0; - -u8 databuffer[DATA_SIZE]; -u32 data_in_buffer; - -s32 output_buffer[0x10000][6]; -s32 output_write_cursor=0; -s32 output_read_cursor=0; -s32 output_buffer_data=0; - -int flags,srate,bitrate; - -#define CHANNEL_CENTER 1 -#define CHANNEL_STEREO 2 -#define CHANNEL_SURROUND 4 -#define CHANNEL_LFE 8 - -int sample_flags = 0; - -u32 frame_size; - -a52_state_t* ac3dec; -sample_t *decode_buffer = NULL; - -s32 data_rate=4; - -int state=0; - -FILE *fSpdifDump; - -extern u32 core; -void __fastcall ReadInput(V_Core& thiscore, s32& PDataL,s32& PDataR); - -union spdif_frame { // total size: 32bits - struct { - u32 preamble:4; //4 - u32 databits:24; //28 - u32 valid:1; //29 - u32 subcode:1; //30 - u32 chanstat:1; //31 - u32 parity:1; //32 // parity not including preamble - } bits; - u32 whole; -}; - -union spdif_block { - spdif_frame frames[192]; - u8 bytes [192*4]; -}; - -/* -spdif_block bbuffer[2]; -u8 *bbuff = bbuffer[0].bytes; -u32 bbuff_bytes = 0; -*/ - -bool check_frame(spdif_frame f) -{ - u32 w = f.whole>>4; - u32 t = 0; - - for(int i=0;i>28;i++) - { - t=t^(w&1); - w>>=1; - } - - return (t==0)&&(f.bits.valid); -} - -void spdif_Write(s32 data) -{ - spdif_frame f; - - f.whole=data; - - if(check_frame(f)) - { - int dec = f.bits.databits; - databuffer[data_in_buffer++]=(dec )&0xFF; - databuffer[data_in_buffer++]=(dec>> 8)&0xFF; - databuffer[data_in_buffer++]=(dec>>16)&0xFF; - } -} - -void spdif_remove_data(unsigned int bytes) -{ - if(bytes0)*-1; //1 if positive, -1 if negative, 0 otherwise - n=abs(n)+1; //make it [1..2] - s32 k=*(s32*)&n; - k=k&0x7FFFFF; - return k*sign; -} - -void spdif_update() -{ - s32 Data,Zero; - - core=0; - V_Core& thiscore( Cores[core] ); - for(int i=0;i -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef DEFS_H_INCLUDED -#define DEFS_H_INCLUDED - -typedef enum {SPU2_VOL_MODE_CONST,SPU2_VOL_MODE_PLIN,SPU2_VOL_MODE_NLIN,SPU2_VOL_MODE_PLOG,SPU2_VOL_MODE_NLOG} V_VolMode; - -typedef struct { - u16 Reg_VOL; - s16 Value; //also Reg_VOLX - s8 Increment; - s8 Mode; -} V_Volume; - -typedef struct { - u16 Reg_ADSR1; - u16 Reg_ADSR2; -//also Reg_ENVX - s32 Value; // [Air] : Ranges from 0 to 0x7fffffff (signed values are clamped to 0) -// Phase - u8 Phase; -//Attack Rate - u8 Ar; -//Attack Mode - u8 Am; -//Decay Rate - u8 Dr; -//Sustain Level - u8 Sl; -//Sustain Rate - u8 Sr; -//Sustain Mode - u8 Sm; -//Release Rate - u8 Rr; -//Release Mode - u8 Rm; -//Ready To Release - u8 Releasing; -} V_ADSR; - - -typedef struct { -// SPU2 cycle where the Playing started - u32 PlayCycle; -// Left Volume - V_Volume VolumeL; -// Right Volume - V_Volume VolumeR; -// Envelope - V_ADSR ADSR; -// Pitch (also Reg_PITCH) - s16 Pitch; -// Pitch Modulated by previous voice - s8 Modulated; -// Source (Wave/Noise) - s8 Noise; -// Direct Output for Left Channel - s32 DryL; -// Direct Output for Right Channel - s32 DryR; -// Effect Output for Left Channel - s32 WetL; -// Effect Output for Right Channel - s32 WetR; -// Loop Start Adress (also Reg_LSAH/L) - u32 LoopStartA; -// Sound Start Adress (also Reg_SSAH/L) - u32 StartA; -// Next Read Data Adress (also Reg_NAXH/L) - u32 NextA; -// Voice Decoding State - s32 Prev1; - s32 Prev2; - - s8 LoopMode; - s8 LoopFlags; - -// [Air] : Replaced loop flags read from the ADPCM header with -// a single LoopFlags value (above) -- more cache-friendly. - //s8 LoopStart; - //s8 Loop; - //s8 LoopEnd; - -// Sample pointer (19:12 bit fixed point) - s32 SP; - -// Sample pointer for Cubic Interpolation -// Cubic interpolation mixes a sample behind Linear, so that it -// can have sample data to either side of the end points from which -// to extrapolate. This SP represents that late sample position. - s32 SPc; - -// Previous sample values - used for interpolation -// [Air] : Inverted order of these members to match the access order in the -// code (might improve cache hits). - s32 PV4; - s32 PV3; - s32 PV2; - s32 PV1; - -// Last outputted audio value, used for voice modulation. - s32 OutX; - -// SBuffer now points directly to an ADPCM cache entry. - s16 *SBuffer; - -// sample position within the current decoded packet. - s32 SCurrent; - -} V_Voice; - -#ifndef PUBLIC -// ** Begin Debug-only variables section ** -// Separated from the V_Voice struct to improve cache performance of -// the Public Release build. -struct V_VoiceDebug -{ - s8 FirstBlock; - s32 SampleData; - s32 PeakX; - s32 displayPeak; - s32 lastSetStartA; - s32 lastStopReason; -}; - -struct V_CoreDebug -{ - V_VoiceDebug Voices[24]; - s32 AutoDMAPeak; -// Last Transfer Size - u32 lastsize; -}; - -// Debug tracking information - 24 voices and 2 cores. -extern V_CoreDebug DebugCores[2]; -#endif - -typedef struct { - u16 IN_COEF_L; - u16 IN_COEF_R; - u32 FB_SRC_A; - u32 FB_SRC_B; - u16 FB_ALPHA; - u16 FB_X; - u32 IIR_SRC_A0; - u32 IIR_SRC_A1; - u32 IIR_SRC_B1; - u32 IIR_SRC_B0; - u32 IIR_DEST_A0; - u32 IIR_DEST_A1; - u32 IIR_DEST_B0; - u32 IIR_DEST_B1; - u16 IIR_ALPHA; - u16 IIR_COEF; - u32 ACC_SRC_A0; - u32 ACC_SRC_A1; - u32 ACC_SRC_B0; - u32 ACC_SRC_B1; - u32 ACC_SRC_C0; - u32 ACC_SRC_C1; - u32 ACC_SRC_D0; - u32 ACC_SRC_D1; - u16 ACC_COEF_A; - u16 ACC_COEF_B; - u16 ACC_COEF_C; - u16 ACC_COEF_D; - u32 MIX_DEST_A0; - u32 MIX_DEST_A1; - u32 MIX_DEST_B0; - u32 MIX_DEST_B1; -} V_Reverb; - -typedef struct { - u16 Out; - u16 Info; - u16 Unknown1; - u16 Mode; - u16 Media; - u16 Unknown2; - u16 Protection; -} V_SPDIF; - -typedef struct { - u32 PMON; - u32 NON; - u32 VMIXL; - u32 VMIXR; - u32 VMIXEL; - u32 VMIXER; - u16 MMIX; - u32 ENDX; - u16 STATX; - u16 ATTR; - u16 _1AC; -} V_CoreRegs; - -typedef struct { -// Core Voices - V_Voice Voices[24]; -// Master Volume for Left Channel - V_Volume MasterL; -// Master Volume for Right Channel - V_Volume MasterR; -// Volume for External Data Input (Left Channel) - u16 ExtL; -// Volume for External Data Input (Right Channel) - u16 ExtR; -// Volume for Sound Data Input (Left Channel) - u16 InpL; -// Volume for Sound Data Input (Right Channel) - u16 InpR; -// Volume for Output from Effects (Left Channel) - u16 FxL; -// Volume for Output from Effects (Right Channel) - u16 FxR; -// Interrupt Address - u32 IRQA; -// DMA Transfer Start Address - u32 TSA; -// DMA Transfer Data Address (Internal...) - u32 TDA; -// External Input to Direct Output (Left) - s32 ExtDryL; -// External Input to Direct Output (Right) - s32 ExtDryR; -// External Input to Effects (Left) - s32 ExtWetL; -// External Input to Effects (Right) - s32 ExtWetR; -// Sound Data Input to Direct Output (Left) - s32 InpDryL; -// Sound Data Input to Direct Output (Right) - s32 InpDryR; -// Sound Data Input to Effects (Left) - s32 InpWetL; -// Sound Data Input to Effects (Right) - s32 InpWetR; -// Voice Data to Direct Output (Left) - s32 SndDryL; -// Voice Data to Direct Output (Right) - s32 SndDryR; -// Voice Data to Effects (Left) - s32 SndWetL; -// Voice Data to Effects (Right) - s32 SndWetR; -// Interrupt Enable - s8 IRQEnable; -// DMA related? - s8 DMABits; -// Effect Enable - s8 FxEnable; -// Noise Clock - s8 NoiseClk; -// AutoDMA Status - u16 AutoDMACtrl; -// DMA Interrupt Counter - s32 DMAICounter; -// Mute - s8 Mute; -// Input Buffer - u32 InputDataLeft; - u32 InputPos; - u32 InputDataProgress; - u8 AdmaInProgress; - -// Reverb - V_Reverb Revb; - u32 EffectsStartA; - u32 EffectsEndA; - u32 ReverbX; -// Registers - V_CoreRegs Regs; - - u8 InitDelay; - - u8 CoreEnabled; - - u8 AttrBit0; - u8 AttrBit4; - u8 AttrBit5; - - u16*DMAPtr; - u32 MADR; - u32 TADR; - - s16 ADMATempBuffer[0x1000]; - - u32 ADMAPV; - u32 ADMAPL; - u32 ADMAPR; - -} V_Core; - -extern V_Core Cores[2]; -extern V_SPDIF Spdif; - -// Output Buffer Writing Position (the same for all data); -extern s16 OutPos; -// Input Buffer Reading Position (the same for all data); -extern s16 InputPos; -// SPU Mixing Cycles ("Ticks mixed" counter) -extern u32 Cycles; -extern u8 InpBuff; -// 1b0 "hack" -extern u32 Num; - - -#endif // DEFS_H_INCLUDED // diff --git a/plugins/spu2ghz/src/dma.cpp b/plugins/spu2ghz/src/dma.cpp deleted file mode 100644 index 3ec2a5f8eb..0000000000 --- a/plugins/spu2ghz/src/dma.cpp +++ /dev/null @@ -1,510 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "spu2.h" - -extern u8 callirq; - -FILE *DMA4LogFile=0; -FILE *DMA7LogFile=0; -FILE *ADMA4LogFile=0; -FILE *ADMA7LogFile=0; -FILE *ADMAOutLogFile=0; - -FILE *REGWRTLogFile[2]={0,0}; - -int packcount=0; - -u16* MBASE[2] = {0,0}; - -u16* DMABaseAddr; - -void DMALogOpen() { - if(!DMALog()) return; - DMA4LogFile=fopen(DMA4LogFileName,"wb"); - DMA7LogFile=fopen(DMA7LogFileName,"wb"); - ADMA4LogFile=fopen("logs/adma4.raw","wb"); - ADMA7LogFile=fopen("logs/adma7.raw","wb"); - ADMAOutLogFile=fopen("logs/admaOut.raw","wb"); - //REGWRTLogFile[0]=fopen("logs/RegWrite0.raw","wb"); - //REGWRTLogFile[1]=fopen("logs/RegWrite1.raw","wb"); -} -void DMA4LogWrite(void *lpData, u32 ulSize) { - if(!DMALog()) return; - if (!DMA4LogFile) return; - fwrite(lpData,ulSize,1,DMA4LogFile); -} - -void DMA7LogWrite(void *lpData, u32 ulSize) { - if(!DMALog()) return; - if (!DMA7LogFile) return; - fwrite(lpData,ulSize,1,DMA7LogFile); -} - -void ADMA4LogWrite(void *lpData, u32 ulSize) { - if(!DMALog()) return; - if (!ADMA4LogFile) return; - fwrite(lpData,ulSize,1,ADMA4LogFile); -} -void ADMA7LogWrite(void *lpData, u32 ulSize) { - if(!DMALog()) return; - if (!ADMA7LogFile) return; - fwrite(lpData,ulSize,1,ADMA7LogFile); -} -void ADMAOutLogWrite(void *lpData, u32 ulSize) { - if(!DMALog()) return; - if (!ADMAOutLogFile) return; - fwrite(lpData,ulSize,1,ADMAOutLogFile); -} - -void RegWriteLog(u32 core,u16 value) -{ - if(!DMALog()) return; - if (!REGWRTLogFile[core]) return; - fwrite(&value,2,1,REGWRTLogFile[core]); -} - -void DMALogClose() { - if(!DMALog()) return; - if (DMA4LogFile) fclose(DMA4LogFile); - if (DMA7LogFile) fclose(DMA7LogFile); - if (REGWRTLogFile[0]) fclose(REGWRTLogFile[0]); - if (REGWRTLogFile[1]) fclose(REGWRTLogFile[1]); - if (ADMA4LogFile) fclose(ADMA4LogFile); - if (ADMA7LogFile) fclose(ADMA7LogFile); - if (ADMAOutLogFile) fclose(ADMAOutLogFile); -} - - -__forceinline u16 DmaRead(u32 core) -{ - const u16 ret = (u16)spu2M_Read(Cores[core].TDA); - Cores[core].TDA++; - Cores[core].TDA&=0xfffff; - return ret; -} - -__forceinline void DmaWrite(u32 core, u16 value) -{ - spu2M_Write( Cores[core].TSA, value ); - Cores[core].TSA++; - Cores[core].TSA&=0xfffff; -} - -void AutoDMAReadBuffer(int core, int mode) //mode: 0= split stereo; 1 = do not split stereo -{ - int spos=((Cores[core].InputPos+0xff)&0x100); //starting position of the free buffer - - if(core==0) - ADMA4LogWrite(Cores[core].DMAPtr+Cores[core].InputDataProgress,0x400); - else - ADMA7LogWrite(Cores[core].DMAPtr+Cores[core].InputDataProgress,0x400); - - if(mode) - { - //hacky :p - - memcpy((Cores[core].ADMATempBuffer+(spos<<1)),Cores[core].DMAPtr+Cores[core].InputDataProgress,0x400); - Cores[core].MADR+=0x400; - Cores[core].InputDataLeft-=0x200; - Cores[core].InputDataProgress+=0x200; - } - else - { - memcpy((Cores[core].ADMATempBuffer+spos),Cores[core].DMAPtr+Cores[core].InputDataProgress,0x200); - //memcpy((spu2mem+0x2000+(core<<10)+spos),Cores[core].DMAPtr+Cores[core].InputDataProgress,0x200); - Cores[core].MADR+=0x200; - Cores[core].InputDataLeft-=0x100; - Cores[core].InputDataProgress+=0x100; - - memcpy((Cores[core].ADMATempBuffer+spos+0x200),Cores[core].DMAPtr+Cores[core].InputDataProgress,0x200); - //memcpy((spu2mem+0x2200+(core<<10)+spos),Cores[core].DMAPtr+Cores[core].InputDataProgress,0x200); - Cores[core].MADR+=0x200; - Cores[core].InputDataLeft-=0x100; - Cores[core].InputDataProgress+=0x100; - } - // See ReadInput at mixer.cpp for explanation on the commented out lines - // -} - -void StartADMAWrite(int core,u16 *pMem, u32 sz) -{ - int size=(sz)&(~511); - - if(MsgAutoDMA()) ConLog(" * SPU2: DMA%c AutoDMA Transfer of %d bytes to %x (%02x %x %04x).\n", - (core==0)?'4':'7',size<<1,Cores[core].TSA,Cores[core].DMABits,Cores[core].AutoDMACtrl,(~Cores[core].Regs.ATTR)&0x7fff); - - Cores[core].InputDataProgress=0; - if((Cores[core].AutoDMACtrl&(core+1))==0) - { - Cores[core].TSA=0x2000+(core<<10); - Cores[core].DMAICounter=size; - } - else if(size>=512) - { - Cores[core].InputDataLeft=size; - if(Cores[core].AdmaInProgress==0) - { -#ifdef PCM24_S1_INTERLEAVE - if((core==1)&&((PlayMode&8)==8)) - { - AutoDMAReadBuffer(core,1); - } - else - { - AutoDMAReadBuffer(core,0); - } -#else - if(((PlayMode&4)==4)&&(core==0)) - Cores[0].InputPos=0; - - AutoDMAReadBuffer(core,0); -#endif - - if(size==512) - Cores[core].DMAICounter=size; - } - - Cores[core].AdmaInProgress=1; - } - else - { - Cores[core].InputDataLeft=0; - Cores[core].DMAICounter=1; - } - Cores[core].TADR=Cores[core].MADR+(size<<1); -} - -void DoDMAWrite(int core,u16 *pMem,u32 size) -{ - // Perform an alignment check. - // Not really important. Everything should work regardless, - // but it could be indicative of an emulation foopah elsewhere. - -#if 0 - uptr pa = ((uptr)pMem)&7; - uptr pm = Cores[core].TSA&0x7; - - if( pa ) - { - fprintf(stderr, "* SPU2 DMA Write > Missaligned SOURCE! Core: %d TSA: 0x%x TDA: 0x%x Size: 0x%x\n", core, Cores[core].TSA, Cores[core].TDA, size); - } - - if( pm ) - { - fprintf(stderr, "* SPU2 DMA Write > Missaligned TARGET! Core: %d TSA: 0x%x TDA: 0x%x Size: 0x%x\n", core, Cores[core].TSA, Cores[core].TDA, size ); - } -#endif - - if(core==0) - DMA4LogWrite(pMem,size<<1); - else - DMA7LogWrite(pMem,size<<1); - - if(MsgDMA()) ConLog(" * SPU2: DMA%c Transfer of %d bytes to %x (%02x %x %04x).\n",(core==0)?'4':'7',size<<1,Cores[core].TSA,Cores[core].DMABits,Cores[core].AutoDMACtrl,(~Cores[core].Regs.ATTR)&0x7fff); - - Cores[core].TSA &= 0xfffff; - - u32 buff1end = Cores[core].TSA + size; - u32 buff2end=0; - if( buff1end > 0x100000 ) - { - buff2end = buff1end - 0x100000; - buff1end = 0x100000; - } - - const int cacheIdxStart = Cores[core].TSA / pcm_WordsPerBlock; - const int cacheIdxEnd = (buff1end+pcm_WordsPerBlock-1) / pcm_WordsPerBlock; - PcmCacheEntry* cacheLine = &pcm_cache_data[cacheIdxStart]; - PcmCacheEntry& cacheEnd = pcm_cache_data[cacheIdxEnd]; - - do - { - cacheLine->Validated = false; - cacheLine++; - } while ( cacheLine != &cacheEnd ); - -#if 0 - // Pcm Cache Invalidation! - // It's a requirement that we mask bits for the blocks that are written to *only*, - // because doing anything else can cause the cache to fail, thanks to the progressive - // nature of the SPU2's ADPCM encoding. (the same thing that makes it impossible - // to use SSE optimizations on it). - - u8* cache = (u8*)pcm_cache_flags; - - // Step 1: Clear bits in the front remainder. - - const int pcmTSA = Cores[core].TSA / pcm_WordsPerBlock; - const int pcmTDA = buff1end / pcm_WordsPerBlock; - const int remFront = pcmTSA & 31; - const int remBack = ((buff1end+pcm_WordsPerBlock-1)/pcm_WordsPerBlock) & 31; // round up to get the end remainder - - int flagTSA = pcmTSA / 32; - - if( remFront ) - { - // need to clear some upper bits of this u32 - uint mask = (1ul< 0 ) - { - // second branch needs copied: - // It starts at the beginning of memory and moves forward to buff2end - - // endpoint cache should be irrelevant, since it's almost certainly dynamic - // memory below 0x2800 (registers and such) - //const u32 endpt2 = (buff2end + roundUp) / indexer_scalar; - //memset( pcm_cache_flags, 0, endpt2 ); - - memcpy( GetMemPtr( 0 ), &pMem[buff1size], buff2end*2 ); - - Cores[core].TDA = (buff2end+1) & 0xfffff; - - if(Cores[core].IRQEnable) - { - // Flag interrupt? - // If IRQA occurs between start and dest, flag it. - // Since the buffer wraps, the conditional might seem odd, but it works. - - if( ( Cores[core].IRQA >= Cores[core].TSA ) || - ( Cores[core].IRQA <= Cores[core].TDA ) ) - { - Spdif.Info=4<= Cores[core].TSA ) && - ( Cores[core].IRQA <= Cores[core].TDA ) ) - { - Spdif.Info=4< 0x100000 ) - { - buff2end = buff1end - 0x100000; - buff1end = 0x100000; - } - - const u32 buff1size = (buff1end-Cores[core].TSA); - memcpy( pMem, GetMemPtr( Cores[core].TSA ), buff1size*2 ); - - if( buff2end > 0 ) - { - // second branch needs cleared: - // It starts at the beginning of memory and moves forward to buff2end - - memcpy( &pMem[buff1size], GetMemPtr( 0 ), buff2end*2 ); - - Cores[core].TDA = (buff2end+0x20) & 0xfffff; - - for( int i=0; i<2; i++ ) - { - if(Cores[i].IRQEnable) - { - // Flag interrupt? - // If IRQA occurs between start and dest, flag it. - // Since the buffer wraps, the conditional might seem odd, but it works. - - if( ( Cores[i].IRQA >= Cores[core].TSA ) || - ( Cores[i].IRQA <= Cores[core].TDA ) ) - { - Spdif.Info=4<= Cores[i].TSA ) && - ( Cores[i].IRQA <= Cores[i].TDA+0x1f ) ) - { - Spdif.Info=4< -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef DMA_H_INCLUDED -#define DMA_H_INCLUDED - -void DMALogOpen(); -void DMA4LogWrite(void *lpData, u32 ulSize); -void DMA7LogWrite(void *lpData, u32 ulSize); -void DMALogClose(); - -extern void DmaWrite(u32 core, u16 data); -extern u16 DmaRead(u32 core); - -extern void AutoDMAReadBuffer(int core, int mode); - -#endif // DMA_H_INCLUDED // \ No newline at end of file diff --git a/plugins/spu2ghz/src/interface.cpp b/plugins/spu2ghz/src/interface.cpp deleted file mode 100644 index b1b0f15ba3..0000000000 --- a/plugins/spu2ghz/src/interface.cpp +++ /dev/null @@ -1,454 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "spu2.h" -#include "regtable.h" - -#include "svnrev.h" - -// [Air]: Adding the spu2init boolean wasn't necessary except to help me in -// debugging the spu2 suspend/resume behavior (when user hits escape). -static bool spu2open=false; // has spu2open plugin interface been called? -static bool spu2init=false; // has spu2init plugin interface been called? - -static s32 logvolume[16384]; -static u32 pClocks=0; - - -static const u8 version = PS2E_SPU2_VERSION; -static const u8 revision = 1; -static const u8 build = 9; // increase that with each version - -static char libraryName[256]; - -BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD dwReason,LPVOID lpvReserved) -{ - if(dwReason==DLL_PROCESS_ATTACH) hInstance=hinstDLL; - return TRUE; -} - -static void InitLibraryName() -{ -#ifdef PUBLIC - - // Public Release! - // Output a simplified string that's just our name: - - strcpy( libraryName, "SPU2ghz" ); - -#elif defined( SVN_REV_UNKNOWN ) - - // Unknown revision. - // Output a name that includes devbuild status but not - // subversion revision tags: - - strcpy( libraryName, "SPU2ghz" -# ifdef _DEBUG_FAST - "-Debug" -# elif defined( DEBUG ) - "-Debug/Strict" // strict debugging is slow! -# else - "-Dev" -# endif - ); -#else - - // Use TortoiseSVN's SubWCRev utility's output - // to label the specific revision: - - sprintf_s( libraryName, "SPU2ghz r%d%s" -# ifdef _DEBUG_FAST - "-Debug" -# elif defined( _DEBUG ) - "-Debug/Strict" // strict debugging is slow! -# else - "-Dev" -# endif - ,SVN_REV, - SVN_MODS ? "m" : "" - ); -#endif - -} - -EXPORT_C_(u32) PS2EgetLibType() -{ - return PS2E_LT_SPU2; -} - -EXPORT_C_(char*) PS2EgetLibName() -{ - InitLibraryName(); - return libraryName; -} - -EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) -{ - return (version<<16)|(revision<<8)|build; -} - -EXPORT_C_(void) SPU2configure() { - configure(); -} - -EXPORT_C_(void) SPU2about() { - InitLibraryName(); - SysMessage( libraryName ); -} - -EXPORT_C_(s32) SPU2test() { - return SndTest(); -} - -EXPORT_C_(s32) SPU2init() -{ -#define MAKESURE(a,b) \ - /*fprintf(stderr,"%08p: %08p == %08p\n",&(regtable[a>>1]),regtable[a>>1],U16P(b));*/ \ - assert(regtable[(a)>>1]==U16P(b)) - - MAKESURE(0x800,zero); - - s32 c=0,v=0; - ReadSettings(); - -#ifdef SPU2_LOG - if(AccessLog()) - { - spu2Log = fopen(AccessLogFileName, "w"); - setvbuf(spu2Log, NULL, _IONBF, 0); - FileLog("SPU2init\n"); - } -#endif - srand((unsigned)time(NULL)); - - disableFreezes=false; - - if (spu2init) - { - ConLog( " * SPU2: Already initialized - Ignoring SPU2init signal." ); - return 0; - } - - spu2init=true; - - spu2regs = (short*)malloc(0x010000); - _spu2mem = (short*)malloc(0x200000); - - // adpcm decoder cache: - // the cache data size is determined by taking the number of adpcm blocks - // (2MB / 16) and multiplying it by the decoded block size (28 samples). - // Thus: pcm_cache_data = 7,340,032 bytes (ouch!) - // Expanded: 16 bytes expands to 56 bytes [3.5:1 ratio] - // Resulting in 2MB * 3.5. - - pcm_cache_data = (PcmCacheEntry*)calloc( pcm_BlockCount, sizeof(PcmCacheEntry) ); - - if( (spu2regs == NULL) || (_spu2mem == NULL) || - (pcm_cache_data == NULL) ) - { - SysMessage("SPU2: Error allocating Memory\n"); return -1; - } - - for(int mem=0;mem<0x800;mem++) - { - u16 *ptr=regtable[mem>>1]; - if(!ptr) { - regtable[mem>>1] = &(spu2Ru16(mem)); - } - } - - memset(spu2regs,0,0x010000); - memset(_spu2mem,0,0x200000); - memset(&Cores,0,(sizeof(V_Core) * 2)); - CoreReset(0); - CoreReset(1); - - DMALogOpen(); - - for(v=0;v<16384;v++) - { - logvolume[v]=(s32)(s32)floor(log((double)(v+1))*3376.7); - } - - LowPassFilterInit(); - InitADSR(); - -#ifdef STREAM_DUMP - il0=fopen("logs/spu2input0.pcm","wb"); - il1=fopen("logs/spu2input1.pcm","wb"); -#endif - -#ifdef EFFECTS_DUMP - el0=fopen("logs/spu2fx0.pcm","wb"); - el1=fopen("logs/spu2fx1.pcm","wb"); -#endif - - -#ifdef S2R_ENABLE - if(!replay_mode) - s2r_open("replay_dump.s2r"); -#endif - return 0; -} - -EXPORT_C_(s32) SPU2open(void *pDsp) -{ - if( spu2open ) return 0; - - FileLog("[%10d] SPU2 Open\n",Cycles); - - /* - if(debugDialogOpen==0) - { - hDebugDialog = CreateDialogParam(hInstance,MAKEINTRESOURCE(IDD_DEBUG),0,DebugProc,0); - ShowWindow(hDebugDialog,SW_SHOWNORMAL); - debugDialogOpen=1; - }*/ - - spu2open=true; - if (!SndInit()) - { - srate_pv=(double)SampleRate/48000.0; - - spdif_init(); - - DspLoadLibrary(dspPlugin,dspPluginModule); - - WaveDump::Open(); - - return 0; - } - else - { - SPU2close(); - return -1; - }; -} - -EXPORT_C_(void) SPU2close() -{ - if( !spu2open ) return; - FileLog("[%10d] SPU2 Close\n",Cycles); - - DspCloseLibrary(); - spdif_shutdown(); - SndClose(); - - spu2open = false; -} - -EXPORT_C_(void) SPU2shutdown() -{ - if(!spu2init) return; - - ConLog( " * SPU2: Shutting down.\n" ); - - SPU2close(); - -#ifdef S2R_ENABLE - if(!replay_mode) - s2r_close(); -#endif - - DoFullDump(); -#ifdef STREAM_DUMP - fclose(il0); - fclose(il1); -#endif -#ifdef EFFECTS_DUMP - fclose(el0); - fclose(el1); -#endif - WaveDump::Close(); - - DMALogClose(); - - spu2init = false; - - SAFE_FREE(spu2regs); - SAFE_FREE(_spu2mem); - - SAFE_FREE( pcm_cache_data ); - - spu2regs = NULL; - _spu2mem = NULL; - pcm_cache_data = NULL; - -#ifdef SPU2_LOG - if(!AccessLog()) return; - FileLog("[%10d] SPU2shutdown\n",Cycles); - if(spu2Log) fclose(spu2Log); -#endif -} - -EXPORT_C_(void) SPU2setClockPtr(u32 *ptr) -{ - cPtr=ptr; - hasPtr=(cPtr!=NULL); -} - -bool numpad_minus_old=false; -bool numpad_minus = false; -bool numpad_plus = false, numpad_plus_old = false; - -EXPORT_C_(void) SPU2async(u32 cycles) -{ -#ifndef PUBLIC - u32 oldClocks = lClocks; - static u32 timer=0,time1=0,time2=0; - timer++; - if (timer == 1){ - time1=timeGetTime(); - } - if (timer == 3000){ - time2 = timeGetTime()-time1 ; - timer=0; - } -#endif - - DspUpdate(); - - if(LimiterToggleEnabled) - { - numpad_minus = (GetAsyncKeyState(VK_SUBTRACT)&0x8000)!=0; - - if(numpad_minus && !numpad_minus_old) - { - if(LimitMode) LimitMode=0; - else LimitMode=1; - SndUpdateLimitMode(); - } - numpad_minus_old = numpad_minus; - } - -#ifndef PUBLIC - /*numpad_plus = (GetAsyncKeyState(VK_ADD)&0x8000)!=0; - if(numpad_plus && !numpad_plus_old) - { - DoFullDump(); - } - numpad_plus_old = numpad_plus;*/ -#endif - - if(hasPtr) - { - TimeUpdate(*cPtr); - } - else - { - pClocks+=cycles; - TimeUpdate(pClocks); - } -} - -EXPORT_C_(void) SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()) -{ - _irqcallback=SPU2callback; - dma4callback=DMA4callback; - dma7callback=DMA7callback; -} - -EXPORT_C_(u16) SPU2read(u32 rmem) -{ - // if(!replay_mode) - // s2r_readreg(Cycles,rmem); - - if(hasPtr) TimeUpdate(*cPtr); - - u16 ret=0xDEAD; u32 core=0, mem=rmem&0xFFFF, omem=mem; - if (mem & 0x400) { omem^=0x400; core=1; } - - if(rmem==0x1f9001AC) - { - ret = DmaRead(core); - } - else if (rmem>>16 == 0x1f80) - { - ret = SPU_ps1_read(rmem); - } - else if ((mem&0xFFFF)>=0x800) - { - ret=spu2Ru16(mem); - ConLog(" * SPU2: Read from reg>=0x800: %x value %x\n",mem,ret); - FileLog(" * SPU2: Read from reg>=0x800: %x value %x\n",mem,ret); - } - else - { - ret = *(regtable[(mem>>1)]); - - FileLog("[%10d] SPU2 read mem %x (core %d, register %x): %x\n",Cycles, mem, core, (omem & 0x7ff), ret); - } - - return ret; -} - -EXPORT_C_(void) SPU2write(u32 rmem, u16 value) -{ -#ifdef S2R_ENABLE - if(!replay_mode) - s2r_writereg(Cycles,rmem,value); -#endif - - if(rmem==0x1f9001ac) - { - //RegWriteLog(0,value); - if((Cores[0].IRQEnable)&&(Cores[0].TSA==Cores[0].IRQA)) - { - Spdif.Info=4; - SetIrqCall(); - } - spu2M_Write( Cores[0].TSA++, value ); - Cores[0].TSA&=0xfffff; - } - else if(rmem==0x1f9005ac) - { - //RegWriteLog(1,value); - if((Cores[0].IRQEnable)&&(Cores[0].TSA==Cores[0].IRQA)) - { - Spdif.Info=4; - SetIrqCall(); - } - spu2M_Write( Cores[1].TSA++, value ); - Cores[1].TSA&=0xfffff; - } - else - { - if(hasPtr) TimeUpdate(*cPtr); - - if (rmem>>16 == 0x1f80) - SPU_ps1_write(rmem,value); - else - SPU2_FastWrite( rmem, value ); - } -} - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -EXPORT_C_(int) SPU2setupRecording(int start, void* pData) -{ - // Don't record if we have a bogus state. - if( disableFreezes ) return 0; - - if(start==0) - RecordStop(); - else if(start==1) - RecordStart(); - - return 0; -} diff --git a/plugins/spu2ghz/src/lowpass.cpp b/plugins/spu2ghz/src/lowpass.cpp deleted file mode 100644 index da26ee7388..0000000000 --- a/plugins/spu2ghz/src/lowpass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "lowpass.h" -#include -#include - -void LPF_init(LPF_data*lpf,double freq, double srate) -{ - double omega = 2*freq/srate; - double g = 1.0; - - // calculating coefficients: - - double k,p,q,a; - double a0,a1,a2,a3,a4; - - k=(4.0*g-3.0)/(g+1.0); - p=1.0-0.25*k;p*=p; - - // LP: - a=1.0/(tan(0.5*omega)*(1.0+p)); - p=1.0+a; - q=1.0-a; - - a0=1.0/(k+p*p*p*p); - a1=4.0*(k+p*p*p*q); - a2=6.0*(k+p*p*q*q); - a3=4.0*(k+p*q*q*q); - a4= (k+q*q*q*q); - p=a0*(k+1.0); - - lpf->coef[0]=p; - lpf->coef[1]=4.0*p; - lpf->coef[2]=6.0*p; - lpf->coef[3]=4.0*p; - lpf->coef[4]=p; - lpf->coef[5]=-a1*a0; - lpf->coef[6]=-a2*a0; - lpf->coef[7]=-a3*a0; - lpf->coef[8]=-a4*a0; -} -double LPF(LPF_data* lpf, double in) -{ -// per sample: - - double out=lpf->coef[0]*in+lpf->d[0]; - lpf->d[0] =lpf->coef[1]*in+lpf->coef[5]*out+lpf->d[1]; - lpf->d[1] =lpf->coef[2]*in+lpf->coef[6]*out+lpf->d[2]; - lpf->d[2] =lpf->coef[3]*in+lpf->coef[7]*out+lpf->d[3]; - lpf->d[3] =lpf->coef[4]*in+lpf->coef[8]*out; -return out; -} diff --git a/plugins/spu2ghz/src/lowpass.h b/plugins/spu2ghz/src/lowpass.h deleted file mode 100644 index 5281f31548..0000000000 --- a/plugins/spu2ghz/src/lowpass.h +++ /dev/null @@ -1,27 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#pragma once - -typedef struct IIR_data -{ - double coef[9]; - double d[4]; -} LPF_data; - -void LPF_init(LPF_data*lpf,double freq, double srate); -double LPF(LPF_data* lpf, double in); diff --git a/plugins/spu2ghz/src/mixer.cpp b/plugins/spu2ghz/src/mixer.cpp deleted file mode 100644 index b9c12348e2..0000000000 --- a/plugins/spu2ghz/src/mixer.cpp +++ /dev/null @@ -1,1454 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -// [Air] Notes -----> -// Adding 'static' to the __forceinline methods hints to the linker that it need not -// actually include procedural versions of the methods in the DLL. Under normal circumstances -// the compiler will still generate the procedures even though they are never used (the inline -// code is used instead). Using static reduced the size of my generated .DLL by a few KB. -// (doesn't really make anything faster, but eh... whatever :) -// -#include "spu2.h" - -#include -#include "lowpass.h" - -#undef min -#undef max - -#include - -using std::min; -using std::max; - -extern void spdif_update(); - -void ADMAOutLogWrite(void *lpData, u32 ulSize); - -extern void VoiceStop(int core,int vc); - -double pow_2_31 = pow(2.0,31.0); - -LPF_data L,R; -extern u32 core; -u32 core, voice; -extern u8 callirq; -double srate_pv=1.0; - -static const s32 ADSR_MAX_VOL = 0x7fffffff; - -static const s32 f[5][2] = -{ - { 0, 0 }, - { 60, 0 }, - { 115, -52 }, - { 98, -55 }, - { 122, -60 } -}; - -static const int InvExpOffsets[] = { 0,4,6,8,9,10,11,12 }; - -static u32 PsxRates[160]; -/*= -{ - - //for +Lin: PsxRates[value+8] - //for -Lin: PsxRates[value+7] - - 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, - 0xD744FCCB,0xB504F334,0x9837F052,0x80000000,0x6BA27E65,0x5A82799A,0x4C1BF829,0x40000000, - 0x35D13F33,0x2D413CCD,0x260DFC14,0x20000000,0x1AE89F99,0x16A09E66,0x1306FE0A,0x10000000, - 0x0D744FCD,0x0B504F33,0x09837F05,0x08000000,0x06BA27E6,0x05A8279A,0x04C1BF83,0x04000000, - 0x035D13F3,0x02D413CD,0x0260DFC1,0x02000000,0x01AE89FA,0x016A09E6,0x01306FE1,0x01000000, - 0x00D744FD,0x00B504F3,0x009837F0,0x00800000,0x006BA27E,0x005A827A,0x004C1BF8,0x00400000, - 0x0035D13F,0x002D413D,0x00260DFC,0x00200000,0x001AE8A0,0x0016A09E,0x001306FE,0x00100000, - 0x000D7450,0x000B504F,0x0009837F,0x00080000,0x0006BA28,0x0005A828,0x0004C1C0,0x00040000, - 0x00035D14,0x0002D414,0x000260E0,0x00020000,0x0001AE8A,0x00016A0A,0x00013070,0x00010000, - 0x0000D745,0x0000B505,0x00009838,0x00008000,0x00006BA2,0x00005A82,0x00004C1C,0x00004000, - 0x000035D1,0x00002D41,0x0000260E,0x00002000,0x00001AE9,0x000016A1,0x00001307,0x00001000, - 0x00000D74,0x00000B50,0x00000983,0x00000800,0x000006BA,0x000005A8,0x000004C2,0x00000400, - 0x0000035D,0x000002D4,0x00000261,0x00000200,0x000001AF,0x0000016A,0x00000130,0x00000100, - 0x000000D7,0x000000B5,0x00000098,0x00000080,0x0000006C,0x0000005B,0x0000004C,0x00000040, - 0x00000036,0x0000002D,0x00000026,0x00000020,0x0000001B,0x00000017,0x00000013,0x00000010, - 0x0000000D,0x0000000B,0x0000000A,0x00000008,0x00000007,0x00000006,0x00000005,0x00000004, - 0x00000003,0x00000003,0x00000002,0x00000002,0x00000002,0x00000001,0x00000001,0x00000000, - - //128+8 - 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000, -};*/ - - -// Performs a 64-bit multiplication between two values and returns the -// high 32 bits as a result (discarding the fractional 32 bits). -// The combined fracional bits of both inputs must be 32 bits for this -// to work properly. -// -// This is meant to be a drop-in replacement for times when the 'div' part -// of a MulDiv is a constant. (example: 1<<8, or 4096, etc) -// -// [Air] Performance breakdown: This is over 10 times faster than MulDiv in -// a *worst case* scenario. It's also more accurate since it forces the -// caller to extend the inputs so that they make use of all 32 bits of -// precision. -// -static s32 __forceinline MulShr32( s32 srcval, s32 mulval ) -{ - s64 tmp = ((s64)srcval * mulval ); - return ((s32*)&tmp)[1]; - - // Performance note: Using the temp var and memory reference - // actually ends up being roughly 2x faster than using a bitshift. - // It won't fly on big endian machines though... :) -} - -static s32 __forceinline MulShr32su( s32 srcval, u32 mulval ) -{ - s64 tmp = ((s64)srcval * (s32)mulval ); - return ((s32*)&tmp)[1]; -} - - -void InitADSR() // INIT ADSR -{ - for (int i=0; i<(32+128); i++) - { - int shift=(i-32)>>2; - s64 rate=(i&3)+4; - if (shift<0) - rate >>= -shift; - else - rate <<= shift; - - PsxRates[i] = (int)min( rate, 0x3fffffffLL ); - } -} - -#define VOL(x) (((s32)x)) //24.8 volume - -static void __forceinline XA_decode_block(s16* buffer, const s16* block, s32& prev1, s32& prev2) -{ - const s32 header = *block; - s32 shift = ((header>> 0)&0xF)+16; - s32 pred1 = f[(header>> 4)&0xF][0]; - s32 pred2 = f[(header>> 4)&0xF][1]; - - const s8* blockbytes = (s8*)&block[1]; - - for(int i=0; i<14; i++, blockbytes++) - { - s32 pcm, pcm2; - { - s32 data = ((*blockbytes)<<28) & 0xF0000000; - pcm = data>>shift; - pcm+=((pred1*prev1)+(pred2*prev2))>>6; - if(pcm> 32767) pcm= 32767; - else if(pcm<-32768) pcm=-32768; - *(buffer++) = pcm; - } - - //prev2=prev1; - //prev1=pcm; - - { - s32 data = ((*blockbytes)<<24) & 0xF0000000; - pcm2 = data>>shift; - pcm2+=((pred1*pcm)+(pred2*prev1))>>6; - if(pcm2> 32767) pcm2= 32767; - else if(pcm2<-32768) pcm2=-32768; - *(buffer++) = pcm2; - } - - prev2=pcm; - prev1=pcm2; - } -} - -static void __forceinline XA_decode_block_unsaturated(s16* buffer, const s16* block, s32& prev1, s32& prev2) -{ - const s32 header = *block; - s32 shift = ((header>> 0)&0xF)+16; - s32 pred1 = f[(header>> 4)&0xF][0]; - s32 pred2 = f[(header>> 4)&0xF][1]; - - const s8* blockbytes = (s8*)&block[1]; - - for(int i=0; i<14; i++, blockbytes++) - { - s32 pcm, pcm2; - { - s32 data = ((*blockbytes)<<28) & 0xF0000000; - pcm = data>>shift; - pcm+=((pred1*prev1)+(pred2*prev2))>>6; - // [Air] : Fast method, no saturation is performed. - *(buffer++) = pcm; - } - - { - s32 data = ((*blockbytes)<<24) & 0xF0000000; - pcm2 = data>>shift; - pcm2+=((pred1*pcm)+(pred2*prev1))>>6; - // [Air] : Fast method, no saturation is performed. - *(buffer++) = pcm2; - } - - prev2=pcm; - prev1=pcm2; - } -} - -static void __forceinline IncrementNextA( const V_Core& thiscore, V_Voice& vc ) -{ - // Important! Both cores signal IRQ when an address is read, regardless of - // which core actually reads the address. - - for( int i=0; i<2; i++ ) - { - if( Cores[i].IRQEnable && (vc.NextA==Cores[i].IRQA ) ) - { - #ifndef PUBLIC - ConLog(" * SPU2 Core %d: IRQ Called (IRQ passed).\n", i); - #endif - Spdif.Info=4<> 8; // grab loop flags from the upper byte. - - const int cacheIdx = vc.NextA / pcm_WordsPerBlock; - PcmCacheEntry& cacheLine = pcm_cache_data[cacheIdx]; - vc.SBuffer = cacheLine.Sampledata; - - if( cacheLine.Validated ) - { - // Cached block! Read from the cache directly. - // Make sure to propagate the prev1/prev2 ADPCM: - - vc.Prev1 = vc.SBuffer[27]; - vc.Prev2 = vc.SBuffer[26]; - - //ConLog( " * SPU2 : Cache Hit! NextA=0x%x, cacheIdx=0x%x\n", vc.NextA, cacheIdx ); - - #ifndef PUBLIC - g_counter_cache_hits++; - #endif - } - else - { - // Only flag the cache if it's a non-dynamic memory range. - if( vc.NextA >= SPU2_DYN_MEMLINE ) - cacheLine.Validated = true; - - #ifndef PUBLIC - if( vc.NextA < SPU2_DYN_MEMLINE ) - g_counter_cache_ignores++; - else - g_counter_cache_misses++; - #endif - - s16* sbuffer = cacheLine.Sampledata; - - // saturated decoder - XA_decode_block( sbuffer, memptr, vc.Prev1, vc.Prev2 ); - - // [Air]: Testing use of a new unsaturated decoder. (benchmark needed) - // Chances are the saturation isn't needed, but for a very few exception games. - // This is definitely faster than the above version, but is it by enough to - // merit possible lower compatibility? Especially now that games that make - // heavy use of the SPU2 via music or sfx will mostly use the cache anyway. - - //XA_decode_block_unsaturated( vc.SBuffer, memptr, vc.Prev1, vc.Prev2 ); - } - - vc.SCurrent = 0; - if( (vc.LoopFlags & XAFLAG_LOOP_START) && !vc.LoopMode ) - vc.LoopStartA = vc.NextA; - } - - IncrementNextA( thiscore, vc ); - -_skipIncrement: - Data = vc.SBuffer[vc.SCurrent++]; -} - -// Returns the linear slide value for AR and SR inputs. -static int GetLinearSrAr( uint SrAr ) -{ - // The Sr/Ar settings work in quarter steps, which means - // the bottom 2 bits go on the left side of the shift, and - // the right side of the shift gets divided by 4: - - const uint newSr = 0x7f - SrAr; - return ((1|(newSr&3)) << (newSr>>2)); -} - -static void __forceinline CalculateADSR( V_Voice& vc ) -{ - V_ADSR& env(vc.ADSR); - - jASSUME( env.Phase != 0 ); - - if(env.Releasing && (env.Phase < 5)) - env.Phase = 5; - - switch (env.Phase) - { - case 1: // attack - if( env.Value == ADSR_MAX_VOL ) - { - // Already maxed out. Progress phase and nothing more: - env.Phase++; - break; - } - - // Case 1 below is for pseudo exponential below 75%. - // Pseudo Exp > 75% and Linear are the same. - - if (env.Am && (env.Value>=0x60000000)) - env.Value += PsxRates[(env.Ar^0x7f)-0x18+32]; - else //if( env.Ar < 0x7f ) - env.Value+=PsxRates[(env.Ar^0x7f)-0x10+32]; - //env.Value += GetLinearSrAr( env.Ar ); - - if( env.Value < 0 ) - { - // We hit the ceiling. - env.Phase++; - env.Value = ADSR_MAX_VOL; - } - break; - - case 2: // decay - { - u32 off = InvExpOffsets[(env.Value>>28)&7]; - env.Value-=PsxRates[((env.Dr^0x1f)*4)-0x18+off+32]; - - // calculate sustain level by mirroring the bits - // of the sustain var into the lower bits as we shift up - // (total shift, 27 bits) - - s32 suslev = (env.Sl << 4) | env.Sl; - suslev = (suslev << 8) | suslev; // brings us to 12 bits! - suslev = (suslev << 12) | suslev; // 24 bits! - - if( env.Value <= (suslev<<3) ) - { - if (env.Value < 0) - env.Value = 0; - env.Phase++; - } - } - break; - - case 3: // sustain - { - // 0x7f disables sustain (infinite sustain) - if( env.Sr == 0x7f ) return; - - if (env.Sm&2) // decreasing - { - if (env.Sm&4) // exponential - { - u32 off = InvExpOffsets[(env.Value>>28)&7]; - env.Value-=PsxRates[(env.Sr^0x7f)-0x1b+off+32]; - } - else // linear - { - env.Value-=PsxRates[(env.Sr^0x7f)-0xf+32]; - //env.Value -= GetLinearSrAr( env.Sr ); - } - - if( env.Value <= 0 ) - { - env.Value = 0; - env.Phase++; - } - } - else // increasing - { - if( (env.Sm&4) && (env.Value>=0x60000000) ) - env.Value+=PsxRates[(env.Sr^0x7f)-0x18+32]; - else - { - // linear / Pseudo below 75% (they're the same) - env.Value+=PsxRates[(env.Sr^0x7f)-0x10+32]; - //env.Value += GetLinearSrAr( env.Sr ); - } - - if( env.Value < 0 ) - { - env.Value = ADSR_MAX_VOL; - env.Phase++; - } - } - } - break; - - case 4: // sustain end - env.Value = (env.Sm&2) ? 0 : ADSR_MAX_VOL; - if(env.Value==0) - env.Phase=6; - break; - - case 5: // release - - if (env.Rm) // exponential - { - u32 off=InvExpOffsets[(env.Value>>28)&7]; - env.Value-=PsxRates[((env.Rr^0x1f)*4)-0x18+off+32]; - } - else // linear - { - //env.Value-=PsxRates[((env.Rr^0x1f)*4)-0xc+32]; - if( env.Rr != 0x1f ) - env.Value -= (1 << (0x1f-env.Rr)); - } - - if( env.Value <= 0 ) - { - env.Value=0; - env.Phase++; - } - break; - - case 6: // release end - env.Value=0; - break; - - jNO_DEFAULT - } - - if (env.Phase==6) { - #ifndef PUBLIC - if(MsgVoiceOff()) ConLog(" * SPU2: Voice Off by ADSR: %d \n", voice); - DebugCores[core].Voices[voice].lastStopReason = 2; - #endif - VoiceStop(core,voice); - Cores[core].Regs.ENDX|=(1<> 15; -} - -static void __forceinline UpdatePitch( V_Voice& vc ) -{ - s32 pitch; - - // [Air] : re-ordered comparisons: Modulated is much more likely to be zero than voice, - // and so the way it was before it's have to check both voice and modulated values - // most of the time. Now it'll just check Modulated and short-circuit past the voice - // check (not that it amounts to much, but eh every little bit helps). - if( (vc.Modulated==0) || (voice==0) ) - pitch = vc.Pitch; - else - pitch = (vc.Pitch*(32768 + abs(Cores[core].Voices[voice-1].OutX)))>>15; - - vc.SP+=pitch; -} - -// Returns a 16 bit result in Value. -static void __forceinline GetVoiceValues_Linear(V_Core& thiscore, V_Voice& vc, s32& Value) -{ - while( vc.SP > 0 ) - { - vc.PV2=vc.PV1; - - GetNextDataBuffered( thiscore, vc, vc.PV1 ); - - vc.SP-=4096; - } - - if( vc.ADSR.Phase==0 ) - { - Value = 0; - return; - } - - CalculateADSR( vc ); - - jASSUME( vc.ADSR.Value >= 0 ); // ADSR should never be negative... - - // Note! It's very important that ADSR stay as accurate as possible. By the way - // it is used, various sound effects can end prematurely if we truncate more than - // one or two bits. - - if(Interpolation==0) - { - Value = MulShr32( vc.PV1<<1, vc.ADSR.Value ); - } - else //if(Interpolation==1) //must be linear - { - s32 t0 = vc.PV2 - vc.PV1; - Value = MulShr32( (vc.PV1<<1) - ((t0*vc.SP)>>11), vc.ADSR.Value ); - } -} - -// Returns a 16 bit result in Value. -static void __forceinline GetVoiceValues_Cubic(V_Core& thiscore, V_Voice& vc, s32& Value) -{ - while( vc.SP > 0 ) - { - vc.PV4=vc.PV3; - vc.PV3=vc.PV2; - vc.PV2=vc.PV1; - - GetNextDataBuffered( thiscore, vc, vc.PV1 ); - vc.PV1<<=2; - vc.SPc = vc.SP&4095; // just the fractional part, please! - vc.SP-=4096; - } - - if( vc.ADSR.Phase==0 ) - { - Value = 0; - return; - } - - CalculateADSR( vc ); - - jASSUME( vc.ADSR.Value >= 0 ); // ADSR should never be negative... - - s32 z0 = vc.PV3 - vc.PV4 + vc.PV1 - vc.PV2; - s32 z1 = (vc.PV4 - vc.PV3 - z0); - s32 z2 = (vc.PV2 - vc.PV4); - - s32 mu = vc.SPc; - - s32 val = (z0 * mu) >> 12; - val = ((val + z1) * mu) >> 12; - val = ((val + z2) * mu) >> 12; - val += vc.PV2; - - // Note! It's very important that ADSR stay as accurate as possible. By the way - // it is used, various sound effects can end prematurely if we truncate more than - // one or two bits. - Value = MulShr32( val, vc.ADSR.Value>>1 ); -} - -// Noise values need to be mixed without going through interpolation, since it -// can wreak havoc on the noise (causing muffling or popping). Not that this noise -// generator is accurate in its own right.. but eh, ah well :) -static void __forceinline __fastcall GetNoiseValues(V_Core& thiscore, V_Voice& vc, s32& Data) -{ - while(vc.SP>=4096) - { - GetNoiseValues( Data ); - vc.SP-=4096; - } - - // GetNoiseValues can't set the phase zero on us unexpectedly - // like GetVoiceValues can. Better assert just in case though.. - jASSUME( vc.ADSR.Phase != 0 ); - - CalculateADSR( vc ); - - // Yup, ADSR applies even to noise sources... - Data = MulShr32( Data, vc.ADSR.Value ); -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -void __fastcall ReadInput(V_Core& thiscore, s32& PDataL,s32& PDataR) -{ - if((thiscore.AutoDMACtrl&(core+1))==(core+1)) - { - s32 tl,tr; - - if((core==1)&&((PlayMode&8)==8)) - { - thiscore.InputPos&=~1; - - // CDDA mode - // Source audio data is 32 bits. - // We don't yet have the capability to handle this high res input data - // so we just downgrade it to 16 bits for now. - -#ifdef PCM24_S1_INTERLEAVE - *PDataL=*(((s32*)(thiscore.ADMATempBuffer+(thiscore.InputPos<<1)))); - *PDataR=*(((s32*)(thiscore.ADMATempBuffer+(thiscore.InputPos<<1)+2))); -#else - s32 *pl=(s32*)&(thiscore.ADMATempBuffer[thiscore.InputPos]); - s32 *pr=(s32*)&(thiscore.ADMATempBuffer[thiscore.InputPos+0x200]); - PDataL=*pl; - PDataR=*pr; -#endif - - PDataL>>=1; //give 31 bit data (SndOut downsamples the rest of the way) - PDataR>>=1; - - thiscore.InputPos+=2; - if((thiscore.InputPos==0x100)||(thiscore.InputPos>=0x200)) { - thiscore.AdmaInProgress=0; - if(thiscore.InputDataLeft>=0x200) - { - u8 k=thiscore.InputDataLeft>=thiscore.InputDataProgress; - -#ifdef PCM24_S1_INTERLEAVE - AutoDMAReadBuffer(core,1); -#else - AutoDMAReadBuffer(core,0); -#endif - thiscore.AdmaInProgress=1; - - thiscore.TSA=(core<<10)+thiscore.InputPos; - - if (thiscore.InputDataLeft<0x200) - { - FileLog("[%10d] AutoDMA%c block end.\n",Cycles, (core==0)?'4':'7'); - - #ifndef PUBLIC - if(thiscore.InputDataLeft>0) - { - if(MsgAutoDMA()) ConLog("WARNING: adma buffer didn't finish with a whole block!!\n"); - } - #endif - thiscore.InputDataLeft=0; - thiscore.DMAICounter=1; - } - } - thiscore.InputPos&=0x1ff; - } - - } - else if((core==0)&&((PlayMode&4)==4)) - { - thiscore.InputPos&=~1; - - s32 *pl=(s32*)&(thiscore.ADMATempBuffer[thiscore.InputPos]); - s32 *pr=(s32*)&(thiscore.ADMATempBuffer[thiscore.InputPos+0x200]); - PDataL=*pl; - PDataR=*pr; - - thiscore.InputPos+=2; - if(thiscore.InputPos>=0x200) { - thiscore.AdmaInProgress=0; - if(thiscore.InputDataLeft>=0x200) - { - u8 k=thiscore.InputDataLeft>=thiscore.InputDataProgress; - - AutoDMAReadBuffer(core,0); - - thiscore.AdmaInProgress=1; - - thiscore.TSA=(core<<10)+thiscore.InputPos; - - if (thiscore.InputDataLeft<0x200) - { - FileLog("[%10d] Spdif AutoDMA%c block end.\n",Cycles, (core==0)?'4':'7'); - - #ifndef PUBLIC - if(thiscore.InputDataLeft>0) - { - if(MsgAutoDMA()) ConLog("WARNING: adma buffer didn't finish with a whole block!!\n"); - } - #endif - thiscore.InputDataLeft=0; - thiscore.DMAICounter=1; - } - } - thiscore.InputPos&=0x1ff; - } - - } - else - { - if((core==1)&&((PlayMode&2)!=0)) - { - tl=0; - tr=0; - } - else - { - // Using the temporary buffer because this area gets overwritten by some other code. - //*PDataL=(s32)*(s16*)(spu2mem+0x2000+(core<<10)+thiscore.InputPos); - //*PDataR=(s32)*(s16*)(spu2mem+0x2200+(core<<10)+thiscore.InputPos); - - tl=(s32)thiscore.ADMATempBuffer[thiscore.InputPos]; - tr=(s32)thiscore.ADMATempBuffer[thiscore.InputPos+0x200]; - - } - - PDataL=tl; - PDataR=tr; - - thiscore.InputPos++; - if((thiscore.InputPos==0x100)||(thiscore.InputPos>=0x200)) { - thiscore.AdmaInProgress=0; - if(thiscore.InputDataLeft>=0x200) - { - u8 k=thiscore.InputDataLeft>=thiscore.InputDataProgress; - - AutoDMAReadBuffer(core,0); - - thiscore.AdmaInProgress=1; - - thiscore.TSA=(core<<10)+thiscore.InputPos; - - if (thiscore.InputDataLeft<0x200) - { - thiscore.AutoDMACtrl |= ~3; - - #ifndef PUBLIC - FileLog("[%10d] AutoDMA%c block end.\n",Cycles, (core==0)?'4':'7'); - if(thiscore.InputDataLeft>0) - { - if(MsgAutoDMA()) ConLog("WARNING: adma buffer didn't finish with a whole block!!\n"); - } - #endif - thiscore.InputDataLeft=0; - thiscore.DMAICounter=1; - } - } - thiscore.InputPos&=0x1ff; - } - } - } - else { - PDataL=0; - PDataR=0; - } -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -static void __forceinline __fastcall ReadInputPV(V_Core& thiscore, s32& ValL,s32& ValR) -{ - s32 DL=0, DR=0; - - u32 pitch=AutoDMAPlayRate[core]; - - if(pitch==0) pitch=48000; - - thiscore.ADMAPV+=pitch; - while(thiscore.ADMAPV>=48000) - { - ReadInput(thiscore, DL,DR); - thiscore.ADMAPV-=48000; - thiscore.ADMAPL=DL; - thiscore.ADMAPR=DR; - } - - ValL=thiscore.ADMAPL; - ValR=thiscore.ADMAPR; - - #ifndef PUBLIC - s32 InputPeak = max(abs(ValL),abs(ValR)); - if(DebugCores[core].AutoDMAPeak>12)&7]; - Vol.Value -= PsxRates[(Vol.Increment^0x7f)-0x1b+off+32] >> 16; - } - else - Vol.Value -= Vol.Increment; - - if (Vol.Value < 0) - { - Vol.Value = 0; - Vol.Mode = 0; // disable slide - } - } - else - { - // Increment - // Pseudo-exponential increments, as done by the SPU2 (really!) - // Above 75% slides slow, below 75% slides fast. It's exponential, pseudoly speaking. - - if( (Vol.Mode & VOLFLAG_EXPONENTIAL) && (Vol.Value>=0x6000)) - Vol.Value += PsxRates[(Vol.Increment^0x7f)-0x18+32] >> 16; - else - Vol.Value += Vol.Increment; - - if( Vol.Value < 0 ) // wrapped around the "top"? - { - Vol.Value = 0x7fff; - Vol.Mode = 0; // disable slide - } - } -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -static s32 __forceinline clamp(s32 x) -{ - if (x>0x00ffffff) return 0x00ffffff; - if (x<0xff000000) return 0xff000000; - return x; -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -static void DoReverb( V_Core& thiscore, s32& OutL, s32& OutR, s32 InL, s32 InR) -{ - static s32 INPUT_SAMPLE_L,INPUT_SAMPLE_R; - static s32 OUTPUT_SAMPLE_L,OUTPUT_SAMPLE_R; - - if(!(thiscore.FxEnable&&EffectsEnabled)) - { - OUTPUT_SAMPLE_L=0; - OUTPUT_SAMPLE_R=0; - } - else if((Cycles&1)==0) - { - INPUT_SAMPLE_L=InL; - INPUT_SAMPLE_R=InR; - } - else - { -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// - s32 IIR_INPUT_A0,IIR_INPUT_A1,IIR_INPUT_B0,IIR_INPUT_B1; - s32 ACC0,ACC1; - s32 FB_A0,FB_A1,FB_B0,FB_B1; - s32 buffsize=thiscore.EffectsEndA-thiscore.EffectsStartA+1; - - if(buffsize<0) - { - buffsize = thiscore.EffectsEndA; - thiscore.EffectsEndA=thiscore.EffectsStartA; - thiscore.EffectsStartA=buffsize; - buffsize=thiscore.EffectsEndA-thiscore.EffectsStartA+1; - } - - //filter the 2 samples (prev then current) - LowPass(INPUT_SAMPLE_L, INPUT_SAMPLE_R); - LowPass(InL, InR); - - INPUT_SAMPLE_L=(INPUT_SAMPLE_L+InL)>>9; - INPUT_SAMPLE_R=(INPUT_SAMPLE_R+InR)>>9; - -#define BUFFER(x) ((s32)(*GetMemPtr(thiscore.EffectsStartA + ((thiscore.ReverbX + buffsize-((x)<<2))%buffsize)))) -#define SBUFFER(x) (*GetMemPtr(thiscore.EffectsStartA + ((thiscore.ReverbX + buffsize-((x)<<2))%buffsize))) - - thiscore.ReverbX=((thiscore.ReverbX + 4)%buffsize); - - IIR_INPUT_A0 = (BUFFER(thiscore.Revb.IIR_SRC_A0) * thiscore.Revb.IIR_COEF + INPUT_SAMPLE_L * thiscore.Revb.IN_COEF_L)>>16; - IIR_INPUT_A1 = (BUFFER(thiscore.Revb.IIR_SRC_A1) * thiscore.Revb.IIR_COEF + INPUT_SAMPLE_R * thiscore.Revb.IN_COEF_R)>>16; - IIR_INPUT_B0 = (BUFFER(thiscore.Revb.IIR_SRC_B0) * thiscore.Revb.IIR_COEF + INPUT_SAMPLE_L * thiscore.Revb.IN_COEF_L)>>16; - IIR_INPUT_B1 = (BUFFER(thiscore.Revb.IIR_SRC_B1) * thiscore.Revb.IIR_COEF + INPUT_SAMPLE_R * thiscore.Revb.IN_COEF_R)>>16; - - SBUFFER(thiscore.Revb.IIR_DEST_A0 + 4) = clamp((IIR_INPUT_A0 * thiscore.Revb.IIR_ALPHA + BUFFER(thiscore.Revb.IIR_DEST_A0) * (65535 - thiscore.Revb.IIR_ALPHA))>>16); - SBUFFER(thiscore.Revb.IIR_DEST_A1 + 4) = clamp((IIR_INPUT_A1 * thiscore.Revb.IIR_ALPHA + BUFFER(thiscore.Revb.IIR_DEST_A1) * (65535 - thiscore.Revb.IIR_ALPHA))>>16); - SBUFFER(thiscore.Revb.IIR_DEST_B0 + 4) = clamp((IIR_INPUT_B0 * thiscore.Revb.IIR_ALPHA + BUFFER(thiscore.Revb.IIR_DEST_B0) * (65535 - thiscore.Revb.IIR_ALPHA))>>16); - SBUFFER(thiscore.Revb.IIR_DEST_B1 + 4) = clamp((IIR_INPUT_B1 * thiscore.Revb.IIR_ALPHA + BUFFER(thiscore.Revb.IIR_DEST_B1) * (65535 - thiscore.Revb.IIR_ALPHA))>>16); - - ACC0 = (s32)(BUFFER(thiscore.Revb.ACC_SRC_A0) * thiscore.Revb.ACC_COEF_A + - BUFFER(thiscore.Revb.ACC_SRC_B0) * thiscore.Revb.ACC_COEF_B + - BUFFER(thiscore.Revb.ACC_SRC_C0) * thiscore.Revb.ACC_COEF_C + - BUFFER(thiscore.Revb.ACC_SRC_D0) * thiscore.Revb.ACC_COEF_D)>>16; - ACC1 = (s32)(BUFFER(thiscore.Revb.ACC_SRC_A1) * thiscore.Revb.ACC_COEF_A + - BUFFER(thiscore.Revb.ACC_SRC_B1) * thiscore.Revb.ACC_COEF_B + - BUFFER(thiscore.Revb.ACC_SRC_C1) * thiscore.Revb.ACC_COEF_C + - BUFFER(thiscore.Revb.ACC_SRC_D1) * thiscore.Revb.ACC_COEF_D)>>16; - - FB_A0 = BUFFER(thiscore.Revb.MIX_DEST_A0 - thiscore.Revb.FB_SRC_A); - FB_A1 = BUFFER(thiscore.Revb.MIX_DEST_A1 - thiscore.Revb.FB_SRC_A); - FB_B0 = BUFFER(thiscore.Revb.MIX_DEST_B0 - thiscore.Revb.FB_SRC_B); - FB_B1 = BUFFER(thiscore.Revb.MIX_DEST_B1 - thiscore.Revb.FB_SRC_B); - - SBUFFER(thiscore.Revb.MIX_DEST_A0) = clamp((ACC0 - FB_A0 * thiscore.Revb.FB_ALPHA)>>16); - SBUFFER(thiscore.Revb.MIX_DEST_A1) = clamp((ACC1 - FB_A1 * thiscore.Revb.FB_ALPHA)>>16); - SBUFFER(thiscore.Revb.MIX_DEST_B0) = clamp(((thiscore.Revb.FB_ALPHA * ACC0) - FB_A0 * (65535 - thiscore.Revb.FB_ALPHA) - FB_B0 * thiscore.Revb.FB_X)>>16); - SBUFFER(thiscore.Revb.MIX_DEST_B1) = clamp(((thiscore.Revb.FB_ALPHA * ACC1) - FB_A1 * (65535 - thiscore.Revb.FB_ALPHA) - FB_B1 * thiscore.Revb.FB_X)>>16); - - OUTPUT_SAMPLE_L=clamp((BUFFER(thiscore.Revb.MIX_DEST_A0)+BUFFER(thiscore.Revb.MIX_DEST_B0))>>2); - OUTPUT_SAMPLE_R=clamp((BUFFER(thiscore.Revb.MIX_DEST_B1)+BUFFER(thiscore.Revb.MIX_DEST_B1))>>2); - } - OutL=OUTPUT_SAMPLE_L; - OutR=OUTPUT_SAMPLE_R; -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -// writes a signed value to the SPU2 ram -// Performs no cache invalidation -- use only for dynamic memory ranges -// of the SPU2 (between 0x0000 and SPU2_DYN_MEMLINE) -static __forceinline void spu2M_WriteFast( u32 addr, s16 value ) -{ - // throw an assertion if the memory range is invalid: - jASSUME( addr < SPU2_DYN_MEMLINE ); - *GetMemPtr( addr ) = value; -} - - -static __forceinline void MixVoice( V_Core& thiscore, V_Voice& vc, s32& VValL, s32& VValR ) -{ - s32 Value=0; - - VValL = 0; - VValR = 0; - - // Most games don't use much volume slide effects. So only call the UpdateVolume - // methods when needed by checking the flag outside the method here... - - if( vc.VolumeL.Mode & VOLFLAG_SLIDE_ENABLE ) UpdateVolume( vc.VolumeL ); - if( vc.VolumeR.Mode & VOLFLAG_SLIDE_ENABLE ) UpdateVolume( vc.VolumeR ); - - if( vc.ADSR.Phase > 0 ) - { - UpdatePitch( vc ); - - if( vc.Noise ) - GetNoiseValues( thiscore, vc, Value ); - else - { - if( Interpolation == 2 ) - GetVoiceValues_Cubic( thiscore, vc, Value ); - else - GetVoiceValues_Linear( thiscore, vc, Value ); - } - - // Record the output (used for modulation effects) - vc.OutX = Value; - - #ifndef PUBLIC - DebugCores[core].Voices[voice].displayPeak = max(DebugCores[core].Voices[voice].displayPeak,abs(Value)); - #endif - - // TODO : Implement this using high-def MulShr32. - // vc.VolumeL/R are 15 bits. Value should be 32 bits (but is currently 16) - - VValL = ApplyVolume(Value,vc.VolumeL.Value); - VValR = ApplyVolume(Value,vc.VolumeR.Value); - } - - // Write-back of raw voice data (post ADSR applied) - - if (voice==1) spu2M_WriteFast( 0x400 + (core<<12) + OutPos, (s16)Value ); - else if (voice==3) spu2M_WriteFast( 0x600 + (core<<12) + OutPos, (s16)Value ); - -} - - -static void __fastcall MixCore(s32& OutL, s32& OutR, s32 ExtL, s32 ExtR) -{ - s32 RVL,RVR; - s32 SDL=0,SDR=0; - s32 SWL=0,SWR=0; - - V_Core& thiscore( Cores[core] ); - - for (voice=0;voice<24;voice++) - { - s32 VValL,VValR; - - V_Voice& vc( thiscore.Voices[voice] ); - MixVoice( thiscore, vc, VValL, VValR ); - - // Note: Results from MixVoice are ranged at 16 bits. - // Following muls are toggles only (0 or 1) - - SDL += VValL & vc.DryL; - SDR += VValR & vc.DryR; - SWL += VValL & vc.WetL; - SWR += VValR & vc.WetR; - } - - // Saturate final result to standard 16 bit range. - SDL = min( max( SDL, -0x8000 ), 0x7fff ); - SDR = min( max( SDR, -0x8000 ), 0x7fff ); - SWL = min( max( SWL, -0x8000 ), 0x7fff ); - SWR = min( max( SWR, -0x8000 ), 0x7fff ); - - // Write Mixed results To Output Area - spu2M_WriteFast( 0x1000 + (core<<12) + OutPos, (s16)SDL ); - spu2M_WriteFast( 0x1200 + (core<<12) + OutPos, (s16)SDR ); - spu2M_WriteFast( 0x1400 + (core<<12) + OutPos, (s16)SWL ); - spu2M_WriteFast( 0x1600 + (core<<12) + OutPos, (s16)SWR ); - - // Write mixed results to logfile (if enabled) - - WaveDump::WriteCore( core, CoreSrc_DryVoiceMix, SDL, SDR ); - WaveDump::WriteCore( core, CoreSrc_WetVoiceMix, SWL, SWR ); - - s32 TDL,TDR; - - // Mix in the Input data - TDL = OutL & thiscore.InpDryL; - TDR = OutR & thiscore.InpDryR; - - // Mix in the Voice data - TDL += SDL & thiscore.SndDryL; - TDR += SDR & thiscore.SndDryR; - - // Mix in the External (nothing/core0) data - TDL += ExtL & thiscore.ExtDryL; - TDR += ExtR & thiscore.ExtDryR; - - if(EffectsEnabled) - { - s32 TWL,TWR; - - // Mix Input, Voice, and External data: - TWL = OutL & thiscore.InpWetL; - TWR = OutR & thiscore.InpWetR; - TWL += SWL & thiscore.SndWetL; - TWR += SWR & thiscore.SndWetR; - TWL += ExtL & thiscore.ExtWetL; - TWR += ExtR & thiscore.ExtWetR; - - WaveDump::WriteCore( core, CoreSrc_PreReverb, TWL, TWR ); - - //Apply Effects - DoReverb( thiscore, RVL, RVR, TWL, TWR ); - - TWL = ApplyVolume(RVL,VOL(thiscore.FxL)); - TWR = ApplyVolume(RVR,VOL(thiscore.FxR)); - - WaveDump::WriteCore( core, CoreSrc_PostReverb, TWL, TWR ); - - //Mix Wet,Dry - OutL = (TDL + TWL); - OutR = (TDR + TWR); - } - else - { - OutL = TDL; - OutR = TDR; - } - - //Apply Master Volume - if( thiscore.MasterL.Mode & VOLFLAG_SLIDE_ENABLE ) UpdateVolume(thiscore.MasterL); - if( thiscore.MasterR.Mode & VOLFLAG_SLIDE_ENABLE ) UpdateVolume(thiscore.MasterR); - - if (thiscore.Mute==0) - { - // Final output value -- We don't use ApplyVolume sot hat we can leave the 15 bits of - // fixed point accuracy in place for SoundTouch and other post processing. - - OutL = OutL * thiscore.MasterL.Value; - OutR = OutR * thiscore.MasterR.Value; - } - else - { - OutL=0; - OutR=0; - } -} - -// used to throttle the output rate of cache stat reports -static int p_cachestat_counter=0; - -void __fastcall Mix() -{ - s32 ExtL=0, ExtR=0, OutL, OutR; - - // **** CORE ZERO **** - - core=0; - if( (PlayMode&4) == 0 ) - { - // get input data from input buffers - ReadInputPV(Cores[0], ExtL, ExtR); - WaveDump::WriteCore( 0, CoreSrc_Input, ExtL, ExtR ); - } - - MixCore( ExtL, ExtR, 0, 0 ); - - if( PlayMode & 4 ) - { - ExtL=0; - ExtR=0; - } - - // Commit Core 0 output to ram before mixing Core 1: - ExtL>>=15; - ExtR>>=15; - - ExtL = min( max( ExtL, -0x8000 ), 0x7fff ); - ExtR = min( max( ExtR, -0x8000 ), 0x7fff ); - - spu2M_WriteFast( 0x800 + OutPos, ExtL ); - spu2M_WriteFast( 0xA00 + OutPos, ExtR ); - - WaveDump::WriteCore( 0, CoreSrc_External, ExtL, ExtR ); - - // **** CORE ONE **** - - core=1; - if( (PlayMode&8) != 8 ) - { - ReadInputPV(Cores[1], OutL, OutR); // get input data from input buffers - WaveDump::WriteCore( 1, CoreSrc_Input, OutL, OutR ); - } - - // Apply volume to the external (Core 0) input data. - - MixCore( OutL, OutR, ApplyVolume( ExtL, Cores[1].ExtL), ApplyVolume( ExtR, Cores[1].ExtR) ); - - if( PlayMode & 8 ) - { - // Experimental CDDA support - // The CDDA overrides all other mixer output. It's a direct feed! - - ReadInput(Cores[1], OutL, OutR); - //WaveLog::WriteCore( 1, "CDDA-32", OutL, OutR ); - } - -#ifndef PUBLIC - static s32 Peak0,Peak1; - static s32 PCount; - - Peak0 = max(Peak0,max(ExtL,ExtR)); - Peak1 = max(Peak1,max(OutL,OutR)); -#endif - - // Update spdif (called each sample) - if(PlayMode&4) - spdif_update(); - - OutL >>= 6; - OutR >>= 6; - - // AddToBuffer - SndWrite(OutL, OutR); - OutPos++; - if (OutPos>=0x200) OutPos=0; - -#ifndef PUBLIC - // [TODO]: Create an INI option to enable/disable this particular log. - p_cachestat_counter++; - if(p_cachestat_counter > (48000*10) ) - { - p_cachestat_counter = 0; - if( MsgCache() ) ConLog( " * SPU2 > CacheStats > Hits: %d Misses: %d Ignores: %d\n", - g_counter_cache_hits, - g_counter_cache_misses, - g_counter_cache_ignores ); - - g_counter_cache_hits = - g_counter_cache_misses = - g_counter_cache_ignores = 0; - } -#endif -} - -///////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////// -// // - -/* ------------------------------------------------------------------------------ -PSX reverb hardware notes -by Neill Corlett ------------------------------------------------------------------------------ - -Yadda yadda disclaimer yadda probably not perfect yadda well it's okay anyway -yadda yadda. - ------------------------------------------------------------------------------ - -Basics ------- - -- The reverb buffer is 22khz 16-bit mono PCM. -- It starts at the reverb address given by 1DA2, extends to - the end of sound RAM, and wraps back to the 1DA2 address. - -Setting the address at 1DA2 resets the current reverb work address. - -This work address ALWAYS increments every 1/22050 sec., regardless of -whether reverb is enabled (bit 7 of 1DAA set). - -And the contents of the reverb buffer ALWAYS play, scaled by the -"reverberation depth left/right" volumes (1D84/1D86). -(which, by the way, appear to be scaled so 3FFF=approx. 1.0, 4000=-1.0) - ------------------------------------------------------------------------------ - -Register names --------------- - -These are probably not their real names. -These are probably not even correct names. -We will use them anyway, because we can. - -1DC0: FB_SRC_A (offset) -1DC2: FB_SRC_B (offset) -1DC4: IIR_ALPHA (coef.) -1DC6: ACC_COEF_A (coef.) -1DC8: ACC_COEF_B (coef.) -1DCA: ACC_COEF_C (coef.) -1DCC: ACC_COEF_D (coef.) -1DCE: IIR_COEF (coef.) -1DD0: FB_ALPHA (coef.) -1DD2: FB_X (coef.) -1DD4: IIR_DEST_A0 (offset) -1DD6: IIR_DEST_A1 (offset) -1DD8: ACC_SRC_A0 (offset) -1DDA: ACC_SRC_A1 (offset) -1DDC: ACC_SRC_B0 (offset) -1DDE: ACC_SRC_B1 (offset) -1DE0: IIR_SRC_A0 (offset) -1DE2: IIR_SRC_A1 (offset) -1DE4: IIR_DEST_B0 (offset) -1DE6: IIR_DEST_B1 (offset) -1DE8: ACC_SRC_C0 (offset) -1DEA: ACC_SRC_C1 (offset) -1DEC: ACC_SRC_D0 (offset) -1DEE: ACC_SRC_D1 (offset) -1DF0: IIR_SRC_B1 (offset) -1DF2: IIR_SRC_B0 (offset) -1DF4: MIX_DEST_A0 (offset) -1DF6: MIX_DEST_A1 (offset) -1DF8: MIX_DEST_B0 (offset) -1DFA: MIX_DEST_B1 (offset) -1DFC: IN_COEF_L (coef.) -1DFE: IN_COEF_R (coef.) - -The coefficients are signed fractional values. --32768 would be -1.0 - 32768 would be 1.0 (if it were possible... the highest is of course 32767) - -The offsets are (byte/8) offsets into the reverb buffer. -i.e. you multiply them by 8, you get byte offsets. -You can also think of them as (samples/4) offsets. -They appear to be signed. They can be negative. -None of the documented presets make them negative, though. - -Yes, 1DF0 and 1DF2 appear to be backwards. Not a typo. - ------------------------------------------------------------------------------ - -What it does ------------- - -We take all reverb sources: -- regular channels that have the reverb bit on -- cd and external sources, if their reverb bits are on -and mix them into one stereo 44100hz signal. - -Lowpass/downsample that to 22050hz. The PSX uses a proper bandlimiting -algorithm here, but I haven't figured out the hysterically exact specifics. -I use an 8-tap filter with these coefficients, which are nice but probably -not the real ones: - -0.037828187894 -0.157538631280 -0.321159685278 -0.449322115345 -0.449322115345 -0.321159685278 -0.157538631280 -0.037828187894 - -So we have two input samples (INPUT_SAMPLE_L, INPUT_SAMPLE_R) every 22050hz. - -* IN MY EMULATION, I divide these by 2 to make it clip less. - (and of course the L/R output coefficients are adjusted to compensate) - The real thing appears to not do this. - -At every 22050hz tick: -- If the reverb bit is enabled (bit 7 of 1DAA), execute the reverb - steady-state algorithm described below -- AFTERWARDS, retrieve the "wet out" L and R samples from the reverb buffer - (This part may not be exactly right and I guessed at the coefs. TODO: check later.) - L is: 0.333 * (buffer[MIX_DEST_A0] + buffer[MIX_DEST_B0]) - R is: 0.333 * (buffer[MIX_DEST_A1] + buffer[MIX_DEST_B1]) -- Advance the current buffer position by 1 sample - -The wet out L and R are then upsampled to 44100hz and played at the -"reverberation depth left/right" (1D84/1D86) volume, independent of the main -volume. - ------------------------------------------------------------------------------ - -Reverb steady-state -------------------- - -The reverb steady-state algorithm is fairly clever, and of course by -"clever" I mean "batshit insane". - -buffer[x] is relative to the current buffer position, not the beginning of -the buffer. Note that all buffer offsets must wrap around so they're -contained within the reverb work area. - -Clipping is performed at the end... maybe also sooner, but definitely at -the end. - -IIR_INPUT_A0 = buffer[IIR_SRC_A0] * IIR_COEF + INPUT_SAMPLE_L * IN_COEF_L; -IIR_INPUT_A1 = buffer[IIR_SRC_A1] * IIR_COEF + INPUT_SAMPLE_R * IN_COEF_R; -IIR_INPUT_B0 = buffer[IIR_SRC_B0] * IIR_COEF + INPUT_SAMPLE_L * IN_COEF_L; -IIR_INPUT_B1 = buffer[IIR_SRC_B1] * IIR_COEF + INPUT_SAMPLE_R * IN_COEF_R; - -IIR_A0 = IIR_INPUT_A0 * IIR_ALPHA + buffer[IIR_DEST_A0] * (1.0 - IIR_ALPHA); -IIR_A1 = IIR_INPUT_A1 * IIR_ALPHA + buffer[IIR_DEST_A1] * (1.0 - IIR_ALPHA); -IIR_B0 = IIR_INPUT_B0 * IIR_ALPHA + buffer[IIR_DEST_B0] * (1.0 - IIR_ALPHA); -IIR_B1 = IIR_INPUT_B1 * IIR_ALPHA + buffer[IIR_DEST_B1] * (1.0 - IIR_ALPHA); - -buffer[IIR_DEST_A0 + 1sample] = IIR_A0; -buffer[IIR_DEST_A1 + 1sample] = IIR_A1; -buffer[IIR_DEST_B0 + 1sample] = IIR_B0; -buffer[IIR_DEST_B1 + 1sample] = IIR_B1; - -ACC0 = buffer[ACC_SRC_A0] * ACC_COEF_A + - buffer[ACC_SRC_B0] * ACC_COEF_B + - buffer[ACC_SRC_C0] * ACC_COEF_C + - buffer[ACC_SRC_D0] * ACC_COEF_D; -ACC1 = buffer[ACC_SRC_A1] * ACC_COEF_A + - buffer[ACC_SRC_B1] * ACC_COEF_B + - buffer[ACC_SRC_C1] * ACC_COEF_C + - buffer[ACC_SRC_D1] * ACC_COEF_D; - -FB_A0 = buffer[MIX_DEST_A0 - FB_SRC_A]; -FB_A1 = buffer[MIX_DEST_A1 - FB_SRC_A]; -FB_B0 = buffer[MIX_DEST_B0 - FB_SRC_B]; -FB_B1 = buffer[MIX_DEST_B1 - FB_SRC_B]; - -buffer[MIX_DEST_A0] = ACC0 - FB_A0 * FB_ALPHA; -buffer[MIX_DEST_A1] = ACC1 - FB_A1 * FB_ALPHA; -buffer[MIX_DEST_B0] = (FB_ALPHA * ACC0) - FB_A0 * (FB_ALPHA^0x8000) - FB_B0 * FB_X; -buffer[MIX_DEST_B1] = (FB_ALPHA * ACC1) - FB_A1 * (FB_ALPHA^0x8000) - FB_B1 * FB_X; - ------------------------------------------------------------------------------ -*/ diff --git a/plugins/spu2ghz/src/mixer.h b/plugins/spu2ghz/src/mixer.h deleted file mode 100644 index ce809b95d3..0000000000 --- a/plugins/spu2ghz/src/mixer.h +++ /dev/null @@ -1,26 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef MIXER_H_INCLUDED -#define MIXER_H_INCLUDED - -void __fastcall Mix(); - -void __fastcall LogVolInit(); -void __fastcall LogVolClose(); - -#endif // MIXER_H_INCLUDED // diff --git a/plugins/spu2ghz/src/regs.h b/plugins/spu2ghz/src/regs.h deleted file mode 100644 index 455f1e82a1..0000000000 --- a/plugins/spu2ghz/src/regs.h +++ /dev/null @@ -1,184 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef REGS_H_INCLUDED -#define REGS_H_INCLUDED - -#define SPU2_CORE0 0x00000000 -#define SPU2_CORE1 0x00000400 - -#define SPU2_VP(voice) ((voice) * 16) -#define SPU2_VA(voice) ((voice) * 12) - -#define REG_VP_VOLL 0x0000 // Voice Volume Left -#define REG_VP_VOLR 0x0002 // Voice Volume Right -#define REG_VP_PITCH 0x0004 // Pitch -#define REG_VP_ADSR1 0x0006 // Envelope 1 (Attack-Decay-Sustain-Release) -#define REG_VP_ADSR2 0x0008 // Envelope 2 (Attack-Decay-Sustain-Release) -#define REG_VP_ENVX 0x000A // Current Envelope -#define REG_VP_VOLXL 0x000C // Current Voice Volume Left -#define REG_VP_VOLXR 0x000E // Current Voice Volume Right - -// .. repeated for each voice .. - -#define REG_S_PMON 0x0180 // Pitch Modulation Spec. -#define REG_S_NON 0x0184 // Alloc Noise Generator -#define REG_S_VMIXL 0x0188 // Voice Output Mix Left (Dry) -#define REG_S_VMIXEL 0x018C // Voice Output Mix Left (Wet) -#define REG_S_VMIXR 0x0190 // Voice Output Mix Right (Dry) -#define REG_S_VMIXER 0x0194 // Voice Output Mix Right (Wet) - -#define REG_P_MMIX 0x0198 // Output Spec. After Voice Mix -#define REG_C_ATTR 0x019A // Core X Attrib -#define REG_A_IRQA 0x019C // Interrupt Address Spec. - -#define REG_S_KON 0x01A0 // Key On 0/1 -#define REG_S_KOFF 0x01A4 // Key Off 0/1 - -#define REG_A_TSA 0x01A8 // Transfer starting address -#define REG__1AC 0x01AC // Transfer data -#define REG__1AE 0x01AE -#define REG_S_ADMAS 0x01B0 // AutoDMA Status - -// 1b2, 1b4, 1b6, 1b8, 1ba, 1bc, 1be are unknown - -#define REG_VA_SSA 0x01C0 // Waveform data starting address -#define REG_VA_LSAX 0x01C4 // Loop point address -#define REG_VA_NAX 0x01C8 // Waveform data that should be read next - -// .. repeated for each voice .. - -#define REG_A_ESA 0x02E0 //Address: Top address of working area for effects processing -#define R_FB_SRC_A 0x02E4 // Feedback Source A -#define R_FB_SRC_B 0x02E8 // Feedback Source B -#define R_IIR_DEST_A0 0x02EC -#define R_IIR_DEST_A1 0x02F0 -#define R_ACC_SRC_A0 0x02F4 -#define R_ACC_SRC_A1 0x02F8 -#define R_ACC_SRC_B0 0x02FC -#define R_ACC_SRC_B1 0x0300 -#define R_IIR_SRC_A0 0x0304 -#define R_IIR_SRC_A1 0x0308 -#define R_IIR_DEST_B0 0x030C -#define R_IIR_DEST_B1 0x0310 -#define R_ACC_SRC_C0 0x0314 -#define R_ACC_SRC_C1 0x0318 -#define R_ACC_SRC_D0 0x031C -#define R_ACC_SRC_D1 0x0320 -#define R_IIR_SRC_B1 0x0324 -#define R_IIR_SRC_B0 0x0328 -#define R_MIX_DEST_A0 0x032C -#define R_MIX_DEST_A1 0x0330 -#define R_MIX_DEST_B0 0x0334 -#define R_MIX_DEST_B1 0x0338 -#define REG_A_EEA 0x033C // Address: End address of working area for effects processing (upper part of address only!) - -#define REG_S_ENDX 0x0340 // End Point passed flag - -#define REG_P_STATX 0x0344 // Status register? - -// 0x346 .. 0x3fe are unknown (unused?) - -// core 1 has the same registers with 0x400 added. -// core 1 ends at 0x746 - -// 0x746 .. 0x75e are unknown - -// "Different" register area - -#define REG_P_MVOLL 0x0760 // Master Volume Left -#define REG_P_MVOLR 0x0762 // Master Volume Right -#define REG_P_EVOLL 0x0764 // Effect Volume Left -#define REG_P_EVOLR 0x0766 // Effect Volume Right -#define REG_P_AVOLL 0x0768 // Core External Input Volume Left (Only Core 1) -#define REG_P_AVOLR 0x076A // Core External Input Volume Right (Only Core 1) -#define REG_P_BVOLL 0x076C // Sound Data Volume Left -#define REG_P_BVOLR 0x076E // Sound Data Volume Right -#define REG_P_MVOLXL 0x0770 // Current Master Volume Left -#define REG_P_MVOLXR 0x0772 // Current Master Volume Right - -#define R_IIR_ALPHA 0x0774 //IIR alpha (% used) -#define R_ACC_COEF_A 0x0776 -#define R_ACC_COEF_B 0x0778 -#define R_ACC_COEF_C 0x077A -#define R_ACC_COEF_D 0x077C -#define R_IIR_COEF 0x077E -#define R_FB_ALPHA 0x0780 //feedback alpha (% used) -#define R_FB_X 0x0782 //feedback -#define R_IN_COEF_L 0x0784 -#define R_IN_COEF_R 0x0786 - -// values repeat for core1 - -// End OF "Different" register area - -// SPDIF interface -#define SPDIF_OUT 0x07C0 // SPDIF Out: OFF/'PCM'/Bitstream/Bypass -#define IRQINFO 0x07C2 -#define SPDIF_MODE 0x07C6 -#define SPDIF_MEDIA 0x07C8 // SPDIF Media: 'CD'/DVD -#define SPDIF_COPY 0x07CC // SPDIF Copy Protection - - -/********************************************************************* -Core attributes (SD_C) - bit 1 - Unknown (this bit is sometimes set) - bit 2..3 - Unknown (usually never set) - bit 4..5 - DMA related - bit 6 - IRQ? DMA mode? wtf? - bit 7 - effect enable (reverb enable) - bit 8 - IRQ enable? - bit 9..14 - noise clock - bit 15 - mute - bit 16 - reset - -*********************************************************************/ - -#define SPDIF_OUT_OFF 0x0000 //no spdif output -#define SPDIF_OUT_PCM 0x0020 //encode spdif from spu2 pcm output -#define SPDIF_OUT_BYPASS 0x0100 //bypass spu2 processing - -#define SPDIF_MODE_BYPASS_BITSTREAM 0x0002 //bypass mode for digital bitstream data -#define SPDIF_MODE_BYPASS_PCM 0x0000 //bypass mode for pcm data (using analog output) - -#define SPDIF_MODE_MEDIA_CD 0x0800 //source media is a CD -#define SPDIF_MODE_MEDIA_DVD 0x0000 //source media is a DVD - -#define SPDIF_MEDIA_CDVD 0x0200 -#define SPDIF_MEDIA_400 0x0000 - -#define SPDIF_COPY_NORMAL 0x0000 // spdif stream is not protected -#define SPDIF_COPY_PROHIBIT 0x8000 // spdif stream can't be copied - -/********************************************************************/ - -#define VOICE_PARAM_VOLL 0x0 // Voice Volume Left -#define VOICE_PARAM_VOLR 0x2 // Voice Volume Right -#define VOICE_PARAM_PITCH 0x4 // Pitch -#define VOICE_PARAM_ADSR1 0x6 // Envelope 1 (Attack-Delay-Sustain-Release) -#define VOICE_PARAM_ADSR2 0x8 // Envelope 2 (Attack-Delay-Sustain-Release) -#define VOICE_PARAM_ENVX 0xA // Current Envelope -#define VOICE_PARAM_VOLXL 0xC // Current Voice Volume Left -#define VOICE_PARAM_VOLXR 0xE // Current Voice Volume Right - -/********************************************************************/ - -#define VOICE_ADDR_SSA 0x0 // Waveform data starting address -#define VOICE_ADDR_LSAX 0x4 // Loop point address -#define VOICE_ADDR_NAX 0x8 // Waveform data that should be read next - -#endif // REGS_H_INCLUDED // \ No newline at end of file diff --git a/plugins/spu2ghz/src/regtable.cpp b/plugins/spu2ghz/src/regtable.cpp deleted file mode 100644 index c588886c1a..0000000000 --- a/plugins/spu2ghz/src/regtable.cpp +++ /dev/null @@ -1,314 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include "spu2.h" -#include "regtable.h" - -// This var is used to confirm that our lookup table is "correct" -// If the assertion in DllMain fails, it means the table has too too few entries. -// (it can't have too many because that would generate a compiler error). -const u16 zero=0; - -#define PCORE(c,p) \ - U16P(Cores[c].##p) - -#define PVCP(c,v,p) \ - PCORE(c,Voices[v].##p) - -#define PVC(c,v) \ - PVCP(c,v,VolumeL.Reg_VOL), \ - PVCP(c,v,VolumeR.Reg_VOL), \ - PVCP(c,v,Pitch), \ - PVCP(c,v,ADSR.Reg_ADSR1), \ - PVCP(c,v,ADSR.Reg_ADSR2), \ - PVCP(c,v,ADSR.Value)+1, \ - PVCP(c,v,VolumeL.Value), \ - PVCP(c,v,VolumeR.Value) - -#define PVCA(c,v) \ - PVCP(c,v,StartA)+1, \ - PVCP(c,v,StartA), \ - PVCP(c,v,LoopStartA)+1, \ - PVCP(c,v,LoopStartA), \ - PVCP(c,v,NextA)+1, \ - PVCP(c,v,NextA) - -#define PRAW(a) \ - ((u16*)NULL) - -#define PREVB_REG(c,n) \ - PCORE(c,Revb.##n)+1, \ - PCORE(c,Revb.##n) - -#pragma pack(1) -u16* regtable[0x800] = -{ - // Voice Params: 8 params, 24 voices = 0x180 bytes - PVC(0, 0),PVC(0, 1),PVC(0, 2),PVC(0, 3),PVC(0, 4),PVC(0, 5), - PVC(0, 6),PVC(0, 7),PVC(0, 8),PVC(0, 9),PVC(0,10),PVC(0,11), - PVC(0,12),PVC(0,13),PVC(0,14),PVC(0,15),PVC(0,16),PVC(0,17), - PVC(0,18),PVC(0,19),PVC(0,20),PVC(0,21),PVC(0,22),PVC(0,23), - - PCORE(0,Regs.PMON), - PCORE(0,Regs.PMON)+1, - PCORE(0,Regs.NON), - PCORE(0,Regs.NON)+1, - PCORE(0,Regs.VMIXL), - PCORE(0,Regs.VMIXL)+1, - PCORE(0,Regs.VMIXEL), - PCORE(0,Regs.VMIXEL)+1, - PCORE(0,Regs.VMIXR), - PCORE(0,Regs.VMIXR)+1, - PCORE(0,Regs.VMIXER), - PCORE(0,Regs.VMIXER)+1, - PCORE(0,Regs.MMIX), - - PCORE(0,Regs.ATTR), - - PCORE(0,IRQA)+1, - PCORE(0,IRQA), - - U16P(zero), - U16P(zero), - U16P(zero), - U16P(zero), - - PCORE(0,TSA)+1, - PCORE(0,TSA), - - PRAW(0x1ac), PRAW(0x1ae), - - PCORE(0,AutoDMACtrl), - - PRAW(0x1b2), PRAW(0x1b4), PRAW(0x1b6), PRAW(0x1b8), PRAW(0x1ba), PRAW(0x1bc), PRAW(0x1be), // unknown - - // Voice Addresses - PVCA(0, 0),PVCA(0, 1),PVCA(0, 2),PVCA(0, 3),PVCA(0, 4),PVCA(0, 5), - PVCA(0, 6),PVCA(0, 7),PVCA(0, 8),PVCA(0, 9),PVCA(0,10),PVCA(0,11), - PVCA(0,12),PVCA(0,13),PVCA(0,14),PVCA(0,15),PVCA(0,16),PVCA(0,17), - PVCA(0,18),PVCA(0,19),PVCA(0,20),PVCA(0,21),PVCA(0,22),PVCA(0,23), - - PCORE(0,EffectsStartA)+1, - PCORE(0,EffectsStartA), - - PREVB_REG(0,FB_SRC_A), - PREVB_REG(0,FB_SRC_B), - PREVB_REG(0,IIR_SRC_A0), - PREVB_REG(0,IIR_SRC_A1), - PREVB_REG(0,IIR_SRC_B1), - PREVB_REG(0,IIR_SRC_B0), - PREVB_REG(0,IIR_DEST_A0), - PREVB_REG(0,IIR_DEST_A1), - PREVB_REG(0,IIR_DEST_B0), - PREVB_REG(0,IIR_DEST_B1), - PREVB_REG(0,ACC_SRC_A0), - PREVB_REG(0,ACC_SRC_A1), - PREVB_REG(0,ACC_SRC_B0), - PREVB_REG(0,ACC_SRC_B1), - PREVB_REG(0,ACC_SRC_C0), - PREVB_REG(0,ACC_SRC_C1), - PREVB_REG(0,ACC_SRC_D0), - PREVB_REG(0,ACC_SRC_D1), - PREVB_REG(0,MIX_DEST_A0), - PREVB_REG(0,MIX_DEST_A1), - PREVB_REG(0,MIX_DEST_B0), - PREVB_REG(0,MIX_DEST_B1), - - PCORE(0,EffectsEndA)+1, - U16P(zero), - - PCORE(0,Regs.ENDX), - PCORE(0,Regs.ENDX)+1, - PCORE(0,Regs.STATX), - - //0x346 here - PRAW(0x346), - PRAW(0x348),PRAW(0x34A),PRAW(0x34C),PRAW(0x34E), - PRAW(0x350),PRAW(0x352),PRAW(0x354),PRAW(0x356), - PRAW(0x358),PRAW(0x35A),PRAW(0x35C),PRAW(0x35E), - PRAW(0x360),PRAW(0x362),PRAW(0x364),PRAW(0x366), - PRAW(0x368),PRAW(0x36A),PRAW(0x36C),PRAW(0x36E), - PRAW(0x370),PRAW(0x372),PRAW(0x374),PRAW(0x376), - PRAW(0x378),PRAW(0x37A),PRAW(0x37C),PRAW(0x37E), - PRAW(0x380),PRAW(0x382),PRAW(0x384),PRAW(0x386), - PRAW(0x388),PRAW(0x38A),PRAW(0x38C),PRAW(0x38E), - PRAW(0x390),PRAW(0x392),PRAW(0x394),PRAW(0x396), - PRAW(0x398),PRAW(0x39A),PRAW(0x39C),PRAW(0x39E), - PRAW(0x3A0),PRAW(0x3A2),PRAW(0x3A4),PRAW(0x3A6), - PRAW(0x3A8),PRAW(0x3AA),PRAW(0x3AC),PRAW(0x3AE), - PRAW(0x3B0),PRAW(0x3B2),PRAW(0x3B4),PRAW(0x3B6), - PRAW(0x3B8),PRAW(0x3BA),PRAW(0x3BC),PRAW(0x3BE), - PRAW(0x3C0),PRAW(0x3C2),PRAW(0x3C4),PRAW(0x3C6), - PRAW(0x3C8),PRAW(0x3CA),PRAW(0x3CC),PRAW(0x3CE), - PRAW(0x3D0),PRAW(0x3D2),PRAW(0x3D4),PRAW(0x3D6), - PRAW(0x3D8),PRAW(0x3DA),PRAW(0x3DC),PRAW(0x3DE), - PRAW(0x3E0),PRAW(0x3E2),PRAW(0x3E4),PRAW(0x3E6), - PRAW(0x3E8),PRAW(0x3EA),PRAW(0x3EC),PRAW(0x3EE), - PRAW(0x3F0),PRAW(0x3F2),PRAW(0x3F4),PRAW(0x3F6), - PRAW(0x3F8),PRAW(0x3FA),PRAW(0x3FC),PRAW(0x3FE), - - //AND... we reached 0x400! - // Voice Params: 8 params, 24 voices = 0x180 bytes - PVC(1, 0),PVC(1, 1),PVC(1, 2),PVC(1, 3),PVC(1, 4),PVC(1, 5), - PVC(1, 6),PVC(1, 7),PVC(1, 8),PVC(1, 9),PVC(1,10),PVC(1,11), - PVC(1,12),PVC(1,13),PVC(1,14),PVC(1,15),PVC(1,16),PVC(1,17), - PVC(1,18),PVC(1,19),PVC(1,20),PVC(1,21),PVC(1,22),PVC(1,23), - - PCORE(1,Regs.PMON), - PCORE(1,Regs.PMON)+1, - PCORE(1,Regs.NON), - PCORE(1,Regs.NON)+1, - PCORE(1,Regs.VMIXL), - PCORE(1,Regs.VMIXL)+1, - PCORE(1,Regs.VMIXEL), - PCORE(1,Regs.VMIXEL)+1, - PCORE(1,Regs.VMIXR), - PCORE(1,Regs.VMIXR)+1, - PCORE(1,Regs.VMIXER), - PCORE(1,Regs.VMIXER)+1, - PCORE(1,Regs.MMIX), - - PCORE(1,Regs.ATTR), - - PCORE(1,IRQA)+1, - PCORE(1,IRQA), - - U16P(zero), - U16P(zero), - U16P(zero), - U16P(zero), - - PCORE(1,TSA)+1, - PCORE(1,TSA), - - PRAW(0x5ac), PRAW(0x5ae), - - PCORE(1,AutoDMACtrl), - - PRAW(0x5b2), PRAW(0x5b4), PRAW(0x5b6), PRAW(0x5b8), PRAW(0x5ba), PRAW(0x5bc), PRAW(0x5be), // unknown - - // Voice Addresses - PVCA(1, 0),PVCA(1, 1),PVCA(1, 2),PVCA(1, 3),PVCA(1, 4),PVCA(1, 5), - PVCA(1, 6),PVCA(1, 7),PVCA(1, 8),PVCA(1, 9),PVCA(1,10),PVCA(1,11), - PVCA(1,12),PVCA(1,13),PVCA(1,14),PVCA(1,15),PVCA(1,16),PVCA(1,17), - PVCA(1,18),PVCA(1,19),PVCA(1,20),PVCA(1,21),PVCA(1,22),PVCA(1,23), - - PCORE(1,EffectsStartA)+1, - PCORE(1,EffectsStartA), - - PREVB_REG(1,FB_SRC_A), - PREVB_REG(1,FB_SRC_B), - PREVB_REG(1,IIR_SRC_A0), - PREVB_REG(1,IIR_SRC_A1), - PREVB_REG(1,IIR_SRC_B1), - PREVB_REG(1,IIR_SRC_B0), - PREVB_REG(1,IIR_DEST_A0), - PREVB_REG(1,IIR_DEST_A1), - PREVB_REG(1,IIR_DEST_B0), - PREVB_REG(1,IIR_DEST_B1), - PREVB_REG(1,ACC_SRC_A0), - PREVB_REG(1,ACC_SRC_A1), - PREVB_REG(1,ACC_SRC_B0), - PREVB_REG(1,ACC_SRC_B1), - PREVB_REG(1,ACC_SRC_C0), - PREVB_REG(1,ACC_SRC_C1), - PREVB_REG(1,ACC_SRC_D0), - PREVB_REG(1,ACC_SRC_D1), - PREVB_REG(1,MIX_DEST_A0), - PREVB_REG(1,MIX_DEST_A1), - PREVB_REG(1,MIX_DEST_B0), - PREVB_REG(1,MIX_DEST_B1), - - PCORE(1,EffectsEndA)+1, - U16P(zero), - - PCORE(1,Regs.ENDX), - PCORE(1,Regs.ENDX)+1, - PCORE(1,Regs.STATX), - - PRAW(0x746), - PRAW(0x748),PRAW(0x74A),PRAW(0x74C),PRAW(0x74E), - PRAW(0x750),PRAW(0x752),PRAW(0x754),PRAW(0x756), - PRAW(0x758),PRAW(0x75A),PRAW(0x75C),PRAW(0x75E), - - //0x760: weird area - PCORE(0,MasterL.Reg_VOL), - PCORE(0,MasterR.Reg_VOL), - PCORE(0,FxL), - PCORE(0,FxR), - PCORE(0,ExtL), - PCORE(0,ExtR), - PCORE(0,InpL), - PCORE(0,InpR), - PCORE(0,MasterL.Value), - PCORE(0,MasterR.Value), - PCORE(0,Revb.IIR_ALPHA), - PCORE(0,Revb.ACC_COEF_A), - PCORE(0,Revb.ACC_COEF_B), - PCORE(0,Revb.ACC_COEF_C), - PCORE(0,Revb.ACC_COEF_D), - PCORE(0,Revb.IIR_COEF), - PCORE(0,Revb.FB_ALPHA), - PCORE(0,Revb.FB_X), - PCORE(0,Revb.IN_COEF_L), - PCORE(0,Revb.IN_COEF_R), - - PCORE(1,MasterL.Reg_VOL), - PCORE(1,MasterR.Reg_VOL), - PCORE(1,FxL), - PCORE(1,FxR), - PCORE(1,ExtL), - PCORE(1,ExtR), - PCORE(1,InpL), - PCORE(1,InpR), - PCORE(1,MasterL.Value), - PCORE(1,MasterR.Value), - PCORE(1,Revb.IIR_ALPHA), - PCORE(1,Revb.ACC_COEF_A), - PCORE(1,Revb.ACC_COEF_B), - PCORE(1,Revb.ACC_COEF_C), - PCORE(1,Revb.ACC_COEF_D), - PCORE(1,Revb.IIR_COEF), - PCORE(1,Revb.FB_ALPHA), - PCORE(1,Revb.FB_X), - PCORE(1,Revb.IN_COEF_L), - PCORE(1,Revb.IN_COEF_R), - - PRAW(0x7B0),PRAW(0x7B2),PRAW(0x7B4),PRAW(0x7B6), - PRAW(0x7B8),PRAW(0x7BA),PRAW(0x7BC),PRAW(0x7BE), - - // SPDIF interface - U16P(Spdif.Out), - U16P(Spdif.Info), - U16P(Spdif.Unknown1), - U16P(Spdif.Mode), - U16P(Spdif.Media), - U16P(Spdif.Unknown2), - U16P(Spdif.Protection), - - PRAW(0x7CE), - PRAW(0x7D0),PRAW(0x7D2),PRAW(0x7D4),PRAW(0x7D6), - PRAW(0x7D8),PRAW(0x7DA),PRAW(0x7DC),PRAW(0x7DE), - PRAW(0x7E0),PRAW(0x7E2),PRAW(0x7E4),PRAW(0x7E6), - PRAW(0x7E8),PRAW(0x7EA),PRAW(0x7EC),PRAW(0x7EE), - PRAW(0x7F0),PRAW(0x7F2),PRAW(0x7F4),PRAW(0x7F6), - PRAW(0x7F8),PRAW(0x7FA),PRAW(0x7FC),PRAW(0x7FE), - - U16P(zero) -}; -#pragma pack() \ No newline at end of file diff --git a/plugins/spu2ghz/src/regtable.h b/plugins/spu2ghz/src/regtable.h deleted file mode 100644 index aa823cdd94..0000000000 --- a/plugins/spu2ghz/src/regtable.h +++ /dev/null @@ -1,29 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef _REGTABLE_H_ -#define _REGTABLE_H_ - -#define U16P(x) ((u16*)&(x)) - -// Yay! Global namespace pollution 101! -extern const u16 zero; - -extern u16* regtable[0x800]; - -#endif \ No newline at end of file diff --git a/plugins/spu2ghz/src/savestate.cpp b/plugins/spu2ghz/src/savestate.cpp deleted file mode 100644 index fa54c50e6f..0000000000 --- a/plugins/spu2ghz/src/savestate.cpp +++ /dev/null @@ -1,247 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "SPU2.h" - -struct SPU2freezeData -{ - u32 version; - u8 unkregs[0x10000]; - u8 mem[0x200000]; - - u32 id; - V_Core Cores[2]; - V_SPDIF Spdif; - s16 OutPos; - s16 InputPos; - u8 InpBuff; - u32 Cycles; - s32 uTicks; - double srate_pv; - double opitch; - int osps; - int PlayMode; - - int lClocks; - - PcmCacheEntry cacheData; - -}; - -#define SAVE_ID 0x73326701 - -// versioning for saves. -// Increment this if changes to V_Core or V_Voice structs are made. -// Chances are we'll never explicitly support older save versions, -// but might as well version them anyway. Could come in handly someday! -#define SAVE_VERSION 0x0102 - -static int getFreezeSize() -{ - if( disableFreezes ) return 8; // length of the string id "invalid" (plus a zero!) - - int size = sizeof(SPU2freezeData); - - // calculate the amount of memory consumed by our cache: - - for( int bidx=0; bidxdata; - - if( spud->id != SAVE_ID || spud->version < SAVE_VERSION ) - { - printf("\n*** SPU2Ghz Warning:\n"); - if( spud->id == SAVE_ID ) - { - printf("\tSavestate version is from an older version of this plugin.\n"); - printf("\tAudio may not recover correctly.\n\n"); - } - else - { - printf(" The savestate you are trying to load was not made with this plugin.\n"); - printf(" The emulator will not be stable! Find a memorycard savespot to save your\n"); - printf(" game, reset, and then continue from there.\n\n"); - } - - disableFreezes=true; - lClocks = 0; - resetClock = true; - - // Do *not* reset the cores. - // We'll need some "hints" as to how the cores should be initialized, - // and the only way to get that is to use the game's existing core settings - // and hope they kinda match the settings for the savestate (IRQ enables and such). - // - - //CoreReset( 0 ); - //CoreReset( 1 ); - - // adpcm cache : Clear all the cache flags and buffers. - - wipe_the_cache(); - } - else - { - disableFreezes=false; - - // base stuff - memcpy(spu2regs, spud->unkregs, 0x010000); - memcpy(_spu2mem, spud->mem, 0x200000); - - memcpy(Cores, spud->Cores, sizeof(Cores)); - memcpy(&Spdif, &spud->Spdif, sizeof(Spdif)); - OutPos = spud->OutPos; - InputPos = spud->InputPos; - InpBuff = spud->InpBuff; - Cycles = spud->Cycles; - uTicks = spud->uTicks; - srate_pv = spud->srate_pv; - PlayMode = spud->PlayMode; - lClocks = spud->lClocks; - - // Load the ADPCM cache: - - wipe_the_cache(); - - const PcmCacheEntry* pcmSrc = &spud->cacheData; - int blksLoaded=0; - - for( int bidx=0; bidx FreezeLoad > Loaded %d cache blocks.\n", blksLoaded++ ); - } - - } else if (mode == FREEZE_SAVE) - { - if (data->data == NULL) return -1; - - if( disableFreezes ) - { - // No point in making a save state since the SPU2 - // state is completely bogus anyway... Let's just - // give this some random ID that no one will recognize. - - strcpy( data->data, "invalid" ); - return 0; - } - - - SPU2freezeData *spud = (SPU2freezeData*)data->data; - - spud->id=SAVE_ID; - spud->version=SAVE_VERSION;//ZEROSPU_VERSION; //Zero compat working bad, better not save that - - memcpy(spud->unkregs, spu2regs, 0x010000); - memcpy(spud->mem, _spu2mem, 0x200000); - memcpy(spud->Cores, Cores, sizeof(Cores)); - memcpy(&spud->Spdif, &Spdif, sizeof(Spdif)); - spud->OutPos = OutPos; - spud->InputPos = InputPos; - spud->InpBuff = InpBuff; - spud->Cycles = Cycles; - spud->uTicks = uTicks; - spud->srate_pv = srate_pv; - spud->PlayMode = PlayMode; - spud->lClocks = lClocks; - - // Save our cache: - // We could just force the user to rebuild the cache when loading - // from stavestates, but for most games the cache is pretty - // small and compresses well. - // - // Potential Alternative: - // If the cache is not saved then it is necessary to save the - // decoded blocks currently in use by active voices. This allows - // voices to resume seamlessly on load. - - PcmCacheEntry* pcmDst = &spud->cacheData; - int blksSaved=0; - - for( int bidx=0; bidx FreezeSave > Saved %d cache blocks.\n", blksSaved++ ); - - } - else if (mode == FREEZE_SIZE) - { - data->size = getFreezeSize(); - } - return 0; - -} diff --git a/plugins/spu2ghz/src/sndout.cpp b/plugins/spu2ghz/src/sndout.cpp deleted file mode 100644 index 9317ea2e85..0000000000 --- a/plugins/spu2ghz/src/sndout.cpp +++ /dev/null @@ -1,889 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -// [TODO] : The layout of this code file is now a complete hackish mess after -// numerous timestretch-related additions. The whole thing should really be -// rethought and redone at this point. - -#include "spu2.h" -#include "SoundTouch/SoundTouch.h" -#include "SoundTouch/WavFile.h" - -#include - -static int ts_stats_stretchblocks = 0; -static int ts_stats_normalblocks = 0; -static int ts_stats_logcounter = 0; - -class NullOutModule: public SndOutModule -{ -public: - s32 Init(SndBuffer *) { return 0; } - void Close() { } - s32 Test() const { return 0; } - void Configure(HWND parent) { } - bool Is51Out() const { return false; } - int GetEmptySampleCount() const { return 0; } - - const char* GetIdent() const - { - return "nullout"; - } - - const char* GetLongName() const - { - return "No Sound (Emulate SPU2 only)"; - } - -} NullOut; - -SndOutModule* mods[]= -{ - &NullOut, - WaveOut, - DSoundOut, - //DSound51Out, - //ASIOOut, - XAudio2Out, - NULL // signals the end of our list -}; - -int FindOutputModuleById( const char* omodid ) -{ - int modcnt = 0; - while( mods[modcnt] != NULL ) - { - if( strcmp( mods[modcnt]->GetIdent(), omodid ) == 0 ) - break; - ++modcnt; - } - return modcnt; -} - - -// Overall master volume shift. -// Converts the mixer's 32 bit value into a 16 bit value. -int SndOutVolumeShift = SndOutVolumeShiftBase + 1; - -static __forceinline s16 SndScaleVol( s32 inval ) -{ - return inval >> SndOutVolumeShift; -} - - -// records last buffer status (fill %, range -100 to 100, with 0 being 50% full) -float lastPct; -float lastEmergencyAdj; - -float cTempo=1; -float eTempo = 1; -int freezeTempo = 0; - -soundtouch::SoundTouch* pSoundTouch=NULL; - - -//usefull when timestretch isn't available -//#define DYNAMIC_BUFFER_LIMITING - -class SndBufferImpl: public SndBuffer -{ -private: - s32 *buffer; - s32 size; - s32 rpos; - s32 wpos; - s32 data; - - // data prediction amount, used to "commit" data that hasn't - // finished timestretch processing. - s32 predictData; - - bool pw; - - bool underrun_freeze; - HANDLE hSyncEvent; - CRITICAL_SECTION cs; - -protected: - int GetAlignedBufferSize( int comp ) - { - return (comp + SndOutPacketSize-1) & ~(SndOutPacketSize-1); - } - -public: - SndBufferImpl( float latencyMS ) - { - rpos=0; - wpos=0; - data=0; - size=GetAlignedBufferSize( (int)(latencyMS * SampleRate / 500.0f ) ); - buffer = new s32[size]; - pw=false; - underrun_freeze = false; - predictData = 0; - -#ifdef DYNAMIC_BUFFER_LIMITING - overflows=0; - underflows=0; - writewaits=0; - buffer_limit=size; -#endif - InitializeCriticalSection(&cs); - hSyncEvent = CreateEvent(NULL,FALSE,FALSE,NULL); - } - - virtual ~SndBufferImpl() - { - pw=false; - PulseEvent(hSyncEvent); - Sleep(10); - EnterCriticalSection(&cs); - LeaveCriticalSection(&cs); - DeleteCriticalSection(&cs); - CloseHandle(hSyncEvent); - delete buffer; - } - - virtual void WriteSamples(s32 *bData, int nSamples) - { - EnterCriticalSection(&cs); - int free = size-data; - predictData = 0; - - jASSUME( data <= size ); - - if( pw && ( free < nSamples ) ) - { - // Wait for a ReadSamples to pull some stuff out of the buffer. - // One SyncEvent will do the trick. - ResetEvent( hSyncEvent ); - LeaveCriticalSection(&cs); - WaitForSingleObject(hSyncEvent,20); - EnterCriticalSection(&cs); - } - - // Problem: - // If the SPU2 gets out of sync with the SndOut device, the writepos of the - // circular buffer will overtake the readpos, leading to a prolonged period - // of hopscotching read/write accesses (ie, lots of staticy crap sound for - // several seconds). - // - // Compromise: - // When an overrun occurs, we adapt by discarding a portion of the buffer. - // The older portion of the buffer is discarded rather than incoming data, - // so that the overall audio synchronization is better. - - if( free < nSamples ) - { - // Buffer overrun! - // Dump samples from the read portion of the buffer instead of dropping - // the newly written stuff. - - s32 comp; - - if( timeStretchEnabled ) - { - // If we overran it means the timestretcher failed. We need to speed - // up audio playback. - cTempo += cTempo * 0.12f; - eTempo += eTempo * 0.40f; - if( eTempo > 7.5f ) eTempo = 7.5f; - pSoundTouch->setTempo( eTempo ); - - // Throw out just a little bit (two packets worth) to help - // give the TS some room to work: - - comp = SndOutPacketSize*2; - } - else - { - // Toss half the buffer plus whatever's being written anew: - comp = GetAlignedBufferSize( (size + nSamples ) / 2 ); - if( comp > (size-SndOutPacketSize) ) comp = size-SndOutPacketSize; - } - - data-=comp; - rpos=(rpos+comp)%size; - if( MsgOverruns() ) - ConLog(" * SPU2 > Overrun Compensation (%d packets tossed)\n", comp / SndOutPacketSize ); - lastPct = 0.0; // normalize the timestretcher - } - - // copy in two phases, since there's a chance the packet - // wraps around the buffer (it'd be nice to deal in packets only, but - // the timestretcher and DSP options require flexibility). - - const int endPos = wpos + nSamples; - const int secondCopyLen = endPos - size; - s32* wposbuffer = &buffer[wpos]; - - data += nSamples; - if( secondCopyLen > 0 ) - { - nSamples -= secondCopyLen; - memcpy( buffer, &bData[nSamples], secondCopyLen * sizeof( *bData ) ); - wpos = secondCopyLen; - } - else - wpos += nSamples; - - memcpy( wposbuffer, bData, nSamples * sizeof( *bData ) ); - - LeaveCriticalSection(&cs); - } - - protected: - // Returns TRUE if there is data to be output, or false if no data - // is available to be copied. - bool CheckUnderrunStatus( int& nSamples, int& quietSampleCount ) - { - quietSampleCount = 0; - if( underrun_freeze ) - { - int toFill = (int)(size * ( timeStretchEnabled ? 0.1f : 0.50f ) ); - toFill = GetAlignedBufferSize( toFill ); - - // toFill is now aligned to a SndOutPacket - - if( data < toFill ) - { - quietSampleCount = nSamples; - return false; - } - - underrun_freeze = false; - if( MsgOverruns() ) - ConLog(" * SPU2 > Underrun compensation (%d packets buffered)\n", toFill / SndOutPacketSize ); - lastPct = 0.0; // normalize timestretcher - } - else if( data < nSamples ) - { - nSamples = data; - quietSampleCount = SndOutPacketSize - data; - underrun_freeze = true; - - if( timeStretchEnabled ) - { - // timeStretcher failed it's job. We need to slow down the audio some. - - cTempo -= (cTempo * 0.12f); - eTempo -= (eTempo * 0.30f); - if( eTempo < 0.1f ) eTempo = 0.1f; - pSoundTouch->setTempo( eTempo ); - } - - return nSamples != 0; - } - - return true; - } - - public: - void ReadSamples( s16* bData ) - { - int nSamples = SndOutPacketSize; - - EnterCriticalSection(&cs); - - // Problem: - // If the SPU2 gets even the least bit out of sync with the SndOut device, - // the readpos of the circular buffer will overtake the writepos, - // leading to a prolonged period of hopscotching read/write accesses (ie, - // lots of staticy crap sound for several seconds). - // - // Fix: - // If the read position overtakes the write position, abort the - // transfer immediately and force the SndOut driver to wait until - // the read buffer has filled up again before proceeding. - // This will cause one brief hiccup that can never exceed the user's - // set buffer length in duration. - - int quietSamples; - if( CheckUnderrunStatus( nSamples, quietSamples ) ) - { - jASSUME( nSamples <= SndOutPacketSize ); - - // [Air] [TODO]: This loop is probably a candidiate for SSE2 optimization. - - const int endPos = rpos + nSamples; - const int secondCopyLen = endPos - size; - const s32* rposbuffer = &buffer[rpos]; - - data -= nSamples; - - if( secondCopyLen > 0 ) - { - nSamples -= secondCopyLen; - for( int i=0; i 0 ) - { - nSamples -= secondCopyLen; - memcpy( &bData[nSamples], buffer, secondCopyLen * sizeof( *bData ) ); - rpos = secondCopyLen; - } - else - rpos += nSamples; - - memcpy( bData, &buffer[oldrpos], nSamples * sizeof( *bData ) ); - } - - // If quietSamples != 0 it means we have an underrun... - // Let's just dull out some silence, because that's usually the least - // painful way of dealing with underruns: - memset( bData, 0, quietSamples * sizeof(*bData) ); - PulseEvent(hSyncEvent); - LeaveCriticalSection(&cs); - } - - void PredictDataWrite( int samples ) - { - predictData += samples; - } - - virtual void PauseOnWrite(bool doPause) { pw = doPause; } - - // Calculate the buffer status percentage. - // Returns range from -1.0 to 1.0 - // 1.0 = buffer overflow! - // 0.0 = buffer nominal (50% full) - // -1.0 = buffer underflow! - float GetStatusPct() - { - EnterCriticalSection(&cs); - - // Get the buffer status of the output driver too, so that we can - // obtain a more accurate overall buffer status. - - int drvempty = mods[OutputModule]->GetEmptySampleCount(); // / 2; - - //ConLog( "Data %d >>> driver: %d predict: %d\n", data, drvempty, predictData ); - - float result = (float)(data + predictData - drvempty) - (size/2); - result /= (size/2); - LeaveCriticalSection(&cs); - return result; - } - -}; - -SndBufferImpl *sndBuffer=NULL; - -s32* sndTempBuffer=NULL; -s32 sndTempProgress=NULL; -s16* sndTempBuffer16=NULL; - -void UpdateTempoChange() -{ - if( --freezeTempo > 0 ) - { - return; - } - - float statusPct = sndBuffer->GetStatusPct(); - float pctChange = statusPct - lastPct; - - float tempoChange; - float emergencyAdj = 0; - float newcee = cTempo; // workspace var. for cTempo - - // IMPORTANT! - // If you plan to tweak these values, make sure you're using a release build - // OUTSIDE THE DEBUGGER to test it! The Visual Studio debugger can really cause - // erratic behavior in the audio buffers, and makes the timestretcher seem a - // lot more inconsistent than it really is. - - // We have two factors. - // * Distance from nominal buffer status (50% full) - // * The change from previous update to this update. - - // Prediction based on the buffer change: - // (linear seems to work better here) - - tempoChange = pctChange * 0.75f; - - if( statusPct * tempoChange < 0.0f ) - { - // only apply tempo change if it is in synch with the buffer status. - // In other words, if the buffer is high (over 0%), and is decreasing, - // ignore it. It'll just muck things up. - - tempoChange = 0; - } - - // Sudden spikes in framerate can cause the nominal buffer status - // to go critical, in which case we have to enact an emergency - // stretch. The following cubic formulas do that. Values near - // the extremeites give much larger results than those near 0. - // And the value is added only this time, and does not accumulate. - // (otherwise a large value like this would cause problems down the road) - - // Constants: - // Weight - weights the statusPct's "emergency" consideration. - // higher values here will make the buffer perform more drastic - // compensations at the outter edges of the buffer (at -75 or +75% - // or beyond, for example). - - // Range - scales the adjustment to the given range (more or less). - // The actual range is dependent on the weight used, so if you increase - // Weight you'll usually want to decrease Range somewhat to compensate. - - // Prediction based on the buffer fill status: - - const float statusWeight = 2.99f; - const float statusRange = 0.068f; - - // "non-emergency" deadzone: In this area stretching will be strongly discouraged. - // Note: due tot he nature of timestretch latency, it's always a wee bit harder to - // cope with low fps (underruns) tha it is high fps (overruns). So to help out a - // little, the low-end portions of this check are less forgiving than the high-sides. - - if( cTempo < 0.965f || cTempo > 1.060f || - pctChange < -0.38f || pctChange > 0.54f || - statusPct < -0.32f || statusPct > 0.39f || - eTempo < 0.89f || eTempo > 1.19f ) - { - emergencyAdj = ( pow( statusPct*statusWeight, 3.0f ) * statusRange); - } - - // Smooth things out by factoring our previous adjustment into this one. - // It helps make the system 'feel' a little smarter by giving it at least - // one packet worth of history to help work off of: - - emergencyAdj = (emergencyAdj * 0.75f) + (lastEmergencyAdj * 0.25f ); - - lastEmergencyAdj = emergencyAdj; - lastPct = statusPct; - - // Accumulate a fraction of the tempo change into the tempo itself. - // This helps the system run "smarter" to games that run consistently - // fast or slow by altering the base tempo to something closer to the - // game's active speed. In tests most games normalize within 2 seconds - // at 100ms latency, which is pretty good (larger buffers normalize even - // quicker). - - newcee += newcee * (tempoChange+emergencyAdj) * 0.03f; - - // Apply tempoChange as a scale of cTempo. That way the effect is proportional - // to the current tempo. (otherwise tempos rate of change at the extremes would - // be too drastic) - - float newTempo = newcee + ( emergencyAdj * cTempo ); - - // ... and as a final optimization, only stretch if the new tempo is outside - // a nominal threshold. Keep this threshold check small, because it could - // cause some serious side effects otherwise. (enlarging the cTempo check above - // is usually better/safer) - if( newTempo < 0.970f || newTempo > 1.045f ) - { - cTempo = (float)newcee; - - if( newTempo < 0.10f ) newTempo = 0.10f; - else if( newTempo > 10.0f ) newTempo = 10.0f; - - if( cTempo < 0.15f ) cTempo = 0.15f; - else if( cTempo > 7.5f ) cTempo = 7.5f; - - pSoundTouch->setTempo( eTempo = (float)newTempo ); - ts_stats_stretchblocks++; - - /*ConLog(" * SPU2: [Nominal %d%%] [Emergency: %d%%] (baseTempo: %d%% ) (newTempo: %d%%) (buffer: %d%%)\n", - //(relation < 0.0) ? "Normalize" : "", - (int)(tempoChange * 100.0 * 0.03), - (int)(emergencyAdj * 100.0), - (int)(cTempo * 100.0), - (int)(newTempo * 100.0), - (int)(statusPct * 100.0) - );*/ - } - else - { - // Nominal operation -- turn off stretching. - // note: eTempo 'slides' toward 1.0 for smoother audio and better - // protection against spikes. - if( cTempo != 1.0f ) - { - cTempo = 1.0f; - eTempo = ( 1.0f + eTempo ) * 0.5f; - pSoundTouch->setTempo( eTempo ); - } - else - { - if( eTempo != cTempo ) - pSoundTouch->setTempo( eTempo=cTempo ); - ts_stats_normalblocks++; - } - } -} - - -void soundtouchInit() -{ - pSoundTouch = new soundtouch::SoundTouch(); - pSoundTouch->setSampleRate(SampleRate); - pSoundTouch->setChannels(2); - - pSoundTouch->setSetting(SETTING_USE_QUICKSEEK, 0); - pSoundTouch->setSetting(SETTING_USE_AA_FILTER, 0); - pSoundTouch->setTempo(1); - - // some timestretch management vars: - - cTempo = 1.0; - eTempo = 1.0; - lastPct = 0; - lastEmergencyAdj = 0; - - // just freeze tempo changes for a while at startup. - // the driver buffers are bogus anyway. - freezeTempo = 8; -} - -static void _sndInitFail() -{ - // If a failure occurs, just initialize the NoSound driver. This'll allow - // the game to emulate properly (hopefully), albeit without sound. - OutputModule = FindOutputModuleById( NullOut.GetIdent() ); - mods[OutputModule]->Init( sndBuffer ); -} - -s32 SndInit() -{ - if( mods[OutputModule] == NULL ) - { - _sndInitFail(); - return 0; - } - - // initialize sound buffer - // Buffer actually attempts to run ~50%, so allocate near double what - // the requested latency is: - - try - { - sndBuffer = new SndBufferImpl( SndOutLatencyMS * (timeStretchEnabled ? 2.0f : 1.5f) ); - sndTempBuffer = new s32[SndOutPacketSize]; - sndTempBuffer16 = new s16[SndOutPacketSize]; - } - catch( std::bad_alloc& ) - { - // out of memory exception (most likely) - - SysMessage( "Out of memory error occured while initializing SPU2." ); - _sndInitFail(); - return 0; - } - - // clear buffers! - // Fixes loopy sounds on emu resets. - memset( sndTempBuffer, 0, sizeof(s32) * SndOutPacketSize ); - memset( sndTempBuffer16, 0, sizeof(s16) * SndOutPacketSize ); - - sndTempProgress = 0; - - soundtouchInit(); // initializes the timestretching - - if(LimitMode!=0) - { - sndBuffer->PauseOnWrite(true); - } - - // some crap - spdif_set51(mods[OutputModule]->Is51Out()); - - // initialize module - if( mods[OutputModule]->Init(sndBuffer) == -1 ) - { - _sndInitFail(); - } - - return 0; -} - -void SndClose() -{ - mods[OutputModule]->Close(); - - SAFE_DELETE_OBJ( sndBuffer ); - SAFE_DELETE_ARRAY( sndTempBuffer ); - SAFE_DELETE_ARRAY( sndTempBuffer16 ); - SAFE_DELETE_OBJ( pSoundTouch ); -} - -void SndUpdateLimitMode() -{ - //sndBuffer->PauseOnWrite(LimitMode!=0); - - if(LimitMode!=0) { - timeStretchEnabled = true; - //printf(" * SPU2 limiter is now ON.\n"); - printf(" * SPU2 timestretch is now ON.\n"); - } - else { - //printf(" * SPU2 limiter is now OFF.\n"); - printf(" * SPU2 timestretch is now OFF.\n"); - timeStretchEnabled = false; - } - -} - - -s32 SndWrite(s32 ValL, s32 ValR) -{ - // Log final output to wavefile. - #ifndef PUBLIC - WaveDump::WriteCore( 1, CoreSrc_External, SndScaleVol(ValL), SndScaleVol(ValR) ); - #endif - - RecordWrite(SndScaleVol(ValL),SndScaleVol(ValR)); - - if(mods[OutputModule] == &NullOut) // null output doesn't need buffering or stretching! :p - return 0; - - sndTempBuffer[sndTempProgress++] = ValL; - sndTempBuffer[sndTempProgress++] = ValR; - - // If we haven't accumulated a full packet yet, do nothing more: - if(sndTempProgress < SndOutPacketSize) return 1; - - if(dspPluginEnabled) - { - for(int i=0;i>1)<<1; - - for(int i=0;iPredictDataWrite( (int)( sndTempProgress / eTempo ) ); - for(int i=0;iputSamples((float*)sndTempBuffer, sndTempProgress>>1); - - while( ( sndTempProgress = pSoundTouch->receiveSamples((float*)sndTempBuffer, sndTempProgress>>1)<<1 ) != 0 ) - { - // [Air] [TODO] : Implement an SSE downsampler to int. - for(int i=0;iWriteSamples(sndTempBuffer, sndTempProgress); - progress = true; - } - - UpdateTempoChange(); - - if( MsgOverruns() ) - { - if( progress ) - { - if( ++ts_stats_logcounter > 300 ) - { - ts_stats_logcounter = 0; - ConLog( " * SPU2 > Timestretch Stats > %d%% of packets stretched.\n", - ( ts_stats_stretchblocks * 100 ) / ( ts_stats_normalblocks + ts_stats_stretchblocks ) ); - ts_stats_normalblocks = 0; - ts_stats_stretchblocks = 0; - } - } - } - } - else - { - sndBuffer->WriteSamples(sndTempBuffer, sndTempProgress); - sndTempProgress=0; - } - - return 1; -} - -s32 SndTest() -{ - if( mods[OutputModule] == NULL ) - return -1; - - return mods[OutputModule]->Test(); -} - -void SndConfigure(HWND parent, u32 module ) -{ - if( mods[module] == NULL ) - return; - - mods[module]->Configure(parent); -} - -#if 0 -////////////////////////////////////////////////////////////// -// Basic Timestretcher (50% to 150%) -const s32 StretchBufferSize = 2048; - -s32 stretchBufferL[StretchBufferSize*2]; -s32 stretchBufferR[StretchBufferSize*2]; -s32 stretchPosition=0; - -s32 stretchOutputSize = 2048; // valid values from 1024 to 3072 - -s32 blah; - -extern float cspeed; -void TimestretchUpdate(int bufferusage,int buffersize) -{ - if(cspeed>1.01) - { - stretchOutputSize+=10; - } - else if (cspeed<0.99) - { - stretchOutputSize-=10; - } - - blah++; - if(blah>=2) - { - blah=0; - - printf(" * Stretch = %d of %d\n",stretchOutputSize,StretchBufferSize); - } -} - -s32 SndWriteStretch(s32 ValL, s32 ValR) -{ - // TODO: update stretchOutputSize according to speed :P - - stretchBufferL[stretchPosition] = ValL; - stretchBufferR[stretchPosition] = ValR; - - stretchPosition++; - if(stretchPosition>=StretchBufferSize) - { - stretchPosition=0; - - if(stretchOutputSize < (StretchBufferSize/2)) - stretchOutputSize=(StretchBufferSize/2); - if(stretchOutputSize > (StretchBufferSize*3/2)) - stretchOutputSize=(StretchBufferSize*3/2); - - if(stretchOutputSize>StretchBufferSize) - { - int K = (stretchOutputSize-StretchBufferSize); - int J = StretchBufferSize - K; - - // K samples offset - for(int i=StretchBufferSize;i -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef SNDOUT_H_INCLUDE -#define SNDOUT_H_INCLUDE - -// Number of stereo samples per SndOut block. -// All drivers must work in units of this size when communicating with -// SndOut. -static const int SndOutPacketSize = 1024; - -static const int SndOutVolumeShiftBase = 10; -extern int SndOutVolumeShift; - -#define pcmlog -extern FILE *wavelog; - -s32 SndInit(); -void SndClose(); -s32 SndWrite(s32 ValL, s32 ValR); -s32 SndTest(); -void SndConfigure(HWND parent, u32 outmodidx ); -bool SndGetStats(u32 *written, u32 *played); - -int FindOutputModuleById( const char* omodid ); - -class SndBuffer -{ -public: - virtual ~SndBuffer() {} - - virtual void WriteSamples(s32 *buffer, int nSamples)=0; - virtual void PauseOnWrite(bool doPause)=0; - - virtual void ReadSamples( s16* bData )=0; - virtual void ReadSamples( s32* bData )=0; - - //virtual s32 GetBufferUsage()=0; - //virtual s32 GetBufferSize()=0; -}; - -class SndOutModule -{ -public: - // Virtual destructor, because it helps fight C+++ funny-business. - virtual ~SndOutModule(){}; - - // Returns a unique identification string for this driver. - // (usually just matches the driver's cpp filename) - virtual const char* GetIdent() const=0; - - // Returns the long name / description for this driver. - // (for use in configuration screen) - virtual const char* GetLongName() const=0; - - virtual s32 Init(SndBuffer *buffer)=0; - virtual void Close()=0; - virtual s32 Test() const=0; - virtual void Configure(HWND parent)=0; - virtual bool Is51Out() const=0; - - // Returns the number of empty samples in the output buffer. - // (which is effectively the amount of data played since the last update) - virtual int GetEmptySampleCount() const=0; -}; - -//internal -extern SndOutModule *WaveOut; -extern SndOutModule *DSoundOut; -extern SndOutModule *FModOut; -extern SndOutModule *ASIOOut; -extern SndOutModule *XAudio2Out; -extern SndOutModule *DSound51Out; - -extern SndOutModule* mods[]; - -#endif // SNDOUT_H_INCLUDE diff --git a/plugins/spu2ghz/src/spdif.h b/plugins/spu2ghz/src/spdif.h deleted file mode 100644 index 16cca3ef5f..0000000000 --- a/plugins/spu2ghz/src/spdif.h +++ /dev/null @@ -1,112 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef SPDIF_H_INCLUDED -#define SPDIF_H_INCLUDED - -#ifndef u32 -typedef unsigned int u32; -#endif - -/* - Preamble cell-order cell-order - (last cell "0") (last cell "1") - ---------------------------------------------- - "B" 11101000 00010111 - "M" 11100010 00011101 - "W" 11100100 00011011 - - Only the lower 4 bits are used. - -Preamble B: Marks a word containing data for channel A (left) - at the start of the data-block. - -Preamble M: Marks a word with data for channel A that isn't - at the start of the data-block. - -Preamble W: Marks a word containing data for channel B. - (right, for stereo). When using more than 2 - channels, this could also be any other channel - (except for A). - - bits meaning - ---------------------------------------------------------- - 0-3 Preamble (see above; special structure) - - 4-7 Auxillary-audio-databits - - 8-27 Sample - (A 24-bit sample can be used (using bits 4-27). - A CD-player uses only 16 bits, so only bits - 13 (LSB) to 27 (MSB) are used. Bits 4-12 are - set to 0). - - 28 Validity - (When this bit is set, the sample should not - be used by the receiver. A CD-player uses - the 'error-flag' to set this bit). - - 29 Subcode-data - - 30 Channel-status-information - - 31 Parity (bit 0-3 are not included) - -*/ - -typedef struct _subframe -{ - u32 preamble:4; - u32 aux_data:4; - u32 snd_data:20; - u32 validity:1; - u32 subcode:1; - u32 chstatus:1; - u32 parity:1; -} subframe; - -/* - bit meaning - ------------------------------------------------------------- - 0-3 controlbits: - bit 0: 0 (is set to 1 during 4 channel transmission) - bit 1: 0=Digital audio, 1=Non-audio (reserved to be 0 on old S/PDIF specs) - bit 2: copy-protection. Copying is allowed when this bit is set. - bit 3: is set when pre-emphasis is used. - - 4-7 0 (reserved) - - 9-15 catagory-code: - 0 = common 2-channel format - 1 = 2-channel CD-format - (set by a CD-player when a subcode is transmitted) - 2 = 2-channel PCM-encoder-decoder format - - others are not used - - 19-191 0 (reserved) -*/ - -typedef struct _chstatus -{ - u8 ctrlbits:4; - u8 reservd1:4; - u8 category; - u8 reservd2[22]; -} chstatus: - -#endif//SPDIF_H_INCLUDED \ No newline at end of file diff --git a/plugins/spu2ghz/src/spu2.cpp b/plugins/spu2ghz/src/spu2.cpp deleted file mode 100644 index 683d3713f7..0000000000 --- a/plugins/spu2ghz/src/spu2.cpp +++ /dev/null @@ -1,1370 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "SPU2.h" -#include "resource.h" -#include - -#include "regtable.h" - -void StartVoices(int core, u32 value); -void StopVoices(int core, u32 value); - -void InitADSR(); - -DWORD CALLBACK TimeThread(PVOID /* unused param */); - -const char *ParamNames[8]={"VOLL","VOLR","PITCH","ADSR1","ADSR2","ENVX","VOLXL","VOLXR"}; -const char *AddressNames[6]={"SSAH","SSAL","LSAH","LSAL","NAXH","NAXL"}; - - -// [Air]: fixed the hacky part of UpdateTimer with this: -bool resetClock = true; - -// Used to make spu2 more robust at loading incompatible saves. -// Disables re-freezing of save state data. -bool disableFreezes=false; - -void (* _irqcallback)(); -void (* dma4callback)(); -void (* dma7callback)(); - -short *spu2regs; -short *_spu2mem; -s32 uTicks; - -u8 callirq; - -HANDLE hThreadFunc; -u32 ThreadFuncID; - -#ifndef PUBLIC -V_CoreDebug DebugCores[2]; -#endif -V_Core Cores[2]; -V_SPDIF Spdif; - -s16 OutPos; -s16 InputPos; -u8 InpBuff; -u32 Cycles; -u32 Num; - -u32* cPtr=NULL; -u32 lClocks=0; - -bool hasPtr=false; - -int PlayMode; - -s16 attrhack[2]={0,0}; - -HINSTANCE hInstance; - -bool debugDialogOpen=false; -HWND hDebugDialog=NULL; - -CRITICAL_SECTION threadSync; - -bool has_to_call_irq=false; - -void SetIrqCall() -{ - has_to_call_irq=true; -} - -void SysMessage(const char *fmt, ...) -{ - va_list list; - char tmp[512]; - - va_start(list,fmt); - sprintf_s(tmp,fmt,list); - va_end(list); - MessageBox(0, tmp, "SPU2ghz Msg", 0); -} - -__forceinline s16 * __fastcall GetMemPtr(u32 addr) -{ -#ifndef _DEBUG_FAST - // In case you're wondering, this assert is the reason spu2ghz - // runs so incrediously slow in Debug mode. :P - assert(addr<0x100000); -#endif - return (_spu2mem+addr); -} - -__forceinline s16 __fastcall spu2M_Read( u32 addr ) -{ - return *GetMemPtr( addr & 0xfffff ); -} - -// writes a signed value to the SPU2 ram -// Invalidates the ADPCM cache in the process. -// Optimization note: don't use __forceinline because the footprint of this -// function is a little too heavy now. Better to let the compiler decide. -__inline void __fastcall spu2M_Write( u32 addr, s16 value ) -{ - // Make sure the cache is invalidated: - // (note to self : addr address WORDs, not bytes) - - addr &= 0xfffff; - if( addr >= SPU2_DYN_MEMLINE ) - { - const int cacheIdx = addr / pcm_WordsPerBlock; - pcm_cache_data[cacheIdx].Validated = false; - - ConLog( " * SPU2 : PcmCache Block Clear at 0x%x (cacheIdx=0x%x)\n", addr, cacheIdx); - } - *GetMemPtr( addr ) = value; -} - -// writes an unsigned value to the SPU2 ram -__inline void __fastcall spu2M_Write( u32 addr, u16 value ) -{ - spu2M_Write( addr, (s16)value ); -} - -__forceinline void RegLog(int level, char *RName,u32 mem,u32 core,u16 value) -{ - if( level > 1 ) - FileLog("[%10d] SPU2 write mem %08x (core %d, register %s) value %04x\n",Cycles,mem,core,RName,value); -} - -void AssignVolume(V_Volume& vol, s16 value) -{ - vol.Reg_VOL = value; - if (value & 0x8000) { // +Lin/-Lin/+Exp/-Exp - vol.Mode=(value & 0xF000)>>12; - vol.Increment=(value & 0x3F); - } - else { - vol.Mode=0; - vol.Increment=0; - vol.Value=value<<1; - } -} - -void CoreReset(int c) -{ -#define DEFAULT_VOICE_VOLUME 0x3FFF - int v=0; - - ConLog(" * SPU2: Initializing core %d structures... ",c); - - memset(Cores+c,0,sizeof(Cores[c])); - - Cores[c].Regs.STATX=0; - Cores[c].Regs.ATTR=0; - Cores[c].ExtL=0x7FFF; - Cores[c].ExtR=0x7FFF; - Cores[c].InpL=0x7FFF; - Cores[c].InpR=0x7FFF; - Cores[c].FxL=0x7FFF; - Cores[c].FxR=0x7FFF; - Cores[c].MasterL.Reg_VOL=0x3FFF; - Cores[c].MasterL.Value=0x7FFF; - Cores[c].MasterR.Reg_VOL=0x3FFF; - Cores[c].MasterR.Value=0x7FFF; - Cores[c].ExtWetR = -1; - Cores[c].ExtWetL = -1; - Cores[c].ExtDryR = -1; - Cores[c].ExtDryL = -1; - Cores[c].InpWetR = -1; - Cores[c].InpWetL = -1; - Cores[c].InpDryR = -1; - Cores[c].InpDryL = -1; - Cores[c].SndWetR = -1; - Cores[c].SndWetL = -1; - Cores[c].SndDryR = -1; - Cores[c].SndDryL = -1; - Cores[c].Regs.MMIX = 0xFFCF; - Cores[c].Regs.VMIXL = 0xFFFFFF; - Cores[c].Regs.VMIXR = 0xFFFFFF; - Cores[c].Regs.VMIXEL = 0xFFFFFF; - Cores[c].Regs.VMIXER = 0xFFFFFF; - Cores[c].EffectsStartA= 0xEFFF8 + 0x10000*c; - Cores[c].EffectsEndA = 0xEFFFF + 0x10000*c; - Cores[c].FxEnable=0; - Cores[c].IRQA=0xFFFF0; - Cores[c].IRQEnable=1; - - for (v=0;v<24;v++) { - AssignVolume(Cores[c].Voices[v].VolumeL,DEFAULT_VOICE_VOLUME); - AssignVolume(Cores[c].Voices[v].VolumeR,DEFAULT_VOICE_VOLUME); - Cores[c].Voices[v].ADSR.Value=0; - Cores[c].Voices[v].ADSR.Phase=0; - Cores[c].Voices[v].Pitch=0x3FFF; - Cores[c].Voices[v].DryL = -1; - Cores[c].Voices[v].DryR = -1; - Cores[c].Voices[v].WetL = -1; - Cores[c].Voices[v].WetR = -1; - Cores[c].Voices[v].NextA=2800; - Cores[c].Voices[v].StartA=2800; - Cores[c].Voices[v].LoopStartA=2800; - //Cores[c].Voices[v].lastSetStartA=2800; fixme: this is part of debug now - } - Cores[c].DMAICounter=0; - Cores[c].AdmaInProgress=0; - - Cores[c].Regs.STATX=0x80; - - ConLog("done.\n"); -} - -static BOOL CALLBACK DebugProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) -{ - int wmId,wmEvent; - - switch(uMsg) - { - case WM_PAINT: - return FALSE; - case WM_INITDIALOG: - { - debugDialogOpen=true; - } - break; - case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - // Parse the menu selections: - switch (wmId) - { - case IDOK: - case IDCANCEL: - debugDialogOpen=false; - EndDialog(hWnd,0); - break; - default: - return FALSE; - } - break; - default: - return FALSE; - } - return TRUE; -} - -#ifndef PUBLIC - -int FillRectangle(HDC dc, int left, int top, int width, int height) -{ - RECT r = { left, top, left+width, top+height }; - - return FillRect(dc, &r, (HBRUSH)GetStockObject(DC_BRUSH)); -} - -BOOL DrawRectangle(HDC dc, int left, int top, int width, int height) -{ - RECT r = { left, top, left+width, top+height }; - - POINT p[5] = { - { r.left, r.top }, - { r.right, r.top }, - { r.right, r.bottom }, - { r.left, r.bottom }, - { r.left, r.top }, - }; - - return Polyline(dc, p, 5); -} - - -HFONT hf = NULL; -int lCount=0; -void UpdateDebugDialog() -{ - if(!debugDialogOpen) return; - - lCount++; - if(lCount>=(SampleRate/10)) - { - HDC hdc = GetDC(hDebugDialog); - - if(!hf) - { - hf = CreateFont( 8, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Lucida Console"); - } - - SelectObject(hdc,hf); - SelectObject(hdc,GetStockObject(DC_BRUSH)); - SelectObject(hdc,GetStockObject(DC_PEN)); - - for(int c=0;c<2;c++) - { - for(int v=0;v<24;v++) - { - int IX = 8+256*c; - int IY = 8+ 32*v; - V_Voice& vc(Cores[c].Voices[v]); - V_VoiceDebug& vcd( DebugCores[c].Voices[v] ); - - SetDCBrushColor(hdc,RGB( 0, 0, 0)); - if((vc.ADSR.Phase>0)&&(vc.ADSR.Phase<6)) - { - SetDCBrushColor(hdc,RGB( 0, 0,128)); - } - else - { - if(vcd.lastStopReason==1) - { - SetDCBrushColor(hdc,RGB(128, 0, 0)); - } - if(vcd.lastStopReason==2) - { - SetDCBrushColor(hdc,RGB( 0,128, 0)); - } - } - - FillRectangle(hdc,IX,IY,252,30); - - SetDCPenColor(hdc,RGB( 255, 128, 32)); - - DrawRectangle(hdc,IX,IY,252,30); - - SetDCBrushColor (hdc,RGB( 0,255, 0)); - - int vl = abs(vc.VolumeL.Value * 24 / 32768); - int vr = abs(vc.VolumeR.Value * 24 / 32768); - - FillRectangle(hdc,IX+38,IY+26 - vl, 4, vl); - FillRectangle(hdc,IX+42,IY+26 - vr, 4, vr); - - int adsr = (vc.ADSR.Value>>16) * 24 / 32768; - - FillRectangle(hdc,IX+48,IY+26 - adsr, 4, adsr); - - int peak = vcd.displayPeak * 24 / 32768; - - FillRectangle(hdc,IX+56,IY+26 - peak, 4, peak); - - SetTextColor(hdc,RGB( 0,255, 0)); - SetBkColor (hdc,RGB( 0, 0, 0)); - - static char t[1024]; - - sprintf(t,"%06x",vc.StartA); - TextOut(hdc,IX+4,IY+3,t,6); - - sprintf(t,"%06x",vc.NextA); - TextOut(hdc,IX+4,IY+12,t,6); - - sprintf(t,"%06x",vc.LoopStartA); - TextOut(hdc,IX+4,IY+21,t,6); - - vcd.displayPeak = 0; - - if(vcd.lastSetStartA != vc.StartA) - { - printf(" *** Warning! Core %d Voice %d: StartA should be %06x, and is %06x.\n", - c,v,vcd.lastSetStartA,vc.StartA); - vcd.lastSetStartA = vc.StartA; - } - } - } - ReleaseDC(hDebugDialog,hdc); - lCount=0; - } - - MSG msg; - while(PeekMessage(&msg,hDebugDialog,0,0,PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -} -#endif - -#define TickInterval 768 -#define SanityInterval 4800 - -u32 TicksCore=0; -u32 TicksThread=0; - -void __fastcall TimeUpdate(u32 cClocks) -{ - u32 dClocks = cClocks-lClocks; - - // [Air]: Sanity Check - // If for some reason our clock value seems way off base, just mix - // out a little bit, skip the rest, and hope the ship "rights" itself later on. - - if( dClocks > TickInterval*SanityInterval ) - { - ConLog( " * SPU2 > TimeUpdate Sanity Check (Tick Delta: %d) (PS2 Ticks: %d)\n", dClocks/TickInterval, cClocks/TickInterval ); - dClocks = TickInterval*SanityInterval; - lClocks = cClocks-dClocks; - } - - //UpdateDebugDialog(); - - //Update Mixing Progress - while(dClocks>=TickInterval) - { - if(has_to_call_irq) - { - ConLog(" * SPU2: Irq Called (%04x).\n",Spdif.Info); - has_to_call_irq=false; - if(_irqcallback) _irqcallback(); - } - - if(Cores[0].InitDelay>0) - { - Cores[0].InitDelay--; - if(Cores[0].InitDelay==0) - { - CoreReset(0); - } - } - - if(Cores[1].InitDelay>0) - { - Cores[1].InitDelay--; - if(Cores[1].InitDelay==0) - { - CoreReset(1); - } - } - - //Update DMA4 interrupt delay counter - if(Cores[0].DMAICounter>0) - { - Cores[0].DMAICounter-=TickInterval; - if(Cores[0].DMAICounter<=0) - { - Cores[0].MADR=Cores[0].TADR; - Cores[0].DMAICounter=0; - if(dma4callback) dma4callback(); - } - else { - Cores[0].MADR+=TickInterval<<1; - } - } - - //Update DMA7 interrupt delay counter - if(Cores[1].DMAICounter>0) - { - Cores[1].DMAICounter-=TickInterval; - if(Cores[1].DMAICounter<=0) - { - Cores[1].MADR=Cores[1].TADR; - Cores[1].DMAICounter=0; - //ConLog( "* SPU2 > DMA 7 Callback! %d\n", Cycles ); - if(dma7callback) dma7callback(); - } - else { - Cores[1].MADR+=TickInterval<<1; - } - } - - dClocks-=TickInterval; - lClocks+=TickInterval; - Cycles++; - - Mix(); - } -} - -static u16 mask = 0xFFFF; - -void UpdateSpdifMode() -{ - int OPM=PlayMode; - u16 last = 0; - - if(mask&Spdif.Out) - { - last = mask & Spdif.Out; - mask=mask&(~Spdif.Out); - } - - if(Spdif.Out&0x4) // use 24/32bit PCM data streaming - { - PlayMode=8; - ConLog(" * SPU2: WARNING: Possibly CDDA mode set!\n"); - return; - } - - if(Spdif.Out&SPDIF_OUT_BYPASS) - { - PlayMode=2; - if(Spdif.Mode&SPDIF_MODE_BYPASS_BITSTREAM) - PlayMode=4; //bitstream bypass - } - else - { - PlayMode=0; //normal processing - if(Spdif.Out&SPDIF_OUT_PCM) - { - PlayMode=1; - } - } - if(OPM!=PlayMode) - { - ConLog(" * SPU2: Play Mode Set to %s (%d).\n", - (PlayMode==0) ? "Normal" : ((PlayMode==1) ? "PCM Clone" : ((PlayMode==2) ? "PCM Bypass" : "BitStream Bypass")),PlayMode); - } -} - -void SPU_ps1_write(u32 mem, u16 value) -{ - bool show=true; - - u32 reg = mem&0xffff; - - if((reg>=0x1c00)&&(reg<0x1d80)) - { - //voice values - u8 voice = ((reg-0x1c00)>>4); - u8 vval = reg&0xf; - switch(vval) - { - case 0: //VOLL (Volume L) - Cores[0].Voices[voice].VolumeL.Mode=0; - Cores[0].Voices[voice].VolumeL.Value=value<<1; - Cores[0].Voices[voice].VolumeL.Reg_VOL = value; break; - case 1: //VOLR (Volume R) - Cores[0].Voices[voice].VolumeR.Mode=0; - Cores[0].Voices[voice].VolumeR.Value=value<<1; - Cores[0].Voices[voice].VolumeR.Reg_VOL = value; break; - case 2: Cores[0].Voices[voice].Pitch=value; break; - case 3: Cores[0].Voices[voice].StartA=(u32)value<<8; break; - case 4: // ADSR1 (Envelope) - Cores[0].Voices[voice].ADSR.Am=(value & 0x8000)>>15; - Cores[0].Voices[voice].ADSR.Ar=(value & 0x7F00)>>8; - Cores[0].Voices[voice].ADSR.Dr=(value & 0xF0)>>4; - Cores[0].Voices[voice].ADSR.Sl=(value & 0xF); - Cores[0].Voices[voice].ADSR.Reg_ADSR1 = value; break; - case 5: // ADSR2 (Envelope) - Cores[0].Voices[voice].ADSR.Sm=(value & 0xE000)>>13; - Cores[0].Voices[voice].ADSR.Sr=(value & 0x1FC0)>>6; - Cores[0].Voices[voice].ADSR.Rm=(value & 0x20)>>5; - Cores[0].Voices[voice].ADSR.Rr=(value & 0x1F); - Cores[0].Voices[voice].ADSR.Reg_ADSR2 = value; break; - case 6: - // [Air] Experimental --> shifting value into a 31 bit range. - // shifting by 16 might be more correct? - Cores[0].Voices[voice].ADSR.Value = value<<15; - ConLog( "* SPU2: Mysterious ADSR Volume Set to 0x%x", value ); - break; - case 7: Cores[0].Voices[voice].LoopStartA=(u32)value <<8; break; - - jNO_DEFAULT; - } - } - else switch(reg) - { - case 0x1d80:// Mainvolume left - Cores[0].MasterL.Mode=0; - Cores[0].MasterL.Value=value; - break; - case 0x1d82:// Mainvolume right - Cores[0].MasterL.Mode=0; - Cores[0].MasterR.Value=value; - break; - case 0x1d84:// Reverberation depth left - Cores[0].FxL=value; - break; - case 0x1d86:// Reverberation depth right - Cores[0].FxR=value; - break; - - case 0x1d88:// Voice ON (0-15) - SPU2_FastWrite(REG_S_KON,value); - break; - case 0x1d8a:// Voice ON (16-23) - SPU2_FastWrite(REG_S_KON+2,value); - break; - - case 0x1d8c:// Voice OFF (0-15) - SPU2_FastWrite(REG_S_KOFF,value); - break; - case 0x1d8e:// Voice OFF (16-23) - SPU2_FastWrite(REG_S_KOFF+2,value); - break; - - case 0x1d90:// Channel FM (pitch lfo) mode (0-15) - SPU2_FastWrite(REG_S_PMON,value); - break; - case 0x1d92:// Channel FM (pitch lfo) mode (16-23) - SPU2_FastWrite(REG_S_PMON+2,value); - break; - - - case 0x1d94:// Channel Noise mode (0-15) - SPU2_FastWrite(REG_S_NON,value); - break; - case 0x1d96:// Channel Noise mode (16-23) - SPU2_FastWrite(REG_S_NON+2,value); - break; - - case 0x1d98:// Channel Reverb mode (0-15) - SPU2_FastWrite(REG_S_VMIXEL,value); - SPU2_FastWrite(REG_S_VMIXER,value); - break; - case 0x1d9a:// Channel Reverb mode (16-23) - SPU2_FastWrite(REG_S_VMIXEL+2,value); - SPU2_FastWrite(REG_S_VMIXER+2,value); - break; - case 0x1d9c:// Channel Reverb mode (0-15) - SPU2_FastWrite(REG_S_VMIXL,value); - SPU2_FastWrite(REG_S_VMIXR,value); - break; - case 0x1d9e:// Channel Reverb mode (16-23) - SPU2_FastWrite(REG_S_VMIXL+2,value); - SPU2_FastWrite(REG_S_VMIXR+2,value); - break; - - case 0x1da2:// Reverb work area start - { - u32 val=(u32)value <<8; - - SPU2_FastWrite(REG_A_ESA, val&0xFFFF); - SPU2_FastWrite(REG_A_ESA+2,val>>16); - } - break; - case 0x1da4: - Cores[0].IRQA=(u32)value<<8; - break; - case 0x1da6: - Cores[0].TSA=(u32)value<<8; - break; - - case 0x1daa: - SPU2_FastWrite(REG_C_ATTR,value); - break; - case 0x1dae: - SPU2_FastWrite(REG_P_STATX,value); - break; - case 0x1da8:// Spu Write to Memory - DmaWrite(0,value); - show=false; - break; - } - - if(show) FileLog("[%10d] (!) SPU write mem %08x value %04x\n",Cycles,mem,value); - - spu2Ru16(mem)=value; -} - -u16 SPU_ps1_read(u32 mem) -{ - bool show=true; - u16 value = spu2Ru16(mem); - - u32 reg = mem&0xffff; - - if((reg>=0x1c00)&&(reg<0x1d80)) - { - //voice values - u8 voice = ((reg-0x1c00)>>4); - u8 vval = reg&0xf; - switch(vval) - { - case 0: //VOLL (Volume L) - value=Cores[0].Voices[voice].VolumeL.Mode; - value=Cores[0].Voices[voice].VolumeL.Value; - value=Cores[0].Voices[voice].VolumeL.Reg_VOL; break; - case 1: //VOLR (Volume R) - value=Cores[0].Voices[voice].VolumeR.Mode; - value=Cores[0].Voices[voice].VolumeR.Value; - value=Cores[0].Voices[voice].VolumeR.Reg_VOL; break; - case 2: value=Cores[0].Voices[voice].Pitch; break; - case 3: value=Cores[0].Voices[voice].StartA; break; - case 4: value=Cores[0].Voices[voice].ADSR.Reg_ADSR1; break; - case 5: value=Cores[0].Voices[voice].ADSR.Reg_ADSR2; break; - case 6: value=Cores[0].Voices[voice].ADSR.Value >> 16; break; - case 7: value=Cores[0].Voices[voice].LoopStartA; break; - - jNO_DEFAULT; - } - } - else switch(reg) - { - case 0x1d80: value = Cores[0].MasterL.Value; break; - case 0x1d82: value = Cores[0].MasterR.Value; break; - case 0x1d84: value = Cores[0].FxL; break; - case 0x1d86: value = Cores[0].FxR; break; - - case 0x1d88: value = 0; break; - case 0x1d8a: value = 0; break; - case 0x1d8c: value = 0; break; - case 0x1d8e: value = 0; break; - - case 0x1d90: value = Cores[0].Regs.PMON&0xFFFF; break; - case 0x1d92: value = Cores[0].Regs.PMON>>16; break; - - case 0x1d94: value = Cores[0].Regs.NON&0xFFFF; break; - case 0x1d96: value = Cores[0].Regs.NON>>16; break; - - case 0x1d98: value = Cores[0].Regs.VMIXEL&0xFFFF; break; - case 0x1d9a: value = Cores[0].Regs.VMIXEL>>16; break; - case 0x1d9c: value = Cores[0].Regs.VMIXL&0xFFFF; break; - case 0x1d9e: value = Cores[0].Regs.VMIXL>>16; break; - - case 0x1da2: value = Cores[0].EffectsStartA>>3; break; - case 0x1da4: value = Cores[0].IRQA>>3; break; - case 0x1da6: value = Cores[0].TSA>>3; break; - - case 0x1daa: - value = SPU2read(REG_C_ATTR); - break; - case 0x1dae: - value = 0; //SPU2read(REG_P_STATX)<<3; - break; - case 0x1da8: - value = DmaRead(0); - show=false; - break; - } - - if(show) FileLog("[%10d] (!) SPU read mem %08x value %04x\n",Cycles,mem,value); - return value; -} - -void RegWriteLog(u32 core,u16 value); - -void SPU2writeLog(u32 rmem, u16 value) -{ -#ifndef PUBLIC - u32 vx=0, vc=0, core=0, omem, mem; - omem=mem=rmem & 0x7FF; //FFFF; - if (mem & 0x400) { omem^=0x400; core=1; } - - if( omem < 0x0180 ) // Voice Params (VP) - { - const u32 voice = (omem & 0x1F0) >> 4; - const u32 param = (omem & 0xF) >> 1; - char dest[192]; - sprintf( dest, "Voice %d %s", voice,ParamNames[param] ); - RegLog( 2, dest, rmem, core, value ); - } - else if ((omem >= 0x01C0) && (omem < 0x02DE)) // Voice Addressing Params (VA) - { - const u32 voice = ((omem-0x01C0) / 12); - const u32 address = ((omem-0x01C0) % 12)>>1; - - char dest[192]; - sprintf( dest, "Voice %d %s", voice, AddressNames[address] ); - RegLog( 2, dest, rmem, core, value ); - } - else if ((mem >= 0x0760) && (mem < 0x07b0)) - { - omem=mem; core=0; - if (mem >= 0x0788) {omem-=0x28; core=1;} - switch(omem) { - case REG_P_EVOLL: RegLog(2,"EVOLL",rmem,core,value); break; - case REG_P_EVOLR: RegLog(2,"EVOLR",rmem,core,value); break; - case REG_P_AVOLL: if (core) { RegLog(2,"AVOLL",rmem,core,value); } break; - case REG_P_AVOLR: if (core) { RegLog(2,"AVOLR",rmem,core,value); } break; - case REG_P_BVOLL: RegLog(2,"BVOLL",rmem,core,value); break; - case REG_P_BVOLR: RegLog(2,"BVOLR",rmem,core,value); break; - case REG_P_MVOLXL: RegLog(2,"MVOLXL",rmem,core,value); break; - case REG_P_MVOLXR: RegLog(2,"MVOLXR",rmem,core,value); break; - case R_IIR_ALPHA: RegLog(2,"IIR_ALPHA",rmem,core,value); break; - case R_ACC_COEF_A: RegLog(2,"ACC_COEF_A",rmem,core,value); break; - case R_ACC_COEF_B: RegLog(2,"ACC_COEF_B",rmem,core,value); break; - case R_ACC_COEF_C: RegLog(2,"ACC_COEF_C",rmem,core,value); break; - case R_ACC_COEF_D: RegLog(2,"ACC_COEF_D",rmem,core,value); break; - case R_IIR_COEF: RegLog(2,"IIR_COEF",rmem,core,value); break; - case R_FB_ALPHA: RegLog(2,"FB_ALPHA",rmem,core,value); break; - case R_FB_X: RegLog(2,"FB_X",rmem,core,value); break; - case R_IN_COEF_L: RegLog(2,"IN_COEF_L",rmem,core,value); break; - case R_IN_COEF_R: RegLog(2,"IN_COEF_R",rmem,core,value); break; - - } - } - else if ((mem>=0x07C0) && (mem<0x07CE)) { - switch(mem) { - case SPDIF_OUT: - RegLog(2,"SPDIF_OUT",rmem,-1,value); - break; - case IRQINFO: - RegLog(2,"IRQINFO",rmem,-1,value); - break; - case 0x7c4: - if(Spdif.Unknown1 != value) ConLog(" * SPU2: SPDIF Unknown Register 1 set to %04x\n",value); - RegLog(2,"SPDIF_UNKNOWN1",rmem,-1,value); - break; - case SPDIF_MODE: - if(Spdif.Mode != value) ConLog(" * SPU2: SPDIF Mode set to %04x\n",value); - RegLog(2,"SPDIF_MODE",rmem,-1,value); - break; - case SPDIF_MEDIA: - if(Spdif.Media != value) ConLog(" * SPU2: SPDIF Media set to %04x\n",value); - RegLog(2,"SPDIF_MEDIA",rmem,-1,value); - break; - case 0x7ca: - if(Spdif.Unknown2 != value) ConLog(" * SPU2: SPDIF Unknown Register 2 set to %04x\n",value); - RegLog(2,"SPDIF_UNKNOWN2",rmem,-1,value); - break; - case SPDIF_COPY: - if(Spdif.Protection != value) ConLog(" * SPU2: SPDIF Copy set to %04x\n",value); - RegLog(2,"SPDIF_COPY",rmem,-1,value); - break; - } - UpdateSpdifMode(); - } - else - { - switch(omem) - { - case REG_C_ATTR: - RegLog(4,"ATTR",rmem,core,value); - break; - case REG_S_PMON: - RegLog(1,"PMON0",rmem,core,value); - break; - case (REG_S_PMON + 2): - RegLog(1,"PMON1",rmem,core,value); - break; - case REG_S_NON: - RegLog(1,"NON0",rmem,core,value); - break; - case (REG_S_NON + 2): - RegLog(1,"NON1",rmem,core,value); - break; - case REG_S_VMIXL: - RegLog(1,"VMIXL0",rmem,core,value); - case (REG_S_VMIXL + 2): - RegLog(1,"VMIXL1",rmem,core,value); - break; - case REG_S_VMIXEL: - RegLog(1,"VMIXEL0",rmem,core,value); - break; - case (REG_S_VMIXEL + 2): - RegLog(1,"VMIXEL1",rmem,core,value); - break; - case REG_S_VMIXR: - RegLog(1,"VMIXR0",rmem,core,value); - break; - case (REG_S_VMIXR + 2): - RegLog(1,"VMIXR1",rmem,core,value); - break; - case REG_S_VMIXER: - RegLog(1,"VMIXER0",rmem,core,value); - break; - case (REG_S_VMIXER + 2): - RegLog(1,"VMIXER1",rmem,core,value); - break; - case REG_P_MMIX: - RegLog(1,"MMIX",rmem,core,value); - break; - case REG_A_IRQA: - RegLog(2,"IRQAH",rmem,core,value); - break; - case (REG_A_IRQA + 2): - RegLog(2,"IRQAL",rmem,core,value); - break; - case (REG_S_KON + 2): - RegLog(1,"KON1",rmem,core,value); - break; - case REG_S_KON: - RegLog(1,"KON0",rmem,core,value); - break; - case (REG_S_KOFF + 2): - RegLog(1,"KOFF1",rmem,core,value); - break; - case REG_S_KOFF: - RegLog(1,"KOFF0",rmem,core,value); - break; - case REG_A_TSA: - RegLog(2,"TSAH",rmem,core,value); - break; - case (REG_A_TSA + 2): - RegLog(2,"TSAL",rmem,core,value); - break; - case REG_S_ENDX: - //ConLog(" * SPU2: Core %d ENDX cleared!\n",core); - RegLog(2,"ENDX0",rmem,core,value); - break; - case (REG_S_ENDX + 2): - //ConLog(" * SPU2: Core %d ENDX cleared!\n",core); - RegLog(2,"ENDX1",rmem,core,value); - break; - case REG_P_MVOLL: - RegLog(1,"MVOLL",rmem,core,value); - break; - case REG_P_MVOLR: - RegLog(1,"MVOLR",rmem,core,value); - break; - case REG_S_ADMAS: - RegLog(3,"ADMAS",rmem,core,value); - ConLog(" * SPU2: Core %d AutoDMAControl set to %d\n",core,value); - break; - case REG_P_STATX: - RegLog(3,"STATX",rmem,core,value); - break; - case REG_A_ESA: - RegLog(1,"ESAH",rmem,core,value); - break; - case (REG_A_ESA + 2): - RegLog(1,"ESAL",rmem,core,value); - break; - case REG_A_EEA: - RegLog(1,"EEAH",rmem,core,value); - break; - - #define LOG_REVB_REG(n,t) \ - case R_##n: \ - RegLog(2,t "H",mem,core,value); \ - break; \ - case (R_##n + 2): \ - RegLog(2,t "L",mem,core,value); \ - break; - - LOG_REVB_REG(FB_SRC_A,"FB_SRC_A") - LOG_REVB_REG(FB_SRC_B,"FB_SRC_B") - LOG_REVB_REG(IIR_SRC_A0,"IIR_SRC_A0") - LOG_REVB_REG(IIR_SRC_A1,"IIR_SRC_A1") - LOG_REVB_REG(IIR_SRC_B1,"IIR_SRC_B1") - LOG_REVB_REG(IIR_SRC_B0,"IIR_SRC_B0") - LOG_REVB_REG(IIR_DEST_A0,"IIR_DEST_A0") - LOG_REVB_REG(IIR_DEST_A1,"IIR_DEST_A1") - LOG_REVB_REG(IIR_DEST_B0,"IIR_DEST_B0") - LOG_REVB_REG(IIR_DEST_B1,"IIR_DEST_B1") - LOG_REVB_REG(ACC_SRC_A0,"ACC_SRC_A0") - LOG_REVB_REG(ACC_SRC_A1,"ACC_SRC_A1") - LOG_REVB_REG(ACC_SRC_B0,"ACC_SRC_B0") - LOG_REVB_REG(ACC_SRC_B1,"ACC_SRC_B1") - LOG_REVB_REG(ACC_SRC_C0,"ACC_SRC_C0") - LOG_REVB_REG(ACC_SRC_C1,"ACC_SRC_C1") - LOG_REVB_REG(ACC_SRC_D0,"ACC_SRC_D0") - LOG_REVB_REG(ACC_SRC_D1,"ACC_SRC_D1") - LOG_REVB_REG(MIX_DEST_A0,"MIX_DEST_A0") - LOG_REVB_REG(MIX_DEST_A1,"MIX_DEST_A1") - LOG_REVB_REG(MIX_DEST_B0,"MIX_DEST_B0") - LOG_REVB_REG(MIX_DEST_B1,"MIX_DEST_B1") - - default: - RegLog(2,"UNKNOWN",rmem,core,value); spu2Ru16(mem) = value; - } - } -#endif -} - -__forceinline void SPU2_FastWrite( u32 rmem, u16 value ) -{ - u32 vx=0, vc=0, core=0, omem, mem; - omem=mem=rmem & 0x7FF; //FFFF; - if (mem & 0x400) { omem^=0x400; core=1; } - - SPU2writeLog(mem,value); - - if (omem < 0x0180) // Voice Params - { - const u32 voice = (omem & 0x1F0) >> 4; - const u32 param = (omem & 0xF)>>1; - - //FileLog("[%10d] SPU2 write mem %08x (Core %d Voice %d Param %s) value %x\n",Cycles,rmem,core,voice,ParamNames[param],value); - - switch (param) - { - case 0: //VOLL (Volume L) - case 1: //VOLR (Volume R) - { - V_Volume& thisvol = (param==0) ? Cores[core].Voices[voice].VolumeL : Cores[core].Voices[voice].VolumeR; - if (value & 0x8000) // +Lin/-Lin/+Exp/-Exp - { - thisvol.Mode=(value & 0xF000)>>12; - thisvol.Increment=(value & 0x3F); - } - else - { - // Constant Volume mode (no slides or envelopes) - // Volumes range from 0x3fff to -0x4000. Values below zero invert the waveform (unimplemented) - - thisvol.Mode=0; - thisvol.Increment=0; - - s16 newval = value & 0x3fff; - if( value & 0x4000 ) - newval = 0x3fff - newval; - thisvol.Value = newval<<1; - } - thisvol.Reg_VOL = value; - } - break; - - case 2: Cores[core].Voices[voice].Pitch=value; break; - case 3: // ADSR1 (Envelope) - Cores[core].Voices[voice].ADSR.Am=(value & 0x8000)>>15; - Cores[core].Voices[voice].ADSR.Ar=(value & 0x7F00)>>8; - Cores[core].Voices[voice].ADSR.Dr=(value & 0xF0)>>4; - Cores[core].Voices[voice].ADSR.Sl=(value & 0xF); - Cores[core].Voices[voice].ADSR.Reg_ADSR1 = value; break; - case 4: // ADSR2 (Envelope) - Cores[core].Voices[voice].ADSR.Sm=(value & 0xE000)>>13; - Cores[core].Voices[voice].ADSR.Sr=(value & 0x1FC0)>>6; - Cores[core].Voices[voice].ADSR.Rm=(value & 0x20)>>5; - Cores[core].Voices[voice].ADSR.Rr=(value & 0x1F); - Cores[core].Voices[voice].ADSR.Reg_ADSR2 = value; break; - case 5: - // [Air] : Mysterious volume set code. Too bad none of my games ever use it. - // (as usual... ) - Cores[core].Voices[voice].ADSR.Value = value << 15; - ConLog( "* SPU2: Mysterious ADSR Volume Set to 0x%x", value ); - break; - - case 6: Cores[core].Voices[voice].VolumeL.Value=value; break; - case 7: Cores[core].Voices[voice].VolumeR.Value=value; break; - - jNO_DEFAULT; - } - } - else if ((omem >= 0x01C0) && (omem < 0x02DE)) - { - const u32 voice =((omem-0x01C0) / 12); - const u32 address =((omem-0x01C0) % 12)>>1; - //FileLog("[%10d] SPU2 write mem %08x (Core %d Voice %d Address %s) value %x\n",Cycles,rmem,core,voice,AddressNames[address],value); - - switch (address) { - case 0: Cores[core].Voices[voice].StartA=((value & 0x0F) << 16) | (Cores[core].Voices[voice].StartA & 0xFFF8); - #ifndef PUBLIC - DebugCores[core].Voices[voice].lastSetStartA = Cores[core].Voices[voice].StartA; - #endif - break; - case 1: Cores[core].Voices[voice].StartA=(Cores[core].Voices[voice].StartA & 0x0F0000) | (value & 0xFFF8); - #ifndef PUBLIC - DebugCores[core].Voices[voice].lastSetStartA = Cores[core].Voices[voice].StartA; - #endif - //if(core==1) printf(" *** StartA for C%dV%02d set to 0x%05x\n",core,voice,Cores[core].Voices[voice].StartA); - break; - case 2: Cores[core].Voices[voice].LoopStartA=((value & 0x0F) << 16) | (Cores[core].Voices[voice].LoopStartA & 0xFFF8); - Cores[core].Voices[voice].LoopMode=3; break; - case 3: Cores[core].Voices[voice].LoopStartA=(Cores[core].Voices[voice].LoopStartA & 0x0F0000) | (value & 0xFFF8);break; - Cores[core].Voices[voice].LoopMode=3; break; - case 4: Cores[core].Voices[voice].NextA=((value & 0x0F) << 16) | (Cores[core].Voices[voice].NextA & 0xFFF8); - //printf(" *** Warning: C%dV%02d NextA MODIFIED EXTERNALLY!\n",core,voice); - break; - case 5: Cores[core].Voices[voice].NextA=(Cores[core].Voices[voice].NextA & 0x0F0000) | (value & 0xFFF8); - //printf(" *** Warning: C%dV%02d NextA MODIFIED EXTERNALLY!\n",core,voice); - break; - } - } - else - { - switch(omem) - { - case REG_C_ATTR: - { - int irqe=Cores[core].IRQEnable; - int bit0=Cores[core].AttrBit0; - int bit4=Cores[core].AttrBit4; - - if(((value>>15)&1)&&(!Cores[core].CoreEnabled)&&(Cores[core].InitDelay==0)) // on init/reset - { - if(hasPtr) - { - Cores[core].InitDelay=1; - Cores[core].Regs.STATX=0; - } - else - { - CoreReset(core); - } - } - - Cores[core].AttrBit0 =(value>> 0) & 0x01; //1 bit - Cores[core].DMABits =(value>> 1) & 0x07; //3 bits - Cores[core].AttrBit4 =(value>> 4) & 0x01; //1 bit - Cores[core].AttrBit5 =(value>> 5) & 0x01; //1 bit - Cores[core].IRQEnable =(value>> 6) & 0x01; //1 bit - Cores[core].FxEnable =(value>> 7) & 0x01; //1 bit - Cores[core].NoiseClk =(value>> 8) & 0x3f; //6 bits - //Cores[core].Mute =(value>>14) & 0x01; //1 bit - Cores[core].Mute=0; - Cores[core].CoreEnabled=(value>>15) & 0x01; //1 bit - Cores[core].Regs.ATTR =value&0x7fff; - - if(value&0x000E) - { - ConLog(" * SPU2: Core %d ATTR unknown bits SET! value=%04x\n",core,value); - } - - if(Cores[core].AttrBit0!=bit0) - { - ConLog(" * SPU2: ATTR bit 0 set to %d\n",Cores[core].AttrBit0); - } - if(Cores[core].IRQEnable!=irqe) - { - ConLog(" * SPU2: IRQ %s\n",((Cores[core].IRQEnable==0)?"disabled":"enabled")); - if(!Cores[core].IRQEnable) - Spdif.Info=0; - } - - } - return; - -#define vx_SetSomeBits( varname, start, done ) \ - { for (uint vc=start, vx=1;vc>1]) = value; - break; - } - } - - if ((mem>=0x07C0) && (mem<0x07CE)) - { - UpdateSpdifMode(); - } -} - - -void VoiceStart(int core,int vc) -{ - if((Cycles-Cores[core].Voices[vc].PlayCycle)>=4) - { - if(Cores[core].Voices[vc].StartA&7) - { - fprintf( stderr, " *** Misaligned StartA %05x!\n",Cores[core].Voices[vc].StartA); - Cores[core].Voices[vc].StartA=(Cores[core].Voices[vc].StartA+0xFFFF8)+0x8; - } - - Cores[core].Voices[vc].ADSR.Releasing=0; - Cores[core].Voices[vc].ADSR.Value=1; - Cores[core].Voices[vc].ADSR.Phase=1; - Cores[core].Voices[vc].PlayCycle=Cycles; - Cores[core].Voices[vc].SCurrent=28; - Cores[core].Voices[vc].LoopMode=0; - Cores[core].Voices[vc].LoopFlags=0; - Cores[core].Voices[vc].LoopStartA=Cores[core].Voices[vc].StartA; - Cores[core].Voices[vc].NextA=Cores[core].Voices[vc].StartA; - Cores[core].Voices[vc].Prev1=0; - Cores[core].Voices[vc].Prev2=0; - - Cores[core].Voices[vc].PV1=Cores[core].Voices[vc].PV2=0; - Cores[core].Voices[vc].PV3=Cores[core].Voices[vc].PV4=0; - - Cores[core].Regs.ENDX&=~(1<>vc) & 1) { - VoiceStart(core,vc); - } - } - Cores[core].Regs.ENDX &= ~(value); - //Cores[core].Regs.ENDX = 0; -} - -void StopVoices(int core, u32 value) -{ - u32 vx=1,vc=0; - for (vc=0;vc<24;vc++) { - if ((value>>vc) & 1) { - Cores[core].Voices[vc].ADSR.Releasing=1; - //if(MsgKeyOnOff()) ConLog(" * SPU2: KeyOff: Core %d; Voice %d.\n",core,vc); - } - } -} - diff --git a/plugins/spu2ghz/src/spu2.h b/plugins/spu2ghz/src/spu2.h deleted file mode 100644 index 7b2fc13ca9..0000000000 --- a/plugins/spu2ghz/src/spu2.h +++ /dev/null @@ -1,242 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#ifndef SPU2_H_INCLUDED -#define SPU2_H_INCLUDED - -//system defines -#ifdef __LINUX__ - #include -#else -# define WINVER 0x0501 -# define _WIN32_WINNT 0x0501 -# include -# include -#endif - -#include - -#include -#include -#include -#include -#include - -//SPU2 plugin defines -//#define SPU2defs // not using the PCSX2 defs (see below) -#include "PS2Edefs.h" - -#define EXPORT_C_(type) extern "C" __declspec(dllexport) type __stdcall - -// We have our own versions that have the DLLExport attribute configured: - -EXPORT_C_(s32) SPU2init(); -EXPORT_C_(s32) SPU2open(void *pDsp); -EXPORT_C_(void) SPU2close(); -EXPORT_C_(void) SPU2shutdown(); -EXPORT_C_(void) SPU2write(u32 mem, u16 value); -EXPORT_C_(u16) SPU2read(u32 mem); -EXPORT_C_(void) SPU2readDMA4Mem(u16 *pMem, u32 size); -EXPORT_C_(void) SPU2writeDMA4Mem(u16 *pMem, u32 size); -EXPORT_C_(void) SPU2interruptDMA4(); -EXPORT_C_(void) SPU2readDMA7Mem(u16* pMem, u32 size); -EXPORT_C_(void) SPU2writeDMA7Mem(u16 *pMem, u32 size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -EXPORT_C_(void) SPU2setDMABaseAddr(uptr baseaddr); - -EXPORT_C_(void) SPU2interruptDMA7(); -EXPORT_C_(u32) SPU2ReadMemAddr(int core); -EXPORT_C_(void) SPU2WriteMemAddr(int core,u32 value); -EXPORT_C_(void) SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -EXPORT_C_(int) SPU2setupRecording(int start, void* pData); - -EXPORT_C_(void) SPU2setClockPtr(u32* ptr); - -EXPORT_C_(void) SPU2async(u32 cycles); -EXPORT_C_(s32) SPU2freeze(int mode, freezeData *data); -EXPORT_C_(void) SPU2configure(); -EXPORT_C_(void) SPU2about(); -EXPORT_C_(s32) SPU2test(); - - -//#define EFFECTS_DUMP - -//Plugin parts -#include "config.h" -#include "defs.h" -#include "regs.h" -#include "dma.h" -#include "mixer.h" -#include "sndout.h" - -#include "spu2replay.h" - -#define SPU2_LOG - -#include "debug.h" - -// [Air] : give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - -//-------------------------------------------------------------------------------------- -// Helper macros -//-------------------------------------------------------------------------------------- -#ifndef SAFE_FREE -# define SAFE_FREE(p) { if(p) { free(p); (p)=NULL; } } -#endif -#ifndef SAFE_DELETE_ARRAY -# define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } -#endif -#ifndef SAFE_DELETE_OBJ -# define SAFE_DELETE_OBJ(p) { if(p) { delete (p); (p)=NULL; } } -#endif -#ifndef SAFE_RELEASE -# define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } -#endif - -// The SPU2 has a dynamic memory range which is used for several internal operations, such as -// registers, CORE 1/2 mixing, AutoDMAs, and some other fancy stuff. We exclude this range -// from the cache here: -static const s32 SPU2_DYN_MEMLINE = 0x2800; - -// 8 short words per encoded PCM block. (as stored in SPU2 ram) -static const int pcm_WordsPerBlock = 8; - -// number of cachable ADPCM blocks (any blocks above the SPU2_DYN_MEMLINE) -static const int pcm_BlockCount = 0x100000 / pcm_WordsPerBlock; - -// 28 samples per decoded PCM block (as stored in our cache) -static const int pcm_DecodedSamplesPerBlock = 28; - -struct PcmCacheEntry -{ - bool Validated; - s16 Sampledata[pcm_DecodedSamplesPerBlock]; -}; - -extern void spdif_set51(u32 is_5_1_out); -extern u32 spdif_init(); -extern void spdif_shutdown(); -extern void spdif_get_samples(s32 *samples); // fills the buffer with [l,r,c,lfe,sl,sr] if using 5.1 output, or [l,r] if using stereo - -extern short *spu2regs; -extern short *_spu2mem; - -extern PcmCacheEntry* pcm_cache_data; - -extern s16 __forceinline * __fastcall GetMemPtr(u32 addr); -extern s16 __forceinline __fastcall spu2M_Read( u32 addr ); -extern void __inline __fastcall spu2M_Write( u32 addr, s16 value ); -extern void __inline __fastcall spu2M_Write( u32 addr, u16 value ); - -#define spu2Rs16(mmem) (*(s16 *)((s8 *)spu2regs + ((mmem) & 0x1fff))) -#define spu2Ru16(mmem) (*(u16 *)((s8 *)spu2regs + ((mmem) & 0x1fff))) - -void SysMessage(const char *fmt, ...); - -extern void VoiceStart(int core,int vc); -extern void VoiceStop(int core,int vc); - -extern s32 uTicks; - -extern void (* _irqcallback)(); -extern void (* dma4callback)(); -extern void (* dma7callback)(); - -extern void SetIrqCall(); - -extern double srate_pv; - -extern s16 *input_data; -extern u32 input_data_ptr; - -extern HINSTANCE hInstance; - -extern int PlayMode; -extern int recording; - -extern u32 lClocks; - -extern u32* cPtr; -extern bool hasPtr; - -extern bool disableFreezes; -extern bool resetClock; - -extern void RegLog(int level, char *RName,u32 mem,u32 core,u16 value); -extern void SPU2writeLog(u32 rmem, u16 value); - -extern void __fastcall TimeUpdate(u32 cClocks); -extern u16 SPU_ps1_read(u32 mem); -extern void SPU_ps1_write(u32 mem, u16 value); -extern void SPU2_FastWrite( u32 rmem, u16 value ); - -extern void CoreReset(int c); -extern void StartVoices(int core, u32 value); -extern void StopVoices(int core, u32 value); - -extern s32 DspLoadLibrary(char *fileName, int modNum); -extern void DspCloseLibrary(); -extern int DspProcess(s16 *buffer, int samples); -extern void DspUpdate(); // to let the Dsp process window messages - -extern void RecordStart(); -extern void RecordStop(); -extern void RecordWrite(s16 left, s16 right); - -extern void UpdateSpdifMode(); -extern void LowPassFilterInit(); -extern void InitADSR(); -extern void SndUpdateLimitMode(); - -//#define PCM24_S1_INTERLEAVE - -#endif // SPU2_H_INCLUDED // diff --git a/plugins/spu2ghz/src/spu2replay.cpp b/plugins/spu2ghz/src/spu2replay.cpp deleted file mode 100644 index 51e08e5ed3..0000000000 --- a/plugins/spu2ghz/src/spu2replay.cpp +++ /dev/null @@ -1,196 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include - -#include "spu2.h" - -FILE* s2rfile; - -void s2r_write16(s16 data) -{ - fwrite(&data,2,1,s2rfile); -} - -void s2r_write32(u32 data) -{ - fwrite(&data,4,1,s2rfile); -} - -#define EMITC(i,a) s2r_write32(((u32)(i&0xFF)<<24)|(a&0xFFFFFF)) - -int s2r_open(char *filename) -{ - s2rfile=fopen(filename,"wb"); - return s2rfile?0:-1; -} - -void s2r_readreg(u32 ticks,u32 addr) -{ - if(!s2rfile) return; - s2r_write32(ticks); - EMITC(0,addr); -} - -void s2r_writereg(u32 ticks,u32 addr,s16 value) -{ - if(!s2rfile) return; - s2r_write32(ticks); - EMITC(1,addr); - s2r_write16(value); -} - -void s2r_writedma4(u32 ticks,u16*data,u32 len) -{ - u32 i; - if(!s2rfile) return; - s2r_write32(ticks); - EMITC(2,len); - for(i=0;i>24; - sval&=0xFFFFFF; - - while((ccycle-lasync)>64) - { - lasync+=64; - pcycles=lasync; - pclocks=pcycles*768; - - SPU2async(pclocks); - } - pcycles=ccycle; - pclocks=pcycles*768; - - - switch(evid) - { - case 0: - SPU2read(sval); - break; - case 1: - Cread(&tval,2,1,file); - SPU2write(sval,tval); - break; - case 2: - Cread(dmabuffer,sval,2,file); - SPU2writeDMA4Mem(dmabuffer,sval); - break; - case 3: - Cread(dmabuffer,sval,2,file); - SPU2writeDMA7Mem(dmabuffer,sval); - break; - default: - // not implemented - return; - break; - } - } - - //shutdown - SPU2close(); - SPU2shutdown(); - fclose(file); - - replay_mode=false; -} diff --git a/plugins/spu2ghz/src/spu2replay.h b/plugins/spu2ghz/src/spu2replay.h deleted file mode 100644 index ea6aac62af..0000000000 --- a/plugins/spu2ghz/src/spu2replay.h +++ /dev/null @@ -1,35 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#ifndef SPU2REPLAY_H_INCLUDED -#define SPU2REPLAY_H_INCLUDED - -// s2r dumping -int s2r_open(char *filename); -void s2r_readreg(u32 ticks,u32 addr); -void s2r_writereg(u32 ticks,u32 addr,s16 value); -void s2r_writedma4(u32 ticks,u16*data,u32 len); -void s2r_writedma7(u32 ticks,u16*data,u32 len); -void s2r_close(); - -// s2r playing -void CALLBACK s2r_replay(HWND hwnd, HINSTANCE hinst, LPSTR filename, int nCmdShow); - -extern bool replay_mode; - -#endif//SPU2REPLAY_H_INCLUDED \ No newline at end of file diff --git a/plugins/spu2ghz/src/utf8.cpp b/plugins/spu2ghz/src/utf8.cpp deleted file mode 100644 index 6dd8c2e876..0000000000 --- a/plugins/spu2ghz/src/utf8.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (C) 2001 Peter Harris - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Convert a string between UTF-8 and the locale's charset. - */ - -#include -#include - -#include "utf8.h" - - -#ifdef _WIN32 - - /* Thanks to Peter Harris for this win32 - * code. - */ - -#include -#include - -static unsigned char *make_utf8_string(const wchar_t *unicode) -{ - int size = 0, index = 0, out_index = 0; - unsigned char *out; - unsigned short c; - - /* first calculate the size of the target string */ - c = unicode[index++]; - while(c) { - if(c < 0x0080) { - size += 1; - } else if(c < 0x0800) { - size += 2; - } else { - size += 3; - } - c = unicode[index++]; - } - - out = (unsigned char*)malloc(size + 1); - if (out == NULL) - return NULL; - index = 0; - - c = unicode[index++]; - while(c) - { - if(c < 0x080) { - out[out_index++] = (unsigned char)c; - } else if(c < 0x800) { - out[out_index++] = 0xc0 | (c >> 6); - out[out_index++] = 0x80 | (c & 0x3f); - } else { - out[out_index++] = 0xe0 | (c >> 12); - out[out_index++] = 0x80 | ((c >> 6) & 0x3f); - out[out_index++] = 0x80 | (c & 0x3f); - } - c = unicode[index++]; - } - out[out_index] = 0x00; - - return out; -} - -static wchar_t *make_unicode_string(const unsigned char *utf8) -{ - int size = 0, index = 0, out_index = 0; - wchar_t *out; - unsigned char c; - - /* first calculate the size of the target string */ - c = utf8[index++]; - while(c) { - if((c & 0x80) == 0) { - index += 0; - } else if((c & 0xe0) == 0xe0) { - index += 2; - } else { - index += 1; - } - size += 1; - c = utf8[index++]; - } - - out = (wchar_t*)malloc((size + 1) * sizeof(wchar_t)); - if (out == NULL) - return NULL; - index = 0; - - c = utf8[index++]; - while(c) - { - if((c & 0x80) == 0) { - out[out_index++] = c; - } else if((c & 0xe0) == 0xe0) { - out[out_index] = (c & 0x1F) << 12; - c = utf8[index++]; - out[out_index] |= (c & 0x3F) << 6; - c = utf8[index++]; - out[out_index++] |= (c & 0x3F); - } else { - out[out_index] = (c & 0x3F) << 6; - c = utf8[index++]; - out[out_index++] |= (c & 0x3F); - } - c = utf8[index++]; - } - out[out_index] = 0; - - return out; -} - -int utf8_encode(const char *from, char **to) -{ - wchar_t *unicode; - int wchars, err; - - wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, - strlen(from), NULL, 0); - - if(wchars == 0) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - return -1; - } - - unicode = (wchar_t*)calloc(wchars + 1, sizeof(unsigned short)); - if(unicode == NULL) - { - fprintf(stderr, "Out of memory processing string to UTF8\n"); - return -1; - } - - err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, - strlen(from), unicode, wchars); - if(err != wchars) - { - free(unicode); - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - return -1; - } - - /* On NT-based windows systems, we could use WideCharToMultiByte(), but - * MS doesn't actually have a consistent API across win32. - */ - *to = (char*)make_utf8_string(unicode); - - free(unicode); - return 0; -} - -int utf8_decode(const char *from, char **to) -{ - wchar_t *unicode; - int chars, err; - - /* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but - * MS doesn't actually have a consistent API across win32. - */ - unicode = make_unicode_string((unsigned char*)from); - if(unicode == NULL) - { - fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n"); - return -1; - } - - chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, - -1, NULL, 0, NULL, NULL); - - if(chars == 0) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - free(unicode); - return -1; - } - - *to = (char *)calloc(chars + 1, sizeof(unsigned char)); - if(*to == NULL) - { - fprintf(stderr, "Out of memory processing string to local charset\n"); - free(unicode); - return -1; - } - - err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, - -1, *to, chars, NULL, NULL); - if(err != chars) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - free(unicode); - free(*to); - *to = NULL; - return -1; - } - - free(unicode); - return 0; -} - -#else /* End win32. Rest is for real operating systems */ - - -#ifdef HAVE_LANGINFO_CODESET -#include -#endif - -int iconvert(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen); - -static char *current_charset = 0; /* means "US-ASCII" */ - -void convert_set_charset(const char *charset) -{ - - if (!charset) - charset = getenv("CHARSET"); - -#ifdef HAVE_LANGINFO_CODESET - if (!charset) - charset = nl_langinfo(CODESET); -#endif - - free(current_charset); - current_charset = 0; - if (charset && *charset) - current_charset = strdup(charset); -} - -static int convert_buffer(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen) -{ - int ret = -1; - -#ifdef HAVE_ICONV - ret = iconvert(fromcode, tocode, from, fromlen, to, tolen); - if (ret != -1) - return ret; -#endif - -#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ - ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen); - if (ret != -1) - return ret; -#endif - - return ret; -} - -static int convert_string(const char *fromcode, const char *tocode, - const char *from, char **to, char replace) -{ - int ret; - size_t fromlen; - char *s; - - fromlen = strlen(from); - ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0); - if (ret == -2) - return -1; - if (ret != -1) - return ret; - - s = malloc(fromlen + 1); - if (!s) - return -1; - strcpy(s, from); - *to = s; - for (; *s; s++) - if (*s & ~0x7f) - *s = replace; - return 3; -} - -int utf8_encode(const char *from, char **to) -{ - char *charset; - - if (!current_charset) - convert_set_charset(0); - charset = current_charset ? current_charset : "US-ASCII"; - return convert_string(charset, "UTF-8", from, to, '#'); -} - -int utf8_decode(const char *from, char **to) -{ - char *charset; - - if(*from == 0) { - *to = malloc(1); - **to = 0; - return 1; - } - - if (!current_charset) - convert_set_charset(0); - charset = current_charset ? current_charset : "US-ASCII"; - return convert_string("UTF-8", charset, from, to, '?'); -} - -#endif diff --git a/plugins/spu2ghz/src/utf8.h b/plugins/spu2ghz/src/utf8.h deleted file mode 100644 index f701319bdf..0000000000 --- a/plugins/spu2ghz/src/utf8.h +++ /dev/null @@ -1,36 +0,0 @@ - -/* - * Convert a string between UTF-8 and the locale's charset. - * Invalid bytes are replaced by '#', and characters that are - * not available in the target encoding are replaced by '?'. - * - * If the locale's charset is not set explicitly then it is - * obtained using nl_langinfo(CODESET), where available, the - * environment variable CHARSET, or assumed to be US-ASCII. - * - * Return value of conversion functions: - * - * -1 : memory allocation failed - * 0 : data was converted exactly - * 1 : valid data was converted approximately (using '?') - * 2 : input was invalid (but still converted, using '#') - * 3 : unknown encoding (but still converted, using '?') - */ - -#ifndef __UTF8_H -#define __UTF8_H - -#ifdef __cplusplus -extern "C" { -#endif - -void convert_set_charset(const char *charset); - -int utf8_encode(const char *from, char **to); -int utf8_decode(const char *from, char **to); - -#ifdef __cplusplus -} -#endif - -#endif /* __UTF8_H */ diff --git a/plugins/spu2ghz/src/wavedump_wav.cpp b/plugins/spu2ghz/src/wavedump_wav.cpp deleted file mode 100644 index 59e8680bc2..0000000000 --- a/plugins/spu2ghz/src/wavedump_wav.cpp +++ /dev/null @@ -1,122 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// - -#include -#include - -#include "spu2.h" - -#include "SoundTouch/WavFile.h" - -static WavOutFile* _new_WavOutFile( const char* destfile ) -{ - return new WavOutFile( destfile, 48000, 16, 2 ); -} - -namespace WaveDump -{ - static WavOutFile* m_CoreWav[2][CoreSrc_Count] = { NULL }; - - static const char* m_tbl_CoreOutputTypeNames[CoreSrc_Count] = - { - "Input", - "DryVoiceMix", - "WetVoiceMix", - "PreReverb", - "PostReverb", - "External" - }; - - void Open() - { - if( !WaveLog() ) return; - - char wavfilename[256]; - - for( uint cidx=0; cidx<2; cidx++ ) - { - for( int srcidx=0; srcidx %s.\n\tWave Log for this core source disabled.", ex.what() ); - m_CoreWav[cidx][srcidx] = NULL; - } - } - } - } - - void Close() - { - for( uint cidx=0; cidx<2; cidx++ ) - { - for( int srcidx=0; srcidxwrite( buffer, 2 ); - } - } -} - -WavOutFile* m_wavrecord = NULL; - -void RecordStart() -{ - SAFE_DELETE_OBJ( m_wavrecord ); - - try - { - m_wavrecord = new WavOutFile( "recording.wav", 48000, 16, 2 ); - } - catch( std::runtime_error& ) - { - SysMessage("SPU2ghz couldn't open file for recording: %s.\nRecording to wavfile disabled.", "recording.wav"); - m_wavrecord = NULL; - } -} - -void RecordStop() -{ - SAFE_DELETE_OBJ( m_wavrecord ); -} - -void RecordWrite(s16 left, s16 right) -{ - if( m_wavrecord == NULL ) return; - - s16 buffer[2] = { left, right }; - m_wavrecord->write( buffer, 2 ); -} diff --git a/plugins/spu2ghz/src/waveout.cpp b/plugins/spu2ghz/src/waveout.cpp deleted file mode 100644 index ad315f6db3..0000000000 --- a/plugins/spu2ghz/src/waveout.cpp +++ /dev/null @@ -1,278 +0,0 @@ -//GiGaHeRz's SPU2 Driver -//Copyright (c) 2003-2008, David Quintana -// -//This library is free software; you can redistribute it and/or -//modify it under the terms of the GNU Lesser General Public -//License as published by the Free Software Foundation; either -//version 2.1 of the License, or (at your option) any later version. -// -//This library 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 -//Lesser General Public License for more details. -// -//You should have received a copy of the GNU Lesser General Public -//License along with this library; if not, write to the Free Software -//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -#include "spu2.h" -#include "dialogs.h" -#include - - -class WaveOutModule: public SndOutModule -{ -private: -# define MAX_BUFFER_COUNT 8 - - static const int PacketsPerBuffer = (1024 / SndOutPacketSize); - static const int BufferSize = SndOutPacketSize*PacketsPerBuffer; - static const int BufferSizeBytes = BufferSize << 1; - - u32 numBuffers; - HWAVEOUT hwodevice; - WAVEFORMATEX wformat; - WAVEHDR whbuffer[MAX_BUFFER_COUNT]; - - s16* qbuffer; - - #define QBUFFER(x) (qbuffer + BufferSize * (x)) - - bool waveout_running; - HANDLE thread; - DWORD tid; - - SndBuffer *buff; - - FILE *voicelog; - - char ErrText[256]; - - static DWORD CALLBACK RThread(WaveOutModule*obj) - { - return obj->Thread(); - } - - DWORD CALLBACK Thread() - { - while( waveout_running ) - { - bool didsomething = false; - for(u32 i=0;idwBytesRecorded = buf->dwBufferLength; - - s16 *t = (s16*)buf->lpData; - for(int p=0; pReadSamples( t ); - - whbuffer[i].dwFlags&=~WHDR_DONE; - waveOutWrite(hwodevice,buf,sizeof(WAVEHDR)); - didsomething = true; - } - - if( didsomething ) - Sleep(1); - else - Sleep(0); - } - return 0; - } - -public: - s32 Init(SndBuffer *sb) - { - buff = sb; - numBuffers = Config_WaveOut.NumBuffers; - - MMRESULT woores; - - if (Test()) return -1; - - wformat.wFormatTag=WAVE_FORMAT_PCM; - wformat.nSamplesPerSec=SampleRate; - wformat.wBitsPerSample=16; - wformat.nChannels=2; - wformat.nBlockAlign=((wformat.wBitsPerSample * wformat.nChannels) / 8); - wformat.nAvgBytesPerSec=(wformat.nSamplesPerSec * wformat.nBlockAlign); - wformat.cbSize=0; - - qbuffer=new s16[BufferSize*numBuffers]; - - woores = waveOutOpen(&hwodevice,WAVE_MAPPER,&wformat,0,0,0); - if (woores != MMSYSERR_NOERROR) - { - waveOutGetErrorText(woores,(char *)&ErrText,255); - SysMessage("WaveOut Error: %s",ErrText); - return -1; - } - - for(u32 i=0;i MAX_BUFFER_COUNT ) Config_WaveOut.NumBuffers = MAX_BUFFER_COUNT; - } - EndDialog(hWnd,0); - break; - case IDCANCEL: - EndDialog(hWnd,0); - break; - default: - return FALSE; - } - break; - - case WM_HSCROLL: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - switch(wmId) { - //case TB_ENDTRACK: - //case TB_THUMBPOSITION: - case TB_LINEUP: - case TB_LINEDOWN: - case TB_PAGEUP: - case TB_PAGEDOWN: - wmEvent=(int)SendMessage((HWND)lParam,TBM_GETPOS,0,0); - case TB_THUMBTRACK: - if( wmEvent < 3 ) wmEvent = 3; - if( wmEvent > MAX_BUFFER_COUNT ) wmEvent = MAX_BUFFER_COUNT; - SendMessage((HWND)lParam,TBM_SETPOS,TRUE,wmEvent); - sprintf_s(temp,128,"%d (%d ms latency)",wmEvent, 1000 / (96000 / (wmEvent * BufferSize))); - SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp); - break; - default: - return FALSE; - } - break; - - default: - return FALSE; - } - return TRUE; - } - -public: - virtual void Configure(HWND parent) - { - INT_PTR ret; - ret=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_WAVEOUT),GetActiveWindow(),(DLGPROC)ConfigProc,1); - if(ret==-1) - { - MessageBoxEx(GetActiveWindow(),"Error Opening the config dialog.","OMG ERROR!",MB_OK,0); - return; - } - } - - virtual bool Is51Out() const { return false; } - - s32 Test() const - { - if (waveOutGetNumDevs() == 0) { - SysMessage("No waveOut Devices Present\n"); return -1; - } - return 0; - } - - int GetEmptySampleCount() const - { - int result = 0; - for(int i=0;i + + + + + + diff --git a/plugins/xpad/vsprops/common.vsprops b/plugins/xpad/vsprops/common.vsprops index 5b34339bc0..6d4b6a7665 100644 --- a/plugins/xpad/vsprops/common.vsprops +++ b/plugins/xpad/vsprops/common.vsprops @@ -25,15 +25,4 @@ SubSystem="2" RandomizedBaseAddress="1" /> - - - diff --git a/plugins/xpad/vsprops/postBuild.tmpl b/plugins/xpad/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/xpad/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/xpad/vsprops/postBuild.unknown b/plugins/xpad/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/xpad/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/xpad/vsprops/preBuild.cmd b/plugins/xpad/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/xpad/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/xpad/vsprops/svnrev_template.h b/plugins/xpad/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/xpad/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/xpad/vsprops/svnrev_unknown.h b/plugins/xpad/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/xpad/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/xpad/xpad_vs2008.vcproj b/plugins/xpad/xpad_vs2008.vcproj index 776406600b..d44d4c5f32 100644 --- a/plugins/xpad/xpad_vs2008.vcproj +++ b/plugins/xpad/xpad_vs2008.vcproj @@ -22,7 +22,7 @@ @@ -86,7 +86,7 @@ @@ -150,7 +150,7 @@ @@ -344,7 +344,7 @@ @@ -727,7 +727,7 @@ @@ -789,7 +789,7 @@ @@ -853,7 +853,7 @@ @@ -916,7 +916,7 @@ -#include "GS.h" #include "Win32.h" extern HINSTANCE hInst; diff --git a/plugins/zerogs/dx/Win32/Win32.cpp b/plugins/zerogs/dx/Win32/Win32.cpp index 4da563ba5a..baf04cc105 100644 --- a/plugins/zerogs/dx/Win32/Win32.cpp +++ b/plugins/zerogs/dx/Win32/Win32.cpp @@ -9,7 +9,6 @@ #include "resrc1.h" -#include "GS.h" #include "Win32.h" #include @@ -37,8 +36,6 @@ void CALLBACK GSkeyEvent(keyEvent *ev) { // } } -#include "Win32/resource.h" - BOOL CALLBACK LoggingDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: diff --git a/plugins/zerogs/dx/Win32/Win32.h b/plugins/zerogs/dx/Win32/Win32.h index acea999c8b..01a622f256 100644 --- a/plugins/zerogs/dx/Win32/Win32.h +++ b/plugins/zerogs/dx/Win32/Win32.h @@ -1,8 +1,10 @@ #ifndef __WIN32_H__ #define __WIN32_H__ +#include "../GS.h" + #include "resrc1.h" -#include "Win32/resource.h" +#include "resource.h" BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/zerogs/dx/Win32/pcsxrootdir.vsprops b/plugins/zerogs/dx/Win32/pcsxrootdir.vsprops new file mode 100644 index 0000000000..6e92d0482d --- /dev/null +++ b/plugins/zerogs/dx/Win32/pcsxrootdir.vsprops @@ -0,0 +1,19 @@ + + + + + + diff --git a/plugins/zerogs/dx/Win32/vsprops/pcsx2_plugin_common.vsprops b/plugins/zerogs/dx/Win32/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/zerogs/dx/Win32/vsprops/postBuild.tmpl b/plugins/zerogs/dx/Win32/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/zerogs/dx/Win32/vsprops/postBuild.unknown b/plugins/zerogs/dx/Win32/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/zerogs/dx/Win32/vsprops/preBuild.cmd b/plugins/zerogs/dx/Win32/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/zerogs/dx/Win32/vsprops/svnrev_template.h b/plugins/zerogs/dx/Win32/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/zerogs/dx/Win32/vsprops/svnrev_unknown.h b/plugins/zerogs/dx/Win32/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/zerogs/dx/Win32/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/zerogs/dx/Win32/zerogs_2008.vcproj b/plugins/zerogs/dx/Win32/zerogs_2008.vcproj index d93497716f..586f9aa94e 100644 --- a/plugins/zerogs/dx/Win32/zerogs_2008.vcproj +++ b/plugins/zerogs/dx/Win32/zerogs_2008.vcproj @@ -18,7 +18,7 @@ + + + diff --git a/plugins/zeropad/Windows/ZeroPAD_2008.vcproj b/plugins/zeropad/Windows/ZeroPAD_2008.vcproj index 52c83cee96..f74b0dd16b 100644 --- a/plugins/zeropad/Windows/ZeroPAD_2008.vcproj +++ b/plugins/zeropad/Windows/ZeroPAD_2008.vcproj @@ -19,7 +19,7 @@ @@ -123,12 +119,10 @@ InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" - AdditionalIncludeDirectories="libs" PreprocessorDefinitions="NDEBUG;_USRDLL;ZEROPAD_EXPORTS" - RuntimeLibrary="2" + RuntimeLibrary="0" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> + + + + + + + + + + + + + + + + + + + = 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#ifdef _UWIN -# define HAVE_STRUCT_TIMESPEC 1 -# define HAVE_SIGNAL_H 1 -# undef HAVE_CONFIG_H -# pragma comment(lib, "pthread") -#endif - -/* - * ------------------------------------------------------------- - * - * - * Module: pthread.h - * - * Purpose: - * Provides an implementation of PThreads based upon the - * standard: - * - * POSIX 1003.1-2001 - * and - * The Single Unix Specification version 3 - * - * (these two are equivalent) - * - * in order to enhance code portability between Windows, - * various commercial Unix implementations, and Linux. - * - * See the ANNOUNCE file for a full list of conforming - * routines and defined constants, and a list of missing - * routines and constants not defined in this implementation. - * - * Authors: - * There have been many contributors to this library. - * The initial implementation was contributed by - * John Bossom, and several others have provided major - * sections or revisions of parts of the implementation. - * Often significant effort has been contributed to - * find and fix important bugs and other problems to - * improve the reliability of the library, which sometimes - * is not reflected in the amount of code which changed as - * result. - * As much as possible, the contributors are acknowledged - * in the ChangeLog file in the source code distribution - * where their changes are noted in detail. - * - * Contributors are listed in the CONTRIBUTORS file. - * - * As usual, all bouquets go to the contributors, and all - * brickbats go to the project maintainer. - * - * Maintainer: - * The code base for this project is coordinated and - * eventually pre-tested, packaged, and made available by - * - * Ross Johnson - * - * QA Testers: - * Ultimately, the library is tested in the real world by - * a host of competent and demanding scientists and - * engineers who report bugs and/or provide solutions - * which are then fixed or incorporated into subsequent - * versions of the library. Each time a bug is fixed, a - * test case is written to prove the fix and ensure - * that later changes to the code don't reintroduce the - * same error. The number of test cases is slowly growing - * and therefore so is the code reliability. - * - * Compliance: - * See the file ANNOUNCE for the list of implemented - * and not-implemented routines and defined options. - * Of course, these are all defined is this file as well. - * - * Web site: - * The source code and other information about this library - * are available from - * - * http://sources.redhat.com/pthreads-win32/ - * - * ------------------------------------------------------------- - */ - -/* Try to avoid including windows.h */ -#if defined(__MINGW32__) && defined(__cplusplus) -#define PTW32_INCLUDE_WINDOWS_H -#endif - -#ifdef PTW32_INCLUDE_WINDOWS_H -#include -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) -/* - * VC++6.0 or early compiler's header has no DWORD_PTR type. - */ -typedef unsigned long DWORD_PTR; -#endif -/* - * ----------------- - * autoconf switches - * ----------------- - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifndef NEED_FTIME -#include -#else /* NEED_FTIME */ -/* use native WIN32 time API */ -#endif /* NEED_FTIME */ - -#if HAVE_SIGNAL_H -#include -#endif /* HAVE_SIGNAL_H */ - -#include -#include - -/* - * Boolean values to make us independent of system includes. - */ -enum { - PTW32_FALSE = 0, - PTW32_TRUE = (! PTW32_FALSE) -}; - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Several systems don't define some error numbers. - */ -#ifndef ENOTSUP -# define ENOTSUP 48 /* This is the value in Solaris. */ -#endif - -#ifndef ETIMEDOUT -# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ -#endif - -#ifndef ENOSYS -# define ENOSYS 140 /* Semi-arbitrary value */ -#endif - -#ifndef EDEADLK -# ifdef EDEADLOCK -# define EDEADLK EDEADLOCK -# else -# define EDEADLK 36 /* This is the value in MSVC. */ -# endif -#endif - -#include - -/* - * To avoid including windows.h we define only those things that we - * actually need from it. - */ -#ifndef PTW32_INCLUDE_WINDOWS_H -#ifndef HANDLE -# define PTW32__HANDLE_DEF -# define HANDLE void * -#endif -#ifndef DWORD -# define PTW32__DWORD_DEF -# define DWORD unsigned long -#endif -#endif - -#ifndef HAVE_STRUCT_TIMESPEC -#define HAVE_STRUCT_TIMESPEC 1 -struct timespec { - long tv_sec; - long tv_nsec; -}; -#endif /* HAVE_STRUCT_TIMESPEC */ - -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 -#endif /* SIG_BLOCK */ - -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 -#endif /* SIG_UNBLOCK */ - -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 -#endif /* SIG_SETMASK */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * ------------------------------------------------------------- - * - * POSIX 1003.1-2001 Options - * ========================= - * - * Options are normally set in , which is not provided - * with pthreads-win32. - * - * For conformance with the Single Unix Specification (version 3), all of the - * options below are defined, and have a value of either -1 (not supported) - * or 200112L (supported). - * - * These options can neither be left undefined nor have a value of 0, because - * either indicates that sysconf(), which is not implemented, may be used at - * runtime to check the status of the option. - * - * _POSIX_THREADS (== 200112L) - * If == 200112L, you can use threads - * - * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) - * If == 200112L, you can control the size of a thread's - * stack - * pthread_attr_getstacksize - * pthread_attr_setstacksize - * - * _POSIX_THREAD_ATTR_STACKADDR (== -1) - * If == 200112L, you can allocate and control a thread's - * stack. If not supported, the following functions - * will return ENOSYS, indicating they are not - * supported: - * pthread_attr_getstackaddr - * pthread_attr_setstackaddr - * - * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) - * If == 200112L, you can use realtime scheduling. - * This option indicates that the behaviour of some - * implemented functions conforms to the additional TPS - * requirements in the standard. E.g. rwlocks favour - * writers over readers when threads have equal priority. - * - * _POSIX_THREAD_PRIO_INHERIT (== -1) - * If == 200112L, you can create priority inheritance - * mutexes. - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PRIO_PROTECT (== -1) - * If == 200112L, you can create priority ceiling mutexes - * Indicates the availability of: - * pthread_mutex_getprioceiling - * pthread_mutex_setprioceiling - * pthread_mutexattr_getprioceiling - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprioceiling - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PROCESS_SHARED (== -1) - * If set, you can create mutexes and condition - * variables that can be shared with another - * process.If set, indicates the availability - * of: - * pthread_mutexattr_getpshared - * pthread_mutexattr_setpshared - * pthread_condattr_getpshared - * pthread_condattr_setpshared - * - * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) - * If == 200112L you can use the special *_r library - * functions that provide thread-safe behaviour - * - * _POSIX_READER_WRITER_LOCKS (== 200112L) - * If == 200112L, you can use read/write locks - * - * _POSIX_SPIN_LOCKS (== 200112L) - * If == 200112L, you can use spin locks - * - * _POSIX_BARRIERS (== 200112L) - * If == 200112L, you can use barriers - * - * + These functions provide both 'inherit' and/or - * 'protect' protocol, based upon these macro - * settings. - * - * ------------------------------------------------------------- - */ - -/* - * POSIX Options - */ -#undef _POSIX_THREADS -#define _POSIX_THREADS 200112L - -#undef _POSIX_READER_WRITER_LOCKS -#define _POSIX_READER_WRITER_LOCKS 200112L - -#undef _POSIX_SPIN_LOCKS -#define _POSIX_SPIN_LOCKS 200112L - -#undef _POSIX_BARRIERS -#define _POSIX_BARRIERS 200112L - -#undef _POSIX_THREAD_SAFE_FUNCTIONS -#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L - -#undef _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_ATTR_STACKSIZE 200112L - -/* - * The following options are not supported - */ -#undef _POSIX_THREAD_ATTR_STACKADDR -#define _POSIX_THREAD_ATTR_STACKADDR -1 - -#undef _POSIX_THREAD_PRIO_INHERIT -#define _POSIX_THREAD_PRIO_INHERIT -1 - -#undef _POSIX_THREAD_PRIO_PROTECT -#define _POSIX_THREAD_PRIO_PROTECT -1 - -/* TPS is not fully supported. */ -#undef _POSIX_THREAD_PRIORITY_SCHEDULING -#define _POSIX_THREAD_PRIORITY_SCHEDULING -1 - -#undef _POSIX_THREAD_PROCESS_SHARED -#define _POSIX_THREAD_PROCESS_SHARED -1 - - -/* - * POSIX 1003.1-2001 Limits - * =========================== - * - * These limits are normally set in , which is not provided with - * pthreads-win32. - * - * PTHREAD_DESTRUCTOR_ITERATIONS - * Maximum number of attempts to destroy - * a thread's thread-specific data on - * termination (must be at least 4) - * - * PTHREAD_KEYS_MAX - * Maximum number of thread-specific data keys - * available per process (must be at least 128) - * - * PTHREAD_STACK_MIN - * Minimum supported stack size for a thread - * - * PTHREAD_THREADS_MAX - * Maximum number of threads supported per - * process (must be at least 64). - * - * SEM_NSEMS_MAX - * The maximum number of semaphores a process can have. - * (must be at least 256) - * - * SEM_VALUE_MAX - * The maximum value a semaphore can have. - * (must be at least 32767) - * - */ -#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 - -#undef PTHREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -#undef _POSIX_THREAD_KEYS_MAX -#define _POSIX_THREAD_KEYS_MAX 128 - -#undef PTHREAD_KEYS_MAX -#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX - -#undef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 0 - -#undef _POSIX_THREAD_THREADS_MAX -#define _POSIX_THREAD_THREADS_MAX 64 - - /* Arbitrary value */ -#undef PTHREAD_THREADS_MAX -#define PTHREAD_THREADS_MAX 2019 - -#undef _POSIX_SEM_NSEMS_MAX -#define _POSIX_SEM_NSEMS_MAX 256 - - /* Arbitrary value */ -#undef SEM_NSEMS_MAX -#define SEM_NSEMS_MAX 1024 - -#undef _POSIX_SEM_VALUE_MAX -#define _POSIX_SEM_VALUE_MAX 32767 - -#undef SEM_VALUE_MAX -#define SEM_VALUE_MAX INT_MAX - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * The Open Watcom C/C++ compiler uses a non-standard calling convention - * that passes function args in registers unless __cdecl is explicitly specified - * in exposed function prototypes. - * - * We force all calls to cdecl even though this could slow Watcom code down - * slightly. If you know that the Watcom compiler will be used to build both - * the DLL and application, then you can probably define this as a null string. - * Remember that pthread.h (this file) is used for both the DLL and application builds. - */ -#define PTW32_CDECL __cdecl - -#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX -# include -#else -/* - * Generic handle type - intended to extend uniqueness beyond - * that available with a simple pointer. It should scale for either - * IA-32 or IA-64. - */ -typedef struct { - void * p; /* Pointer to actual object */ - unsigned int x; /* Extra information - reuse count etc */ -} ptw32_handle_t; - -typedef ptw32_handle_t pthread_t; -typedef struct pthread_attr_t_ * pthread_attr_t; -typedef struct pthread_once_t_ pthread_once_t; -typedef struct pthread_key_t_ * pthread_key_t; -typedef struct pthread_mutex_t_ * pthread_mutex_t; -typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; -typedef struct pthread_cond_t_ * pthread_cond_t; -typedef struct pthread_condattr_t_ * pthread_condattr_t; -#endif -typedef struct pthread_rwlock_t_ * pthread_rwlock_t; -typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; -typedef struct pthread_spinlock_t_ * pthread_spinlock_t; -typedef struct pthread_barrier_t_ * pthread_barrier_t; -typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; - -/* - * ==================== - * ==================== - * POSIX Threads - * ==================== - * ==================== - */ - -enum { -/* - * pthread_attr_{get,set}detachstate - */ - PTHREAD_CREATE_JOINABLE = 0, /* Default */ - PTHREAD_CREATE_DETACHED = 1, - -/* - * pthread_attr_{get,set}inheritsched - */ - PTHREAD_INHERIT_SCHED = 0, - PTHREAD_EXPLICIT_SCHED = 1, /* Default */ - -/* - * pthread_{get,set}scope - */ - PTHREAD_SCOPE_PROCESS = 0, - PTHREAD_SCOPE_SYSTEM = 1, /* Default */ - -/* - * pthread_setcancelstate paramters - */ - PTHREAD_CANCEL_ENABLE = 0, /* Default */ - PTHREAD_CANCEL_DISABLE = 1, - -/* - * pthread_setcanceltype parameters - */ - PTHREAD_CANCEL_ASYNCHRONOUS = 0, - PTHREAD_CANCEL_DEFERRED = 1, /* Default */ - -/* - * pthread_mutexattr_{get,set}pshared - * pthread_condattr_{get,set}pshared - */ - PTHREAD_PROCESS_PRIVATE = 0, - PTHREAD_PROCESS_SHARED = 1, - -/* - * pthread_barrier_wait - */ - PTHREAD_BARRIER_SERIAL_THREAD = -1 -}; - -/* - * ==================== - * ==================== - * Cancelation - * ==================== - * ==================== - */ -#define PTHREAD_CANCELED ((void *) -1) - - -/* - * ==================== - * ==================== - * Once Key - * ==================== - * ==================== - */ -#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} - -struct pthread_once_t_ -{ - int done; /* indicates if user function has been executed */ - void * lock; - int reserved1; - int reserved2; -}; - - -/* - * ==================== - * ==================== - * Object initialisers - * ==================== - * ==================== - */ -#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1) -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2) -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3) - -/* - * Compatibility with LinuxThreads - */ -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER - -#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1) - -#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1) - -#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1) - - -/* - * Mutex types. - */ -enum -{ - /* Compatibility with LinuxThreads */ - PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, - /* For compatibility with POSIX */ - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -}; - - -typedef struct ptw32_cleanup_t ptw32_cleanup_t; - -#if defined(_MSC_VER) -/* Disable MSVC 'anachronism used' warning */ -#pragma warning( disable : 4229 ) -#endif - -typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); - -#if defined(_MSC_VER) -#pragma warning( default : 4229 ) -#endif - -struct ptw32_cleanup_t -{ - ptw32_cleanup_callback_t routine; - void *arg; - struct ptw32_cleanup_t *prev; -}; - -#ifdef __CLEANUP_SEH - /* - * WIN32 SEH version of cancel cleanup. - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ - _cleanup.arg = (_arg); \ - __try \ - { \ - -#define pthread_cleanup_pop( _execute ) \ - } \ - __finally \ - { \ - if( _execute || AbnormalTermination()) \ - { \ - (*(_cleanup.routine))( _cleanup.arg ); \ - } \ - } \ - } - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - /* - * C implementation of PThreads cancel cleanup - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ - -#define pthread_cleanup_pop( _execute ) \ - (void) ptw32_pop_cleanup( _execute ); \ - } - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - /* - * C++ version of cancel cleanup. - * - John E. Bossom. - */ - - class PThreadCleanup { - /* - * PThreadCleanup - * - * Purpose - * This class is a C++ helper class that is - * used to implement pthread_cleanup_push/ - * pthread_cleanup_pop. - * The destructor of this class automatically - * pops the pushed cleanup routine regardless - * of how the code exits the scope - * (i.e. such as by an exception) - */ - ptw32_cleanup_callback_t cleanUpRout; - void * obj; - int executeIt; - - public: - PThreadCleanup() : - cleanUpRout( 0 ), - obj( 0 ), - executeIt( 0 ) - /* - * No cleanup performed - */ - { - } - - PThreadCleanup( - ptw32_cleanup_callback_t routine, - void * arg ) : - cleanUpRout( routine ), - obj( arg ), - executeIt( 1 ) - /* - * Registers a cleanup routine for 'arg' - */ - { - } - - ~PThreadCleanup() - { - if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) - { - (void) (*cleanUpRout)( obj ); - } - } - - void execute( int exec ) - { - executeIt = exec; - } - }; - - /* - * C++ implementation of PThreads cancel cleanup; - * This implementation takes advantage of a helper - * class who's destructor automatically calls the - * cleanup routine if we exit our scope weirdly - */ -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ - (void *) (_arg) ); - -#define pthread_cleanup_pop( _execute ) \ - cleanup.execute( _execute ); \ - } - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ - -#endif /* __CLEANUP_C */ - -#endif /* __CLEANUP_SEH */ - -/* - * =============== - * =============== - * Methods - * =============== - * =============== - */ - -/* - * PThread Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, - void **stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, - size_t * stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, - int detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, - void *stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, - size_t stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *, - int *); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, - int inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr, - int * inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, - int *); - -/* - * PThread Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, - const pthread_attr_t * attr, - void *(*start) (void *), - void *arg); - -PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); - -PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, - pthread_t t2); - -PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); - -PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, - void **value_ptr); - -PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, - int *oldstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, - int *oldtype); - -PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, - void (*init_routine) (void)); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); - -PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, - void (*routine) (void *), - void *arg); -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread Specific Data Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, - void (*destructor) (void *)); - -PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); - -PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, - const void *value); - -PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); - - -/* - * Mutex Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, - int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind); - -/* - * Barrier Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, - int pshared); - -/* - * Mutex Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, - const pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); - -/* - * Spinlock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); - -/* - * Barrier Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, - unsigned int count); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); - -/* - * Condition Variable Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, - int pshared); - -/* - * Condition Variable Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, - const pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, - pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); - -/* - * Scheduling - */ -PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, - int policy, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, - int *policy, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); - -PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); - -/* - * Read-Write Lock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, - const pthread_rwlockattr_t *attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, - int pshared); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 - -/* - * Signal Functions. Should be defined in but MSVC and MinGW32 - * already have signal.h that don't define these. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); - -/* - * Non-portable functions - */ - -/* - * Compatibility with Linux. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, - int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, - int *kind); - -/* - * Possibly supported by other POSIX threads implementations - */ -PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); -PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); - -/* - * Useful if an application wants to statically link - * the lib rather than load the DLL at run-time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); - -/* - * Features that are auto-detected at load/run time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); -enum ptw32_features { - PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ - PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ -}; - -/* - * Register a system time change with the library. - * Causes the library to perform various functions - * in response to the change. Should be called whenever - * the application's top level window receives a - * WM_TIMECHANGE message. It can be passed directly to - * pthread_create() as a new thread if desired. - */ -PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); - -#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* - * Returns the Win32 HANDLE for the POSIX thread. - */ -PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); - - -/* - * Protected Methods - * - * This function blocks until the given WIN32 handle - * is signaled or pthread_cancel had been called. - * This function allows the caller to hook into the - * PThreads cancel mechanism. It is implemented using - * - * WaitForMultipleObjects - * - * on 'waitHandle' and a manually reset WIN32 Event - * used to implement pthread_cancel. The 'timeout' - * argument to TimedWait is simply passed to - * WaitForMultipleObjects. - */ -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, - DWORD timeout); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread-Safe C Runtime Library Mappings. - */ -#ifndef _UWIN -# if defined(NEED_ERRNO) - PTW32_DLLPORT int * PTW32_CDECL _errno( void ); -# else -# ifndef errno -# if (defined(_MT) || defined(_DLL)) - __declspec(dllimport) extern int * __cdecl _errno(void); -# define errno (*_errno()) -# endif -# endif -# endif -#endif - -/* - * WIN32 C runtime library had been made thread-safe - * without affecting the user interface. Provide - * mappings from the UNIX thread-safe versions to - * the standard C runtime library calls. - * Only provide function mappings for functions that - * actually exist on WIN32. - */ - -#if !defined(__MINGW32__) -#define strtok_r( _s, _sep, _lasts ) \ - ( *(_lasts) = strtok( (_s), (_sep) ) ) -#endif /* !__MINGW32__ */ - -#define asctime_r( _tm, _buf ) \ - ( strcpy( (_buf), asctime( (_tm) ) ), \ - (_buf) ) - -#define ctime_r( _clock, _buf ) \ - ( strcpy( (_buf), ctime( (_clock) ) ), \ - (_buf) ) - -#define gmtime_r( _clock, _result ) \ - ( *(_result) = *gmtime( (_clock) ), \ - (_result) ) - -#define localtime_r( _clock, _result ) \ - ( *(_result) = *localtime( (_clock) ), \ - (_result) ) - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - - -/* - * Some compiler environments don't define some things. - */ -#if defined(__BORLANDC__) -# define _ftime ftime -# define _timeb timeb -#endif - -#ifdef __cplusplus - -/* - * Internal exceptions - */ -class ptw32_exception {}; -class ptw32_exception_cancel : public ptw32_exception {}; -class ptw32_exception_exit : public ptw32_exception {}; - -#endif - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* FIXME: This is only required if the library was built using SEH */ -/* - * Get internal SEH tag - */ -PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#ifndef PTW32_BUILD - -#ifdef __CLEANUP_SEH - -/* - * Redefine the SEH __except keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#define __except( E ) \ - __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ - ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) - -#endif /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_CXX - -/* - * Redefine the C++ catch keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#ifdef _MSC_VER - /* - * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' - * if you want Pthread-Win32 cancelation and pthread_exit to work. - */ - -#ifndef PtW32NoCatchWarn - -#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") -#pragma message("------------------------------------------------------------------") -#pragma message("When compiling applications with MSVC++ and C++ exception handling:") -#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") -#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") -#pragma message(" cancelation and pthread_exit to work. For example:") -#pragma message("") -#pragma message(" #ifdef PtW32CatchAll") -#pragma message(" PtW32CatchAll") -#pragma message(" #else") -#pragma message(" catch(...)") -#pragma message(" #endif") -#pragma message(" {") -#pragma message(" /* Catchall block processing */") -#pragma message(" }") -#pragma message("------------------------------------------------------------------") - -#endif - -#define PtW32CatchAll \ - catch( ptw32_exception & ) { throw; } \ - catch( ... ) - -#else /* _MSC_VER */ - -#define catch( E ) \ - catch( ptw32_exception & ) { throw; } \ - catch( E ) - -#endif /* _MSC_VER */ - -#endif /* __CLEANUP_CXX */ - -#endif /* ! PTW32_BUILD */ - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#ifdef PTW32__HANDLE_DEF -# undef HANDLE -#endif -#ifdef PTW32__DWORD_DEF -# undef DWORD -#endif - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* ! RC_INVOKED */ - -#endif /* PTHREAD_H */ diff --git a/plugins/zeropad/Windows/libs/pthreadVC2.lib b/plugins/zeropad/Windows/libs/pthreadVC2.lib deleted file mode 100644 index b447a8b71e..0000000000 Binary files a/plugins/zeropad/Windows/libs/pthreadVC2.lib and /dev/null differ diff --git a/plugins/zeropad/Windows/libs/sched.h b/plugins/zeropad/Windows/libs/sched.h deleted file mode 100644 index dfb8e934af..0000000000 --- a/plugins/zeropad/Windows/libs/sched.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Module: sched.h - * - * Purpose: - * Provides an implementation of POSIX realtime extensions - * as defined in - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#ifndef _SCHED_H -#define _SCHED_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#if defined(__MINGW32__) || defined(_UWIN) -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -/* For pid_t */ -# include -/* Required by Unix 98 */ -# include -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ -#else -typedef int pid_t; -#endif - -/* Thread scheduling policies */ - -enum { - SCHED_OTHER = 0, - SCHED_FIFO, - SCHED_RR, - SCHED_MIN = SCHED_OTHER, - SCHED_MAX = SCHED_RR -}; - -struct sched_param { - int sched_priority; -}; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -PTW32_DLLPORT int __cdecl sched_yield (void); - -PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); - -PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); - -PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); - -PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); - -/* - * Note that this macro returns ENOTSUP rather than - * ENOSYS as might be expected. However, returning ENOSYS - * should mean that sched_get_priority_{min,max} are - * not implemented as well as sched_rr_get_interval. - * This is not the case, since we just don't support - * round-robin scheduling. Therefore I have chosen to - * return the same value as sched_setscheduler when - * SCHED_RR is passed to it. - */ -#define sched_rr_get_interval(_pid, _interval) \ - ( errno = ENOTSUP, (int) -1 ) - - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !_SCHED_H */ - diff --git a/plugins/zeropad/Windows/libs/semaphore.h b/plugins/zeropad/Windows/libs/semaphore.h deleted file mode 100644 index a3330a6388..0000000000 --- a/plugins/zeropad/Windows/libs/semaphore.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Module: semaphore.h - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#if !defined( SEMAPHORE_H ) -#define SEMAPHORE_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#define _POSIX_SEMAPHORES - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifndef HAVE_MODE_T -typedef unsigned int mode_t; -#endif - - -typedef struct sem_t_ * sem_t; - -PTW32_DLLPORT int __cdecl sem_init (sem_t * sem, - int pshared, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem, - const struct timespec * abstime); - -PTW32_DLLPORT int __cdecl sem_post (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem, - int count); - -PTW32_DLLPORT int __cdecl sem_open (const char * name, - int oflag, - mode_t mode, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_close (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_unlink (const char * name); - -PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem, - int * sval); - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !SEMAPHORE_H */ diff --git a/plugins/zeropad/Windows/vsprops/pcsx2_plugin_common.vsprops b/plugins/zeropad/Windows/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/zeropad/Windows/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/zeropad/Windows/vsprops/postBuild.tmpl b/plugins/zeropad/Windows/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/zeropad/Windows/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/zeropad/Windows/vsprops/postBuild.unknown b/plugins/zeropad/Windows/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/zeropad/Windows/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/zeropad/Windows/vsprops/preBuild.cmd b/plugins/zeropad/Windows/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/zeropad/Windows/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/zeropad/Windows/vsprops/svnrev_template.h b/plugins/zeropad/Windows/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/zeropad/Windows/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/zeropad/Windows/vsprops/svnrev_unknown.h b/plugins/zeropad/Windows/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/zeropad/Windows/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/zeropad/common/PS2Edefs.h b/plugins/zeropad/common/PS2Edefs.h deleted file mode 100644 index 49b16e16d5..0000000000 --- a/plugins/zeropad/common/PS2Edefs.h +++ /dev/null @@ -1,885 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/zeropad/common/PS2Etypes.h b/plugins/zeropad/common/PS2Etypes.h deleted file mode 100644 index 4c62b47f0f..0000000000 --- a/plugins/zeropad/common/PS2Etypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifdef __LINUX__ -#define CALLBACK -#else -#define CALLBACK __stdcall -#endif - - -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x - -#define __naked __declspec(naked) - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -#define PCSX2_ALIGNED16_DECL(x) x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */ diff --git a/plugins/zerospu2/3rdparty/SoundTouch/3dnow_win.cpp b/plugins/zerospu2/3rdparty/SoundTouch/3dnow_win.cpp deleted file mode 100644 index 01e6dab8a7..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/3dnow_win.cpp +++ /dev/null @@ -1,350 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Win32 version of the AMD 3DNow! optimized routines for AMD K6-2/Athlon -/// processors. All 3DNow! optimized functions have been gathered into this -/// single source code file, regardless to their class or original source code -/// file, in order to ease porting the library to other compiler and processor -/// platforms. -/// -/// By the way; the performance gain depends heavily on the CPU generation: On -/// K6-2 these routines provided speed-up of even 2.4 times, while on Athlon the -/// difference to the original routines stayed at unremarkable 8%! Such a small -/// improvement on Athlon is due to 3DNow can perform only two operations in -/// parallel, and obviously also the Athlon FPU is doing a very good job with -/// the standard C floating point routines! Here these routines are anyway, -/// although it might not be worth the effort to convert these to GCC platform, -/// for Athlon CPU at least. The situation is different regarding the SSE -/// optimizations though, thanks to the four parallel operations of SSE that -/// already make a difference. -/// -/// This file is to be compiled in Windows platform with Microsoft Visual C++ -/// Compiler. Please see '3dnow_gcc.cpp' for the gcc compiler version for all -/// GNU platforms (if file supplied). -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support 3DNow! instruction set. The update is -/// available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and -/// perform a search with keywords "processor pack". -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: 3dnow_win.cpp,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" -#include "STTypes.h" - -#ifndef _WIN32 -#error "wrong platform - this source code file is exclusively for Win32 platform" -#endif - -using namespace soundtouch; - -#ifdef ALLOW_3DNOW -// 3DNow! routines available only with float sample type - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of 3DNow! optimized functions of class 'TDStretch3DNow' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include - -// these are declared in 'TDStretch.cpp' -extern int scanOffsets[4][24]; - - -// Calculates cross correlation of two buffers -double TDStretch3DNow::calcCrossCorrStereo(const float *pV1, const float *pV2) const -{ - uint overlapLengthLocal = overlapLength; - float corr; - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - /* - c-pseudocode: - - corr = 0; - for (i = 0; i < overlapLength / 4; i ++) - { - corr += pV1[0] * pV2[0]; - pV1[1] * pV2[1]; - pV1[2] * pV2[2]; - pV1[3] * pV2[3]; - pV1[4] * pV2[4]; - pV1[5] * pV2[5]; - pV1[6] * pV2[6]; - pV1[7] * pV2[7]; - - pV1 += 8; - pV2 += 8; - } - */ - - _asm - { - // give prefetch hints to CPU of what data are to be needed soonish. - // give more aggressive hints on pV1 as that changes more between different calls - // while pV2 stays the same. - prefetch [pV1] - prefetch [pV2] - prefetch [pV1 + 32] - - mov eax, dword ptr pV2 - mov ebx, dword ptr pV1 - - pxor mm0, mm0 - - mov ecx, overlapLengthLocal - shr ecx, 2 // div by four - - loop1: - movq mm1, [eax] - prefetch [eax + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm1, [ebx] - prefetch [ebx + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movq mm2, [eax + 8] - pfadd mm0, mm1 - pfmul mm2, [ebx + 8] - - movq mm3, [eax + 16] - pfadd mm0, mm2 - pfmul mm3, [ebx + 16] - - movq mm4, [eax + 24] - pfadd mm0, mm3 - pfmul mm4, [ebx + 24] - - add eax, 32 - pfadd mm0, mm4 - add ebx, 32 - - dec ecx - jnz loop1 - - // add halfs of mm0 together and return the result. - // note: mm1 is used as a dummy parameter only, we actually don't care about it's value - pfacc mm0, mm1 - movd corr, mm0 - femms - } - - return corr; -} - - - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of 3DNow! optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - -FIRFilter3DNow::FIRFilter3DNow() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilter3DNow::~FIRFilter3DNow() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for 3DNow! routine -void FIRFilter3DNow::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - float fDivider; - - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Scale the filter coefficients so that it won't be necessary to scale the filtering result - // also rearrange coefficients suitably for 3DNow! - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new float[2 * newLength + 4]; - filterCoeffsAlign = (float *)(((uint)filterCoeffsUnalign + 15) & -16); - - fDivider = (float)resultDivider; - - // rearrange the filter coefficients for mmx routines - for (i = 0; i < newLength; i ++) - { - filterCoeffsAlign[2 * i + 0] = - filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider; - } -} - - -// 3DNow!-optimized version of the filter routine for stereo sound -uint FIRFilter3DNow::evaluateFilterStereo(float *dest, const float *src, const uint numSamples) const -{ - float *filterCoeffsLocal = filterCoeffsAlign; - uint count = (numSamples - length) & -2; - uint lengthLocal = length / 4; - - assert(length != 0); - assert(count % 2 == 0); - - /* original code: - - double suml1, suml2; - double sumr1, sumr2; - uint i, j; - - for (j = 0; j < count; j += 2) - { - const float *ptr; - - suml1 = sumr1 = 0.0; - suml2 = sumr2 = 0.0; - ptr = src; - filterCoeffsLocal = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) - { - // unroll loop for efficiency. - - suml1 += ptr[0] * filterCoeffsLocal[0] + - ptr[2] * filterCoeffsLocal[2] + - ptr[4] * filterCoeffsLocal[4] + - ptr[6] * filterCoeffsLocal[6]; - - sumr1 += ptr[1] * filterCoeffsLocal[1] + - ptr[3] * filterCoeffsLocal[3] + - ptr[5] * filterCoeffsLocal[5] + - ptr[7] * filterCoeffsLocal[7]; - - suml2 += ptr[8] * filterCoeffsLocal[0] + - ptr[10] * filterCoeffsLocal[2] + - ptr[12] * filterCoeffsLocal[4] + - ptr[14] * filterCoeffsLocal[6]; - - sumr2 += ptr[9] * filterCoeffsLocal[1] + - ptr[11] * filterCoeffsLocal[3] + - ptr[13] * filterCoeffsLocal[5] + - ptr[15] * filterCoeffsLocal[7]; - - ptr += 16; - filterCoeffsLocal += 8; - } - dest[0] = (float)suml1; - dest[1] = (float)sumr1; - dest[2] = (float)suml2; - dest[3] = (float)sumr2; - - src += 4; - dest += 4; - } - - */ - _asm - { - mov eax, dword ptr dest - mov ebx, dword ptr src - mov edx, count - shr edx, 1 - - loop1: - // "outer loop" : during each round 2*2 output samples are calculated - prefetch [ebx] // give a prefetch hint to CPU what data are to be needed soonish - prefetch [filterCoeffsLocal] // give a prefetch hint to CPU what data are to be needed soonish - - mov esi, ebx - mov edi, filterCoeffsLocal - pxor mm0, mm0 - pxor mm1, mm1 - mov ecx, lengthLocal - - loop2: - // "inner loop" : during each round four FIR filter taps are evaluated for 2*2 output samples - movq mm2, [edi] - movq mm3, mm2 - prefetch [edi + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm2, [esi] - prefetch [esi + 32] // give a prefetch hint to CPU what data are to be needed soonish - pfmul mm3, [esi + 8] - - movq mm4, [edi + 8] - movq mm5, mm4 - pfadd mm0, mm2 - pfmul mm4, [esi + 8] - pfadd mm1, mm3 - pfmul mm5, [esi + 16] - - movq mm2, [edi + 16] - movq mm6, mm2 - pfadd mm0, mm4 - pfmul mm2, [esi + 16] - pfadd mm1, mm5 - pfmul mm6, [esi + 24] - - movq mm3, [edi + 24] - movq mm7, mm3 - pfadd mm0, mm2 - pfmul mm3, [esi + 24] - pfadd mm1, mm6 - pfmul mm7, [esi + 32] - add esi, 32 - pfadd mm0, mm3 - add edi, 32 - pfadd mm1, mm7 - - dec ecx - jnz loop2 - - movq [eax], mm0 - add ebx, 16 - movq [eax + 8], mm1 - add eax, 16 - - dec edx - jnz loop1 - - femms - } - - return count; -} - - -#endif // ALLOW_3DNOW diff --git a/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.cpp b/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.cpp deleted file mode 100644 index 6bf529ccec..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.cpp +++ /dev/null @@ -1,184 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// FIR low-pass (anti-alias) filter with filter coefficient design routine and -/// MMX optimization. -/// -/// Anti-alias filter is used to prevent folding of high frequencies when -/// transposing the sample rate with interpolation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.9 $ -// -// $Id: AAFilter.cpp,v 1.9 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include "AAFilter.h" -#include "FIRFilter.h" - -using namespace soundtouch; - -#define PI 3.141592655357989 -#define TWOPI (2 * PI) - -/***************************************************************************** - * - * Implementation of the class 'AAFilter' - * - *****************************************************************************/ - -AAFilter::AAFilter(const uint length) -{ - pFIR = FIRFilter::newInstance(); - cutoffFreq = 0.5; - setLength(length); -} - - - -AAFilter::~AAFilter() -{ - delete pFIR; -} - - - -// Sets new anti-alias filter cut-off edge frequency, scaled to -// sampling frequency (nyquist frequency = 0.5). -// The filter will cut frequencies higher than the given frequency. -void AAFilter::setCutoffFreq(const double newCutoffFreq) -{ - cutoffFreq = newCutoffFreq; - calculateCoeffs(); -} - - - -// Sets number of FIR filter taps -void AAFilter::setLength(const uint newLength) -{ - length = newLength; - calculateCoeffs(); -} - - - -// Calculates coefficients for a low-pass FIR filter using Hamming window -void AAFilter::calculateCoeffs() -{ - uint i; - double cntTemp, temp, tempCoeff,h, w; - double fc2, wc; - double scaleCoeff, sum; - double *work; - SAMPLETYPE *coeffs; - - assert(length > 0); - assert(length % 4 == 0); - assert(cutoffFreq >= 0); - assert(cutoffFreq <= 0.5); - - work = new double[length]; - coeffs = new SAMPLETYPE[length]; - - fc2 = 2.0 * cutoffFreq; - wc = PI * fc2; - tempCoeff = TWOPI / (double)length; - - sum = 0; - for (i = 0; i < length; i ++) - { - cntTemp = (double)i - (double)(length / 2); - - temp = cntTemp * wc; - if (temp != 0) - { - h = fc2 * sin(temp) / temp; // sinc function - } - else - { - h = 1.0; - } - w = 0.54 + 0.46 * cos(tempCoeff * cntTemp); // hamming window - - temp = w * h; - work[i] = temp; - - // calc net sum of coefficients - sum += temp; - } - - // ensure the sum of coefficients is larger than zero - assert(sum > 0); - - // ensure we've really designed a lowpass filter... - assert(work[length/2] > 0); - assert(work[length/2 + 1] > -1e-6); - assert(work[length/2 - 1] > -1e-6); - - // Calculate a scaling coefficient in such a way that the result can be - // divided by 16384 - scaleCoeff = 16384.0f / sum; - - for (i = 0; i < length; i ++) - { - // scale & round to nearest integer - temp = work[i] * scaleCoeff; - temp += (temp >= 0) ? 0.5 : -0.5; - // ensure no overfloods - assert(temp >= -32768 && temp <= 32767); - coeffs[i] = (SAMPLETYPE)temp; - } - - // Set coefficients. Use divide factor 14 => divide result by 2^14 = 16384 - pFIR->setCoefficients(coeffs, length, 14); - - delete[] work; - delete[] coeffs; -} - - -// Applies the filter to the given sequence of samples. -// Note : The amount of outputted samples is by value of 'filter length' -// smaller than the amount of input samples. -uint AAFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples, uint numChannels) const -{ - return pFIR->evaluate(dest, src, numSamples, numChannels); -} - - -uint AAFilter::getLength() const -{ - return pFIR->getLength(); -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.h b/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.h deleted file mode 100644 index 68eb50d27f..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/AAFilter.h +++ /dev/null @@ -1,91 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method -/// with several performance-increasing tweaks. -/// -/// Anti-alias filter is used to prevent folding of high frequencies when -/// transposing the sample rate with interpolation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: AAFilter.h,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef AAFilter_H -#define AAFilter_H - -#include "STTypes.h" - -namespace soundtouch -{ - -class AAFilter -{ -protected: - class FIRFilter *pFIR; - - /// Low-pass filter cut-off frequency, negative = invalid - double cutoffFreq; - - /// num of filter taps - uint length; - - /// Calculate the FIR coefficients realizing the given cutoff-frequency - void calculateCoeffs(); -public: - AAFilter(uint length); - - ~AAFilter(); - - /// Sets new anti-alias filter cut-off edge frequency, scaled to sampling - /// frequency (nyquist frequency = 0.5). The filter will cut off the - /// frequencies than that. - void setCutoffFreq(double newCutoffFreq); - - /// Sets number of FIR filter taps, i.e. ~filter complexity - void setLength(uint newLength); - - uint getLength() const; - - /// Applies the filter to the given sequence of samples. - /// Note : The amount of outputted samples is by value of 'filter length' - /// smaller than the amount of input samples. - uint evaluate(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples, - uint numChannels) const; -}; - -} - -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/BPMDetect.h b/plugins/zerospu2/3rdparty/SoundTouch/BPMDetect.h deleted file mode 100644 index b5e393979d..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/BPMDetect.h +++ /dev/null @@ -1,159 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Beats-per-minute (BPM) detection routine. -/// -/// The beat detection algorithm works as follows: -/// - Use function 'inputSamples' to input a chunks of samples to the class for -/// analysis. It's a good idea to enter a large sound file or stream in smallish -/// chunks of around few kilosamples in order not to extinguish too much RAM memory. -/// - Input sound data is decimated to approx 500 Hz to reduce calculation burden, -/// which is basically ok as low (bass) frequencies mostly determine the beat rate. -/// Simple averaging is used for anti-alias filtering because the resulting signal -/// quality isn't of that high importance. -/// - Decimated sound data is enveloped, i.e. the amplitude shape is detected by -/// taking absolute value that's smoothed by sliding average. Signal levels that -/// are below a couple of times the general RMS amplitude level are cut away to -/// leave only notable peaks there. -/// - Repeating sound patterns (e.g. beats) are detected by calculating short-term -/// autocorrelation function of the enveloped signal. -/// - After whole sound data file has been analyzed as above, the bpm level is -/// detected by function 'getBpm' that finds the highest peak of the autocorrelation -/// function, calculates it's precise location and converts this reading to bpm's. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.5 $ -// -// $Id: BPMDetect.h,v 1.5 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef _BPMDetect_H_ -#define _BPMDetect_H_ - -#include "STTypes.h" -#include "FIFOSampleBuffer.h" - -/// Minimum allowed BPM rate. Used to restrict accepted result above a reasonable limit. -#define MIN_BPM 45 - -/// Maximum allowed BPM rate. Used to restrict accepted result below a reasonable limit. -#define MAX_BPM 230 - - -/// Class for calculating BPM rate for audio data. -class BPMDetect -{ -protected: - /// Auto-correlation accumulator bins. - float *xcorr; - - /// Amplitude envelope sliding average approximation level accumulator - float envelopeAccu; - - /// RMS volume sliding average approximation level accumulator - float RMSVolumeAccu; - - /// Sample average counter. - int decimateCount; - - /// Sample average accumulator for FIFO-like decimation. - soundtouch::LONG_SAMPLETYPE decimateSum; - - /// Decimate sound by this coefficient to reach approx. 500 Hz. - int decimateBy; - - /// Auto-correlation window length - int windowLen; - - /// Number of channels (1 = mono, 2 = stereo) - int channels; - - /// sample rate - int sampleRate; - - /// Beginning of auto-correlation window: Autocorrelation isn't being updated for - /// the first these many correlation bins. - int windowStart; - - /// FIFO-buffer for decimated processing samples. - soundtouch::FIFOSampleBuffer *buffer; - - /// Initialize the class for processing. - void init(int numChannels, int sampleRate); - - /// Updates auto-correlation function for given number of decimated samples that - /// are read from the internal 'buffer' pipe (samples aren't removed from the pipe - /// though). - void updateXCorr(int process_samples /// How many samples are processed. - ); - - /// Decimates samples to approx. 500 Hz. - /// - /// \return Number of output samples. - int decimate(soundtouch::SAMPLETYPE *dest, ///< Destination buffer - const soundtouch::SAMPLETYPE *src, ///< Source sample buffer - int numsamples ///< Number of source samples. - ); - - /// Calculates amplitude envelope for the buffer of samples. - /// Result is output to 'samples'. - void calcEnvelope(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/output data buffer - int numsamples ///< Number of samples in buffer - ); - -public: - /// Constructor. - BPMDetect(int numChannels, ///< Number of channels in sample data. - int sampleRate ///< Sample rate in Hz. - ); - - /// Destructor. - virtual ~BPMDetect(); - - /// Inputs a block of samples for analyzing: Envelopes the samples and then - /// updates the autocorrelation estimation. When whole song data has been input - /// in smaller blocks using this function, read the resulting bpm with 'getBpm' - /// function. - /// - /// Notice that data in 'samples' array can be disrupted in processing. - void inputSamples(soundtouch::SAMPLETYPE *samples, ///< Pointer to input/working data buffer - int numSamples ///< Number of samples in buffer - ); - - - /// Analyzes the results and returns the BPM rate. Use this function to read result - /// after whole song data has been input to the class by consecutive calls of - /// 'inputSamples' function. - /// - /// \return Beats-per-minute rate, or zero if detection failed. - float getBpm(); -}; - -#endif // _BPMDetect_H_ diff --git a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.cpp b/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.cpp deleted file mode 100644 index a8918a8133..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.cpp +++ /dev/null @@ -1,252 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A buffer class for temporarily storaging sound samples, operates as a -/// first-in-first-out pipe. -/// -/// Samples are added to the end of the sample buffer with the 'putSamples' -/// function, and are received from the beginning of the buffer by calling -/// the 'receiveSamples' function. The class automatically removes the -/// outputted samples from the buffer, as well as grows the buffer size -/// whenever necessary. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.11 $ -// -// $Id: FIFOSampleBuffer.cpp,v 1.11 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -#include "FIFOSampleBuffer.h" - -using namespace soundtouch; - -// Constructor -FIFOSampleBuffer::FIFOSampleBuffer(uint numChannels) -{ - sizeInBytes = 0; // reasonable initial value - buffer = NULL; //new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE)]; - bufferUnaligned = NULL; - samplesInBuffer = 0; - bufferPos = 0; - channels = numChannels; -} - - -// destructor -FIFOSampleBuffer::~FIFOSampleBuffer() -{ - delete[] bufferUnaligned; -} - - -// Sets number of channels, 1 = mono, 2 = stereo -void FIFOSampleBuffer::setChannels(const uint numChannels) -{ - uint usedBytes; - - usedBytes = channels * samplesInBuffer; - channels = numChannels; - samplesInBuffer = usedBytes / channels; -} - - -// if output location pointer 'bufferPos' isn't zero, 'rewinds' the buffer and -// zeroes this pointer by copying samples from the 'bufferPos' pointer -// location on to the beginning of the buffer. -void FIFOSampleBuffer::rewind() -{ - if (bufferPos) - { - memmove(buffer, ptrBegin(), sizeof(SAMPLETYPE) * channels * samplesInBuffer); - bufferPos = 0; - } -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position to -// the sample buffer. -void FIFOSampleBuffer::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - memcpy(ptrEnd(numSamples), samples, sizeof(SAMPLETYPE) * numSamples * channels); - samplesInBuffer += numSamples; -} - - -// Increases the number of samples in the buffer without copying any actual -// samples. -// -// This function is used to update the number of samples in the sample buffer -// when accessing the buffer directly with 'ptrEnd' function. Please be -// careful though! -void FIFOSampleBuffer::putSamples(uint numSamples) -{ - uint req; - - req = samplesInBuffer + numSamples; - ensureCapacity(req); - samplesInBuffer += numSamples; -} - - -// Returns a pointer to the end of the used part of the sample buffer (i.e. -// where the new samples are to be inserted). This function may be used for -// inserting new samples into the sample buffer directly. Please be careful! -// -// Parameter 'slackCapacity' tells the function how much free capacity (in -// terms of samples) there _at least_ should be, in order to the caller to -// succesfully insert all the required samples to the buffer. When necessary, -// the function grows the buffer size to comply with this requirement. -// -// When using this function as means for inserting new samples, also remember -// to increase the sample count afterwards, by calling the -// 'putSamples(numSamples)' function. -SAMPLETYPE *FIFOSampleBuffer::ptrEnd(uint slackCapacity) -{ - ensureCapacity(samplesInBuffer + slackCapacity); - return buffer + samplesInBuffer * channels; -} - - -// Returns a pointer to the beginning of the currently non-outputted samples. -// This function is provided for accessing the output samples directly. -// Please be careful! -// -// When using this function to output samples, also remember to 'remove' the -// outputted samples from the buffer by calling the -// 'receiveSamples(numSamples)' function -SAMPLETYPE *FIFOSampleBuffer::ptrBegin() const -{ - return buffer + bufferPos * channels; -} - - -// Ensures that the buffer has enought capacity, i.e. space for _at least_ -// 'capacityRequirement' number of samples. The buffer is grown in steps of -// 4 kilobytes to eliminate the need for frequently growing up the buffer, -// as well as to round the buffer size up to the virtual memory page size. -void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) -{ - SAMPLETYPE *tempUnaligned, *temp; - - if (capacityRequirement > getCapacity()) - { - // enlarge the buffer in 4kbyte steps (round up to next 4k boundary) - sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & -4096; - assert(sizeInBytes % 2 == 0); - tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)]; - if (tempUnaligned == NULL) - { - throw std::runtime_error("Couldn't allocate memory!\n"); - } - temp = (SAMPLETYPE *)(((ulongptr)tempUnaligned + 15) & -16); - memcpy(temp, ptrBegin(), samplesInBuffer * channels * sizeof(SAMPLETYPE)); - delete[] bufferUnaligned; - buffer = temp; - bufferUnaligned = tempUnaligned; - bufferPos = 0; - } - else - { - // simply rewind the buffer (if necessary) - rewind(); - } -} - - -// Returns the current buffer capacity in terms of samples -uint FIFOSampleBuffer::getCapacity() const -{ - return sizeInBytes / (channels * sizeof(SAMPLETYPE)); -} - - -// Returns the number of samples currently in the buffer -uint FIFOSampleBuffer::numSamples() const -{ - return samplesInBuffer; -} - - -// Output samples from beginning of the sample buffer. Copies demanded number -// of samples to output and removes them from the sample buffer. If there -// are less than 'numsample' samples in the buffer, returns all available. -// -// Returns number of samples copied. -uint FIFOSampleBuffer::receiveSamples(SAMPLETYPE *output, uint maxSamples) -{ - uint num; - - num = (maxSamples > samplesInBuffer) ? samplesInBuffer : maxSamples; - - memcpy(output, ptrBegin(), channels * sizeof(SAMPLETYPE) * num); - return receiveSamples(num); -} - - -// Removes samples from the beginning of the sample buffer without copying them -// anywhere. Used to reduce the number of samples in the buffer, when accessing -// the sample buffer with the 'ptrBegin' function. -uint FIFOSampleBuffer::receiveSamples(uint maxSamples) -{ - if (maxSamples >= samplesInBuffer) - { - uint temp; - - temp = samplesInBuffer; - samplesInBuffer = 0; - return temp; - } - - samplesInBuffer -= maxSamples; - bufferPos += maxSamples; - - return maxSamples; -} - - -// Returns nonzero if the sample buffer is empty -int FIFOSampleBuffer::isEmpty() const -{ - return (samplesInBuffer == 0) ? 1 : 0; -} - - -// Clears the sample buffer -void FIFOSampleBuffer::clear() -{ - samplesInBuffer = 0; - bufferPos = 0; -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.h b/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.h deleted file mode 100644 index bcbfb59d4e..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSampleBuffer.h +++ /dev/null @@ -1,174 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A buffer class for temporarily storaging sound samples, operates as a -/// first-in-first-out pipe. -/// -/// Samples are added to the end of the sample buffer with the 'putSamples' -/// function, and are received from the beginning of the buffer by calling -/// the 'receiveSamples' function. The class automatically removes the -/// output samples from the buffer as well as grows the storage size -/// whenever necessary. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.9 $ -// -// $Id: FIFOSampleBuffer.h,v 1.9 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIFOSampleBuffer_H -#define FIFOSampleBuffer_H - -#include "FIFOSamplePipe.h" - -namespace soundtouch -{ - -/// Sample buffer working in FIFO (first-in-first-out) principle. The class takes -/// care of storage size adjustment and data moving during input/output operations. -/// -/// Notice that in case of stereo audio, one sample is considered to consist of -/// both channel data. -class FIFOSampleBuffer : public FIFOSamplePipe -{ -private: - /// Sample buffer. - SAMPLETYPE *buffer; - - // Raw unaligned buffer memory. 'buffer' is made aligned by pointing it to first - // 16-byte aligned location of this buffer - SAMPLETYPE *bufferUnaligned; - - /// Sample buffer size in bytes - uint sizeInBytes; - - /// How many samples are currently in buffer. - uint samplesInBuffer; - - /// Channels, 1=mono, 2=stereo. - uint channels; - - /// Current position pointer to the buffer. This pointer is increased when samples are - /// removed from the pipe so that it's necessary to actually rewind buffer (move data) - /// only new data when is put to the pipe. - uint bufferPos; - - /// Rewind the buffer by moving data from position pointed by 'bufferPos' to real - /// beginning of the buffer. - void rewind(); - - /// Ensures that the buffer has capacity for at least this many samples. - void ensureCapacity(const uint capacityRequirement); - - /// Returns current capacity. - uint getCapacity() const; - -public: - - /// Constructor - FIFOSampleBuffer(uint numChannels = 2 ///< Number of channels, 1=mono, 2=stereo. - ///< Default is stereo. - ); - - /// destructor - ~FIFOSampleBuffer(); - - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const; - - /// Returns a pointer to the end of the used part of the sample buffer (i.e. - /// where the new samples are to be inserted). This function may be used for - /// inserting new samples into the sample buffer directly. Please be careful - /// not corrupt the book-keeping! - /// - /// When using this function as means for inserting new samples, also remember - /// to increase the sample count afterwards, by calling the - /// 'putSamples(numSamples)' function. - SAMPLETYPE *ptrEnd( - uint slackCapacity ///< How much free capacity (in samples) there _at least_ - ///< should be so that the caller can succesfully insert the - ///< desired samples to the buffer. If necessary, the function - ///< grows the buffer size to comply with this requirement. - ); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position to - /// the sample buffer. - virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. - uint numSamples ///< Number of samples to insert. - ); - - /// Adjusts the book-keeping to increase number of samples in the buffer without - /// copying any actual samples. - /// - /// This function is used to update the number of samples in the sample buffer - /// when accessing the buffer directly with 'ptrEnd' function. Please be - /// careful though! - virtual void putSamples(uint numSamples ///< Number of samples been inserted. - ); - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ); - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ); - - /// Returns number of samples currently available. - virtual uint numSamples() const; - - /// Sets number of channels, 1 = mono, 2 = stereo. - void setChannels(uint numChannels); - - /// Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const; - - /// Clears all the samples. - virtual void clear(); -}; - -} - -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSamplePipe.h b/plugins/zerospu2/3rdparty/SoundTouch/FIFOSamplePipe.h deleted file mode 100644 index e10b8b26c8..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/FIFOSamplePipe.h +++ /dev/null @@ -1,217 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// 'FIFOSamplePipe' : An abstract base class for classes that manipulate sound -/// samples by operating like a first-in-first-out pipe: New samples are fed -/// into one end of the pipe with the 'putSamples' function, and the processed -/// samples are received from the other end with the 'receiveSamples' function. -/// -/// 'FIFOProcessor' : A base class for classes the do signal processing with -/// the samples while operating like a first-in-first-out pipe. When samples -/// are input with the 'putSamples' function, the class processes them -/// and moves the processed samples to the given 'output' pipe object, which -/// may be either another processing stage, or a fifo sample buffer object. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.8 $ -// -// $Id: FIFOSamplePipe.h,v 1.8 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIFOSamplePipe_H -#define FIFOSamplePipe_H - -#include -#include -#include "STTypes.h" - -namespace soundtouch -{ - -/// Abstract base class for FIFO (first-in-first-out) sample processing classes. -class FIFOSamplePipe -{ -public: - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const = 0; - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position to - /// the sample buffer. - virtual void putSamples(const SAMPLETYPE *samples, ///< Pointer to samples. - uint numSamples ///< Number of samples to insert. - ) = 0; - - - // Moves samples from the 'other' pipe instance to this instance. - void moveSamples(FIFOSamplePipe &other ///< Other pipe instance where from the receive the data. - ) - { - int oNumSamples = other.numSamples(); - - putSamples(other.ptrBegin(), oNumSamples); - other.receiveSamples(oNumSamples); - }; - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *output, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ) = 0; - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ) = 0; - - /// Returns number of samples currently available. - virtual uint numSamples() const = 0; - - // Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const = 0; - - /// Clears all the samples. - virtual void clear() = 0; -}; - - - -/// Base-class for sound processing routines working in FIFO principle. With this base -/// class it's easy to implement sound processing stages that can be chained together, -/// so that samples that are fed into beginning of the pipe automatically go through -/// all the processing stages. -/// -/// When samples are input to this class, they're first processed and then put to -/// the FIFO pipe that's defined as output of this class. This output pipe can be -/// either other processing stage or a FIFO sample buffer. -class FIFOProcessor :public FIFOSamplePipe -{ -protected: - /// Internal pipe where processed samples are put. - FIFOSamplePipe *output; - - /// Sets output pipe. - void setOutPipe(FIFOSamplePipe *pOutput) - { - assert(output == NULL); - assert(pOutput != NULL); - output = pOutput; - } - - - /// Constructor. Doesn't define output pipe; it has to be set be - /// 'setOutPipe' function. - FIFOProcessor() - { - output = NULL; - } - - - /// Constructor. Configures output pipe. - FIFOProcessor(FIFOSamplePipe *pOutput ///< Output pipe. - ) - { - output = pOutput; - } - - - /// Destructor. - virtual ~FIFOProcessor() - { - } - - - /// Returns a pointer to the beginning of the output samples. - /// This function is provided for accessing the output samples directly. - /// Please be careful for not to corrupt the book-keeping! - /// - /// When using this function to output samples, also remember to 'remove' the - /// output samples from the buffer by calling the - /// 'receiveSamples(numSamples)' function - virtual SAMPLETYPE *ptrBegin() const - { - return output->ptrBegin(); - } - -public: - - /// Output samples from beginning of the sample buffer. Copies requested samples to - /// output buffer and removes them from the sample buffer. If there are less than - /// 'numsample' samples in the buffer, returns all that available. - /// - /// \return Number of samples returned. - virtual uint receiveSamples(SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples. - uint maxSamples ///< How many samples to receive at max. - ) - { - return output->receiveSamples(outBuffer, maxSamples); - } - - - /// Adjusts book-keeping so that given number of samples are removed from beginning of the - /// sample buffer without copying them anywhere. - /// - /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly - /// with 'ptrBegin' function. - virtual uint receiveSamples(uint maxSamples ///< Remove this many samples from the beginning of pipe. - ) - { - return output->receiveSamples(maxSamples); - } - - - /// Returns number of samples currently available. - virtual uint numSamples() const - { - return output->numSamples(); - } - - - /// Returns nonzero if there aren't any samples available for outputting. - virtual int isEmpty() const - { - return output->isEmpty(); - } -}; - -} - -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.cpp b/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.cpp deleted file mode 100644 index 10a0bb0299..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.cpp +++ /dev/null @@ -1,272 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// General FIR digital filter routines with MMX optimization. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: FIRFilter.cpp,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include "FIRFilter.h" -#include "cpu_detect.h" - -using namespace soundtouch; - -/***************************************************************************** - * - * Implementation of the class 'FIRFilter' - * - *****************************************************************************/ - -FIRFilter::FIRFilter() -{ - resultDivFactor = 0; - length = 0; - lengthDiv8 = 0; - filterCoeffs = NULL; -} - - -FIRFilter::~FIRFilter() -{ - delete[] filterCoeffs; -} - -// Usual C-version of the filter routine for stereo sound -uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const -{ - uint i, j, end; - LONG_SAMPLETYPE suml, sumr; -#ifdef FLOAT_SAMPLES - // when using floating point samples, use a scaler instead of a divider - // because division is much slower operation than multiplying. - double dScaler = 1.0 / (double)resultDivider; -#endif - - assert(length != 0); - - end = 2 * (numSamples - length); - - for (j = 0; j < end; j += 2) - { - const SAMPLETYPE *ptr; - - suml = sumr = 0; - ptr = src + j; - - for (i = 0; i < length; i += 4) - { - // loop is unrolled by factor of 4 here for efficiency - suml += ptr[2 * i + 0] * filterCoeffs[i + 0] + - ptr[2 * i + 2] * filterCoeffs[i + 1] + - ptr[2 * i + 4] * filterCoeffs[i + 2] + - ptr[2 * i + 6] * filterCoeffs[i + 3]; - sumr += ptr[2 * i + 1] * filterCoeffs[i + 0] + - ptr[2 * i + 3] * filterCoeffs[i + 1] + - ptr[2 * i + 5] * filterCoeffs[i + 2] + - ptr[2 * i + 7] * filterCoeffs[i + 3]; - } - -#ifdef INTEGER_SAMPLES - suml >>= resultDivFactor; - sumr >>= resultDivFactor; - // saturate to 16 bit integer limits - suml = (suml < -32768) ? -32768 : (suml > 32767) ? 32767 : suml; - // saturate to 16 bit integer limits - sumr = (sumr < -32768) ? -32768 : (sumr > 32767) ? 32767 : sumr; -#else - suml *= dScaler; - sumr *= dScaler; -#endif // INTEGER_SAMPLES - dest[j] = (SAMPLETYPE)suml; - dest[j + 1] = (SAMPLETYPE)sumr; - } - return numSamples - length; -} - - - - -// Usual C-version of the filter routine for mono sound -uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const -{ - uint i, j, end; - LONG_SAMPLETYPE sum; -#ifdef FLOAT_SAMPLES - // when using floating point samples, use a scaler instead of a divider - // because division is much slower operation than multiplying. - double dScaler = 1.0 / (double)resultDivider; -#endif - - - assert(length != 0); - - end = numSamples - length; - for (j = 0; j < end; j ++) - { - sum = 0; - for (i = 0; i < length; i += 4) - { - // loop is unrolled by factor of 4 here for efficiency - sum += src[i + 0] * filterCoeffs[i + 0] + - src[i + 1] * filterCoeffs[i + 1] + - src[i + 2] * filterCoeffs[i + 2] + - src[i + 3] * filterCoeffs[i + 3]; - } -#ifdef INTEGER_SAMPLES - sum >>= resultDivFactor; - // saturate to 16 bit integer limits - sum = (sum < -32768) ? -32768 : (sum > 32767) ? 32767 : sum; -#else - sum *= dScaler; -#endif // INTEGER_SAMPLES - dest[j] = (SAMPLETYPE)sum; - src ++; - } - return end; -} - - -// Set filter coeffiecients and length. -// -// Throws an exception if filter length isn't divisible by 8 -void FIRFilter::setCoefficients(const SAMPLETYPE *coeffs, uint newLength, uint uResultDivFactor) -{ - assert(newLength > 0); - if (newLength % 8) throw std::runtime_error("FIR filter length not divisible by 8"); - - lengthDiv8 = newLength / 8; - length = lengthDiv8 * 8; - assert(length == newLength); - - resultDivFactor = uResultDivFactor; -#ifdef INTEGER_SAMPLES - resultDivider = (SAMPLETYPE)(1< 0); - assert(lengthDiv8 * 8 == length); - if (numSamples < length) return 0; - assert(resultDivFactor >= 0); - if (numChannels == 2) - { - return evaluateFilterStereo(dest, src, numSamples); - } else { - return evaluateFilterMono(dest, src, numSamples); - } -} - - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX-capable CPU available or not. -void * FIRFilter::operator new(size_t s) -{ - // Notice! don't use "new FIRFilter" directly, use "newInstance" to create a new instance instead! - throw std::runtime_error("Don't use 'new FIRFilter', use 'newInstance' member instead!"); - return NULL; -} - - -FIRFilter * FIRFilter::newInstance() -{ - uint uExtensions = 0; - -#if !defined(_MSC_VER) || !defined(__x86_64__) - uExtensions = detectCPUextensions(); -#endif - - // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU - -#ifdef ALLOW_MMX - // MMX routines available only with integer sample types - if (uExtensions & SUPPORT_MMX) - { - return ::new FIRFilterMMX; - } - else -#endif // ALLOW_MMX - -#ifdef ALLOW_SSE - if (uExtensions & SUPPORT_SSE) - { - // SSE support - return ::new FIRFilterSSE; - } - else -#endif // ALLOW_SSE - -#ifdef ALLOW_3DNOW - if (uExtensions & SUPPORT_3DNOW) - { - // 3DNow! support - return ::new FIRFilter3DNow; - } - else -#endif // ALLOW_3DNOW - - { - // ISA optimizations not supported, use plain C version - return ::new FIRFilter; - } -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.h b/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.h deleted file mode 100644 index 5e9b3410f8..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/FIRFilter.h +++ /dev/null @@ -1,163 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// General FIR digital filter routines with MMX optimization. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.17 $ -// -// $Id: FIRFilter.h,v 1.17 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef FIRFilter_H -#define FIRFilter_H - -#include "STTypes.h" - -namespace soundtouch -{ - -class FIRFilter -{ -protected: - // Number of FIR filter taps - uint length; - // Number of FIR filter taps divided by 8 - uint lengthDiv8; - - // Result divider factor in 2^k format - uint resultDivFactor; - - // Result divider value. - SAMPLETYPE resultDivider; - - // Memory for filter coefficients - SAMPLETYPE *filterCoeffs; - - virtual uint evaluateFilterStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) const; - virtual uint evaluateFilterMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) const; - -public: - FIRFilter(); - virtual ~FIRFilter(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we've a MMX-capable CPU available or not. - void * operator new(size_t s); - - static FIRFilter *newInstance(); - - /// Applies the filter to the given sequence of samples. - /// Note : The amount of outputted samples is by value of 'filter_length' - /// smaller than the amount of input samples. - /// - /// \return Number of samples copied to 'dest'. - uint evaluate(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples, - uint numChannels) const; - - uint getLength() const; - - virtual void setCoefficients(const SAMPLETYPE *coeffs, - uint newLength, - uint uResultDivFactor); -}; - - -// Optional subclasses that implement CPU-specific optimizations: - -#ifdef ALLOW_MMX - - /// Class that implements MMX optimized functions exclusive for 16bit integer samples type. - class FIRFilterMMX : public FIRFilter - { - protected: - short *filterCoeffsUnalign; - short *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(short *dest, const short *src, uint numSamples) const; - public: - FIRFilterMMX(); - ~FIRFilterMMX(); - - virtual void setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_MMX - - -#ifdef ALLOW_3DNOW - - /// Class that implements 3DNow! optimized functions exclusive for floating point samples type. - class FIRFilter3DNow : public FIRFilter - { - protected: - float *filterCoeffsUnalign; - float *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; - public: - FIRFilter3DNow(); - ~FIRFilter3DNow(); - virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_3DNOW - - -#ifdef ALLOW_SSE - /// Class that implements SSE optimized functions exclusive for floating point samples type. - class FIRFilterSSE : public FIRFilter - { - protected: - float *filterCoeffsUnalign; - float *filterCoeffsAlign; - - virtual uint evaluateFilterStereo(float *dest, const float *src, uint numSamples) const; - public: - FIRFilterSSE(); - ~FIRFilterSSE(); - - virtual void setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor); - }; - -#endif // ALLOW_SSE - -} - -#endif // FIRFilter_H diff --git a/plugins/zerospu2/3rdparty/SoundTouch/Makefile.am b/plugins/zerospu2/3rdparty/SoundTouch/Makefile.am deleted file mode 100644 index a09ae5f081..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -## Process this file with automake to create Makefile.in -## -## $Id: Makefile.am,v 1.3 2006/02/05 18:33:34 Olli Exp $ -## -## Copyright (C) 2003 - David W. Durham -## -## This file is part of SoundTouch, an audio processing library for pitch/time adjustments -## -## SoundTouch 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. -## -## SoundTouch 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, write to the Free Software Foundation, Inc., 59 Temple -## Place - Suite 330, Boston, MA 02111-1307, USA - -AUTOMAKE_OPTIONS = foreign - -noinst_HEADERS=AAFilter.h cpu_detect.h FIRFilter.h RateTransposer.h TDStretch.h cpu_detect_x86_gcc.cpp -noinst_LIBRARIES = libSoundTouch.a - -if X86_64 -libSoundTouch_a_CXXFLAGS = -fPIC -libSoundTouch_a_CFLAGS = -fPIC -else -libSoundTouch_a_CXXFLAGS = -msse -mmmx -libSoundTouch_a_CFLAGS = -msse -mmmx -endif - -#lib_LTLIBRARIES=libSoundTouch.la -# the mmx_gcc.cpp and cpu_detect_x86_gcc.cpp may need to be conditionally included here from things discovered in configure.ac -libSoundTouch_a_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp mmx_optimized.cpp sse_optimized.cpp \ -RateTransposer.cpp SoundTouch.cpp TDStretch.cpp WavFile.cpp cpu_detect_x86_gcc.cpp - -# ??? test for -fcheck-new in configure.ac -# other compiler flags to add -AM_CXXFLAGS=-O3 -msse -fcheck-new -I../../include - -# other linking flags to add -#libSoundTouch_la_LIBADD= - diff --git a/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.cpp b/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.cpp deleted file mode 100644 index 9e5c962d13..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.cpp +++ /dev/null @@ -1,626 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation -/// together with anti-alias filtering (first order interpolation with anti- -/// alias filtering should be quite adequate for this application) -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/03/19 10:05:49 $ -// File revision : $Revision: 1.13 $ -// -// $Id: RateTransposer.cpp,v 1.13 2006/03/19 10:05:49 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include "RateTransposer.h" -#include "AAFilter.h" - -using namespace soundtouch; - - -/// A linear samplerate transposer class that uses integer arithmetics. -/// for the transposing. -class RateTransposerInteger : public RateTransposer -{ -protected: - int iSlopeCount; - uint uRate; - SAMPLETYPE sPrevSampleL, sPrevSampleR; - - virtual void resetRegisters(); - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - -public: - RateTransposerInteger(); - virtual ~RateTransposerInteger(); - - /// Sets new target rate. Normal rate = 1.0, smaller values represent slower - /// rate, larger faster rates. - virtual void setRate(float newRate); - -}; - - -/// A linear samplerate transposer class that uses floating point arithmetics -/// for the transposing. -class RateTransposerFloat : public RateTransposer -{ -protected: - float fSlopeCount; - float fRateStep; - SAMPLETYPE sPrevSampleL, sPrevSampleR; - - virtual void resetRegisters(); - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - -public: - RateTransposerFloat(); - virtual ~RateTransposerFloat(); -}; - - - -#ifndef min -#define min(a,b) ((a > b) ? b : a) -#define max(a,b) ((a < b) ? b : a) -#endif - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX/SSE/etc-capable CPU available or not. -void * RateTransposer::operator new(size_t s) -{ - // Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead! - assert(FALSE); - return NULL; -} - - -RateTransposer *RateTransposer::newInstance() -{ -#ifdef INTEGER_SAMPLES - return ::new RateTransposerInteger; -#else - return ::new RateTransposerFloat; -#endif -} - - -// Constructor -RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer) -{ - uChannels = 2; - bUseAAFilter = TRUE; - - // Instantiates the anti-alias filter with default tap length - // of 32 - pAAFilter = new AAFilter(32); -} - - - -RateTransposer::~RateTransposer() -{ - delete pAAFilter; -} - - - -/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable -void RateTransposer::enableAAFilter(const BOOL newMode) -{ - bUseAAFilter = newMode; -} - - -/// Returns nonzero if anti-alias filter is enabled. -BOOL RateTransposer::isAAFilterEnabled() const -{ - return bUseAAFilter; -} - - -AAFilter *RateTransposer::getAAFilter() const -{ - return pAAFilter; -} - - - -// Sets new target uRate. Normal uRate = 1.0, smaller values represent slower -// uRate, larger faster uRates. -void RateTransposer::setRate(float newRate) -{ - float fCutoff; - - fRate = newRate; - - // design a new anti-alias filter - if (newRate > 1.0f) - { - fCutoff = 0.5f / newRate; - } - else - { - fCutoff = 0.5f * newRate; - } - pAAFilter->setCutoffFreq(fCutoff); -} - - -// Outputs as many samples of the 'outputBuffer' as possible, and if there's -// any room left, outputs also as many of the incoming samples as possible. -// The goal is to drive the outputBuffer empty. -// -// It's allowed for 'output' and 'input' parameters to point to the same -// memory position. -void RateTransposer::flushStoreBuffer() -{ - if (storeBuffer.isEmpty()) return; - - outputBuffer.moveSamples(storeBuffer); -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void RateTransposer::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - processSamples(samples, numSamples); -} - - - -// Transposes up the sample rate, causing the observed playback 'rate' of the -// sound to decrease -void RateTransposer::upsample(const SAMPLETYPE *src, uint numSamples) -{ - int count, sizeTemp, num; - - // If the parameter 'uRate' value is smaller than 'SCALE', first transpose - // the samples and then apply the anti-alias filter to remove aliasing. - - // First check that there's enough room in 'storeBuffer' - // (+16 is to reserve some slack in the destination buffer) - sizeTemp = (int)((float)numSamples / fRate + 16.0f); - - // Transpose the samples, store the result into the end of "storeBuffer" - count = transpose(storeBuffer.ptrEnd(sizeTemp), src, numSamples); - storeBuffer.putSamples(count); - - // Apply the anti-alias filter to samples in "store output", output the - // result to "dest" - num = storeBuffer.numSamples(); - count = pAAFilter->evaluate(outputBuffer.ptrEnd(num), - storeBuffer.ptrBegin(), num, uChannels); - outputBuffer.putSamples(count); - - // Remove the processed samples from "storeBuffer" - storeBuffer.receiveSamples(count); -} - - -// Transposes down the sample rate, causing the observed playback 'rate' of the -// sound to increase -void RateTransposer::downsample(const SAMPLETYPE *src, uint numSamples) -{ - int count, sizeTemp; - - // If the parameter 'uRate' value is larger than 'SCALE', first apply the - // anti-alias filter to remove high frequencies (prevent them from folding - // over the lover frequencies), then transpose. */ - - // Add the new samples to the end of the storeBuffer */ - storeBuffer.putSamples(src, numSamples); - - // Anti-alias filter the samples to prevent folding and output the filtered - // data to tempBuffer. Note : because of the FIR filter length, the - // filtering routine takes in 'filter_length' more samples than it outputs. - assert(tempBuffer.isEmpty()); - sizeTemp = storeBuffer.numSamples(); - - count = pAAFilter->evaluate(tempBuffer.ptrEnd(sizeTemp), - storeBuffer.ptrBegin(), sizeTemp, uChannels); - - // Remove the filtered samples from 'storeBuffer' - storeBuffer.receiveSamples(count); - - // Transpose the samples (+16 is to reserve some slack in the destination buffer) - sizeTemp = (int)((float)numSamples / fRate + 16.0f); - count = transpose(outputBuffer.ptrEnd(sizeTemp), tempBuffer.ptrBegin(), count); - outputBuffer.putSamples(count); -} - - -// Transposes sample rate by applying anti-alias filter to prevent folding. -// Returns amount of samples returned in the "dest" buffer. -// The maximum amount of samples that can be returned at a time is set by -// the 'set_returnBuffer_size' function. -void RateTransposer::processSamples(const SAMPLETYPE *src, uint numSamples) -{ - uint count; - uint sizeReq; - - if (numSamples == 0) return; - assert(pAAFilter); - - // If anti-alias filter is turned off, simply transpose without applying - // the filter - if (bUseAAFilter == FALSE) - { - sizeReq = (int)((float)numSamples / fRate + 1.0f); - count = transpose(outputBuffer.ptrEnd(sizeReq), src, numSamples); - outputBuffer.putSamples(count); - return; - } - - // Transpose with anti-alias filter - if (fRate < 1.0f) - { - upsample(src, numSamples); - } - else - { - downsample(src, numSamples); - } -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// Returns the number of samples returned in the "dest" buffer -inline uint RateTransposer::transpose(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - if (uChannels == 2) - { - return transposeStereo(dest, src, numSamples); - } - else - { - return transposeMono(dest, src, numSamples); - } -} - - -// Sets the number of channels, 1 = mono, 2 = stereo -void RateTransposer::setChannels(const uint numchannels) -{ - if (uChannels == numchannels) return; - - assert(numchannels == 1 || numchannels == 2); - uChannels = numchannels; - - storeBuffer.setChannels(uChannels); - tempBuffer.setChannels(uChannels); - outputBuffer.setChannels(uChannels); - - // Inits the linear interpolation registers - resetRegisters(); -} - - -// Clears all the samples in the object -void RateTransposer::clear() -{ - outputBuffer.clear(); - storeBuffer.clear(); -} - - -// Returns nonzero if there aren't any samples available for outputting. -uint RateTransposer::isEmpty() -{ - int res; - - res = FIFOProcessor::isEmpty(); - if (res == 0) return 0; - return storeBuffer.isEmpty(); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// RateTransposerInteger - integer arithmetic implementation -// - -/// fixed-point interpolation routine precision -#define SCALE 65536 - -// Constructor -RateTransposerInteger::RateTransposerInteger() : RateTransposer() -{ - // call these here as these are virtual functions; calling these - // from the base class constructor wouldn't execute the overloaded - // versions (peculiar C++ can be). - resetRegisters(); - setRate(1.0f); -} - - -RateTransposerInteger::~RateTransposerInteger() -{ -} - - -void RateTransposerInteger::resetRegisters() -{ - iSlopeCount = 0; - sPrevSampleL = - sPrevSampleR = 0; -} - - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerInteger::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int i, used; - LONG_SAMPLETYPE temp, vol1; - - used = 0; - i = 0; - - // Process the last sample saved from the previous call first... - while (iSlopeCount <= SCALE) - { - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; - dest[i] = (SAMPLETYPE)(temp / SCALE); - i++; - iSlopeCount += uRate; - } - // now always (iSlopeCount > SCALE) - iSlopeCount -= SCALE; - - while (1) - { - while (iSlopeCount > SCALE) - { - iSlopeCount -= SCALE; - used ++; - if (used >= numSamples - 1) goto end; - } - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = src[used] * vol1 + iSlopeCount * src[used + 1]; - dest[i] = (SAMPLETYPE)(temp / SCALE); - - i++; - iSlopeCount += uRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[numSamples - 1]; - - return i; -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Stereo' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerInteger::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int srcPos, i, used; - LONG_SAMPLETYPE temp, vol1; - - if (numSamples == 0) return 0; // no samples, no work - - used = 0; - i = 0; - - // Process the last sample saved from the sPrevSampleLious call first... - while (iSlopeCount <= SCALE) - { - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = vol1 * sPrevSampleL + iSlopeCount * src[0]; - dest[2 * i] = (SAMPLETYPE)(temp / SCALE); - temp = vol1 * sPrevSampleR + iSlopeCount * src[1]; - dest[2 * i + 1] = (SAMPLETYPE)(temp / SCALE); - i++; - iSlopeCount += uRate; - } - // now always (iSlopeCount > SCALE) - iSlopeCount -= SCALE; - - while (1) - { - while (iSlopeCount > SCALE) - { - iSlopeCount -= SCALE; - used ++; - if (used >= numSamples - 1) goto end; - } - srcPos = 2 * used; - vol1 = (LONG_SAMPLETYPE)(SCALE - iSlopeCount); - temp = src[srcPos] * vol1 + iSlopeCount * src[srcPos + 2]; - dest[2 * i] = (SAMPLETYPE)(temp / SCALE); - temp = src[srcPos + 1] * vol1 + iSlopeCount * src[srcPos + 3]; - dest[2 * i + 1] = (SAMPLETYPE)(temp / SCALE); - - i++; - iSlopeCount += uRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[2 * numSamples - 2]; - sPrevSampleR = src[2 * numSamples - 1]; - - return i; -} - - -// Sets new target uRate. Normal uRate = 1.0, smaller values represent slower -// uRate, larger faster uRates. -void RateTransposerInteger::setRate(float newRate) -{ - uRate = (int)(newRate * SCALE + 0.5f); - RateTransposer::setRate(newRate); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// RateTransposerFloat - floating point arithmetic implementation -// -////////////////////////////////////////////////////////////////////////////// - -// Constructor -RateTransposerFloat::RateTransposerFloat() : RateTransposer() -{ - // call these here as these are virtual functions; calling these - // from the base class constructor wouldn't execute the overloaded - // versions (peculiar C++ can be). - resetRegisters(); - setRate(1.0f); -} - - -RateTransposerFloat::~RateTransposerFloat() -{ -} - - -void RateTransposerFloat::resetRegisters() -{ - fSlopeCount = 0; - sPrevSampleL = - sPrevSampleR = 0; -} - - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerFloat::transposeMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int i, used; - - used = 0; - i = 0; - - // Process the last sample saved from the previous call first... - while (fSlopeCount <= 1.0f) - { - dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); - i++; - fSlopeCount += fRate; - } - fSlopeCount -= 1.0f; - - if (numSamples == 1) goto end; - - while (1) - { - while (fSlopeCount > 1.0f) - { - fSlopeCount -= 1.0f; - used ++; - if (used >= numSamples - 1) goto end; - } - dest[i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[used] + fSlopeCount * src[used + 1]); - i++; - fSlopeCount += fRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[numSamples - 1]; - - return i; -} - - -// Transposes the sample rate of the given samples using linear interpolation. -// 'Mono' version of the routine. Returns the number of samples returned in -// the "dest" buffer -uint RateTransposerFloat::transposeStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) -{ - unsigned int srcPos, i, used; - - if (numSamples == 0) return 0; // no samples, no work - - used = 0; - i = 0; - - // Process the last sample saved from the sPrevSampleLious call first... - while (fSlopeCount <= 1.0f) - { - dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleL + fSlopeCount * src[0]); - dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * sPrevSampleR + fSlopeCount * src[1]); - i++; - fSlopeCount += fRate; - } - // now always (iSlopeCount > 1.0f) - fSlopeCount -= 1.0f; - - if (numSamples == 1) goto end; - - while (1) - { - while (fSlopeCount > 1.0f) - { - fSlopeCount -= 1.0f; - used ++; - if (used >= numSamples - 1) goto end; - } - srcPos = 2 * used; - - dest[2 * i] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos] - + fSlopeCount * src[srcPos + 2]); - dest[2 * i + 1] = (SAMPLETYPE)((1.0f - fSlopeCount) * src[srcPos + 1] - + fSlopeCount * src[srcPos + 3]); - - i++; - fSlopeCount += fRate; - } -end: - // Store the last sample for the next round - sPrevSampleL = src[2 * numSamples - 2]; - sPrevSampleR = src[2 * numSamples - 1]; - - return i; -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.h b/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.h deleted file mode 100644 index 1cd6e9026d..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/RateTransposer.h +++ /dev/null @@ -1,162 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sample rate transposer. Changes sample rate by using linear interpolation -/// together with anti-alias filtering (first order interpolation with anti- -/// alias filtering should be quite adequate for this application). -/// -/// Use either of the derived classes of 'RateTransposerInteger' or -/// 'RateTransposerFloat' for corresponding integer/floating point tranposing -/// algorithm implementation. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: RateTransposer.h,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef RateTransposer_H -#define RateTransposer_H - -#include "AAFilter.h" -#include "FIFOSamplePipe.h" -#include "FIFOSampleBuffer.h" - -#include "STTypes.h" - -namespace soundtouch -{ - -/// A common linear samplerate transposer class. -/// -/// Note: Use function "RateTransposer::newInstance()" to create a new class -/// instance instead of the "new" operator; that function automatically -/// chooses a correct implementation depending on if integer or floating -/// arithmetics are to be used. -class RateTransposer : public FIFOProcessor -{ -protected: - /// Anti-alias filter object - AAFilter *pAAFilter; - - float fRate; - - uint uChannels; - - /// Buffer for collecting samples to feed the anti-alias filter between - /// two batches - FIFOSampleBuffer storeBuffer; - - /// Buffer for keeping samples between transposing & anti-alias filter - FIFOSampleBuffer tempBuffer; - - /// Output sample buffer - FIFOSampleBuffer outputBuffer; - - BOOL bUseAAFilter; - - void init(); - - virtual void resetRegisters() = 0; - - virtual uint transposeStereo(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) = 0; - virtual uint transposeMono(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples) = 0; - uint transpose(SAMPLETYPE *dest, - const SAMPLETYPE *src, - uint numSamples); - - void flushStoreBuffer(); - - void downsample(const SAMPLETYPE *src, - uint numSamples); - void upsample(const SAMPLETYPE *src, - uint numSamples); - - /// Transposes sample rate by applying anti-alias filter to prevent folding. - /// Returns amount of samples returned in the "dest" buffer. - /// The maximum amount of samples that can be returned at a time is set by - /// the 'set_returnBuffer_size' function. - void processSamples(const SAMPLETYPE *src, - uint numSamples); - - -public: - RateTransposer(); - virtual ~RateTransposer(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we're to use integer or floating point arithmetics. - void *operator new(size_t s); - - /// Use this function instead of "new" operator to create a new instance of this class. - /// This function automatically chooses a correct implementation, depending on if - /// integer ot floating point arithmetics are to be used. - static RateTransposer *newInstance(); - - /// Returns the output buffer object - FIFOSamplePipe *getOutput() { return &outputBuffer; }; - - /// Returns the store buffer object - FIFOSamplePipe *getStore() { return &storeBuffer; }; - - /// Return anti-alias filter object - AAFilter *getAAFilter() const; - - /// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable - void enableAAFilter(BOOL newMode); - - /// Returns nonzero if anti-alias filter is enabled. - BOOL isAAFilterEnabled() const; - - /// Sets new target rate. Normal rate = 1.0, smaller values represent slower - /// rate, larger faster rates. - virtual void setRate(float newRate); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint channels); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position into - /// the input of the object. - void putSamples(const SAMPLETYPE *samples, uint numSamples); - - /// Clears all the samples in the object - void clear(); - - /// Returns nonzero if there aren't any samples available for outputting. - uint isEmpty(); -}; - -} - -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/STTypes.h b/plugins/zerospu2/3rdparty/SoundTouch/STTypes.h deleted file mode 100644 index d0969ec1c9..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/STTypes.h +++ /dev/null @@ -1,202 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Common type definitions for SoundTouch audio processing library. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: STTypes.h,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef STTypes_H -#define STTypes_H - -//#define INTEGER_SAMPLES 1 - -typedef unsigned int uint; -typedef unsigned long ulong; - -#ifdef __x86_64__ -typedef unsigned long long ulongptr; -#else -typedef unsigned long ulongptr; -#endif - - -#ifdef __GNUC__ - // In GCC, include soundtouch_config.h made by config scritps -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Use Integer as Sample type */ -//#define INTEGER_SAMPLES 1 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -#endif - -#ifndef _WINDEF_ - // if these aren't defined already by Windows headers, define now - - typedef int BOOL; - -#ifndef FALSE - #define FALSE 0 -#endif - -#ifndef TRUE - #define TRUE 1 -#endif - -#endif // _WINDEF_ - - -namespace soundtouch -{ -/// Activate these undef's to overrule the possible sampletype -/// setting inherited from some other header file: -//#undef INTEGER_SAMPLES -//#undef FLOAT_SAMPLES - -#if !(INTEGER_SAMPLES || FLOAT_SAMPLES) - - /// Choose either 32bit floating point or 16bit integer sampletype - /// by choosing one of the following defines, unless this selection - /// has already been done in some other file. - //// - /// Notes: - /// - In Windows environment, choose the sample format with the - /// following defines. - /// - In GNU environment, the floating point samples are used by - /// default, but integer samples can be chosen by giving the - /// following switch to the configure script: - /// ./configure --enable-integer-samples - /// However, if you still prefer to select the sample format here - /// also in GNU environment, then please #undef the INTEGER_SAMPLE - /// and FLOAT_SAMPLE defines first as in comments above. - //#define INTEGER_SAMPLES 1 //< 16bit integer samples - #define FLOAT_SAMPLES 1 //< 32bit float samples - - #endif - - /// Define this to allow CPU-specific assembler optimizations. Notice that - /// having this enabled on non-x86 platforms doesn't matter; the compiler can - /// drop unsupported extensions on different platforms automatically. - /// However, if you're having difficulties getting the optimized routines - /// compiled with your compler (e.g. some gcc compiler versions may be picky), - /// you may wish to disable the optimizations to make the library compile. - #if !defined(_MSC_VER) || !defined(__x86_64__) - #define ALLOW_OPTIMIZATIONS 1 - #define ALLOW_NONEXACT_SIMD_OPTIMIZATION 1 - #endif - - - // If defined, allows the SIMD-optimized routines to take minor shortcuts - // for improved performance. Undefine to require faithfully similar SIMD - // calculations as in normal C implementation. - - - - #ifdef INTEGER_SAMPLES - // 16bit integer sample type - typedef short SAMPLETYPE; - // data type for sample accumulation: Use 32bit integer to prevent overflows - typedef long LONG_SAMPLETYPE; - - #ifdef FLOAT_SAMPLES - // check that only one sample type is defined - #error "conflicting sample types defined" - #endif // FLOAT_SAMPLES - - #ifdef ALLOW_OPTIMIZATIONS - #if (_WIN32 || __i386__ || __x86_64__) - // Allow MMX optimizations - #define ALLOW_MMX 1 - #endif - #endif - - #else - - // floating point samples - typedef float SAMPLETYPE; - // data type for sample accumulation: Use double to utilize full precision. - typedef double LONG_SAMPLETYPE; - - #ifdef ALLOW_OPTIMIZATIONS - // Allow 3DNow! and SSE optimizations - #if _WIN32 - // #define ALLOW_3DNOW 1 - #endif - - #if (_WIN32 || __i386__ || __x86_64__) - #define ALLOW_SSE 1 - #endif - #endif - - #endif // INTEGER_SAMPLES -}; - -#endif \ No newline at end of file diff --git a/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.cpp b/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.cpp deleted file mode 100644 index 381c517162..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.cpp +++ /dev/null @@ -1,474 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -/// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. -/// -/// Notes: -/// - Initialize the SoundTouch object instance by setting up the sound stream -/// parameters with functions 'setSampleRate' and 'setChannels', then set -/// desired tempo/pitch/rate settings with the corresponding functions. -/// -/// - The SoundTouch class behaves like a first-in-first-out pipeline: The -/// samples that are to be processed are fed into one of the pipe by calling -/// function 'putSamples', while the ready processed samples can be read -/// from the other end of the pipeline with function 'receiveSamples'. -/// -/// - The SoundTouch processing classes require certain sized 'batches' of -/// samples in order to process the sound. For this reason the classes buffer -/// incoming samples until there are enough of samples available for -/// processing, then they carry out the processing step and consequently -/// make the processed samples available for outputting. -/// -/// - For the above reason, the processing routines introduce a certain -/// 'latency' between the input and output, so that the samples input to -/// SoundTouch may not be immediately available in the output, and neither -/// the amount of outputtable samples may not immediately be in direct -/// relationship with the amount of previously input samples. -/// -/// - The tempo/pitch/rate control parameters can be altered during processing. -/// Please notice though that they aren't currently protected by semaphores, -/// so in multi-thread application external semaphore protection may be -/// required. -/// -/// - This class utilizes classes 'TDStretch' for tempo change (without modifying -/// pitch) and 'RateTransposer' for changing the playback rate (that is, both -/// tempo and pitch in the same ratio) of the sound. The third available control -/// 'pitch' (change pitch but maintain tempo) is produced by a combination of -/// combining the two other controls. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.13 $ -// -// $Id: SoundTouch.cpp,v 1.13 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include "SoundTouch.h" -#include "TDStretch.h" -#include "RateTransposer.h" -#include "cpu_detect.h" - -using namespace soundtouch; - -/// Print library version string -extern "C" void soundtouch_ac_test() -{ - printf("SoundTouch Version: %s\n",SOUNDTOUCH_VERSION); -} - - -SoundTouch::SoundTouch() -{ - // Initialize rate transposer and tempo changer instances - - pRateTransposer = RateTransposer::newInstance(); - pTDStretch = TDStretch::newInstance(); - - setOutPipe(pTDStretch); - - rate = tempo = 0; - - virtualPitch = - virtualRate = - virtualTempo = 1.0; - - calcEffectiveRateAndTempo(); - - channels = 0; - bSrateSet = FALSE; -} - - - -SoundTouch::~SoundTouch() -{ - delete pRateTransposer; - delete pTDStretch; -} - - - -/// Get SoundTouch library version string -const char *SoundTouch::getVersionString() -{ - static const char *_version = SOUNDTOUCH_VERSION; - - return _version; -} - - -/// Get SoundTouch library version Id -uint SoundTouch::getVersionId() -{ - return SOUNDTOUCH_VERSION_ID; -} - - -// Sets the number of channels, 1 = mono, 2 = stereo -void SoundTouch::setChannels(uint numChannels) -{ - if (numChannels != 1 && numChannels != 2) - { - throw std::runtime_error("Illegal number of channels"); - } - channels = numChannels; - pRateTransposer->setChannels(numChannels); - pTDStretch->setChannels(numChannels); -} - - - -// Sets new rate control value. Normal rate = 1.0, smaller values -// represent slower rate, larger faster rates. -void SoundTouch::setRate(float newRate) -{ - virtualRate = newRate; - calcEffectiveRateAndTempo(); -} - - - -// Sets new rate control value as a difference in percents compared -// to the original rate (-50 .. +100 %) -void SoundTouch::setRateChange(float newRate) -{ - virtualRate = 1.0f + 0.01f * newRate; - calcEffectiveRateAndTempo(); -} - - - -// Sets new tempo control value. Normal tempo = 1.0, smaller values -// represent slower tempo, larger faster tempo. -void SoundTouch::setTempo(float newTempo) -{ - virtualTempo = newTempo; - calcEffectiveRateAndTempo(); -} - - - -// Sets new tempo control value as a difference in percents compared -// to the original tempo (-50 .. +100 %) -void SoundTouch::setTempoChange(float newTempo) -{ - virtualTempo = 1.0f + 0.01f * newTempo; - calcEffectiveRateAndTempo(); -} - - - -// Sets new pitch control value. Original pitch = 1.0, smaller values -// represent lower pitches, larger values higher pitch. -void SoundTouch::setPitch(float newPitch) -{ - virtualPitch = newPitch; - calcEffectiveRateAndTempo(); -} - - - -// Sets pitch change in octaves compared to the original pitch -// (-1.00 .. +1.00) -void SoundTouch::setPitchOctaves(float newPitch) -{ - virtualPitch = (float)exp(0.69314718056f * newPitch); - calcEffectiveRateAndTempo(); -} - - - -// Sets pitch change in semi-tones compared to the original pitch -// (-12 .. +12) -void SoundTouch::setPitchSemiTones(int newPitch) -{ - setPitchOctaves((float)newPitch / 12.0f); -} - - - -void SoundTouch::setPitchSemiTones(float newPitch) -{ - setPitchOctaves(newPitch / 12.0f); -} - - -// Calculates 'effective' rate and tempo values from the -// nominal control values. -void SoundTouch::calcEffectiveRateAndTempo() -{ - float oldTempo = tempo; - float oldRate = rate; - - tempo = virtualTempo / virtualPitch; - rate = virtualPitch * virtualRate; - - if (rate != oldRate) pRateTransposer->setRate(rate); - if (tempo != oldTempo) pTDStretch->setTempo(tempo); - - if (rate > 1.0f) - { - if (output != pRateTransposer) - { - FIFOSamplePipe *transOut; - - assert(output == pTDStretch); - // move samples in the current output buffer to the output of pRateTransposer - transOut = pRateTransposer->getOutput(); - transOut->moveSamples(*output); - // move samples in tempo changer's input to pitch transposer's input - pRateTransposer->moveSamples(*pTDStretch->getInput()); - - output = pRateTransposer; - } - } - else - { - if (output != pTDStretch) - { - FIFOSamplePipe *tempoOut; - - assert(output == pRateTransposer); - // move samples in the current output buffer to the output of pTDStretch - tempoOut = pTDStretch->getOutput(); - tempoOut->moveSamples(*output); - // move samples in pitch transposer's store buffer to tempo changer's input - pTDStretch->moveSamples(*pRateTransposer->getStore()); - - output = pTDStretch; - - } - } -} - - -// Sets sample rate. -void SoundTouch::setSampleRate(uint srate) -{ - bSrateSet = TRUE; - // set sample rate, leave other tempo changer parameters as they are. - pTDStretch->setParameters(srate); -} - - -// Adds 'numSamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void SoundTouch::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - if (bSrateSet == FALSE) - { - throw std::runtime_error("SoundTouch : Sample rate not defined"); - } - else if (channels == 0) - { - throw std::runtime_error("SoundTouch : Number of channels not defined"); - } - - // Transpose the rate of the new samples if necessary - /* Bypass the nominal setting - can introduce a click in sound when tempo/pitch control crosses the nominal value... - if (rate == 1.0f) - { - // The rate value is same as the original, simply evaluate the tempo changer. - assert(output == pTDStretch); - if (pRateTransposer->isEmpty() == 0) - { - // yet flush the last samples in the pitch transposer buffer - // (may happen if 'rate' changes from a non-zero value to zero) - pTDStretch->moveSamples(*pRateTransposer); - } - pTDStretch->putSamples(samples, numSamples); - } - */ - else if (rate <= 1.0f) - { - // transpose the rate down, output the transposed sound to tempo changer buffer - assert(output == pTDStretch); - pRateTransposer->putSamples(samples, numSamples); - pTDStretch->moveSamples(*pRateTransposer); - } - else - { - assert(rate > 1.0f); - // evaluate the tempo changer, then transpose the rate up, - assert(output == pRateTransposer); - pTDStretch->putSamples(samples, numSamples); - pRateTransposer->moveSamples(*pTDStretch); - } -} - - -// Flushes the last samples from the processing pipeline to the output. -// Clears also the internal processing buffers. -// -// Note: This function is meant for extracting the last samples of a sound -// stream. This function may introduce additional blank samples in the end -// of the sound stream, and thus it's not recommended to call this function -// in the middle of a sound stream. -void SoundTouch::flush() -{ - int i; - uint nOut; - SAMPLETYPE buff[128]; - - nOut = numSamples(); - - memset(buff, 0, 128 * sizeof(SAMPLETYPE)); - // "Push" the last active samples out from the processing pipeline by - // feeding blank samples into the processing pipeline until new, - // processed samples appear in the output (not however, more than - // 8ksamples in any case) - for (i = 0; i < 128; i ++) - { - putSamples(buff, 64); - if (numSamples() != nOut) break; // new samples have appeared in the output! - } - - // Clear working buffers - pRateTransposer->clear(); - pTDStretch->clearInput(); - // yet leave the 'tempoChanger' output intouched as that's where the - // flushed samples are! -} - - -// Changes a setting controlling the processing system behaviour. See the -// 'SETTING_...' defines for available setting ID's. -BOOL SoundTouch::setSetting(uint settingId, uint value) -{ - uint sampleRate, sequenceMs, seekWindowMs, overlapMs; - - // read current tdstretch routine parameters - pTDStretch->getParameters(&sampleRate, &sequenceMs, &seekWindowMs, &overlapMs); - - switch (settingId) - { - case SETTING_USE_AA_FILTER : - // enables / disabless anti-alias filter - pRateTransposer->enableAAFilter((value != 0) ? TRUE : FALSE); - return TRUE; - - case SETTING_AA_FILTER_LENGTH : - // sets anti-alias filter length - pRateTransposer->getAAFilter()->setLength(value); - return TRUE; - - case SETTING_USE_QUICKSEEK : - // enables / disables tempo routine quick seeking algorithm - pTDStretch->enableQuickSeek((value != 0) ? TRUE : FALSE); - return TRUE; - - case SETTING_SEQUENCE_MS: - // change time-stretch sequence duration parameter - pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs); - return TRUE; - - case SETTING_SEEKWINDOW_MS: - // change time-stretch seek window length parameter - pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs); - return TRUE; - - case SETTING_OVERLAP_MS: - // change time-stretch overlap length parameter - pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value); - return TRUE; - - default : - return FALSE; - } -} - - -// Reads a setting controlling the processing system behaviour. See the -// 'SETTING_...' defines for available setting ID's. -// -// Returns the setting value. -uint SoundTouch::getSetting(uint settingId) const -{ - uint temp; - - switch (settingId) - { - case SETTING_USE_AA_FILTER : - return pRateTransposer->isAAFilterEnabled(); - - case SETTING_AA_FILTER_LENGTH : - return pRateTransposer->getAAFilter()->getLength(); - - case SETTING_USE_QUICKSEEK : - return pTDStretch->isQuickSeekEnabled(); - - case SETTING_SEQUENCE_MS: - pTDStretch->getParameters(NULL, &temp, NULL, NULL); - return temp; - - case SETTING_SEEKWINDOW_MS: - pTDStretch->getParameters(NULL, NULL, &temp, NULL); - return temp; - - case SETTING_OVERLAP_MS: - pTDStretch->getParameters(NULL, NULL, NULL, &temp); - return temp; - - default : - return 0; - } -} - - -// Clears all the samples in the object's output and internal processing -// buffers. -void SoundTouch::clear() -{ - pRateTransposer->clear(); - pTDStretch->clear(); -} - - - -/// Returns number of samples currently unprocessed. -uint SoundTouch::numUnprocessedSamples() const -{ - FIFOSamplePipe * psp; - if (pTDStretch) - { - psp = pTDStretch->getInput(); - if (psp) - { - return psp->numSamples(); - } - } - return 0; -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.h b/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.h deleted file mode 100644 index 9f3a152f26..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/SoundTouch.h +++ /dev/null @@ -1,252 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -/// -/// SoundTouch - main class for tempo/pitch/rate adjusting routines. -/// -/// Notes: -/// - Initialize the SoundTouch object instance by setting up the sound stream -/// parameters with functions 'setSampleRate' and 'setChannels', then set -/// desired tempo/pitch/rate settings with the corresponding functions. -/// -/// - The SoundTouch class behaves like a first-in-first-out pipeline: The -/// samples that are to be processed are fed into one of the pipe by calling -/// function 'putSamples', while the ready processed samples can be read -/// from the other end of the pipeline with function 'receiveSamples'. -/// -/// - The SoundTouch processing classes require certain sized 'batches' of -/// samples in order to process the sound. For this reason the classes buffer -/// incoming samples until there are enough of samples available for -/// processing, then they carry out the processing step and consequently -/// make the processed samples available for outputting. -/// -/// - For the above reason, the processing routines introduce a certain -/// 'latency' between the input and output, so that the samples input to -/// SoundTouch may not be immediately available in the output, and neither -/// the amount of outputtable samples may not immediately be in direct -/// relationship with the amount of previously input samples. -/// -/// - The tempo/pitch/rate control parameters can be altered during processing. -/// Please notice though that they aren't currently protected by semaphores, -/// so in multi-thread application external semaphore protection may be -/// required. -/// -/// - This class utilizes classes 'TDStretch' for tempo change (without modifying -/// pitch) and 'RateTransposer' for changing the playback rate (that is, both -/// tempo and pitch in the same ratio) of the sound. The third available control -/// 'pitch' (change pitch but maintain tempo) is produced by a combination of -/// combining the two other controls. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.14 $ -// -// $Id: SoundTouch.h,v 1.14 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef SoundTouch_H -#define SoundTouch_H - -#include "FIFOSamplePipe.h" -#include "STTypes.h" - -namespace soundtouch -{ - -/// Soundtouch library version string -#define SOUNDTOUCH_VERSION "1.3.1" - -/// SoundTouch library version id -#define SOUNDTOUCH_VERSION_ID 010301 - -// -// Available setting IDs for the 'setSetting' & 'get_setting' functions: - -/// Enable/disable anti-alias filter in pitch transposer (0 = disable) -#define SETTING_USE_AA_FILTER 0 - -/// Pitch transposer anti-alias filter length (8 .. 128 taps, default = 32) -#define SETTING_AA_FILTER_LENGTH 1 - -/// Enable/disable quick seeking algorithm in tempo changer routine -/// (enabling quick seeking lowers CPU utilization but causes a minor sound -/// quality compromising) -#define SETTING_USE_QUICKSEEK 2 - -/// Time-stretch algorithm single processing sequence length in milliseconds. This determines -/// to how long sequences the original sound is chopped in the time-stretch algorithm. -/// See "STTypes.h" or README for more information. -#define SETTING_SEQUENCE_MS 3 - -/// Time-stretch algorithm seeking window length in milliseconds for algorithm that finds the -/// best possible overlapping location. This determines from how wide window the algorithm -/// may look for an optimal joining location when mixing the sound sequences back together. -/// See "STTypes.h" or README for more information. -#define SETTING_SEEKWINDOW_MS 4 - -/// Time-stretch algorithm overlap length in milliseconds. When the chopped sound sequences -/// are mixed back together, to form a continuous sound stream, this parameter defines over -/// how long period the two consecutive sequences are let to overlap each other. -/// See "STTypes.h" or README for more information. -#define SETTING_OVERLAP_MS 5 - - -class SoundTouch : public FIFOProcessor -{ -private: - /// Rate transposer class instance - class RateTransposer *pRateTransposer; - - /// Time-stretch class instance - class TDStretch *pTDStretch; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualRate; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualTempo; - - /// Virtual pitch parameter. Effective rate & tempo are calculated from these parameters. - float virtualPitch; - - /// Flag: Has sample rate been set? - BOOL bSrateSet; - - /// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and - /// 'virtualPitch' parameters. - void calcEffectiveRateAndTempo(); - -protected : - /// Number of channels - uint channels; - - /// Effective 'rate' value calculated from 'virtualRate', 'virtualTempo' and 'virtualPitch' - float rate; - - /// Effective 'tempo' value calculated from 'virtualRate', 'virtualTempo' and 'virtualPitch' - float tempo; - -public: - SoundTouch(); - virtual ~SoundTouch(); - - /// Get SoundTouch library version string - static const char *getVersionString(); - - /// Get SoundTouch library version Id - static uint getVersionId(); - - /// Sets new rate control value. Normal rate = 1.0, smaller values - /// represent slower rate, larger faster rates. - void setRate(float newRate); - - /// Sets new tempo control value. Normal tempo = 1.0, smaller values - /// represent slower tempo, larger faster tempo. - void setTempo(float newTempo); - - /// Sets new rate control value as a difference in percents compared - /// to the original rate (-50 .. +100 %) - void setRateChange(float newRate); - - /// Sets new tempo control value as a difference in percents compared - /// to the original tempo (-50 .. +100 %) - void setTempoChange(float newTempo); - - /// Sets new pitch control value. Original pitch = 1.0, smaller values - /// represent lower pitches, larger values higher pitch. - void setPitch(float newPitch); - - /// Sets pitch change in octaves compared to the original pitch - /// (-1.00 .. +1.00) - void setPitchOctaves(float newPitch); - - /// Sets pitch change in semi-tones compared to the original pitch - /// (-12 .. +12) - void setPitchSemiTones(int newPitch); - void setPitchSemiTones(float newPitch); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint numChannels); - - /// Sets sample rate. - void setSampleRate(uint srate); - - /// Flushes the last samples from the processing pipeline to the output. - /// Clears also the internal processing buffers. - // - /// Note: This function is meant for extracting the last samples of a sound - /// stream. This function may introduce additional blank samples in the end - /// of the sound stream, and thus it's not recommended to call this function - /// in the middle of a sound stream. - void flush(); - - /// Adds 'numSamples' pcs of samples from the 'samples' memory position into - /// the input of the object. Notice that sample rate _has_to_ be set before - /// calling this function, otherwise throws a runtime_error exception. - virtual void putSamples( - const SAMPLETYPE *samples, ///< Pointer to sample buffer. - uint numSamples ///< Number of samples in buffer. Notice - ///< that in case of stereo-sound a single sample - ///< contains data for both channels. - ); - - /// Clears all the samples in the object's output and internal processing - /// buffers. - virtual void clear(); - - /// Changes a setting controlling the processing system behaviour. See the - /// 'SETTING_...' defines for available setting ID's. - /// - /// \return 'TRUE' if the setting was succesfully changed - BOOL setSetting(uint settingId, ///< Setting ID number. see SETTING_... defines. - uint value ///< New setting value. - ); - - /// Reads a setting controlling the processing system behaviour. See the - /// 'SETTING_...' defines for available setting ID's. - /// - /// \return the setting value. - uint getSetting(uint settingId ///< Setting ID number, see SETTING_... defines. - ) const; - - /// Returns number of samples currently unprocessed. - virtual uint numUnprocessedSamples() const; - - - /// Other handy functions that are implemented in the ancestor classes (see - /// classes 'FIFOProcessor' and 'FIFOSamplePipe') - /// - /// - receiveSamples() : Use this function to receive 'ready' processed samples from SoundTouch. - /// - numSamples() : Get number of 'ready' samples that can be received with - /// function 'receiveSamples()' - /// - isEmpty() : Returns nonzero if there aren't any 'ready' samples. - /// - clear() : Clears all samples from ready/processing buffers. -}; - -} -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.cpp b/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.cpp deleted file mode 100644 index 339c7378fb..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.cpp +++ /dev/null @@ -1,940 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like -/// method with several performance-increasing tweaks. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific -/// file, e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.24 $ -// -// $Id: TDStretch.cpp,v 1.24 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include "STTypes.h" -#include "cpu_detect.h" -#include "TDStretch.h" - -using namespace soundtouch; - -#ifndef min -#define min(a,b) ((a > b) ? b : a) -#define max(a,b) ((a < b) ? b : a) -#endif - - - -/***************************************************************************** - * - * Constant definitions - * - *****************************************************************************/ - - -// Table for the hierarchical mixing position seeking algorithm -int scanOffsets[4][24]={ - { 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806, - 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0}, - {-100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; - -/***************************************************************************** - * - * Implementation of the class 'TDStretch' - * - *****************************************************************************/ - - -TDStretch::TDStretch() : FIFOProcessor(&outputBuffer) -{ - bQuickseek = FALSE; - channels = 2; - bMidBufferDirty = FALSE; - - pMidBuffer = NULL; - pRefMidBufferUnaligned = NULL; - overlapLength = 0; - - setParameters(48000, DEFAULT_SEQUENCE_MS, DEFAULT_SEEKWINDOW_MS, DEFAULT_OVERLAP_MS); - - setTempo(1.0f); -} - - - - -TDStretch::~TDStretch() -{ - delete[] pMidBuffer; - delete[] pRefMidBufferUnaligned; -} - - - -// Calculates the x having the closest 2^x value for the given value -static int _getClosest2Power(double value) -{ - return (int)(log(value) / log(2.0) + 0.5); -} - - - -// Sets routine control parameters. These control are certain time constants -// defining how the sound is stretched to the desired duration. -// -// 'sampleRate' = sample rate of the sound -// 'sequenceMS' = one processing sequence length in milliseconds (default = 82 ms) -// 'seekwindowMS' = seeking window length for scanning the best overlapping -// position (default = 28 ms) -// 'overlapMS' = overlapping length (default = 12 ms) - -void TDStretch::setParameters(uint aSampleRate, uint aSequenceMS, - uint aSeekWindowMS, uint aOverlapMS) -{ - this->sampleRate = aSampleRate; - this->sequenceMs = aSequenceMS; - this->seekWindowMs = aSeekWindowMS; - this->overlapMs = aOverlapMS; - - seekLength = (sampleRate * seekWindowMs) / 1000; - seekWindowLength = (sampleRate * sequenceMs) / 1000; - - maxOffset = seekLength; - - calculateOverlapLength(overlapMs); - - // set tempo to recalculate 'sampleReq' - setTempo(tempo); - -} - - - -/// Get routine control parameters, see setParameters() function. -/// Any of the parameters to this function can be NULL, in such case corresponding parameter -/// value isn't returned. -void TDStretch::getParameters(uint *pSampleRate, uint *pSequenceMs, uint *pSeekWindowMs, uint *pOverlapMs) -{ - if (pSampleRate) - { - *pSampleRate = sampleRate; - } - - if (pSequenceMs) - { - *pSequenceMs = sequenceMs; - } - - if (pSeekWindowMs) - { - *pSeekWindowMs = seekWindowMs; - } - - if (pOverlapMs) - { - *pOverlapMs = overlapMs; - } -} - - -// Overlaps samples in 'midBuffer' with the samples in 'input' -void TDStretch::overlapMono(SAMPLETYPE *output, const SAMPLETYPE *input) const -{ - int i, itemp; - - for (i = 0; i < (int)overlapLength ; i ++) - { - itemp = overlapLength - i; - output[i] = (input[i] * i + pMidBuffer[i] * itemp ) / overlapLength; // >> overlapDividerBits; - } -} - - - -void TDStretch::clearMidBuffer() -{ - if (bMidBufferDirty) - { - memset(pMidBuffer, 0, 2 * sizeof(SAMPLETYPE) * overlapLength); - bMidBufferDirty = FALSE; - } -} - - -void TDStretch::clearInput() -{ - inputBuffer.clear(); - clearMidBuffer(); -} - - -// Clears the sample buffers -void TDStretch::clear() -{ - outputBuffer.clear(); - inputBuffer.clear(); - clearMidBuffer(); -} - - - -// Enables/disables the quick position seeking algorithm. Zero to disable, nonzero -// to enable -void TDStretch::enableQuickSeek(BOOL enable) -{ - bQuickseek = enable; -} - - -// Returns nonzero if the quick seeking algorithm is enabled. -BOOL TDStretch::isQuickSeekEnabled() const -{ - return bQuickseek; -} - - -// Seeks for the optimal overlap-mixing position. -uint TDStretch::seekBestOverlapPosition(const SAMPLETYPE *refPos) -{ - if (channels == 2) - { - // stereo sound - if (bQuickseek) - { - return seekBestOverlapPositionStereoQuick(refPos); - } - else - { - return seekBestOverlapPositionStereo(refPos); - } - } - else - { - // mono sound - if (bQuickseek) - { - return seekBestOverlapPositionMonoQuick(refPos); - } - else - { - return seekBestOverlapPositionMono(refPos); - } - } -} - - - - -// Overlaps samples in 'midBuffer' with the samples in 'inputBuffer' at position -// of 'ovlPos'. -inline void TDStretch::overlap(SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const -{ - if (channels == 2) - { - // stereo sound - overlapStereo(output, input + 2 * ovlPos); - } else { - // mono sound. - overlapMono(output, input + ovlPos); - } -} - - - - -// Seeks for the optimal overlap-mixing position. The 'stereo' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionStereo(const SAMPLETYPE *refPos) -{ - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint i; - - // Slopes the amplitudes of the 'midBuffer' samples - precalcCorrReferenceStereo(); - - bestCorr = INT_MIN; - bestOffs = 0; - - // Scans for the best correlation value by testing each possible position - // over the permitted range. - for (i = 0; i < seekLength; i ++) - { - // Calculates correlation value for the mixing position corresponding - // to 'i' - corr = calcCrossCorrStereo(refPos + 2 * i, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = i; - } - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -// Seeks for the optimal overlap-mixing position. The 'stereo' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos) -{ - uint j; - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint scanCount, corrOffset, tempOffset; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceStereo(); - - bestCorr = INT_MIN; - bestOffs = 0; - corrOffset = 0; - tempOffset = 0; - - // Scans for the best correlation value using four-pass hierarchical search. - // - // The look-up table 'scans' has hierarchical position adjusting steps. - // In first pass the routine searhes for the highest correlation with - // relatively coarse steps, then rescans the neighbourhood of the highest - // correlation with better resolution and so on. - for (scanCount = 0;scanCount < 4; scanCount ++) - { - j = 0; - while (scanOffsets[scanCount][j]) - { - tempOffset = corrOffset + scanOffsets[scanCount][j]; - if (tempOffset >= seekLength) break; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrStereo(refPos + 2 * tempOffset, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - j ++; - } - corrOffset = bestOffs; - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - - -// Seeks for the optimal overlap-mixing position. The 'mono' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionMono(const SAMPLETYPE *refPos) -{ - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint tempOffset; - const SAMPLETYPE *compare; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceMono(); - - bestCorr = INT_MIN; - bestOffs = 0; - - // Scans for the best correlation value by testing each possible position - // over the permitted range. - for (tempOffset = 0; tempOffset < seekLength; tempOffset ++) - { - compare = refPos + tempOffset; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrMono(pRefMidBuffer, compare); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -// Seeks for the optimal overlap-mixing position. The 'mono' version of the -// routine -// -// The best position is determined as the position where the two overlapped -// sample sequences are 'most alike', in terms of the highest cross-correlation -// value over the overlapping period -uint TDStretch::seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos) -{ - uint j; - uint bestOffs; - LONG_SAMPLETYPE bestCorr, corr; - uint scanCount, corrOffset, tempOffset; - - // Slopes the amplitude of the 'midBuffer' samples - precalcCorrReferenceMono(); - - bestCorr = INT_MIN; - bestOffs = 0; - corrOffset = 0; - tempOffset = 0; - - // Scans for the best correlation value using four-pass hierarchical search. - // - // The look-up table 'scans' has hierarchical position adjusting steps. - // In first pass the routine searhes for the highest correlation with - // relatively coarse steps, then rescans the neighbourhood of the highest - // correlation with better resolution and so on. - for (scanCount = 0;scanCount < 4; scanCount ++) - { - j = 0; - while (scanOffsets[scanCount][j]) - { - tempOffset = corrOffset + scanOffsets[scanCount][j]; - if (tempOffset >= seekLength) break; - - // Calculates correlation value for the mixing position corresponding - // to 'tempOffset' - corr = calcCrossCorrMono(refPos + tempOffset, pRefMidBuffer); - - // Checks for the highest correlation value - if (corr > bestCorr) - { - bestCorr = corr; - bestOffs = tempOffset; - } - j ++; - } - corrOffset = bestOffs; - } - // clear cross correlation routine state if necessary (is so e.g. in MMX routines). - clearCrossCorrState(); - - return bestOffs; -} - - -/// clear cross correlation routine state if necessary -void TDStretch::clearCrossCorrState() -{ - // default implementation is empty. -} - - -// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower -// tempo, larger faster tempo. -void TDStretch::setTempo(float newTempo) -{ - uint intskip; - - tempo = newTempo; - - // Calculate ideal skip length (according to tempo value) - nominalSkip = tempo * (seekWindowLength - overlapLength); - skipFract = 0; - intskip = (int)(nominalSkip + 0.5f); - - // Calculate how many samples are needed in the 'inputBuffer' to - // process another batch of samples - sampleReq = max(intskip + overlapLength, seekWindowLength) + maxOffset; -} - - - -// Sets the number of channels, 1 = mono, 2 = stereo -void TDStretch::setChannels(uint numChannels) -{ - if (channels == numChannels) return; - assert(numChannels == 1 || numChannels == 2); - - channels = numChannels; - inputBuffer.setChannels(channels); - outputBuffer.setChannels(channels); -} - - -// nominal tempo, no need for processing, just pass the samples through -// to outputBuffer -void TDStretch::processNominalTempo() -{ - assert(tempo == 1.0f); - - if (bMidBufferDirty) - { - // If there are samples in pMidBuffer waiting for overlapping, - // do a single sliding overlapping with them in order to prevent a - // clicking distortion in the output sound - if (inputBuffer.numSamples() < overlapLength) - { - // wait until we've got overlapLength input samples - return; - } - // Mix the samples in the beginning of 'inputBuffer' with the - // samples in 'midBuffer' using sliding overlapping - overlap(outputBuffer.ptrEnd(overlapLength), inputBuffer.ptrBegin(), 0); - outputBuffer.putSamples(overlapLength); - inputBuffer.receiveSamples(overlapLength); - clearMidBuffer(); - // now we've caught the nominal sample flow and may switch to - // bypass mode - } - - // Simply bypass samples from input to output - outputBuffer.moveSamples(inputBuffer); -} - - -// Processes as many processing frames of the samples 'inputBuffer', store -// the result into 'outputBuffer' -void TDStretch::processSamples() -{ - uint ovlSkip, offset; - int temp; - - /* Removed this small optimization - can introduce a click to sound when tempo setting - crosses the nominal value - if (tempo == 1.0f) - { - // tempo not changed from the original, so bypass the processing - processNominalTempo(); - return; - } - */ - - if (bMidBufferDirty == FALSE) - { - // if midBuffer is empty, move the first samples of the input stream - // into it - if (inputBuffer.numSamples() < overlapLength) - { - // wait until we've got overlapLength samples - return; - } - memcpy(pMidBuffer, inputBuffer.ptrBegin(), channels * overlapLength * sizeof(SAMPLETYPE)); - inputBuffer.receiveSamples(overlapLength); - bMidBufferDirty = TRUE; - } - - // Process samples as long as there are enough samples in 'inputBuffer' - // to form a processing frame. - while (inputBuffer.numSamples() >= sampleReq) - { - // If tempo differs from the normal ('SCALE'), scan for the best overlapping - // position - offset = seekBestOverlapPosition(inputBuffer.ptrBegin()); - - // Mix the samples in the 'inputBuffer' at position of 'offset' with the - // samples in 'midBuffer' using sliding overlapping - // ... first partially overlap with the end of the previous sequence - // (that's in 'midBuffer') - overlap(outputBuffer.ptrEnd(overlapLength), inputBuffer.ptrBegin(), offset); - outputBuffer.putSamples(overlapLength); - - // ... then copy sequence samples from 'inputBuffer' to output - temp = (seekWindowLength - 2 * overlapLength);// & 0xfffffffe; - if (temp > 0) - { - outputBuffer.putSamples(inputBuffer.ptrBegin() + channels * (offset + overlapLength), temp); - } - - // Copies the end of the current sequence from 'inputBuffer' to - // 'midBuffer' for being mixed with the beginning of the next - // processing sequence and so on - assert(offset + seekWindowLength <= inputBuffer.numSamples()); - memcpy(pMidBuffer, inputBuffer.ptrBegin() + channels * (offset + seekWindowLength - overlapLength), - channels * sizeof(SAMPLETYPE) * overlapLength); - bMidBufferDirty = TRUE; - - // Remove the processed samples from the input buffer. Update - // the difference between integer & nominal skip step to 'skipFract' - // in order to prevent the error from accumulating over time. - skipFract += nominalSkip; // real skip size - ovlSkip = (int)skipFract; // rounded to integer skip - skipFract -= ovlSkip; // maintain the fraction part, i.e. real vs. integer skip - inputBuffer.receiveSamples(ovlSkip); - } -} - - -// Adds 'numsamples' pcs of samples from the 'samples' memory position into -// the input of the object. -void TDStretch::putSamples(const SAMPLETYPE *samples, uint numSamples) -{ - // Add the samples into the input buffer - inputBuffer.putSamples(samples, numSamples); - // Process the samples in input buffer - processSamples(); -} - - - -/// Set new overlap length parameter & reallocate RefMidBuffer if necessary. -void TDStretch::acceptNewOverlapLength(uint newOverlapLength) -{ - uint prevOvl; - - prevOvl = overlapLength; - overlapLength = newOverlapLength; - - if (overlapLength > prevOvl) - { - delete[] pMidBuffer; - delete[] pRefMidBufferUnaligned; - - pMidBuffer = new SAMPLETYPE[overlapLength * 2]; - bMidBufferDirty = TRUE; - clearMidBuffer(); - - pRefMidBufferUnaligned = new SAMPLETYPE[2 * overlapLength + 16 / sizeof(SAMPLETYPE)]; - // ensure that 'pRefMidBuffer' is aligned to 16 byte boundary for efficiency - pRefMidBuffer = (SAMPLETYPE *)((((ulongptr)pRefMidBufferUnaligned) + 15) & -16); - } -} - - -// Operator 'new' is overloaded so that it automatically creates a suitable instance -// depending on if we've a MMX/SSE/etc-capable CPU available or not. -void * TDStretch::operator new(size_t s) -{ - // Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead! - assert(FALSE); - return NULL; -} - - -TDStretch * TDStretch::newInstance() -{ - uint uExtensions = 0; - -#if !defined(_MSC_VER) || !defined(__x86_64__) - uExtensions = detectCPUextensions(); -#endif - - // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU - -#ifdef ALLOW_MMX - // MMX routines available only with integer sample types - if (uExtensions & SUPPORT_MMX) - { - return ::new TDStretchMMX; - } - else -#endif // ALLOW_MMX - - -#ifdef ALLOW_SSE - if (uExtensions & SUPPORT_SSE) - { - // SSE support - return ::new TDStretchSSE; - } - else -#endif // ALLOW_SSE - - -#ifdef ALLOW_3DNOW - if (uExtensions & SUPPORT_3DNOW) - { - // 3DNow! support - return ::new TDStretch3DNow; - } - else -#endif // ALLOW_3DNOW - - { - // ISA optimizations not supported, use plain C version - return ::new TDStretch; - } -} - - -////////////////////////////////////////////////////////////////////////////// -// -// Integer arithmetics specific algorithm implementations. -// -////////////////////////////////////////////////////////////////////////////// - -#ifdef INTEGER_SAMPLES - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceStereo() -{ - int i, cnt2; - int temp, temp2; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = i * (overlapLength - i); - cnt2 = i * 2; - - temp2 = (pMidBuffer[cnt2] * temp) / slopingDivider; - pRefMidBuffer[cnt2] = (short)(temp2); - temp2 = (pMidBuffer[cnt2 + 1] * temp) / slopingDivider; - pRefMidBuffer[cnt2 + 1] = (short)(temp2); - } -} - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceMono() -{ - int i; - long temp; - long temp2; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = i * (overlapLength - i); - temp2 = (pMidBuffer[i] * temp) / slopingDivider; - pRefMidBuffer[i] = (short)temp2; - } -} - - -// Overlaps samples in 'midBuffer' with the samples in 'input'. The 'Stereo' -// version of the routine. -void TDStretch::overlapStereo(short *output, const short *input) const -{ - int i; - short temp; - uint cnt2; - - for (i = 0; i < (int)overlapLength ; i ++) - { - temp = (short)(overlapLength - i); - cnt2 = 2 * i; - output[cnt2] = (input[cnt2] * i + pMidBuffer[cnt2] * temp ) / overlapLength; - output[cnt2 + 1] = (input[cnt2 + 1] * i + pMidBuffer[cnt2 + 1] * temp ) / overlapLength; - } -} - - -/// Calculates overlap period length in samples. -/// Integer version rounds overlap length to closest power of 2 -/// for a divide scaling operation. -void TDStretch::calculateOverlapLength(uint overlapMs) -{ - uint newOvl; - - overlapDividerBits = _getClosest2Power((sampleRate * overlapMs) / 1000.0); - if (overlapDividerBits > 9) overlapDividerBits = 9; - if (overlapDividerBits < 4) overlapDividerBits = 4; - newOvl = 1<> overlapDividerBits; - } - - return corr; -} - - -long TDStretch::calcCrossCorrStereo(const short *mixingPos, const short *compare) const -{ - long corr; - uint i; - - corr = 0; - for (i = 2; i < 2 * overlapLength; i += 2) - { - corr += (mixingPos[i] * compare[i] + - mixingPos[i + 1] * compare[i + 1]) >> overlapDividerBits; - } - - return corr; -} - -#endif // INTEGER_SAMPLES - -////////////////////////////////////////////////////////////////////////////// -// -// Floating point arithmetics specific algorithm implementations. -// - -#ifdef FLOAT_SAMPLES - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceStereo() -{ - int i, cnt2; - float temp; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = (float)i * (float)(overlapLength - i); - cnt2 = i * 2; - pRefMidBuffer[cnt2] = (float)(pMidBuffer[cnt2] * temp); - pRefMidBuffer[cnt2 + 1] = (float)(pMidBuffer[cnt2 + 1] * temp); - } -} - - -// Slopes the amplitude of the 'midBuffer' samples so that cross correlation -// is faster to calculate -void TDStretch::precalcCorrReferenceMono() -{ - int i; - float temp; - - for (i=0 ; i < (int)overlapLength ;i ++) - { - temp = (float)i * (float)(overlapLength - i); - pRefMidBuffer[i] = (float)(pMidBuffer[i] * temp); - } -} - - -// SSE-optimized version of the function overlapStereo -void TDStretch::overlapStereo(float *output, const float *input) const -{ - int i; - uint cnt2; - float fTemp; - float fScale; - float fi; - - fScale = 1.0f / (float)overlapLength; - - for (i = 0; i < (int)overlapLength ; i ++) - { - fTemp = (float)(overlapLength - i) * fScale; - fi = (float)i * fScale; - cnt2 = 2 * i; - output[cnt2 + 0] = input[cnt2 + 0] * fi + pMidBuffer[cnt2 + 0] * fTemp; - output[cnt2 + 1] = input[cnt2 + 1] * fi + pMidBuffer[cnt2 + 1] * fTemp; - } -} - - -/// Calculates overlap period length in samples. -void TDStretch::calculateOverlapLength(uint overlapMs) -{ - uint newOvl; - - newOvl = (sampleRate * overlapMs) / 1000; - if (newOvl < 16) newOvl = 16; - - // must be divisible by 8 - newOvl -= newOvl % 8; - - acceptNewOverlapLength(newOvl); -} - - - -double TDStretch::calcCrossCorrMono(const float *mixingPos, const float *compare) const -{ - double corr; - uint i; - - corr = 0; - for (i = 1; i < overlapLength; i ++) - { - corr += mixingPos[i] * compare[i]; - } - - return corr; -} - - -double TDStretch::calcCrossCorrStereo(const float *mixingPos, const float *compare) const -{ - double corr; - uint i; - - corr = 0; - for (i = 2; i < 2 * overlapLength; i += 2) - { - corr += mixingPos[i] * compare[i] + - mixingPos[i + 1] * compare[i + 1]; - } - - return corr; -} - -#endif // FLOAT_SAMPLES diff --git a/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.h b/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.h deleted file mode 100644 index 133c227d49..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/TDStretch.h +++ /dev/null @@ -1,236 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Sampled sound tempo changer/time stretch algorithm. Changes the sound tempo -/// while maintaining the original pitch by using a time domain WSOLA-like method -/// with several performance-increasing tweaks. -/// -/// Note : MMX optimized functions reside in a separate, platform-specific file, -/// e.g. 'mmx_win.cpp' or 'mmx_gcc.cpp' -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.16 $ -// -// $Id: TDStretch.h,v 1.16 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef TDStretch_H -#define TDStretch_H - -#include "STTypes.h" -#include "RateTransposer.h" -#include "FIFOSamplePipe.h" - -namespace soundtouch -{ - -// Default values for sound processing parameters: - -/// Default length of a single processing sequence, in milliseconds. This determines to how -/// long sequences the original sound is chopped in the time-stretch algorithm. -/// -/// The larger this value is, the lesser sequences are used in processing. In principle -/// a bigger value sounds better when slowing down tempo, but worse when increasing tempo -/// and vice versa. -/// -/// Increasing this value reduces computational burden & vice versa. -#define DEFAULT_SEQUENCE_MS 61 - -#define DEFAULT_SEEKWINDOW_MS 18 - -#define DEFAULT_OVERLAP_MS 7 - - -/// Class that does the time-stretch (tempo change) effect for the processed -/// sound. -class TDStretch : public FIFOProcessor -{ -protected: - uint channels; - uint sampleReq; - float tempo; - - SAMPLETYPE *pMidBuffer; - SAMPLETYPE *pRefMidBuffer; - SAMPLETYPE *pRefMidBufferUnaligned; - uint overlapLength; - uint overlapDividerBits; - uint slopingDivider; - uint seekLength; - uint seekWindowLength; - uint maxOffset; - float nominalSkip; - float skipFract; - FIFOSampleBuffer outputBuffer; - FIFOSampleBuffer inputBuffer; - BOOL bQuickseek; - BOOL bMidBufferDirty; - - uint sampleRate; - uint sequenceMs; - uint seekWindowMs; - uint overlapMs; - - void acceptNewOverlapLength(uint newOverlapLength); - - virtual void clearCrossCorrState(); - void calculateOverlapLength(uint overlapMs); - - virtual LONG_SAMPLETYPE calcCrossCorrStereo(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const; - virtual LONG_SAMPLETYPE calcCrossCorrMono(const SAMPLETYPE *mixingPos, const SAMPLETYPE *compare) const; - - virtual uint seekBestOverlapPositionStereo(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionStereoQuick(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionMono(const SAMPLETYPE *refPos); - virtual uint seekBestOverlapPositionMonoQuick(const SAMPLETYPE *refPos); - uint seekBestOverlapPosition(const SAMPLETYPE *refPos); - - virtual void overlapStereo(SAMPLETYPE *output, const SAMPLETYPE *input) const; - virtual void overlapMono(SAMPLETYPE *output, const SAMPLETYPE *input) const; - - void clearMidBuffer(); - void overlap(SAMPLETYPE *output, const SAMPLETYPE *input, uint ovlPos) const; - - void precalcCorrReferenceMono(); - void precalcCorrReferenceStereo(); - - void processNominalTempo(); - - /// Changes the tempo of the given sound samples. - /// Returns amount of samples returned in the "output" buffer. - /// The maximum amount of samples that can be returned at a time is set by - /// the 'set_returnBuffer_size' function. - void processSamples(); - -public: - TDStretch(); - virtual ~TDStretch(); - - /// Operator 'new' is overloaded so that it automatically creates a suitable instance - /// depending on if we've a MMX/SSE/etc-capable CPU available or not. - void *operator new(size_t s); - - /// Use this function instead of "new" operator to create a new instance of this class. - /// This function automatically chooses a correct feature set depending on if the CPU - /// supports MMX/SSE/etc extensions. - static TDStretch *newInstance(); - - /// Returns the output buffer object - FIFOSamplePipe *getOutput() { return &outputBuffer; }; - - /// Returns the input buffer object - FIFOSamplePipe *getInput() { return &inputBuffer; }; - - /// Sets new target tempo. Normal tempo = 'SCALE', smaller values represent slower - /// tempo, larger faster tempo. - void setTempo(float newTempo); - - /// Returns nonzero if there aren't any samples available for outputting. - virtual void clear(); - - /// Clears the input buffer - void clearInput(); - - /// Sets the number of channels, 1 = mono, 2 = stereo - void setChannels(uint numChannels); - - /// Enables/disables the quick position seeking algorithm. Zero to disable, - /// nonzero to enable - void enableQuickSeek(BOOL enable); - - /// Returns nonzero if the quick seeking algorithm is enabled. - BOOL isQuickSeekEnabled() const; - - /// Sets routine control parameters. These control are certain time constants - /// defining how the sound is stretched to the desired duration. - // - /// 'sampleRate' = sample rate of the sound - /// 'sequenceMS' = one processing sequence length in milliseconds - /// 'seekwindowMS' = seeking window length for scanning the best overlapping - /// position - /// 'overlapMS' = overlapping length - void setParameters(uint sampleRate, ///< Samplerate of sound being processed (Hz) - uint sequenceMS = DEFAULT_SEQUENCE_MS, ///< Single processing sequence length (ms) - uint seekwindowMS = DEFAULT_SEEKWINDOW_MS, ///< Offset seeking window length (ms) - uint overlapMS = DEFAULT_OVERLAP_MS ///< Sequence overlapping length (ms) - ); - - /// Get routine control parameters, see setParameters() function. - /// Any of the parameters to this function can be NULL, in such case corresponding parameter - /// value isn't returned. - void getParameters(uint *pSampleRate, uint *pSequenceMs, uint *pSeekWindowMs, uint *pOverlapMs); - - /// Adds 'numsamples' pcs of samples from the 'samples' memory position into - /// the input of the object. - virtual void putSamples( - const SAMPLETYPE *samples, ///< Input sample data - uint numSamples ///< Number of samples in 'samples' so that one sample - ///< contains both channels if stereo - ); -}; - - - -// Implementation-specific class declarations: - -//#ifdef ALLOW_MMX -// /// Class that implements MMX optimized routines for 16bit integer samples type. -// class TDStretchMMX : public TDStretch -// { -// protected: -// long calcCrossCorrStereo(const short *mixingPos, const short *compare) const; -// virtual void overlapStereo(short *output, const short *input) const; -// virtual void clearCrossCorrState(); -// }; -//#endif /// ALLOW_MMX -// -// -//#ifdef ALLOW_3DNOW -// /// Class that implements 3DNow! optimized routines for floating point samples type. -// class TDStretch3DNow : public TDStretch -// { -// protected: -// double calcCrossCorrStereo(const float *mixingPos, const float *compare) const; -// }; -//#endif /// ALLOW_3DNOW - - -#ifdef ALLOW_SSE - /// Class that implements SSE optimized routines for floating point samples type. - class TDStretchSSE : public TDStretch - { - protected: - double calcCrossCorrStereo(const float *mixingPos, const float *compare) const; - }; - -#endif /// ALLOW_SSE - -} -#endif /// TDStretch_H diff --git a/plugins/zerospu2/3rdparty/SoundTouch/WavFile.cpp b/plugins/zerospu2/3rdparty/SoundTouch/WavFile.cpp deleted file mode 100644 index 15a679871c..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/WavFile.cpp +++ /dev/null @@ -1,714 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Classes for easy reading & writing of WAV sound files. -/// -/// For big-endian CPU, define _BIG_ENDIAN_ during compile-time to correctly -/// parse the WAV files with such processors. -/// -/// Admittingly, more complete WAV reader routines may exist in public domain, -/// but the reason for 'yet another' one is that those generic WAV reader -/// libraries are exhaustingly large and cumbersome! Wanted to have something -/// simpler here, i.e. something that's not already larger than rest of the -/// SoundTouch/SoundStretch program... -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.15 $ -// -// $Id: WavFile.cpp,v 1.15 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -#include -#include - -#include "WavFile.h" - -using namespace std; - -const static char riffStr[] = "RIFF"; -const static char waveStr[] = "WAVE"; -const static char fmtStr[] = "fmt "; -const static char dataStr[] = "data"; - - -////////////////////////////////////////////////////////////////////////////// -// -// Helper functions for swapping byte order to correctly read/write WAV files -// with big-endian CPU's: Define compile-time definition _BIG_ENDIAN_ to -// turn-on the conversion if it appears necessary. -// -// For example, Intel x86 is little-endian and doesn't require conversion, -// while PowerPC of Mac's and many other RISC cpu's are big-endian. - -#ifdef BYTE_ORDER - // In gcc compiler detect the byte order automatically - #if BYTE_ORDER == BIG_ENDIAN - // big-endian platform. - #define _BIG_ENDIAN_ - #endif -#endif - -#ifdef _BIG_ENDIAN_ - // big-endian CPU, swap bytes in 16 & 32 bit words - - // helper-function to swap byte-order of 32bit integer - static inline void _swap32(unsigned int &dwData) - { - dwData = ((dwData >> 24) & 0x000000FF) | - ((dwData >> 8) & 0x0000FF00) | - ((dwData << 8) & 0x00FF0000) | - ((dwData << 24) & 0xFF000000); - } - - // helper-function to swap byte-order of 16bit integer - static inline void _swap16(unsigned short &wData) - { - wData = ((wData >> 8) & 0x00FF) | - ((wData << 8) & 0xFF00); - } - - // helper-function to swap byte-order of buffer of 16bit integers - static inline void _swap16Buffer(unsigned short *pData, unsigned int dwNumWords) - { - unsigned long i; - - for (i = 0; i < dwNumWords; i ++) - { - _swap16(pData[i]); - } - } - -#else // BIG_ENDIAN - // little-endian CPU, WAV file is ok as such - - // dummy helper-function - static inline void _swap32(unsigned int &dwData) - { - // do nothing - } - - // dummy helper-function - static inline void _swap16(unsigned short &wData) - { - // do nothing - } - - // dummy helper-function - static inline void _swap16Buffer(unsigned short *pData, unsigned int dwNumBytes) - { - // do nothing - } - -#endif // BIG_ENDIAN - - -////////////////////////////////////////////////////////////////////////////// -// -// Class WavInFile -// - -WavInFile::WavInFile(const char *fileName) -{ - int hdrsOk; - - // Try to open the file for reading - fptr = fopen(fileName, "rb"); - if (fptr == NULL) - { - // didn't succeed - string msg = "Error : Unable to open file \""; - msg += fileName; - msg += "\" for reading."; - throw runtime_error(msg); - } - - // Read the file headers - hdrsOk = readWavHeaders(); - if (hdrsOk != 0) - { - // Something didn't match in the wav file headers - string msg = "File \""; - msg += fileName; - msg += "\" is corrupt or not a WAV file"; - throw runtime_error(msg); - } - - if (header.format.fixed != 1) - { - string msg = "File \""; - msg += fileName; - msg += "\" uses unsupported encoding."; - throw runtime_error(msg); - } - - dataRead = 0; -} - - - -WavInFile::~WavInFile() -{ - close(); -} - - - -void WavInFile::rewind() -{ - int hdrsOk; - - fseek(fptr, 0, SEEK_SET); - hdrsOk = readWavHeaders(); - assert(hdrsOk == 0); - dataRead = 0; -} - - -int WavInFile::checkCharTags() -{ - // header.format.fmt should equal to 'fmt ' - if (memcmp(fmtStr, header.format.fmt, 4) != 0) return -1; - // header.data.data_field should equal to 'data' - if (memcmp(dataStr, header.data.data_field, 4) != 0) return -1; - - return 0; -} - - -int WavInFile::read(char *buffer, int maxElems) -{ - int numBytes; - uint afterDataRead; - - // ensure it's 8 bit format - if (header.format.bits_per_sample != 8) - { - throw runtime_error("Error: WavInFile::read(char*, int) works only with 8bit samples."); - } - assert(sizeof(char) == 1); - - numBytes = maxElems; - afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) - { - // Don't read more samples than are marked available in header - numBytes = header.data.data_len - dataRead; - assert(numBytes >= 0); - } - - numBytes = fread(buffer, 1, numBytes, fptr); - dataRead += numBytes; - - return numBytes; -} - - -int WavInFile::read(short *buffer, int maxElems) -{ - unsigned int afterDataRead; - int numBytes; - int numElems; - - if (header.format.bits_per_sample == 8) - { - // 8 bit format - char *temp = new char[maxElems]; - int i; - - numElems = read(temp, maxElems); - // convert from 8 to 16 bit - for (i = 0; i < numElems; i ++) - { - buffer[i] = temp[i] << 8; - } - delete[] temp; - } - else - { - // 16 bit format - assert(header.format.bits_per_sample == 16); - assert(sizeof(short) == 2); - - numBytes = maxElems * 2; - afterDataRead = dataRead + numBytes; - if (afterDataRead > header.data.data_len) - { - // Don't read more samples than are marked available in header - numBytes = header.data.data_len - dataRead; - assert(numBytes >= 0); - } - - numBytes = fread(buffer, 1, numBytes, fptr); - dataRead += numBytes; - numElems = numBytes / 2; - - // 16bit samples, swap byte order if necessary - _swap16Buffer((unsigned short *)buffer, numElems); - } - - return numElems; -} - - - -int WavInFile::read(float *buffer, int maxElems) -{ - short *temp = new short[maxElems]; - int num; - int i; - double fscale; - - num = read(temp, maxElems); - - fscale = 1.0 / 32768.0; - // convert to floats, scale to range [-1..+1[ - for (i = 0; i < num; i ++) - { - buffer[i] = (float)(fscale * (double)temp[i]); - } - - delete[] temp; - - return num; -} - - -int WavInFile::eof() const -{ - // return true if all data has been read or file eof has reached - return (dataRead == header.data.data_len || feof(fptr)); -} - - -void WavInFile::close() -{ - fclose(fptr); - fptr = NULL; -} - - - -// test if character code is between a white space ' ' and little 'z' -static int isAlpha(char c) -{ - return (c >= ' ' && c <= 'z') ? 1 : 0; -} - - -// test if all characters are between a white space ' ' and little 'z' -static int isAlphaStr(char *str) -{ - int c; - - c = str[0]; - while (c) - { - if (isAlpha(c) == 0) return 0; - str ++; - c = str[0]; - } - - return 1; -} - - -int WavInFile::readRIFFBlock() -{ - fread(&(header.riff), sizeof(WavRiff), 1, fptr); - - // swap 32bit data byte order if necessary - _swap32((unsigned int &)header.riff.package_len); - - // header.riff.riff_char should equal to 'RIFF'); - if (memcmp(riffStr, header.riff.riff_char, 4) != 0) return -1; - // header.riff.wave should equal to 'WAVE' - if (memcmp(waveStr, header.riff.wave, 4) != 0) return -1; - - return 0; -} - - - - -int WavInFile::readHeaderBlock() -{ - char label[5]; - string sLabel; - - // lead label string - fread(label, 1, 4, fptr); - label[4] = 0; - - if (isAlphaStr(label) == 0) return -1; // not a valid label - - // Decode blocks according to their label - if (strcmp(label, fmtStr) == 0) - { - int nLen, nDump; - - // 'fmt ' block - memcpy(header.format.fmt, fmtStr, 4); - - // read length of the format field - fread(&nLen, sizeof(int), 1, fptr); - // swap byte order if necessary - _swap32((unsigned int &)nLen); // int format_len; - header.format.format_len = nLen; - - // calculate how much length differs from expected - nDump = nLen - (sizeof(header.format) - 8); - - // if format_len is larger than expected, read only as much data as we've space for - if (nDump > 0) - { - nLen = sizeof(header.format) - 8; - } - - // read data - fread(&(header.format.fixed), nLen, 1, fptr); - - // swap byte order if necessary - _swap16((unsigned short &)header.format.fixed); // short int fixed; - _swap16((unsigned short &)header.format.channel_number); // short int channel_number; - _swap32((unsigned int &)header.format.sample_rate); // int sample_rate; - _swap32((unsigned int &)header.format.byte_rate); // int byte_rate; - _swap16((unsigned short &)header.format.byte_per_sample); // short int byte_per_sample; - _swap16((unsigned short &)header.format.bits_per_sample); // short int bits_per_sample; - - // if format_len is larger than expected, skip the extra data - if (nDump > 0) - { - fseek(fptr, nDump, SEEK_CUR); - } - - return 0; - } - else if (strcmp(label, dataStr) == 0) - { - // 'data' block - memcpy(header.data.data_field, dataStr, 4); - fread(&(header.data.data_len), sizeof(uint), 1, fptr); - - // swap byte order if necessary - _swap32((unsigned int &)header.data.data_len); - - return 1; - } - else - { - uint len, i; - uint temp; - // unknown block - - // read length - fread(&len, sizeof(len), 1, fptr); - // scan through the block - for (i = 0; i < len; i ++) - { - fread(&temp, 1, 1, fptr); - if (feof(fptr)) return -1; // unexpected eof - } - } - return 0; -} - - -int WavInFile::readWavHeaders() -{ - int res; - - memset(&header, 0, sizeof(header)); - - res = readRIFFBlock(); - if (res) return 1; - // read header blocks until data block is found - do - { - // read header blocks - res = readHeaderBlock(); - if (res < 0) return 1; // error in file structure - } while (res == 0); - // check that all required tags are legal - return checkCharTags(); -} - - -uint WavInFile::getNumChannels() const -{ - return header.format.channel_number; -} - - -uint WavInFile::getNumBits() const -{ - return header.format.bits_per_sample; -} - - -uint WavInFile::getBytesPerSample() const -{ - return getNumChannels() * getNumBits() / 8; -} - - -uint WavInFile::getSampleRate() const -{ - return header.format.sample_rate; -} - - - -uint WavInFile::getDataSizeInBytes() const -{ - return header.data.data_len; -} - - -uint WavInFile::getNumSamples() const -{ - return header.data.data_len / header.format.byte_per_sample; -} - - -uint WavInFile::getLengthMS() const -{ - uint numSamples; - uint sampleRate; - - numSamples = getNumSamples(); - sampleRate = getSampleRate(); - - assert(numSamples < UINT_MAX / 1000); - return (1000 * numSamples / sampleRate); -} - - -////////////////////////////////////////////////////////////////////////////// -// -// Class WavOutFile -// - -WavOutFile::WavOutFile(const char *fileName, int sampleRate, int bits, int channels) -{ - bytesWritten = 0; - fptr = fopen(fileName, "wb"); - if (fptr == NULL) - { - string msg = "Error : Unable to open file \""; - msg += fileName; - msg += "\" for writing."; - //pmsg = msg.c_str; - throw runtime_error(msg); - } - - fillInHeader(sampleRate, bits, channels); - writeHeader(); -} - - - -WavOutFile::~WavOutFile() -{ - close(); -} - - - -void WavOutFile::fillInHeader(uint sampleRate, uint bits, uint channels) -{ - // fill in the 'riff' part.. - - // copy string 'RIFF' to riff_char - memcpy(&(header.riff.riff_char), riffStr, 4); - // package_len unknown so far - header.riff.package_len = 0; - // copy string 'WAVE' to wave - memcpy(&(header.riff.wave), waveStr, 4); - - - // fill in the 'format' part.. - - // copy string 'fmt ' to fmt - memcpy(&(header.format.fmt), fmtStr, 4); - - header.format.format_len = 0x10; - header.format.fixed = 1; - header.format.channel_number = (short)channels; - header.format.sample_rate = sampleRate; - header.format.bits_per_sample = (short)bits; - header.format.byte_per_sample = (short)(bits * channels / 8); - header.format.byte_rate = header.format.byte_per_sample * sampleRate; - header.format.sample_rate = sampleRate; - - // fill in the 'data' part.. - - // copy string 'data' to data_field - memcpy(&(header.data.data_field), dataStr, 4); - // data_len unknown so far - header.data.data_len = 0; -} - - -void WavOutFile::finishHeader() -{ - // supplement the file length into the header structure - header.riff.package_len = bytesWritten + 36; - header.data.data_len = bytesWritten; - - writeHeader(); -} - - - -void WavOutFile::writeHeader() -{ - WavHeader hdrTemp; - - // swap byte order if necessary - hdrTemp = header; - _swap32((unsigned int &)hdrTemp.riff.package_len); - _swap32((unsigned int &)hdrTemp.format.format_len); - _swap16((unsigned short &)hdrTemp.format.fixed); - _swap16((unsigned short &)hdrTemp.format.channel_number); - _swap32((unsigned int &)hdrTemp.format.sample_rate); - _swap32((unsigned int &)hdrTemp.format.byte_rate); - _swap16((unsigned short &)hdrTemp.format.byte_per_sample); - _swap16((unsigned short &)hdrTemp.format.bits_per_sample); - _swap32((unsigned int &)hdrTemp.data.data_len); - - // write the supplemented header in the beginning of the file - fseek(fptr, 0, SEEK_SET); - fwrite(&hdrTemp, sizeof(hdrTemp), 1, fptr); - // jump back to the end of the file - fseek(fptr, 0, SEEK_END); -} - - - -void WavOutFile::close() -{ - finishHeader(); - fclose(fptr); - fptr = NULL; -} - - -void WavOutFile::write(const char *buffer, int numElems) -{ - int res; - - if (header.format.bits_per_sample != 8) - { - throw runtime_error("Error: WavOutFile::write(const char*, int) accepts only 8bit samples."); - } - assert(sizeof(char) == 1); - - res = fwrite(buffer, 1, numElems, fptr); - if (res != numElems) - { - throw runtime_error("Error while writing to a wav file."); - } - - bytesWritten += numElems; -} - - -void WavOutFile::write(const short *buffer, int numElems) -{ - int res; - - // 16 bit samples - if (numElems < 1) return; // nothing to do - - if (header.format.bits_per_sample == 8) - { - int i; - char *temp = new char[numElems]; - // convert from 16bit format to 8bit format - for (i = 0; i < numElems; i ++) - { - temp[i] = buffer[i] >> 8; - } - // write in 8bit format - write(temp, numElems); - delete[] temp; - } - else - { - // 16bit format - unsigned short *pTemp = new unsigned short[numElems]; - - assert(header.format.bits_per_sample == 16); - - // allocate temp buffer to swap byte order if necessary - memcpy(pTemp, buffer, numElems * 2); - _swap16Buffer(pTemp, numElems); - - res = fwrite(pTemp, 2, numElems, fptr); - - delete[] pTemp; - - if (res != numElems) - { - throw runtime_error("Error while writing to a wav file."); - } - bytesWritten += 2 * numElems; - } -} - - -void WavOutFile::write(const float *buffer, int numElems) -{ - int i; - short *temp = new short[numElems]; - int iTemp; - - // convert to 16 bit integer - for (i = 0; i < numElems; i ++) - { - // convert to integer - iTemp = (int)(32768.0f * buffer[i]); - - // saturate - if (iTemp < -32768) iTemp = -32768; - if (iTemp > 32767) iTemp = 32767; - temp[i] = (short)iTemp; - } - - write(temp, numElems); - - delete[] temp; -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/WavFile.h b/plugins/zerospu2/3rdparty/SoundTouch/WavFile.h deleted file mode 100644 index 331ef4d3e9..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/WavFile.h +++ /dev/null @@ -1,253 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Classes for easy reading & writing of WAV sound files. -/// -/// For big-endian CPU, define BIG_ENDIAN during compile-time to correctly -/// parse the WAV files with such processors. -/// -/// Admittingly, more complete WAV reader routines may exist in public domain, but -/// the reason for 'yet another' one is that those generic WAV reader libraries are -/// exhaustingly large and cumbersome! Wanted to have something simpler here, i.e. -/// something that's not already larger than rest of the SoundTouch/SoundStretch program... -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.7 $ -// -// $Id: WavFile.h,v 1.7 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef WAVFILE_H -#define WAVFILE_H - -#include - -#ifndef uint -typedef unsigned int uint; -#endif - - -/// WAV audio file 'riff' section header -typedef struct -{ - char riff_char[4]; - int package_len; - char wave[4]; -} WavRiff; - -/// WAV audio file 'format' section header -typedef struct -{ - char fmt[4]; - int format_len; - short fixed; - short channel_number; - int sample_rate; - int byte_rate; - short byte_per_sample; - short bits_per_sample; -} WavFormat; - -/// WAV audio file 'data' section header -typedef struct -{ - char data_field[4]; - uint data_len; -} WavData; - - -/// WAV audio file header -typedef struct -{ - WavRiff riff; - WavFormat format; - WavData data; -} WavHeader; - - -/// Class for reading WAV audio files. -class WavInFile -{ -private: - /// File pointer. - FILE *fptr; - - /// Counter of how many bytes of sample data have been read from the file. - uint dataRead; - - /// WAV header information - WavHeader header; - - /// Read WAV file headers. - /// \return zero if all ok, nonzero if file format is invalid. - int readWavHeaders(); - - /// Checks WAV file header tags. - /// \return zero if all ok, nonzero if file format is invalid. - int checkCharTags(); - - /// Reads a single WAV file header block. - /// \return zero if all ok, nonzero if file format is invalid. - int readHeaderBlock(); - - /// Reads WAV file 'riff' block - int readRIFFBlock(); - -public: - /// Constructor: Opens the given WAV file. If the file can't be opened, - /// throws 'runtime_error' exception. - WavInFile(const char *filename); - - /// Destructor: Closes the file. - ~WavInFile(); - - /// Close the file. Notice that file is automatically closed also when the - /// class instance is deleted. - void close(); - - /// Rewind to beginning of the file - void rewind(); - - /// Get sample rate. - uint getSampleRate() const; - - /// Get number of bits per sample, i.e. 8 or 16. - uint getNumBits() const; - - /// Get sample data size in bytes. Ahem, this should return same information as - /// 'getBytesPerSample'... - uint getDataSizeInBytes() const; - - /// Get total number of samples in file. - uint getNumSamples() const; - - /// Get number of bytes per audio sample (e.g. 16bit stereo = 4 bytes/sample) - uint getBytesPerSample() const; - - /// Get number of audio channels in the file (1=mono, 2=stereo) - uint getNumChannels() const; - - /// Get the audio file length in milliseconds - uint getLengthMS() const; - - /// Reads audio samples from the WAV file. This routine works only for 8 bit samples. - /// Reads given number of elements from the file or if end-of-file reached, as many - /// elements as are left in the file. - /// - /// \return Number of 8-bit integers read from the file. - int read(char *buffer, int maxElems); - - /// Reads audio samples from the WAV file to 16 bit integer format. Reads given number - /// of elements from the file or if end-of-file reached, as many elements as are - /// left in the file. - /// - /// \return Number of 16-bit integers read from the file. - int read(short *buffer, ///< Pointer to buffer where to read data. - int maxElems ///< Size of 'buffer' array (number of array elements). - ); - - /// Reads audio samples from the WAV file to floating point format, converting - /// sample values to range [-1,1[. Reads given number of elements from the file - /// or if end-of-file reached, as many elements as are left in the file. - /// - /// \return Number of elements read from the file. - int read(float *buffer, ///< Pointer to buffer where to read data. - int maxElems ///< Size of 'buffer' array (number of array elements). - ); - - /// Check end-of-file. - /// - /// \return Nonzero if end-of-file reached. - int eof() const; -}; - - - -/// Class for writing WAV audio files. -class WavOutFile -{ -private: - /// Pointer to the WAV file - FILE *fptr; - - /// WAV file header data. - WavHeader header; - - /// Counter of how many bytes have been written to the file so far. - int bytesWritten; - - /// Fills in WAV file header information. - void fillInHeader(const uint sampleRate, const uint bits, const uint channels); - - /// Finishes the WAV file header by supplementing information of amount of - /// data written to file etc - void finishHeader(); - - /// Writes the WAV file header. - void writeHeader(); - -public: - /// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception - /// if file creation fails. - WavOutFile(const char *fileName, ///< Filename - int sampleRate, ///< Sample rate (e.g. 44100 etc) - int bits, ///< Bits per sample (8 or 16 bits) - int channels ///< Number of channels (1=mono, 2=stereo) - ); - - /// Destructor: Finalizes & closes the WAV file. - ~WavOutFile(); - - /// Write data to WAV file. This function works only with 8bit samples. - /// Throws a 'runtime_error' exception if writing to file fails. - void write(const char *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Write data to WAV file. Throws a 'runtime_error' exception if writing to - /// file fails. - void write(const short *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Write data to WAV file in floating point format, saturating sample values to range - /// [-1..+1[. Throws a 'runtime_error' exception if writing to file fails. - void write(const float *buffer, ///< Pointer to sample data buffer. - int numElems ///< How many array items are to be written to file. - ); - - /// Finalize & close the WAV file. Automatically supplements the WAV file header - /// information according to written data etc. - /// - /// Notice that file is automatically closed also when the class instance is deleted. - void close(); -}; - -#endif diff --git a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect.h b/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect.h deleted file mode 100644 index 69892102c9..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect.h +++ /dev/null @@ -1,62 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// A header file for detecting the Intel MMX instructions set extension. -/// -/// Please see 'mmx_win.cpp', 'mmx_cpp.cpp' and 'mmx_non_x86.cpp' for the -/// routine implementations for x86 Windows, x86 gnu version and non-x86 -/// platforms, respectively. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.4 $ -// -// $Id: cpu_detect.h,v 1.4 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef _CPU_DETECT_H_ -#define _CPU_DETECT_H_ - -#include "STTypes.h" - -#define SUPPORT_MMX 0x0001 -#define SUPPORT_3DNOW 0x0002 -#define SUPPORT_ALTIVEC 0x0004 -#define SUPPORT_SSE 0x0008 -#define SUPPORT_SSE2 0x0010 - -/// Checks which instruction set extensions are supported by the CPU. -/// -/// \return A bitmask of supported extensions, see SUPPORT_... defines. -uint detectCPUextensions(void); - -/// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint wDisableMask); - -#endif // _CPU_DETECT_H_ diff --git a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp b/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp deleted file mode 100644 index 68423c3a0e..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_gcc.cpp +++ /dev/null @@ -1,138 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// gcc version of the x86 CPU detect routine. -/// -/// This file is to be compiled on any platform with the GNU C compiler. -/// Compiler. Please see 'cpu_detect_x86_win.cpp' for the x86 Windows version -/// of this file. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.6 $ -// -// $Id: cpu_detect_x86_gcc.cpp,v 1.6 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "cpu_detect.h" - -#ifndef __GNUC__ -#error wrong platform - this source code file is for the GNU C compiler. -#endif - -using namespace std; - -#include -////////////////////////////////////////////////////////////////////////////// -// -// processor instructions extension detection routines -// -////////////////////////////////////////////////////////////////////////////// - - -// Flag variable indicating whick ISA extensions are disabled (for debugging) -static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions - -// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint dwDisableMask) -{ - _dwDisabledISA = dwDisableMask; -} - - - -/// Checks which instruction set extensions are supported by the CPU. -uint detectCPUextensions(void) -{ -#ifndef __i386__ - return 0; // always disable extensions on non-x86 platforms. -#else - uint res = 0; - - if (_dwDisabledISA == 0xffffffff) return 0; - - asm volatile( - "\n\txor %%esi, %%esi" // clear %%esi = result register - // check if 'cpuid' instructions is available by toggling eflags bit 21 - - "\n\tpushf" // save eflags to stack - "\n\tpop %%eax" // load eax from stack (with eflags) - "\n\tmovl %%eax, %%ecx" // save the original eflags values to ecx - "\n\txor $0x00200000, %%eax" // toggle bit 21 - "\n\tpush %%eax" // store toggled eflags to stack - "\n\tpopf" // load eflags from stack - "\n\tpushf" // save updated eflags to stack - "\n\tpop %%eax" // load from stack - "\n\txor %%edx, %%edx" // clear edx for defaulting no mmx - "\n\tcmp %%ecx, %%eax" // compare to original eflags values - "\n\tjz end" // jumps to 'end' if cpuid not present - - // cpuid instruction available, test for presence of mmx instructions - - "\n\tmovl $1, %%eax" - "\n\tcpuid" -// movl $0x00800000, %edx // force enable MMX - "\n\ttest $0x00800000, %%edx" - "\n\tjz end" // branch if MMX not available - - "\n\tor $0x01, %%esi" // otherwise add MMX support bit - - "\n\ttest $0x02000000, %%edx" - "\n\tjz test3DNow" // branch if SSE not available - - "\n\tor $0x08, %%esi" // otherwise add SSE support bit - - "\n\ttest3DNow:" - // test for precense of AMD extensions - "\n\tmov $0x80000000, %%eax" - "\n\tcpuid" - "\n\tcmp $0x80000000, %%eax" - "\n\tjbe end" // branch if no AMD extensions detected - - // test for precense of 3DNow! extension - "\n\tmov $0x80000001, %%eax" - "\n\tcpuid" - "\n\ttest $0x80000000, %%edx" - "\n\tjz end" // branch if 3DNow! not detected - - "\n\tor $0x02, %%esi" // otherwise add 3DNow support bit - - "\n\tend:" - - "\n\tmov %%esi, %0" - - : "=r" (res) - : /* no inputs */ - : "%edx", "%eax", "%ecx", "%esi" ); - - return res & ~_dwDisabledISA; -#endif -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_win.cpp b/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_win.cpp deleted file mode 100644 index ee3acf69f7..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/cpu_detect_x86_win.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// Win32 version of the x86 CPU detect routine. -/// -/// This file is to be compiled in Windows platform with Microsoft Visual C++ -/// Compiler. Please see 'cpu_detect_x86_gcc.cpp' for the gcc compiler version -/// for all GNU platforms. -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.10 $ -// -// $Id: cpu_detect_x86_win.cpp,v 1.10 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" - -#ifndef _WIN32 -#error wrong platform - this source code file is exclusively for Win32 platform -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// processor instructions extension detection routines -// -////////////////////////////////////////////////////////////////////////////// - -// Flag variable indicating whick ISA extensions are disabled (for debugging) -static uint _dwDisabledISA = 0x00; // 0xffffffff; //<- use this to disable all extensions - - -// Disables given set of instruction extensions. See SUPPORT_... defines. -void disableExtensions(uint dwDisableMask) -{ - _dwDisabledISA = dwDisableMask; -} - - - -/// Checks which instruction set extensions are supported by the CPU. -uint detectCPUextensions(void) -{ - uint res = 0; - - if (_dwDisabledISA == 0xffffffff) return 0; - - _asm - { - ; check if 'cpuid' instructions is available by toggling eflags bit 21 - ; - xor esi, esi ; clear esi = result register - - pushfd ; save eflags to stack - pop eax ; load eax from stack (with eflags) - mov ecx, eax ; save the original eflags values to ecx - xor eax, 0x00200000 ; toggle bit 21 - push eax ; store toggled eflags to stack - popfd ; load eflags from stack - pushfd ; save updated eflags to stack - pop eax ; load from stack - xor edx, edx ; clear edx for defaulting no mmx - cmp eax, ecx ; compare to original eflags values - jz end ; jumps to 'end' if cpuid not present - - ; cpuid instruction available, test for presence of mmx instructions - mov eax, 1 - cpuid - test edx, 0x00800000 - jz end ; branch if MMX not available - - or esi, SUPPORT_MMX ; otherwise add MMX support bit - - test edx, 0x02000000 - jz test3DNow ; branch if SSE not available - - or esi, SUPPORT_SSE ; otherwise add SSE support bit - - test3DNow: - ; test for precense of AMD extensions - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000000 - jbe end ; branch if no AMD extensions detected - - ; test for precense of 3DNow! extension - mov eax, 0x80000001 - cpuid - test edx, 0x80000000 - jz end ; branch if 3DNow! not detected - - or esi, SUPPORT_3DNOW ; otherwise add 3DNow support bit - - end: - - mov res, esi - } - - return res & ~_dwDisabledISA; -} diff --git a/plugins/zerospu2/3rdparty/SoundTouch/mmx_optimized.cpp b/plugins/zerospu2/3rdparty/SoundTouch/mmx_optimized.cpp deleted file mode 100644 index b49584b694..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/mmx_optimized.cpp +++ /dev/null @@ -1,305 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// MMX optimized routines. All MMX optimized functions have been gathered into -/// this single source code file, regardless to their class or original source -/// code file, in order to ease porting the library to other compiler and -/// processor platforms. -/// -/// The MMX-optimizations are programmed using MMX compiler intrinsics that -/// are supported both by Microsoft Visual C++ and GCC compilers, so this file -/// should compile with both toolsets. -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support compiler intrinsic syntax. The update -/// is available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/06 18:52:43 $ -// File revision : $Revision: 1.1 $ -// -// $Id: mmx_optimized.cpp,v 1.1 2006/02/06 18:52:43 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "STTypes.h" - -#ifdef ALLOW_MMX -// MMX routines available only with integer sample type - -#if !(_WIN32 || __i386__ || __x86_64__) -#error "wrong platform - this source code file is exclusively for x86 platforms" -#endif - -using namespace soundtouch; - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of MMX optimized functions of class 'TDStretchMMX' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include -#include - - -// Calculates cross correlation of two buffers -long TDStretchMMX::calcCrossCorrStereo(const short *pV1, const short *pV2) const -{ - const __m64 *pVec1, *pVec2; - __m64 shifter; - __m64 accu; - long corr; - uint i; - - pVec1 = (__m64*)pV1; - pVec2 = (__m64*)pV2; - - shifter = _m_from_int(overlapDividerBits); - accu = _mm_setzero_si64(); - - // Process 4 parallel sets of 2 * stereo samples each during each - // round to improve CPU-level parallellization. - for (i = 0; i < overlapLength / 8; i ++) - { - __m64 temp; - - // dictionary of instructions: - // _m_pmaddwd : 4*16bit multiply-add, resulting two 32bits = [a0*b0+a1*b1 ; a2*b2+a3*b3] - // _mm_add_pi32 : 2*32bit add - // _m_psrad : 32bit right-shift - - temp = _mm_add_pi32(_mm_madd_pi16(pVec1[0], pVec2[0]), - _mm_madd_pi16(pVec1[1], pVec2[1])); - accu = _mm_add_pi32(accu, _mm_sra_pi32(temp, shifter)); - - temp = _mm_add_pi32(_mm_madd_pi16(pVec1[2], pVec2[2]), - _mm_madd_pi16(pVec1[3], pVec2[3])); - accu = _mm_add_pi32(accu, _mm_sra_pi32(temp, shifter)); - - pVec1 += 4; - pVec2 += 4; - } - - // copy hi-dword of mm0 to lo-dword of mm1, then sum mmo+mm1 - // and finally store the result into the variable "corr" - - accu = _mm_add_pi32(accu, _mm_srli_si64(accu, 32)); - corr = _m_to_int(accu); - - // Clear MMS state - _m_empty(); - - return corr; - // Note: Warning about the missing EMMS instruction is harmless - // as it'll be called elsewhere. -} - - - -void TDStretchMMX::clearCrossCorrState() -{ - // Clear MMS state - _m_empty(); - //_asm EMMS; -} - - - -// MMX-optimized version of the function overlapStereo -void TDStretchMMX::overlapStereo(short *output, const short *input) const -{ - const __m64 *pVinput, *pVMidBuf; - __m64 *pVdest; - __m64 mix1, mix2, adder, shifter; - uint i; - - pVinput = (const __m64*)input; - pVMidBuf = (const __m64*)pMidBuffer; - pVdest = (__m64*)output; - - // mix1 = mixer values for 1st stereo sample - // mix1 = mixer values for 2nd stereo sample - // adder = adder for updating mixer values after each round - - mix1 = _mm_set_pi16(0, overlapLength, 0, overlapLength); - adder = _mm_set_pi16(1, -1, 1, -1); - mix2 = _mm_add_pi16(mix1, adder); - adder = _mm_add_pi16(adder, adder); - - shifter = _m_from_int(overlapDividerBits); - - for (i = 0; i < overlapLength / 4; i ++) - { - __m64 temp1, temp2; - - // load & shuffle data so that input & mixbuffer data samples are paired - temp1 = _mm_unpacklo_pi16(pVMidBuf[0], pVinput[0]); // = i0l m0l i0r m0r - temp2 = _mm_unpackhi_pi16(pVMidBuf[0], pVinput[0]); // = i1l m1l i1r m1r - - // temp = (temp .* mix) >> shifter - temp1 = _mm_sra_pi32(_mm_madd_pi16(temp1, mix1), shifter); - temp2 = _mm_sra_pi32(_mm_madd_pi16(temp2, mix2), shifter); - pVdest[0] = _mm_packs_pi32(temp1, temp2); // pack 2*2*32bit => 4*16bit - - // update mix += adder - mix1 = _mm_add_pi16(mix1, adder); - mix2 = _mm_add_pi16(mix2, adder); - - // --- second round begins here --- - - // load & shuffle data so that input & mixbuffer data samples are paired - temp1 = _mm_unpacklo_pi16(pVMidBuf[1], pVinput[1]); // = i2l m2l i2r m2r - temp2 = _mm_unpackhi_pi16(pVMidBuf[1], pVinput[1]); // = i3l m3l i3r m3r - - // temp = (temp .* mix) >> shifter - temp1 = _mm_sra_pi32(_mm_madd_pi16(temp1, mix1), shifter); - temp2 = _mm_sra_pi32(_mm_madd_pi16(temp2, mix2), shifter); - pVdest[1] = _mm_packs_pi32(temp1, temp2); // pack 2*2*32bit => 4*16bit - - // update mix += adder - mix1 = _mm_add_pi16(mix1, adder); - mix2 = _mm_add_pi16(mix2, adder); - - pVinput += 2; - pVMidBuf += 2; - pVdest += 2; - } - - _m_empty(); // clear MMS state -} - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of MMX optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - - -FIRFilterMMX::FIRFilterMMX() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilterMMX::~FIRFilterMMX() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for MMX routine -void FIRFilterMMX::setCoefficients(const short *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new short[2 * newLength + 8]; - filterCoeffsAlign = (short *)(((ulongptr)filterCoeffsUnalign + 15) & -16); - - // rearrange the filter coefficients for mmx routines - for (i = 0;i < length; i += 4) - { - filterCoeffsAlign[2 * i + 0] = coeffs[i + 0]; - filterCoeffsAlign[2 * i + 1] = coeffs[i + 2]; - filterCoeffsAlign[2 * i + 2] = coeffs[i + 0]; - filterCoeffsAlign[2 * i + 3] = coeffs[i + 2]; - - filterCoeffsAlign[2 * i + 4] = coeffs[i + 1]; - filterCoeffsAlign[2 * i + 5] = coeffs[i + 3]; - filterCoeffsAlign[2 * i + 6] = coeffs[i + 1]; - filterCoeffsAlign[2 * i + 7] = coeffs[i + 3]; - } -} - - - -// mmx-optimized version of the filter routine for stereo sound -uint FIRFilterMMX::evaluateFilterStereo(short *dest, const short *src, const uint numSamples) const -{ - // Create stack copies of the needed member variables for asm routines : - uint i, j; - __m64 *pVdest = (__m64*)dest; - - if (length < 2) return 0; - - for (i = 0; i < numSamples / 2; i ++) - { - __m64 accu1; - __m64 accu2; - const __m64 *pVsrc = (const __m64*)src; - const __m64 *pVfilter = (const __m64*)filterCoeffsAlign; - - accu1 = accu2 = _mm_setzero_si64(); - for (j = 0; j < lengthDiv8 * 2; j ++) - { - __m64 temp1, temp2; - - temp1 = _mm_unpacklo_pi16(pVsrc[0], pVsrc[1]); // = l2 l0 r2 r0 - temp2 = _mm_unpackhi_pi16(pVsrc[0], pVsrc[1]); // = l3 l1 r3 r1 - - accu1 = _mm_add_pi32(accu1, _mm_madd_pi16(temp1, pVfilter[0])); // += l2*f2+l0*f0 r2*f2+r0*f0 - accu1 = _mm_add_pi32(accu1, _mm_madd_pi16(temp2, pVfilter[1])); // += l3*f3+l1*f1 r3*f3+r1*f1 - - temp1 = _mm_unpacklo_pi16(pVsrc[1], pVsrc[2]); // = l4 l2 r4 r2 - - accu2 = _mm_add_pi32(accu2, _mm_madd_pi16(temp2, pVfilter[0])); // += l3*f2+l1*f0 r3*f2+r1*f0 - accu2 = _mm_add_pi32(accu2, _mm_madd_pi16(temp1, pVfilter[1])); // += l4*f3+l2*f1 r4*f3+r2*f1 - - // accu1 += l2*f2+l0*f0 r2*f2+r0*f0 - // += l3*f3+l1*f1 r3*f3+r1*f1 - - // accu2 += l3*f2+l1*f0 r3*f2+r1*f0 - // l4*f3+l2*f1 r4*f3+r2*f1 - - pVfilter += 2; - pVsrc += 2; - } - // accu >>= resultDivFactor - accu1 = _mm_srai_pi32(accu1, resultDivFactor); - accu2 = _mm_srai_pi32(accu2, resultDivFactor); - - // pack 2*2*32bits => 4*16 bits - pVdest[0] = _mm_packs_pi32(accu1, accu2); - src += 4; - pVdest ++; - } - - _m_empty(); // clear emms state - - return (numSamples & 0xfffffffe) - length; -} - -#endif // ALLOW_MMX diff --git a/plugins/zerospu2/3rdparty/SoundTouch/sse_optimized.cpp b/plugins/zerospu2/3rdparty/SoundTouch/sse_optimized.cpp deleted file mode 100644 index 1e70da6608..0000000000 --- a/plugins/zerospu2/3rdparty/SoundTouch/sse_optimized.cpp +++ /dev/null @@ -1,484 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// -/// SSE optimized routines for Pentium-III, Athlon-XP and later CPUs. All SSE -/// optimized functions have been gathered into this single source -/// code file, regardless to their class or original source code file, in order -/// to ease porting the library to other compiler and processor platforms. -/// -/// The SSE-optimizations are programmed using SSE compiler intrinsics that -/// are supported both by Microsoft Visual C++ and GCC compilers, so this file -/// should compile with both toolsets. -/// -/// NOTICE: If using Visual Studio 6.0, you'll need to install the "Visual C++ -/// 6.0 processor pack" update to support SSE instruction set. The update is -/// available for download at Microsoft Developers Network, see here: -/// http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx -/// -/// If the above URL is expired or removed, go to "http://msdn.microsoft.com" and -/// perform a search with keywords "processor pack". -/// -/// Author : Copyright (c) Olli Parviainen -/// Author e-mail : oparviai 'at' iki.fi -/// SoundTouch WWW: http://www.surina.net/soundtouch -/// -//////////////////////////////////////////////////////////////////////////////// -// -// Last changed : $Date: 2006/02/05 16:44:06 $ -// File revision : $Revision: 1.2 $ -// -// $Id: sse_optimized.cpp,v 1.2 2006/02/05 16:44:06 Olli Exp $ -// -//////////////////////////////////////////////////////////////////////////////// -// -// License : -// -// SoundTouch audio processing library -// Copyright (c) Olli Parviainen -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -//////////////////////////////////////////////////////////////////////////////// - -#include "cpu_detect.h" -#include "STTypes.h" - -using namespace soundtouch; - -#ifdef ALLOW_SSE - -// SSE routines available only with float sample type - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of SSE optimized functions of class 'TDStretchSSE' -// -////////////////////////////////////////////////////////////////////////////// - -#include "TDStretch.h" -#include - -// Calculates cross correlation of two buffers -double TDStretchSSE::calcCrossCorrStereo(const float *pV1, const float *pV2) const -{ - uint i; - __m128 vSum, *pVec2; - - // Note. It means a major slow-down if the routine needs to tolerate - // unaligned __m128 memory accesses. It's way faster if we can skip - // unaligned slots and use _mm_load_ps instruction instead of _mm_loadu_ps. - // This can mean up to ~ 10-fold difference (incl. part of which is - // due to skipping every second round for stereo sound though). - // - // Compile-time define ALLOW_NONEXACT_SIMD_OPTIMIZATION is provided - // for choosing if this little cheating is allowed. - -#ifdef ALLOW_NONEXACT_SIMD_OPTIMIZATION - // Little cheating allowed, return valid correlation only for - // aligned locations, meaning every second round for stereo sound. - - #define _MM_LOAD _mm_load_ps - - if (((ulong)pV1) & 15) return -1e50; // skip unaligned locations - -#else - // No cheating allowed, use unaligned load & take the resulting - // performance hit. - #define _MM_LOAD _mm_loadu_ps -#endif - - // ensure overlapLength is divisible by 8 - assert((overlapLength % 8) == 0); - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - // Note: pV2 _must_ be aligned to 16-bit boundary, pV1 need not. - pVec2 = (__m128*)pV2; - vSum = _mm_setzero_ps(); - - // Unroll the loop by factor of 4 * 4 operations - for (i = 0; i < overlapLength / 8; i ++) - { - // vSum += pV1[0..3] * pV2[0..3] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1),pVec2[0])); - - // vSum += pV1[4..7] * pV2[4..7] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 4), pVec2[1])); - - // vSum += pV1[8..11] * pV2[8..11] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 8), pVec2[2])); - - // vSum += pV1[12..15] * pV2[12..15] - vSum = _mm_add_ps(vSum, _mm_mul_ps(_MM_LOAD(pV1 + 12), pVec2[3])); - - pV1 += 16; - pVec2 += 4; - } - - // return value = vSum[0] + vSum[1] + vSum[2] + vSum[3] - float *pvSum = (float*)&vSum; - return (double)(pvSum[0] + pvSum[1] + pvSum[2] + pvSum[3]); - - /* This is approximately corresponding routine in C-language: - double corr; - uint i; - - // Calculates the cross-correlation value between 'pV1' and 'pV2' vectors - corr = 0.0; - for (i = 0; i < overlapLength / 8; i ++) - { - corr += pV1[0] * pV2[0] + - pV1[1] * pV2[1] + - pV1[2] * pV2[2] + - pV1[3] * pV2[3] + - pV1[4] * pV2[4] + - pV1[5] * pV2[5] + - pV1[6] * pV2[6] + - pV1[7] * pV2[7] + - pV1[8] * pV2[8] + - pV1[9] * pV2[9] + - pV1[10] * pV2[10] + - pV1[11] * pV2[11] + - pV1[12] * pV2[12] + - pV1[13] * pV2[13] + - pV1[14] * pV2[14] + - pV1[15] * pV2[15]; - - pV1 += 16; - pV2 += 16; - } - */ - - /* This is corresponding routine in assembler. This may be teeny-weeny bit faster - than intrinsic version, but more difficult to maintain & get compiled on multiple - platforms. - - uint overlapLengthLocal = overlapLength; - float corr; - - _asm - { - // Very important note: data in 'pV2' _must_ be aligned to - // 16-byte boundary! - - // give prefetch hints to CPU of what data are to be needed soonish - // give more aggressive hints on pV1 as that changes while pV2 stays - // same between runs - prefetcht0 [pV1] - prefetcht0 [pV2] - prefetcht0 [pV1 + 32] - - mov eax, dword ptr pV1 - mov ebx, dword ptr pV2 - - xorps xmm0, xmm0 - - mov ecx, overlapLengthLocal - shr ecx, 3 // div by eight - - loop1: - prefetcht0 [eax + 64] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [ebx + 32] // give a prefetch hint to CPU what data are to be needed soonish - movups xmm1, [eax] - mulps xmm1, [ebx] - addps xmm0, xmm1 - - movups xmm2, [eax + 16] - mulps xmm2, [ebx + 16] - addps xmm0, xmm2 - - prefetcht0 [eax + 96] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [ebx + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm3, [eax + 32] - mulps xmm3, [ebx + 32] - addps xmm0, xmm3 - - movups xmm4, [eax + 48] - mulps xmm4, [ebx + 48] - addps xmm0, xmm4 - - add eax, 64 - add ebx, 64 - - dec ecx - jnz loop1 - - // add the four floats of xmm0 together and return the result. - - movhlps xmm1, xmm0 // move 3 & 4 of xmm0 to 1 & 2 of xmm1 - addps xmm1, xmm0 - movaps xmm2, xmm1 - shufps xmm2, xmm2, 0x01 // move 2 of xmm2 as 1 of xmm2 - addss xmm2, xmm1 - movss corr, xmm2 - } - - return (double)corr; - */ -} - - -////////////////////////////////////////////////////////////////////////////// -// -// implementation of SSE optimized functions of class 'FIRFilter' -// -////////////////////////////////////////////////////////////////////////////// - -#include "FIRFilter.h" - -FIRFilterSSE::FIRFilterSSE() : FIRFilter() -{ - filterCoeffsUnalign = NULL; -} - - -FIRFilterSSE::~FIRFilterSSE() -{ - delete[] filterCoeffsUnalign; -} - - -// (overloaded) Calculates filter coefficients for SSE routine -void FIRFilterSSE::setCoefficients(const float *coeffs, uint newLength, uint uResultDivFactor) -{ - uint i; - float fDivider; - - FIRFilter::setCoefficients(coeffs, newLength, uResultDivFactor); - - // Scale the filter coefficients so that it won't be necessary to scale the filtering result - // also rearrange coefficients suitably for 3DNow! - // Ensure that filter coeffs array is aligned to 16-byte boundary - delete[] filterCoeffsUnalign; - filterCoeffsUnalign = new float[2 * newLength + 4]; - filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15) & -16); - - fDivider = (float)resultDivider; - - // rearrange the filter coefficients for mmx routines - for (i = 0; i < newLength; i ++) - { - filterCoeffsAlign[2 * i + 0] = - filterCoeffsAlign[2 * i + 1] = coeffs[i + 0] / fDivider; - } -} - - - -// SSE-optimized version of the filter routine for stereo sound -uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint numSamples) const -{ - int count = (numSamples - length) & -2; - int j; - - assert(count % 2 == 0); - - if (count < 2) return 0; - - assert((length % 8) == 0); - assert(((unsigned long)filterCoeffsAlign) % 16 == 0); - - // filter is evaluated for two stereo samples with each iteration, thus use of 'j += 2' - for (j = 0; j < count; j += 2) - { - const float *pSrc; - const __m128 *pFil; - __m128 sum1, sum2; - uint i; - - pSrc = source; // source audio data - pFil = (__m128*)filterCoeffsAlign; // filter coefficients. NOTE: Assumes coefficients - // are aligned to 16-byte boundary - sum1 = sum2 = _mm_setzero_ps(); - - for (i = 0; i < length / 8; i ++) - { - // Unroll loop for efficiency & calculate filter for 2*2 stereo samples - // at each pass - - // sum1 is accu for 2*2 filtered stereo sound data at the primary sound data offset - // sum2 is accu for 2*2 filtered stereo sound data for the next sound sample offset. - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc) , pFil[0])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 2), pFil[0])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 4), pFil[1])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 6), pFil[1])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 8) , pFil[2])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 10), pFil[2])); - - sum1 = _mm_add_ps(sum1, _mm_mul_ps(_mm_loadu_ps(pSrc + 12), pFil[3])); - sum2 = _mm_add_ps(sum2, _mm_mul_ps(_mm_loadu_ps(pSrc + 14), pFil[3])); - - pSrc += 16; - pFil += 4; - } - - // Now sum1 and sum2 both have a filtered 2-channel sample each, but we still need - // to sum the two hi- and lo-floats of these registers together. - - // post-shuffle & add the filtered values and store to dest. - _mm_storeu_ps(dest, _mm_add_ps( - _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(1,0,3,2)), // s2_1 s2_0 s1_3 s1_2 - _mm_shuffle_ps(sum1, sum2, _MM_SHUFFLE(3,2,1,0)) // s2_3 s2_2 s1_1 s1_0 - )); - source += 4; - dest += 4; - } - - // Ideas for further improvement: - // 1. If it could be guaranteed that 'source' were always aligned to 16-byte - // boundary, a faster aligned '_mm_load_ps' instruction could be used. - // 2. If it could be guaranteed that 'dest' were always aligned to 16-byte - // boundary, a faster '_mm_store_ps' instruction could be used. - - return (uint)count; - - /* original routine in C-language. please notice the C-version has differently - organized coefficients though. - double suml1, suml2; - double sumr1, sumr2; - uint i, j; - - for (j = 0; j < count; j += 2) - { - const float *ptr; - const float *pFil; - - suml1 = sumr1 = 0.0; - suml2 = sumr2 = 0.0; - ptr = src; - pFil = filterCoeffs; - for (i = 0; i < lengthLocal; i ++) - { - // unroll loop for efficiency. - - suml1 += ptr[0] * pFil[0] + - ptr[2] * pFil[2] + - ptr[4] * pFil[4] + - ptr[6] * pFil[6]; - - sumr1 += ptr[1] * pFil[1] + - ptr[3] * pFil[3] + - ptr[5] * pFil[5] + - ptr[7] * pFil[7]; - - suml2 += ptr[8] * pFil[0] + - ptr[10] * pFil[2] + - ptr[12] * pFil[4] + - ptr[14] * pFil[6]; - - sumr2 += ptr[9] * pFil[1] + - ptr[11] * pFil[3] + - ptr[13] * pFil[5] + - ptr[15] * pFil[7]; - - ptr += 16; - pFil += 8; - } - dest[0] = (float)suml1; - dest[1] = (float)sumr1; - dest[2] = (float)suml2; - dest[3] = (float)sumr2; - - src += 4; - dest += 4; - } - */ - - - /* Similar routine in assembly, again obsoleted due to maintainability - _asm - { - // Very important note: data in 'src' _must_ be aligned to - // 16-byte boundary! - mov edx, count - mov ebx, dword ptr src - mov eax, dword ptr dest - shr edx, 1 - - loop1: - // "outer loop" : during each round 2*2 output samples are calculated - - // give prefetch hints to CPU of what data are to be needed soonish - prefetcht0 [ebx] - prefetcht0 [filterCoeffsLocal] - - mov esi, ebx - mov edi, filterCoeffsLocal - xorps xmm0, xmm0 - xorps xmm1, xmm1 - mov ecx, lengthLocal - - loop2: - // "inner loop" : during each round eight FIR filter taps are evaluated for 2*2 samples - prefetcht0 [esi + 32] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [edi + 32] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm2, [esi] // possibly unaligned load - movups xmm3, [esi + 8] // possibly unaligned load - mulps xmm2, [edi] - mulps xmm3, [edi] - addps xmm0, xmm2 - addps xmm1, xmm3 - - movups xmm4, [esi + 16] // possibly unaligned load - movups xmm5, [esi + 24] // possibly unaligned load - mulps xmm4, [edi + 16] - mulps xmm5, [edi + 16] - addps xmm0, xmm4 - addps xmm1, xmm5 - - prefetcht0 [esi + 64] // give a prefetch hint to CPU what data are to be needed soonish - prefetcht0 [edi + 64] // give a prefetch hint to CPU what data are to be needed soonish - - movups xmm6, [esi + 32] // possibly unaligned load - movups xmm7, [esi + 40] // possibly unaligned load - mulps xmm6, [edi + 32] - mulps xmm7, [edi + 32] - addps xmm0, xmm6 - addps xmm1, xmm7 - - movups xmm4, [esi + 48] // possibly unaligned load - movups xmm5, [esi + 56] // possibly unaligned load - mulps xmm4, [edi + 48] - mulps xmm5, [edi + 48] - addps xmm0, xmm4 - addps xmm1, xmm5 - - add esi, 64 - add edi, 64 - dec ecx - jnz loop2 - - // Now xmm0 and xmm1 both have a filtered 2-channel sample each, but we still need - // to sum the two hi- and lo-floats of these registers together. - - movhlps xmm2, xmm0 // xmm2 = xmm2_3 xmm2_2 xmm0_3 xmm0_2 - movlhps xmm2, xmm1 // xmm2 = xmm1_1 xmm1_0 xmm0_3 xmm0_2 - shufps xmm0, xmm1, 0xe4 // xmm0 = xmm1_3 xmm1_2 xmm0_1 xmm0_0 - addps xmm0, xmm2 - - movaps [eax], xmm0 - add ebx, 16 - add eax, 16 - - dec edx - jnz loop1 - } - */ -} - -#endif // ALLOW_SSE diff --git a/plugins/zerospu2/Win32/ProjectRootDir.vsprops b/plugins/zerospu2/Win32/ProjectRootDir.vsprops new file mode 100644 index 0000000000..b8400f4c9c --- /dev/null +++ b/plugins/zerospu2/Win32/ProjectRootDir.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/plugins/zerospu2/Win32/Win32.cpp b/plugins/zerospu2/Win32/Win32.cpp index 5702778677..15ba6591f9 100644 --- a/plugins/zerospu2/Win32/Win32.cpp +++ b/plugins/zerospu2/Win32/Win32.cpp @@ -20,7 +20,7 @@ #include #include -#include "zerospu2.h" +#include "../zerospu2.h" #include "resource.h" extern HINSTANCE hInst; diff --git a/plugins/zerospu2/Win32/ZeroSPU2_2008.vcproj b/plugins/zerospu2/Win32/ZeroSPU2_2008.vcproj index 243d51ba5f..65fff9e082 100644 --- a/plugins/zerospu2/Win32/ZeroSPU2_2008.vcproj +++ b/plugins/zerospu2/Win32/ZeroSPU2_2008.vcproj @@ -19,7 +19,7 @@ @@ -142,7 +142,91 @@ /> + + + + + + + + + + + + + + + + + + + @@ -237,114 +321,6 @@ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/zerospu2/Win32/dsound51.cpp b/plugins/zerospu2/Win32/dsound51.cpp index c852add397..dbf7bd51f1 100644 --- a/plugins/zerospu2/Win32/dsound51.cpp +++ b/plugins/zerospu2/Win32/dsound51.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "zerospu2.h" +#include "../zerospu2.h" ///////////////////////////////////// // use DirectSound for the sound #include diff --git a/plugins/zerospu2/Win32/vsprops/pcsx2_plugin_common.vsprops b/plugins/zerospu2/Win32/vsprops/pcsx2_plugin_common.vsprops deleted file mode 100644 index 086133a60a..0000000000 --- a/plugins/zerospu2/Win32/vsprops/pcsx2_plugin_common.vsprops +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/plugins/zerospu2/Win32/vsprops/postBuild.tmpl b/plugins/zerospu2/Win32/vsprops/postBuild.tmpl deleted file mode 100644 index 8423bad3f5..0000000000 --- a/plugins/zerospu2/Win32/vsprops/postBuild.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%\%~3%4 -set pcsxnewname=%pcsxoutdir%\%~3-r$WCREV$$WCMODS?m:$%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -copy /Y %~1 %pcsxnewname% - -if ERRORLEVEL 0 ( - echo Target copied to %pcsxnewname% -) -exit 0 diff --git a/plugins/zerospu2/Win32/vsprops/postBuild.unknown b/plugins/zerospu2/Win32/vsprops/postBuild.unknown deleted file mode 100644 index d633aa67d3..0000000000 --- a/plugins/zerospu2/Win32/vsprops/postBuild.unknown +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rem -rem Usage: postBuild.cmd SourcePath DestDir DestFile DestExt -rem -rem SourcePath - $(TargetPath) - Fully qualified path of the generated target file. -rem DestDir - $(SolutionDir) - Directory of the destination, usually the same as the solution. -rem DestFile - Base filename of the target/dest, without extension! -rem DestExt - Extension of the target/dest! - -set pcsxoutdir=%~2\bin\plugins -set pcsxoutname=%pcsxoutdir%%~3%4 - -IF NOT EXIST %pcsxoutdir% ( - md %pcsxoutdir% -) - -copy /Y %~1 %pcsxoutname% -if ERRORLEVEL 0 ( - echo Target copied to %pcsxoutname% -) -set ERRORLEVEL=0 diff --git a/plugins/zerospu2/Win32/vsprops/preBuild.cmd b/plugins/zerospu2/Win32/vsprops/preBuild.cmd deleted file mode 100644 index fc5f233aba..0000000000 --- a/plugins/zerospu2/Win32/vsprops/preBuild.cmd +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem Usage: preBuild.cmd ProjectSrcDir VspropsDir -rem -rem ProjectSrcDir - $(ProjectDir)\.. - Directory of project source code. -rem VspropsDir - $(PrjectDir)\vsprops - Directory of this script and its counterparts. - -SubWCRev.exe %~1 %~2\svnrev_template.h %~1\svnrev.h -if %ERRORLEVEL% NEQ 0 ( - echo Automatic revision update unavailable, using generic template instead. - echo You can safely ignore this message - see svnrev.h for details. - copy /Y %~2\svnrev_unknown.h %~1\svnrev.h - copy /Y %~2\postBuild.unknown %~2\postBuild.cmd -) else ( - SubWCRev.exe %~1 %~2\postBuild.tmpl %~2\postBuild.cmd -) - -rem Always return an errorlevel of 0 -- this allows compilation to continue if SubWCRev failed. - -exit 0 diff --git a/plugins/zerospu2/Win32/vsprops/svnrev_template.h b/plugins/zerospu2/Win32/vsprops/svnrev_template.h deleted file mode 100644 index f2656ef1e8..0000000000 --- a/plugins/zerospu2/Win32/vsprops/svnrev_template.h +++ /dev/null @@ -1,18 +0,0 @@ -// svnrev_template.h --> svnrev.h -// -// This file acts as a template for the automatic SVN revision/version tag. -// It is used by the utility SubWCrev.exe to create an "svnrev.h" file for -// whichever project is being compiled (as indicated by command line options -// passed to SubWCRev.exe during the project's pre-build step). -// -// The SubWCRev.exe utility is part of TortoiseSVN and requires several DLLs -// installed by TortoiseSVN, so it will only be available if you have TortoiseSVN -// installed on your system. If you do not have it installed, a generic template -// is used instead (see svnrev_generic.h). Having TortoiseSVN is handy but not -// necessary. If you do not have it installed, everything will still compile -// fine except without the SVN revision tagged to the application/dll version. -// -// TortoiseSVN can be downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV $WCREV$ -#define SVN_MODS $WCMODS?1:0$ \ No newline at end of file diff --git a/plugins/zerospu2/Win32/vsprops/svnrev_unknown.h b/plugins/zerospu2/Win32/vsprops/svnrev_unknown.h deleted file mode 100644 index 4872e23b20..0000000000 --- a/plugins/zerospu2/Win32/vsprops/svnrev_unknown.h +++ /dev/null @@ -1,23 +0,0 @@ -// svnrev_genric.h --> svnrev.h -// -// This file acts as a placebo for people who do not have TortoiseSVN installed. -// It provides "empty" revision information to the Pcsx2 Playground projects in -// the absence of real revisions derived from the repository being built. -// -// This file does not affect application/dll builds in any significant manner, -// other than the lack of automatic revision tags inserted into the app (which -// is very convenient but hardly necessary). -// -// See svn_template.h for more information on how the process of revision -// templating works. -// -// If you would like to enable automatic revisin tagging, TortoiseSVN can be -// downloaded from http://tortoisesvn.tigris.org - -#define SVN_REV_UNKNOWN - -// The following defines are included so that code will still compile even if it -// doesn't check for the SVN_REV_UNKNOWN define. - -#define SVN_REV 0 -#define SVN_MODS "" \ No newline at end of file diff --git a/plugins/zerospu2/common/PS2Edefs.h b/plugins/zerospu2/common/PS2Edefs.h deleted file mode 100644 index 49b16e16d5..0000000000 --- a/plugins/zerospu2/common/PS2Edefs.h +++ /dev/null @@ -1,885 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2EDEFS_H__ -#define __PS2EDEFS_H__ - -/* - * PS2E Definitions v0.6.2 (beta) - * - * Author: linuzappz@hotmail.com - * shadowpcsx2@yahoo.gr - * florinsasu@hotmail.com - */ - -/* - Notes: - * Since this is still beta things may change. - - * OSflags: - __LINUX__ (linux OS) - _WIN32 (win32 OS) - - * common return values (for ie. GSinit): - 0 - success - -1 - error - - * reserved keys: - F1 to F10 are reserved for the emulator - - * plugins should NOT change the current - working directory. - (on win32, add flag OFN_NOCHANGEDIR for - GetOpenFileName) - -*/ - -#include "PS2Etypes.h" - - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \ - defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \ - defined(USBdefs) || defined(FWdefs) -#define COMMONdefs -#endif - -// PS2EgetLibType returns (may be OR'd) -#define PS2E_LT_GS 0x01 -#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=- -#define PS2E_LT_SPU2 0x04 -#define PS2E_LT_CDVD 0x08 -#define PS2E_LT_DEV9 0x10 -#define PS2E_LT_USB 0x20 -#define PS2E_LT_FW 0x40 -#define PS2E_LT_SIO 0x80 - -// PS2EgetLibVersion2 (high 16 bits) -#define PS2E_GS_VERSION 0x0006 -#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=- -#define PS2E_SPU2_VERSION 0x0005 -#define PS2E_CDVD_VERSION 0x0005 -#define PS2E_DEV9_VERSION 0x0003 -#define PS2E_USB_VERSION 0x0003 -#define PS2E_FW_VERSION 0x0002 -#define PS2E_SIO_VERSION 0x0001 -#ifdef COMMONdefs - -u32 CALLBACK PS2EgetLibType(void); -u32 CALLBACK PS2EgetLibVersion2(u32 type); -char* CALLBACK PS2EgetLibName(void); - -#endif - -// key values: -/* key values must be OS dependant: - win32: the VK_XXX will be used (WinUser) - linux: the XK_XXX will be used (XFree86) -*/ - -// event values: -#define KEYPRESS 1 -#define KEYRELEASE 2 - -typedef struct _keyEvent { - u32 key; - u32 evt; -} keyEvent; - -// for 64bit compilers -typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1]; - -// plugin types -#define SIO_TYPE_PAD 0x00000001 -#define SIO_TYPE_MTAP 0x00000004 -#define SIO_TYPE_RM 0x00000040 -#define SIO_TYPE_MC 0x00000100 - -typedef int (CALLBACK * SIOchangeSlotCB)(int slot); - -typedef struct _cdvdSubQ { - u8 ctrl:4; // control and mode bits - u8 mode:4; // control and mode bits - u8 trackNum; // current track number (1 to 99) - u8 trackIndex; // current index within track (0 to 99) - u8 trackM; // current minute location on the disc (BCD encoded) - u8 trackS; // current sector location on the disc (BCD encoded) - u8 trackF; // current frame location on the disc (BCD encoded) - u8 pad; // unused - u8 discM; // current minute offset from first track (BCD encoded) - u8 discS; // current sector offset from first track (BCD encoded) - u8 discF; // current frame offset from first track (BCD encoded) -} cdvdSubQ; - -typedef struct _cdvdTD { // NOT bcd coded - u32 lsn; - u8 type; -} cdvdTD; - -typedef struct _cdvdTN { - u8 strack; //number of the first track (usually 1) - u8 etrack; //number of the last track -} cdvdTN; - -// CDVDreadTrack mode values: -#define CDVD_MODE_2352 0 // full 2352 bytes -#define CDVD_MODE_2340 1 // skip sync (12) bytes -#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes -#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq - -// CDVDgetDiskType returns: -#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc -#define CDVD_TYPE_DVDV 0xfe // DVD Video -#define CDVD_TYPE_CDDA 0xfd // Audio CD -#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD -#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio) -#define CDVD_TYPE_PS2CD 0x12 // PS2 CD -#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio) -#define CDVD_TYPE_PSCD 0x10 // PS CD -#define CDVD_TYPE_UNKNOWN 0x05 // Unknown -#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided -#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided -#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd -#define CDVD_TYPE_DETCT 0x01 // Detecting -#define CDVD_TYPE_NODISC 0x00 // No Disc - -// CDVDgetTrayStatus returns: -#define CDVD_TRAY_CLOSE 0x00 -#define CDVD_TRAY_OPEN 0x01 - -// cdvdTD.type (track types for cds) -#define CDVD_AUDIO_TRACK 0x01 -#define CDVD_MODE1_TRACK 0x41 -#define CDVD_MODE2_TRACK 0x61 - -#define CDVD_AUDIO_MASK 0x00 -#define CDVD_DATA_MASK 0x40 -// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel) - -typedef void (*DEV9callback)(int cycles); -typedef int (*DEV9handler)(void); - -typedef void (*USBcallback)(int cycles); -typedef int (*USBhandler)(void); - -// freeze modes: -#define FREEZE_LOAD 0 -#define FREEZE_SAVE 1 -#define FREEZE_SIZE 2 - -typedef struct _GSdriverInfo { - char name[8]; - void *common; -} GSdriverInfo; - -#ifdef _WINDOWS_ -typedef struct _winInfo { // unsupported values must be set to zero - HWND hWnd; - HMENU hMenu; - HWND hStatusWnd; -} winInfo; -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* GS plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef GSdefs - -// basic funcs - -s32 CALLBACK GSinit(); -s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread); -void CALLBACK GSclose(); -void CALLBACK GSshutdown(); -void CALLBACK GSvsync(int field); -void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr); -void CALLBACK GSgifTransfer2(u32 *pMem, u32 size); -void CALLBACK GSgifTransfer3(u32 *pMem, u32 size); -void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits) -void CALLBACK GSgifSoftReset(u32 mask); -void CALLBACK GSreadFIFO(u64 *mem); -void CALLBACK GSreadFIFO2(u64 *mem, int qwc); - -// extended funcs - -// GSkeyEvent gets called when there is a keyEvent from the PAD plugin -void CALLBACK GSkeyEvent(keyEvent *ev); -void CALLBACK GSchangeSaveState(int, const char* filename); -void CALLBACK GSmakeSnapshot(char *path); -void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg); -void CALLBACK GSirqCallback(void (*callback)()); -void CALLBACK GSprintf(int timeout, char *fmt, ...); -void CALLBACK GSsetBaseMem(void*); -void CALLBACK GSsetGameCRC(int crc, int gameoptions); - -// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done -void CALLBACK GSsetFrameSkip(int frameskip); - -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK GSsetupRecording(int start, void* pData); - -void CALLBACK GSreset(); -void CALLBACK GSwriteCSR(u32 value); -void CALLBACK GSgetDriverInfo(GSdriverInfo *info); -#ifdef _WIN32 -s32 CALLBACK GSsetWindowInfo(winInfo *info); -#endif -s32 CALLBACK GSfreeze(int mode, freezeData *data); -void CALLBACK GSconfigure(); -void CALLBACK GSabout(); -s32 CALLBACK GStest(); - -#endif - -/* PAD plugin API -=[ OBSOLETE ]=- */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef PADdefs - -// basic funcs - -s32 CALLBACK PADinit(u32 flags); -s32 CALLBACK PADopen(void *pDsp); -void CALLBACK PADclose(); -void CALLBACK PADshutdown(); -// PADkeyEvent is called every vsync (return NULL if no event) -keyEvent* CALLBACK PADkeyEvent(); -u8 CALLBACK PADstartPoll(int pad); -u8 CALLBACK PADpoll(u8 value); -// returns: 1 if supported pad1 -// 2 if supported pad2 -// 3 if both are supported -u32 CALLBACK PADquery(); - -// call to give a hint to the PAD plugin to query for the keyboard state. A -// good plugin will query the OS for keyboard state ONLY in this function. -// This function is necessary when multithreading because otherwise -// the PAD plugin can get into deadlocks with the thread that really owns -// the window (and input). Note that PADupdate can be called from a different -// thread than the other functions, so mutex or other multithreading primitives -// have to be added to maintain data integrity. -void CALLBACK PADupdate(int pad); - -// extended funcs - -void CALLBACK PADgsDriverInfo(GSdriverInfo *info); -void CALLBACK PADconfigure(); -void CALLBACK PADabout(); -s32 CALLBACK PADtest(); - -#endif - -/* SIO plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SIOdefs - -// basic funcs - -s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f); -s32 CALLBACK SIOopen(void *pDsp); -void CALLBACK SIOclose(); -void CALLBACK SIOshutdown(); -u8 CALLBACK SIOstartPoll(u8 value); -u8 CALLBACK SIOpoll(u8 value); -// returns: SIO_TYPE_{PAD,MTAP,RM,MC} -u32 CALLBACK SIOquery(); - -// extended funcs - -void CALLBACK SIOconfigure(); -void CALLBACK SIOabout(); -s32 CALLBACK SIOtest(); - -#endif - -/* SPU2 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef SPU2defs - -// basic funcs - -s32 CALLBACK SPU2init(); -s32 CALLBACK SPU2open(void *pDsp); -void CALLBACK SPU2close(); -void CALLBACK SPU2shutdown(); -void CALLBACK SPU2write(u32 mem, u16 value); -u16 CALLBACK SPU2read(u32 mem); -void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size); -void CALLBACK SPU2interruptDMA4(); -void CALLBACK SPU2readDMA7Mem(u16* pMem, int size); -void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size); - -// all addresses passed by dma will be pointers to the array starting at baseaddr -// This function is necessary to successfully save and reload the spu2 state -void CALLBACK SPU2setDMABaseAddr(uptr baseaddr); - -void CALLBACK SPU2interruptDMA7(); -u32 CALLBACK SPU2ReadMemAddr(int core); -void CALLBACK SPU2WriteMemAddr(int core,u32 value); -void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); - -// extended funcs -// if start is 1, starts recording spu2 data, else stops -// returns a non zero value if successful -// for now, pData is not used -int CALLBACK SPU2setupRecording(int start, void* pData); - -void CALLBACK SPU2setClockPtr(u32* ptr); -void CALLBACK SPU2setTimeStretcher(short int enable); - -void CALLBACK SPU2async(u32 cycles); -s32 CALLBACK SPU2freeze(int mode, freezeData *data); -void CALLBACK SPU2configure(); -void CALLBACK SPU2about(); -s32 CALLBACK SPU2test(); - -#endif - -/* CDVD plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef CDVDdefs - -// basic funcs - -s32 CALLBACK CDVDinit(); -s32 CALLBACK CDVDopen(const char* pTitleFilename); -void CALLBACK CDVDclose(); -void CALLBACK CDVDshutdown(); -s32 CALLBACK CDVDreadTrack(u32 lsn, int mode); - -// return can be NULL (for async modes) -u8* CALLBACK CDVDgetBuffer(); - -s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data) -s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information -s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type -s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc -s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx -s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx -s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray -s32 CALLBACK CDVDctrlTrayClose(); //close disc tray - -// extended funcs - -void CALLBACK CDVDconfigure(); -void CALLBACK CDVDabout(); -s32 CALLBACK CDVDtest(); -void CALLBACK CDVDnewDiskCB(void (*callback)()); - -#endif - -/* DEV9 plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef DEV9defs - -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK DEV9init(); -s32 CALLBACK DEV9open(void *pDsp); -void CALLBACK DEV9close(); -void CALLBACK DEV9shutdown(); -u8 CALLBACK DEV9read8(u32 addr); -u16 CALLBACK DEV9read16(u32 addr); -u32 CALLBACK DEV9read32(u32 addr); -void CALLBACK DEV9write8(u32 addr, u8 value); -void CALLBACK DEV9write16(u32 addr, u16 value); -void CALLBACK DEV9write32(u32 addr, u32 value); -void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size); -void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size); -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK DEV9irqCallback(DEV9callback callback); -DEV9handler CALLBACK DEV9irqHandler(void); - -// extended funcs - -s32 CALLBACK DEV9freeze(int mode, freezeData *data); -void CALLBACK DEV9configure(); -void CALLBACK DEV9about(); -s32 CALLBACK DEV9test(); - -#endif - -/* USB plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef USBdefs - -// basic funcs - -s32 CALLBACK USBinit(); -s32 CALLBACK USBopen(void *pDsp); -void CALLBACK USBclose(); -void CALLBACK USBshutdown(); -u8 CALLBACK USBread8(u32 addr); -u16 CALLBACK USBread16(u32 addr); -u32 CALLBACK USBread32(u32 addr); -void CALLBACK USBwrite8(u32 addr, u8 value); -void CALLBACK USBwrite16(u32 addr, u16 value); -void CALLBACK USBwrite32(u32 addr, u32 value); -void CALLBACK USBasync(u32 cycles); - -// cycles = IOP cycles before calling callback, -// if callback returns 1 the irq is triggered, else not -void CALLBACK USBirqCallback(USBcallback callback); -USBhandler CALLBACK USBirqHandler(void); -void CALLBACK USBsetRAM(void *mem); - -// extended funcs - -s32 CALLBACK USBfreeze(int mode, freezeData *data); -void CALLBACK USBconfigure(); -void CALLBACK USBabout(); -s32 CALLBACK USBtest(); - -#endif - -/* FW plugin API */ - -// if this file is included with this define -// the next api will not be skipped by the compiler -#ifdef FWdefs -// basic funcs - -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -s32 CALLBACK FWinit(); -s32 CALLBACK FWopen(void *pDsp); -void CALLBACK FWclose(); -void CALLBACK FWshutdown(); -u32 CALLBACK FWread32(u32 addr); -void CALLBACK FWwrite32(u32 addr, u32 value); -void CALLBACK FWirqCallback(void (*callback)()); - -// extended funcs - -s32 CALLBACK FWfreeze(int mode, freezeData *data); -void CALLBACK FWconfigure(); -void CALLBACK FWabout(); -s32 CALLBACK FWtest(); -#endif - -// might be useful for emulators -#ifdef PLUGINtypedefs - -typedef u32 (CALLBACK* _PS2EgetLibType)(void); -typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type); -typedef char*(CALLBACK* _PS2EgetLibName)(void); - -// GS -// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _GSinit)(); -typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread); -typedef void (CALLBACK* _GSclose)(); -typedef void (CALLBACK* _GSshutdown)(); -typedef void (CALLBACK* _GSvsync)(int field); -typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr); -typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size); -typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits) -typedef void (CALLBACK* _GSgifSoftReset)(u32 mask); -typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem); -typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc); - -typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev); -typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename); -typedef void (CALLBACK* _GSirqCallback)(void (*callback)()); -typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...); -typedef void (CALLBACK* _GSsetBaseMem)(void*); -typedef void (CALLBACK* _GSsetGameCRC)(int, int); -typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip); -typedef int (CALLBACK* _GSsetupRecording)(int, void*); -typedef void (CALLBACK* _GSreset)(); -typedef void (CALLBACK* _GSwriteCSR)(u32 value); -typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info); -#ifdef _WINDOWS_ -typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info); -#endif -typedef void (CALLBACK* _GSmakeSnapshot)(const char *path); -typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int); -typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _GSconfigure)(); -typedef s32 (CALLBACK* _GStest)(); -typedef void (CALLBACK* _GSabout)(); - -// PAD -typedef s32 (CALLBACK* _PADinit)(u32 flags); -typedef s32 (CALLBACK* _PADopen)(void *pDsp); -typedef void (CALLBACK* _PADclose)(); -typedef void (CALLBACK* _PADshutdown)(); -typedef keyEvent* (CALLBACK* _PADkeyEvent)(); -typedef u8 (CALLBACK* _PADstartPoll)(int pad); -typedef u8 (CALLBACK* _PADpoll)(u8 value); -typedef u32 (CALLBACK* _PADquery)(); -typedef void (CALLBACK* _PADupdate)(int pad); - -typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info); -typedef void (CALLBACK* _PADconfigure)(); -typedef s32 (CALLBACK* _PADtest)(); -typedef void (CALLBACK* _PADabout)(); - -// SIO -typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f); -typedef s32 (CALLBACK* _SIOopen)(void *pDsp); -typedef void (CALLBACK* _SIOclose)(); -typedef void (CALLBACK* _SIOshutdown)(); -typedef u8 (CALLBACK* _SIOstartPoll)(u8 value); -typedef u8 (CALLBACK* _SIOpoll)(u8 value); -typedef u32 (CALLBACK* _SIOquery)(); - -typedef void (CALLBACK* _SIOconfigure)(); -typedef s32 (CALLBACK* _SIOtest)(); -typedef void (CALLBACK* _SIOabout)(); - -// SPU2 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _SPU2init)(); -typedef s32 (CALLBACK* _SPU2open)(void *pDsp); -typedef void (CALLBACK* _SPU2close)(); -typedef void (CALLBACK* _SPU2shutdown)(); -typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value); -typedef u16 (CALLBACK* _SPU2read)(u32 mem); -typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2interruptDMA4)(); -typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size); -typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr); -typedef void (CALLBACK* _SPU2interruptDMA7)(); -typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)()); -typedef int (CALLBACK* _SPU2setupRecording)(int, void*); - -typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr); -typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable); - -typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core); -typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value); -typedef void (CALLBACK* _SPU2async)(u32 cycles); -typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _SPU2configure)(); -typedef s32 (CALLBACK* _SPU2test)(); -typedef void (CALLBACK* _SPU2about)(); - - -// CDVD -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _CDVDinit)(); -typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename); -typedef void (CALLBACK* _CDVDclose)(); -typedef void (CALLBACK* _CDVDshutdown)(); -typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode); -typedef u8* (CALLBACK* _CDVDgetBuffer)(); -typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq); -typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer); -typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer); -typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc); -typedef s32 (CALLBACK* _CDVDgetDiskType)(); -typedef s32 (CALLBACK* _CDVDgetTrayStatus)(); -typedef s32 (CALLBACK* _CDVDctrlTrayOpen)(); -typedef s32 (CALLBACK* _CDVDctrlTrayClose)(); - -typedef void (CALLBACK* _CDVDconfigure)(); -typedef s32 (CALLBACK* _CDVDtest)(); -typedef void (CALLBACK* _CDVDabout)(); -typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)()); - -// DEV9 -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _DEV9init)(); -typedef s32 (CALLBACK* _DEV9open)(void *pDsp); -typedef void (CALLBACK* _DEV9close)(); -typedef void (CALLBACK* _DEV9shutdown)(); -typedef u8 (CALLBACK* _DEV9read8)(u32 mem); -typedef u16 (CALLBACK* _DEV9read16)(u32 mem); -typedef u32 (CALLBACK* _DEV9read32)(u32 mem); -typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value); -typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value); -typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value); -typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size); -typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback); -typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void); - -typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data); -typedef void (CALLBACK* _DEV9configure)(); -typedef s32 (CALLBACK* _DEV9test)(); -typedef void (CALLBACK* _DEV9about)(); - -// USB -// NOTE: The read/write functions CANNOT use XMM/MMX regs -// If you want to use them, need to save and restore current ones -typedef s32 (CALLBACK* _USBinit)(); -typedef s32 (CALLBACK* _USBopen)(void *pDsp); -typedef void (CALLBACK* _USBclose)(); -typedef void (CALLBACK* _USBshutdown)(); -typedef u8 (CALLBACK* _USBread8)(u32 mem); -typedef u16 (CALLBACK* _USBread16)(u32 mem); -typedef u32 (CALLBACK* _USBread32)(u32 mem); -typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value); -typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value); -typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _USBasync)(u32 cycles); - - -typedef void (CALLBACK* _USBirqCallback)(USBcallback callback); -typedef USBhandler (CALLBACK* _USBirqHandler)(void); -typedef void (CALLBACK* _USBsetRAM)(void *mem); - -typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _USBconfigure)(); -typedef s32 (CALLBACK* _USBtest)(); -typedef void (CALLBACK* _USBabout)(); - -//FW -typedef s32 (CALLBACK* _FWinit)(); -typedef s32 (CALLBACK* _FWopen)(void *pDsp); -typedef void (CALLBACK* _FWclose)(); -typedef void (CALLBACK* _FWshutdown)(); -typedef u32 (CALLBACK* _FWread32)(u32 mem); -typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value); -typedef void (CALLBACK* _FWirqCallback)(void (*callback)()); - -typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data); -typedef void (CALLBACK* _FWconfigure)(); -typedef s32 (CALLBACK* _FWtest)(); -typedef void (CALLBACK* _FWabout)(); - -#endif - -#ifdef PLUGINfuncs - -// GS -extern _GSinit GSinit; -extern _GSopen GSopen; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; -extern _GSvsync GSvsync; -extern _GSgifTransfer1 GSgifTransfer1; -extern _GSgifTransfer2 GSgifTransfer2; -extern _GSgifTransfer3 GSgifTransfer3; -extern _GSgetLastTag GSgetLastTag; -extern _GSgifSoftReset GSgifSoftReset; -extern _GSreadFIFO GSreadFIFO; -extern _GSreadFIFO2 GSreadFIFO2; - -extern _GSkeyEvent GSkeyEvent; -extern _GSchangeSaveState GSchangeSaveState; -extern _GSmakeSnapshot GSmakeSnapshot; -extern _GSmakeSnapshot2 GSmakeSnapshot2; -extern _GSirqCallback GSirqCallback; -extern _GSprintf GSprintf; -extern _GSsetBaseMem GSsetBaseMem; -extern _GSsetGameCRC GSsetGameCRC; -extern _GSsetFrameSkip GSsetFrameSkip; -extern _GSsetupRecording GSsetupRecording; -extern _GSreset GSreset; -extern _GSwriteCSR GSwriteCSR; -extern _GSgetDriverInfo GSgetDriverInfo; -#ifdef _WINDOWS_ -extern _GSsetWindowInfo GSsetWindowInfo; -#endif -extern _GSfreeze GSfreeze; -extern _GSconfigure GSconfigure; -extern _GStest GStest; -extern _GSabout GSabout; - -// PAD1 -extern _PADinit PAD1init; -extern _PADopen PAD1open; -extern _PADclose PAD1close; -extern _PADshutdown PAD1shutdown; -extern _PADkeyEvent PAD1keyEvent; -extern _PADstartPoll PAD1startPoll; -extern _PADpoll PAD1poll; -extern _PADquery PAD1query; -extern _PADupdate PAD1update; - -extern _PADgsDriverInfo PAD1gsDriverInfo; -extern _PADconfigure PAD1configure; -extern _PADtest PAD1test; -extern _PADabout PAD1about; - -// PAD2 -extern _PADinit PAD2init; -extern _PADopen PAD2open; -extern _PADclose PAD2close; -extern _PADshutdown PAD2shutdown; -extern _PADkeyEvent PAD2keyEvent; -extern _PADstartPoll PAD2startPoll; -extern _PADpoll PAD2poll; -extern _PADquery PAD2query; -extern _PADupdate PAD2update; - -extern _PADgsDriverInfo PAD2gsDriverInfo; -extern _PADconfigure PAD2configure; -extern _PADtest PAD2test; -extern _PADabout PAD2about; - -// SIO[2] -extern _SIOinit SIOinit[2][9]; -extern _SIOopen SIOopen[2][9]; -extern _SIOclose SIOclose[2][9]; -extern _SIOshutdown SIOshutdown[2][9]; -extern _SIOstartPoll SIOstartPoll[2][9]; -extern _SIOpoll SIOpoll[2][9]; -extern _SIOquery SIOquery[2][9]; - -extern _SIOconfigure SIOconfigure[2][9]; -extern _SIOtest SIOtest[2][9]; -extern _SIOabout SIOabout[2][9]; - -// SPU2 -extern _SPU2init SPU2init; -extern _SPU2open SPU2open; -extern _SPU2close SPU2close; -extern _SPU2shutdown SPU2shutdown; -extern _SPU2write SPU2write; -extern _SPU2read SPU2read; -extern _SPU2readDMA4Mem SPU2readDMA4Mem; -extern _SPU2writeDMA4Mem SPU2writeDMA4Mem; -extern _SPU2interruptDMA4 SPU2interruptDMA4; -extern _SPU2readDMA7Mem SPU2readDMA7Mem; -extern _SPU2writeDMA7Mem SPU2writeDMA7Mem; -extern _SPU2setDMABaseAddr SPU2setDMABaseAddr; -extern _SPU2interruptDMA7 SPU2interruptDMA7; -extern _SPU2ReadMemAddr SPU2ReadMemAddr; -extern _SPU2setupRecording SPU2setupRecording; -extern _SPU2WriteMemAddr SPU2WriteMemAddr; -extern _SPU2irqCallback SPU2irqCallback; - -extern _SPU2setClockPtr SPU2setClockPtr; -extern _SPU2setTimeStretcher SPU2setTimeStretcher; - -extern _SPU2async SPU2async; -extern _SPU2freeze SPU2freeze; -extern _SPU2configure SPU2configure; -extern _SPU2test SPU2test; -extern _SPU2about SPU2about; - -// CDVD -extern _CDVDinit CDVDinit; -extern _CDVDopen CDVDopen; -extern _CDVDclose CDVDclose; -extern _CDVDshutdown CDVDshutdown; -extern _CDVDreadTrack CDVDreadTrack; -extern _CDVDgetBuffer CDVDgetBuffer; -extern _CDVDreadSubQ CDVDreadSubQ; -extern _CDVDgetTN CDVDgetTN; -extern _CDVDgetTD CDVDgetTD; -extern _CDVDgetTOC CDVDgetTOC; -extern _CDVDgetDiskType CDVDgetDiskType; -extern _CDVDgetTrayStatus CDVDgetTrayStatus; -extern _CDVDctrlTrayOpen CDVDctrlTrayOpen; -extern _CDVDctrlTrayClose CDVDctrlTrayClose; - -extern _CDVDconfigure CDVDconfigure; -extern _CDVDtest CDVDtest; -extern _CDVDabout CDVDabout; -extern _CDVDnewDiskCB CDVDnewDiskCB; - -// DEV9 -extern _DEV9init DEV9init; -extern _DEV9open DEV9open; -extern _DEV9close DEV9close; -extern _DEV9shutdown DEV9shutdown; -extern _DEV9read8 DEV9read8; -extern _DEV9read16 DEV9read16; -extern _DEV9read32 DEV9read32; -extern _DEV9write8 DEV9write8; -extern _DEV9write16 DEV9write16; -extern _DEV9write32 DEV9write32; -extern _DEV9readDMA8Mem DEV9readDMA8Mem; -extern _DEV9writeDMA8Mem DEV9writeDMA8Mem; -extern _DEV9irqCallback DEV9irqCallback; -extern _DEV9irqHandler DEV9irqHandler; - -extern _DEV9configure DEV9configure; -extern _DEV9freeze DEV9freeze; -extern _DEV9test DEV9test; -extern _DEV9about DEV9about; - -// USB -extern _USBinit USBinit; -extern _USBopen USBopen; -extern _USBclose USBclose; -extern _USBshutdown USBshutdown; -extern _USBread8 USBread8; -extern _USBread16 USBread16; -extern _USBread32 USBread32; -extern _USBwrite8 USBwrite8; -extern _USBwrite16 USBwrite16; -extern _USBwrite32 USBwrite32; -extern _USBasync USBasync; - -extern _USBirqCallback USBirqCallback; -extern _USBirqHandler USBirqHandler; -extern _USBsetRAM USBsetRAM; - -extern _USBconfigure USBconfigure; -extern _USBfreeze USBfreeze; -extern _USBtest USBtest; -extern _USBabout USBabout; - -// FW -extern _FWinit FWinit; -extern _FWopen FWopen; -extern _FWclose FWclose; -extern _FWshutdown FWshutdown; -extern _FWread32 FWread32; -extern _FWwrite32 FWwrite32; -extern _FWirqCallback FWirqCallback; - -extern _FWconfigure FWconfigure; -extern _FWfreeze FWfreeze; -extern _FWtest FWtest; -extern _FWabout FWabout; -#endif - -#ifdef __cplusplus -} // End extern "C" -#endif - -#endif /* __PS2EDEFS_H__ */ diff --git a/plugins/zerospu2/common/PS2Etypes.h b/plugins/zerospu2/common/PS2Etypes.h deleted file mode 100644 index 4c62b47f0f..0000000000 --- a/plugins/zerospu2/common/PS2Etypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/* Pcsx2 - Pc Ps2 Emulator - * Copyright (C) 2002-2008 Pcsx2 Team - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef __PS2ETYPES_H__ -#define __PS2ETYPES_H__ - -#if defined (__linux__) && !defined(__LINUX__) // some distributions are lower case -#define __LINUX__ -#endif - -#ifdef __CYGWIN__ -#define __LINUX__ -#endif - -#ifndef ARRAYSIZE -#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifdef __LINUX__ -#define CALLBACK -#else -#define CALLBACK __stdcall -#endif - - -// jASSUME - give hints to the optimizer -// This is primarily useful for the default case switch optimizer, which enables VC to -// generate more compact switches. - -#ifdef NDEBUG -# define jBREAKPOINT() ((void) 0) -# ifdef _MSC_VER -# define jASSUME(exp) (__assume(exp)) -# else -# define jASSUME(exp) ((void) sizeof(exp)) -# endif -#else -# if defined(_MSC_VER) -# define jBREAKPOINT() do { __asm int 3 } while(0) -# else -# define jBREAKPOINT() ((void) *(volatile char *) 0) -# endif -# define jASSUME(exp) if(exp) ; else jBREAKPOINT() -#endif - -// disable the default case in a switch -#define jNO_DEFAULT \ -{ \ - break; \ - \ -default: \ - jASSUME(0); \ - break; \ -} - - -// Basic types -#if defined(_MSC_VER) - -typedef __int8 s8; -typedef __int16 s16; -typedef __int32 s32; -typedef __int64 s64; - -typedef unsigned __int8 u8; -typedef unsigned __int16 u16; -typedef unsigned __int32 u32; -typedef unsigned __int64 u64; - -typedef unsigned int uint; - -#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x -#define PCSX2_ALIGNED16(x) __declspec(align(16)) x -#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x - -#define __naked __declspec(naked) - -#else // _MSC_VER - -#ifdef __LINUX__ - -#ifdef HAVE_STDINT_H -#include "stdint.h" - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef uintptr_t uptr; -typedef intptr_t sptr; - -#else // HAVE_STDINT_H - -typedef char s8; -typedef short s16; -typedef int s32; -typedef long long s64; - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -#endif // HAVE_STDINT_H - -typedef unsigned int uint; - -#define LONG long -typedef union _LARGE_INTEGER -{ - long long QuadPart; -} LARGE_INTEGER; - -#define __fastcall __attribute__((fastcall)) -#define __unused __attribute__((unused)) -#define _inline __inline__ __attribute__((unused)) -#define __forceinline __attribute__((always_inline,unused)) -#define __naked // GCC lacks the naked specifier - -#endif // __LINUX__ - -#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig))) -#define PCSX2_ALIGNED16(x) x __attribute((aligned(16))) - -#define PCSX2_ALIGNED16_DECL(x) x - -#endif // _MSC_VER - -#if !defined(__LINUX__) || !defined(HAVE_STDINT_H) -#if defined(__x86_64__) -typedef u64 uptr; -typedef s64 sptr; -#else -typedef u32 uptr; -typedef s32 sptr; -#endif -#endif - -// A rough-and-ready cross platform 128-bit datatype, Non-SSE style. -#ifdef __cplusplus -struct u128 -{ - u64 lo; - u64 hi; - - // Implicit conversion from u64 - u128( u64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - u128( u32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -struct s128 -{ - s64 lo; - s64 hi; - - // Implicit conversion from u64 - s128( s64 src ) : - lo( src ) - , hi( 0 ) {} - - // Implicit conversion from u32 - s128( s32 src ) : - lo( src ) - , hi( 0 ) {} -}; - -#else - -typedef union _u128_t -{ - u64 lo; - u64 hi; -} u128; - -typedef union _s128_t -{ - s64 lo; - s64 hi; -} s128; - -#endif - -typedef struct { - int size; - s8 *data; -} freezeData; - -/* common defines */ -#ifndef C_ASSERT -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] -#endif - -#endif /* __PS2ETYPES_H__ */